Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Trouble installing w/ grub2 and volume group
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
mdiehl
n00b
n00b


Joined: 04 Oct 2015
Posts: 3

PostPosted: Sun Oct 04, 2015 10:13 pm    Post subject: Trouble installing w/ grub2 and volume group Reply with quote

Hi all,

It's been a while since I've installed Gentoo, so I'm having difficulty
getting grub2 and lvm to play well together.

I've got the kernel configured and when I tried to boot it with lilo, the
system ran. However, it did ask me for the name of the root block device.

So, I convert to grub2... Grub starts to "determine root device" and comes
back and says that:

Block Device /dev/mapper/server-server is not a valid root device

(No, I'm not very creative when it comes to naming things.)

I also note that if I boot from the install cd, I have to do a vgscan and
vgchange -a y (If I recall correctly) in order to be able to mount my root
filesystem.

So, it actually doesn't seem to be a grub thing, but rather the volume group
doesn't seem to be "active" from boot to boot.

So, how do I fix this?

TIA.

--
Mike Diehl
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Sun Oct 04, 2015 10:26 pm    Post subject: Reply with quote

mdiehl,

Welcome to Gentoo.

Root on a Logical Volume requires an initrd.
The problem is that starting LVM needs some users space tools that can only be accessed one root is mounted, but mounting root needs LVM to be started that ...
Yep, its a viscious circle. There are many like this in the boot process.

The initrd is a root filesystem in a file. The boot loader loads this file and the kernel mounts it as root.
It now has the user space tools it needs the start LVM to be able te mount the real root.

Your diagnosis
mdiehl wrote:
So, it actually doesn't seem to be a grub thing, but rather the volume group
doesn't seem to be "active" from boot to boot.
is spot on.

There are several ways to make a suitable initrd. dracut, genkernel and rolling your own come to mind.
As I'm not a great fan of automation for initrd generation, I make my own.
You will find all three described on the Gentoo WiKi.
_________________
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
mdiehl
n00b
n00b


Joined: 04 Oct 2015
Posts: 3

PostPosted: Sun Oct 04, 2015 10:30 pm    Post subject: Reply with quote

Thank you for taking the time to read about my problem.

I did use genkernel --lvm to create the initrd and that initrd does seem to get loaded by grub2.

Note that there is a RAID1 inside the volume group.

It seems as though the volume needs to be "marked" active somehow. When I boot from the cd, I have to do the vgscan myself each time.

Any ideas?

TIA.

Mike
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Sun Oct 04, 2015 10:49 pm    Post subject: Reply with quote

mdiehl,

Do you mean you use mdadm to raid together logical volumes or that your logical volumes are mirrored using logical volume manager?

My system has root on LVM on RAID5, so I need to assemble the raid set befoe I can see the logical volumes, so that vgchange -ay can succeed.

Code:
genkernel --lvm
will not include any mdadm raid tools into the initrd. However, it will provide a rescue shell, which will be invoked when booting fails. From memory, you get a busybox shell.

Have a look at the initrd init script.
Code:
more /init
does it do what you need?

If you type the commands (from the init script) into the rescue shell, does the system boot or is there something missing?
The initrd is a cpio archive of cpio archives, so you can unpick it if that would help.
_________________
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
mdiehl
n00b
n00b


Joined: 04 Oct 2015
Posts: 3

PostPosted: Mon Oct 05, 2015 5:23 am    Post subject: Reply with quote

Your pointer about accessing the busybox shell was helpful.

I got to the shell and discovered that the RAID hadn't been assembled automatically.

So, I did an mdadm --assemble --scan and the RAID came right up.

Then a vgscan and vgchange -a y and I was able to mount root and boot the system.

So, my (hopefully?) final question is: How do I get the the initrd to do this for me? Or what did I do to dork it up in the first place?

OK 2 questions.

Any ideas?
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Mon Oct 05, 2015 9:40 am    Post subject: Reply with quote

genkernel can build an initramfs /aka initrd for you. worked for my lvm container without raid so far. Warning. backup your kernel config or pay close attention what genkernel does, else it may overwrite your /usr/src/linux/.config . I reuse that (identical / same) initramfs since a few years. once you have built it you can reuse it for any kernel.

also pay attention to the needed kernel modules and kernel parameters.

i need for example dolvm in the kernel line.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Mon Oct 05, 2015 4:31 pm    Post subject: Reply with quote

mdiehl,

I think genkernel has a mdadm option. Yon need to give both the mdadm anh lvm options.
Code:
man genkernel
or genkernel --help or even genkernel -h may help.

You only appear to need the initrd. genkernel can do that too.
_________________
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
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