Cloud-init doesn't configure Netplan network in VM with Debian12

damares\

New Member
Sep 18, 2023
2
0
1
Hi.
We were using Debian11 for our VM in Proxmox and we always used cloud-init to configure Netplan. We are now trying to create a new base VM using Debian12 but something doesn't work. We are using networkd, but when I reboot there's a failure in network configuration.


Here is what I've done:

I enabled the cloud-init service with: systemctl enable cloud-init

With Debian11 we used to give the configuration in a file that we called 01_networkd.cfg in the /etc/cloud/cloud.cfg.d/ folder, with a syntax that I found was a little deprecated, so I tried to adapt the config with the new standard and it's this:

Bash:
network:
    version: 2
    renderer: networkd
    ethernets:
        eth0:
            addresses: 
                - 10.10.0.86/16
            dhcp4: false
            nameservers:
                search: [our_network.priv]
            routes:
                - to: default
                  via: 10.10.0.1

Then I found that Netplan needed openswitch to be installed, so I've done it and then I enabled and applied Netplan configuration:

Bash:
echo 'ENABLED=1' > /etc/default/netplan
netplan apply

I disabled the networking service, in order to use networkd:

Bash:
systemctl disable networking; systemctl mask networking
mv /etc/network/{interfaces,interfaces.save}
systemctl enable systemd-networkd

But when I reboot cloud-init gives an error:

Bash:
[FAILED] Failed to start systemd-networkd-wait-online.service - Wait for Network to be Configured.

Using the Proxmox Console I can see that there's no yaml file in /etc/netplan, so the problem is this: cloud-init doesn't create the network configuration file for Netplan from the config file that I give it.

Any idea? There's something missing or wrong in the syntax?
Thank you.
 
I think that the problem is that cloud-init leave the netplan config file too open.

I'll explain:
once I netplan apply and then execute cloud-init init I have my netplan config file created, but cloud-init throws this error:
Bash:
Permissions for /etc/netplan/50-cloud-init.yaml are too open. Netplan configuration should NOT be accessible by others.

So I tried to chmod the file giving it 600 (as requested), check that the permission was changed, then I tried to launch again cloud-init init and I had the same error and the permission was again too open.

There's something I'm missing in this process