Subject: Re: bug#38086: RAID installation script with ‘mdadm’ no longer works

From: Ludovic Courtès <[email-masked]>
Date: Tue, 12 Nov 2019 00:28:58 +0100

Hi Gábor,

Gábor Boskovits <[email-masked]> skribis:

>> + mdadm --create /dev/md0 --verbose --level=stripe --raid-devices=2
>> /dev/vdb2 /dev/vdb3
>> mdadm: chunk size defaults to 512K
>> mdadm: Defaulting to version 1.2 metadata
>> [   13.890586] md/raid0:md0: cannot assemble multi-zone RAID0 with
>> default_layout setting
>> [   13.894691] md/raid0: please set raid0.default_layout to 1 or 2
>> [   13.896000] md: pers->run() failed ...
>> mdadm: RUN_ARRAY failed: Unknown error 524
>> [   13.901603] md: md0 stopped.
>> --8<---------------cut here---------------end--------------->8---
>>
>> Anyone knows what it takes to “set raid0.default_layout to 1 or 2”?
>>
>
> On kernel 5.3.4 and above the
> raid0.default_layout=2 kernel boot paramter should be set. We should
> generate our grub configuration accordingly.

That’s part of the solution, thank you!

With the patch below, the “raid-root-os” test successfully installs the
system to a RAID0 device, but then that system fails to boot with:

--8<---------------cut here---------------start------------->8---
Booting from Hard Disk...
GRUB loading.
Welcome to GRUB!

error: invalid arch-independent ELF magic.
Entering rescue mode...
--8<---------------cut here---------------end--------------->8---

(It sits there forever.)

Are we missing something in ‘grub.cfg’?  If so, I wonder if that problem
arose with the upgrade in commit
069ab3bbfde704760acaca20dff8a29d167c6be5.

Thoughts?

Ludo’.

diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm
index 22c9554705..5e421f7c54 100644
--- a/gnu/tests/install.scm
+++ b/gnu/tests/install.scm
@@ -543,7 +543,8 @@ where /gnu lives on a separate partition.")
     (bootloader (bootloader-configuration
                  (bootloader grub-bootloader)
                  (target "/dev/vdb")))
-    (kernel-arguments '("console=ttyS0"))
+    (kernel-arguments '("console=ttyS0"
+                        "raid0.default_layout=2"))
 
     ;; Add a kernel module for RAID-0 (aka. "stripe").
     (initrd-modules (cons "raid0" %base-initrd-modules))
@@ -578,9 +579,11 @@ export GUIX_BUILD_OPTIONS=--no-grafts
 parted --script /dev/vdb mklabel gpt \\
   mkpart primary ext2 1M 3M \\
   mkpart primary ext2 3M 600M \\
-  mkpart primary ext2 600M 1200M \\
+  mkpart primary ext2 600M 1.4G \\
   set 1 boot on \\
   set 1 bios_grub on
+modprobe raid0
+echo 1 > /sys/module/raid0/parameters/default_layout
 mdadm --create /dev/md0 --verbose --level=stripe --raid-devices=2 \\
   /dev/vdb2 /dev/vdb3
 mkfs.ext4 -L root-fs /dev/md0