Azure / Azure/azure-linux-extensions

AAD Login fails to install due to unattended-upgrades

Open
#1,318 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
333
Forks
278
Avg merge
2d 9h
Merged PRs (30d)
4

Description

Received the following while trying to install AAD:
```
[ExtensionOperationError] Non-zero exit code: 100, /var/lib/waagent/Microsoft.Azure.ActiveDirectory.LinuxSSH.AADLoginForLinux-1.0.1528.1/./installer.sh install
[stdout]
SIZE/OFF NODE NAME
unattende 2679 root 5uW REG 8,17 0 60585 /var/lib/dpkg/lock-frontend
unattende 2679 root 6uW REG 8,17 0 62853 /var/lib/dpkg/lock
Waiting for locks: COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
apt-get 3406 root 4uW REG 8,17 0 60585 /var/lib/dpkg/lock-frontend
apt-get 3406 root 5uW REG 8,17 0 62853 /var/lib/dpkg/lock
Waiting for locks: COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
unattende 3440 root 5uW REG 8,17 0 60585 /var/lib/dpkg/lock-frontend
unattende 3440 root 6uW REG 8,17 0 62853 /var/lib/dpkg/lock
Waiting for locks: COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
unattende 3440 root 5uW REG 8,17 0 60585 /var/lib/dpkg/lock-frontend
unattende 3440 root 6uW REG 8,17 0 62853 /var/lib/dpkg/lock
Waiting for locks: COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
unattende 3440 root 5uW REG 8,17 0 60585 /var/lib/dpkg/lock-frontend
unattende 3440 root 78uW REG 8,17 0 63047 /var/cache/apt/archives/lock
dpkg 3481 root 3uW REG 8,17 0 62853 /var/lib/dpkg/lock
Waiting for locks: COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
unattende 3440 root 5uW REG 8,17 0 60585 /var/lib/dpkg/lock-frontend
unattende 3440 root 78uW REG 8,17 0 63047 /var/cache/apt/archives/lock
dpkg 3481 root 3uW REG 8,17 0 62853 /var/lib/dpkg/lock
Waiting for locks: COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
unattende 3440 root 5uW REG 8,17 0 60585 /var/lib/dpkg/lock-frontend
unattende 3440 root 78uW REG 8,17 0 63047 /var/cache/apt/archives/lock
Waiting for locks: COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
unattende 3440 root 5uW REG 8,17 0 60585 /var/lib/dpkg/lock-frontend
unattende 3440 root 6uW REG 8,17 0 62853 /var/lib/dpkg/lock
Waiting for locks: COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
unattende 3440 root 5uW REG 8,17 0 60585 /var/lib/dpkg/lock-frontend
unattende 3440 root 108uW REG 8,17 0 63047 /var/cache/apt/archives/lock
Waiting for locks: COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
unattende 3440 root 5uW REG 8,17 0 60585 /var/lib/dpkg/lock-frontend
unatt

[stderr]
Running scope as unit: Microsoft.Azure.ActiveDirectory.LinuxSSH.AADLoginForLinux_1.0.1528.1_ba60715b-dfac-4d75-a933-ab468048f074.scope
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 16 100 16 0 0 1230 0 --:--:-- --:--:-- --:--:-- 1230
Warning: apt-key output should not be parsed (stdout is not a terminal)
Warning: 'apt-key update' is deprecated and should not be used anymore!
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
```

Which seems pretty clear: the extension installer can't run `apt`, because the lock is held, and the `lsof` output it emits indicates that `unattended-upgrades` is running.

I'm instantiating the AAD extension with Terraform, so TF is creating them back-to-back, which means that this VM was very recently booted, too, hence why `unattended-upgrades` is still running / hasn't finished. I think the other piece is that this is from a (minimally modified) custom VM image. But this is important, as the stock Ubuntu images are kept fairly up-to-date, so I presume `unattended-upgrades` has little to do there. But images derived from the stock images aren't getting updates, so once the image is a few days old, then there are changes to make & it takes `unattended-upgrades` longer, and makes this race condition more likely.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the AAD extension installer at /var/lib/waagent/Microsoft.Azure.ActiveDirectory.LinuxSSH.AADLoginForLinux-1.0.1528.1/./installer.sh and reproduce the installation on a recently booted custom Ubuntu image created with Terraform. Check the apt and dpkg lock behavior shown in the failure; done means the extension installs successfully when unattended-upgrades is still running.

Written by the indexing model from the issue text.

Assessment

Tech stack
terraform, ubuntu
Domain
authentication, cloud, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.