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/126.96.36.19978372/UGW3.v188.8.131.5278372.tar.
In picocom, enter:
If don't get any response leave let the device be for 5 or 10 minutes. The USG will reboot when finished updating.