Skip to contentSkip to conversation

'RTNETLINK answers: File exists' error

DISCUSSION Marco Gaiarin 2 participants 5 messages Mar 10, 2021 – Mar 12, 2021

lore
Share & tools
lore
#0 lore raw

Sometime in my firewall (based on debian), using my custom script and with policy routing enabled, i hit this error:

ifup vlan191
Set name-type for VLAN subsystem. Should be visible in /proc/net/vlan/config Added VLAN with VID = 191 to IF -:eth2:-
RTNETLINK answers: File exists
Failed to bring up vlan191.

this typically happen when i 'play' with an interface (eg, i tear it up and down many times for testing); after a bit of play (but something suddenly) the interface go into a undefined state; interface is up (eg, 'ifconfig' return the correct data) but routing is a mess.

Sometime the only thing to do is reboot the firewall.

Probably i do something wrong in my script, but... how can i 'cleanup' the mess without rebooting?

Thanks.

Signature · 8 lines
dott. Marco Gaiarin				        GNUPG Key ID: 240A3D66
  Associazione ``La Nostra Famiglia''          http://www.lanostrafamiglia.it/
  Polo FVG   -   Via della Bontà, 7 - 33078   -   San Vito al Tagliamento (PN)
  marco.gaiarin(at)lanostrafamiglia.it   t +39-0434-842711   f +39-0434-842797

		Dona il 5 PER MILLE a LA NOSTRA FAMIGLIA!
      http://www.lanostrafamiglia.it/index.php/it/sostienici/5x1000
	(cf 00307430132, categoria ONLUS oppure RICERCA SANITARIA)
#1 lore raw
Quoted 7 lines · Marco Gaiarin

Sometime in my firewall (based on debian), using my custom script and with policy routing enabled, i hit this error:

ifup vlan191
Set name-type for VLAN subsystem. Should be visible in /proc/net/vlan/config Added VLAN with VID == 191 to IF -:eth2:-
RTNETLINK answers: File exists
Failed to bring up vlan191.

That means that the kernel thinks that the route / interface that you are, or the script on your behalf is, trying to create already exists.

Quoted 1 line

this typically happen when i 'play' with an interface (eg, i tear it up and down many times for testing); after a bit of play (but something suddenly) the interface go into a undefined state; interface is up (eg, 'ifconfig' return the correct data) but routing is a mess.

*nod*

Been there.
Done that.

Quoted 1 line

Sometime the only thing to do is reboot the firewall.

Na. You generally shouldn't need to reboot.

Quoted 2 lines

Probably i do something wrong in my script, but... how can i 'cleanup' the mess without rebooting?

In between script invocations, check to make sure that any VLAN interfaces you are messing with have been removed and that any Ethernet interfaces are down.

Doing that should remove any routes associated with them and remove the interfaces so that you / the script can start anew when creating them.

Signature · 2 lines
Grant. . . .
unix || die
#2 lore raw
In reply to Marco Gaiarin

Mandi! Grant Taylor
In chel di` si favelave...

Quoted 3 lines
Quoted 1 line

RTNETLINK answers: File exists

That means that the kernel thinks that the route / interface that you are, or the script on your behalf is, trying to create already exists.

Ok.

Quoted 7 lines
Quoted 2 lines

Probably i do something wrong in my script, but... how can i 'cleanup' the mess without rebooting?

In between script invocations, check to make sure that any VLAN interfaces you are messing with have been removed and that any Ethernet interfaces are down.
Doing that should remove any routes associated with them and remove the interfaces so that you / the script can start anew when creating them.

As usual typically happen not on a testbed system, but in production, but every time i've tried to deconfigure manually the interface (with 'ifconfig IFNAME down' or 'ip link delete IFNAME' nothing changed, eg interface get correctly deconfigured, but subsequent 'ifup IFNAME' lead to 'RTNETLINK answers: File exists'.

Signature · 8 lines
dott. Marco Gaiarin				        GNUPG Key ID: 240A3D66
  Associazione ``La Nostra Famiglia''          http://www.lanostrafamiglia.it/
  Polo FVG   -   Via della Bontà, 7 - 33078   -   San Vito al Tagliamento (PN)
  marco.gaiarin(at)lanostrafamiglia.it   t +39-0434-842711   f +39-0434-842797

		Dona il 5 PER MILLE a LA NOSTRA FAMIGLIA!
      http://www.lanostrafamiglia.it/index.php/it/sostienici/5x1000
	(cf 00307430132, categoria ONLUS oppure RICERCA SANITARIA)
#3 lore raw
In reply to Marco Gaiarin

Mandi! Justin Denick
In chel di` si favelave...

Quoted 1 line

might be worth looking into ip route list

I suspect also a routing trouble.

Quoted 2 lines

the "file" that exists might just be the default gw or some routing table added by the interface, but not removed when it was taken down.

OK, at least one time i was able to inspect carefully the routing tables and filters and remove manually eventally crap laying around, but still i get error.

There's some way to 'flush', cleanup, all the route for an interface, but without interfere with others?

Signature · 8 lines
dott. Marco Gaiarin				        GNUPG Key ID: 240A3D66
  Associazione ``La Nostra Famiglia''          http://www.lanostrafamiglia.it/
  Polo FVG   -   Via della Bontà, 7 - 33078   -   San Vito al Tagliamento (PN)
  marco.gaiarin(at)lanostrafamiglia.it   t +39-0434-842711   f +39-0434-842797

		Dona il 5 PER MILLE a LA NOSTRA FAMIGLIA!
      http://www.lanostrafamiglia.it/index.php/it/sostienici/5x1000
	(cf 00307430132, categoria ONLUS oppure RICERCA SANITARIA)
#4 lore raw
In reply to Marco Gaiarin
Quoted 1 line · Marco Gaiarin

There's some way to 'flush', cleanup, all the route for an interface, but without interfere with others?

Taking the interface down has always done that for me.

Any method suffices to take the interface down; ifconfig, ip, distro init scripts, removing the driver module, etc.

Signature · 2 lines
Grant. . . .
unix || die