Flash using console port with usb-to-serial rollover console cable and picocom
Connect the console cable and start minicom and power up the USG
picocom -b 115200
You will be prompted for username/password which is ubnt:ubnt
Now you need to tell the USG to update with software from a web address. Find the latest USG firmware from Unifi here or elsewhere on the Unifi site: https://www.ui.com/download/unifi-switching-routing/default/default/.
Click the download button and agree to the terms - then copy the download link e.g. https://dl.ui.com/unifi/firmware/UGW3/4.4.57.5578372/UGW3.v4.4.57.5578372.tar.
In picocom, enter:
upgrade https://dl.ui.com/unifi/firmware/UGW3/4.4.57.5578372/UGW3.v4.4.57.5578372.tar
If don't get any response leave let the device be for 5 or 10 minutes. The USG will reboot when finished updating.
References: