Bricked Unifi USG
You are having the problem that your USG recently goes offline and online regularly within your UniFi Controller? High latency and slow SSH on your USG? You are at the right spot!
I was having trouble maniging my USG whenever I changed something within my network, this is when I saw that the USG was having some issues. Since all my clients get their IP by DHCP and have vaild DHCP leases I didn't notice the problem right away.
So I did some digging and found this post: UniFi - How to fix a corrupted USG-3P
I also made a copy and uploaded the image there because who knows if his site exists forever.
Anyway, this did the trick for me but I want you to know some more details on how to fix this with a selfhosted controller since I was running in some issues with the said post.
Prerequisites:
- Already set up Controller with networks
- USG as Gateway which was already in use
- FritzBox - Kind of optional but you need something to connect to your ISP
Step 0: Downgrade USG Firmware
I was using the latest firmware UGW3.v4.4.57.5578372.tar on my USG. Before messing around you can try to downgrade to a past vesion and test if this works for you. (f.e. UGW3.v4.4.52.5363511.tar)
SSH into your USG. the credentials are probably not the default ones (ubnt/ubnt) because you've configured different SSH credentials within your controller: Settings->System->Advanced Configuration->SSH to look up your credentials.
upgrade https://dl.ui.com/unifi/firmware/UGW3/4.4.52.5363511/UGW3.v4.4.52.5363511.tar
If this doesn't work for you proceed with Step 0.1.
Step 0.1: Read image from USB
There is a chance that your USB drive inside the USG is faulty. To check this first instead of doing some crazy recovery stuff I highly recommend saving your image from the USB anyway.
- Disassemble the USG just like in the tutorial from Alex.
- Take the USB drive out of the USG
- Plug it into your Windows PC
- Download Win32Diskimager and read the image from the drive to an *.img file
- Write the image with Win32Diskimager back to a new USB drive and put it back into your USG
The good thing about this is, that if it's just the USB drive, everything should work fine from now on.
Step 1: Getting started
This step is not part of Alex's tutorial and I was having massive problems because of that, maybe I'm stupid but this did cost me so much time to figure out. Before you start doing anything with the USG do the following:
Scenario 1: Set Static IP of Controller
Make sure your Unifi-controller is part of the 192.168.1.0/24 default network with a static IP-Address. Because we are not using a cloud-key we have to set the inform-url manually later. Otherwise you won't be able to know your controller IP and you won't find the controller in your network outside of the mentioned network/subnet since there is no gateway to route to a VLAN or anything.
If you've done that, go to your controller and "Forget" the USG from your network, otherwise this will be so much pain later, trust me.
Now follow the fix by Alex Lowe (below), when you are done flashing, connect everything like this:
- Connect LAN1 and your Controller to a layer 2 switch
- Connect a PC or anything which has SSH installed to the same switch
Scenario 2: Use DHCP
If you are using a double Router setup, just like as I do with a FritzBox as ISP Gateway and the USG for internal routing, you can leave your Unifi-controller set to DHCP. Make sure DHCP is turned on on your ISP router.
If you've done that, go to your controller and "Forget" the USG from your network, otherwise this will be so much pain later, trust me.
Now follow the fix by Alex Lowe (below), when you are done flashing, connect everything like this:
- WAN ISP router with DHCP turned on
- Unifi-Controller to ISP router
Now connect to your ISP router and look up the given IP-Addresses by DHCP and connect to your USG.
Step 2: Follow the fix by Alex Lowe
- Unscrew the screws underneath the sticky pads to get excess to the USB drive
- Remove the USB drive
- Download the shipping image, unzip it with 7-zip or something similar
- Flash the drive with rufus or Raspberry Pi Imager
- Install USB drive and put everything together
Step 3: Upgrade Firmware
Because the installed image is so old (4.2.0) your controller wont be able to adopt the USG.
Download the latest firmware here: Unifi-Download
Upload the firmware to your USG: Default credentials for the USG are: ubnt/ubnt
scp /Downloads/firmware.tar ubnt@ipofyourusg:/tmp
Connect to USG via SSH, Default credentials for the USG are: ubnt/ubnt
sudo su
add system image /tmp/firmware.tar
The USG will reboot after that and cut the connection. Reconnect like above and set the inform url.
sudo su
set-inform http://ipofyourcontroller:8080/inform
You can check the status in your controller now or use the command "info":