Sample Header Ad - 728x90

Debian 12 cloud image won't let me ssh unless first boot already has NIC available

1 vote
0 answers
147 views
I have a little script that automates setting up a local VM. Basically when I want to create a VM it sets up some cloud-init configuration, boots the guest once initially for setup (with a "cdrom" attached), and then shuts it down ahead of use. With the Debian 11 (bullseye) cloud images the guest init process worked fine when passing -nic none to the qemu process, i.e. an offline setup worked without issue. It would configure my ssh key and upon second launch of the VM (without the cloud-init "cdrom" attached) everything worked fine and I could connect. But with Debian 12 (bookworm) cloud images, my same setup process runs into two issues: * the initial boot hangs at "Starting systemd-networkd-…it for Network to be Configured..." for a few minutes before proceeding * something then changes in **subsequent** boots in that the guest SSH service won't respond to connections Is this more likely a change on the cloud-init side (looks like my old bullseye base image logs "Cloud-init v. 20.4.1" and the new logs "Cloud-init v. 22.4.2") in somehow it force-configures a NON-working network if that's the case on first boot? Or would this be something more generic to Debian 11 → 12 itself in that its own network stuff now breaks when an interface isn't initially available? ## Update I've at least uncovered two more clues: When the machine has a NIC on *first* boot, the network interface ends up known as enp0s1. Whereas if only the later boots have networking then the interface gets named eth0. This doesn't seem like a super important difference though in light of the second… The other thing I've discovered is that if I let cloud-init *continue* to load on every boot (specifically by **not** doing a touch /etc/cloud/cloud-init.disabled during initial configuration) then SSH access does work on subsequent boots. [i.e. even when the interface is still now eth0 rather than enp0s1 as it would have been.] So this does point to something that cloud-init now "needs to" do in later versions before networking really will work. But what exactly? Why was Debian 11 fine to bring up networking on its own but now Debian 12 has to have cloud-init set up for it?
Asked by natevw (194 rep)
Mar 14, 2025, 07:07 PM
Last activity: Mar 14, 2025, 07:34 PM