Bug 989099

Summary: persistent-net.rules does not work for eth
Product: [Fedora] Fedora Reporter: Nerijus Baliūnas <nerijus>
Component: systemdAssignee: systemd-maint
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: extras-orphan, johannbg, jonathan, lnykryn, mhlavink, msekleta, notting, plautrba, systemd-maint, udev-maint, vpavlin, zbyszek
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-19 13:43:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
udevadm output
none
udevadm eth1 output none

Description Nerijus Baliūnas 2013-07-27 14:30:10 UTC
I have in /etc/udev/rules.d/70-persistent-net.rules:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="d4:3d:7e:02:xx:xx", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1b:21:0e:xx:xx", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

But when booting:
r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
r8169 0000:02:00.0 eth0: RTL8168evl/8111evl at 0xf7e16000, d4:3d:7e:02:xx:xx, XID 0c900800 IRQ 44
r8169 0000:02:00.0 eth0: jumbo features [frames: 9200 bytes, tx checksumming: ko]
e1000: Intel(R) PRO/1000 Network Driver - version 7.3.21-k8-NAPI
e1000: Copyright (c) 1999-2006 Intel Corporation.
e1000 0000:04:01.0 eth1: (PCI:33MHz:32-bit) 00:1b:21:0e:xx:xx
e1000 0000:04:01.0 eth1: Intel(R) PRO/1000 Network Connection

As you can see, d4:3d:7e:02:xx:xx is eth0, while it should be eth1.
The rule for USB wifi device in 70-persistent-net.rules works. Renaming to 99-persistent-net.rules did not help.
The same setup worked correctly in F18.

Comment 1 Kay Sievers 2013-07-27 14:37:09 UTC
Interface names can no longer be swapped, they need different names not
clashing with the kernel namespace. It is not expected to work in Fedora 19
or any newer release.

Edit the file to use any name other than eth0/1. Remove the rules and use
the new default names, or install biosdevname.

http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/

Comment 2 Nerijus Baliūnas 2013-07-28 12:35:55 UTC
I removed the rules (deleted the file completely), but after reboot interface names were still eth0 and eth1. How to get the new names?

Comment 3 Kay Sievers 2013-07-28 14:32:58 UTC
*** Bug 989212 has been marked as a duplicate of this bug. ***

Comment 4 Kay Sievers 2013-07-28 14:38:15 UTC
Hmm, what does (running as root):
  udevadm test /sys/class/net/eth0
print?

Comment 5 Nerijus Baliūnas 2013-07-30 00:04:50 UTC
# udevadm test /sys/class/net/eth0
calling: test
version 204
...
read rules file: /usr/lib/udev/rules.d/80-net-name-slot.rules
read rules file: /etc/udev/rules.d/80-persistent-net.rules
...
PROGRAM '/lib/udev/rename_device' /usr/lib/udev/rules.d/60-net.rules:1
starting '/lib/udev/rename_device'
'/lib/udev/rename_device' [9468] exit with return code 0
IMPORT builtin 'net_id' /usr/lib/udev/rules.d/75-net-description.rules:6
IMPORT builtin 'hwdb' /usr/lib/udev/rules.d/75-net-description.rules:12
NAME 'enp2s0' /usr/lib/udev/rules.d/80-net-name-slot.rules:12
RUN '/usr/lib/systemd/systemd-sysctl --prefix=/proc/sys/net/ipv4/conf/$name --prefix=/proc/sys/net/ipv4/neigh/$name --prefix=/proc/sys/net/ipv6/conf/$name --prefix=/proc/sys/net/ipv6/neigh/$name' /usr/lib/udev/rules.d/99-systemd.rules:52
changing net interface name from 'eth0' to 'enp2s0'
error changing net interface name eth0 to enp2s0: Device or resource busy

Will attach full command output.

Comment 6 Nerijus Baliūnas 2013-07-30 00:05:43 UTC
Created attachment 780185 [details]
udevadm output

Comment 7 Nerijus Baliūnas 2013-07-30 00:16:59 UTC
Please note - I do have /etc/udev/rules.d/80-persistent-net.rules, which is the same as in this bug's description except eth0 and eth1 are swapped.

But with or w/o it after reboot the interface names are the same - eth0 and eth1.

Comment 8 Kay Sievers 2013-07-30 01:01:02 UTC
(In reply to Nerijus Baliūnas from comment #7)
> Please note - I do have /etc/udev/rules.d/80-persistent-net.rules, which is
> the same as in this bug's description except eth0 and eth1 are swapped.
> 
> But with or w/o it after reboot the interface names are the same - eth0 and
> eth1.

The rules might fail any random time in the future, when the drivers are
loaded in a different order. It's not safe to use them. Userspace cannot
reliably rename devices in the same namespace the kernel uses to create new
devices.

(In reply to Nerijus Baliūnas from comment #2)
> I removed the rules (deleted the file completely), but after reboot
> interface names were still eth0 and eth1. How to get the new names?

By removing your rules file. If custom names are specified, the default names
will not be used.

Comment 9 Nerijus Baliūnas 2013-07-30 01:20:18 UTC
As I told before - I removed the rules file, but dmesg after reboot still showed the names as eth0 and eth1, but not enp2s0 or similar.

Comment 10 Kay Sievers 2013-07-30 01:26:45 UTC
(In reply to Nerijus Baliūnas from comment #9)
> As I told before - I removed the rules file, but dmesg after reboot still
> showed the names as eth0 and eth1, but not enp2s0 or similar.

The requested test in comment 4 shows that the rules file is still there,
that's why I assume that is the reason for the default names not getting active.

The output shows that the names are properly composed, just not applied.

If you want to debug it further, please repeat the test without the rules file.

Comment 11 Nerijus Baliūnas 2013-08-10 23:12:02 UTC
The same "error changing net interface name eth0 to enp2s0: Device or resource busy" w/o the rules file. But ifconfig eth0 down helped - after it was renamed correctly:

changing net interface name from 'eth0' to 'enp2s0'
renamed netif to 'enp2s0'
changed devpath to '/devices/pci0000:00/0000:00:1c.1/0000:02:00.0/net/enp2s0'
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:1c.1/0000:02:00.0/net/enp2s0

But running udevadm test /sys/class/net/eth1 does not rename the PCI e1000 card (output attached). Why?

Comment 12 Nerijus Baliūnas 2013-08-10 23:13:18 UTC
Created attachment 785287 [details]
udevadm eth1 output

Comment 13 Zbigniew Jędrzejewski-Szmek 2013-08-19 12:40:03 UTC
(In reply to Nerijus Baliūnas from comment #11)

Comment 14 Kay Sievers 2013-08-19 13:43:59 UTC
Busy interfaces can never be renamed, that was always the case. If something
uses the device already, brings it up, it is too late to rename it.

Seems you have a ifcfg file telling the device should be named eth1:
  NAME 'eth1' /usr/lib/udev/rules.d/60-net.rules:1