0

I have a system with an encrypted root. I have installed dropbear-initramfs and am able to SSH in and unlock root and boot fine. However once I boot I end up with both eth0 and br0 with the same static IP and thus networking is not functioning.

Running ifconfig eth0 0.0.0.0 gets everything going after boot, but I want to avoid having to load that in at boot as it feels very hacky. Looking for how to get initramfs to reset/cleardown/etc the eth0 interface to allow netplan to apply once the main system kernel boots.

The IP for initramfs is configured in /etc/initramfs-tools/initramfs.conf as follows IP=”192.168.1.220:::255.255.255.0::eth0:off”

Netplan config

  ethernets:
    eth0:
      dhcp4: no
  bridges:
    br0:
      interfaces: [eth0]
      dhcp4: no
      addresses:
      - 192.168.1.220/24
      gateway4: 192.168.1.1
      nameservers:
        addresses:
        - 8.8.8.8
        - 8.8.4.4
        search:
        - teese.net.au
  version: 2

I have tried setting IFDOWN=* in /etc/dropbear-initramfs/config to no avail.

Any tips would be appreciated. Cheers

2
  • I end up running ip addr flush dev $IFACE after boot, which also feels hacky. Have you found a better solution? – Nick Golder Feb 17 at 16:16
  • My "better solution" was to set up a serial console connection from my raspberry pi that sits on top of it. Works for my needs and had a far less hacky feel to it. One thing to note I came across, needs to be an on motherboard COM port on the server as by default Ubuntu kernel is not built to work with USB serial (and I could not be bothered going a custom kernel build just to get a serial port working when I could just spend a couple of $$$ on a COM port Serial header) – Jason Feb 27 at 0:26
1

If you are using Ubuntu 20.04 like me, you will find a file /run/netplan/eno1.yaml (or similar file) created after booting.

You can add a script under /etc/initramfs-tools/scripts/init-bottom/ like this:

rm -f /run/netplan/eno1.yaml

to delete the IP address configuration you specified in /etc/initramfs-tools/initramfs.conf

See this related question: What is creating /run/netplan/eth0.yaml?

3
  • Thank you. Certainly appears to have solved my issue in my test box. For those wanting my full fix it is as below: /etc/initramfs-tools/scripts/init-bottom/remove-eth0.sh #!/bin/sh rm -f /run/netplan/eth0.yaml ip -f inet address flush dev eth0 update-initramfs -u – Jason Feb 27 at 1:01
  • Sorry above comment is formatted horribly and I can no-longer edit. So yeah obviously meant to be some line breaks in there. – Jason Feb 27 at 1:07
  • Glad that helped! I too struggle on this issue for like 1 week. – Jim Lin Feb 28 at 5:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.