OpenWrt + Arch Raspberry Pi Dual Boot using Pinn - how to reboot to Arch partition from OpenWrt


I have successfully set up PINN with OpenWrt and Arch (PiKVM) on my Raspberry Pi and can reboot between the two using the PINN interface.

I am also able to reboot directly from the Arch partition into OpenWrt using reboot 10 - where 10 is the OpenWrt boot partition number, but running reboot 6 from OpenWrt to boot directly into Arch does not work.

Is there another way to boot from OpenWrt to a different partition? I tried a few of the solutions I tried online but none have work so far so wondering if anyone know if OpenWrt has a way to do this.


Wondering if OpenWrt's reboot command is not accepting the partition number - some have compiled and added their own command -

I'm betting 'reboot' is just a symlink to Busybox on OpenWrt, like many essential commands on OpenWrt. For supported dualboot devices, OpenWrt has code to set a boot partition, to some extent - it sets a u-boot value AFAIK, and thoses values are fixed, whereas it sounds like yours is dynamic. Partition numbers 6 and 10 sound random in the sense that they probably depend on the actual partitioning of your SD card, and you can do whatever with those.

So either you'd compile OpenWrt to include a more full-featured reboot implementation, but I'm not sure if that would have the same feature as the RPi one you ended up installing yourself, or you stick with the RPi one you already installed.

Neither systemd-sysv reboot(8) nor sysvinit-core reboot(8) have any concept of such a feature either (grub-reboot(8) or efibootmgr(8) would have, but that's a different story and would need quite some attention to get working on OpenWrt, especially for the RPi).

1 Like

Yes you are correct, PINN creates these partitions as you use it to install the OS, so these numbers are dynamic, I believe 6 would always be the first OS`s boot Partition but after that it dynamic based on what you installed.

For now I have figured out that I can just set the PINN autoboot.txt file from OpenWrt by mounting the PINN partition and then I can reboot, but it would be better to reboot directly from OpenWrt into the other OS, so I will look into more options.

@slh @Borromini - I found another possible solution, but was hoping for some input if possible.

I found another post where a user compiled his own "custom_reboot" command - see:

I was able to compile something similar and it does seem to work, but I was wondering where to best get some input on what all to do before I actually run syscall(SYS_reboot and reboot OpenWrt.

In the custom command I found they run

system("/etc/init.d/rcK || /etc/init.d/rc 0");

but since this is for Rasbian those are not present on OpenWrt.

Any idea what would be needed to run to safely reboot? Is a simple sync() enough for OpenWrt? Or are there other scripts to run. I did poke around on Github looking for some OpenWrt reboot commands and that seems about all it does before it runs a reboot via Busybox, but I am unsure if Busybox is doing something else?

Also if there was any other reason to not create a script like this that could break OpenWrt please let me know. Thanks alot for all the help.