Dracut software raid (efi stub)

Hi,
I’m using efi stub to boot suse - it worked fine until I tried to convert system to software raid (md, based on arch wiki).

I have two identical disks (sda, sdb).
System raw file is created by suse studio, copied to sda1 and booted fine.
Then I booted from usb, created raid1 on sdb and rsync’ed all data from sda3 to sdb3 (root parition, others are efi and swap that will not be raided).

Then I chrooted to md0:

mkdir /mnt/new-raidmount /dev/md0 /mnt/new-raid
mount --bind /sys /mnt/new-raid/sys
mount --bind /proc /mnt/new-raid/proc
mount --bind /dev /mnt/new-raid/dev
chroot /mnt/new-raid/

I recreated initramfs with dracut, and added new boot entry (in chroot):


mount /dev/sdb2 /boot/efi
dracut -v -f -a mdraid --mdadmconf /boot/efi/EFI/suse/initrd-4.1.20-11-default 4.1.20-11-default
efibootmgr --create --disk /dev/sdb --part 2 --label pul04cexMd0 --loader \\EFI\\suse\\vmlinuz.efi -u "rd.md.uuid=3976b709:46279b19:f7c725fd:999b3629 root=UUID=a2eb1cf7-c773-48fa-8d59-0dc882ed0698 rw initrd=/EFI/suse/initrd-4.1.20-11-default video=DP-2:640x480 rd.shell rd.debug"

Where “rd.md.uuid” and “root” values are taken from dracut verbose output.

Then I try to boot raid based system - it drops me to dracut shell :frowning:

This is strange to me:
Although I specified as dracut params “-a mdraid --mdadmconf”, and lsinitrd lists file “etc/mdadm.conf” it does not exists when I’m in emergency shell, /proc/mdstat is missing too.

Am I missing something? mdraid module is not in initramfs?

Part of dracut output:

Stored kernel commandline:
rd.md.uuid=3976b709:46279b19:f7c725fd:999b3629
root=UUID=a2eb1cf7-c773-48fa-8d59-0dc882ed0698 rootflags=rw,relatime,data=ordered rootfstype=ext3
*** Creating image file ***
*** Creating image file done ***
Some kernel modules could not be included
This is not necessarily an error:
ext3
linux_raid_member
Image: /boot/efi/EFI/suse/initrd-4.1.20-11-default: 9,1M

Version: dracut-037-68.1

Arguments: -v -f -a ‘mdraid’ --mdadmconf

dracut modules:
bash
i18n
ifcfg
kernel-modules
mdraid
rootfs-block
terminfo
udev-rules
systemd
usrmount
base
fs-lib
shutdown
suse

Try stopping at various stages (see man dracut.kernel for description odfrd.break) to determine when it gets removed. This may give some starting point.

Part of dracut output

Full output would be more useful.

Hi arvidjaar

Full dracut output: http://paste.opensuse.org/6644116

rdsosreport after failed booting https://drive.google.com/open?id=0B9VAr2d6bwGZd2RzenplZmlxaGs

I’ve set rd.break=initqueue and etc/mdadm.conf was missing.
My usb keyboard does not work with rd.break=pre-trigger

I don’t see any clear message why it fails.

This can be an error?

Some kernel modules could not be included
This is not necessarily an error:
ext3
linux_raid_member

rdsosreport shows sdb3 as type linux_raid_member.

PS: I’ve noticed this [Bug 970215] New: rd.md.uuid is always added to the dracut cmdline, no matter if there is any mduuid arg given - openSUSE Bugs - openSUSE Mailing Lists can produce empty rd.md.uuid in /etc/cmdline/99-suse.conf but man says that rd.md.uuid can be specified multiple times.

The problem is fixed, but I’m not sure what exactly was wrong.

I installed system with live-installer, and created raid using “Expert paritioning”, it worked fine, so there must have been something wrong with my commands.

I started again, and it worked this time.
See commands that I used to convert Suse studio appliance copied to sda (where sdb is the same size) below.

  1. Boot to usb disk, after first boot from sda (system preconfigured), run:
  2. Run:

echo "copying partition scheme sda->sdb..."
sgdisk --backup=/root/table /dev/sda
sgdisk --load-backup=/root/table /dev/sdb
sgdisk -G /dev/sdb
echo "removing old raid just in case..."
mdadm --stop md0
mdadm --remove /dev/md0
partprobe /dev/sdb

echo "marking /dev/sdb3 as raid partition type..."
sgdisk --typecode 3:fd00 /dev/sdb
partprobe /dev/sdb

echo "Creating raid with just /dev/sdb3..."
mdadm --zero-superblock /dev/sdb3
mdadm --create /dev/md0 --level=1 --raid-devices=2 missing /dev/sdb3 <<< $'y
'



echo "Mounting sda3 as old-root..."
mkdir /mnt/old-root
mount /dev/sda3 /mnt/old-root

echo "Formatting raid..."
mkfs.ext3 -F /dev/md0
mkdir /mnt/new-raid
echo "Mounting raid as new-raid"
mount /dev/md0 /mnt/new-raid
echo "Starting sync of old-root to new-raid"

rsync -ax --delete /mnt/old-root/ /mnt/new-raid

echo "Mounting both efi partitions"
mkdir /mnt/old-efi
mount /dev/sda2 /mnt/old-efi
mkdir /mnt/new-efi
mount /dev/sdb2 /mnt/new-efi

echo "Sync efi..."
rsync -avx --delete /mnt/old-efi/ /mnt/new-efi

echo "Chrooting to raid"
mount --bind /sys /mnt/new-raid/sys
mount --bind /proc /mnt/new-raid/proc
mount --bind /dev /mnt/new-raid/dev

chroot /mnt/new-raid/ /bin/bash -x <<'EOF'
## Chrooted:

mount /dev/sdb2 /boot/efi
new_kernel_dir=/boot/efi/EFI/suse

kernel_version=`ls /lib/modules` # Not uname -r (chroot)
echo "Kernel version: ${kernel_version}"
dracut --force -v

mkdir -pv ${new_kernel_dir}
cp -uv /boot/vmlinuz-* /boot/initrd-* ${new_kernel_dir}/

kernel_name=vmlinuz-${kernel_version}
new_kernel_name=vmlinuz.efi
mv -v ${new_kernel_dir}/${kernel_name} ${new_kernel_dir}/${new_kernel_name}

for disk in sda sdb
do
    efibootmgr --create --disk /dev/${disk} --part 2 --label myBoot${disk} --loader \\EFI\\suse\\${new_kernel_name} -u "root=/dev/md0 rw initrd=/EFI/suse/initrd-${kernel_version} video=DP-2:640x480 quiet"
done
EOF

echo "Sync efi back..."
rsync -avx --delete /mnt/new-efi/ /mnt/old-efi

sgdisk --typecode 3:fd00 /dev/sda
partprobe /dev/sdb

umount /dev/sda2
umount /dev/sdb2
umount /dev/sda3

mdadm /dev/md0 -a /dev/sda3
cat /proc/mdstat
echo "Will reboot in 15s"
sleep 15
reboot


I did not used:


sgdisk --backup=/root/table /dev/sda
sgdisk --load-backup=/root/table /dev/sdb
sgdisk -G /dev/sdb

At first attempt, but some dd, which might cause problems.