Bruce Dubbs wrote:
> Bryan Kadzban wrote:
>> 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.
> 
> Yes, but we can fix that.  In the udev-lfs tarball we have the needed files:
> 
> write_net_rules
> rule_generator.functions
> 
> We need to change two places in rule_generator.functions where it has
> RUNDIR=$(udevadm info --run) with a constant RUNDIR=/run/udev
> 
> Then in section 7.2 (inside chroot), we need to do a couple of things:
> 
> cd ~
> mkdir -p /run/udev
> 
> cat set_persistent_net_rules.sh  << EOF
> #! /bin/bash
> 
> for NIC in /sys/class/net/eth* ; do
>     IF=${NIC##*/}
>     if [ "$IF" == "eth*" ]; then break; fi
> 
>     export INTERFACE="$IF"
>     export MATCHADDR="$(cat $NIC/address)"
>     export MATCHDEVID="$(cat $NIC/dev_id)"
>     export MATCHIFTYPE="$(cat $NIC/type)"
>     /lib/udev/write_net_rules

...And /etc is writable here, so I think this should generate something
usable at least.  (Might need a couple more environment vars for stuff
like the vendor/device ID and the driver, but whatever.)

I think we used to do it this way, actually.  :-)

One problem (I think) is that this won't follow the whitelist/blacklist
rules in the existing 75-persistent-net-generator.rules file.  So it'll
try to generate rules for NICs that are known to be buggy (locally
administered MACs that change per boot, qemu-created devices that change
MACs at every boot, etc.).  :-/

> We need to be careful that someone doesn't remove /run/udev after 
> booting or outside of chroot.

Hmm?

Oh, the rm -rf.  Can we make it a tmpfs in chapter 7, and fix it that
way?  Then we don't need the rm in the instructions; it just needs to be
unmounted at shutdown time.  :-)

(I still like the idea of indirection in the network bootscripts; it
seems to match how udev handles storage, input, and sound devices, much
better.  If I get some time this week or weekend or something, I'll
replace my network scripts with whatever is current in the book -- I'm
still using really old stuff since this system is pretty old -- and
assuming that works, I'll look into adding the indirection, then see how
I like the results.)

Attachment: 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

Reply via email to