Skip to content

fix(examples): disable background apt services in multi-runner user-data#5141

Open
alexjurkiewicz wants to merge 1 commit into
github-aws-runners:mainfrom
alexjurkiewicz:fix/userdata-dpkg-lock
Open

fix(examples): disable background apt services in multi-runner user-data#5141
alexjurkiewicz wants to merge 1 commit into
github-aws-runners:mainfrom
alexjurkiewicz:fix/userdata-dpkg-lock

Conversation

@alexjurkiewicz

Copy link
Copy Markdown
Contributor

Ubuntu's `unattended-upgrades`, `apt-daily.service`, and `apt-daily-upgrade.service` start in the background shortly after a fresh instance boots and can hold `/var/lib/dpkg/lock-frontend`. The runner installer (`install_runner.sh` → `installdependencies.sh`) runs `apt-get` to install .NET Core dependencies; if a background service holds the lock at that moment the install fails:

E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 5381 (apt-get)
Can't install dotnet core dependencies.

Without `set -e`, the runner starts with missing dependencies. With `set -e` (a common hardening practice), the entire user-data script exits — the runner is never installed or registered, and queued jobs wait indefinitely until job-retry exhausts its attempts.

This PR stops and masks those services before any `apt-get` operations, then waits for any in-flight lock holder to release.

Disable unattended-upgrades, apt-daily.service and apt-daily-upgrade.service.
They can interfere with user-data dependency installation causing errors like:

  E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 5381 (apt-get)
  Can't install dotnet core dependencies.

Also, wait for the dpkg lock to release before trying to install anything.
@alexjurkiewicz alexjurkiewicz requested a review from a team as a code owner June 1, 2026 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant