Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[FIXED] mdadm failing to detect raid on boot
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
Soichiro
n00b
n00b


Joined: 28 Jul 2006
Posts: 24

PostPosted: Sun Jun 12, 2016 12:04 am    Post subject: [FIXED] mdadm failing to detect raid on boot Reply with quote

I have just done a new install of Gentoo with an mdadm-based RAID5. This is on an EFI system and the systemd Gentoo profile with GRUB2. Upon booting, I get the following set of messages:

Code:

md: Waiting for all devices to be available before autodetect
md: If you don't use raid, use raid=noautodetect
md: Autodetecting RAID arrays.
md: Scanned 0 and added 0 devices.
md: autorun ...
md: ... autorun DONE.
VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
Please append a correct "root=" boot option: here are the available partitions:
0800      3907018584 sda  driver: sd
  0801            2048 sda1 b61a9001-9fe1-4d9e-bb88-4d8daf6af258
  0802          131072 sda2 2829ccb0-067e-40cc-8be0-ceb08ed40be8
  0803      3905834840 sda3 264c614d-a665-4743-805c-c70906f2b03e
  0804         1048408 sda4 42f293bc-8798-4187-b8b8-c739a746142b
0810      3907018584 sdb  driver: sd
  0811      3905835008 sdb1 ccf1cf5c-1c07-4436-8418-909550a723d3
  0812         1048408 sdb2 9f9a0ceb-0c4c-42e3-8186-147a6531bfc1
0820      3907018584 sdc  driver: sd
  0821      3905835008 sdc1 433da8fc-cb23-4ee7-a4b1-0cb7e97cca97
  0822         1048408 sdc2 a2acf272-1475-46d7-ae13-a8570b0ec268
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)


Using mdadm --assemble --scan from the LiveCD assembles the array correctly (using sda3, sdb1, and sdc1). My /etc/fstab is as follows:

Code:

/dev/sda2      /boot      vfat      noauto,noatime   1 2
/dev/md0      /      btrfs      noatime      0 1
/dev/sda4      none      swap      sw      0 0
/dev/sdb2      none      swap      sw      0 0
/dev/sdc2      none      swap      sw      0 0


I have ensured that the btrfs driver is built in to the kernel.

My /etc/mdadm.conf is as follows:

Code:

ARRAY /dev/md/0 metadata=1.2 level=raid5 name=gentoo:0 UUID=84b65c11:ea5ce875:6abbb20b:336de948 devices=/dev/sda3,/dev/sdb1,/dev/sdc1


My /etc/genkernel.conf contains the following modifications:

Code:

UDEV="yes"
MDADM="yes"
MDADM_CONFIG="/etc/mdadm.conf"


I have built my kernel from scratch, then used genkernel-next to build the initramfs with genkernel --install initramfs.

My /etc/default/grub contains the following modifications to the boot command line:

Code:

GRUB_CMDLINE_LINUX="init=/usr/lib/systemd/systemd domdadm"


I'm rather stumped at what to try next.


Last edited by Soichiro on Sun Jun 12, 2016 10:27 pm; edited 1 time in total
Back to top
View user's profile Send private message
guitou
Guru
Guru


Joined: 02 Oct 2003
Posts: 400
Location: France

PostPosted: Sun Jun 12, 2016 8:22 am    Post subject: Reply with quote

Hello.

Not used to raid arrays, but looking at your post I can at least tell your problem relies here: your raid array is not properly detected.
Now, in your md conf file I can see defined raid array /dev/md/0 and in your fstab /dev/md0: maybe a typo?..

++
Gi)
Back to top
View user's profile Send private message
Goverp
l33t
l33t


Joined: 07 Mar 2007
Posts: 669

PostPosted: Sun Jun 12, 2016 9:16 am    Post subject: Re: mdadm failing to detect raid on boot, causing kernel pan Reply with quote

Soichiro wrote:
I have just done a new install of Gentoo with an mdadm-based RAID5. This is on an EFI system and the systemd Gentoo profile with GRUB2. Upon booting, I get the following set of messages:
...
I'm rather stumped at what to try next.

I'm not sure if it applies in your environment (genkernel, systemd, UEFI, grub2), but in my old (openrc, BIOS, legacy grub) setup autodetect relies on the partitions having the correct partition type (linux autodetec=fd).
_________________
Greybeard
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43213
Location: 56N 3W

PostPosted: Sun Jun 12, 2016 9:33 am    Post subject: Reply with quote

Soichiro,

Grub is doing its thing, the kernel has loaded but it fails to find root as the raid sets are not assembled.
Your error message shows the kernel listing all the block devices it can see.

Kernel raid autodetect is depreciated and no longer works by default.
What does /sbin/mdadm -E /dev/sda1 have to say about the partitions in your root raid?

Code:
$ sudo /sbin/mdadm -E /dev/sda1
Password:
/dev/sda1:
          Magic : a92b4efc
        Version : 0.90.00
           UUID : 9392926d:64086e7a:86638283:4138a597
  Creation Time : Sat Apr 11 16:34:40 2009
     Raid Level : raid1
...

Note the Version : 0.90.00. That's not the default used by mdadm any more and its the only one that will auto assemble.

You need an initrd containing mdadm and an init script in the initrd that assembles the raid set before root can be mounted.
There is something not right in your initrd.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Soichiro
n00b
n00b


Joined: 28 Jul 2006
Posts: 24

PostPosted: Sun Jun 12, 2016 11:57 am    Post subject: Reply with quote

guitou wrote:
Hello.

Not used to raid arrays, but looking at your post I can at least tell your problem relies here: your raid array is not properly detected.
Now, in your md conf file I can see defined raid array /dev/md/0 and in your fstab /dev/md0: maybe a typo?..

++
Gi)


I've tried it both ways in the /etc/mdadm.conf and it doesn't seem to make a difference. (On my other Gentoo machine with RAID 5, it's this same way--md/0 in mdadm.conf and md0 in fstab)


NeddySeagoon wrote:
Soichiro,

Grub is doing its thing, the kernel has loaded but it fails to find root as the raid sets are not assembled.
Your error message shows the kernel listing all the block devices it can see.

Kernel raid autodetect is depreciated and no longer works by default.
What does /sbin/mdadm -E /dev/sda1 have to say about the partitions in your root raid?

Code:
$ sudo /sbin/mdadm -E /dev/sda1
Password:
/dev/sda1:
          Magic : a92b4efc
        Version : 0.90.00
           UUID : 9392926d:64086e7a:86638283:4138a597
  Creation Time : Sat Apr 11 16:34:40 2009
     Raid Level : raid1
...

Note the Version : 0.90.00. That's not the default used by mdadm any more and its the only one that will auto assemble.

You need an initrd containing mdadm and an init script in the initrd that assembles the raid set before root can be mounted.
There is something not right in your initrd.


mdadm -E shows:

Code:

/dev/sda3:
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x1
     Array UUID : 84b65c11:ea5ce875:6abbb20b:336de948
           Name : gentoo:0  (local to host gentoo)
  Creation Time : Thu Jun  9 22:01:11 2016
     Raid Level : raid5
   Raid Devices : 3


I have an initrd generated by genkernel, but perhaps there's some configuration I'm missing that is causing the RAID to fail to be assembled. This is the output generated by genkernel, so it appears mdadm is being included:

Code:

* Gentoo Linux Genkernel; Version 64
* Running with options: --install initramfs

* Using genkernel.conf from /etc/genkernel.conf
* Sourcing arch-specific config.sh from /usr/share/genkernel/arch/x86_64/config.sh ..
* Sourcing arch-specific modules_load from /usr/share/genkernel/arch/x86_64/modules_load ..

* Linux Kernel 4.6.2-gentoo for x86_64...
* .. with config file /usr/share/genkernel/arch/x86_64/kernel-config
* busybox: >> Using cache
* initramfs: >> Initializing...
*         >> Appending base_layout cpio data...
*         >> Appending udev cpio data...
cp: cannot stat ‘/etc/modprobe.d/blacklist.conf’: No such file or directory
* cannot copy /etc/modprobe.d/blacklist.conf from udev
cp: cannot stat ‘/lib/systemd/network/99-default.link’: No such file or directory
* cannot copy /lib/systemd/network/99-default.link from udev
*         >> Appending auxilary cpio data...
*         >> Copying keymaps
*         >> Appending busybox cpio data...
*         >> Appending mdadm cpio data...
*         >> Appending modules cpio data...
*         >> Appending blkid cpio data...
*         >> Appending ld_so_conf cpio data...
* ldconfig: adding /sbin/ldconfig...
* ld.so.conf: adding /etc/ld.so.conf{.d/*,}...
cpio: lib64 not created: newer or same age version exists
cpio: lib64 not created: newer or same age version exists
cpio: lib64/ld-linux-x86-64.so.2 not created: newer or same age version exists
cpio: lib64/libc.so.6 not created: newer or same age version exists
cpio: lib64/libpthread.so.0 not created: newer or same age version exists
cpio: lib64 not created: newer or same age version exists
cpio: lib64/ld-linux-x86-64.so.2 not created: newer or same age version exists
cpio: lib64/libblkid.so.1 not created: newer or same age version exists
cpio: lib64/libc.so.6 not created: newer or same age version exists
cpio: lib64/libuuid.so.1 not created: newer or same age version exists
*         >> Finalizing cpio...
*         >> Compressing cpio data (.xz)...


My full grub.cfg generated by grub2-mkconfig is as follows:

Code:

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_gpt
insmod part_gpt
insmod part_gpt
insmod diskfilter
insmod mdraid1x
insmod raid5rec
insmod btrfs
set root='mduuid/84b65c11ea5ce8756abbb20b336de948'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint='mduuid/84b65c11ea5ce8756abbb20b336de948'  c4e4f0b7-6d18-4d44-bcd4-4e7cfb5efe09
else
  search --no-floppy --fs-uuid --set=root c4e4f0b7-6d18-4d44-bcd4-4e7cfb5efe09
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-c4e4f0b7-6d18-4d44-bcd4-4e7cfb5efe09' {
    load_video
    if [ "x$grub_platform" = xefi ]; then
        set gfxpayload=keep
    fi
    insmod gzio
    insmod part_gpt
    insmod fat
    set root='hd0,gpt2'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  7877-AC60
    else
      search --no-floppy --fs-uuid --set=root 7877-AC60
    fi
    echo    'Loading Linux 4.6.2-gentoo ...'
    linux    /vmlinuz-4.6.2-gentoo root=UUID=c4e4f0b7-6d18-4d44-bcd4-4e7cfb5efe09 ro init=/usr/lib/systemd/systemd domdadm
    echo    'Loading initial ramdisk ...'
    initrd    /initramfs-genkernel-x86_64-4.6.2-gentoo
}
submenu 'Advanced options for Gentoo GNU/Linux' $menuentry_id_option 'gnulinux-advanced-c4e4f0b7-6d18-4d44-bcd4-4e7cfb5efe09' {
    menuentry 'Gentoo GNU/Linux, with Linux 4.6.2-gentoo' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.6.2-gentoo-advanced-c4e4f0b7-6d18-4d44-bcd4-4e7cfb5efe09' {
        load_video
        if [ "x$grub_platform" = xefi ]; then
            set gfxpayload=keep
        fi
        insmod gzio
        insmod part_gpt
        insmod fat
        set root='hd0,gpt2'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  7877-AC60
        else
          search --no-floppy --fs-uuid --set=root 7877-AC60
        fi
        echo    'Loading Linux 4.6.2-gentoo ...'
        linux    /vmlinuz-4.6.2-gentoo root=UUID=c4e4f0b7-6d18-4d44-bcd4-4e7cfb5efe09 ro init=/usr/lib/systemd/systemd domdadm
        echo    'Loading initial ramdisk ...'
        initrd    /initramfs-genkernel-x86_64-4.6.2-gentoo
    }
    menuentry 'Gentoo GNU/Linux, with Linux 4.6.2-gentoo (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.6.2-gentoo-recovery-c4e4f0b7-6d18-4d44-bcd4-4e7cfb5efe09' {
        load_video
        if [ "x$grub_platform" = xefi ]; then
            set gfxpayload=keep
        fi
        insmod gzio
        insmod part_gpt
        insmod fat
        set root='hd0,gpt2'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  7877-AC60
        else
          search --no-floppy --fs-uuid --set=root 7877-AC60
        fi
        echo    'Loading Linux 4.6.2-gentoo ...'
        linux    /vmlinuz-4.6.2-gentoo root=UUID=c4e4f0b7-6d18-4d44-bcd4-4e7cfb5efe09 ro single init=/usr/lib/systemd/systemd domdadm
        echo    'Loading initial ramdisk ...'
        initrd    /initramfs-genkernel-x86_64-4.6.2-gentoo
    }
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43213
Location: 56N 3W

PostPosted: Sun Jun 12, 2016 12:52 pm    Post subject: Reply with quote

Soichiro,

I've always made my initrd by hand. Its the only way to be able to understand and fix it when the black magic fails you.

Raid sets have a kernel major number of 9. Your panic only lists 08xx, which corresponds to /dev/sd*
It follows that the raid sets have not been assembled. I don't know how to use genkernel to fix it.

After the panic, you should be dropped to a shell.
cat the init script and execute the remaining commands starting with with the mdadm -A ... one at a time.
That will tell you where it goes wrong and may give some insight into fixing it.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Soichiro
n00b
n00b


Joined: 28 Jul 2006
Posts: 24

PostPosted: Sun Jun 12, 2016 10:26 pm    Post subject: Reply with quote

I was able to figure it out. Looks like the issue was that the EFI bootloader was loading the kernel directly, rather than going through GRUB and loading the initramfs. Once I used efibootmgr to delete the incorrect entry and create a new one pointing to GRUB, the initramfs loaded and assembled the RAID as expected. Thanks for the help.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum