Skip to content

Commit 240f353

Browse files
committed
ci(qemu): wait for dpkg lock before apt-get install
unattended-upgrades can still hold /var/lib/dpkg/lock-frontend when the VM runs apt-get install, causing "Could not get lock" failures. Use sudo flock to wait for the lock to be released before installing.
1 parent c451931 commit 240f353

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

.github/workflows/scripts/qemu-2-run-in-vm.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ function prapre_test_env() {
114114
if [ "${#missing_packages[@]}" -gt 0 ]; then
115115
echo "installing missing packages: ${missing_packages[*]}"
116116
sudo apt-get update
117+
# wait for unattended-upgrades to release /var/lib/dpkg/lock-frontend
118+
sudo flock --wait 300 /var/lib/dpkg/lock-frontend true || true
117119
sudo apt-get install -y "${missing_packages[@]}"
118120
fi
119121
# Ubuntu 20.04 Default clang-10 Has a CO-RE Relocation Bug (Fixed in LLVM 12 / D87153) — Use clang-12 Instead

0 commit comments

Comments
 (0)