initramfs-tools-network-hook icon indicating copy to clipboard operation
initramfs-tools-network-hook copied to clipboard

Problem creating VLAN interface?

Open Dunuin opened this issue 3 years ago • 4 comments

Hi,

Already used this hook 2 years ago on Proxmox VE server to unlock a LUKS encrypted LVM via tagged vlan and that is still working fine. Now I'm trying to set up another Proxmox VE 7.2 ( which is based on Debian 11) server that also needs tagged VLAN but this time to unlock the encrypted ZFS root filesystem dataset.

But with this server this just won't work. After manually unlocking the root filesystem by connecting a keyboard+display and Proxmox VE has booted my network is working fine. This is my /etc/network/intefaces:

auto lo
iface lo inet loopback

iface enp3s0 inet manual

auto enp3s0.43
iface enp3s0.43 inet manual

auto vmbr43
iface vmbr43 inet static
        address 192.168.43.40/24
        gateway 192.168.43.1
        bridge-ports enp3s0.43
        bridge-stp off
        bridge-fd 0

When I check the used driver in Proxmox VE it is reporting to use r8169 and the chip is a Realtek RTL8111GR.

My /etc/initramfs-tools/initramfs.conf looks like this:

VLAN="enp3s0:43"
IP=192.168.43.40::192.168.43.1:255.255.255.0:J3710Unlock:enp3s0.43:off:192.168.43.1

The old server, using a Mellanox Connectx-3, and this config works fine:

VLAN="ens5:43"
IP=192.168.43.50::192.168.43.1:255.255.255.0::ens5.43:off

So the new server uses basically the same, just another NIC, a hostname and an additional DNS server IP.

But when I reboot it looks like initramfs is failing to create the VLAN interface: Second 4 to 5.5:

...
Running /scripts/init-premount ... done.
Mounting root filesystem ... Begin: Waiting up to 180 secs for enp3s0.43 to become available ... Begin: Running /scripts/nfs-top ... done.
Running /scripts/nfs-premount ... done.
Running /scripts/local-top ... Begin: Bringing up enp3s0.43 ... ip: RTNETLINK answers: Operation not supported
Generic FE-GE Realtec PHY r8169-0-300:00: attached PHY driver (mii_bus:phy_addr=r8169-0-300:00, irq=MAC)
r8169 0000:03:00.0 enp3s0: Link Is Down
ip: SIOCGIFFLAGS: No such device
done.
done
...
Begin: Importing ZFS root pool 'rpool' ... Begin: Importing pool 'rpool' using defaults ... done.
done.
Enter passphrase for 'rpool/ROOT':
r8169 0000:03:00.0 enp3s0: Link is Up - 1Gbps/Full - flow control off
IPv6: ADDRCONF(NETDEV_CHANGE): enp3s0: link becomes ready

Then a long time nothing and then 10x:

ipconfig: enp3s0.43: SIOCGIFINDEX: No such device
ipconfig: no devices to configure

And a single: /scripts/init-premount/dropbear: .: line 329: can't open '/run/net-enp3s0.43.conf' : No such file or directory

When I skip tagged VLAN and use this for the /etc/initramfs-tools/initramfs.conf and set the switch to untagged VLAN 43 everything works fine:

IP=192.168.43.40::192.168.43.1:255.255.255.0:J3710Unlock:enp3s0:off:192.168.43.1

What could be the problem here? Looks like initramfs and Proxmox VE are using the same r8169 driver but somehow initramfs still can't create a vlan interface?

I'm also not sure how to add a driver to initramfs using modprobe. Do I just need to "modprobe r8169" to the /etc/initramfs-tools/initramfs.conf?

Dunuin avatar Oct 24 '22 18:10 Dunuin

I installed a new server. Same problem as last time but this time it gets stuck with a endless loop of this after unlocking the root filesystem through the physical console: dropbear2

Before unlocking the root filesystem it looks like this: dropbear1

I've added this to the initramfs.conf:

VLAN="ens3:43"
IP=192.168.43.50::192.168.43.1:255.255.255.0:EnterpriseUnlock:ens3.43:off:192.168.43.1

Where ens3 is my ConnectX-3 NIC. Used the same NIC in the old server, where it was called ens5 with this config, and there everything was working fine:

VLAN="ens5:43"
IP=192.168.43.50::192.168.43.1:255.255.255.0::ens5.43:off

What is the best way to recover from this so I can boot my OS and change/disable the config?

Dunuin avatar Dec 29 '22 00:12 Dunuin

In case someone also screws up the initramfs and needs to rebuild it to get the linux boot again. You need to boot another linux, chroot into the non-bootlable linux and then rebuild the initramfs. I documented it there: https://forum.proxmox.com/threads/fix-stuck-initramfs.120192/post-522569

Still the question why VLANs are not working and it fails with "RTNETLINK answers: Operation not supported" on both of my servers.

Dunuin avatar Dec 31 '22 21:12 Dunuin

Sorry, but because I'm not using the hook anymore and a lack of time, I'm not able to maintain this repo anymore.

Please fork and start developing :)

stcz avatar Jan 15 '23 09:01 stcz

@Dunuin I reported the sleep and cat issue to https://bugs.debian.org/1033802 But until now we did not find an easy way to reproduce the bug.

williamdes avatar Feb 20 '24 14:02 williamdes