The officially official Devuan Forum!

You are not logged in.

#1 2018-09-04 19:06:35

YYY
Member
Registered: 2018-09-04
Posts: 3  

/etc/udev/rules.d/70-persistent-net.rules rule not working (ASCII)

Hello!

I make clear Devuan ASCII installation.
My computer have two net card - one card onboard and other in PCI-e slot.
Two card have same chipset (realtek)
In system i saw two interfaces - eth0 and eth1.
Card with MAC "XX:XX:XX:XX:XX:XX" named as eth0
Card with MAC "YY:YY:YY:YY:YY:YY" named as eth1

Now i want change interfaces names.
I want
card "XX:XX:XX:XX:XX:XX" with name eth1
card "YY:YY:YY:YY:YY:YY" with name eth0

I not find file /etc/udev/rules.d/70-persistent-net.rules
But in ubuntu 16.04 with upstart i can made it file manually and it work.

In Devuan ASCII i made file /etc/udev/rules.d/70-persistent-net.rules with rules

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="YY:YY:YY:YY:YY:YY", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="XX:XX:XX:XX:XX:XX", NAME="eth1"

it not work .... i try

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="XX:XX:XX:XX:XX:XX", NAME="eth1"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="YY:YY:YY:YY:YY:YY", NAME="eth0"

but it not work to sad


How i can change interfaces name in Devuan ASCII ?


Thank you!


PS:
I read "/etc/udev/rules.d/70-persistent-net.rules not regenerating [SOLVED] (https://dev1galaxy.org/viewtopic.php?id=2333)" but it not help me...

Offline

#2 2018-09-04 19:57:28

YYY
Member
Registered: 2018-09-04
Posts: 3  

Re: /etc/udev/rules.d/70-persistent-net.rules rule not working (ASCII)

I try test in VB
with one card

command
udevadm test /sys/class/net/eth0
saw what udev read my file /etc/udev/rules.d/10-network.rules
and i can change eth0 name on eth1 name - all work


I try test in VB
with two card

command
udevadm test /sys/class/net/eth0
saw what udev read my file /etc/udev/rules.d/10-network.rules
but write "Device or resources busy" and not change eth0 to eth1

calling: test
version 3.2.2
=== trie on-disk ===
tool version:          3
file size:         7431499 bytes
header size             80 bytes
strings            1850651 bytes
nodes              5580768 bytes
Load module index
timestamp of '/etc/udev/rules.d' changed
timestamp of '/run/udev/rules.d' changed
Reading rules file: /etc/udev/rules.d/10-network.rules
Reading rules file: /lib/udev/rules.d/40-usb_modeswitch.rules
Reading rules file: /lib/udev/rules.d/50-firmware.rules
Reading rules file: /lib/udev/rules.d/50-udev-default.rules
Reading rules file: /lib/udev/rules.d/55-dm.rules
Reading rules file: /lib/udev/rules.d/60-block.rules
Reading rules file: /lib/udev/rules.d/60-cdrom_id.rules
Reading rules file: /lib/udev/rules.d/60-drm.rules
Reading rules file: /lib/udev/rules.d/60-evdev.rules
Reading rules file: /lib/udev/rules.d/60-fuse.rules
Reading rules file: /lib/udev/rules.d/60-libgphoto2-6.rules
Reading rules file: /lib/udev/rules.d/60-persistent-alsa.rules
Reading rules file: /lib/udev/rules.d/60-persistent-input.rules
Reading rules file: /lib/udev/rules.d/60-persistent-storage-dm.rules
Reading rules file: /lib/udev/rules.d/60-persistent-storage-tape.rules
Reading rules file: /lib/udev/rules.d/60-persistent-storage.rules
Reading rules file: /lib/udev/rules.d/60-persistent-v4l.rules
Reading rules file: /lib/udev/rules.d/60-sensor.rules
Reading rules file: /lib/udev/rules.d/60-serial.rules
Reading rules file: /lib/udev/rules.d/64-btrfs.rules
Reading rules file: /lib/udev/rules.d/64-xorg-xkb.rules
Reading rules file: /lib/udev/rules.d/65-libwacom.rules
Reading rules file: /lib/udev/rules.d/69-libmtp.rules
Reading rules file: /lib/udev/rules.d/69-wacom.rules
Reading rules file: /lib/udev/rules.d/70-mouse.rules
Reading rules file: /lib/udev/rules.d/70-power-switch.rules
Reading rules file: /lib/udev/rules.d/70-touchpad.rules
Reading rules file: /lib/udev/rules.d/70-uaccess.rules
Reading rules file: /lib/udev/rules.d/70-udev-acl.rules
Reading rules file: /lib/udev/rules.d/71-seat.rules
Reading rules file: /lib/udev/rules.d/73-idrac.rules
Reading rules file: /lib/udev/rules.d/73-seat-late.rules
Reading rules file: /lib/udev/rules.d/73-special-net-names.rules
Reading rules file: /lib/udev/rules.d/73-usb-net-by-mac.rules
Reading rules file: /lib/udev/rules.d/75-net-description.rules
Reading rules file: /lib/udev/rules.d/75-persistent-net-generator.rules
Reading rules file: /lib/udev/rules.d/75-probe_mtd.rules
Reading rules file: /lib/udev/rules.d/78-sound-card.rules
Reading rules file: /lib/udev/rules.d/80-drivers.rules
Reading rules file: /lib/udev/rules.d/80-ifupdown.rules
Reading rules file: /lib/udev/rules.d/80-libinput-device-groups.rules
Reading rules file: /lib/udev/rules.d/80-net-name-slot.rules
Reading rules file: /lib/udev/rules.d/80-networking.rules
Reading rules file: /lib/udev/rules.d/80-udisks2.rules
Reading rules file: /lib/udev/rules.d/85-hdparm.rules
Reading rules file: /lib/udev/rules.d/85-hwclock.rules
Reading rules file: /lib/udev/rules.d/90-alsa-restore.rules
Reading rules file: /lib/udev/rules.d/90-console-setup.rules
Reading rules file: /lib/udev/rules.d/90-libinput-model-quirks.rules
rules contain 196608 bytes tokens (16384 * 12 bytes), 22764 bytes strings
17168 strings (138193 bytes), 14837 de-duplicated (117761 bytes), 2332 trie nodes used
NAME 'eth1' /etc/udev/rules.d/10-network.rules:1
IMPORT builtin 'net_id' /lib/udev/rules.d/75-net-description.rules:6
IMPORT builtin 'hwdb' /lib/udev/rules.d/75-net-description.rules:12
RUN 'ifupdown-hotplug' /lib/udev/rules.d/80-ifupdown.rules:5
RUN 'net.agent' /lib/udev/rules.d/80-networking.rules:1
changing net interface name from 'eth0' to 'eth1'
Error changing net interface name eth0 to eth1: Device or resource busy
could not rename interface '2' from 'eth0' to 'eth1': Device or resource busy
created db file '/run/udev/data/n2' for '/devices/pci0000:00/0000:00:03.0/net/eth0'
Unload module index
This program is for debugging only, it does not run any program
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run.

ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:03.0/net/eth0
ID_BUS=pci
ID_MODEL_FROM_DATABASE=82540EM Gigabit Ethernet Controller (PRO/1000 MT Desktop Adapter)
ID_MODEL_ID=0x100e
ID_NET_NAME_MAC=enx08002767c8d4
ID_NET_NAME_PATH=enp0s3
ID_OUI_FROM_DATABASE=PCS Systemtechnik GmbH
ID_PCI_CLASS_FROM_DATABASE=Network controller
ID_PCI_SUBCLASS_FROM_DATABASE=Ethernet controller
ID_VENDOR_FROM_DATABASE=Intel Corporation
ID_VENDOR_ID=0x8086
IFINDEX=2
INTERFACE=eth0
SUBSYSTEM=net
USEC_INITIALIZED=3547643
run: 'ifupdown-hotplug'
run: 'net.agent'

udevadm test /sys/class/net/eth1
saw what udev read my file /etc/udev/rules.d/10-network.rules
but write "File exist" and not change eth1 to eth0

calling: test
version 3.2.2
=== trie on-disk ===
tool version:          3
file size:         7431499 bytes
header size             80 bytes
strings            1850651 bytes
nodes              5580768 bytes
Load module index
timestamp of '/etc/udev/rules.d' changed
timestamp of '/run/udev/rules.d' changed
Reading rules file: /etc/udev/rules.d/10-network.rules
Reading rules file: /lib/udev/rules.d/40-usb_modeswitch.rules
Reading rules file: /lib/udev/rules.d/50-firmware.rules
Reading rules file: /lib/udev/rules.d/50-udev-default.rules
Reading rules file: /lib/udev/rules.d/55-dm.rules
Reading rules file: /lib/udev/rules.d/60-block.rules
Reading rules file: /lib/udev/rules.d/60-cdrom_id.rules
Reading rules file: /lib/udev/rules.d/60-drm.rules
Reading rules file: /lib/udev/rules.d/60-evdev.rules
Reading rules file: /lib/udev/rules.d/60-fuse.rules
Reading rules file: /lib/udev/rules.d/60-libgphoto2-6.rules
Reading rules file: /lib/udev/rules.d/60-persistent-alsa.rules
Reading rules file: /lib/udev/rules.d/60-persistent-input.rules
Reading rules file: /lib/udev/rules.d/60-persistent-storage-dm.rules
Reading rules file: /lib/udev/rules.d/60-persistent-storage-tape.rules
Reading rules file: /lib/udev/rules.d/60-persistent-storage.rules
Reading rules file: /lib/udev/rules.d/60-persistent-v4l.rules
Reading rules file: /lib/udev/rules.d/60-sensor.rules
Reading rules file: /lib/udev/rules.d/60-serial.rules
Reading rules file: /lib/udev/rules.d/64-btrfs.rules
Reading rules file: /lib/udev/rules.d/64-xorg-xkb.rules
Reading rules file: /lib/udev/rules.d/65-libwacom.rules
Reading rules file: /lib/udev/rules.d/69-libmtp.rules
Reading rules file: /lib/udev/rules.d/69-wacom.rules
Reading rules file: /lib/udev/rules.d/70-mouse.rules
Reading rules file: /lib/udev/rules.d/70-power-switch.rules
Reading rules file: /lib/udev/rules.d/70-touchpad.rules
Reading rules file: /lib/udev/rules.d/70-uaccess.rules
Reading rules file: /lib/udev/rules.d/70-udev-acl.rules
Reading rules file: /lib/udev/rules.d/71-seat.rules
Reading rules file: /lib/udev/rules.d/73-idrac.rules
Reading rules file: /lib/udev/rules.d/73-seat-late.rules
Reading rules file: /lib/udev/rules.d/73-special-net-names.rules
Reading rules file: /lib/udev/rules.d/73-usb-net-by-mac.rules
Reading rules file: /lib/udev/rules.d/75-net-description.rules
Reading rules file: /lib/udev/rules.d/75-persistent-net-generator.rules
Reading rules file: /lib/udev/rules.d/75-probe_mtd.rules
Reading rules file: /lib/udev/rules.d/78-sound-card.rules
Reading rules file: /lib/udev/rules.d/80-drivers.rules
Reading rules file: /lib/udev/rules.d/80-ifupdown.rules
Reading rules file: /lib/udev/rules.d/80-libinput-device-groups.rules
Reading rules file: /lib/udev/rules.d/80-net-name-slot.rules
Reading rules file: /lib/udev/rules.d/80-networking.rules
Reading rules file: /lib/udev/rules.d/80-udisks2.rules
Reading rules file: /lib/udev/rules.d/85-hdparm.rules
Reading rules file: /lib/udev/rules.d/85-hwclock.rules
Reading rules file: /lib/udev/rules.d/90-alsa-restore.rules
Reading rules file: /lib/udev/rules.d/90-console-setup.rules
Reading rules file: /lib/udev/rules.d/90-libinput-model-quirks.rules
rules contain 196608 bytes tokens (16384 * 12 bytes), 22764 bytes strings
17168 strings (138193 bytes), 14837 de-duplicated (117761 bytes), 2332 trie nodes used
NAME 'eth0' /etc/udev/rules.d/10-network.rules:2
IMPORT builtin 'net_id' /lib/udev/rules.d/75-net-description.rules:6
IMPORT builtin 'hwdb' /lib/udev/rules.d/75-net-description.rules:12
RUN 'ifupdown-hotplug' /lib/udev/rules.d/80-ifupdown.rules:5
RUN 'net.agent' /lib/udev/rules.d/80-networking.rules:1
changing net interface name from 'eth1' to 'eth0'
Error changing net interface name eth1 to eth0: File exists
could not rename interface '3' from 'eth1' to 'eth0': File exists
created db file '/run/udev/data/n3' for '/devices/pci0000:00/0000:00:08.0/net/eth1'
Unload module index
This program is for debugging only, it does not run any program
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run.

ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:08.0/net/eth1
ID_BUS=pci
ID_MODEL_FROM_DATABASE=82540EM Gigabit Ethernet Controller (PRO/1000 MT Desktop Adapter)
ID_MODEL_ID=0x100e
ID_NET_NAME_MAC=enx080027f0c455
ID_NET_NAME_PATH=enp0s8
ID_OUI_FROM_DATABASE=PCS Systemtechnik GmbH
ID_PCI_CLASS_FROM_DATABASE=Network controller
ID_PCI_SUBCLASS_FROM_DATABASE=Ethernet controller
ID_VENDOR_FROM_DATABASE=Intel Corporation
ID_VENDOR_ID=0x8086
IFINDEX=3
INTERFACE=eth1
SUBSYSTEM=net
USEC_INITIALIZED=3546287
run: 'ifupdown-hotplug'
run: 'net.agent'

Last edited by YYY (2018-09-04 19:58:18)

Offline

#3 2018-09-04 20:26:18

YYY
Member
Registered: 2018-09-04
Posts: 3  

Re: /etc/udev/rules.d/70-persistent-net.rules rule not working (ASCII)

Ok...

i try use ifrename (apt-get install ifrename)

it work with two run and with two config file
first run with config1 rename eth0 -> eth2
second run with config2 rename eth1 -> eth0 and eth2 -> eth1

not good, but work...


I think better made original name for interfaces like "lan"/"wan" through file  /etc/udev/rules.d/70-persistent-net.rules ...

Offline

#4 2018-09-04 23:54:17

ralph.ronnquist
Administrator
From: Clifton Hill, Victoria, AUS
Registered: 2016-11-30
Posts: 266  

Re: /etc/udev/rules.d/70-persistent-net.rules rule not working (ASCII)

I suppose, if you choose to stay with the names eth0 and eth2 (i.e. not eth1) it might also work as udev rules.

Offline

#5 2018-09-05 18:20:47

bbatten
Member
Registered: 2017-07-02
Posts: 29  

Re: /etc/udev/rules.d/70-persistent-net.rules rule not working (ASCII)

@YYY,
For me, I find including the phrase KERNEL=="eth*" works. e.g.:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="11:22:33:44:55:66", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

Hope this helps.

Offline

Board footer