Flash / restore the OS image

(!)

Note:
Flashing an OS image and restore OS from backup have identical methods. Any time there is a mention about flashing an OS, it also means restoring an OS from backup.

Which method for flashing / restoring the OS to use? They are sorted from easiest to hardest.

    • PC / Notebook connected to same network
    • Progress of the backup process and any errors are shown in web interface
    • No other HW is necessary (flashdisk, USB cable)
    • Might not work for units with corrupted system
    • Backed-up device must have USB A port
    • No PC / Notebook needed for flashing process itself
    • Successful flashing is indicated only by reboot and any errors during flashing process are not shown
    • An USB flash drive with enough storage size
    • Might not work for units with corrupted system
    • Another device with Linux OS connected directly to the backed-up device
    • USB-C cable is needed
    • Can be done even if system is corrupted
    • Primarily for more experienced users
    • Cannot be used on units with secure boot enabled
    • Another device connected directly to the backed-up device
    • USB-C cable is needed
    • Can be done even if system is corrupted
    • Only .raw file is available from backup
    • Primarily for more experienced users
    • Cannot be used on units with secure boot enabled

To flash OS into the Edge unit via the service web interface, you must first know the steps to enter service mode. The instructions are available in in this article.

  1. Download a ZIP archive with the OS image and extract it into a new folder in your PC or prepare backup of an OS image with swu file. Extract archive.swu from the archive or backup
  2. Enter the device IP address into a web browser. Upon confirmation, you will be connected to the Unipi Edge service interface
  3. In the service interface, drag and drop the archive.swu file into the Software update box
  4. The OS flashing will start
  5. Wait until the device finishes the process. Its progress can be monitored in a box under the Messages label
  6. When the flash is complete, the device restarts

State after the flashing process is finished

  1. When restoring backup that is already on USB flashdisk skip to step 5
  2. Download a ZIP archive with the fresh OS image and extract it into a new folder in your PC
  3. Prepare a USB flash disk in FAT32 format with a capacity of at least 4 GB
  4. Unzip the ZIP archive and then copy the contents to a flash drive
  5. Unplug the power supply of the device and insert the flash disk into any USB A port on the device
  6. Press and hold the SERVICE (SVC) button
  7. Plug in the device power supply, the unit will automatically start the reflashing process (after 5-10 s) indicated by rapid blinking of all LEDs in both upper and lower row
  8. You can now release the SERVICE (SVC) button
  9. When the flash is complete the device restarts

(!)

Note:
If the USB flash disk is not compatible, the unit will not start the OS image flashing and proceeds to service mode. In that case, you need to use a different flash disk or the above-mentioned flashing via the service interface.

Flashing the OS using a USB flashdisk only from .swu file

When only .swu backup file is available, it is possible to flash via USB flashdisk.

  1. Download a ZIP archive with the OS image and extract it into a new folder in your PC
  2. Prepare a USB flash disk in FAT32 format with a capacity of at least 4 GB
  3. Unzip the ZIP archive and then copy the contents to a flash drive
  4. On the USB drive replace the .swu file present with the .swu containing backup
  5. Unplug the power supply of the device and insert the flash disk into any USB A port on the device
  6. Press and hold the SERVICE (SVC) button
  7. Plug in the device power supply, the unit will automatically start the reflashing process (after 5-10 s) indicated by rapid blinking of all LEDs in both upper and lower row
  8. You can now release the SERVICE (SVC) button
  9. When the flash is complete the device restarts

(!)

Note:
If the USB flash disk is not compatible, the unit will not start the OS image flashing and proceeds to service mode. In that case, you need to use a different flash disk or the above-mentioned flashing via the service interface.

(!)

Attention:
The following guides are for more experienced users.

Restore an OS image from swu file

(!)

Attention:
This method can be used only to restore from backup from the same unit. This procedure is only possible on devices with Linux OS and root access.

  1. Start the unit in Initialization mode
  2. Enter the lsblk command and identify which device is the attached eMMC storage, typically sda, sdb, etc. or find it from kernel log using dmesg
    [114570.735872] usb 1-1.3: New USB device found, idVendor=0a5c, idProduct=0104, bcdDevice= 1.00
    [114570.735903] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [114570.735917] usb 1-1.3: Product: Raspberry Pi multi-function USB device
    [114570.735928] usb 1-1.3: Manufacturer: Raspberry Pi
    [114570.735938] usb 1-1.3: SerialNumber: 10000000ff00a88e
    [114570.797566] usb-storage 1-1.3:1.0: USB Mass Storage device detected
    [114570.798207] scsi host0: usb-storage 1-1.3:1.0
    [114570.806660] cdc_acm 1-1.3:1.1: ttyACM0: USB ACM device
    [114571.803910] scsi 0:0:0:0: Direct-Access     mmcblk0                        PQ: 0 ANSI: 2
    [114571.805093] scsi 0:0:0:0: Attached scsi generic sg0 type 0
    [114571.806559] sd 0:0:0:0: Power-on or device reset occurred
    [114571.808665] sd 0:0:0:0: [>>sda<<] 15269888 512-byte logical blocks: (7.82 GB/7.28 GiB)
    [114571.940909] sd 0:0:0:0: [sda] Write Protect is off
    [114571.940937] sd 0:0:0:0: [sda] Mode Sense: 0f 00 00 00
    [114572.072867] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
  3. Open the directory with the swu2rpioboot.sh script (created after from backup.sh) and backup of the OS
  4. Run the swu2rpiboot.sh script
    sudo sh swu2rpiboot.sh /dev/sdX 

    Replace the sdX with the device, sda in this case. The backup must be named archive.swu and in directory from where the script is executed.

  5. When finished, disconnect 24 V DC power supply and the USB-C cable
  6. You can now boot the Unipi Edge with the restored OS

Flash from raw OS image

In case the .raw backup is not available and the device cannot be flashed or restored any other way, it is necessary to use .raw version of Base OS image. This image is intended to restore the device with corrupted boot sector. After restoring the device with this image it is recommended to flash the device with newest version of an OS image or with previously created backup.

  1. Start the unit in Initialization mode
  2. Download and extract raw version of image (Base OS - raw) or use backup of raw image
  3. Identify which device is the attached eMMC storage
    • Mac / Linux - Use lsblk command, the storage will typically be sda, sdb, etc.
    • Windows - Find the device label in My PC

      /!\

      Warning:
      Using incorrect device could result in the loss of data on a different partition or device. Make sure to perform the recovery only on the block device made by rpiboot.

  4. Open Balena Etcher, Raspberry Pi Imager or some similar tool or use dd utility on Linux
  5. Flash or copy over the OS
    • example of using dd
      dd if=backup.raw of=/dev/sdX conv=fsync status=progress
  6. When finished, disconnect 24 V DC power supply and the USB-C cable
  7. You can now boot the Unipi Edge with the restored OS

(!)

Attention:
Do not use backups from models with greater storage then on the flashed unit. E.g. Using backup created on Unipi Edge model with 16 GB of eMMC to flash onto model with only 8 GB. This could lead to data loss or system corruption on the flashed unit.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies