LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   GRUB2 menulist configuration, root in LVM (https://www.linuxquestions.org/questions/linux-newbie-8/grub2-menulist-configuration-root-in-lvm-4175428035/)

r4czek 09-19-2012 01:08 PM

GRUB2 menulist configuration, root in LVM
 
Hi, I hope this is right place to ask this question. I did everything I could, googled, read manuals and still I have problem. I'll be really grateful if you can help!

First, some info. Partitioning of my hdd:
sda1 - ntfs - Windows boot
sda2 - ntfs - Windows C:
sda3 - ntfs - Windows D:
sda4 - extended
-sda5 - ext4 - /boot
-sda6 - lvm

And inside sda6 there's LVM group calld G1 divided into volumes: home, root, tmp, usr, var, swap


So, here's my story:
I've just installed Debian Testing and GRUB2. Also disabled recovery mode for Debian in GRUB. After those operations I had two menu entries in GRUB:
-Debian GNU/Linux, with Linux 3.2.0-3-amd64
-Windows 7 (loader) (on /dev/sda1)

So far great! However, I'm a little bit pedant person and wanted to have just:
-Windows 7
-Debian Wheezy

Let's do it! Found this guide:
http://www.dedoimedo.com/computers/g...mozTocId584691

No problems with Windows 7, created 11_windows7, inside:
Quote:

#!/bin/sh -e
echo "Adding Windows 7"
cat << EOF
menuentry "Windows 7" {
set root=(hd0,1)
chainloader (hd0,1)+1
}
EOF
Tried to configure 12_debian:
Quote:

#!/bin/sh -e
cat << EOF
echo "Adding Debian Wheezy"
menuentry "Debian Wheezy" {
set root=(hd0,6)
linux /boot/vmlinuz-3.2.0-3-amd64
initrd /boot/initrd.img-3.2.0-3-amd
}
EOF
but with no success. After choosing "Debian Wheezy" in GRUB I get:
Quote:

error:file not found.
I guess that there's problem because root is "hided" inside LVM partition, am I right? I found some info about GRUB Naming convention (http://www.gnu.org/software/grub/man...ing-convention) and Device syntax (http://www.gnu.org/software/grub/man...#Device-syntax), but I'm a newbie and had no idea how to properly implement them.

Also, found interesting article here: https://wiki.archlinux.org/index.php/GRUB2#LVM and, accordingly tried:
Quote:

# (0) Arch Linux
cat << EOF
menuentry "Debian Wheezy" {
insmod lvm
set root=(G1-boot) #also tried G1-root
linux /boot/vmlinuz-3.2.0-3-amd64 root=/dev/mapper/G1-root ro
initrd /boot/initrd.img-3.2.0-3-amd
}
EOF
I'd appreciate every tip, every help, every tut and every manual =)

PS.: I wrote the whole story, because, surely, I've made a lot of mistakes during configuration and partitioning or something could have been done better or more professionally. Maybe you are able to find some mistakes =)

TobiSGD 09-20-2012 06:31 AM

You need to point Grub to your /boot, not the /-partition, since the kernel and initrd reside in /boot. So it should be
Code:

set root=hd(0,5)
and the kernel line should be appended with
Code:

root=/dev/VOLUME_GROUP/LOGICAL_VOLUME
if I am not mistaken.

r4czek 09-20-2012 11:48 AM

Tried, but without success. I used those combinations:
Quote:

#!/bin/sh -e
cat << EOF
echo "Adding Debian Wheezy"
menuentry "Debian Wheezy" {
set root=(hd0,5)
linux /boot/vmlinuz-3.2.0-3-amd64 root=/dev/G1/root
initrd /boot/initrd.img-3.2.0-3-amd
}
EOF
Quote:

#!/bin/sh -e
cat << EOF
echo "Adding Debian Wheezy"
menuentry "Debian Wheezy" {
set root=(hd0,5)
linux /boot/vmlinuz-3.2.0-3-amd64
initrd /boot/initrd.img-3.2.0-3-amd
}
EOF
Quote:

#!/bin/sh -e
cat << EOF
echo "Adding Debian Wheezy"
menuentry "Debian Wheezy" {
set root=hd(0,5)
linux /boot/vmlinuz-3.2.0-3-amd64
initrd /boot/initrd.img-3.2.0-3-amd
}
EOF
Quote:

#!/bin/sh -e
cat << EOF
echo "Adding Debian Wheezy"
menuentry "Debian Wheezy" {
set root=hd(0,5)
linux /boot/vmlinuz-3.2.0-3-amd64 root=/dev/G1/root
initrd /boot/initrd.img-3.2.0-3-amd
}
EOF
But now I'm getting not only "file not found" error, but also "you need to load the kernel first" error. =(


All times are GMT -5. The time now is 02:45 AM.