bobjohncat
Posts: 21
Joined: Thu Mar 05, 2015 3:41 pm

Dual Boot on USB - 2 identical OSs - failover OS

Mon Oct 16, 2017 11:23 am

Hi,

I would like to have two identical OSs, Rasp Stretch Lite, as a safety/update feature for unmanned Pis.

So if I had stored on 2 partitions on a USB stick

OS_A
OS_B

Have it boot OS_A and use this OS.

In the future I want to upgrade the OS, lets say instead of running apt-get update and relying on this process, I could get OS_A to download a compressed image, uncompress it to the partition of OS_B, once its done, update the boot file to point to this OS_B, it reboots and load OS_B. If OS_B is successful then carry on using that. Obviously in the future I can do the same upgrade but back to OS_A.

Couple of questions

1) Is my logic sound with this idea?
2) Any ideas how I can write a fail back script, so lets say OS_A just uncompressed a new OS to OS_B, changes the boot file to point to OS_B and reboots. If OS_B fails to boot then how can I update the boot file to go back to OS_A

Thanks in advance for any thoughts

DorianAtExtensia
Posts: 4
Joined: Wed Oct 18, 2017 3:34 pm

Re: Dual Boot on USB - 2 identical OSs - failover OS

Wed Oct 18, 2017 4:24 pm

wow, I just posted a bootloader request for this today and just saw your post here.

my post is still pending moderator approval
but I asked if they could implement a feature similar to u-boot's bootcount/altbootcmd feature.

I've been able to get u-boot to work with this A/B/Recovery partition scheme using the regular raspberry pi's.

but I would prefer having built in bootloader support than using u-boot.

in a nutshell I recommended a bootcount.txt file in the fat boot partition that has:
bootcount=0
maxbootcount=3
altbootconfig=config2.txt

the bootloader can update the bootcount an the os can reset it to zero
if the bootcount exceeds maxbootcount use the config file from altbootconfig instead of the default config.txt


probably also need an altbootcmd too for the cmdline.txt

-dorian

bobjohncat
Posts: 21
Joined: Thu Mar 05, 2015 3:41 pm

Re: Dual Boot on USB - 2 identical OSs - failover OS

Thu Oct 19, 2017 10:45 pm

Many thanks for the reply, really helpful and will look into this!

Return to “Advanced users”

Who is online

Users browsing this forum: wildfire and 24 guests