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:
patrickandClaude Opus 5.5 committed 2026-10-17 13:13:03 -04:00
1 parent 7a8c51ec84
commit 73b4a164e4
3 files changed
+20 -3

No files matched your search

+7 -1
View File
@@ -6,7 +6,7 @@
# rules can change without redeploying agents.
set -euo pipefail
AGENT_VERSION=0.3.0
AGENT_VERSION=0.3.1
# Prefix for every file the agent reads. Only the test suite sets this.
ROOT=${KERNELWATCH_ROOT:-}
@@ -154,8 +154,14 @@ read_needrestart() {
# Simulated dist-upgrade. Reads only: no locks, no cache files written.
# dist-upgrade (not upgrade) so new-ABI kernel packages pulled in by the
# meta-package show up. C locale because we parse apt's messages.
#
# apt skips phasing in chroots, detected with `ischroot -t`, which compares /
# with /proc/1/root. Unprivileged we can't read /proc/1/root, so ischroot
# answers "chroot" and apt would offer every phased update. We're not in one:
# say so, and apt applies phasing from /etc/machine-id like it does for root.
apt_simulation() {
LC_ALL=C apt-get -s -q \
-o Dir::Bin::ischroot=/bin/false \
-o Debug::NoLocking=true \
-o Dir::Cache::pkgcache= \
-o Dir::Cache::srcpkgcache= \