Adik
Posts: 3
Joined: Mon Mar 03, 2014 3:54 pm

Remote Reboot to another OS with NOOBS

Mon Mar 03, 2014 4:04 pm

Hello Guys,

I am a very first user of the Raspberry Pi. However I've a little experience with linux.

Today I copied the NOOB Software to my Raspberry and installed Raspbian and Raspbmc.

I have connected my raspi to my network so I can work from remote (ssh with Android / Windows). Everything works pretty good.

I wonder, if it is possible to reboot the Raspi to an operating system of my choice without using an usb keyboard/mouse.
Is there a possible shell comand? I don't want to plug in a keyboard/mouse to change the OS.

Thanks in advance

User avatar
ukscone
Forum Moderator
Forum Moderator
Posts: 4214
Joined: Fri Jul 29, 2011 2:51 pm
Contact: Website

Re: Remote Reboot to another OS with NOOBS

Mon Mar 03, 2014 4:14 pm

according to the NOOBS docs you can boot into a specific partition by adding a file to the FAT partition which you can do from a running raspi you'd just need to know which OS is on which partition.

Code: Select all

How to bypass the Recovery splashscreen and boot directly into a fixed partition

After you have installed your chosen OSes, add the following file to the root directory of NOOBS to force the indicated partition to be booted at power-on.

Add a text file named autoboot.txt to the root directory of NOOBS.

Add boot_partition=<partition number> to the file and save it to disk.

This will also prevent the splashscreen from being displayed at boot.

Adik
Posts: 3
Joined: Mon Mar 03, 2014 3:54 pm

Re: Remote Reboot to another OS with NOOBS

Mon Mar 03, 2014 10:32 pm

thank you for your reply!
so the only way to boot in another system is by creating a file?! Ok I don't need to plugin a keyboard for that, but still it's an inconvenient way to do so.

Adik
Posts: 3
Joined: Mon Mar 03, 2014 3:54 pm

Re: Remote Reboot to another OS with NOOBS

Wed Mar 05, 2014 1:58 pm

finally, I got it.
Here is my solution description:
First of all I needed to mount the FAT partition of NOOBS which can be found with

Code: Select all

sudo fdisk -l
/dev/mmcblk0p1 8192 240234 116021+ e W95 FAT16 (LBA)
.....
after mounting the partition,

Code: Select all

mkdir /mnt/NOOBS
mount -t auto /dev/mmcblk0p1 /mnt/NOOBS/ 

autoboot.txt can be created.

I found out, that RASPBMC has no. 5 and Raspbian no. 7.
To avoid the mounting process I changed fstab on each partition (raspbmc and rasbian)

Code: Select all

nano /etc/fstab  

Code: Select all

mount -t auto /dev/mmcblk0p1 /mnt/NOOBS 

Now I can use my android device with "Raspi SSH" to switch between the operating system with folloging commands which can be saved to buttons:
// switch to raspbian

Code: Select all

sed -i 's/5/7/g' /mnt/NOOBS/autoboot.txt 
// switch to raspBMC

Code: Select all

sed -i 's/7/5/g' /mnt/NOOBS/autoboot.txt 
after executing one of these commands you can reboot your system

Code: Select all

sudo shutdown -r now 	

zerg
Posts: 3
Joined: Sat Jun 14, 2014 8:34 pm

Re: Remote Reboot to another OS with NOOBS

Sat Jun 14, 2014 9:16 pm

Hi,
I have installed Raspbian and Raspbmc on the same SD card using NOOBS.
Following the instructions I have mounted /dev/mmcblk0p1 to /mnt/NOOBS/ and created autoboot.txt in the root folder of the first partition of the D Card. Inside I added one row

Code: Select all

[email protected] /mnt/NOOBS $ cat /mnt/NOOBS/autoboot.txt
boot_partition=5
my partitions are the following :

Code: Select all

 Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            8192     2916015     1453912    e  W95 FAT16 (LBA)
/dev/mmcblk0p2         2916352    15889407     6486528   85  Linux extended
/dev/mmcblk0p3        15889408    15954943       32768   83  Linux
/dev/mmcblk0p5         2924544     3088383       81920    c  W95 FAT32 (LBA)
/dev/mmcblk0p6         3096576     8245247     2574336   83  Linux
/dev/mmcblk0p7         8249344     8372223       61440    c  W95 FAT32 (LBA)
/dev/mmcblk0p8         8380416    15884287     3751936   83  Linux
I tried boot_partition with almost all the numbers and it still is showing me the screen in the beginning to choose OS with default the one I booted last. It seems in totally ignores the existence of the autoboot.txt file.
1.Can you please advise where is the problem ? Have I misstyped or misunderstood something ?
2. CA you tell me why there are so many partitions on the SD Card after the installation. last 4 seem to be the Raspbian and Raspbmc. I'm not sure what the second and third partition are doing and how the numbers are going. for example which number should be /dev/mmcblk0p7 - number 7 or number 6 (since it is 6th row) or 5 (if the row count start form 0) ?

For reference this is my fstab for the Raspbian OS

Code: Select all

[email protected] /mnt/NOOBS $ cat /etc/fstab
proc            /proc           proc    defaults          0       0
/dev/mmcblk0p7  /boot           vfat    defaults          0       2
/dev/mmcblk0p8  /               ext4    defaults,noatime  0       1
/dev/mmcblk0p1 /mnt/NOOBS/      vfat    defaults          0       0
Many thanks for the help !

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: Remote Reboot to another OS with NOOBS

Mon Jun 23, 2014 7:03 pm

zerg wrote:I tried boot_partition with almost all the numbers and it still is showing me the screen in the beginning to choose OS with default the one I booted last. It seems in totally ignores the existence of the autoboot.txt file.
1.Can you please advise where is the problem ?
https://github.com/raspberrypi/noobs/issues/195
zerg wrote:2. Can you tell me why there are so many partitions on the SD Card after the installation. last 4 seem to be the Raspbian and Raspbmc. I'm not sure what the second and third partition are doing and how the numbers are going.
On your NOOBS SD card there are three primary partitions:
  • /dev/mmcblk0p1 is the NOOBS boot (a.k.a. recovery) partition - at power-on, the Raspberry Pi always boots from /dev/mmcblk0p1
  • /dev/mmcblk0p2 is the extended partition (we'll come back to this later)
  • /dev/mmcblk0p3 is the NOOBS setting partition - this contains files telling NOOBS which OSes are installed, what partitions they're installed on, which OS should be loaded by default, which langauge/keyboard NOOBS should use, etc.
For historical reasons, SD cards (and hard-drives) can only have a maximum of 4 primary partitions, but one of those partitions can optionally be an extended partition, and that extended partition can contain an unlimited amount of logical partitions. On Linux, partitions 1-4 are always the primary partitions, and logical partitions are always numbered 5 and above.

So on your NOOBS SD card with Raspbian and RaspBMC installed, your extended partition /dev/mmcblk0p2 contains 4 logical partitions:
  • /dev/mmcblk0p5 is the RaspBMC boot partition, containing amongst other files the kernel used by RaspBMC
  • /dev/mmcblk0p6 is the RaspBMC root partition, containing the main RaspBMC program files
  • /dev/mmcblk0p7 is the Raspbian boot partition
  • /dev/mmcblk0p8 is the Raspbian root partition
All quite logical, once you manage to wrap your head around it :lol:

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: Remote Reboot to another OS with NOOBS

Mon Jun 23, 2014 7:27 pm

Adik wrote:so the only way to boot in another system is by creating a file?! Ok I don't need to plugin a keyboard for that, but still it's an inconvenient way to do so.
Alternatively you can just prod a sysfs parameter, the same as NOOBS' boot-selection menu itself does https://github.com/raspberrypi/noobs/bl ... g.cpp#L142

i.e.

Code: Select all

sudo su -c 'echo 7 > /sys/module/bcm2708/parameters/reboot_part'
sudo reboot
will force your Pi to reboot and load from partition 7 (/dev/mmcblk0p7) directly, bypassing the NOOBS interface, and without having to write any files to disk (or mounting /dev/mmcblk0p1). After the reboot, reboot_part will be set back to 0 i.e. disabled, which means the next reboot will load from /dev/mmcblk0p1, same as always. :ugeek:

zerg
Posts: 3
Joined: Sat Jun 14, 2014 8:34 pm

Re: Remote Reboot to another OS with NOOBS

Thu Jun 26, 2014 7:37 am

Many Thank AndrewS,
"/sys/module/bcm2708/parameters/reboot_part" works very well and is solving the issue. This is very efficient way to reboot into the OS image you want.
Also I see that there is new version of NOOBS, so will try if they have fixed the autoboot.txt.

zerg
Posts: 3
Joined: Sat Jun 14, 2014 8:34 pm

Re: Remote Reboot to another OS with NOOBS

Wed Jul 09, 2014 9:19 am

Hi,
I found another way to change the boot image. The third partition (/dev/mmcblk0p3), is for the settings of NOOBS. There is a configuration file noobs.conf. It seems it defines which is the default OS to boot :

Code: Select all

[General]
default_partition_to_boot=5
display_mode=0
keyboard_layout=us
language=us
So if you change the default_partition_to_boot, I assume this will work. I did not try it though.
I'm wandering where the waiting time is stored and how can change the 10 seonds when booting and you have choice to manually hange the OS.

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: Remote Reboot to another OS with NOOBS

Wed Jul 09, 2014 12:00 pm

zerg wrote:So if you change the default_partition_to_boot, I assume this will work. I did not try it though.
Yeah, should do (it's the setting that NOOBS uses to 'remember' which OS was booted last).
That's obviously a more 'permanent' change than using the "/sys/module/bcm2708/parameters/reboot_part" though.
I'm wandering where the waiting time is stored and how can change the 10 seonds when booting and you have choice to manually hange the OS.
https://github.com/raspberrypi/noobs/issues/168

gohilurvish
Posts: 4
Joined: Sat Apr 30, 2016 3:23 pm

Re: Remote Reboot to another OS with NOOBS

Sun May 01, 2016 8:06 pm

AndrewS wrote:
Adik wrote:so the only way to boot in another system is by creating a file?! Ok I don't need to plugin a keyboard for that, but still it's an inconvenient way to do so.
Alternatively you can just prod a sysfs parameter, the same as NOOBS' boot-selection menu itself does https://github.com/raspberrypi/noobs/bl ... g.cpp#L142

i.e.

Code: Select all

sudo su -c 'echo 7 > /sys/module/bcm2708/parameters/reboot_part'
sudo reboot
will force your Pi to reboot and load from partition 7 (/dev/mmcblk0p7) directly, bypassing the NOOBS interface, and without having to write any files to disk (or mounting /dev/mmcblk0p1). After the reboot, reboot_part will be set back to 0 i.e. disabled, which means the next reboot will load from /dev/mmcblk0p1, same as always. :ugeek:

Thank You for this AndrewS.
I was exactly looking for this...
Always boot to Raspbian unless i ask system to boot to other OS from Raspbian. And even after restart from that OS, i wanted to come back to Raspbian.

EZ_Bluff
Posts: 7
Joined: Wed Mar 22, 2017 12:25 pm

Re: Remote Reboot to another OS with NOOBS

Fri Mar 24, 2017 2:02 pm

gohilurvish wrote:
AndrewS wrote:
Adik wrote:so the only way to boot in another system is by creating a file?! Ok I don't need to plugin a keyboard for that, but still it's an inconvenient way to do so.
Alternatively you can just prod a sysfs parameter, the same as NOOBS' boot-selection menu itself does https://github.com/raspberrypi/noobs/bl ... g.cpp#L142

i.e.

Code: Select all

sudo su -c 'echo 7 > /sys/module/bcm2708/parameters/reboot_part'
sudo reboot
will force your Pi to reboot and load from partition 7 (/dev/mmcblk0p7) directly, bypassing the NOOBS interface, and without having to write any files to disk (or mounting /dev/mmcblk0p1). After the reboot, reboot_part will be set back to 0 i.e. disabled, which means the next reboot will load from /dev/mmcblk0p1, same as always. :ugeek:
I have Raspbian and LibreElec installed on my sd card. I tried running the code on ssh in LibreElec. First it says I don't need sudo since I am already logged in as root, then after I tried without sudo it says no such directory. What am I doing wrong?

EZ_Bluff
Posts: 7
Joined: Wed Mar 22, 2017 12:25 pm

Re: Remote Reboot to another OS with NOOBS

Mon Mar 27, 2017 9:20 am

Ok. So I found using sudo fdisk -l in Raspbian that partitions 6 and 8 are boot partitions of Raspbian and Libreelec. Using the following code:

sudo su -c 'echo 8 > /sys/module/bcm2709/parameters/reboot_part'
sudo reboot

I can reboot from Raspbian directly to Libreelec.

However, I can't do the same from Libreelec (logging in as root - default login)
i.e.
sudo su -c 'echo 6 > /sys/module/bcm2709/parameters/reboot_part'
sudo reboot

Help, please.

Roozbehsf
Posts: 1
Joined: Mon Jun 12, 2017 2:55 pm

Re: Remote Reboot to another OS with NOOBS

Mon Jun 12, 2017 3:04 pm

Hi all,

I have the same issue.
I can reboot from Raspbian to another partition (let's say LibreELEC) by prod a sysfs parameter and it is really convenient. But I can't perform the same in LibreELEC (or OSMC).
In other words I couldn't find the right system parameter for reboot partition in LibreELEC (neither in OSMC).
Can anyone help?

Thanks!

Lokus
Posts: 2
Joined: Sun Jul 02, 2017 11:16 am

Re: Remote Reboot to another OS with NOOBS

Sun Jul 02, 2017 11:25 am

Hi,

i just registered here, because i have the same problem as it is described in the last two posts.
I managed to switch from recalbox into rasplex with the ssh command mentioned some posts above
sudo su -c 'echo 7 > /sys/module/bcm2708/parameters/reboot_part'
sudo reboot
but the other way, from rasplex to recalbox doesn't work, i don't know the right command or another solution. rasplex is also based on LibreElec, which is the problem the other two guys have too.

I hope someone can help.
Thanks in advance!

Lokus
Posts: 2
Joined: Sun Jul 02, 2017 11:16 am

Re: Remote Reboot to another OS with NOOBS

Sun Jul 02, 2017 10:09 pm

Yes!! I found a solution for me! Or better said, Matt Huisman (the Creator of PINN) just told me, that i should try:

reboot [partition_number]
eg.
reboot 6

and this worked for me! It's so funny that it is such a simple command...

User avatar
mattrix
Posts: 134
Joined: Mon Mar 02, 2015 6:20 am
Location: Christchurch, New Zealand
Contact: Website

Re: Remote Reboot to another OS with NOOBS

Mon Jul 03, 2017 12:33 am

Matt Huisman (the Creator of PINN)
I'm not the creator of PIN (that is procount).
I just contribute some OS's and make some dual-boot how-to's etc :)
www.matthuisman.nz

randytsuch
Posts: 2
Joined: Thu Mar 01, 2018 3:46 pm

Re: Remote Reboot to another OS with NOOBS

Thu Mar 01, 2018 4:05 pm

FWIW, I've been working on remote rebooting of my PINN based pi.

The Reboot command didn't work for me :( Would have been nice if it was that easy lol.

What did work was to use the 500mb data partition the NOOBS and PINN have as an option.

Then I made a few files in this partition, I have three OS's loaded, so I made three files.
Each file is basically a different version of autoboot.txt. Each file sets a different boot partition, so one file might contain

Code: Select all

boot_partition=7
I then mounted /dev/mmcblk0p1 (PINN boot partition), and copied one of these autoboot files to autoboot.txt.
Reboot, and the OS selected by autoboot.txt booted up.

Hope this makes sense, working on a wiki page with the specific instructions, once I finish getting all this working how I want, will post a link to that page. But I was able to boot to different partitions using this method last night, works fine.

I even did it from picoreplayer, which runs picore running out of RAM. I can not (easily) make changes to picoreplayer, so I have to mount the drives each time. So I mounted the PINN boot partition and the data partition, copied the new autoboot.txt, and rebooted to a different OS.

I'm going to make it easier to change, planning to use an Android program, SSH Button, which will send a command to my pi. So, after mounting the partitions for boot and data (I still need to edit fstab to mount these partitions at boot), I will send something like this

Code: Select all

sudo cp /mnt/ShareData/autoboot_PCP.txt /mnt/pinnBoot/autoboot.txt && sudo reboot
There are similar IOS apps, although SSH Button is a little nicer than the IOS apps I've found.

As an aside, I'm using this utility
https://www.matthuisman.nz/2017/05/noob ... s.html?m=1
to resize my partitions to make use of the entire 32g sd card. Once I do this how I want, I'll finish implementing this rebooting scheme.

Randy

User avatar
KLL
Posts: 1453
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand
Contact: Website

Re: Remote Reboot to another OS with NOOBS

Fri Mar 02, 2018 5:53 am

randytsuch wrote:
Thu Mar 01, 2018 4:05 pm
remote rebooting of my PINN based pi.
a easy way is the VNC selection of PINN,
for this you add in recovery.cmdline
vncshare forcetrigger
so you end up at every boot at the INSTALL menu of PINN ( and waiting for you to connect VNC )
with EXIT and OS select you have that remote boot select from a remote PC ( is that what you look for? )

User avatar
procount
Posts: 2155
Joined: Thu Jun 27, 2013 12:32 pm
Location: UK

Re: Remote Reboot to another OS with NOOBS

Fri Mar 02, 2018 9:04 am

This thread may also be relevant --> viewtopic.php?f=29&t=206371#p1280120
PINN - NOOBS with the extras... https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=142574

User avatar
mattrix
Posts: 134
Joined: Mon Mar 02, 2015 6:20 am
Location: Christchurch, New Zealand
Contact: Website

Re: Remote Reboot to another OS with NOOBS

Tue May 29, 2018 3:12 am

For OS's that don't work with reboot [part] or /sys/module/bcm2708/parameters/reboot_part,
I load in a simple executable which does the reboot [part] logic.

Here is the source code:
https://pastebin.com/VULwtmyx

A compiled version (and source) can be found in my NOOBS Companion add-on.
https://github.com/matthuisman/kodi-rep ... -0.2.9.zip

Unzip that and it's in plugin.program.noobs.companion/resources/files
It's called "part_reboot".

If you copy that into your OS, make it executable , you should be able to call it the same as you would call reboot [part]
eg. ./part_reboot 9
www.matthuisman.nz

zimou132
Posts: 1
Joined: Wed Sep 12, 2018 7:30 pm

Re: Remote Reboot to another OS with NOOBS

Wed Sep 12, 2018 7:33 pm

It should be ok just leave it plugged into the charger and let it build a charge... if it is at the stage where boot-loops happen, it should still be ok , once he charges enough to turn on and start bootlooping... Just remove the batt. count to 15 and replace battery and put back on charger, this should result in the powered off charging screen where it shows the battery charging up let it build a good charge then continue once it finally boots past the bootloops

Return to “Beginners”