9990-misc-helpers.sh: remove mdadm.conf in initramfs if existent.
authorMihai Moldovan <ionic@ionic.de>
Wed, 7 Apr 2021 13:30:54 +0000 (15:30 +0200)
committerMihai Moldovan <ionic@ionic.de>
Wed, 7 Apr 2021 13:31:05 +0000 (15:31 +0200)
commit02b7fee2ca2d7180b8bceef8ac831034595f0eef
treed9b6452256c36f9cd7eab3273a7f6ad37a5c5d17
parent80b6bc422d0ed44a81bd15fe68cf05786f254188
9990-misc-helpers.sh: remove mdadm.conf in initramfs if existent.

mkinitramfs is creating the initramfs based on host system parameters.
This is important for RAID support - if the base system (in that case,
the FAI chroot we use to bootstrap grml from) does not contain an
/etc/mdadm/mdadm.conf file (which is the default), it will automatically
generate one for the initramfs from the RAID devices in the currently
running system.

This essentially means that the RAID configuration spills into the
initramfs, even if later grml-live/FAI scripts make sure that they are
not recorded in the squashfs mdadm.conf.

Consequently, the generated image will boot fine on the system that
created the image, but will fail to boot from RAID devices on other
systems, since mdadm --assemble --scan will just refuse to start any
arrays not included in the provided mdadm.conf file as shipped in the
initramfs. Since we build general-purpose images and desperately want to
have auto-detection in such a case, this behavior is unwanted.

The easiest way to fix that is to just delete the initramfs's mdadm.conf
file before calling the RAID auto-detection script. This should restore
correct auto-detection behavior regardless of the system that built the
image without any disadvantage.

Closes: https://github.com/grml/grml/issues/125
components/9990-misc-helpers.sh