5

I already have few Raspberry Pi devices running Raspbian + my custom scripts. These device is internet connected and mounted at area which is hard to access, (e.g on top of a building)

Over the years, newer Raspbian version released or I created a newer custom image which I would like to deploy to all these devices easily.

Is there any example to remotely flash/update the OS images while the Pi is running live? (The scenario is like upgrading the Curiosity Mars land rover's OS from earth, then reboots it.)

goldilocks
  • 56,430
  • 17
  • 109
  • 217
Dennis
  • 383
  • 1
  • 5
  • 14
  • 1
    My raspberry pi is easy to access, but I haven't touched it physically in months. There is no need to have physical access. While goldilocks answer has valuable information about updating I think you are really asking about `sudo rpi-update`. Read this article: http://www.raspberrypi.org/documentation/raspbian/updating.md – Tyson Jan 06 '15 at 12:58

3 Answers3

3

You don't need to "flash it live". The firmware is on the SD card and loaded at every boot. Just update the system normally:

apt-get update
apt-get upgrade

The reboot. You probably want to test this in relation to whatever application software you're running on an at hand system first in case there are any glitches with that.

Most likely everything will be fine.

As others have suggested, you can also use rpi-update, which is a bash script that downloads the latest firmware from https://github.com/Hexxeh/rpi-firmware along with a kernel.

goldilocks
  • 56,430
  • 17
  • 109
  • 217
3

As far as deploying custom images remotely, I'm not sure how to go about it, but check out This. It's the Raspbian net install. You can put this on a running pi and when it restarts it auto installs a minimal raspbian image. If you check link, it github and maybe you can figure out how they did this by checking their code.

As far as just updating firmware remotely, just make sure you have rpi-update installed

 sudo apt-get install rpi-update

And then run

 sudo rpi-update 

Once firmware finished installing and there were no errors, you need to reboot to start using new firmware.

Edit: This will probably be more helpful. It's the same github repo, but it the BUILD.md file that has some useful info that may help you deploy a custom image remotely.

geoffmcc
  • 591
  • 4
  • 8
  • Note that as per **[here](http://www.raspberrypi.org/documentation/raspbian/updating.md)** you don't need `rpi-update` to update the firmware; it ships together with the kernel in normal updates. According to that page using `rpi-update` is appropriate if you want to "try more recent **experimental** software". You may have minor issues if you mismatch firmware (one example which would be nasty on a remote unit: *`reboot` does not work*, it just halts the system and you must now physically plug-unplug), so unless there's a reason to, stick with the regular Debian updates. – goldilocks Jan 06 '15 at 17:04
  • I know it's available in Official Raspbian image, but OP was also talking about using custom images. It would need to be installed in that case, such as how I had to install it because I used the netinstall image. I also never had any issue after firmware update, but yeah it possible, but it also possible to downgrade using rpi-update. But as you stated, you then need physical access if issue makes remote not possible. – geoffmcc Jan 06 '15 at 17:10
  • It's using a custom *kernel* that I stumbled upon the "won't reboot properly" issue, although I haven't bothered to solve it so can't say for sure why (mismatched firmware is a guess, because earlier I had [an opposite problem](http://raspberrypi.stackexchange.com/questions/12200/halting-inevitably-leads-to-reboot) that was corrected by updating the firmware with `rpi-update`...) Anyway, something to be aware of. You're probably right. – goldilocks Jan 06 '15 at 17:29
  • 1
    When using rpi-update it is a good idea to keep a log of the firmware hash you had and one it installed. That way if you update and have problems you can always downgrade to old firmware using rpi-update xxxxxxxxxxxx (whatever the hash is. There is an example in the read me on github.com – geoffmcc Jan 06 '15 at 17:48
2

If you are doing remote updates, you can use a over-the-air updates tool built for this purpose to get more safety (e.g. rollback) and control (grouping, deployment status, etc). For example, Mender has official support for Raspbian now: https://hub.mender.io/t/raspberry-pi-3-model-b-b-raspbian

rduio
  • 21
  • 1