How To Update Firmware via SSH
From Deliberant wiki
Contents |
Introduction
There may be cases where it is beneficial or even necessary to update the firmware on a device without using the web browser. It is possible to update firmware by using SSH and using the fwupdate command. This wiki is a walkthrough of getting the image on the device, and then flashing it.
Getting the Image on the Device
The first step of flashing an image in shell is getting the firmware image on the device. There are two easy ways to do this, SFTP the image to the device, or use wget from the device to download the image from an external source.
Using SFTP to Upload the Image
- Navigate to the folder on your computer where the firmware file is located.
- mhardy@mhardy-laptop:~/temp/firmware$ ls *
- DLB-CPE_24.v5.23.20642.080822.164518.img
- Using SFTP, login to the device
mhardy@mhardy-laptop:~/temp/firmware$ sftp admin@192.168.2.66
- Connecting to 192.168.2.66...
- Failed to add the host to the list of known hosts (/home/mhardy/.ssh/known_hosts).
- admin@192.168.2.66's password:
- Navigate to the /tmp folder. This is where the firmware image will be stored
- sftp> cd /tmp
- Upload firmware image. (Firmware names may vary)
- sftp> put DLB-CPE_24.v5.23.20642.080822.164518.img
- Uploading DLB-CPE_24.v5.23.20642.080822.164518.img to /var/tmp/DLB-CPE_24.v5.23.20642.080822.164518.img
- DLB-CPE_24.v5.23.20642.080822.164518.img 100% 4495KB 499.4KB/s 00:09
- Exit out of SFTP. File upload is complete!
- sftp> exit
Using WGET to download the file to the device
wget is available on these devices to transfer files from remote HTTP(s)/FTP servers.
- Login to the device via SSH
- mhardy@mhardy-laptop:~$ ssh admin@192.168.5.164
- Failed to add the host to the list of known hosts (/home/mhardy/.ssh/known_hosts).
- admin@192.168.5.164's password:
- After successful login, the CLI will be displayed
- CLI version 1.0
- Available commands:
- authcheck - Test authentication config
- passwd - Change any administrator password
- reboot - Reboot device
- reset - Reset device to defaults
- shell - Start system shell
- show - Show device configuration
- status - Show device status
- quit - Exit CLI
- Type 'shell' to escape to shell.
- cli> shell
- Launching system shell.
- Enter 'exit' or Ctrl-D to return from shell.
- BusyBox v1.5.0 (2008-08-22 12:51:10 EEST) Built-in shell (ash)
- Enter 'help' for a list of built-in commands.
- Navigate to the /tmp directory
- cd /tmp
- Using wget, download firmware image from specified URL
- wget http://www.deliberant.com/downloads/firmware/DLB-CPE_24.v5.23.20642.080822.164518.img
- Connecting to www.deliberant.com (67.211.11.195:80)
- DLB-CPE_24.v5.23.206 100% |********************************************************| 4494 KB 00:00:00 ETA
- File is now on the device, now move on the flashing!
Flashing the Image
Once the image is on the device, now you will want to actually flash it.
- SSH into the device
- mhardy@mhardy-laptop:~/temp/firmware$ ssh admin@192.168.2.66
- Failed to add the host to the list of known hosts (/home/mhardy/.ssh/known_hosts).
- admin@192.168.2.66's password:
- After successful login, the CLI will be displayed
- CLI version 1.0
- Available commands:
- authcheck - Test authentication config
- passwd - Change any administrator password
- reboot - Reboot device
- reset - Reset device to defaults
- shell - Start system shell
- show - Show device configuration
- status - Show device status
- quit - Exit CLI
- cli>
- Type 'shell' to escape to the shell
- cli> shell
- Launching system shell.
- Enter 'exit' or Ctrl-D to return from shell.
- BusyBox v1.5.0 (2008-10-17 15:17:11 EEST) Built-in shell (ash)
- Enter 'help' for a list of built-in commands.
- Navigate to the /tmp directory
- cd /tmp
- Rename previously uploaded file to 'fwupdate.bin'
- mv DLB-CPE_24.v5.23.20642.080822.164518.img fwupdate.bin
- Finally, run 'fwupdate -m'
- fwupdate -m
- /sbin/fwupdate: About to run firmware update
Now, device will flash, and reboot with new firmware. When device loads, the new firmware should be active. Enjoy!
Notes
- Windows users may use various SFTP clients to upload the image to the device, such as the PSFTP client developed by the makers of Putty, a popular SSH client: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
