[RELEASE] Reboot2oOS - Reboot once to another OS.
This addon will reboot your linux pc once into another OS of your choice then boot back into linux. It uses GRUB so a working multi-boot setup with GRUB is required. It has been tested with GRUB 1.99 + 2.00, but it will probably work with any distro that uses GRUB. Manual editing of system files and files contained within the addon zip is required to get this addon working (edit icon.png preferably before installation):

Edit the name= tag to your liking. I currently have it named Games because I reboot into windows to play games and emulators.

if dialog.yesno("Reboot to windows...", "XBMC needs to reboot for Games"):
This is the message that is contained in the Yes/No dialog

The addon icon can be changed based on your needs. It is currently a Atari 2600 joystick as I reboot into windows to play games.

The entries following the above options correspond to your GRUB menu entries - REBOOT_TO= is the OS you want to reboot once to, DEFAULT_OS= is your default OS.
You can get a listing of OS's recognised by GRUB with the following command:
sed -n '/menuentry/s/.*\(["'\''].*["'\'']\).*/\1/p' /boot/grub/grub.cfg

After installing the addon edit /etc/default/grub and change the line
then exit and now you need to edit the sudoers file so the commands that require root can run without a password:
sudo visudo
At the end of the file after #includedir /etc/sudoers.d add (note you need to edit the username, mine is xbmc):
%xbmc ALL = NOPASSWD: /sbin/reboot, /usr/sbin/grub-set-default, /usr/sbin/grub-reboot

Now time to make the reboot2oos.sh script executable and update GRUB:
chmod +x ~/.xbmc/addons/script.reboot2oos/reboot2oos.sh
sudo update-grub

Now select 'Games' under Programs to use the addon and reboot once to the OS of your choice.

I wish that Chromium OS has Reboot button now Wink
This is great.

Using hyperspin in windows for games and Ubuntu for xbmc.
So this is perfect and will test tonight.
Here is a new version of resboot2oos.sh that Ive been using, which should make os selection more robust - it uses disks uuid's + other info to select the os to reboot to, instead of the grub menu order, so it should still work after changes to the menu order. Replace the entire contents of the file with:

EDIT: script now in addon
Hi teeedubb,

Thanks for the tip on the OpenELEC forums on your Reboot2oOS addon.
If I understand it correctly, this will not change the default grub entry? (Because I want OE to stay as my default OS and switch to Win8 with this addon, thus after reboot come back into OE automatically.
Platforms: Windows 10 - OS X - iOS - OSMC (Vero 4K)
It sets the default boot device each time it runs and it can be set to any grub entry For oe you need this version

do you also have this new version available for Ubuntu XBMC?

I used 0.1.8 before, but now using 14.04LTS this is not working any more.

Thanks Nimanic
The current version should still work with 14.04, although I have been using the script above for a while now which is more robust. Try with that one and post the output of when you run the reboot2oos.sh script from the command line (comment out the 'sudo reboot' line to prevent reboots while testing).
Updated addon in first post to include new reboot2oos.sh script, plus cleaned up included docs.

form the consol the script is working and restarting the PC.

Out of XBMC the script fails (little window bottom right), but a video which is runing is stoped.

My system is a fresh installed XBMCUbuntu 13.2 based on 14.0LTS.

any idea what i might have missed?
Did you make the script executable?

chmod +x ~/.xbmc/addons/script.reboot2oos/reboot2oos.sh

If that doesn't work post your xbmc.log file of when the error occurs.
I downloaded your addon, and had a look at the reboot script.
I have a few comments based on my own experience, and about what I read from this blog
as well as from reading Grub2 documentation.

At first, if you simply change /etc/default/grub as you suggest
GRUB_DEFAULT=0 and modify it to GRUB_DEFAULT=saved
this doesn't mean that Grub will boot from the last saved entry.

Saving an OS can be achieved by running sudo grub-set-default if GRUB_DEFAULT=saved is set in /etc/default/grub. It may also be saved if GRUB_SAVEDEFAULT=true is also set in /etc/default/grub. In this case, the default OS remains until a new OS is manually selected from the GRUB 2 menu or the grub-set-default command is executed.

Otherwise, if you simply set GRUB_DEFAULT=saved and issue a command grub-reboot x
the entry x will be used once only, then the next time grub will reboot the default entry.

This makes the script much simpler, and you don't need to give grub-set-default the possibility to run as root.

What I did with my script was to search for the windows entry in /boot/grub/grub.cfg
by using the command
grep -i 'windows' /boot/grub/grub.cfg|cut -d"'" -f2
this gives you a string like
Windows 7 (loader) (on /dev/sda1)
then I wrote my script as
sudo grub-reboot "Windows 7 (loader) (on /dev/sda1)"
sudo reboot

It works for me, I'm willing to try my script within your addon.
I tried and it works perfect with the following:
1. Install your app

2. Apply the changes as you describe apart from vi visudo that is going to be
%xbmc ALL = NOPASSWD: /sbin/reboot, /usr/sbin/grub-reboot

3. Replace reboot2oos.sh that you provide with mine
sudo grub-reboot "Windows 7 (loader) (on /dev/sda1)"
sudo reboot
where the string is obtained by issuing the command
grep -i 'windows' /boot/grub/grub.cfg|cut -d"'" -f2

Thanks for the great job!
Cool glad you got it working. The DEFAULT_OS entry isnt necessary, though I think I left it in there as a precautionary measure - it doesnt hurt, plus its been a few years since I set this up, there might have been another reason too.
V0.3.0 in First post:

default.py is now helix compatible - back up your old script as it can be used with this version - They WILL be overwritten with this update.
Thread Rating:
  • 2 Vote(s) - 5 Average

Logout Mark Read Team Forum Stats Members Help
[RELEASE] Reboot2oOS - Reboot once to another OS.52