Any packages installed in binary hooks are marked as manually installed - even dependencies

Bug #2036195 reported by Philip Roche
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
livecd-rootfs (Ubuntu)
Fix Released
Undecided
Philip Roche
Xenial
Fix Committed
Undecided
Philip Roche
Bionic
Fix Committed
Undecided
Philip Roche
Focal
Fix Committed
Undecided
Philip Roche
Jammy
Fix Committed
Undecided
Philip Roche
Lunar
Fix Committed
Undecided
Philip Roche

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

Related branches

Changed in livecd-rootfs (Ubuntu):
status: New → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package livecd-rootfs - 23.10.39

---------------
livecd-rootfs (23.10.39) mantic; urgency=medium

  * The chroot tmpfs mount should only be /var/lib/apt/lists, not
    /var/lib/apt; the latter breaks changes to /var/lib/apt/extended_states.
    LP: #2036195.

 -- Steve Langasek <email address hidden> Mon, 18 Sep 2023 15:06:23 -0700

Changed in livecd-rootfs (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Philip Roche (philroche) wrote :

This fix will need to be backported all the way back to xenial's version of livecd-rootfs. Can you update the bug metadata/Affects to reflect this?

Revision history for this message
Steve Langasek (vorlon) wrote :

Done, but note that the bug state does not actually have to be adjusted prior to SRU upload.

Philip Roche (philroche)
Changed in livecd-rootfs (Ubuntu Xenial):
assignee: nobody → Philip Roche (philroche)
Changed in livecd-rootfs (Ubuntu Bionic):
assignee: nobody → Philip Roche (philroche)
Changed in livecd-rootfs (Ubuntu Focal):
assignee: nobody → Philip Roche (philroche)
Changed in livecd-rootfs (Ubuntu Jammy):
assignee: nobody → Philip Roche (philroche)
Changed in livecd-rootfs (Ubuntu Lunar):
assignee: nobody → Philip Roche (philroche)
Changed in livecd-rootfs (Ubuntu Xenial):
status: New → Confirmed
Changed in livecd-rootfs (Ubuntu Bionic):
status: New → Confirmed
Changed in livecd-rootfs (Ubuntu Focal):
status: New → Confirmed
Changed in livecd-rootfs (Ubuntu Jammy):
status: New → Confirmed
Changed in livecd-rootfs (Ubuntu Lunar):
status: New → Confirmed
Philip Roche (philroche)
description: updated
Revision history for this message
Philip Roche (philroche) wrote :
Changed in livecd-rootfs (Ubuntu Lunar):
status: Confirmed → Fix Committed
Revision history for this message
Philip Roche (philroche) wrote :
Changed in livecd-rootfs (Ubuntu Jammy):
status: Confirmed → Fix Committed
Revision history for this message
Philip Roche (philroche) wrote :
Changed in livecd-rootfs (Ubuntu Focal):
status: Confirmed → Fix Committed
Revision history for this message
Philip Roche (philroche) wrote :
Changed in livecd-rootfs (Ubuntu Bionic):
status: Confirmed → Fix Committed
Revision history for this message
Philip Roche (philroche) wrote :
Changed in livecd-rootfs (Ubuntu Xenial):
status: Confirmed → Fix Committed
Changed in livecd-rootfs (Ubuntu):
assignee: nobody → Philip Roche (philroche)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.