[Bug 2036195] Re: Any packages installed in binary hooks are marked as manually installed - even dependencies
Philip Roche
2036195 at bugs.launchpad.net
Mon Dec 11 17:31:26 UTC 2023
I have created test images for focal, jammy and lunar using this
proposed package.
This is easiest to test using a GCE image build where image build
removes fwupd, fwupd-signed, bolt, libarchive13 and irqbalance which
then leaves a long list of package autoremovable.
```
Remv jq [1.6-2.1ubuntu3]
Remv libatasmart4 [0.19-5build2]
Remv libblockdev-fs3 [3.0.2-3]
Remv libblockdev-loop3 [3.0.2-3]
Remv libblockdev-nvme3 [3.0.2-3]
Remv libblockdev-part3 [3.0.2-3]
Remv libblockdev-swap3 [3.0.2-3]
Remv libblockdev3 [3.0.2-3]
Remv libblockdev-utils3 [3.0.2-3]
Remv libflashrom1 [1.3.0-2.1ubuntu1]
Remv libftdi1-2 [1.5-6build2]
Remv libjq1 [1.6-2.1ubuntu3]
Remv libqmi-proxy [1.32.4-2ubuntu1]
Remv libqmi-glib5 [1.32.4-2ubuntu1]
Remv libmbim-utils [1.28.4-2]
Remv libmbim-glib4 [1.28.4-2] [libmbim-proxy:amd64 ]
Remv libmbim-proxy [1.28.4-2]
Remv libmm-glib0 [1.20.6-1ubuntu1]
Remv libnss3 [2:3.92-1]
Remv libnspr4 [2:4.35-1.1]
Remv libnuma1 [2.0.16-1]
Remv libonig5 [6.9.8-2]
Remv libprotobuf-c1 [1.4.1-1ubuntu2]
Remv usb-modeswitch [2.6.1-3ubuntu2]
Remv tcl [8.6.13]
Remv tcl8.6 [8.6.13+dfsg-2]
Remv libtcl8.6 [8.6.13+dfsg-2]
Remv libudisks2-0 [2.10.0-3ubuntu2]
Remv usb-modeswitch-data [20191128-5]
```
Using the proposed packages I can confirm that after calling `apt-get -y
autoremove --purge` that these packages are no longer present in the
image or the package manifest for the image.
Marking verification-done
** Tags removed: verification-needed verification-needed-focal verification-needed-jammy verification-needed-lunar
** Tags added: verification-done verification-done-focal verification-done-jammy verification-done-lunar
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to livecd-rootfs in Ubuntu.
https://bugs.launchpad.net/bugs/2036195
Title:
Any packages installed in binary hooks are marked as manually
installed - even dependencies
Status in livecd-rootfs package in Ubuntu:
Fix Released
Status in livecd-rootfs source package in Xenial:
Fix Released
Status in livecd-rootfs source package in Bionic:
Fix Released
Status in livecd-rootfs source package in Focal:
Fix Committed
Status in livecd-rootfs source package in Jammy:
Fix Committed
Status in livecd-rootfs source package in Lunar:
Fix Committed
Bug description:
After much debugging trying to understand why `apt-get autoremove` was
not working in a binary hook I realised that all packages installed in
a binary hook are marked as manually installed - even the dependencies
of packages. This is a bug.
Another side affect of this is that any dependency of a package in the
base chroot that is removed in a binary hook is not autoremovable in
the binary hook.
It is autoremovable once the image is created and launched though.
This is due to how the `setup_mountpoint` function works (see
https://git.launchpad.net/livecd-rootfs/tree/live-
build/functions#n123) specifically
```
mount -t tmpfs none "$mountpoint/var/lib/apt"
```
Which means that inside the chroot that the binary hook works on, the
`/var/lib/apt` directory is empty... including the
`/var/lib/apt/extended_states` file which is used to store whether a
package was auto installed or not.
The same goes the other way - any changes to the
`/var/lib/apt/extended_states` file inside chroot that the binary
hook is changing are not reflected in the final image due to the
`teardown_mountpoint` (see https://git.launchpad.net/livecd-
rootfs/tree/live-build/functions#n152) not persisting any of those
changes.
The end result being.
* If a package is removed in the binary hook then the resulting image will likely have autoremovable packages at first launch
* Any package and their dependencies installed in a binary hook will all be marked as manually installed.
SRU
====
[ Impact ]
* Packages installed in a binary hook are marked as manually
installed - even the dependencies of packages
[ Test Plan ]
* Build test images and remove a package with dependencies.
* Confirm that the dependencies are marked as autoremovable.
* Confirm there are packages marked as auto installed
[ Where problems could occur ]
* Is any dependent packages are not marked as autremovable.
* If no packages are marked as auto installed
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/livecd-rootfs/+bug/2036195/+subscriptions
More information about the foundations-bugs
mailing list