Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] udevadm net interface name missing on ppc32?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC
View previous topic :: View next topic  
Author Message
iMike
Apprentice
Apprentice


Joined: 01 Apr 2005
Posts: 208
Location: Stockholm, Sweden

PostPosted: Wed Apr 03, 2013 11:16 am    Post subject: [SOLVED] udevadm net interface name missing on ppc32? Reply with quote

Has anyone updated to udev-200 on ppc32 yet?

When I try getting the persistent network name under udev-197-r8, I just get:
Code:
# udevadm test-builtin net_id /sys/class/net/eth0 2> /dev/null
ID_NET_NAME_MAC=enx000393563422
ID_OUI_FROM_DATABASE=Apple Computer, Inc.
i.e., it does not return the new name for eth0. I have now updated a machine to udev-199-r1 (adding USE=hwdb), but have not rebooted into it since it's headless and I don't want to hose my ssh access because udev might rename eth0. On my x86, x86_64 machines, I was up to udev-1999-r1 and could get the persistent network interface names in udev-199-r1 before updating to udev-200. Is it safe to boot into udev-199-r1 or will it start using some unknown network interface name? I'm using the latest kernel 3.8.5, btw. Anyone tried it?

Last edited by iMike on Thu Apr 04, 2013 10:10 am; edited 1 time in total
Back to top
View user's profile Send private message
ssuominen
Developer
Developer


Joined: 30 Sep 2005
Posts: 2128
Location: Finland

PostPosted: Wed Apr 03, 2013 5:38 pm    Post subject: Reply with quote

Upstream says this is expected for certain type of drivers. For instance, if it's using the SSD bus instead of PCI bus.

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

"What precisely has changed in v197?

5. Classic, unpredictable kernel-native ethX naming (example: eth0)

By default, systemd v197 will now name interfaces following policy 1) if that information from the firmware is applicable and available, falling back to 2) if that information from the firmware is applicable and available, falling back to 3) if applicable, falling back to 5) in all other cases. Policy 4) is not used by default, but is available if the user chooses so."

So your case is falling to the 5) from the document.

Out of curiosity, can you post the output of the following command:

Code:

$ udevadm info /sys/class/net/eth0


Since you see ID_NET_NAME_MAC there, you should be able to assume ID_NET_NAME_MAC is sane and safe to use as udev should check the sanity of it before making it available.

So again, quoting from http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames:

"What precisely has changed in v197?

4. Names incorporating the interfaces's MAC address (example: enx78e7d1ea46da)

By default, systemd v197 will now name interfaces following policy 1) if that information from the firmware is applicable and available, falling back to 2) if that information from the firmware is applicable and available, falling back to 3) if applicable, falling back to 5) in all other cases. Policy 4) is not used by default, but is available if the user chooses so."

See part 4) which says MAC based names are disabled by default.

So about this point you are propably asking what a heck is he talking about, and what is the solution, right? You have 2 options. You can use the long MAC based enx* interface names, or you can use MAC to assign it a solid name:


Option 1, using short and sane MAC based name you can make up yourself)

Create file /etc/udev/rules.d/70-my-network.rules. The filename can be anything, but it's good idea to make it start like 70- and it must end with .rules.
Replace xx:xx:xx:xx:xx:xx with your own MAC address. And you can assign it any name you want, that is not already reserved by the kernel, so it can be other than net0 too.
The file would look like this:

Quote:

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="xx:xx:xx:xx:xx:xx", NAME="net0"



Option 2, using long MAC based enx* name)

Copy /lib/udev/rules.d/80-net-name-slot.rules to /etc/udev/rules.d/80-net-name-slot.rules and edit it in /etc, to use ID_NET_NAME_MAC.


For both, Option 1) and Option 2) you should make sure there are no leftover files that would cause things to fall apart (obviously this is the first step to make in any case):

Code:

# mv /etc/udev/rules.d/70-persistent-*.rules /root/
# mv /etc/udev/rules.d/80-net-*.rules /root/


And there should be no reason for you to go back to 197, 198 or 199, or even any point.
Back to top
View user's profile Send private message
iMike
Apprentice
Apprentice


Joined: 01 Apr 2005
Posts: 208
Location: Stockholm, Sweden

PostPosted: Thu Apr 04, 2013 10:10 am    Post subject: Reply with quote

First off, thanks for the well-considered answer. Armed with that info, I went ahead with the udev update and all went perfectly.

Quote:
Out of curiosity, can you post the output of the following command: $ udevadm info /sys/class/net/eth0
Code:
# udevadm info /sys/class/net/eth0
P: /devices/pci0002:20/0002:20:0f.0/net/eth0
E: DEVPATH=/devices/pci0002:20/0002:20:0f.0/net/eth0
E: ID_BUS=pci
E: ID_MODEL_FROM_DATABASE=UniNorth GMAC (Sun GEM)
E: ID_MODEL_ID=0x0021
E: ID_NET_NAME_MAC=enx000393563422
E: ID_OUI_FROM_DATABASE=Apple Computer, Inc.
E: ID_PCI_CLASS_FROM_DATABASE=Network controller
E: ID_PCI_SUBCLASS_FROM_DATABASE=Ethernet controller
E: ID_VENDOR_FROM_DATABASE=Apple Inc.
E: ID_VENDOR_ID=0x106b
E: IFINDEX=2
E: INTERFACE=eth0
E: SUBSYSTEM=net
E: USEC_INITIALIZED=105614
The above is for a Mac G4 (ppc32). Here is the slightly different output from a Mac G3 (ppc32) running the same kernel (3.8.5) and udev (197-r8 ):
Code:
# udevadm info /sys/class/net/eth0
P: /devices/pci0000:00/0000:00:0d.0/0000:01:05.0/0.80800000:mac-io/0.00011000:ethernet/net/eth0
E: DEVPATH=/devices/pci0000:00/0000:00:0d.0/0000:01:05.0/0.80800000:mac-io/0.00011000:ethernet/net/eth0
E: ID_BUS=pci
E: ID_MODEL_FROM_DATABASE=Paddington Mac I/O
E: ID_MODEL_ID=0x0017
E: ID_NET_NAME_MAC=enx000502612e2c
E: ID_OUI_FROM_DATABASE=APPLE COMPUTER
E: ID_PCI_CLASS_FROM_DATABASE=Unassigned class
E: ID_VENDOR_FROM_DATABASE=Apple Inc.
E: ID_VENDOR_ID=0x106b
E: IFINDEX=2
E: INTERFACE=eth0
E: SUBSYSTEM=net
E: USEC_INITIALIZED=5859564
I noticed that the PCI_CLASS_FROM_DATABASE in this case is "unassigned" and PCI_SUBCLASS_FROM_DATABASE is entirely missing; however, it didn't make any difference: your first soluton, creating a 70-my-network.rules, worked on both the G4 and G3. They both now report the same info above when I substitute net0 for eth0 running under udev-200 with kernel 3.8.5. I will probably try your solution 2 with a different G4 and see how that goes. If so, I'll report back here.

Thank you very much for your help!
Back to top
View user's profile Send private message
ssuominen
Developer
Developer


Joined: 30 Sep 2005
Posts: 2128
Location: Finland

PostPosted: Thu Apr 04, 2013 10:38 am    Post subject: Reply with quote

iMike wrote:
They both now report the same info above when I substitute net0 for eth0 running under udev-200 with kernel 3.8.5. I will probably try your solution 2 with a different G4 and see how that goes.


What do you mean by "when I substitute net0 for eth0"?

I hope you didn't mean you took the example Option 1) and replaced net0 with eth0 in your 70-my-network.rules from that, because that won't work.
That would be same as disabling the predictable interface feature entirely, because you can't rename into kernel reserved namespace like eth0, eth1, eth2, wlan0, wlan1, and a like.
That's why I said net0 but I could have said anything0, internet0, lan0, whatever123, freenamespace2, kernelhasnottakenthis6, ...

If the purpose was to use eth0 you could just delete 70-my-network.rules and create a empty file /etc/udev/rules.d/80-net-name-slot.rules to override /lib/udev/rules.d/80-net-name-slot.rules which is the correct way to disable the feature. Then possible random kernel names like eth0, eth1, eth2, wlan0, wlan1, ... are used.

Just verifying.
Back to top
View user's profile Send private message
iMike
Apprentice
Apprentice


Joined: 01 Apr 2005
Posts: 208
Location: Stockholm, Sweden

PostPosted: Thu Apr 04, 2013 6:41 pm    Post subject: Reply with quote

I think I understood your options correctly. Here is my setup:
Code:
# cat /etc/udev/rules.d/70-my-network.rules
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:03:93:56:34:22", NAME="net0"
Thus when I replace eth0 with net0 in the udevadm command, I get the "same" info I used to get for eth0, namely:
Code:
udevadm info /sys/class/net/net0
P: /devices/pci0002:20/0002:20:0f.0/net/net0
E: DEVPATH=/devices/pci0002:20/0002:20:0f.0/net/net0
E: ID_BUS=pci
E: ID_MODEL_FROM_DATABASE=UniNorth GMAC (Sun GEM)
E: ID_MODEL_ID=0x0021
E: ID_NET_NAME_MAC=enx000393563422
E: ID_OUI_FROM_DATABASE=Apple Computer, Inc.
E: ID_PCI_CLASS_FROM_DATABASE=Network controller
E: ID_PCI_SUBCLASS_FROM_DATABASE=Ethernet controller
E: ID_VENDOR_FROM_DATABASE=Apple Inc.
E: ID_VENDOR_ID=0x106b
E: IFINDEX=2
E: INTERFACE=net0
E: SUBSYSTEM=net
E: USEC_INITIALIZED=122288
The new ifname is now net0, so I changed that in /etc/conf.d/net
Code:
config_net0="dhcp"
fallback_net0="autoipd"
dhcp_net0="nontp"
and in vnstat, and made new sym links to net.lo in /etc/init.d/, etc.

Just filling in the details for what I guess would be option 2 in my case, I suppose I would copy over /lib/udev/rules.d/80-net-name-slot.rules and edit it in /etc to look something like:
Code:
# do not edit this file, it will be overwritten on update

ACTION=="remove", GOTO="net_name_slot_end"
SUBSYSTEM!="net", GOTO="net_name_slot_end"
NAME!="", GOTO="net_name_slot_end"

IMPORT{cmdline}="net.ifnames"
ENV{net.ifnames}=="0", GOTO="net_name_slot_end"

NAME=="", ENV{ID_NET_NAME_ONBOARD}!="", NAME="$env{ID_NET_NAME_ONBOARD}"
NAME=="", ENV{ID_NET_NAME_SLOT}!="", NAME="$env{ID_NET_NAME_SLOT}"
NAME=="", ENV{ID_NET_NAME_PATH}!="", NAME="$env{ID_NET_NAME_PATH}"
NAME=="", ENV{ID_NET_NAME_MAC}!="", NAME="$env{ID_NET_NAME_MAC}

LABEL="net_name_slot_end"
Where I added the line with ID_NET_NAME_MAC. Then I would have long names like enx000393563422 I would use instead of something like net0. I don't see any advantage in this option, so I probably won't try it out for anything other than as a test.

If I have misunderstood, it was a good misunderstanding, because it all works :-) (i.e., option 1, I have not tried option 2)
Back to top
View user's profile Send private message
ssuominen
Developer
Developer


Joined: 30 Sep 2005
Posts: 2128
Location: Finland

PostPosted: Thu Apr 04, 2013 8:53 pm    Post subject: Reply with quote

iMike wrote:
I think I understood your options correctly.


Yes, you got it right. It was me who was propably reading wrong your comment, that's all!
Back to top
View user's profile Send private message
iMike
Apprentice
Apprentice


Joined: 01 Apr 2005
Posts: 208
Location: Stockholm, Sweden

PostPosted: Fri Apr 05, 2013 9:47 am    Post subject: Reply with quote

A big thanks, tusan tack, and kiitos for your help and following up!
Back to top
View user's profile Send private message
GENKILL
n00b
n00b


Joined: 09 Dec 2012
Posts: 7

PostPosted: Sun Apr 07, 2013 7:58 pm    Post subject: Reply with quote

ok, so I've made today (with downloaded actual minimal iso, stage3 and snapshot) fresh install for new system and I was so suprised that nothing works fine - i went through like said in official handbook for amd64 as usual and I was very iritated.
First problem was the system cannot mount /run (eventually because it was not originally cleared before devtmpfs was mounted there), of course I resolved problem with kernel and devtmpfs and system went up and running with network eth0. But now I did update deep, so udev 200 apeared and eth0 vanished. I did "eselect read news all" to check what's going on and I came here to say that I don't understand how can I change eth's names with my own e.g. link0. I did what You write here in forum, but still I can only work with enp4s0 name so
cat /etc/udev/rules.d/70-my-network.rules
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="my_mac", NAME="link0"
doesn't work

Please help mi understand how to use udev more efficient
Back to top
View user's profile Send private message
ssuominen
Developer
Developer


Joined: 30 Sep 2005
Posts: 2128
Location: Finland

PostPosted: Mon Apr 08, 2013 8:01 am    Post subject: Reply with quote

GENKILL wrote:
ok


The eth0 or whatnot in handbook is an example. The device name has always been driver, kernel and hardware dependant, not much as it's now sure. So replace eth0 in the handbook with your actual device and go through the steps you did there, and you have everything working assuming they would have been working in the first place.

As for why the .rules file is not working, is there old /etc/udev/rules.d/70-persistent-net.rules in place? Or some other network .rules file with NAME in it that would take precedence?

What is the output of, replace <ifname> with eg. eth0

Code:

# ls /sys/class/net/
# udevadm test-builtin net_id /sys/class/net/<ifname> 2> /dev/null


Are you sure the MAC is typed correctly? Does it have lower or upper case letters? Trying to say, try the obvious first.
Are you using net.ifnames=0 kernel parameter or not? Should be visible in /proc/cmdline if changed.

ifconfig, ifconfig -a

The latest stage3 file is a bit old too, and still has 197-r8 as starting point, instead of 200, that should autoresolve itself with the autobuilds.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC 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