ifupdown-ng / ifupdown-ng

flexible ifup/ifdown implementation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dummy0 interface not coming up on boot

snh opened this issue Β· comments

Hello there πŸ‘‹

Running ifupdown-ng 0.12.1-r0 with Alpine 3.16, I've noted that any interfaces with a link-type of dummy are failing to come up after a reboot. This is occurring on all of my systems running Alpine 3.16. This was working fine on Alpine 3.15 running ifupdown-ng 0.11.3-r0.

For example, the following config:

auto dummy0
iface dummy0
        link-type dummy
        address 192.168.100.1

Post reboot:

$ ip addr show dummy0
3: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 86:a5:fd:4d:07:9b brd ff:ff:ff:ff:ff:ff

After a doas ifup dummy0:

$ ip addr show dummy0
3: dummy0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
    link/ether 86:a5:fd:4d:07:9b brd ff:ff:ff:ff:ff:ff
    inet 192.168.100.1/24 scope global dummy0
       valid_lft forever preferred_lft forever
    inet6 fe80::84a5:fdff:fe4d:79b/64 scope link
       valid_lft forever preferred_lft forever

Unfortunately a doas ifdown -f dummy0 followed by a doas ifup dummy0 is unable to reproduce it. It only seems to occur at boot.

Any tips for how I could debug this further? Nothing of note is appearing in /var/log/messages post boot.

I hacked away at /etc/init.d/networking to force it to log the output of the ifup in verboes mode to a file, and narrowed it down to the following where it fails:

ifup: acquiring lock on /run/ifstate.dummy0.lock
ifup: changing state of interface dummy0 to 'up'
ifupdown: dummy0: attempting to run link executor for phase create
+ '[' dummy '=' dummy ]
+ '[' -d /sys/class/net/dummy0 ]
+ ip link add dummy0 type dummy
ip: RTNETLINK answers: File exists
ifupdown: dummy0: attempting to run static executor for phase create
+ '[' -z  ]
+ IF_METRIC=1
+ '[' -n  ]
+ '[' -n  ]
+ '[' -n 1 ]
+ METRIC='metric 1'
+ exit 0
ifup: failed to change interface dummy0 state to 'up'

Still trying to figure out why it thinks dummy0 already exists at that point.

Edit: Further to this, any name other than dummy0 works fine... And interestingly when I use a different name, such as dummy1, I still end up with a mysterious dummy0 interface in a down state after a reboot, along with a working dummy1, even if a dummy0 isn't defined in /etc/network/interfaces.

Ah, mystery solved thanks to https://serverfault.com/questions/839430/what-is-special-about-the-dummy-interface-dummy0.

It seems that adding a dummy interface of any name is loading the dummy module which thanks to numdummies defaulting to 1, results in the dummy0 interface.

The fix is to either use a name other than dummy0, or load the dummy module earlier so that the dummy0 interface already exists at the appropriate point and is reused.

As to why this broke with Alpine 3.16 and worked fine in Alpine 3.15. My guess is #166 has fixed the edge case where this was allowed to still work.