live-build manipulation of conffiles results in them being treated as modified by end user
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
live-build (Ubuntu) |
Fix Released
|
Critical
|
Michael Hudson-Doyle | ||
Xenial |
Invalid
|
Undecided
|
Catherine Redfield | ||
Bionic |
Invalid
|
Undecided
|
Catherine Redfield | ||
Focal |
Fix Released
|
Undecided
|
Catherine Redfield | ||
Jammy |
Fix Released
|
Undecided
|
Catherine Redfield | ||
Lunar |
Fix Released
|
Undecided
|
Philip Roche | ||
livecd-rootfs (Ubuntu) |
Invalid
|
Critical
|
Michael Hudson-Doyle | ||
Xenial |
Invalid
|
Undecided
|
Unassigned | ||
Bionic |
Invalid
|
Undecided
|
Unassigned | ||
Focal |
Invalid
|
Undecided
|
Unassigned | ||
Jammy |
Invalid
|
Undecided
|
Unassigned | ||
Lunar |
Invalid
|
Undecided
|
Unassigned | ||
ubuntu-advantage-tools (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
Xenial |
Invalid
|
Undecided
|
Unassigned | ||
Bionic |
Invalid
|
Undecided
|
Unassigned | ||
Focal |
Invalid
|
Undecided
|
Unassigned | ||
Jammy |
Invalid
|
Undecided
|
Unassigned | ||
Lunar |
Invalid
|
Undecided
|
Unassigned |
Bug Description
[ Impact ]
For packages that use preferences.d/ files, live-build will remove those files
causing the package to prompt for conffiles that it should have by default.
This issue was first seen in ubuntu-
conffiles in the 29 -> 29.2 transition but was prevented because of this bug.
The current plan is to have the conffiles be added in 29.5, but since ubuntu-
advantage-tools has an SRU exception this bug would prevent users on older than
mantic systems being able to run 29.5+ ubuntu-
To avoid removing packaged preferences.d files, the proposed patch only removes
/etc/apt/
files in lb_chroot_archives install stage. Then during remove stage or
lb_chroot_archives the backed up packaged preferences.d files are restored.
[ Test Plan ]
Since there are no known packages that rely on conffiles in this way, the
easiest way to see the bug/test the patch is to use the test patch attached to
this bug report. This adds an additional step lb_chroot_
the build process that writes a preferences file /etc/apt/
Then verify that /etc/apt/
live-build; it will not be there if the bug is still present.
Individual steps to perform the test:
# Pull unpatched live-build
$ pull-lp-source live-build focal
$ cd live-build-3.0~a57/
# Add testing patch to live-build so behaviour is apparent
$ quilt import lb_chroot_
$ quilt push
# Create an image using unpatched live-build
$ export UBUNTU_
$ export LIVECD_
$ export LIVECD_
$ export LIVE_BUILD_
$ ubuntu-bartender --build-provider aws --livecd-
# Validate the dummy preferences file was created
$ grep 'Creating dummy preferences' [UNPATCHED]
+ Echo_message Creating dummy preferences.d files...
+ STRING=Creating dummy preferences.d files...
P:+ printf Creating dummy preferences.d files...\n
Creating dummy preferences.d files...
# Download and extract the patched live-build
# Add testing patch to live-build so behaviour is apparent
$ quilt import lb_chroot_
$ quilt push
# Create an image using patched live-build
$ export UBUNTU_
$ export LIVECD_
$ export LIVECD_
$ export LIVE_BUILD_
$ ubuntu-bartender --build-provider aws --livecd-
# Validate the dummy preferences file was created
$ grep 'Creating dummy preferences' [PATCHED]
+ Echo_message Creating dummy preferences.d files...
+ STRING=Creating dummy preferences.d files...
P:+ printf Creating dummy preferences.d files...\n
Creating dummy preferences.d files...
# Mount the two images
$ tar xvzf [UNPATCHED]
$ mv build.output build.output-
$ tar xvzf [PATCHED]
$ mv build.output build.output-
$ mkdir --parents --verbose ./mount-unpatched && sudo mount ./build.
$ mkdir --parents --verbose ./mount-patched && sudo mount ./build.
# Diff manifests (should be identical)
$ diff build.output-
# Create and diff filelists (patched version will have /etc/apt/
$ (cd "./mount-unpatched" && sudo find -xdev) > "unpatched.
$ sort unpatched.filelist > unpatched.
$ (cd "./mount-patched" && sudo find -xdev) > "patched.filelist"
$ sort patched.filelist > patched.
$ diff patched.
230d229
< ./etc/apt/
# Clean up
$ sudo umount ./mount-unpatched
$ sudo umount ./mount-patched
$ rm -r *-unpatched
$ rm -r *-patched
$ rm *.filelist
$ rm *.filelist.sorted
[ Where problems could occur ]
Since we were not able to fully determine the history of lb_chroot_archives,
it's possible that there was a compelling reason for wiping out
/etc/apt/
needs refinment (FIXME) suggest that perhaps this was not the long term plan but
there may have been a good reason nonetheless). Because of this uncertainty the
patch attempts to minimize the changes to lb_chroot_archives' existing function
but the backup and restore do keep files that would previously have been
deleted.
It would be preferable for packaged apt preference files to be stored somewhere
besides /etc but unfortunately this is how apt is written.
Since this creates copies of existing files temporarily there may be some
failure path where those copies are created but not properly cleaned up. In
that case there would be unexpected config files on the system in
/etc/apt/
create functional problems for the user as apt will not attempt to read the
copied files.
If anything in lb_chroot_archives creates different files in
/etc/apt/
version of the file will overwrite the new file. We did not see this behavior
in testing but it could theoretically cause problems if it did occur. The
secion # Check local pinning preferences in lb_chroot_archives does write to the
directory explicitly.
[ Other Info ]
The original bug report, focusing on the ubuntu-
retained below for reference.
-------
When updating ubuntu-
This is on a system that is presumed to not have modified the relevant files.
Setting up ubuntu-
Configuration file '/etc/apt/
==> Deleted (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** ubuntu-pro-esm-apps (Y/I/N/O/D/Z) [default=N] ?
Configuration file '/etc/apt/
==> Deleted (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** ubuntu-
steps to reproduce (at least today):
lxc launch ubuntu-daily:mantic
in container:
apt update
apt install ubuntu-
Discovered in subiquity CI - https:/
summary: |
- conffile prompt in upgrade from 29 -> 29.2 + live-build manipulation of conffiles results in them being treated as + modified by end user |
Changed in ubuntu-advantage-tools (Ubuntu): | |
status: | New → Invalid |
tags: | added: foundations-todo |
Changed in livecd-rootfs (Ubuntu): | |
assignee: | nobody → Michael Hudson-Doyle (mwhudson) |
Changed in live-build (Ubuntu): | |
assignee: | nobody → Michael Hudson-Doyle (mwhudson) |
Changed in live-build (Ubuntu): | |
status: | New → In Progress |
Changed in livecd-rootfs (Ubuntu): | |
status: | New → Invalid |
Changed in live-build (Ubuntu Xenial): | |
status: | New → Triaged |
Changed in live-build (Ubuntu Bionic): | |
status: | New → Triaged |
Changed in live-build (Ubuntu Focal): | |
status: | New → Triaged |
Changed in live-build (Ubuntu Jammy): | |
status: | New → Triaged |
Changed in live-build (Ubuntu Lunar): | |
status: | New → Triaged |
Changed in livecd-rootfs (Ubuntu Xenial): | |
status: | New → Invalid |
Changed in livecd-rootfs (Ubuntu Bionic): | |
status: | New → Invalid |
Changed in livecd-rootfs (Ubuntu Focal): | |
status: | New → Invalid |
Changed in livecd-rootfs (Ubuntu Jammy): | |
status: | New → Invalid |
Changed in livecd-rootfs (Ubuntu Lunar): | |
status: | New → Invalid |
Changed in ubuntu-advantage-tools (Ubuntu Xenial): | |
status: | New → Invalid |
Changed in ubuntu-advantage-tools (Ubuntu Bionic): | |
status: | New → Invalid |
Changed in ubuntu-advantage-tools (Ubuntu Focal): | |
status: | New → Invalid |
Changed in ubuntu-advantage-tools (Ubuntu Jammy): | |
status: | New → Invalid |
Changed in ubuntu-advantage-tools (Ubuntu Lunar): | |
status: | New → Invalid |
Changed in live-build (Ubuntu Lunar): | |
assignee: | nobody → Philip Roche (philroche) |
Changed in live-build (Ubuntu Jammy): | |
assignee: | nobody → Philip Roche (philroche) |
Changed in live-build (Ubuntu Focal): | |
assignee: | nobody → Philip Roche (philroche) |
Changed in live-build (Ubuntu Bionic): | |
assignee: | nobody → Philip Roche (philroche) |
Changed in live-build (Ubuntu Xenial): | |
assignee: | nobody → Philip Roche (philroche) |
description: | updated |
Changed in live-build (Ubuntu Lunar): | |
status: | Fix Committed → In Progress |
Changed in live-build (Ubuntu Jammy): | |
status: | Fix Committed → In Progress |
Changed in live-build (Ubuntu Focal): | |
status: | Fix Committed → In Progress |
Changed in live-build (Ubuntu Bionic): | |
status: | Fix Committed → In Progress |
Changed in live-build (Ubuntu Xenial): | |
status: | Fix Committed → In Progress |
description: | updated |
description: | updated |
description: | updated |
tags: | removed: foundations-todo |
This looks to be a bug in `livecd-rootfs`. there's code from `live-build` that "helpfully" attempts to clean up. and in livecd-rootfs, we attempt to save off and restore.
https:/ /git.launchpad. net/livecd- rootfs/ tree/live- build/auto/ build#n360
https:/ /git.launchpad. net/livecd- rootfs/ tree/live- build/ubuntu- cpc/hooks. d/chroot/ 100-preserve- apt-prefs. chroot
it appears something may be going awry here, because a launch of a current mantic image there is nothing in `/etc/apt/ preferences. d/` when there should be a couple files dropped in by ubuntu- advantage- tools. this is verifiable by launching an lxc container of the current mantic daily
`lxc launch ubuntu-daily:m`
I've tested a build of the ua-tools in proposed on 22.04's livecd-rootfs, and don't run into the same issue. checking 20.04 as well.