Apply Ubuntu phasing in the agent's sandbox
apt skips phasing in chroots, which it detects by running `ischroot -t`. ischroot compares / with /proc/1/root; the agent's DynamicUser can't read /proc/1/root, so ischroot answers "chroot" (-t = assume yes when unsure) and apt offered every phased update. On a real 26.04 host, 4 updates apt deferred as root were reported as installable, with 0 phased. Pass -o Dir::Bin::ischroot=/bin/false so apt applies phasing from /etc/machine-id exactly as it does for root. Agent 0.3.1, server 0.3.2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7a8c51ec84
commit
73b4a164e4
3 files changed
+20
-3
No files matched your search
@@ -198,6 +198,17 @@ X
|
||||
["libnss-systemd", "libpam-systemd", "libsystemd-shared", "libsystemd0", "libudev1",
|
||||
"systemd", "systemd-resolved", "udev"]))
|
||||
|
||||
def test_apt_told_it_is_not_in_a_chroot(self):
|
||||
# Otherwise unprivileged apt thinks it's in a chroot and ignores phasing
|
||||
# (seen on a real 26.04 host: 4 phased updates counted as installable).
|
||||
stub(self.bin, "apt-get", 'case "$*" in *Dir::Bin::ischroot=/bin/false*) ;; *) exit 1;; esac\n'
|
||||
'echo "The following upgrades have been deferred due to phasing:"\n'
|
||||
'echo " snapd open-vm-tools"\n'
|
||||
'echo "0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded."\n')
|
||||
r = self.report()
|
||||
self.assertEqual(r["phased_packages"], ["open-vm-tools", "snapd"])
|
||||
self.assertEqual(r["upgradable_count"], 0)
|
||||
|
||||
def test_apt_runs_in_c_locale(self):
|
||||
stub(self.bin, "apt-get", 'echo "Inst locale-$LC_ALL [1] (2 x [amd64])"\n')
|
||||
self.assertEqual(self.report()["upgradable_count"], 1)
|
||||
|
||||
Reference in new issue
Block a user