LXD with cloud-init status is forever running or say hanging

I followed the Quick-start tutorial with LXD, it went well until cloud-init status --wait, it is running forever. cloud-init status returned status: running.

But when I tried it with multipass, it returned status: done

Note: ubuntu 22.04 $ lxc version: Client version: 5.21 Server version: 5.21

What I am missing? What do I need to do?

Does it work with latest/stable?

I got the forever running
cloud-init status
status: running

It is running for more than an hour now

on latest/stable or 5.21/candidate?

$ lxc version
Client version: 5.21.0 LTS Server version: 5.21.0 LTS

And do you see the same issue on LXD 5.20 (i.e the latest/stable channel)?

Yes, I experienced the same issue, that was the reason I re-installed to get the latest, thinking the issue will be resolved. But I did not experience the same with multipass

It looks like the problem is snap.lxd.activative.service

$ systemctl --failed

  UNIT                       LOAD         ACTIVE SUB     DESCRIPTION                         
  snap.lxd.activate.service  not-found  failed failed  snap.lxd.activate.service           


This seems to be the issue:

I ran into this same problem (cloud-init status forever returning running) when using ubuntu:jammy. Switching to ubuntu:focal or ubuntu:noble resolved it, so must be an issue with the jammy immage.

I followed the cloud-init tutorial mentioned in this thread but I did not manage to reproduce this behavior. The cloud-init status just comes back as done. Would you have some commands I could try? Which LXD version are you using?

After a closer look it seems https://wiki.debian.org/LXC/SystemdMountsAndAppArmor was the problem.
For now I set lxc.apparmor.profile = unconfined, which has resolved my issues (also on Jammy).

(Debian bookworm, LXD version 5.0.2)

You might also want to try using security.nesting=true rather than using lxc.apparmor.profile = unconfined

1 Like