Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Grub/Initramfs Boot with Root on Raid
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
sn3
n00b
n00b


Joined: 15 May 2013
Posts: 2

PostPosted: Thu May 16, 2013 4:08 am    Post subject: Grub/Initramfs Boot with Root on Raid Reply with quote

I've been trying to get this work for some time now, so I figured it'd be time to ask for help. I've set up root on a raid1 partition, but can't seem to get it to boot. I've been mainly following http://www.gentoo.org/doc/en/gentoo-x86+raid+lvm2-quickinstall.xml with some additions from the handbook.

Code:
>> Activating mdev
>> Skipping module load; no modules in the ramdisk!
>> Hint: Use parameter scandelay[=seconds] if you need waiting here
>> Detected real_root as a md device. Setting up the device node...
mdadm: bad uuid: UUID=ognmiz:AXTy:ecuZ:3vyN:thZ5:UZHA:tSb3aB
mdadm: ARRAY line /dev/md4 has no identity information
mdadm: No devices listed in conf file were found.
>> Scanning for and activating Volume Groups
   No volume groups found
   No volume groups found
>> Determining root device...
>> Mounting /dev/md3 as root...
>> Using mount -t ext3 -o ro
mount: mounting /dev/md3 on /newroot failed: Invalid argument
!! Could not mount specified ROOT, try again
!! Could not find the root block device in .


Originally, I thought it was because the md* is being renamed, but I assigned it in the mdadm.conf, so that shouldn't be the case. There is some weird error which I'll look into afterwards with the LVM array (md4).
Code:
mdadm --detail --scan

Not pulling correct uuid, instead used blkid to identify and then pushed them into the mdadm.conf:
Code:
(chroot) livecd / # cat /etc/mdadm.conf
ARRAY /dev/md1 metadata=0.90 UUID=7fbb2285:4ce5:4c95:9f01:72dc7dfa5960
ARRAY /dev/md3 metadata=0.90 UUID=d2b27939:8b7c:4cea:bdbb:e2abee148aab
ARRAY /dev/md4 metadata=0.90 UUID=ognmiz:AXTy:ecuZ:3vyN:thZ5:UZHA:tSb3aB


Genkernel also appears to be automatically ignoring mdadm.conf, so I included it in genkernel.conf:
Code:
(chroot) livecd / # egrep 'mdadm|MDADM' /etc/genkernel.conf
MDADM="yes"
MDADM_CONFIG="/etc/mdadm.conf"


My other thought was that the initramfs wasn't built properly, as I'm using a hardened-sources kernel with genkernel. I'll probably try building it with a regular kernel instead and report back. Any insight would be appreciated.

Thanks in advance.






General Info:
Code:
(chroot) livecd / # fdisk -l /dev/sda

Disk /dev/sda: 160.0 GB, 160041885696 bytes, 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x3b510e5c

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      133119       65536   fd  Linux raid autodetect
/dev/sda2          133120     4327423     2097152   82  Linux swap / Solaris
/dev/sda3         4327424    67241983    31457280   fd  Linux raid autodetect
/dev/sda4        67241984   312581807   122669912   fd  Linux raid autodetect
(chroot) livecd / # fdisk -l /dev/sdb

Disk /dev/sdb: 160.0 GB, 160041885696 bytes, 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x85862b18

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048      133119       65536   fd  Linux raid autodetect
/dev/sdb2          133120     4327423     2097152   82  Linux swap / Solaris
/dev/sdb3         4327424    67241983    31457280   fd  Linux raid autodetect
/dev/sdb4        67241984   312581807   122669912   fd  Linux raid autodetect


Code:
(chroot) livecd / # cat /proc/mdstat   
Personalities : [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] [linear] [multipath]
md4 : active raid1 sda4[0] sdb4[1]
      122669824 blocks [2/2] [UU]
     
md3 : active raid1 sda3[0] sdb3[1]
      31457216 blocks [2/2] [UU]
     
md1 : active raid1 sda1[0] sdb1[1]
      65472 blocks [2/2] [UU]
     
unused devices: <none>



Code:
(chroot) livecd / # cat /etc/fstab
/dev/md1      /boot      ext2      noauto,noatime   1 2
/dev/md3      /      ext3      noatime      0 1
/dev/sda2      none      swap      sw,pri=1    0 0
/dev/sdb2      none      swap      sw,pri=1   0 0
/dev/cdrom      /mnt/cdrom   auto      noauto,ro   0 0
/dev/fd0      /mnt/floppy   auto      noauto      0 0
/dev/vg/usr      /usr      ext3      noatime      1 2
/dev/vg/portage      /usr/portage   ext2      noatime      1 2
/dev/vg/distfiles   /usr/portage/distfile   ext2   noatime      1 2
/dev/vg/home      /home      ext3      noatime      1 2
/dev/vg/opt      /opt      ext3      noatime      1 2
/dev/vg/tmp      /tmp      ext2      noatime      1 2
/dev/vg/var      /var      ext3      noatime      1 2
/dev/vg/vartmp      /var/tmp   ext2      noatime      1 2
/dev/vg/flux      /flux      ext3      noatime      1 2


Code:
(chroot) livecd / # cat /boot/grub/grub.conf
default 0
timeout 10
title Gentoo Linux
root (hd0,0)
kernel /boot/kernel real_root=/dev/md3 dolvm domdadm rootfstype=ext3
initrd /boot/initramfs-genkernel-x86-3.8.11-hardened


Code:
(chroot) livecd boot # genkernel --install --no-ramdisk-modules --lvm --mdadm initramfs
* Gentoo Linux Genkernel; Version 3.4.45
* Running with options: --install --no-ramdisk-modules --lvm --mdadm initramfs

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

* Linux Kernel 3.8.11-hardened for x86...
* .. with config file /usr/share/genkernel/arch/x86/kernel-config
* busybox: >> Using cache
* initramfs: >> Initializing...
*         >> Appending base_layout cpio data...
*         >> Appending auxilary cpio data...
*         >> Copying keymaps
*         >> Appending busybox cpio data...
*         >> Appending lvm cpio data...
*           LVM: Adding support (compiling binaries)...
* lvm: >> Using cache
*         >> Appending mdadm cpio data...
*       MDADM: Adding support (compiling binaries)...
*       MDADM: Using cache
* initramfs: Not copying modules...
*         >> Appending blkid cpio data...
*         >> Appending modprobed cpio data...
*         >> Compressing cpio data (.xz)...

* WARNING... WARNING... WARNING...
* Additional kernel cmdline arguments that *may* be required to boot properly...
* add "dolvm" for lvm support
* add "domdadm" for RAID support
* With support for several ext* filesystems available, it may be needed to
* add "rootfstype=ext3" or "rootfstype=ext4" to the list of boot parameters.

* Do NOT report kernel bugs as genkernel bugs unless your bug
* is about the default genkernel configuration...
*
* Make sure you have the latest ~arch genkernel before reporting bugs.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Thu May 16, 2013 5:59 pm    Post subject: Reply with quote

sn3,

Welcome to Gentoo.

Code:
kernel /boot/kernel real_root=/dev/md3 dolvm domdadm rootfstype=ext3
initrd /boot/initramfs-genkernel-x86-3.8.11-hardened


You probably want to drop the real_ from your kernel line.
Also, with version 0.90 raid superblocks, kernel raid auto assembly will work. mdadm is not required in your initrd.

If you want to do it the hard way, with your own kernel and initrd, I've posted details several times in the last month or so.
If you can't find them, I'll try to dig you out a link.
_________________
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
azimux
n00b
n00b


Joined: 13 Sep 2007
Posts: 14

PostPosted: Fri May 17, 2013 6:22 am    Post subject: Reply with quote

Are you sure that mdadm --scan --detail is not giving the right UUIDs?

Like Neddy said, I also don't use "Linux raid autodetect" type ID if the array is handled in the initramfs. I set the partition type to something else. That way the kernel doesn't try to assemble them as well as the initramfs. You also don't have to use 0.90 metadata on anything but /boot if you are using an initramfs to handle mdadm.

I'm not 100% sure what the issue you've ran into is, but I'd boot in with a rescue disk or live CD or whatever, get everything assembled and mounted exactly how you want it, delete all the ARRAY entries entirely from /etc/mdadm.conf and regenerate them via mdadm --scan --detail >> /etc/mdadm.conf and rebuild the initramfs and see if that fixes the problem.

Also, not sure if it helps in your situation, but I prefer to do this with labels. I'd do an e2label /dev/md3 sn3sboxroot and maybe try to use root=LABEL=sn3sboxroot instead of the UUID if you really don't trust it. I like to use LABEL= in my /etc/fstab and when using mount in rescue disks as well so I don't have to remember all the md numbers or care if they change (like when I boot in with a rescue disk and md3 is now md128 or something.)

I now use grub2 which puts root=UUID= in the grub.cfg for me, but I *think* I used to do it with labels in grub 1, so it might be helpful if that's allowed.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Fri May 17, 2013 4:38 pm    Post subject: Reply with quote

azimux,

The kernel and grub1 between them do not support labels or filesystem UUIDs. You need an initrd with the userspace mount command for that.

If you use GPT disklables, the kernel understands the GPT partition UUIDs. Note that the partition UUID and the UUID of the filesystem that lives on the partition are not related and are not interchangeable.
_________________
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
azimux
n00b
n00b


Joined: 13 Sep 2007
Posts: 14

PostPosted: Fri May 17, 2013 6:30 pm    Post subject: Reply with quote

Ah yes, you are correct sir. I checked my old backups and I never used root=LABEL= or root=UUID=, I always used root=/dev/md3 (also one system used root=/dev/md/Gentoo-2012:5 but was using 1.2 metadata and an initrd as well of course.) Sorry for the misadvice.

Today root=UUID= is in my grub2 grub.cfg but it is indeed the block ID not the mdadm UUID, as you mentioned.
Back to top
View user's profile Send private message
sn3
n00b
n00b


Joined: 15 May 2013
Posts: 2

PostPosted: Sun May 19, 2013 5:56 pm    Post subject: Reply with quote

azimux wrote:

Like Neddy said, I also don't use "Linux raid autodetect" type ID if the array is handled in the initramfs. I set the partition type to something else. That way the kernel doesn't try to assemble them as well as the initramfs. You also don't have to use 0.90 metadata on anything but /boot if you are using an initramfs to handle mdadm.

I'm not 100% sure what the issue you've ran into is, but I'd boot in with a rescue disk or live CD or whatever, get everything assembled and mounted exactly how you want it, delete all the ARRAY entries entirely from /etc/mdadm.conf and regenerate them via mdadm --scan --detail >> /etc/mdadm.conf and rebuild the initramfs and see if that fixes the problem.


Thanks for the replies. I'll set the partition type for / and the lvm2 volume to Linux(83) and see if it helps. Will also look into removing the 0.90.

For mdadm --scan --detail, it reports different UUIDs than with blkid - but after reading NeedySeagoon's post, I'm probably mixing up the partition/filesystem UUIDs. I did initially use the mdadm --scan --detail to set the mdadm.conf with no success, and your Label/Grub2 suggestion sounds more promising anyways.

On another note, I've seen references to the gentoo-wiki.com article (I believe that was from a post by you Needy, though I may be wrong) as opposed the quickstart here, but with that site gone and gentoo-wiki.info seemingly without that article, I'm more compelled to move on to Grub2 since there are other posts here on it.

Thanks again.
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