LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Auto-reboot into selected OS (https://www.linuxquestions.org/questions/linux-general-1/auto-reboot-into-selected-os-723728/)

RussellChamp 05-04-2009 09:26 PM

Auto-reboot into selected OS
 
Hey guys! I'm running Ubuntu 9.04 on my laptop computer and I also have Window XP, and Windows Vista running alongside on different partition/hard drives.

I just got an idea here! I'd like it if I could selectively decide which OS to boot into when rebooting. The easiest solution (of course) is just to modify the "default OS" number in /etc/grub/boot.lst but I wanted to do a little something more elegant.
Since I've been learning Tk and Ruby in a class this semester, I was thinking that something along those lines (or Python and Tk) would be cool and a good use of what I learned.

Any comments / ideas on this? Has this already been done? Would there be any way to actually include this in the GNOME sessions menu?

Thanks for any feedback!
-Russell

rylan76 05-05-2009 02:30 AM

Hmm why do you want to do this?

If for some reason you don't want to use the normal GRUB menu to choose the operating system, in operating systems that have access to your root /boot partion, just change the parameter you refer to in the grub.conf file via code...?

Then, on reboot, the selected operating system should start up...

RussellChamp 05-06-2009 09:21 AM

Well, sometimes shut-downs and reboots can take some time so if I want to, say, reboot and go grab a sammich while it's working, I have to wait until Grub loads up and then select the non-default option that I wanted and then go grab my sammich.
Also, like I said before, I wanted to do this kinda' like a pet project or a proof of I-can-do-it type of thing. The best way to learn is to actually get your mitts dirty in code and actually program something (semi-)useful!

rylan76 05-07-2009 01:58 AM

Quote:

Originally Posted by RussellChamp (Post 3532113)
Well, sometimes shut-downs and reboots can take some time so if I want to, say, reboot and go grab a sammich while it's working, I have to wait until Grub loads up and then select the non-default option that I wanted and then go grab my sammich.
Also, like I said before, I wanted to do this kinda' like a pet project or a proof of I-can-do-it type of thing. The best way to learn is to actually get your mitts dirty in code and actually program something (semi-)useful!

Very true! Well, what I said previously might work partially, but not necessarily always. I. e. you'll need to be able to access the /boot parition which your grub installation reads when it starts up - and in the /boot partition, you'll need to programmatically alter grub.conf to each time select the correct default operating system. I. e. if you reboot and go grab a sandwich, the default will already be correctly set up and if no key is pressed in the grub menu, the operating system you want will be booted...

saikee 05-07-2009 07:05 AM

Think this can be done by installing a program called kexec

linus72 05-07-2009 07:10 AM

Yep, kexec, useful to read alot about it...

NetbootCD-3.0, based off Tinycore-1.3, has a isolinux/syslinux entry for kexec support...

LABEL tinycore-kexec
menu label ^TinyCoreKexec Support
kernel /boot/isolinux/kexec.bzI
append initrd=/boot/isolinux/tinycore.gz quiet

Try it out, it might work...

RussellChamp 05-10-2009 03:35 PM

Sweet! I'll check that out as soon as I can! No real reason for re-inventing the wheel, eh?

EDIT: Hmm... after reading the article, I'm not sure that I'd be able to use this if I want to boot from Linux into Windows.... or am I reading this wrong?

saikee 05-11-2009 02:10 AM

There is another way too. One can put Grub in a partition that can be edited while using a M$ Windows and so a different operating system is fired up in the next reboot.

I have just finished this technique to boot 126 Xp. Everything can be done by a script or a simple program.


All times are GMT -5. The time now is 09:17 PM.