1

There are lots of OSs and Linux dists to install on your netbook, and I want to make it as easy as possible to install, remove and switch between them.

Just installing a dist and then another one after it will replace the GRUB boot screen every time, and some dists might override previous GRUB menus entirely.

On a previous machine I created a GRUB partition which chain-loads GRUB for each dist, but now I can't remember how I did it.

The hard drive is currently empty, since I started playing around with repartitioning. What is the easiest way to install GRUB to a partition? Links are welcome, but please no generic "install GRUB" guides because the ones I've found haven't been relevant to my particular situation (empty hard drive, multi boot environment, no CD/floppy)..

2 Answers 2

2

Just configure one GRUB install to find your various kernels.

Say you have three partitions. sda1 with Windows. And sda2 and sda3 with a Linux distribution each. Your GRUB configuration should look like this:

title Windows
rootnoverify (hd0,0)
chainloader +1

title Linux 1
root (hd0,1)
kernel /path/to/kernel1

title Linux 2
root (hd0,2)
kernel /path/to/kernel2

This way you can load all OSes directly via one GRUB setup. Maybe you want to install GRUB into the partition boot record as well. Then you could also chain load the Linuxes:

title Windows
rootnoverify (hd0,0)
chainloader +1

title Linux 2
rootnoverify (hd0,2)
chainloader +1

title Linux 1
root (hd0,1)
kernel /path/to/kernel1

The chain load option tells GRUB to load the first sector of the given partition where the next bootloader is located.

1
  • I want to accomplish the same soon, this is helpful, thanks!
    – invert
    Feb 24, 2011 at 14:27
0

In GRUB 2, you would use the command sudo grub-install {your boot partition, e.g. /dev/sdb2} which should autodetect which drives have a bootable OS on them and create the appropriate configuration files. In GRUB 2, you shouldn't configure the grub.cfg file by yourself, rather let GRUB 2 work itself using the commands grub-install and update-grub.

This should even work from a live CD. It'll autodetect the GRUB 2 on the hard disk drive and change those files.

1
  • 1
    This seems to be Ubuntu specific. Other distributions may not encourage autodetection. grub-mkconfig is another way to create a grub2 config. Included will be the kernels in /boot only. grub-install does no autodetection for itself, it just installs grub2 according to its config and does some sanity checks. Aug 21, 2010 at 9:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.