Bruce Dubbs wrote: > Armin K. wrote: >> Bruce, some guy came on the irc saying that network rules creation >> does not work in systemd extracted udev. >> >> <Zenther> working my way through the cvs book and get to 7.2.1. >> Creating stable names for network interfaces and I am getting a >> cat: /etc/udev/rules.d/70-persistent-net.rules: No such file or >> directory. Above that I see it list out my eth0 and wlan0. >> >> Can you check and/or confirm that? > > > I can confirm that in chroot. I think he is referring to section > 7.5. That needs to be changed. The 'udevadm test' command no longer > runs aux programs, e.g. /lib/udev/write_net_rules. > > However, the first time the system is booted, udevd will run the > rules and the 70-persistent-net.rules file will be written at that > time.
Well, they finally killed it. ARRRRG. Unfortunately for the case where pregenerating the rules files is required, "at first boot" is way too late to generate the file. The NIC needs to have a stable name assigned before the networking stuff gets configured, so that at first boot, the NICs are configured correctly. Obviously it only matters on a multi-NIC machine, and only really when the configuration is different per NIC. Since the Debian-package udev maintainer is the one who said he'd be continuing this (since Debian has exactly the same problem on users' server installations), I wonder if Debian has added patches to fix it up, or is generating the config in some other way. ...doing a bunch of thinking here... Do we want to just bite the bullet and change the networking config to use MAC- or path-based IDs instead of NIC names? E.g. change the /etc/sysconfig/ifconfig.eth0 filename (and directory, if a directory is used) to either /etc/sysconfig/ifconfig.mac.xx:xx:xx:xx:xx:xx, or /etc/sysconfig/ifconfig.path.pci-foo-bar-usb-baz-whatever (whatever path_id prints out), then use udevadm to find the NIC device's name? With a couple changes to the udev rules (add an IMPORT{builtin}=path_id, and copy attrs{address} off to some environment variable), all the required info should be in the udev database, meaning something like this might work: <read file or directory name into $NIC_ID or whatever> TYPE=`echo $NIC_ID | cut -d. -f2` # either mac or path ID=`echo $NIC_ID | cut -d. -f2-` if [ "$TYPE" = "path" ] ; then for i in /sys/class/net/* ; do if [ "$(udevadm info --query env --path $i \ | grep ID_PATH)" = "$ID" ] ; then INTERFACE=${i##/sys/class/net/} fi done if [ -z "$INTERFACE" ] ; then # whatever error handling fi else for i in /sys/class/net/* ; do if [ "$(udevadm info --query env --path $i \ | grep ID_MAC)" = "$ID" ] ; then INTERFACE=${i##/sys/class/net/} fi done if [ -z "$INTERFACE" ] ; then # whatever error handling fi fi Then run the script as before, since $INTERFACE is set. Alternately, that's a weird N-squared algorithm. Maybe it'd work better to do something like: <read file or directory name into $NIC_ID or whatever> TYPE=`echo $NIC_ID | cut -d. -f2` # either mac or path ID=`echo $NIC_ID | cut -d. -f2-` cd /sys/class/net for i in * ; do udevadm info --query env --path /sys/class/net/$i \ --export --export-prefix="${i}_" done # optionally fix up cwd if [ "$TYPE" = "path" ] ; then INTERFACE=$(set | grep "_ID_PATH=$ID" | cut -d_ -f1) if [ -z "$INTERFACE" ] ; then # whatever error handling fi else INTERFACE=$(set | grep "_ID_MAC=$ID" | cut -d_ -f1) if [ -z "$INTERFACE" ] ; then # whatever error handling fi fi We could just remove the persistent rules entirely at that point, since the interface ID would be dereferenced on every boot, so if it changes, nobody cares.
signature.asc
Description: OpenPGP digital signature
-- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page