So there were a couple of changes made to the latest UniFi controller version that causes it to break on upgrade but that’s no worries because the fix is quite simple.
Before we started we would appreciate if you considered becoming a supporter of this project.
With that out of the way, lets get started.
Step 1) Update your UniFiPi to the latest version.
Step 2) Enable SSH on your UniFiPi.
Step 3) Backup your UniFi configuration
Step 4) Run the following command to update Java, set defaults and reboot.
sudo apt update
sudo apt upgrade
sudo apt install -y openjdk-8-jre-headless haveged
sudo rm -rf /etc/default/unifi
reboot
Step 5) Updated and ready to go!

Step 5) Continue the discussion over on the UniFiPi Subreddit or on Twitter