[Debconf-devel] Bug#983425: debconf: please add support for DPKG_ROOT

Johannes 'josch' Schauer josch at debian.org
Wed Feb 24 00:44:00 GMT 2021


Package: debconf
Version: 1.5.74
Severity: wishlist
Tags: patch
User: debian-dpkg at lists.debian.org
Usertags: dpkg-root-support

Hi,

since dpkg 1.18.5, dpkg sets the variable DPKG_ROOT when invoking
maintainer scripts. Usually that variable is empty but when calling dpkg
with --root and --force-script-chrootless, dpkg will set DPKG_ROOT to
the new root directory. In that mode, maintainer scripts are called
without chroot(1) around them, and thus have to be able to possibly
operate on the path from DPKG_ROOT instead of working on /. This is
useful for bootstrapping, creating chroots for foreign architectures
where utilities from inside the chroot cannot be executed, avoiding
dependency loops between postinst scripts, installation without
requiring superuser privileges and for creating installations that do
not even contain dpkg. See
https://wiki.debian.org/Teams/Dpkg/Spec/InstallBootstrap for more
information.

Currently, missing support for DPKG_ROOT in debconf is the single
biggest blocker in making all Essential:yes packages successfully
install with --root and --force-script-chrootless. Me and Helmut Grohne
happened to work on adding DPKG_ROOT support to debconf at the same
time, so now we have two patches which both work.

helmut: https://salsa.debian.org/josch/debconf/-/commit/4336c589fd6cb25e20f1753986bc86a74b668846

josch: https://salsa.debian.org/josch/debconf/-/commit/b84d965da3c56f33fed7e4f0899bc21c34578fcd

Could you review either and give us feedback so that we can prepare a
patch that is fit for inclusion into debconf?

To try it out, you have to install the changed debconf package directly
on your machine and *not* into the chroot, because in chrootless mode,
the maintainer script will call the tools as they are installed on the
machine running it. You can see how it currently fails by running:

mmdebstrap --mode=chrootless --variant=custom --include=debconf unstable /dev/null
[...]
Setting up debconf (1.5.74) ...
debconf: DbDriver "passwords" warning: could not open /var/cache/debconf/passwords.dat: Permission denied
debconf: DbDriver "config": could not write /var/cache/debconf/config.dat-new: Permission denied
dpkg: error processing package debconf (--configure):
 installed debconf package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 debconf
E: Sub-process /usr/bin/dpkg returned an error code (1)

However, with the changes from above commits, the command will succeed.

Thanks!

cheers, josch



More information about the Debconf-devel mailing list