Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
udev 197 predictable network names
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
pakjebakmeel
n00b
n00b


Joined: 13 Feb 2012
Posts: 48

PostPosted: Wed Feb 06, 2013 9:30 am    Post subject: udev 197 predictable network names Reply with quote

Question,

I would like to move along and delete the /lib/udev/rules.d/80-net-name-slot.rules file so I get predictable network names. Only remark is that the box is completely headless and I don't feel like grabbing a keyboard and monitor. I want to do this remote without loosing connectivity.

My plan is to update the symlink in /etc/init.d/net.eth0 to /etc/init.d/net.(predictablename) and ammend /etc/conf.d/net, delete the file and reboot.

My question is what will the new predictable name be? I ran this script:

Code:
for i in /sys/class/net/*; do
  echo "==$i"
  udevadm test-builtin net_id "$i";
  echo
done 2>/dev/null


the relevant portion of output is:

Code:
==/sys/class/net/eth0
ID_NET_NAME_MAC=enx00224d7c586a
ID_NET_NAME_PATH=enp1s0


Would the new name become enx00224d7c586a or enp1s0? Which one would udev use? I've searched but cannot find the anwser.

So, I will update the symlink

Code:
lrwxrwxrwx 1 root root    6 Dec  7 11:44 net.eth0 -> net.lo

to:
Code:
lrwxrwxrwx 1 root root    6 Dec  7 11:44 net.enp1s0 -> net.lo


Next I should update the /etc/conf.d/net from:

Code:
config_eth0="192.168.10.10/24"
routes_eth0="default via 192.168.10.1"


to:

Code:
config_enp1s0="192.168.10.10/24"
routes_enp1s0="default via 192.168.10.1"


The delete this file:

Code:
/lib/udev/rules.d/80-net-name-slot.rules


and reboot.. fingers crossed and I should be ok right?
Back to top
View user's profile Send private message
SamuliSuominen
Retired Dev
Retired Dev


Joined: 30 Sep 2005
Posts: 2133
Location: Finland

PostPosted: Wed Feb 06, 2013 9:43 am    Post subject: Re: udev 197 predictable network names Reply with quote

pakjebakmeel wrote:

The delete this file:
Code:
/lib/udev/rules.d/80-net-name-slot.rules



Where did you find the information that you should delete /lib/udev/rules.d/80-net-name-slot.rules? Nothing should be deleted from /lib/udev/rules.d!

If you want the new scheme you delete /etc/udev/rules.d/80-net-name-slot.rules OR copy the /lib/udev/rules.d/80-net-name-slot.rules to /etc/udev/rules.d/

In first option, when deleted from /etc, the file from /lib takes over. In second option the content of the file from /lib is copied to /etc and the /etc one stays in control. Both achieving the same result, the new scheme being used.

By definition, all of /usr, /lib, /lib32, /lib64, /bin, /sbin are all static directories allowed to be touched only by the Package Manager (portage)

I suppose you better read the migration news item and the wiki page again.
Back to top
View user's profile Send private message
pakjebakmeel
n00b
n00b


Joined: 13 Feb 2012
Posts: 48

PostPosted: Wed Feb 06, 2013 10:02 am    Post subject: Re: udev 197 predictable network names Reply with quote

ssuominen wrote:
pakjebakmeel wrote:

The delete this file:
Code:
/lib/udev/rules.d/80-net-name-slot.rules



Where did you find the information that you should delete /lib/udev/rules.d/80-net-name-slot.rules? Nothing should be deleted from /lib/udev/rules.d!

If you want the new scheme you delete /etc/udev/rules.d/80-net-name-slot.rules OR copy the /lib/udev/rules.d/80-net-name-slot.rules to /etc/udev/rules.d/

In first option, when deleted from /etc, the file from /lib takes over. In second option the content of the file from /lib is copied to /etc and the /etc one stays in control. Both achieving the same result, the new scheme being used.

By definition, all of /usr, /lib, /lib32, /lib64, /bin, /sbin are all static directories allowed to be touched only by the Package Manager (portage)

I suppose you better read the migration news item and the wiki page again.


Thank you for that, I will confirm I get the right file in /etc/udev/rules.d/80-net-name-slot.rules deleted. I actually read both the news and the wiki but did not have it in front of me when typing this post and messed up the files. I will re-read the news/wiki to make sure I refer to the correct file.

But apart from that, the main question still remains; would udev use enx00224d7c586a or enp1s0?

Code:
gentoo rules.d # udevadm test-builtin net_id /sys/class/net/eth0 2> /dev/null
ID_NET_NAME_MAC=enx00224d7c586a
ID_NET_NAME_PATH=enp1s0
Back to top
View user's profile Send private message
SamuliSuominen
Retired Dev
Retired Dev


Joined: 30 Sep 2005
Posts: 2133
Location: Finland

PostPosted: Wed Feb 06, 2013 11:42 am    Post subject: Re: udev 197 predictable network names Reply with quote

pakjebakmeel wrote:

But apart from that, the main question still remains; would udev use enx00224d7c586a or enp1s0?

Code:
gentoo rules.d # udevadm test-builtin net_id /sys/class/net/eth0 2> /dev/null
ID_NET_NAME_MAC=enx00224d7c586a
ID_NET_NAME_PATH=enp1s0


Looks correct to me and the other threads seem to concur. Google for "udevadm test-builtin net_id" and you'll find it has worked for others too.
Back to top
View user's profile Send private message
derk
Guru
Guru


Joined: 10 Mar 2003
Posts: 347
Location: St Thomas Ontario

PostPosted: Wed Feb 06, 2013 12:24 pm    Post subject: Reply with quote

udev can use either name you get to pick .. which you prefer ..


created a bash shell script from code in original comment see bug 455822 for general use
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3264
Location: Canada

PostPosted: Wed Feb 06, 2013 6:16 pm    Post subject: Reply with quote

What actually is the reason to use predictable names on a headless server, which probably does not vary its hardwareand ?. Did you 'non-predictable'
jump a lot ?
Back to top
View user's profile Send private message
SamuliSuominen
Retired Dev
Retired Dev


Joined: 30 Sep 2005
Posts: 2133
Location: Finland

PostPosted: Wed Feb 06, 2013 6:19 pm    Post subject: Reply with quote

dmpogo wrote:
What actually is the reason to use predictable names on a headless server, which probably does not vary its hardwareand ?. Did you 'non-predictable'
jump a lot ?


If the box only has one network card, it'll always be eth0 and this won't be any of issue -- except you can still use the new predicatable names for just heck of it... or for consistency to match other boxes.
Back to top
View user's profile Send private message
pakjebakmeel
n00b
n00b


Joined: 13 Feb 2012
Posts: 48

PostPosted: Wed Feb 06, 2013 7:38 pm    Post subject: Reply with quote

derk wrote:
udev can use either name you get to pick .. which you prefer ..


created a bash shell script from code in original comment see bug 455822 for general use


Thanks, that was the answer I was looking for.. Uhm I did try and find the bug you mention but no success. When I try and google for it using different terms I keep ending up in this topic, no other useful results. What's this bug about? Have you got a link?
Back to top
View user's profile Send private message
derk
Guru
Guru


Joined: 10 Mar 2003
Posts: 347
Location: St Thomas Ontario

PostPosted: Wed Feb 06, 2013 7:52 pm    Post subject: Reply with quote

https://bugs.gentoo.org/show_bug.cgi?id=453494 use this one .. as this https://bugs.gentoo.org/show_bug.cgi?id=455822 is obsolete
Back to top
View user's profile Send private message
SamuliSuominen
Retired Dev
Retired Dev


Joined: 30 Sep 2005
Posts: 2133
Location: Finland

PostPosted: Thu Feb 07, 2013 8:01 am    Post subject: Reply with quote

derk wrote:
https://bugs.gentoo.org/show_bug.cgi?id=453494 use this one .. as this https://bugs.gentoo.org/show_bug.cgi?id=455822 is obsolete


Just to mention the obvious: The correct bug is mentioned in the issued news item, as well as in the 80-net-name-slot.rules example file we install, which is also at /usr/share/doc/udev-197-r<hit tab>/gentoo/ directory in case you have deleted it or something.

So people have now multiple options to go with, use the init script from the bug and rename the interfaces before udev starts to keep using eth*, script to tell which ones will be the new interfaces for proper migration, ...
And I think the documentation is good enough too, although seeing so many threads here about the same issue hints that it might not be. :-/
Back to top
View user's profile Send private message
wcg
Guru
Guru


Joined: 06 Jan 2009
Posts: 588

PostPosted: Fri Feb 08, 2013 1:00 am    Post subject: Reply with quote

How does udev choose between ID_NET_NAME_MAC and
ID_NET_NAME_PATH?
_________________
TIA
Back to top
View user's profile Send private message
derk
Guru
Guru


Joined: 10 Mar 2003
Posts: 347
Location: St Thomas Ontario

PostPosted: Fri Feb 08, 2013 5:42 am    Post subject: Reply with quote

udev does not distinguish between them so far as I know .. they both point to the same device .. only one name is based on the hardware address on the PCI bus and the other name on the mac address .. use whichever you prefer

the mac address name form is useful when you have multiple net interfaces of the same type and wish to specify by mac address which card is which ..
Back to top
View user's profile Send private message
pakjebakmeel
n00b
n00b


Joined: 13 Feb 2012
Posts: 48

PostPosted: Fri Feb 08, 2013 6:56 am    Post subject: Reply with quote

ssuominen wrote:
derk wrote:
https://bugs.gentoo.org/show_bug.cgi?id=453494 use this one .. as this https://bugs.gentoo.org/show_bug.cgi?id=455822 is obsolete


Just to mention the obvious: The correct bug is mentioned in the issued news item, as well as in the 80-net-name-slot.rules example file we install, which is also at /usr/share/doc/udev-197-r<hit tab>/gentoo/ directory in case you have deleted it or something.

So people have now multiple options to go with, use the init script from the bug and rename the interfaces before udev starts to keep using eth*, script to tell which ones will be the new interfaces for proper migration, ...
And I think the documentation is good enough too, although seeing so many threads here about the same issue hints that it might not be. :-/


I think the documents is quite ok but what I couldn't get a clear answer on is which name udev is going to use. From what I see now you can use both but that isn't really clear in the docs.
Back to top
View user's profile Send private message
pakjebakmeel
n00b
n00b


Joined: 13 Feb 2012
Posts: 48

PostPosted: Mon Feb 11, 2013 7:43 pm    Post subject: Reply with quote

That worked fine yes.. Thanks!

Code:
enp1s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.10.10  netmask 255.255.255.0  broadcast 192.168.10.255
        ether 00:22:4d:7c:58:6a  txqueuelen 1000  (Ethernet)
        RX packets 1098  bytes 214828 (209.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1856  bytes 237312 (231.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 16  memory 0xd0120000-d0140000
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum