Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Installing grub2 with /boot on software 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
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 811

PostPosted: Sat Jun 29, 2013 2:28 pm    Post subject: [SOLVED] Installing grub2 with /boot on software raid Reply with quote

Hi All,

I'm a bit stuck on a new installation where i want to have 2 disks in software raid. The bootloader should be grub2 because the bios is known to have issues with grub legacy.

My setup is this:
I have two disks, sda and sdb. I'm currently booting from /dev/sdb which i made bootable with unetbootin and a gentoo live dvd image. /dev/sda is where i'm installing. All partitions should be software raided (although with one drive only, which i will change as soon as i don't need /dev/sdb anymore for booting, for now /dev/sdb is my fallback in case /dev/sda doesn't boot :) ).

This are the partitions:
Code:

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xf96d7342

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048      264191      131072   fd  Linux raid autodetect
/dev/sda2          264192     8652799     4194304   fd  Linux raid autodetect

And this is /proc/mdstat for the raid1 "array"'s:
Code:

Personalities : [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md1 : active raid1 sda2[0]
      4194240 blocks [1/1] [U]
     
md0 : active raid1 sda1[0]
      131008 blocks [1/1] [U]
     
unused devices: <none>

The filesystems on the raid devices are ext2 voor /dev/md0 for /boot and ext3 on /dev/md1 for /.

According to the manual (which i found here: http://www.gnu.org/software/grub/manual/grub.html#Device-syntax ) i made this device.map:
Code:

(hd0) /dev/sda
(hd1) /dev/sdb
(md/0) /dev/md0
(md/1) /dev/md1

But when i try to intall grub it reports:
Code:

/usr/sbin/grub2-probe: warning: the drive name `md/0' in device.map is incorrect. Using hostdisk//dev/md0 instead. Please use the form [hfc]d[0-9]* (E.g. `hd0' or `cd').
/usr/sbin/grub2-probe: warning: the drive name `md/1' in device.map is incorrect. Using hostdisk//dev/md1 instead. Please use the form [hfc]d[0-9]* (E.g. `hd0' or `cd').

If i remove the md/[01] from device.map and try to install grub, it reports:
Code:

Path `/boot/grub2' is not readable by GRUB on boot. Installation is impossible. Aborting.

When i got grub to install itself it indeed wasn't able to read the kernel from the array and reported "unknown filesystem" when i pointed it to the raid partition.

I found the catch that the device-mapper has to be enabled, but that did not make a difference:
Code:

These are the packages that would be merged, in reverse order:

Calculating dependencies... done!
[ebuild   R   ~] sys-boot/grub-2.00-r3:2  USE="device-mapper nls -custom-cflags -debug -d
oc -efiemu -libzfs -mount -sdl -static -truetype" GRUB_PLATFORMS="pc -coreboot -efi-32 -e
fi-64 -emu -ieee1275 -multiboot -qemu -qemu-mips -yeeloong" 0 kB

Total: 1 package (1 reinstall), Size of downloads: 0 kB


Any clues ?
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com


Last edited by pa4wdh on Sun Jul 07, 2013 10:56 am; edited 1 time in total
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 811

PostPosted: Thu Jul 04, 2013 5:31 pm    Post subject: Reply with quote

After getting some help on the grub-help mailing list i learned i should include de md devices in the device.map, so i removed those.

But, somehow, for reasons i do not yet understand, the behavior changed even before i made that change to the device.map, and in my opinion the situation got worse.
Right now grub2-install /dev/sda gives:
Code:

pc12 / # grub2-install /dev/sda
*** glibc detected *** /usr/sbin/grub2-probe: double free or corruption (fasttop): 0x00007f369d678120 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x7d586)[0x7f369cbcf586]
/usr/sbin/grub2-probe(+0xbd5bd)[0x7f369d4195bd]
/usr/sbin/grub2-probe(+0xd142e)[0x7f369d42d42e]
/usr/sbin/grub2-probe(+0xd1677)[0x7f369d42d677]
/usr/sbin/grub2-probe(+0xd1639)[0x7f369d42d639]
/usr/sbin/grub2-probe(+0xe1da)[0x7f369d36a1da]
/usr/sbin/grub2-probe(main+0x315)[0x7f369d366246]
/lib64/libc.so.6(__libc_start_main+0xed)[0x7f369cb765dd]
/usr/sbin/grub2-probe(+0x7bb9)[0x7f369d363bb9]
======= Memory map: ========
7f369c301000-7f369c316000 r-xp 00000000 09:01 198945                     /usr/lib64/gcc/x86_64-pc-linux-gnu/4.6.3/libgcc_s.so.1
7f369c316000-7f369c516000 ---p 00015000 09:01 198945                     /usr/lib64/gcc/x86_64-pc-linux-gnu/4.6.3/libgcc_s.so.1
7f369c516000-7f369c517000 r-xp 00015000 09:01 198945                     /usr/lib64/gcc/x86_64-pc-linux-gnu/4.6.3/libgcc_s.so.1
7f369c517000-7f369c518000 rwxp 00016000 09:01 198945                     /usr/lib64/gcc/x86_64-pc-linux-gnu/4.6.3/libgcc_s.so.1
7f369c518000-7f369c530000 r-xp 00000000 09:01 98446                      /lib64/libpthread-2.15.so
7f369c530000-7f369c72f000 ---p 00018000 09:01 98446                      /lib64/libpthread-2.15.so
7f369c72f000-7f369c730000 r-xp 00017000 09:01 98446                      /lib64/libpthread-2.15.so
7f369c730000-7f369c731000 rwxp 00018000 09:01 98446                      /lib64/libpthread-2.15.so
7f369c731000-7f369c735000 rwxp 00000000 00:00 0
7f369c735000-7f369c73d000 r-xp 00000000 09:01 98455                      /lib64/librt-2.15.so
7f369c73d000-7f369c93c000 ---p 00008000 09:01 98455                      /lib64/librt-2.15.so
7f369c93c000-7f369c93d000 r-xp 00007000 09:01 98455                      /lib64/librt-2.15.so
7f369c93d000-7f369c93e000 rwxp 00008000 09:01 98455                      /lib64/librt-2.15.so
7f369c93e000-7f369c950000 r-xp 00000000 09:01 98391                      /lib64/libudev.so.1.3.5
7f369c950000-7f369cb50000 ---p 00012000 09:01 98391                      /lib64/libudev.so.1.3.5
7f369cb50000-7f369cb51000 r-xp 00012000 09:01 98391                      /lib64/libudev.so.1.3.5
7f369cb51000-7f369cb52000 rwxp 00013000 09:01 98391                      /lib64/libudev.so.1.3.5
7f369cb52000-7f369ccf1000 r-xp 00000000 09:01 98361                      /lib64/libc-2.15.so
7f369ccf1000-7f369cef1000 ---p 0019f000 09:01 98361                      /lib64/libc-2.15.so
7f369cef1000-7f369cef5000 r-xp 0019f000 09:01 98361                      /lib64/libc-2.15.so
7f369cef5000-7f369cef7000 rwxp 001a3000 09:01 98361                      /lib64/libc-2.15.so
7f369cef7000-7f369cefb000 rwxp 00000000 00:00 0
7f369cefb000-7f369cf34000 r-xp 00000000 09:01 413253                     /lib64/libdevmapper.so.1.02
7f369cf34000-7f369d133000 ---p 00039000 09:01 413253                     /lib64/libdevmapper.so.1.02
7f369d133000-7f369d134000 r-xp 00038000 09:01 413253                     /lib64/libdevmapper.so.1.02
7f369d134000-7f369d137000 rwxp 00039000 09:01 413253                     /lib64/libdevmapper.so.1.02
7f369d137000-7f369d138000 rwxp 00000000 00:00 0
7f369d138000-7f369d159000 r-xp 00000000 09:01 98439                      /lib64/ld-2.15.so
7f369d34d000-7f369d351000 rwxp 00000000 00:00 0
7f369d352000-7f369d359000 rwxp 00000000 00:00 0
7f369d359000-7f369d35a000 r-xp 00021000 09:01 98439                      /lib64/ld-2.15.so
7f369d35a000-7f369d35b000 rwxp 00022000 09:01 98439                      /lib64/ld-2.15.so
7f369d35b000-7f369d35c000 rwxp 00000000 00:00 0
7f369d35c000-7f369d461000 r-xp 00000000 09:01 429083                     /usr/sbin/grub2-probe
7f369d661000-7f369d662000 r-xp 00105000 09:01 429083                     /usr/sbin/grub2-probe
7f369d662000-7f369d669000 rwxp 00106000 09:01 429083                     /usr/sbin/grub2-probe
7f369d669000-7f369d912000 rwxp 00000000 00:00 0                          [heap]
7fffa4c4b000-7fffa4c8e000 rwxp 00000000 00:00 0                          [stack]
7fffa4d78000-7fffa4d79000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
/usr/share/grub/grub-mkconfig_lib: line 53: 11470 Aborted                 "${grub_probe}" -t fs "$path" > /dev/null 2>&1
Path `/boot/grub2' is not readable by GRUB on boot. Installation is impossible. Aborting.


It's actually grub2-probe failing here. On a normal partition it works normal, but as soon as i point it to a raid device it fails:
Code:

pc12 / # grub2-probe -d /dev/sdb2
ext2
pc12 / # grub2-probe -d /dev/md0
ext2
*** glibc detected *** grub2-probe: double free or corruption (fasttop): 0x00007feb9f0aa0b0 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x7d586)[0x7feb9e601586]
grub2-probe(+0xbd5bd)[0x7feb9ee4b5bd]
grub2-probe(+0xd142e)[0x7feb9ee5f42e]
grub2-probe(+0xd1677)[0x7feb9ee5f677]
grub2-probe(+0xd1639)[0x7feb9ee5f639]
grub2-probe(+0xe1da)[0x7feb9ed9c1da]
grub2-probe(main+0x315)[0x7feb9ed98246]
/lib64/libc.so.6(__libc_start_main+0xed)[0x7feb9e5a85dd]
grub2-probe(+0x7bb9)[0x7feb9ed95bb9]
======= Memory map: ========
7feb9dd33000-7feb9dd48000 r-xp 00000000 09:01 198945                     /usr/lib64/gcc/x86_64-pc-linux-gnu/4.6.3/libgcc_s.so.1
7feb9dd48000-7feb9df48000 ---p 00015000 09:01 198945                     /usr/lib64/gcc/x86_64-pc-linux-gnu/4.6.3/libgcc_s.so.1
7feb9df48000-7feb9df49000 r-xp 00015000 09:01 198945                     /usr/lib64/gcc/x86_64-pc-linux-gnu/4.6.3/libgcc_s.so.1
7feb9df49000-7feb9df4a000 rwxp 00016000 09:01 198945                     /usr/lib64/gcc/x86_64-pc-linux-gnu/4.6.3/libgcc_s.so.1
7feb9df4a000-7feb9df62000 r-xp 00000000 09:01 98446                      /lib64/libpthread-2.15.so
7feb9df62000-7feb9e161000 ---p 00018000 09:01 98446                      /lib64/libpthread-2.15.so
7feb9e161000-7feb9e162000 r-xp 00017000 09:01 98446                      /lib64/libpthread-2.15.so
7feb9e162000-7feb9e163000 rwxp 00018000 09:01 98446                      /lib64/libpthread-2.15.so
7feb9e163000-7feb9e167000 rwxp 00000000 00:00 0
7feb9e167000-7feb9e16f000 r-xp 00000000 09:01 98455                      /lib64/librt-2.15.so
7feb9e16f000-7feb9e36e000 ---p 00008000 09:01 98455                      /lib64/librt-2.15.so
7feb9e36e000-7feb9e36f000 r-xp 00007000 09:01 98455                      /lib64/librt-2.15.so
7feb9e36f000-7feb9e370000 rwxp 00008000 09:01 98455                      /lib64/librt-2.15.so
7feb9e370000-7feb9e382000 r-xp 00000000 09:01 98391                      /lib64/libudev.so.1.3.5
7feb9e382000-7feb9e582000 ---p 00012000 09:01 98391                      /lib64/libudev.so.1.3.5
7feb9e582000-7feb9e583000 r-xp 00012000 09:01 98391                      /lib64/libudev.so.1.3.5
7feb9e583000-7feb9e584000 rwxp 00013000 09:01 98391                      /lib64/libudev.so.1.3.5
7feb9e584000-7feb9e723000 r-xp 00000000 09:01 98361                      /lib64/libc-2.15.so
7feb9e723000-7feb9e923000 ---p 0019f000 09:01 98361                      /lib64/libc-2.15.so
7feb9e923000-7feb9e927000 r-xp 0019f000 09:01 98361                      /lib64/libc-2.15.so
7feb9e927000-7feb9e929000 rwxp 001a3000 09:01 98361                      /lib64/libc-2.15.so
7feb9e929000-7feb9e92d000 rwxp 00000000 00:00 0
7feb9e92d000-7feb9e966000 r-xp 00000000 09:01 413253                     /lib64/libdevmapper.so.1.02
7feb9e966000-7feb9eb65000 ---p 00039000 09:01 413253                     /lib64/libdevmapper.so.1.02
7feb9eb65000-7feb9eb66000 r-xp 00038000 09:01 413253                     /lib64/libdevmapper.so.1.02
7feb9eb66000-7feb9eb69000 rwxp 00039000 09:01 413253                     /lib64/libdevmapper.so.1.02
7feb9eb69000-7feb9eb6a000 rwxp 00000000 00:00 0
7feb9eb6a000-7feb9eb8b000 r-xp 00000000 09:01 98439                      /lib64/ld-2.15.so
7feb9ed7f000-7feb9ed83000 rwxp 00000000 00:00 0
7feb9ed84000-7feb9ed8b000 rwxp 00000000 00:00 0
7feb9ed8b000-7feb9ed8c000 r-xp 00021000 09:01 98439                      /lib64/ld-2.15.so
7feb9ed8c000-7feb9ed8d000 rwxp 00022000 09:01 98439                      /lib64/ld-2.15.so
7feb9ed8d000-7feb9ed8e000 rwxp 00000000 00:00 0
7feb9ed8e000-7feb9ee93000 r-xp 00000000 09:01 429083                     /usr/sbin/grub2-probe
7feb9f093000-7feb9f094000 r-xp 00105000 09:01 429083                     /usr/sbin/grub2-probe
7feb9f094000-7feb9f09b000 rwxp 00106000 09:01 429083                     /usr/sbin/grub2-probe
7feb9f09b000-7feb9f342000 rwxp 00000000 00:00 0                          [heap]
7fff371ea000-7fff37210000 rwxp 00000000 00:00 0                          [stack]
7fff3730d000-7fff3730e000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Aborted

Note that also on the raid device it gives the correct answer (ext2) before aborting.

I also tried to make the /boot raid array an array with more than one partition by adding a second partition which lives on /dev/sda3. Of course this doesn't give me any redundancy but that was just to check if grub failed because there was only one disk in the raid configuration which usually is a bit odd.
So this is the raid config now:
Code:

pc12 / # fdisk -l /dev/sda

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xf96d7342

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048      264191      131072   fd  Linux raid autodetect
/dev/sda2          264192     8652799     4194304   fd  Linux raid autodetect
/dev/sda3         8652800     8914943      131072   fd  Linux raid autodetect
pc12 / # cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sda2[0]
      4194240 blocks [1/1] [U]
     
md0 : active raid1 sda3[1] sda1[0]
      131008 blocks [2/2] [UU]
     
unused devices: <none>

Unfortunately that didn't change anything in grub's behavior.
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 811

PostPosted: Sat Jul 06, 2013 3:17 pm    Post subject: Reply with quote

The difference seems to be if mdadm is installed or not. If mdadm is installed grub2 seems to use it to find the UUID and some other stuff of the raid devices. However, the "double free" occurs when mdadm is installed, so something seems to be wrong there.
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 811

PostPosted: Sun Jul 07, 2013 10:55 am    Post subject: Reply with quote

The problem is finally solved :D

It seems 1-disk raid array's confuse grub2-probe, so when i made both arrays (not only /boot) redundant is started to work as intended :)
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
Dr_b_
n00b
n00b


Joined: 18 Jan 2004
Posts: 33

PostPosted: Thu Apr 24, 2014 2:55 am    Post subject: Same problem installing on software RAID /dev/mdx Reply with quote

pa4wdh wrote:
The difference seems to be if mdadm is installed or not. If mdadm is installed grub2 seems to use it to find the UUID and some other stuff of the raid devices. However, the "double free" occurs when mdadm is installed, so something seems to be wrong there.


After many days of troubleshooting, I read this post, and it solved the problem i was having similar in description to the OP.


Code:
livecd / # grub2-install /dev/sda
Path `/boot/grub' is not readable by GRUB on boot. Installation is impossible. Aborting.

livecd / # grub2-probe -d /dev/md126
grub2-probe: error: disk `md126' not found.



The gentoo installation docs assume single disk and the grub2 install docs (wiki) didn't mention installing mdadm first. I think i will attempt to add that to the grub2 wiki doc, I can't be the only one using RAID and running into this issue on a new install.

mdraid grub2 installation fails on raid without mdadm package installed
Back to top
View user's profile Send private message
JackHunt
n00b
n00b


Joined: 21 Aug 2016
Posts: 47
Location: Oxfordshire, England

PostPosted: Wed Jul 21, 2021 4:18 pm    Post subject: Re: Same problem installing on software RAID /dev/mdx Reply with quote

Dr_b_ wrote:
pa4wdh wrote:
The difference seems to be if mdadm is installed or not. If mdadm is installed grub2 seems to use it to find the UUID and some other stuff of the raid devices. However, the "double free" occurs when mdadm is installed, so something seems to be wrong there.


After many days of troubleshooting, I read this post, and it solved the problem i was having similar in description to the OP.


Code:
livecd / # grub2-install /dev/sda
Path `/boot/grub' is not readable by GRUB on boot. Installation is impossible. Aborting.

livecd / # grub2-probe -d /dev/md126
grub2-probe: error: disk `md126' not found.



The gentoo installation docs assume single disk and the grub2 install docs (wiki) didn't mention installing mdadm first. I think i will attempt to add that to the grub2 wiki doc, I can't be the only one using RAID and running into this issue on a new install.

mdraid grub2 installation fails on raid without mdadm package installed


Sorry for the necro, but I can confirm this is still the case. Thanks, saved me further frustration.
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