Azure / Azure/WALinuxAgent

[BUG] WALinuxAgent service should start after the cloud-config service

Open
#1,938 18 comments 13 reactions 0 assignees View on GitHub
provisioning triaged
Dominant language
Python
Stars
581
Forks
397
Avg merge
2d 15h
Merged PRs (30d)
9

Description

Currently (On Canonical UbuntuServer 18.04-LTS) the WALinuxAgent service and cloud-init run in parallel on start-up causing issues with contention of the package repository.

I believe that WALinuxAgent should start _after_ the cloud-config service to ensure that:
- Packages that extensions may depend on can be installed by cloud-init; (EG: https://github.com/microsoft/azure-pipelines-agent/issues/2866 for an example)
- Updates or packages installed by WALinuxAgent, or by Extensions, do not contend for the distribution's package manager, causing locks and failures

**Distro and WALinuxAgent details:**
- Distro and Version: [e.g. Ubuntu 18.04 latest image]
- WALinuxAgent version
```
WALinuxAgent-2.2.45 running on ubuntu 18.04
Python: 3.6.9
Goal state agent: 2.2.48.1
```

**Additional context**
My current situation when starting an Ubuntu 18.04 VM, with the Log Analytics extension is that:
1. WALinuxAgent starts, installs the Log Analytics agent (through extension) then;
2. Shortly after (~2 seconds or so) cloud-init starts with the following configuration:
```yaml
package_upgrade: true
package_reboot_if_required: true
```
3. WALinuxAgent or Log Analytics agent has the package repository lock, and causes cloud-init to fail

My current solution is to modify the service behaviour by adding this override to `/etc/systemd/system/walinuxagent.service.d/override.conf` from within `bootcmd` using cloud-init:
```
[Unit]
After=cloud-config.service
```

Contributor guide

Open the contributing guide

Research direction

Start by inspecting the WALinuxAgent systemd service and the cloud-config.service ordering on Ubuntu 18.04. Reproduce the startup scenario with cloud-init package_upgrade enabled and the Log Analytics extension. Done means WALinuxAgent starts after cloud-config and the package manager no longer experiences the described lock contention.

Written by the indexing model from the issue text.

Assessment

Tech stack
cloud, python, ubuntu
Domain
cloud, devops, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.