Unifi-Video Won’t Start

My unifi-video would not start the other day. I figured it was java related and yes, it was. I had wasted a few hours trying to downgrade my java but it wasn’t happening. I was using openjdk and had recently upgraded from Ubuntu 18.04 to Ubuntu 20.04. I did not realize until I had fixed it that my camera had stopped recording almost a month ago.

This link goes to the answer on the Unifi Community. The instructions are easy and it works! The problem is I don’t trust Ubiquiti and am afraid the solution might be lost if they change forums again. The post by Daschundfarm was the key for me. Note – the Java download link did not work with wget. I had to download it on a different computer and then transfer it to my server. Below is the instructions.

I have Ubuntu 20.04.2 LTS:

EDIT2: Note that this way you’re locking the system into an “old” version of Java, which might not be a good practice in the long run + knowing this shithole company, they’ll sooner or later make unifi-controller not be able to run on this older java version – which is going to be an issue if you run both video & controller on the same machine. Also it might happen that after every automatic java update (thinking about apt -f upgrade / dist-upgrade) you’ll have to repeat some of the steps below.

EDIT: Thanks to @Resquer here is a direct link to the download (don’t have to create an oracle account):

https://javadl.oracle.com/webapps/download/AutoDL?BundleId=243727_61ae65e088624f5aaa0b1d2d801acb16

1, Download “jre-8u271-linux-x64.tar.gz” from [SEE ABOVE]

(Or if the above link is no worky, then https://www.oracle.com/java/technologies/javase/javase8u211-later-archive-downloads.html (you want the JRE! not the JDK, so scroll down a bit on the page for the “Java SE Runtime Environment 8u271” section))

as root (sudo su):

2, mkdir /usr/local/java (if not already exists)

3, cp “jre-8u271-linux-x64.tar.gz” /usr/local/java

4, cd /usr/local/java

5, tar zxvf jre-8u271-linux-x64.tar.gz

6, rm jre-8u271-linux-x64.tar.gz

7, update-alternatives –install “/usr/bin/java” “java” “/usr/local/java/jre1.8.0_271/bin/java” 1

8, update-alternatives –config java (select the number of the newly extracted one, it was #3 for me):

* 3      /usr/local/java/jre1.8.0_271/bin/java      1     manual mode

9, echo “JAVA_HOME=/usr/local/java/jre1.8.0_271” | tee -a /etc/default/unifi

10, reboot and enjoy.