Skip to main content
23 votes

How to disable `apt-daily.service` on Ubuntu cloud VM image?

Note: Unfortunately part of the solution below doesn't work on Ubuntu 16.04 systems (such as that of the questioner) because the suggested systemd-run invocation only works on Ubuntu 18.04 and above (...
Anon's user avatar
  • 3,884
11 votes

Azure VM cloud-init overrides /etc/fstab

I realize that this is late, but I hope it helps. In Azure, the linux agent configuration file (waagent.conf) usually sets the mountpoint and you do i from there for most Linux distros supported. You'...
baalali's user avatar
  • 111
8 votes

How to disable `apt-daily.service` on Ubuntu cloud VM image?

You can disable this via the "bootcmd" cloud-init module. This runs before network is brought up, which is required before apt update can get a chance to run. #cloud-config bootcmd: - echo 'APT::...
KP99's user avatar
  • 181
6 votes

Changing default values in /etc/ssh/sshd_config using cloud init config

Expanding on @dandreye, this takes into account that these could be commented out and sets the proper option regardless of their current value. runcmd: - sed -i 's/\#\?ClientAliveInterval .\+/...
Eldon McGuinness's user avatar
4 votes

How to disable `apt-daily.service` on Ubuntu cloud VM image?

Based on Anon's solution, I created this script, which after being run and then rebooting, solves the problem for me: #!/bin/sh systemctl mask apt-daily.service apt-daily-upgrade.service systemctl ...
JWL's user avatar
  • 387
4 votes

When using cloud-init, what order are the users created in?

It turns out there is a uid field as mentioned here, so I can use that to ensure that each user has a specific UID. However, as mentioned here, there is a bug with how the uid field is parsed. ...
pacoverflow's user avatar
3 votes
Accepted

cloud-init.log shows write_files.0: Additional properties are not allowed ('defer' was unexpected)

You need to update to cloud-init v21.4, which is the version that added the defer property to write_files. Check the version you are running with cloud-init -v, and with head -n 1 /var/log/cloud-init....
Elizabeth's user avatar
3 votes

How can I use cloud-init NoCloud with OPNsense 21?

I'm working on expanding cloud-init support to BSDs*. The errors should be fixed by now since at least https://github.com/canonical/cloud-init/pull/1779 And by now, Vultr is fairly well supported. If ...
Mina Galić's user avatar
3 votes
Accepted

Unexpected token within environment variable throws syntax error in cloud-init

You don't need to escape the double quotes in a here-doc. The way you have it there, the outer shell expands the variables, and the shell started by su sees -p \"gy75k9([0y6se2v^\" literally,...
ilkkachu's user avatar
  • 148k
3 votes

How to disable `apt-daily.service` on Ubuntu cloud VM image?

The excellent answers on here have been working for me for ages but suddenly I started getting the dreaded {"changed": false, "msg": "Failed to lock apt for exclusive ...
Joe Lipson's user avatar
2 votes
Accepted

How to boot after partitioning

I see you have changed the partitioning type from MBR to GPT. Is your firmware in legacy/CSM/BIOS mode, or did you also change the firmware type to UEFI? In any case, you will need to reinstall your ...
Johan Myréen's user avatar
2 votes
Accepted

How do I use Hashicorp's Linux Repository with Centos 8 and cloud-init to install Vault

The URL https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo is not the repository URL, but the YUM configuration file for the repository. The yum-config-manager command works with YUM ...
GracefulRestart's user avatar
2 votes

How to disable `apt-daily.service` on Ubuntu cloud VM image?

This cloud-init works. #cloud-config apt: conf: | APT { Periodic { Update-Package-Lists "0"; }; }; Unattended-Upgrade { Package-Blacklist { "*"; }...
Alexander's user avatar
2 votes
Accepted

Why does the cloud-init version in log file conflict with the version in the binary?

Cloud-init ran as version 21.2 but has since been upgraded to 21.4. The update might have been a manual sudo apt update && sudo apt upgrade, or it may have upgraded itself. Sidenote: Your ...
Brett Holman's user avatar
2 votes

cloud-init.log shows write_files.0: Additional properties are not allowed ('defer' was unexpected)

What does the following show? head -n 1 /var/log/cloud-init.log Without the defer statement I see a similar exception on Ubuntu 20.04 cloud-init 22.1: arc~ cat ~/my-user-data #cloud-config users: - ...
Brett Holman's user avatar
2 votes

Errors during downloading metadata for repository 'epel'

This is a proof-of-concept that I have come up with. You can use this as a starting point. for repourl in \ "https://fedora.cu.be/epel" \ "https://lon.mirror.rackspace.com/epel" \ &...
Haxiel's user avatar
  • 8,719
2 votes

Why are cloud-init processes running long after server creation?

From a helpful chat over on the #cloud-init IRC channel, apparently this relates to a problem with cloud-init version 21.3 that is fixed in 21.4, which will be released in a few days. Until then, a ...
drmrbrewer's user avatar
2 votes
Accepted

ubuntu-live-server installation through PXE user-data config error

ssh_pwauth is not a per-user config key, but a top-level config key. So: users: - name: user gecos: ubuntu-server groups: adm, cdrom, dip, lxd, plugdev, sudo lock_passwd: false ...
telcoM's user avatar
  • 114k
2 votes
Accepted

cloud-init does not work for Ubuntu 22.04 images

sudo: true is invalid. Specify an actual rule, not just "true". According to the documentation: sudo: (string/null) Sudo rule to use or false. Absence of a sudo value or null will result in ...
falcojr's user avatar
  • 136
1 vote
Accepted

cloud-init tailscale setup fails due to missing /dev/net/tun

Does the kernel get upgraded on first boot? @tom-yan pretty much got it I just ran into the same error with tun and found this post The problem was this kernel package getting upgraded by apk upgrade:...
Secsy Code's user avatar
1 vote
Accepted

cloud-init: Getting the error: No such function check

This was a simple typo gpt, should be gpt. Change: disk_setup: /dev/vdb: table_type: gpt, layout: true to: disk_setup: /dev/vdb: table_type: gpt layout: true So the no-such ...
Evan Carroll's user avatar
  • 35.1k
1 vote
Accepted

Debian 12 Cloud Image Deployment Issue - Growpart can not find grep and other basic utilities

The package containing the failing script seems to be cloud-initramfs-growroot, and it actually has a more specific bug report for this issue, with a patch attached. I am seeing the same issue on my ...
telcoM's user avatar
  • 114k
1 vote

cloudinit does not run for qemu/kvm systems created by terraform and libvirt provider

As Brett-holman mentioned, the issue is most likely the cloud-init YAML you are passing in. If you monitor the console of the booting domain ( virsh console --domain your-kvm-domain ) using a un-...
mattsn0w's user avatar
1 vote
Accepted

secrets unintentionally printed to cloud-init logs

The quickest and easiest solution would probably be to use set +x to disable the shell tracing option that seems to have been set in a parent script. Ultimately a better solution is to remove the set -...
Sotto Voce's user avatar
  • 7,211
1 vote

Debian 11 fails to set IPv6 via Cloud-Init: "ens18/disable_ipv6: No such file or directory"

If you are using ifupdown, installing ifupdown2 instead of ifupdown solved the problem here. sudo apt-get update sudo apt-get install ifupdown2
Raphaël Enrici's user avatar
1 vote

Changing default values in /etc/ssh/sshd_config using cloud init config

What you need is to include a single line to tell cloud-init to append to sshd_config rather that replace the whole file, i.e append: true. So your cloud_init.cfg file will look like this: --- ...
Yasir Elsharif's user avatar
1 vote

Ubuntu Server won't start if no GPU is installed

As I run some tests thanks to the comments I figured out, that the problem is the fstab entry. If I comment out the fstab entry the system will boot without VGA installed. I find it quite strange, as ...
Max R.'s user avatar
  • 121
1 vote

How to disable `apt-daily.service` on Ubuntu cloud VM image?

If the purpose is to provision the machine without incurring in a locking error, the simplest and most stable solution is to run the provisioner remote command (or the apt-related commands) while ...
Marcus's user avatar
  • 991
1 vote

How to disable `apt-daily.service` on Ubuntu cloud VM image?

This waits for 1sec in a whil loop and checks if the lock is released. while : ; do sleep 1 echo $( ps aux | grep -c lock_is_held ) processes are using apt. ...
Navidzj's user avatar
  • 11

Only top scored, non community-wiki answers of a minimum length are eligible