WALinuxAgent: [BUG] WALinuxAgent service should start after the cloud-config service
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:
- WALinuxAgent starts, installs the Log Analytics agent (through extension) then;
- Shortly after (~2 seconds or so) cloud-init starts with the following configuration:
package_upgrade: true
package_reboot_if_required: true
- 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
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 13
- Comments: 17 (1 by maintainers)
+1
It seems utterly bizarre to leave this broken for two and a half years:
cloud-inithas been around for over a decade and is absolutely industry standard. To have an external agent that wades in without any reference tocloud-initrenders it unusable. There is a provided mechanism to check ifcloud-initis still running https://cloudinit.readthedocs.io/en/latest/reference/faq.htmlUpdate on this; my proposed solution doesn’t appear to work reliably.
I believe that the
walinuxagentservice needs to start aftercloud-finalto be more robust. I’m achieving that with the following in cloud-init:We implemented the solution some time ago and everything worked well.
Recently, our cloud-init process failed due to connection issues. We use these workers to run the Azure DevOps extension, which is installed by the WALinuxAgent. Normally, the provided solution ensures that the extension is installed only after cloud-init completes. However, because cloud-init failed, it was marked as finished, so WALinuxAgent proceeded to install the Azure DevOps agent extension even though the initialization was incomplete.
So we extended the workaround by testing the status of cloud-init.
Good workaround but this should be fix, or allow extension sequencing for customScript extension.