cloud-init dhclient apparmor denied with noexec on /var/tmp
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
isc-dhcp (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
Hello - we are seeing an issue on multiple Azure hosts where there is a long delay during bootup. This appears to be related to an apparmor issue with dhclient executed via cloud-init when /var is mounted noexec. Because /var is noexec, the original dhclient is executed rather than the copy in /var/tmp/
This prevents the instance from being able to record the DHCP lease information to /var/tmp/
This issue does not occur in default Ubuntu installations (including the Ubuntu 20.04 default Azure image), as the dhcp.py script in cloud-init behaves differently, copying /usr/sbin/dhclient to /var/tmp/
The syslog will show the following entry when the instance boots up:
cloud-init[820]: 2021-07-07 14:50:40,661 - dhcp.py[WARNING]: dhclient did not produce expected files: dhcp.leases, dhclient.pid
The cloud-init.log file will show this entry when this issue is occurring. Since the instance has no IP address at this stage of the boot process, an unreachable network is to be expected:
azure.py[DEBUG]: Failed HTTP request with Azure endpoint http://
With the timeouts in azure.py described above, the instance will not boot for around 20 minutes until all 240 connection attempts are completed.
This is logged in /var/log/
type=AVC msg=audit(
Adding the following file resolves the issue: /etc/apparmor.
/var/tmp/
/var/tmp/
This allows dhclient executed via cloud-init to write the dhclient.pid and dhcp.leases files to /var/tmp/cloud-init and the instance to boot normally.
Status changed to 'Confirmed' because the bug affects multiple users.