Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a lock timeout for apt-get installs #3461

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

trent-abc
Copy link

apt-get often gets in a race condition with self-hosted runners that results in it being unable to obtain the lock for install/upgrades (as seen below). This fix adds a 5 minute timeout which retries apt-get install/upgrades, making the installation process more robust.

See
https://help.ubuntu.com/community/AutomaticSecurityUpdates
https://blog.sinjakli.co.uk/2021/10/25/waiting-for-apt-locks-without-the-hacky-bash-scripts/

Example error message:


+ os_id='ubuntu
debian'
+ [[ ubuntu
debian =~ ^ubuntu.* ]]
+ echo 'Installing dependencies'
Installing dependencies
+ ./bin/installdependencies.sh
--------OS Information--------
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
------------------------------
The current OS is Debian based
--------Debian Version--------
bullseye/sid
------------------------------
/usr/bin/apt-get
Hit:1 http://us-west-2.ec2.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://us-west-2.ec2.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 http://us-west-2.ec2.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:4 https://download.docker.com/linux/ubuntu focal InRelease
Hit:5 https://nvidia.github.io/libnvidia-container/stable/deb/amd64  InRelease
Hit:6 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64  InRelease
Hit:7 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:8 https://fsx-lustre-client-repo.s3.amazonaws.com/ubuntu focal InRelease
Reading package lists...
E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 33029 (unattended-upgr)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
'apt-get' failed with exit code '0'
Can't install dotnet core dependencies.
You can manually install all required dependencies based on following documentation
https://docs.microsoft.com/en-us/dotnet/core/linux-prerequisites?tabs=netcore2x

@trent-abc trent-abc requested a review from a team as a code owner September 11, 2024 06:46
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