Reboot into new OS image Remotely
I have a few old rpi 3b+ still running stretch which i would like to upgrade to either bullseye or buster. They are all remote and i access them via AnyDesk or reverse ssh tunnels as a backup.
I have attempted to simply upgrade into buster/bullseye on a rpi at home, with the same setup as these remote ones. My hope was that i would upgrade, then reverse ssh or AnyDesk into it after the upgrade, but they never managed to upgrade properly (attempted about 6 tiems with multiple variations and always failed for one reason or another). I can’t risk not being able to remote login, so i’m looking at other options.
Ideally here is what i’d like to do:
- Remote log into my rpi.
- Download a pre-configured image of buster/bullseye (with all the things i need, Anydesk etc..).
- Reboot the rpi into the newly downloaded OS image.
I’ve looked into using some multiboot tools, but they generally need you to do all the setup on a separate SD ard / USB etc. I need to be able to perform all these remotely via AnyDesk or ssh, and on the SD card that contains the currently running OS.
Anyone able to give me some pointers?
Download a pre-configured image of buster/bullseye (with all the things i need, Anydesk etc..); Reboot the rpi into the newly downloaded OS image.
That’s a relatively common requirement for embedded devices; now, would you be setting up these for the first time, you might do rather "enterprise-y" solutions like mender to allow for such remote updates, with robust fallback and so on.
But I gather that’s not what we’re doing. We’ve got these RPis out in the field, the OS that doesn’t come with a robust over-the-wire update functional is still running, so we need to deal with that and can be smart later.
Here’s how I’d approach this:
From the running debian stretch:
- Shrink the root partition (if classical partitioning is used, and not LVM), or if existent, disable the swap partition
- add a new partition (or if LVM is used, add a new LVM volume) if not using the swap partition
- download a compressed bootable upgrader system image (this might simply be the debian netinstaller with an installer preseed, or something more advanced like FAI), and uncompress it into the newly created partition or the former swap. Alternatively, if there is enough space, just download your new target system!
- configure your bootloader to boot from the new system next boot
if rebooting into the new image worked, you can log into that system and make the bootloader changes permanent. If not, you would be thrown back to the old image.
Now, I must admit I don’t know which bootloader you’re using – and that’s the "hard part" here.