AW: Alter initrd inside normal fai workflow

steven.wend at t-online.de steven.wend at t-online.de
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 module-setup.sh 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/module-setup.sh < /etc/fai/hooks/patches/module-setup.sh.patch
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/module-setup.sh.patch 
--- module-setup.sh	2017-03-02 09:57:25.726779823 +0000
+++ module-setup_new.sh	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" \
         ${NULL}
 
-    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.

Steven


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

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 <https://t-online.de/email-kostenlos> - kostenlos und sicher für alle!


More information about the linux-fai mailing list