Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] grub legacy, grub2, soft raid, boot error
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Frautoincnam
Tux's lil' helper
Tux's lil' helper


Joined: 19 May 2017
Posts: 76

PostPosted: Sun Dec 30, 2018 10:38 pm    Post subject: [solved] grub legacy, grub2, soft raid, boot error Reply with quote

Hi,

On my home server, without UEFI, I have 3 Sata HD : sda, sdb, sdc
sda and sdb are partitionned identicaly, ann all partions are associated in a soft raid 1 as :
sda1 + sdb1 => /dev/md1 => /boot
sda2 + sdb2 => /dev/md2 => /
sda3 + sdb3 => /dev/md3 => swap
sda4 + sdb4 => extended
sda5 + sdb5 => /dev/md5 => /tmp
sda6 + sdb6 => /dev/md6 => /home
sda7 + sdb7 => /dev/md7 => /var
sda8 + sdb8 => /dev/md8 => /other
sdc (sd1,sdc2) is only for backup
I use Grub legacy, installed in /dev/sda AND /dev/sdb with :
Code:
# grub --no-floppy

grub> find /grub/stage1
 (hd0,0)
 (hd1,0)
grub> device (hd0) /dev/sda
grub> root (hd0,0)
grub> setup (hd0)

grub> device (hd0) /dev/sdb
grub> root (hd0,0)
grub> setup (hd0)
grub> quit


and a grub.conf like :
Code:
title Gentoo
root (hd0,0)
kernel /boot/kernel root=/dev/md2

And ALL works fine.

Now, I've bought 2 SSD (sdd, sde), to use in soft raid 1 too, put all (except /other), so I partitionned them and associated partions like :
sdd1 + sde1 => /dev/md11 => /boot
sdd2 + sde2 => /dev/md12 => /
sdd3 + sde3 => /dev/md13 => swap
sdd4 + sde4 => extended
sdd5 + sde5 => /dev/md15 => /tmp
sdd6 + sde6 => /dev/md16 => /home
sdd7 + sde7 => /dev/md17 => /var
The ony difference is that md12 is EXT4 and md2 is EXT3, but I do have EXT4 in my kernel :
Code:
# grep EXT4 /usr/src/linux/.config
CONFIG_EXT4_FS=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y
# CONFIG_EXT4_ENCRYPTION is not set
# CONFIG_EXT4_DEBUG is not set


I won't remove sda and sdb. I'll juste resize /dev/md8 to use all the space, when I'll be able to use my SSDs.

My BIOS doesn't permit me to select drive to boot, so for the moment, I have to use boot loader on sda/sdb.

I tried a lot of configurations, and even added Grub2, to try to chainload, but never get something else than :
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

I added sdd/sde to device.map :
# cat /boot/grub/device.map
Code:
(hd0)   /dev/sda
(hd1)   /dev/sdb
(hd2)   /dev/sdc
(hd3)   /dev/sdd
(hd4)   /dev/sde

I put grub on sdd/sde the same way with :
Code:
grub> find /grub/stage1
 (hd0,0)
 (hd1,0)
 (hd3,0)
 (hd4,0)
grub> device (hd3) /dev/sdd
grub> root (hd3,0)
grub> setup (hd3)

grub> device (hd3) /dev/sde
grub> root (hd3,0)
grub> setup (hd3)
grub> quit

(tried too with hd0 instead of hd3)
I added
Code:
title Gentoo SSD
root (hd3,0)
kernel /boot/kernel root=/dev/md12

to grub.conf (tried with hd0 too)

Tried to Chainload grub2 with :
Code:
title GRUB2 Chainload HD0
root (hd0,0)
kernel /boot/grub/i386-pc/core.img
boot

title GRUB2 Chainload HD3
root (hd3,0)
kernel /boot/grub/i386-pc/core.img
boot


Grub2 is installed with grub-install --grub-setup=/bin/true /dev/sda, like suggested in https://wiki.gentoo.org/wiki/GRUB2_Migration#Installing_and_configuring_GRUB2

I tried a lot of things (too much), and I'm now totally lost.

The only thing I didn't (and won't) try is to replace Grub legacy with Grub2. Too much afraid by not being able to boot at all.
I'd prefer to not use Grub2, but if I have to do it, I will.

Maybe I have others informations to give for you to try to help me.

PS : sorry for my not really good english

Edit :
to be complete, I have to add :
1) os-prober/grub2-mkconfig doesn't find boot on SSDs. I just get :
Code:
# LC_ALL=C grub2-mkconfig -o grub.cfg
Generating grub configuration file ...
Found linux image: /boot/kernel-4.14.83-gentoo
Found linux image: /boot/kernel-4.14.52-gentoo
Found memtest image: /boot/memtest86plus/memtest.bin
Found memtest image: /boot/memtest86plus/memtest
done


2) Chainloading works. I can start my system on HDs raid with Grub legacy => Grub2

3) I modifyed /etc/grub.d/40_custom :
Code:
menuentry 'Gentoo SSD' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-d47e8faa-3b7e-405d-bc8c-a2d418846bee' {
        load_video
        insmod gzio
        insmod part_msdos
        insmod part_msdos
        insmod diskfilter
        insmod mdraid09
        insmod ext2
        set root='mduuid/e4d1401a6e79b1cd58f2f8e7254eabdb'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint='mduuid/e4d1401a-6e79-b1cd-58f2-f8e7254eabdb' 2c41c099-b22e-47c9-a43a-8cb90fce1265
        else
          search --no-floppy --fs-uuid --set=root 2c41c099-b22e-47c9-a43a-8cb90fce1265
        fi
        echo    'Chargement de Linux 4.14.83-gentoo...'
        linux   /kernel-4.14.83-gentoo root=/dev/md12 ro


4) I tried to chroot in my SSDs raid, generate grub.cfg (It doesn't find HDs boot), but chainloading to it doesn't work(always the same Kernel Panic). But I don't know Grub2 very well. That's possible I don't do what is needed.

5) SDDs raids works fine, even I can't boot on it.

6) I don't use initramfs. My kernel is compiled by myself, no genkernel.

7) bootinfoscript

I can't understand why Grub legacy on sda/sdb can't boot my system on md12. If it could, I would never need Grub2.


Last edited by Frautoincnam on Mon Jan 07, 2019 3:51 am; edited 1 time in total
Back to top
View user's profile Send private message
ribx
Apprentice
Apprentice


Joined: 20 Nov 2003
Posts: 219
Location: germany

PostPosted: Mon Jan 07, 2019 1:19 am    Post subject: Reply with quote

I didn't use grub1 for quite some time and I think never on a RAID without a initram. I don't even understand how that will work. Who knows what /dev/md2 is? Is that name defined in the partition? Or is it chance, that the kernel and grub use the same name?

You can use the initramfs provided by genkernel easily with your own kernel. I do this for years. Just do

Code:

 # genkernel initramfs


after building a new kernel, thats it.

Also, I kind of tricked grub-mkconfig by creating some links:

Code:

# ls -l /boot/*99*
lrwxrwxrwx 1 root root 13 2016-12-20 12:41 /boot/initramfs-9999.img -> initramfs
lrwxrwxrwx 1 root root  7 2016-04-24 16:20 /boot/vmlinuz-9999 -> vmlinuz


That way I don't have to update the grub config after a update of the kernel and can still use grub-mkconfig to recreate it whenever I need to.

Honestly I think your setup is way too complicated. Did you ever thought about using btrfs as the "raid" provider? You could have everything in a big partition and then use supvolumes and set soft quotas where you need them (e.g. for /var/log). Only swap needs to be its own partition. That way you could utilize your disk space much better. btrfs support raid1 and you could even change it later to raid5 or raid1 with 3 mirrors or what ever you which to. And you will have snapshot support (Check out snapper for snapshots).

Backing up btrfs (also with snapshots, extended attributes and ACLs) is also quite easy.
_________________
The adopt an unanswered post initiative
Back to top
View user's profile Send private message
Frautoincnam
Tux's lil' helper
Tux's lil' helper


Joined: 19 May 2017
Posts: 76

PostPosted: Mon Jan 07, 2019 3:51 am    Post subject: Reply with quote

In fact, I just forgot to set my partitions to type FD (Raid auto detect).
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware 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