Repository navigation
fix(vhd): disable apt-daily units before the pre-install reboot - #10203
Open
Artur Khantimirov (r2k1) wants to merge 1 commit into
Open
Artur Khantimirov (r2k1) wants to merge 1 commit into
Artur Khantimirov (r2k1) wants to merge 1 commit into
Conversation
Contributor
Windows Unit Test Results 3 files 21 suites 1m 21s ⏱️ Results for commit 547ef76. ♻️ This comment has been updated with latest results. |
The Ubuntu VHD build masked and disabled apt-daily units in install-dependencies.sh, after the reboot that follows pre-install-dependencies.sh. Persistent timers can start these units at boot, and a running unit holds the apt/dpkg locks during the build. Move the existing block before the reboot so the units cannot start. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Artur Khantimirov (r2k1)
force-pushed
the
r2k1-vhd-dpkg-lock-failure
branch
from
November 26, 2026 19:30
6a3c564 to
547ef76
Compare
Contributor
Contributor
Contributor
|
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The existing suites do not execute the pre-install block, leaving Ubuntu configuration, non-Ubuntu skip behavior, and ordering that prevents the reboot-related lock race without regression coverage.
1 open issue
What changed in this PR
This PR moves Ubuntu’s automatic apt-update suppression earlier in the VHD build to prevent apt-daily jobs from starting at the pre-install reboot and competing for package-manager locks. It replaces the retry approach proposed in #10202.
Changes:
- Moves the existing service masking, timer disabling, and
99periodicsettings into pre-install, before the reboot. - Removes the post-reboot copy and adds comments explaining why the ordering matters.
| File | Description |
|---|---|
vhdbuilder/packer/pre-install-dependencies.sh |
Applies Ubuntu apt-daily suppression before the reboot. |
vhdbuilder/packer/install-dependencies.sh |
Removes the suppression block from the post-reboot phase. |
Review effort: Balanced
Comment on lines
+367
to
+369
| systemctl mask apt-daily.service apt-daily-upgrade.service || exit 1 | ||
| systemctl disable apt-daily.service apt-daily-upgrade.service || exit 1 | ||
| systemctl disable apt-daily.timer apt-daily-upgrade.timer || exit 1 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
547ef764af92fa836ea1a79e1617e3c39fceb816↑ All Ubuntu Packer templates reboot right after
pre-install-dependencies.sh;OS/UBUNTU_OS_NAMEare set there; no early exit.↑
make validate-shelland ShellSpec pass; one GPT review pass found no issues.↓ No VHD build ran with this change.
Persistent=truetimer started at boot kept running.↓ No log names the exact unit that held the lock.
↑ The passing CVM run 193168482 and the FIPS job show the same contention after the reboot.
↓ If the holder is not apt-daily, this change does not help.
What this PR does / why we need it:
Daily Linux VHD build 193348731 failed in
build2004cvmgen2containerd. All 4 Packer attempts failed about 3–4 minutes after the reboot, each at a different apt call:The contention is systematic; the failure depends on timing:
dpkg frontend lockerror at a call that tolerates it.Could not get lock /var/lib/apt/lists/lock. It is held by process 2531 (apt-get)right after the reboot.Cause: the build intentionally masks and disables
apt-daily*units and writes99periodic. But it did this ininstall-dependencies.sh, after the Packer reboot. The timers arePersistent=true, so at boot they can start apt-daily before the script runs. Mask/disable do not stop a unit that already runs, so it holds the apt/dpkg locks.Before:
install-dependencies.sh(after the reboot) masks/disables the units and writes99periodic.After: the same block, unchanged, runs at the end of
pre-install-dependencies.sh, before the reboot. After the reboot, masked services cannot start and disabled timers do not fire. A unit that runs during pre-install stops at the reboot.No new ShellSpec test: the change moves inline top-level code; there is no function to test.
This replaces the retry approach in closed #10202.
Validation:
make validate-shell: passed.shellspec --shell bash spec/vhdbuilder/packer/pre_install_dependencies_spec.sh spec/vhdbuilder/packer/install_dependencies_spec.sh: passed (8 examples, 0 failures). (macOS/bin/shfails on unchangeddevfor the pre-install spec, so I used bash.)Which issue(s) this PR fixes:
Fixes AB#40919782