USG white square of death

Is your USG flashing white and failing to boot? Does the controller show the USG as offline or provisioning? Does your firewall drop out and reboot? Issues with read-only mode?

USG white square of death

My Unifi USG recently started acting up. It was showing as 'offline' in the controller, then a reboot would make it change to 'provisioning' before dropping back to offline.
The device would also randomly reboot, normally when I was right in the middle of doing something important, dropping the connection! Eventually, the device seemed to give up and the light on top would only flash white.. the WSOD!

I tried to access the USG via SSH, but that had become flaky for some time. Connections via SSH would drop and it would seem to be in read-only mode. Thankfully I wasn't the first person to experience this, and repair is possible! Read on for some details on the process...

r/homelab - Repairing a failing USB drive in a Ubiquiti UniFi Security Gateway (USG)
117 votes and 55 comments so far on Reddit

Repair

To repair your USG, you will need to open it up. This will void your warranty.
You will also need a USB stick - I recommend an 8gb drive (comments online say that the minimum capacity of the USB is 4gb with a maximum of 16gb). The disk will need to be pretty slim, too - you'll see why very soon!

To open the USG, remove the 4 rubber feet. Use a screwdriver to remove the four screws that attach the lid to the assembly.

Inside, you will find a USB stick, which is the memory drive for the USG. I'm not sure why they didn't include a more reliable storage device on the board, but at least a USB drive is easy to replace.

Software

If you have a second (working) USG, one of the fastest ways to get the device working again would be to take an image of the working USB and flash it onto a new drive for the broken USG. This would get the device up and running from a reasonably new firmware level. See below in the 'backup' section for an easy way to create a backup image if you want to go down this route.

If you don't have another USG, you can get download a file from UniFi. The source of my information is here:

Dead USG | Ubiquiti Community
Good morning all.This morning when I got to work I noticed that my network was down (VoIP phones, computers, AP’s, UniFi Video cameras and so on.I looked

The file you can download is named 'USG-4_2_0-shipped.img.bz2', and has a hash of '80485aa3c770d61d16360afdab57fba820660ce8'. You should check the hash to make sure that the file has not been changed.

Once this is downloaded, a tool like Etcher can be used to flash the image onto a USB drive.

You can then plug the USB drive into the USG, reassemble it, and power it up again. It may take a while to boot up, plus you might find it on the wrong subnet (192.168.1.1/24). When you get a connection to the USG, you will need to update the firmware. It's best to do this before provisioning the USG.

Backup

Once your USG is online, updated & provisioned, now might be a good time to take a backup image of the device to reduce the downtime should this happen again!

I created a spare USB drive with the image pre-flashed, so in the event of a similar failure I can plug the USB into the USG and just update the firmware.

Creating a backup image using a Mac or Linux is pretty simple with 'dd'. Always be careful using these commands. Using the wrong disk identifier will result in data loss!:

  1. Connect your USB to the machine
  2. (OSX) Use command 'diskutil list' in terminal. As an example, this displays /dev/disk4 for my USB. See image 1
  3. To create a backup image of this USB, I can use the command below. This command uses an 'input' of /dev/rdisk4 with a block size of 1m, and pipes the output to gzip, compressing the file as it goes. See backup code below.
  4. To reflash, I can use the command below. It's basically reverse of the first command. It decompresses the file and 'outputs' it to the disk. See restore code below.
    You will need to unmount but not eject the drive before you can write to it. Use 'diskutil unmountDisk /dev/disk4' for this example.
Image 1
sudo dd if=/dev/rdisk4 bs=1m | gzip > ~/Desktop/usbBackup.gz
Backup Code
gzip -dc ~/Desktop/usbBackup.gz | sudo dd of=/dev/rdisk4 bs=1m
Restore Code

If you would like some more information of Windows backups, or more details on 'dd', see this post which was writen to describe some backup procedures for the Raspberry Pi.

How to Backup your Raspberry Pi SD Card
All the steps to backing up your Pi.

Hopefully this guide pulls together some of the resources you need to get your USG repaired and working again.

As always, get in touch with comments and thoughts! hi@xga.ie