AW: Alter initrd inside normal fai workflow

steven.wend at steven.wend at
Thu Mar 2 14:13:34 CET 2017

Hi Thomas,

thanks for the hint.

We tried it that way (running our hook which adds the udev rule and run dkpg-reconfigure dracut inside nfs root). It didn't work. When extracting the initrd no rule appeared.

After checking dracut we recognized that dracut needs custom udev rules at a special location. Dracut uses (inside the nfs root) "/usr/lib/dracut/modules.d/95udev-rules/". We changed the and added our rule. Those steps are now another hook.

$ cat hooks/13-add-udev-persistent-net-rules 
#! /bin/bash

error=0 ; trap "error=$((error|1))" ERR

cp /etc/fai/hooks/etc/udev/rules.d/70-persistent-net.rules $NFSROOT/etc/udev/rules.d/70-persistent-net.rules
cp /etc/fai/hooks/etc/udev/rules.d/70-persistent-net.rules $NFSROOT/usr/lib/dracut/modules.d/95udev-rules/70-persistent-net.rules
patch $NFSROOT/usr/lib/dracut/modules.d/95udev-rules/ < /etc/fai/hooks/patches/
chroot $NFSROOT dpkg-reconfigure dracut
cp $NFSROOT/boot/vmlinuz-3.16.0-4-amd64 $TFTPROOT/vmlinuz-3.16.0-4-amd64
cp $NFSROOT/boot/initrd.img-3.16.0-4-amd64 $TFTPROOT/initrd.img-3.16.0-4-amd64

exit $error

$ cat hooks/patches/ 
---	2017-03-02 09:57:25.726779823 +0000
+++	2017-03-02 09:57:03.746779823 +0000
@@ -48,9 +48,10 @@
         95-late.rules \
         "$moddir/59-persistent-storage.rules" \
         "$moddir/61-persistent-storage.rules" \
+        "$moddir/70-persistent-net.rules" \
-    prepare_udev_rules 59-persistent-storage.rules 61-persistent-storage.rules
+    prepare_udev_rules 59-persistent-storage.rules 61-persistent-storage.rules 70-persistent-net.rules
     # debian udev rules
     inst_rules 91-permissions.rules
     # eudev rules

Now it works out.


Betreff: Re: Alter initrd inside normal fai workflow
Datum: 2017-03-01T22:05:29+0100
Von: "Thomas Lange" <lange at>
An: "fully automatic installation for Linux" <linux-fai at>

If you need to alter the initrd inside the nfsroot, you can make your
changes and then call
  # chroot /srv/fai/nfsroot dpkg-reconfigure dracut
This will rebuild the initrd. Then copy it to the tftp directory. IMO
this is easier than extract, alter and package it.

regards Thomas

Gesendet mit Telekom Mail <> - kostenlos und sicher für alle!

More information about the linux-fai mailing list