I'm looking for a way to easily have multiple OSes on my machine that
can be easily updated without having to constantly modify the menu.lst
by hand. For example, I currently have three Linux installations
(various versions of Debian or Ubuntu) on a single machine, one on
each of /dev/hda1, /dev/hda2, /dev/hda3. Currently, grub's menu.lst
file is on /dev/hda3. That means whenever /dev/hda1 or /dev/hda2
updates their kernel, I have to manually copy the new kernel stanzas
to /dev/hda3's menu.lst file.
What I'd rather do is create a "master" menu.lst file on /dev/hda4,
which chain loads a grub loader on /dev/hda1, /dev/hda2, or /dev/hda3
and uses the respective menu.lst file on those partitions.
Can that be done? Has anyone here done that? Anyone got pointers on
how to do this? A google of "grub chainloading grub" returned lots of
hits of how to do this with Windows.
Regards,
- Robert
The short answer, yes.
> Has anyone here done that?
Couldn't find anyone on the Net who has. But my Google-Fu is pretty weak.
> Anyone got pointers how to do this?
Couldn't find any. Here's what I did (IIRC):
1) installed Ubuntu (/dev/hda2 == /)
2) created /dev/hda1 for holding "master" menu.lst, vfat formated,
mounted at /grub.vfat
3) mount /dev/hda1 /grub.vfat
4) grub-install --root-directory=/grub.vfat/ /dev/hda
5) edit /grub.vfat/boot/grub/menu.lst. For example,
default 0
timeout 3
title Ubuntu 7.10
root (hd0,1)
chainloader +1
6) grub-install --root-directory=/ /dev/hda2
So far it seems to work. Having the filesystem formated as vfat
allows me to edit the boot files from within Windows, one of the other
OSes installed.
Regards,
- Robert
The above was on a desktop. As a working case, I just did this with
my laptop: a Windows/Ubuntu dual boot on a Lenovo T61. Here are some
salient pieces of info:
$ sudo fdisk -l /dev/sda
Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xcd6bcd6b
Device Boot Start End Blocks Id System
/dev/sda1 * 1 1567 12582912+ 7 HPFS/NTFS
/dev/sda2 1567 3249 13514648+ 7 HPFS/NTFS
/dev/sda3 3250 3262 104422+ b W95 FAT32
/dev/sda4 3263 9729 51946177+ 5 Extended
/dev/sda5 * 3263 9729 51946146 83 Linux
$ df -hTl -x tmpfs
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda5 ext3 49G 7.7G 40G 17% /
/dev/sda3 vfat 101M 168K 101M 1% /mnt/grub
$ tree /mnt/grub/boot/
/mnt/grub/boot/
`-- grub
|-- default
|-- device.map
|-- e2fs_stage1_5
|-- fat_stage1_5
|-- installed-version
|-- jfs_stage1_5
|-- menu.lst
|-- minix_stage1_5
|-- reiserfs_stage1_5
|-- stage1
|-- stage2
`-- xfs_stage1_5
$ cat /mnt/grub/boot/grub/menu.lst
default saved
timeout 3
title Ubuntu Gutsy 7.10
root (hd0,4)
savedefault 1
chainloader +1
title Microsoft Windows XP Professional
root (hd0,0)
savedefault 1
makeactive
chainloader +1
$ sudo grub-install --root-directory=/mnt/grub/ /dev/sda
$ grep -i -e ^title /boot/grub/menu.lst
title Ubuntu 7.10, kernel 2.6.22-14-generic
title Ubuntu 7.10, kernel 2.6.22-14-generic (recovery mode)
title Ubuntu 7.10, memtest86+
$ sudo grub-install --root-directory=/ /dev/sda5
Regards,
- Robert