tpylkko
Posts: 409
Joined: Tue Oct 14, 2014 5:21 pm

Where does NOOBS store the value for which OS booted last?

Tue Jan 26, 2016 7:55 pm

I tried to find this information in the github documentation and online, but failed. I'd like to know how NOOBS knows what OS was booted last? I'm assuming that it stores this a number in some variable and then on next boot it uses this information. The problem is that I want to work with a NOOBS install with two OS via ssh, and want to be able to "switch OS's" at times. If I issue reboot, it will but it will boot back into the same OS unless I locally chose otherwise in the splash screen. But the problem is that I am not available locally.

I realize that I can mount the partitions to access data on on the storage of the other OS, but some times I want to be able to run it also.

If there is indeed such a variable somewhere, then I could simply mount the NOOBs partition, edit that number and reboot. It would then boot into the "wrong OS" thinking that it was where it was last.


EDIT: in noobs.conf there is:

Code: Select all

default_partition_to_boot=8
. I wonder if this is it?

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Where does NOOBS store the value for which OS booted las

Tue Jan 26, 2016 8:18 pm

https://github.com/raspberrypi/noobs/bl ... -partition

(Of course, there is a small hurdle to implementing this from within a running system, because by design the root directory of NOOBS, which contains the recovery console code, is not mounted by the running Operating System. That can be overcome manually.)

tpylkko
Posts: 409
Joined: Tue Oct 14, 2014 5:21 pm

Re: Where does NOOBS store the value for which OS booted las

Tue Jan 26, 2016 8:26 pm

Ok, that probably works in some sense. However, it involves adding a new config file to the system, and for all I can see, the system already some how knows which partition to boot, and it would be more simple to "spoof" that. And also, that file then needs to be deleted later to resume to normal - yet another reason why it would be nicer to just "spoof" the normal process, instead of adding a new one.

Also, if whatever way to do this is manually laborious, it doesn't matter because I could just write a script.

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Where does NOOBS store the value for which OS booted las

Tue Jan 26, 2016 8:32 pm

tpylkko wrote:Ok, that probably works in some sense. However, it involves adding a new config file to the system, and for all I can see, the system already some how knows which partition to boot, and it would be more simple to "spoof" that. And also, that file then needs to be deleted later to resume to normal - yet another reason why it would be nicer to just "spoof" the normal process, instead of adding a new one.

Also, if whatever way to do this is manually laborious, it doesn't matter because I could just write a script.
Simply pointing out what the developers/maintainers have documented. Your decision whether to use it or not...

User avatar
rpdom
Posts: 17170
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Where does NOOBS store the value for which OS booted las

Tue Jan 26, 2016 9:03 pm

You could look at the NOOBS source and see how it boots into a specific partition. IIRC there's a register that holds the partition number to use at next start-up. It gets reset after selecting the partition.

You could use that to effectively bypass NOOBS for the next boot and boot straight into the other OS.

Ah, here we are: viewtopic.php?t=71107#p568213 :)

tpylkko
Posts: 409
Joined: Tue Oct 14, 2014 5:21 pm

Re: Where does NOOBS store the value for which OS booted las

Wed Jan 27, 2016 10:46 am

Ok. Thanks a lot, this is exactly what I needed.

Thank you also B. Goode, I think it is in order to just state that I was not trying to undermine your suggestion, but I think that it is fair to say that for this particular problem that solution is not the best one.

Return to “Beginners”