LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Distributions (https://www.linuxquestions.org/questions/linux-distributions-5/)
-   -   how to get grub2 to work properly in mbr of multi-boot system with lvm (https://www.linuxquestions.org/questions/linux-distributions-5/how-to-get-grub2-to-work-properly-in-mbr-of-multi-boot-system-with-lvm-925544/)

ruggetier 01-24-2012 07:10 PM

how to get grub2 to work properly in mbr of multi-boot system with lvm
 
Hello forum,
I’m new member, glad to be here and sending greetings to all helping hands out there.

Now here is my story:
After a major breakdown I’m trying to set up a multi boot system like so:
  • inevitable XP
  • Linux Mint for daily use "out of the box"
  • Bodhi for fiddling and fun
  • Scientific Linux with focus on security, for coding Salome simulations and other work stuff

This time I decided to use lvm for obvious reasons, I never did this before.

Mint installation went well (including dualboot), but after installing Bodhi I was surprised when the bootmenue only showed Bodhi and XP entries — Mint was gone.

Since then I’m trying to get grub to list all three OSes, but all the infos i could find do not apply, because they either do not cover lvm or multiboot, just dualboot with lvm, what I already have achieved twice ;-)

Here’s some infos that might be of relevance:
  • I did not use /boot partitions but wrote grub directly on “sda”
  • Filesystem of all Linux partitions is ext4
So now Scientific Linux is yet to be installed, and I hope you people could point me out the proper proceedings so that in the end I can choose among all of them.

Many thanks :wave:

towheedm 01-24-2012 09:43 PM

I'f Mint is for daily use, I'll assume it controls grub and its configuration files. Remember only one OS has 'control' of GRUB's menu.

To return control to Mint, do this:
1. From the GRUB menu, press c for GRUB's command line
2. Set root with set root='(hdx,y)' where x is the drive and y the partition on the drive where you installed Mint. Remember partitions start with 1.
3. Load the kernel with linux /boot/vmlinuz....... root=/dev/<lvm root device>. If you don't know the version of the kernel, press <tab> for a list.
4. Load the initramfs with initrd /boot/initrd...... If you don't know the version of the kernel, press <tab> for a list. This must match the kernel.
5. Boot the kernel with the command 'boot'.

Once Mint is loaded give Mint control of GRUB again with:
Code:

sudo grub-install /dev/sda
Update GRUB's menu with:
Code:

sudo update-grub
If you cannot determine the root device or kernel version, you may also do this:
Mount your Mint partition in Bodhi
Code:

mkdir /mnt/mint ; mount /dev/sdx /mnt/mint
where sdx is the partition with Mint

Look at your grub.cfg file in Mint:
Code:

cat /mnt/mint/boot/grub/grub.cfg | less
Look for the first menuentry line. Within the menuentry section, note the set root=, linux and initrd lines. Use these as the values for the Steps 1 to 5 above.

I don't use lvm, do I'm not sure of any specifics for lvm.

If this don't work, post back with any error message.

ruggetier 01-27-2012 08:59 PM

Thanks towheedm but before I tried your approach I rebooted once again and updated grub and it worked! I have no idea why it didn´t before, I must have messed sth up.

Then I tried to install Scientific Linux, but it does not support grub2. That means you have to have a /boot partition outside the lvm. I didn´t want that so I swiched to CAElinux wich comes with Salome in a package. This one´s a ubuntu derivate so no probs here with grub2.

For now everything is fine :wave:


All times are GMT -5. The time now is 09:46 AM.