#961508 ifupdown: RTNETLINK answers: File exists

Package:
ifupdown
Source:
ifupdown
Description:
high level tools to configure network interfaces
Submitter:
ael
Date:
2023-02-03 15:15:03 UTC
Severity:
normal
#961508#5
Date:
2020-05-25 12:11:49 UTC
From:
To:
There seem to be so many open bugs for ifupdown that it is not clear
whether there is any point in reporting this, but perhaps it may help
others.

I have encountered the unhelpful error  message "RTNETLINK answers: File
exists" on more than one machine but only on rare occasions.
I seem now to discovered what is happening.

I normally use ethernet, but occasionly wifi. The problem seems to be
when I mistakely "ifup" on one interface, take it down, and then
try to use (ifup) on the other interface.

It looks as if ifdown is failing to clear a broadcast address, and
trying to set up the new broadcast address gives this mysterious
messages passed up from ip.

The failure hapens when ip is called as in:
ip addr add 192.168.0.7/255.255.255.0 broadcast 192.168.0.255 dev eth0 label eth0

Deleting this manually with ip  as:-
ip addr del 192.168.0.7/255.255.255.0 broadcast 192.168.0.255   dev eth0 label eth0

and then rerunning ifup clears the problem.

I have yet to look at the source, but I guess this should be simple to
fix.
----------------------------------------------------
-- Package-specific info:
--- /etc/network/interfaces:
cat: /etc/network/interfaces: Permission denied

/usr/share/bug/ifupdown: 20: cannot open /etc/network/interfaces: Permission denied
--- up and down scripts installed:
/etc/network/if-down.d:
total 4
-rwxr-xr-x 1 root root 1015 Apr 13  2015 avahi-autoipd
lrwxrwxrwx 1 root root   32 May 19 13:29 wpasupplicant -> ../../wpa_supplicant/ifupdown.sh

/etc/network/if-post-down.d:
total 8
lrwxrwxrwx 1 root root   23 May  7 19:47 avahi-daemon -> ../if-up.d/avahi-daemon
-rwxr-xr-x 1 root root  138 Sep 21  2018 chrony
-rwxr-xr-x 1 root root 1409 Mar 24  2016 wireless-tools
lrwxrwxrwx 1 root root   32 May 19 13:29 wpasupplicant -> ../../wpa_supplicant/ifupdown.sh

/etc/network/if-pre-up.d:
total 12
-rwxr-xr-x 1 root root  344 Apr 28  2012 ethtool
-rwxr-xr-x 1 root root 4191 Sep 15  2018 wireless-tools
lrwxrwxrwx 1 root root   32 May 19 13:29 wpasupplicant -> ../../wpa_supplicant/ifupdown.sh

/etc/network/if-up.d:
total 32
-rwxr-xr-x 1 root root  923 Apr 13  2015 avahi-autoipd
-rwxr-xr-x 1 root root  484 Mar  6  2013 avahi-daemon
-rwxr-xr-x 1 root root  290 Dec 21  2016 chrony
-rwxr-xr-x 1 root root  138 Sep 21  2018 chrony.dpkg-dist
-rwxr-xr-x 1 root root 1685 Sep 22  2014 ethtool
-rwxr-xr-x 1 root root 4937 Aug 22  2019 mountnfs
-rwxr-xr-x 1 root root  336 Jul 31  2010 slrn
lrwxrwxrwx 1 root root   32 May 19 13:29 wpasupplicant -> ../../wpa_supplicant/ifupdown.sh

#961508#10
Date:
2023-01-31 19:10:46 UTC
From:
To:
I have a similar problem with ifupdown on my home server which has
accumulated a rather unfortunate pile of crap...

I am not sure where the problem comes from. I suspect it might be
related to the initrd raising the interfaces before ifup actually runs,
and the RTNETLINK error is about the gateway already being set.

The workaround I found was to just flush the device before the setup:

iface eth0 inet static
	# fix RTNETLINK errors on boot see https://bugs.debian.org/961508
        pre-up ip addr flush dev eth0 || true
	address 192.168.0.3
	netmask 255.255.255.0
	gateway 192.168.0.1

One might argue this should be the default and that ifup should clear
interfaces before bringing them up, but I'm not familiar enough with
ifup's intricacies to be certain.

Interestingly, I found this command on the raspi forum here:

https://raspberrypi.stackexchange.com/a/51947/32186

a.

#961508#15
Date:
2023-01-31 21:02:11 UTC
From:
To:
 I have not encountered this for a long time now. It looks as if ipdown
 now flushes:

# ifdown -v eth0
...
 ip -4 addr flush dev eth0
...

ael

#961508#20
Date:
2023-01-31 22:01:48 UTC
From:
To:
ah yes, that's ifdown, but on boot i suspect that doesn't run.
#961508#25
Date:
2023-02-03 14:29:54 UTC
From:
To:
Hi!

El 31/01/23 a las 14:10, Antoine Beaupré escribió:
...

I suppose this could be safe on a static configuration.

ael <witwall3@disroot.org>, your interfaces content is not available.
Could you please confirm your eth0 configuration is static?

Cheers,

#961508#30
Date:
2023-02-03 15:01:32 UTC
From:
To:
[..snip..]

Yes, static.

ael