network interface names having strange names because of udev rules
Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
network interface names having strange names because of udev rules
Hello everyone,
I might be diggin deeper in udev documentation, but I admit I am really not good friend with udev.
My problem is simple here, but there are still many other things I fail to understand with udev.
I have built a Linux From Scratch with udev-208 taken from systemd but without compiling the whole systemd.
And my network interfaces are named enp0s3 to enp0s6 (I have 4 network cards), whlie I would like them to simply be named eth0 to eth3.
When I remove the /lib/udev/rules.d/80-net-name-slot.rules (and I reboot) they take the names eth0 et eth3.
But I'm not really satisfied with this rather dirty solution.
Does anyone know why these strange names are assaigned to my interfaces, and what could I do to have them named classically ?
Does anyone know why these strange names are assaigned to my interfaces, and what could I do to have them named classically ?
There is only one way: a very simple way.
You can write a simple udev rule to name your device anything you like.
Just a little reading a well written tutorial here and here.
I have passed the same stage, but later on, just few minutes I found udev
a very handy and interesting means for the job.
Thanks Malekmustaq. I'm gonna have a look at these documents.
(This is strange, your links don't seem to work in the post, I mean I cannot directly click on them, I had to look at your post code to see the URLs)
I'm not sure this will answer easily to my problem, because my Linux From Scratch is going to be installed on different machines with different hardware, so I'll have to write hardware-independent rules.
Well I'll read the doc and I'll see.
Hello again.
I have succeeded to get back correct names for my network interfaces, by adding a rule which is maybe not so clean, but it looks ok for now :
NAME=="", ENV{INTERFACE}!="", NAME="$ENV{INTERFACE}"
but I still encounter problems with udev. I detail them in a next post.
I take /dev/sr0 as an example.
I then remove the modules cdrom and sr_mod, and try again :
Code:
starting 'scsi_id --export --whitelisted -d /dev/sr0'
'scsi_id --export --whitelisted -d /dev/sr0'(out) 'ID_SCSI=1'
'scsi_id --export --whitelisted -d /dev/sr0'(out) 'ID_VENDOR='
'scsi_id --export --whitelisted -d /dev/sr0'(out) 'ID_VENDOR_ENC='
'scsi_id --export --whitelisted -d /dev/sr0'(out) 'ID_MODEL='
'scsi_id --export --whitelisted -d /dev/sr0'(out) 'ID_MODEL_ENC='
'scsi_id --export --whitelisted -d /dev/sr0'(out) 'ID_REVISION='
'scsi_id --export --whitelisted -d /dev/sr0'(out) 'ID_TYPE='
'scsi_id --export --whitelisted -d /dev/sr0' [3994] exit with return code 0
IMPORT builtin 'path_id' /lib/udev/rules.d/60-persistent-storage.rules:55
IMPORT builtin 'path_id' returned non-zero
update old name, '/dev/disk/by-id/ata-QEMU_DVD-ROM_QM00003' no longer belonging to '/devices/pci0000:00/0000:00:01.1/ata2/host1/target1:0:0/1:0:0:0/block/sr0'
no reference left, remove '/dev/disk/by-id/ata-QEMU_DVD-ROM_QM00003'
update old name, '/dev/disk/by-label/CDROM' no longer belonging to '/devices/pci0000:00/0000:00:01.1/ata2/host1/target1:0:0/1:0:0:0/block/sr0'
no reference left, remove '/dev/disk/by-label/CDROM'
update old name, '/dev/disk/by-uuid/2015-01-08-13-04-59-00' no longer belonging to '/devices/pci0000:00/0000:00:01.1/ata2/host1/target1:0:0/1:0:0:0/block/sr0'
no reference left, remove '/dev/disk/by-uuid/2015-01-08-13-04-59-00'
handling device node '/dev/sr0', devnum=b11:0, mode=0660, uid=0, gid=12
can not stat() node '/dev/sr0' (No such file or directory)
created db file '/run/udev/data/b11:0' for '/devices/pci0000:00/0000:00:01.1/ata2/host1/target1:0:0/1:0:0:0/block/sr0'
passed -1 bytes to netlink monitor 0x103a270
seq 2598 processed with 0
seq 2598 done with 0
passed 270 bytes to netlink monitor 0x1030540
seq 2601 running
device 0x10499b0 filled with db file data
I really don't understand what's wrong. If I create rules to execute commands with NAEM=='sr0", it works, but udev still refuses to create my devices.
Would anyone have a clue about it ?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.