tags:

views:

97

answers:

2

I have two Linux distributions (OpenSuSE, Ubuntu) installed on two different partitions. Each time i start my machine, GRUB loads up allowing me to select one of the two distributions.

I don't want the GRUB to show up so I limit timeout to zero in /boot/grub/menu.lst which will most probably make my machine load OpenSuSE each time i start my PC because it's the first option in the menu.lst.

Is it possible that the second time i restart my PC, Ubuntu gets loaded automatically? The third time i restart again, OpenSuSE may get booted while fourth time i restart, Ubuntu may load up and so on?

In other words how can i make my machine to boot the next OS in menu.lst, the next time it is restarted?

It's a weird problem. :) but i need to test something actually. Suggestions needed from you guys.

Thanks a lot.

+3  A: 

Put something in the startup scripts to rewrite menu.lst.

So have Ubuntu write a version of menu.lst that loads OpenSuSE, and have OpenSuSE write a version that loads Ubuntu.

I a relatively safe way to do this would be to have 3 files, menu.lst, menu.lst.ubuntu and menu.lst.SuSE and have the scripts do:

cp menu.lst.ubuntu menu.lst

on SuSE and:

cp menu.lst.SuSE menu.lst

on Ubuntu.

rjmunro
Great minds.......
jhs
This should work for me. Thanks rjmunro.
baltusaj
+1  A: 

Lilo can do this.

But you might consider a simple script in each OS that sets the other OS as the grub default. For example, the following script would modify a default 1 setting to default 0:

echo -e "g/default 1/d\ni\ndefault 0\n.\nw" | ed /boot/grub/menu.lst

(ed is much like Vi. Run just the first command to see what it's doing.)

On the other OS, you could run the counterpart:

echo -e "g/default 0/d\ni\ndefault 1\n.\nw" | ed /boot/grub/menu.lst
jhs
Thanks jhs. I think it will work out for me. But i will get to LILO if i fail to achieve the functionality with GRUB.
baltusaj