Update on 2022/05/27: Uploaded and included link to the ‘usg-4-2-0-shipped.img ‘ on the Archive.org.

A few weeks back we had a power outage at our home. Electricity was restored a few hours later and we all thought nothing of it. Everything turned back on and my home network seemed to function correctly.

About a week later, I logged in to my Ubiquiti Network Manager Controller and saw that my Ubiquiti UniFi Security Gateway (USG) was no longer sending over data to the controller software. I still thought little of this issue, since the USG was still routing and blocking unsolicited traffic.

The following weekend I decided I wanted to restore full USG functionality in the Network Manager Controller software, so I decided to simply reboot the USG. This, unknowingly, was my first mistake. After turning the USG back on, I found that the Network Manager Controller software would not hand out new IP addresses from the DHCP scope. I could only attach to the network with a physical connection and a static IP address self-assigned on the same subnet as the USG. I tried to reboot the device several times, but it was all in vain. I realized the device had a deeper issue.

I performed a factory reset on the USG a few times and the lights indicated that the resets were successful, but my connectivity issues on the LAN were not resolved.

At this point, I began researching online on how to reflash the firmware on the USG device. After putting a process together from several articles, I was able to find a viable solution. I will document the procedure below for future reference.


The first step, which led to several minutes of initial frustration, was figuring out how to get into the device. At first I thought it might pry apart, but I quickly figured out this was not the case.

  1. Remove the rubber pads from the bottom of the USG device, revealing four screws. Remove all four screws.
Screw, top-left
  1. After removing all four screws, the top piece of the unit will lift off, revealing the main board of the USG device.

Note: I had already removed the internal USB drive at the time I took this picture. Pretend it is there.

USG main board with USB drive already removed
  1. Remove the USB drive, containing the potentially corrupted firmware.
The USB drive is a silver and slim
  1. Plug the USB drive into a computer and verify it is actually functional. Sometimes USB drives die. If the drive is at least recognized by the computer, proceed to step 5.
  1. Download the factory-shipped image from Ubiquiti here:
    Ubiquiti: https://dl.ubnt-ut.com/cmb/USG-4_2_0-shipped.img.bz2
    Internet Archive: https://archive.org/details/usg-4-2-0-shipped.img
  1. Use your favorite image flashing utility to write the downloaded firmware onto the USB drive.

Note: I like to use balenaEtcher on macOS ($ brew cask install balenaetcher), but Rufus is a good alternative on Windows (> choco install rufus).
Attention: The firmware writing procedure can take 10+ minutes, so do not get frustrated and remove the drive mid-write.

  1. Once the factory image is flashed onto the USB drive and the image is verified, plug the USB drive back into the USG device. Turn on the device.

Note: The initial boot process can taken several minutes, but the light in the middle of the board will come on once it is running.

USB drive installed and LED light on
  1. Reassemble the USG (and do not forget to reapply the sticky pads).

Note: Do not reattach it to the network yet.

  1. Login to the Ubiquiti Network Manager Controller and forget the old USG.
  1. Plug the USG back into the network and more than likely the Ubiquiti Network Manager Controller will automatically adopt it and reconfigure it.

Note: Make sure to apply all applicable updates to the USG, because the factory image is now out-of-date.


Once all of these steps are complete, you should be on your way to full usage of your USG product once more. I am happy they decided to make their boot medium removable and easily re-writable. If you run into any issues, feel free to drop a line in the comments below and I will see if I can assist.

20 Replies to “How to Reflash a Ubiquiti UniFi Security Gateway (USG)”

  1. D.J. thanks for posting the article, maybe you can help. I have a USG gateway usually connect through Google chrome. I couldn’t even get to the Unifi controller login screen being hardwired to my switch, connected to the gateway of course. Finally I connected the pc to the Gateway. Got the login screen and my credentials don’t work. they are good, but i can’t get in to manage the switches or the wireless access point. closing my house and have to turn over the login to the new owner. Now i’m dead in the water. I do have internet coming out of the WAN1 of the gateway. how can i reset/get control over my own stuff? will a hard reset just remove the switches so I get internet only from the one gateway port? I’m a severe novice. can you help me?
    Thanks.

    1. Mark,
      Quite honestly Iā€™m not sure where to start here, nor do I believe I understand the problem. It sounds like you should reset a lot of the equipment, ensure your credentials are correct, re-adopt the equipment, and start from square-one. Iā€™d also read a lot of the documentation on the Ubiquiti website and check out their forums. People there are great and will help you far quicker than I can on this blog. Check out https://community.ui.com/questions

  2. Thank you for this tutorial. A similar thing happened to me. I can now reflash it for someone else to use, but I am disappointed in the USG, so I replaced it with a Fortinet.

  3. I had 4 of these old units laying around, I was able to recover all of them. Thank you!

  4. Protip: when an older USG stops working, it’s most likely that the original flash drive died.

    Purchase a cheap one from your favorite retailer, follow this guide and you’re back in business. You may have to “shuck” the thumbdrive due to the tight clearances, but it’ll still work just fine.

  5. Would it be possible to create a backup image of the USB stick, as a sort of preventive measure? Is it FAT32 or ext4?

  6. Hmm … thanks for the suggestion but after reflashing my USB (with balenaEtcher), I still just get the flashing Console light. šŸ™

    1. Try to use Rufus to flash the drive.
      https://rufus.ie/en/

      Also, I know it sounds silly, but safely eject the USB, if at all possible. Did balenaEtcher verify when you wrote the image to the thumbdrive and validate it matched?

Leave a Reply

Your email address will not be published.