User:Oldcpu/pbs
applicable to openSUSE-10.x and 11.x with pre-grub2 version
Symptom
You wish to reboot directly to a specific boot partition, over-riding (for this one boot) the default grub boot settings (Similar to what can be done from Kmenu restart).
Cause
You do not have access to the GUI, and need to reboot directly to a specific boot partition, over-riding (for this one boot) the default grub boot settings.
Solution
Open a konsole and then type "su" to get root permissions. Then type "grubonce" to get boot options, followed by "grubonce" again with the specific option number, followed again by the "shutdown -r" command, which then it will reboot to the exact OS that you specified. .... ie something like:
Example1
oldcpu@stonehenge01:~> su Password: stonehenge01:/home/oldcpu # grubonce 0: SUSE Linux 10.1 1: Windows 2: Floppy 3: Failsafe -- SUSE Linux 10.1 stonehenge01:/home/oldcpu # grubonce 1 stonehenge01:/home/oldcpu # shutdown -r now
After which the PC stonehenge01 immediately boots to Windows, with no grubmenu option. After rebooting from MS-Windows, the grub menu is back.
Example2
This example provides a sample script pbs ( P.B.S. - Partition Boot Selector) that one can optionally create :
#!/bin/bash # P.B.S. - Partition Boot Selector - Version 1.1 # by J. McDaniel for use with Grub Legacy # Reboot from CLI to selective partitions # Written for openSUSE Forums on 8-22-2010 if [ "$HOME" != "/root" ] ; then echo "Root User Permissions are required, Please Enter the ..." echo sudo $0 else tput clear tput setf 7 tput setb 2 tput bold echo "P.B.S. - Partition Boot Selector Version 1.1 - for Grub Legacy" echo tput setf 7 tput setb 1 echo "Reboot from CLI to selective partitions - Your Choices Are...." echo tput sgr0 grubonce echo tput setaf 2 tput bold read -p "Please type a single digit option # & press <enter>..(q=Quit): " CHOICE if [ "$CHOICE" != "q" ] ; then grubonce $CHOICE shutdown -r now else tput clear tput sgr0 fi fi exit 0 # End of Script File
Copy and past the above code into a text program like kwrite or gedit or beaver. Then save the program into your bin folder (ie /home/username/bin or ~/bin) as the file pbs. Then you need to make this script file executable with the following command:
chmod +x ~/bin/pbs
Once you have created, saved and made executable pbs, you can run the script file. Open a normal user mode terminal session and type the command pbs. You are given one chance to quit by entering a small letter "q". Make sure you have saved all of your work and exited any applications before switching to another OS and good luck.
Possible Grub2 Approach
Grub2 may have a similar capability, possibly using the "grub2-reboot" command as follows:
To determine the boot selection, enter in a terminal:
grep menuentry /boot/grub/grub.cfg
which will provide the parition list. Then run
grub2-reboot <some-number>
to reboot once to the appropriate partition.
Links
.