Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Problems with LVMs and grub...
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
shgadwa
Guru
Guru


Joined: 12 Mar 2009
Posts: 327

PostPosted: Fri Apr 06, 2012 5:28 am    Post subject: Problems with LVMs and grub... Reply with quote

So here's the thing...

I decided I wanted Linux on my new laptop. I have a couple years experience with gentoo, and it was on my old laptop until the hard drive crashed. But I thought to try something different, so I installed arch Linux. I did it using LVMs, and it was pretty simple. However the distro would of needed a ton of work to get it usable for me. So I kept the LVMs, cleaned it out, and installed gentoo. I noticed once I copied over the stage3 tarball and rebooted, it worked fine using my archlinux kernel. But then I installed gentoo-sources, configured the kernel, and such and upon reboot, I cannot get into the computer.

I'm pretty sure the issue is that the boot loader does not know where the root partition is. and/or the logical volume is not activated (vgchange -a y).

I ended up making a initram folder as well as a initscript, which seemed to have gotten me farther than before. Only now the kernel panics at boot, saying I need to append a root location in the grub configuration file.

I'm tired and giving up for now. That is, going to bed. Ill try to get you guys some pastebins soon.

In the meantime if anyone could help me I would appreciate it.

If it helps the actual partition is /dev/sda4. The logical volume is /dev/mapper/cryptpool-cryptroot. I also have a home logical volume but I figured I'd get gentoo up and running before setting all that up.
Back to top
View user's profile Send private message
Arkhelion
Apprentice
Apprentice


Joined: 07 Sep 2010
Posts: 151
Location: France

PostPosted: Fri Apr 06, 2012 6:57 am    Post subject: Reply with quote

Hello,

To have a root-on-lvm, you have to load lvm with an initrd (that's what arch does when you add the lvm hook in mkinitcpio). You can make your initrd on your own or simply use genkernel's --lvm option to get it done.

Cheers
_________________
Arkhelion
Back to top
View user's profile Send private message
shgadwa
Guru
Guru


Joined: 12 Mar 2009
Posts: 327

PostPosted: Fri Apr 06, 2012 12:03 pm    Post subject: Reply with quote

Arkhelion wrote:
Hello,

To have a root-on-lvm, you have to load lvm with an initrd (that's what arch does when you add the lvm hook in mkinitcpio). You can make your initrd on your own or simply use genkernel's --lvm option to get it done.

Cheers

Huh. I did do that, and that was what brought me to the kernel panic.

I've tried booting with a gentoo kernel and the arch Linux initramfs. That gets farther, but then it drops to a root prompt saying that its unable to locate any logical volumes. I've tried to use vgchange to find them but that doesn't work, it only works in the livecd... thus far.

If I used genkernel, how would I copy it over to the boot partition?
Back to top
View user's profile Send private message
shgadwa
Guru
Guru


Joined: 12 Mar 2009
Posts: 327

PostPosted: Fri Apr 06, 2012 12:23 pm    Post subject: Reply with quote

Right now the kernel says VFS: Cannot open root device "mapper/cryptpool-cryptroot" or unknown block (2,0)
please append correct "root=" boot option.

then it lists some options... sda1, sda2, etc.
Back to top
View user's profile Send private message
Arkhelion
Apprentice
Apprentice


Joined: 07 Sep 2010
Posts: 151
Location: France

PostPosted: Fri Apr 06, 2012 12:30 pm    Post subject: Reply with quote

"genkernel --install" would copy the generated bzimage+initrd to /boot I personnally use :
Code:
genkernel --install --oldconfig --menuconfig --lvm all


EDIT: Errr cryptpool is your VG I guess. And cryptroot your LV... Is it encrypted?
_________________
Arkhelion
Back to top
View user's profile Send private message
shgadwa
Guru
Guru


Joined: 12 Mar 2009
Posts: 327

PostPosted: Fri Apr 06, 2012 1:20 pm    Post subject: Reply with quote

Arkhelion wrote:
"genkernel --install" would copy the generated bzimage+initrd to /boot I personnally use :
Code:
genkernel --install --oldconfig --menuconfig --lvm all


EDIT: Errr cryptpool is your VG I guess. And cryptroot your LV... Is it encrypted?

No, its not encrypted. I've ran your genkernel command. I assume it puts bzImage in /boot. Using hat doesn't change the situation.
Back to top
View user's profile Send private message
shgadwa
Guru
Guru


Joined: 12 Mar 2009
Posts: 327

PostPosted: Fri Apr 06, 2012 1:46 pm    Post subject: Reply with quote

Im getting somewhere...

Found out after running the genkernel command, there is a initramfs genkernel image in /boot. I used that, and it does get me farther. Kernel doesn't panic anymore but right after module loading it says

block device /Dec/mapper/cryptpool-cryptroot is not a valid rood device. it wants me to specify the root directory.
Back to top
View user's profile Send private message
Arkhelion
Apprentice
Apprentice


Joined: 07 Sep 2010
Posts: 151
Location: France

PostPosted: Fri Apr 06, 2012 2:31 pm    Post subject: Reply with quote

It's actually getting somewhere, I guess. Do you see during the boot that it activates your LVM volumes?
Could you paste the grub/lilo line loading the kernel?
What's your root FS? Ext4? BtrFS? Is it compiled in kernel?
_________________
Arkhelion
Back to top
View user's profile Send private message
shgadwa
Guru
Guru


Joined: 12 Mar 2009
Posts: 327

PostPosted: Fri Apr 06, 2012 2:42 pm    Post subject: Reply with quote

Thank you for your help.

/kernel-3.2.12-gentoo
initrd /initramfs-genkernel-x86_64-3.2.12-gentoo

Filesystem is EXT4, I have that in the kernel, and also in /etc/fstab.
Back to top
View user's profile Send private message
shgadwa
Guru
Guru


Joined: 12 Mar 2009
Posts: 327

PostPosted: Fri Apr 06, 2012 2:51 pm    Post subject: Reply with quote

Looking at the boot kernel logs, it doesn't seem like it even tries to activate the logical volumes. Using the initramfs that U created, it would try to activate them but states that there are no logical volumes (untrue... logical volumes can be mounted using a live cd).
Back to top
View user's profile Send private message
Arkhelion
Apprentice
Apprentice


Joined: 07 Sep 2010
Posts: 151
Location: France

PostPosted: Fri Apr 06, 2012 4:48 pm    Post subject: Reply with quote

You have no options for your kernel in your bootloader (and what's your bootloader btw)?
I believe there should be root for grub2 or real_root for grub, and you could add a little dolvm to be sure it gets loaded. If you only load the kernel, I'm pretty sure it could miss things.

If you use GRUB, you could read this
_________________
Arkhelion
Back to top
View user's profile Send private message
shgadwa
Guru
Guru


Joined: 12 Mar 2009
Posts: 327

PostPosted: Fri Apr 06, 2012 7:53 pm    Post subject: Reply with quote

Arkhelion wrote:
You have no options for your kernel in your bootloader (and what's your bootloader btw)?
I believe there should be root for grub2 or real_root for grub, and you could add a little dolvm to be sure it gets loaded. If you only load the kernel, I'm pretty sure it could miss things.

If you use GRUB, you could read this

As the title says, I'm using grub. Grub 1. I believe I have menu.lst set properly. I will try to SSH into the live cd and copy configuration files.
Back to top
View user's profile Send private message
shgadwa
Guru
Guru


Joined: 12 Mar 2009
Posts: 327

PostPosted: Fri Apr 06, 2012 9:29 pm    Post subject: Reply with quote

Ok...

I've shh'd into it so I can copy and paste files.

grub menu.lst
Quote:
# (0) Gentoo Linux
title Gentoo Linux
root (hd0,4)
kernel /kernel-3.2.12-gentoo root=/dev/mapper/cryptpool-cryptroot ro
initrd /initramfs-genkernel-x86_64-3.2.12-gentoo

# (1) Gentoo Linux
title Gentoo Linux Fallback
root (hd0,4)
kernel /kernel-3.2.12-gentoo root=/dev/mapper/cryptpool-cryptroot ro
initrd /initramfs



Quote:
(chroot) livecd / # fdisk /dev/sda

Command (m for help): p

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 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: 0x249aaa6f

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 3074047 1536000 27 Hidden NTFS WinRE
/dev/sda2 3074048 412674047 204800000 7 HPFS/NTFS/exFAT
/dev/sda3 412674048 431435775 9380864 17 Hidden HPFS/NTFS
/dev/sda4 431435776 625142447 96853336 5 Extended
/dev/sda5 * 431437824 431642623 102400 83 Linux
/dev/sda6 431642687 625142447 96749880+ 83 Linux


Pretty sure the Logical Volumes are on /dev/sda6. /dev/sda5 is my /boot partition and it has ext2. The logical volumes have EXT4.

Quote:
(chroot) livecd / # ls /dev/mapper
control cryptpool-crypthome cryptpool-cryptroot cryptpool-cryptswap


Quote:
(chroot) livecd / # ls /boot
System.map-genkernel-x86_64-3.2.12-gentoo initramfs-linux-fallback.img
boot initramfs-linux.img
bzImage kernel-3.2.12-gentoo
grub kernel-genkernel-x86_64-3.2.12-gentoo
initram lost+found
initramfs vmlinuz-linux
initramfs-genkernel-x86_64-3.2.12-gentoo


Let me know if there's any other files you would need to help me here. Thanks a lot!

Shawn
Back to top
View user's profile Send private message
Arkhelion
Apprentice
Apprentice


Joined: 07 Sep 2010
Posts: 151
Location: France

PostPosted: Fri Apr 06, 2012 9:49 pm    Post subject: Reply with quote

Would you try to replace your kernel line in menu.lst with this one?
Code:
kernel /kernel-3.2.12-gentoo dolvm root=/dev/ram0 real_root=/dev/mapper/cryptpool-cryptroot init=/linuxrc

_________________
Arkhelion
Back to top
View user's profile Send private message
shgadwa
Guru
Guru


Joined: 12 Mar 2009
Posts: 327

PostPosted: Fri Apr 06, 2012 9:55 pm    Post subject: Reply with quote

Arkhelion wrote:
Would you try to replace your kernel line in menu.lst with this one?
Code:
kernel /kernel-3.2.12-gentoo dolvm root=/dev/ram0 real_root=/dev/mapper/cryptpool-cryptroot init=/linuxrc

WOW! You're awesome! That worked. Thank you so much!
Back to top
View user's profile Send private message
apinsard
n00b
n00b


Joined: 24 Mar 2012
Posts: 74
Location: France

PostPosted: Sun Apr 08, 2012 8:23 pm    Post subject: Reply with quote

Hi, I'm having the same problem but the given solution doesn't work for me.

The errors are exactly the same as shgadwa.

I'm using grub 0.97

Here are the ways I boot m'y system

Code:
 
root (hd0, 0)
kernel /boot/kernel-genkernel-x86_64-3.2.12-gentoo root=/dev/vg0/system doscsi



Code:
 
root (hd0, 0)
kernel /boot/kernel-genkernel-x86_64-3.2.12-gentoo root=/dev/vg0/system init=/bin/bb doscsi
initrd /boot/initramfs-genkernel-x86_64-3.2.12-gentoo


I tried with dolvm, real_root...
But nothing happened.

Any idea?
Back to top
View user's profile Send private message
shgadwa
Guru
Guru


Joined: 12 Mar 2009
Posts: 327

PostPosted: Sun Apr 08, 2012 9:58 pm    Post subject: Reply with quote

This is no longer working for me either. Only thing I've changed, that I can think of, is I've reconfigured my kernel. Now it says that it cannot find any logical volumes, then says block device /dev/mapper/cryptpool-cryptroot is not a valid root device. I have not changed my menu.lst grub file. Weird thing is I've reverted back to previous kernel settings (which worked before) and that didn't change anything. I'm wondering if emerge --depclean broke something.
Back to top
View user's profile Send private message
apinsard
n00b
n00b


Joined: 24 Mar 2012
Posts: 74
Location: France

PostPosted: Sun Apr 08, 2012 10:02 pm    Post subject: Reply with quote

Actually it works for me, I might have misstype anything.
Back to top
View user's profile Send private message
shgadwa
Guru
Guru


Joined: 12 Mar 2009
Posts: 327

PostPosted: Sun Apr 08, 2012 10:11 pm    Post subject: Reply with quote

I'm a field engineer so I have got troubleshooting down...

Its not a problem with --depclean ruining something. I just did a revdep-rebuild and nothing was broken. Also it has to be a kernel problem of some sort because I remember now, I had configured the kernel from scratch (only enabling what is required), but made a mistake on copying the image over to /boot. At this point I was able to boot up fine, but it wasn't my new kernel. So, I reconfigured the kernel, copied the image over, and now it won't boot.

My old kernel configuration is no longer present because I deleted it. However I find it odd that the genkernel image which was booting fine previously, is no longer booting because of the same issue.

I can't think of anything myself or genkernel might have missed in configuring the kernel. If the hard drive device was not compiled in the kernel, I wouldn't have gotten as far as I did. device mapper is compiled in the kernel, initramfs is compiled in the kernel.

The fact that it was working on the other kernel suggests its a kernel issue, the fact that genkernel doesn't work suggests its a grub/boot and/or initramfs issue. At any rate, the issue is that lvm is not finding logical volumes.

any help would be appreciated.
Back to top
View user's profile Send private message
shgadwa
Guru
Guru


Joined: 12 Mar 2009
Posts: 327

PostPosted: Mon Apr 09, 2012 12:36 am    Post subject: Reply with quote

Still working on trying to get this working, and still puzzled as to why its not...

After it says there are no logical volumes, it drops to a busybox shell. From there, I am unable to mount my physical volume (/dev/sda6), I am unable to activate logical volumes, and if I scan for logical volumes, I noticed its searching ram0, ram1, ram2, etc for logical volumes, and finding none.
Back to top
View user's profile Send private message
Arkhelion
Apprentice
Apprentice


Joined: 07 Sep 2010
Posts: 151
Location: France

PostPosted: Mon Apr 09, 2012 8:18 am    Post subject: Reply with quote

How did you generate your initrd ther last time you did it. Did you use genkernel --lvm? That might be it.
_________________
Arkhelion
Back to top
View user's profile Send private message
shgadwa
Guru
Guru


Joined: 12 Mar 2009
Posts: 327

PostPosted: Mon Apr 09, 2012 11:45 am    Post subject: Reply with quote

Arkhelion wrote:
How did you generate your initrd ther last time you did it. Did you use genkernel --lvm? That might be it.


Yes, however if I use the genkernel initrd, it drops to a busybox shell because it can't find any logical volumes.
Back to top
View user's profile Send private message
shgadwa
Guru
Guru


Joined: 12 Mar 2009
Posts: 327

PostPosted: Mon Apr 09, 2012 3:46 pm    Post subject: Reply with quote

Ok... a couple things here.


If I use my own initramfs, the kernel panics (now, it didn't do this before?) saying that it cannot find /bin/lvm or /bin/sh. Something must be wrong with my syntax or something.

Using the generated initramfs from genkernel, it drops to a shell saying that it cannot find any logical volumes. After further digging, it appears that it cannot see my physical partitions. Something is wrong with how device nodes are picked up. /dev/sda6 doesn't even exist in /dev. /dev/sda (my hard drive) is there, but I am unable to mount it.

Currently I am using devtmpfs, but I have also used udev... with the same results.
Back to top
View user's profile Send private message
Arkhelion
Apprentice
Apprentice


Joined: 07 Sep 2010
Posts: 151
Location: France

PostPosted: Tue Apr 10, 2012 9:16 am    Post subject: Reply with quote

If the kernel says it can't find /bin/lvm, or /bin/sh in your manually built initrd, I guess, there's something wrong with it (is the compression method compiled in the kernel?).

About the genkernel's initrd, there's something wrong with it if you can't find any partition in /dev/sda. The fact that you can't mount /dev/sda is not surprising, mount can't determine the type of this device, and I _think_ "mount" is just a wrapper for "mount.ext4" or "mount.btrfs". So if it can't determine the type of device, it can't call the right program.

I'm not sure I can't figure out why it wouldn't work, but maybe it could help if you could paste here the output of
Code:
fdisk -l /dev/sda


EDIT: Sorry, just saw you fixed it in another thread
_________________
Arkhelion
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