What do you think? Is this the right solution to the problem? A few more bits about DPKG_ROOT as well as alternative solution proposals (including rejected ones) can be found on this wiki page:
https://wiki.debian.org/Teams/Dpkg/Spec/InstallBootstrap#Proposal:_chrootless_maintscripts
So lets come back to our question of scope: Right now, our DPKG_ROOT patches are limited to Essential:yes, build-essential, apt and systemd. We also restrict the mechanism to initial installations only and upgrades are not supported. We also currently require that the system (and its tools) on the outside must be the same as the chroot that is being created with DPKG_ROOT. As
far as enabling very early architecture bootstrap goes, this solves the problem.
So what do you think? Is this okay? Is there a better solution?
Johannes Schauer Marin Rodrigues wrote:
What do you think? Is this the right solution to the problem? A few more bits
about DPKG_ROOT as well as alternative solution proposals (including rejected
ones) can be found on this wiki page:
https://wiki.debian.org/Teams/Dpkg/Spec/InstallBootstrap#Proposal:_chrootless_maintscripts
So lets come back to our question of scope: Right now, our DPKG_ROOT patches
are limited to Essential:yes, build-essential, apt and systemd. We also restrict the mechanism to initial installations only and upgrades are not supported. We also currently require that the system (and its tools) on the outside must be the same as the chroot that is being created with DPKG_ROOT. As
far as enabling very early architecture bootstrap goes, this solves the problem.
So what do you think? Is this okay? Is there a better solution?
So, first of all, I'm thrilled to see work on improving bootstrapping
and cross-bootstrapping. I'm also thrilled to see DPKG_ROOT being
discussed more broadly.
Regarding the specific solution: the DPKG_ROOT approach has concerned me since it was introduced, because maintainer scripts run as root, so a
bug in one package's DPKG_ROOT support (let alone the absence of
DPKG_ROOT support) would result in modifying the host system rather than the target chroot.
I would love to see the DPKG_ROOT support augmented with `unshare`, a mount namespace, a UID namespace, and a chroot, such that:
- The host filesystem is bind-mounted read-only.
- Host devices are not available (only a minimal /dev); this will also
help ensure bootstraps don't depend on any aspect of the host system.
- The maintainer scripts run as container-root, but not as host-root, so
that they can't accidentally change any aspect of the host.
This could still make use of the existing DPKG_ROOT support; this would
be completely transparent to the maintainer scripts and tools ported
thus far.
This would also allow bootstrapping as non-root, on systems that allow creating UID namespaces as non-root.
As a bonus, testsuites could use an overlayfs instead of a read-only
bind mount, and then check afterwards if *any* changes occurred in the overlay, which would be a test failure.
Does that seem like a reasonable addition to the DPKG_ROOT support?
Johannes Schauer Marin Rodrigues wrote:
What do you think? Is this the right solution to the problem? A few more bits
about DPKG_ROOT as well as alternative solution proposals (including rejected
ones) can be found on this wiki page:
https://wiki.debian.org/Teams/Dpkg/Spec/InstallBootstrap#Proposal:_chrootless_maintscripts
So lets come back to our question of scope: Right now, our DPKG_ROOT patches
are limited to Essential:yes, build-essential, apt and systemd. We also restrict the mechanism to initial installations only and upgrades are not supported. We also currently require that the system (and its tools) on the outside must be the same as the chroot that is being created with DPKG_ROOT. As
far as enabling very early architecture bootstrap goes, this solves the problem.
So what do you think? Is this okay? Is there a better solution?
So, first of all, I'm thrilled to see work on improving bootstrapping
and cross-bootstrapping. I'm also thrilled to see DPKG_ROOT being
discussed more broadly.
Regarding the specific solution: the DPKG_ROOT approach has concerned me since it was introduced, because maintainer scripts run as root, so a
bug in one package's DPKG_ROOT support (let alone the absence of
DPKG_ROOT support) would result in modifying the host system rather than
the target chroot.
I would love to see the DPKG_ROOT support augmented with `unshare`, a
mount namespace, a UID namespace, and a chroot, such that:
- The host filesystem is bind-mounted read-only.
- Host devices are not available (only a minimal /dev); this will also
help ensure bootstraps don't depend on any aspect of the host system.
- The maintainer scripts run as container-root, but not as host-root, so
that they can't accidentally change any aspect of the host.
This could still make use of the existing DPKG_ROOT support; this would
be completely transparent to the maintainer scripts and tools ported
thus far.
This would also allow bootstrapping as non-root, on systems that allow creating UID namespaces as non-root.
As a bonus, testsuites could use an overlayfs instead of a read-only
bind mount, and then check afterwards if *any* changes occurred in the overlay, which would be a test failure.
Does that seem like a reasonable addition to the DPKG_ROOT support?
in 2016 we filed our first DPKG_ROOT patch #824594 against
base-files. The dpkg version at the time just had included support for
the DPKG_ROOT variable being set for maintainer scripts and we were
excited to try out this new feature for creating foreign architecture chroots. At the time we thought that no discussion on d-devel was
necessary before filing the bug because we knew only 10 source packages
had to add DPKG_ROOT to their maintainer scripts and because doing so
would not affect any normal installation.
Johannes Schauer Marin Rodrigues <josch@debian.org> writes:
in 2016 we filed our first DPKG_ROOT patch #824594 against
base-files. The dpkg version at the time just had included support for
the DPKG_ROOT variable being set for maintainer scripts and we were
excited to try out this new feature for creating foreign architecture chroots. At the time we thought that no discussion on d-devel was
necessary before filing the bug because we knew only 10 source packages
had to add DPKG_ROOT to their maintainer scripts and because doing so
would not affect any normal installation.
[...]
Thank you for this excellent write-up!
This is exactly the type of fairly obscure Debian lore that, although it
only affects a small number of packages, is worth documenting because it
can be very difficult to understand otherwise why it's present or to debug problems caused by accidentally breaking it.
I would therefore love to see this documented in Policy. The
documentation doesn't have to be long, but even though this only affects a small handful of packages used during early bootstrapping, I think we
should write it down somewhere official so that we have a record of what we're doing and how it's supposed to work (and what packages need to care about it).
If possible, could you write up a brief description along those lines and open a bug against debian-policy with that description? We can then
figure out where to put it in the document.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 463 |
Nodes: | 16 (2 / 14) |
Uptime: | 156:05:46 |
Calls: | 9,384 |
Calls today: | 4 |
Files: | 13,561 |
Messages: | 6,095,837 |