grml / live-boot-grml

GNU General Public License v3.0
10 stars 11 forks source link

9990-misc-helpers.sh: remove mdadm.conf in initramfs if existent. #15

Closed Ionic closed 3 years ago

Ionic commented 3 years ago

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

mika commented 3 years ago

@Ionic thanks a lot for this PR! Thanks for the review, @zeha!