Comment 2 for bug 2038662

Revision history for this message
Brian Candler (b-candler) wrote :

Grr... it works if I first run a dummy command within the machine:

systemd-nspawn -M jammy-rootfs --as-pid2 passwd root
machinectl start jammy-rootfs # it's working now!
machinectl login jammy-rootfs

(Even just "echo hello world" does the job)

However if you go back to a *fresh* image then it fails:

machinectl stop jammy-rootfs
machinectl remove jammy-rootfs
machinectl pull-raw http://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img jammy-rootfs
# Both of these commands consistently fail:
machinectl start jammy-rootfs
systemd-nspawn -M jammy-rootfs -U -b -n

Conclusion: this is confusing. The solution is to manually spawn any command within the image, *before* attempting to start the image with --boot.