LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 12-23-2014, 04:35 AM   #1
pascaltaf
LQ Newbie
 
Registered: Nov 2014
Location: Paris suburb
Distribution: LFS, Debian
Posts: 26

Rep: Reputation: Disabled
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 ?
 
Old 12-23-2014, 12:23 PM   #2
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,669

Rep: Reputation: 498Reputation: 498Reputation: 498Reputation: 498Reputation: 498
Quote:
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.

Good luck and hope it helps.
 
Old 12-24-2014, 03:31 AM   #3
pascaltaf
LQ Newbie
 
Registered: Nov 2014
Location: Paris suburb
Distribution: LFS, Debian
Posts: 26

Original Poster
Rep: Reputation: Disabled
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.
 
Old 12-24-2014, 06:40 AM   #4
Head_on_a_Stick
Senior Member
 
Registered: Dec 2014
Location: London, England
Distribution: Debian stable (and OpenBSD-current)
Posts: 1,187

Rep: Reputation: 285Reputation: 285Reputation: 285
You can add a kernel command line parameter to your boot loader/manager:
Code:
net.ifnames=0
http://www.freedesktop.org/wiki/Soft...nterfaceNames/
 
Old 01-08-2015, 09:02 AM   #5
pascaltaf
LQ Newbie
 
Registered: Nov 2014
Location: Paris suburb
Distribution: LFS, Debian
Posts: 26

Original Poster
Rep: Reputation: Disabled
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.
 
Old 01-08-2015, 09:07 AM   #6
pascaltaf
LQ Newbie
 
Registered: Nov 2014
Location: Paris suburb
Distribution: LFS, Debian
Posts: 26

Original Poster
Rep: Reputation: Disabled
udev doesn't actually create the devices

So, the problem is simple : udev loads my kernel modules but does not create devices, or very few ones.
Here is what I do, on a kvm machine :
Code:
$ ls /dev | wc
17
$ ls /dev > /tmp/whatsindev1
$ lsmod
$ /lib/udev/udevd --debug 2>&1 | tee /tmp/udevout
$ udevadm trigger
$ lsmod
sym53c8xx 71330 0 - Live 0xffffffffa00a6000
e1000 100621 0 - Live 0xffffffffa0026000
sr_mod 13651 0 - Live 0xffffffffa001e000
cdrom 34256 1 sr_mod, Live 0xffffffffa0011000
processor 22868 0 - Live 0xffffffffa0000000
$ ls /dev | wc
23
$ ls /dev > /tmp/whatsindev2
$ diff /tmp/whatsindev{1,2}
+char
 console
+core
+fd
 null
 ptmx
 pts
 pty
 random
+stderr
+stdin
+stdout
 tty2
 tty3
 tty4
In the output of udevd, I can see these lines :
Code:
error reading /etc/udev/hwdb.bin: No such file or directory
load module index
read rules file: /lib/udev/rules.d/42-usb-hid-pm.rules
read rules file: /lib/udev/rules.d/50-firmware.rules
read rules file: /lib/udev/rules.d/50-udev-default.rules
read rules file: /lib/udev/rules.d/60-cdrom_id.rules
read rules file: /lib/udev/rules.d/60-keyboard.rules
read rules file: /lib/udev/rules.d/60-persistent-alsa.rules
read rules file: /lib/udev/rules.d/60-persistent-input.rules
read rules file: /lib/udev/rules.d/60-persistent-serial.rules
read rules file: /lib/udev/rules.d/60-persistent-storage-tape.rules
read rules file: /lib/udev/rules.d/60-persistent-storage.rules
read rules file: /lib/udev/rules.d/60-persistent-v4l.rules
...
'cdrom_id --lock-media /dev/sr0'(out) 'ID_CDROM=1'
'cdrom_id --lock-media /dev/sr0'(out) 'ID_CDROM_DVD=1'
'cdrom_id --lock-media /dev/sr0'(out) 'ID_CDROM_MRW=1'
'cdrom_id --lock-media /dev/sr0'(out) 'ID_CDROM_MRW_W=1'
'cdrom_id --lock-media /dev/sr0'(out) 'ID_CDROM_MEDIA=1'
'cdrom_id --lock-media /dev/sr0'(out) 'ID_CDROM_MEDIA_DVD=1'
'cdrom_id --lock-media /dev/sr0'(out) 'ID_CDROM_MEDIA_TRACK_COUNT_DATA=1'
'cdrom_id --lock-media /dev/sr0' [2196] exit with return code 0
LINK 'cdrom' /lib/udev/rules.d/60-cdrom_id.rules:18
device 0x115ac30 has devpath '/devices/pci0000:00/0000:00:01.1/ata2/host1/target1:0:0/1:0:0:0'
device 0x115b4e0 has devpath '/devices/pci0000:00/0000:00:01.1/ata2/host1/target1:0:0'
device 0x116c890 has devpath '/devices/pci0000:00/0000:00:01.1/ata2/host1'
device 0x115f210 has devpath '/devices/pci0000:00/0000:00:01.1/ata2'
device 0x115f730 has devpath '/devices/pci0000:00/0000:00:01.1'
device 0x115fd10 has devpath '/devices/pci0000:00'
IMPORT 'ata_id --export /dev/sr0' /lib/udev/rules.d/60-persistent-storage.rules:32
starting 'ata_id --export /dev/sr0'
seq 1277 queued, 'change' 'block'
'ata_id --export /dev/sr0'(out) 'ID_ATA=1'
'ata_id --export /dev/sr0'(out) 'ID_TYPE=cd'
'ata_id --export /dev/sr0'(out) 'ID_BUS=ata'
'ata_id --export /dev/sr0'(out) 'ID_MODEL=QEMU_DVD-ROM'
'ata_id --export /dev/sr0'(out) 'ID_MODEL_ENC=QEMU\x20DVD-ROM\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'
'ata_id --export /dev/sr0'(out) 'ID_REVISION=0.12.5'
'ata_id --export /dev/sr0'(out) 'ID_SERIAL=QEMU_DVD-ROM_QM00003'
'ata_id --export /dev/sr0'(out) 'ID_SERIAL_SHORT=QM00003'
'ata_id --export /dev/sr0' [2254] exit with return code 0
LINK 'disk/by-id/ata-QEMU_DVD-ROM_QM00003' /lib/udev/rules.d/60-persistent-storage.rules:42
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 ?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
udev: persistent scsi disk names cothgr Linux - Software 3 06-27-2014 04:44 PM
Network interface names: p6p1 havard Linux - Networking 3 09-16-2011 09:53 AM
network interface keeps switching names on start-up slack_dude Slackware 2 02-15-2007 07:57 AM
udev not creating dev names as expected ocgltd Linux - Hardware 1 12-27-2006 11:17 PM
SAMBA: display of share names is OK but files names are wrong superandrzej Linux - Software 5 02-02-2004 09:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 05:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration