algi
Posts: 8
Joined: Sat Apr 11, 2015 9:54 pm

Rebooting into a new OS.

Tue Apr 21, 2015 10:23 pm

Hello!

I'm running 3 different OSes on a NOOBS installation.

I want to bypass the timeconsuming process of rebooting and selecting OS in the graphical interface by rebooting streight in to the desired OS parition through the command line alone?

I've tried to google as much on the topic as I can but it's just getting me more confused. Anybody here that can shed some light on this matter?

Greatly appreciated!

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5616
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Rebooting into a new OS.

Tue Apr 21, 2015 10:26 pm

for example, echo 5 >/sys/module/bcm2708/parameters/reboot_part; reboot;

User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Re: Rebooting into a new OS.

Tue Apr 21, 2015 10:30 pm

... welcome to boot-loaders.

To boot into an OS (on any computer) you need a boot-loader. NOOBS is your boot-loader. I have not seen it yet, but somebody out there sooner or later will get grub2 running on the Raspberry PI and then you will be able to boot into the OS by selecting it in grub. The bottom line is that you *need* a boot-loader. You don't load an OS from the command line. Well, unless you mean the grub command line; or equiv.
marcus
:ugeek:

algi
Posts: 8
Joined: Sat Apr 11, 2015 9:54 pm

Re: Rebooting into a new OS.

Tue Apr 21, 2015 10:44 pm

ShiftPlusOne wrote:for example, echo 5 >/sys/module/bcm2708/parameters/reboot_part; reboot;
Sudo command didn't work on that for some reason and it tells me to use su and when I do that it says:

[email protected]:~# echo 5 >/sys/module/bcm2708/parameters/reboot_part; reboot;
-bash: /sys/module/bcm2708/parameters/reboot_part: No such file or directory

Broadcast message from [email protected] (pts/0) (Tue Apr 21 22:40:10 2015):
The system is going down for reboot NOW!

Is the 5 an indication of what partition to boot from ? I'm guessing my setup doesn't look exactly the same as yours and that's why it's not working ?

algi
Posts: 8
Joined: Sat Apr 11, 2015 9:54 pm

Re: Rebooting into a new OS.

Tue Apr 21, 2015 10:47 pm

MarkHaysHarris777 wrote:... welcome to boot-loaders.

To boot into an OS (on any computer) you need a boot-loader. NOOBS is your boot-loader. I have not seen it yet, but somebody out there sooner or later will get grub2 running on the Raspberry PI and then you will be able to boot into the OS by selecting it in grub. The bottom line is that you *need* a boot-loader. You don't load an OS from the command line. Well, unless you mean the grub command line; or equiv.
Hum, this goes against what I've read in other threads.. But it would make sense because all methods I try to copy fail. Is it because I have used NOOBS as my installationmethod and therefore everything needs to be run via the Noobs bootloader?

I really hate not being able to predecide what OS to run on reboot...

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5616
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Rebooting into a new OS.

Tue Apr 21, 2015 10:51 pm

MarkHaysHarris777 wrote:... welcome to boot-loaders.

To boot into an OS (on any computer) you need a boot-loader. NOOBS is your boot-loader. I have not seen it yet, but somebody out there sooner or later will get grub2 running on the Raspberry PI and then you will be able to boot into the OS by selecting it in grub. The bottom line is that you *need* a boot-loader. You don't load an OS from the command line. Well, unless you mean the grub command line; or equiv.
NOOBS isn't really a bootloader, it's a small linux distro which sets the reboot_part parameter and reboots. The actual bootloader is the firmware, which the pi doesn't run without anyway.
algi wrote:Sudo command didn't work on that for some reason and it tells me to use su and when I do that
Of course. 'sudo' would run echo as root and redirect as the current user. You'd need to do something like echo 5 | sudo tee /sys/module/bcm2708/parameters/reboot_part;
algi wrote:/sys/module/bcm2708/parameters/reboot_part: No such file or directory
Maybe you're running on a pi2 and it's bcm2709? You didn't specify.
algi wrote:Is the 5 an indication of what partition to boot from ?
Yes

algi
Posts: 8
Joined: Sat Apr 11, 2015 9:54 pm

Re: Rebooting into a new OS.

Tue Apr 21, 2015 11:24 pm

Shift!! Thanks so much! This actually worked! Aces! =)

User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Re: Rebooting into a new OS.

Tue Apr 21, 2015 11:37 pm

ShiftPlusOne wrote:
MarkHaysHarris777 wrote:... welcome to boot-loaders.

To boot into an OS (on any computer) you need a boot-loader. NOOBS is your boot-loader. . . .
NOOBS isn't really a bootloader, it's a small linux distro which sets the reboot_part parameter and reboots. The actual bootloader is the firmware, which the pi doesn't run without anyway.
Actually, the bootloader is, well, raspberrypi-bootloader but for most folks the way into that is NOOBS. That IS part of the entire idea behind NOOBS... you allow people to select a boot partition without having them mucking around in the internals which they do not understand anyway!

I think it is a poor idea to give an OP an internals command, when they are not clear in the first place, which can get them into trouble. If it works you're a hero... if it doesn't, well they are toast and who's to blame?
marcus
:ugeek:

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5616
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Rebooting into a new OS.

Wed Apr 22, 2015 12:05 am

Glad it worked.

Marcus, all I can say is that I disagree with all of that. I'd like to see more people hack things to suit their needs, understand things on a deeper level. If it doesn't work, great, it's a learning experience. In this case, the worst case outcome was that nothing would happen. If there's potential for data loss, damaged hardware or electrocution... that's another matter.

User avatar
kusti8
Posts: 3441
Joined: Sat Dec 21, 2013 5:29 pm
Location: USA

Re: Rebooting into a new OS.

Wed Apr 22, 2015 1:09 am

ShiftPlusOne wrote:Glad it worked.

Marcus, all I can say is that I disagree with all of that. I'd like to see more people hack things to suit their needs, understand things on a deeper level. If it doesn't work, great, it's a learning experience. In this case, the worst case outcome was that nothing would happen. If there's potential for data loss, damaged hardware or electrocution... that's another matter.
+1

That's what the pi is made for, education. You can learn a lot from the pi if you don't shut yourself out from the info.

I had a science teacher once who gave wrong info (that sea floor spreading causes plate tectonics) and that doesn't help anybody. You either need to understand it fully, or not understand it at all. Simplifying can be used, but to an extent. After that, it's lying.
There are 10 types of people: those who understand binary and those who don't.

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

Re: Rebooting into a new OS.

Wed Apr 22, 2015 12:30 pm

Alternatively, you can create a text file in the recovery partition (/dev/mmcblk0p1) called 'Autoboot.txt' with the line 'boot_partition=5' (change 5 to whatever partition you want to boot).
This will boot straight into the selected partition on power up without going through Noobs at all.
This is useful if you have a Motorola Lapdock, for example, that (annoyingly) turns off the display when Noobs does the second boot into the selected partition due to loss of the USB connection.
PINN - NOOBS with the extras... https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=142574

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

Re: Rebooting into a new OS.

Sat May 21, 2016 6:28 pm

Sorry for opening it after long...
Actually I am doing something like this...
I have Raspbian(part 6) and OpenELEC(part 8) installed via NOOBS...

I want system to always boot to Raspbian Quickly and it is done via adding boot_partition=6 to autoboot.txt.
I want to go to OpenElec only from Raspbian. And even a reboot from there should take me to Raspbian.

Now, I earlier tried this from Raspbian

Code: Select all

sudo su -c 'echo 8 > /sys/module/bcm2709/parameters/reboot_part'
sudo reboot
It works well if I do it via SSH or in terminal. But by putting it in .sh file and running or by putting this in a file and make it executable.

Any idea why?

Return to “Advanced users”