Grub2 without Linux

I wanted to create a system where I can plug in operating systems as I like. Meaning switching from a Win/Linux dual boot to Win/Win etc. I thought Grub or Grub2 would be a good way to do so.  It turned out to be a little tricky for reasons I do not fully comprehend yet. I also lack the time to research any further. Yet here is how it eventually worked:

I used Ubuntu 10.04 (CD) as a tool to install Grub2. We will set up Grub2 on a dedicated boot partition. In our case this partition will be called sda1:

1) Boot from CD and use GParted to create a ~100MB partition which will be a dedicated boot partition holding the required Grub2 files, let us say that partition is called sda1.

2) Next open a terminal and type:

1
2
3
sudo mount /dev/sda1 /mnt
sudo grub-install --root-directory=/mnt /dev/sda1
sudo sh -x /usr/sbin/grub-mkconfig -o /mnt/boot/grub/grub.cfg

3) I think this optional yet call and at best prevents some disc errors

1
sudo umount /dev/sda1

4) Reboot

Step 2) will mount the boot partition you just created (line 1). It also writes Grub2 into the Master Boot Record (MBR) and create the needed files on the boot partition (sda1) (line 2). Also it will configure the Grub2 boot menu automatically (line 3) based on the operating systems it finds on other partitions.

I do not know why grub-mkconfig has to be called that way. But if called normally it will throw the error grub-probe: error: cannot find a device for / (is /dev mounted?)..

Sources of information:
http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg798307.html
https://help.ubuntu.com/community/Grub2#Reinstalling from LiveCD

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Leave a Reply