LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Fedora (https://www.linuxquestions.org/questions/fedora-35/)
-   -   Changing boot order (https://www.linuxquestions.org/questions/fedora-35/changing-boot-order-357760/)

CornMaster 08-28-2005 08:09 AM

Changing boot order
 
Is there a way I can change the boot order in both linux and windows XP.

Basically I like to remote to my machine, and I'd like to have the option to be in one OS, and then reboot into the other. (obviously I have a dual boot)

I could write a script to change the config file in Linux, but could I do this for windows too?

trickykid 08-28-2005 10:31 AM

Well you only have one boot loader. If your using the bootloader for Linux like grub or lilo, it would have to be changed there. Of course, if you have Linux as the default, you can pass arguments to have it boot into a different label upon next bootup but if you load up Windows, you can't change this but keeping Linux as the default, if you reboot Windows, it should boot back into Linux the next go round.

CornMaster 08-28-2005 10:57 AM

That would work. :)

I'm using grub....how would I pass this argument to make a one time change?

jspaar 08-29-2005 12:52 AM

In Fedora you can could also use my bootnext script to choose the next boot (one-time-only). bootnext
[Sorry for the geocities crap, it's the only free hosting I have.]
If you make linux your default boot in grub, you can always use bootnext when you want to switch to XP.

The only catch with bootnext is that it's graphical, so if you're connecting remotely from a host without X, bootnext won't be able to display. There is a similar command-line script out there, search OLD threads in this forum by me to find its name.

CornMaster 08-29-2005 06:04 AM

That would be really sweet if it worked from console. ;)

Humm...I searched, but couldn't find anything. Maybe I'm searching wrong. I'll take another look later.

I will give your prog a try, I do plan to use VNC a bit.

Thanks

CornMaster 08-29-2005 11:00 AM

I did some looking around and looked at the GRUB manual.
http://www.gnu.org/software/grub/man...-once_002donly

This seems to be exactly what I'm looking for.

I guess I could write a script that would change the entry in the grub config file and use it just before I reboot.
Or I could have two versions of the grub config...the original and the boot once one. Then copy in the boot once one whan I need to start up windows.

I'll do a little expermenting tonight, and let you know how it goes.

jspaar 08-29-2005 12:52 PM

Quote:

Originally posted by CornMaster
That would be really sweet if it worked from console. ;)

Humm...I searched, but couldn't find anything. Maybe I'm searching wrong. I'll take another look later.

Ok, here's the old thread: http://www.linuxquestions.org/questi...181#post755181
That thread has a few versions of my script, and the earliest one is non-graphical. The choice is hard-coded in the variable WINDOWS_TITLE., but you could tweak that to use a command line argument instead.

Also somebody mentions later a script called "rebootin", which I think you can still find via google. I haven't tried it.

Quote:


I will give your prog a try, I do plan to use VNC a bit.

Thanks

Cool, let me know if you have any probs with it. ssh -X would work too, if you're remoting in from another linux box.

Quote:


I did some looking around and looked at the GRUB manual.
http://www.gnu.org/software/grub/ma...g-once_002donly

This seems to be exactly what I'm looking for.

Yeah that's exactly how bootnext works. You can see the guts of it in that link above.

CornMaster 08-29-2005 07:24 PM

Hummm...I made the changes to the file like the manual said....however I could not run the grub-set-default command cause it's not there.

Instead I opened grub and used the savedefault command (that I noticed in your code).

The first time I tried it, it booted straight to XP, but the next reboot it make XP the default instead of Linux...which is not what I intended...and since then, I can't make it boot to XP at all (It always goes to the menu)

I'm going to keep fiddling with it.....the manual on the gnu website doesn't seem to match the latest grub...

jspaar 08-29-2005 08:40 PM

Sounds like you maybe left off the "--once" when you were playing with savedefault. That would cause the default to be changed permanently. "savedefault --once" is the key to the whole one-time-only boot thing.

You probably know the easy way to reset the permanent default: edit /boot/grub/grub.conf and change the default=# line to match the menu choice you want. Entries start from 0. Or just use system-config-boot, which is even easier.

Quote:

I'm going to keep fiddling with it.....the manual on the gnu website doesn't seem to match the latest grub...
Yeah I remember scanning through the grub docs and thinking "no wonder I have to write this myself". ;) Seemed like the --once hack is an optional patch that RedHat includes, but not all distros do. So it's not well documented.

Bootnext never messes with your permanent default. If it does, let me know...

CornMaster 08-30-2005 04:53 AM

I stopped trying to reinvent the wheel and used your first script. Works perfectly. :)

I do have another problem though...which I'll post elsewhere.....but I'll give the gist here.

When I su to root....I can't use any of the commands in sbin. I have to type the whole path. so /sbin/grub instead of just grub.
But if I login as root...it all works fine.

joshfields 09-14-2005 03:20 PM

when you su to root, you MUST say su -

THE DASH IS IMPORTANT!!!

dm215 10-01-2005 03:58 PM

Is there any reason why this code (bootnext, the early, non-graphical version) wouldn't work in SUSE? I have the same remote reboot issue on a dual-boot machine.

jspaar 10-02-2005 03:06 PM

Quote:

Originally posted by dm215
Is there any reason why this code (bootnext, the early, non-graphical version) wouldn't work in SUSE? I have the same remote reboot issue on a dual-boot machine.
I haven't tried it on SUSE, but if doesn't work, I'd guess that maybe SUSE doesn't include the patch for "--once" in their GRUB code. I know that Fedora's grub source packages has a separate patch for -once which gets applied to the upstream tarball.

If that is the only issue, then it should be feasible to download Fedora's grub source package and build it for SUSE, but that's something I haven't tried either and it would take some mucking about.

If you find out that SUSE does have the -once patch, then it should be pretty simple to get bootnext working on SUSE. But that's my first bet for any trouble.

dm215 10-04-2005 10:13 AM

one time reboot script for suse 9.x
 
In the interest of helping out when I can, here's a shell script for SUSE users that a friend found elsewhere:

#!/bin/sh
/usr/sbin/grub --device-map=/boot/grub/device.map --batch <<FOO
savedefault --default=1 --once
quit
FOO
/sbin/reboot

This has the same effect as boonext in SUSE - will reset the grub config file (which in suse is device.map) to windows for one reboot.

Note: script assumes that Windows is option 1 in grub (this is the default if you installed suse on a machine already running Windows).


All times are GMT -5. The time now is 11:12 AM.