UniFi controller v.5.4.16 and Oracle 8

So, this is what I ended up needing to do to get Oracle 8 installed and UniFi 5.4.16 running on OSMC/RPI3:

  1. Install java-package and build-essentials
  2. Download Linux ARM 32 Hard Float ABI from Java SE Development Kit 8 Downloads
  3. Rename the tar.gz to remove “32” from the filename to avoid an install script failure if an architecture designator is in
    the filename.
  4. Build a deb package from the renamed tar.gz file
  5. Install the Oracle 8 deb package
  6. Configure java to use Oracle 8 not openjdk-7
  7. Release the hold on the UniFi package and upgrade to 5.4.16
  8. Configure JAVA_HOME
  9. Restart UniFi
# apt install java-package build-essentials
# mv jdk-8u131-linux-arm32-vfp-hflt.tar.gz jdk-8u131-linux-arm-vfp-hflt.tar.gz
$ make-jpkg jdk-8u131-linux-arm-vfp-hflt.tar.gz
# dpkg -i oracle-java8-jdk_8u131_armhf.deb
# update-alternatives --config java
# apt-mark unhold unifi && apt dist-upgrade
# echo "JAVA_HOME=/usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt" | sudo tee /etc/default/unifi
# systemctl restart unifi

I can say with absolute certainty that the UniFi controller is much more responsive now that Oracle 8 is the default java version. Web UI responsiveness is remarkably improved!


1 Like

I’m trying to get Oracle Java 8 installed as part of my UniFi install.

When I try to build the package at the make-jpkg step I get an error:

dpkg-checkbuilddeps: Unmet build dependencies: libgtk2.0-0

I have build-essential and java-package installed.

Any ideas on how to get past this?

Edit: premature question, installing libgtk2.0-dev appears to have fixed that issue - build in progress

OK, built and installed fine.

When I try to start the unifi service, I get the following error:

osmc@osmc:~$ sudo systemctl status unifi
● unifi.service - unifi
   Loaded: loaded (/lib/systemd/system/unifi.service; disabled)
   Active: active (exited) since Tue 2017-08-08 20:48:41 NZST; 2min 38s ago
  Process: 1204 ExecStart=/usr/lib/unifi/bin/unifi.init start (code=exited, status=0/SUCCESS)

Aug 08 20:48:40 osmc unifi.init[1204]: Starting Ubiquiti UniFi Controller: unifiCannot locate Java Home
Aug 08 20:48:41 osmc unifi.init[1204]: failed!
Aug 08 20:48:41 osmc systemd[1]: Started unifi.

When I ran update-alternatives I selected the Oracle Java option, and I have completed the JAVA_HOME step.

Any ideas how I troubleshoot further? It seems like the unifi package can’t find Java, but I’m not sure why…

Why not ask on the unifi forum since this has nothing to do with OSMC.

We can’t give support for other applications Java works on OSMC rest is for their devs to work out, it’s their job

As Toast said, this is outside the scope of the OSMC support forum.

That said, I can offer some general advice which is try to run it from the command line:

sudo /usr/lib/unifi/bin/unifi.init start

and see what happens. If it creates a log file, check there or look in the system log by running sudo journalctl.

Edit: added sudo

1 Like

The reason why I said it was that they have it as their job and get paid for it rather than us that volunteer our time.

So let the paid guys sort it out. Plus I know that their forum is great for support question like this. I own and operate serval of their products

1 Like


Execute the two commands below (configuring the unifi service to use Oracle jdk 8).

> # echo "JAVA_HOME=/usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt" | sudo tee /etc/default/unifi
> # systemctl restart unifi
1 Like

@ransur0t Fantastic post as this is very good to have UNIFI hosted on RPI’s running on OSMC…

Do you have any luck getting the latest Unifi Controllers running on RPI’s? I mean 5.6.20 or 5.6.22 as since 5.6.19 I can’t get my RPI UNIFI Controller to work…

I did request help at the Unifi forum but no love so far…

Keep up the good work…

below link will help users to get make-jpkg command working as it helped me

You’re welcome @sniferx1, glad you find it helpful. As others have said, perhaps out of scope for general user support on OSMC forums, but nonetheless from a community perspective I believe it is helpful to “cross pollinate” between ubnt and osmc forums …

Regarding the next major version release of the unifi controller, I have not transitioned to that yet (it is currently still in stable release candidate staging).

My current controller version (as follows) still runs great:

~$ apt-cache policy unifi
Installed: 5.5.24-9806
Candidate: 5.5.24-9806
Version table:
*** 5.5.24-9806 0
500 http://www.ubnt.com/downloads/unifi/debian/ stable/ubiquiti armhf Packages
100 /var/lib/dpkg/status

1 Like

No problem @ransur0t. I am using 5.6.x branch as it got VPN support for me via L2TP as I am using my phone to login and perform tasks in local WAN / LAN / Wifi…

Any way I have raised a ticket with UniFi now and will wait to see what they say…

Just FYI…
You can also get 5.6.x branch releases by updatating source list to include testing (rather than stable)

No need to switch sources.list.d entry to testing repo – ubnt just pushed 5.6.22 to stable! I think I’ll hold the unifi package until I verify it will run on the pi3/osmc, or at least determine what needs to be done to get it to run.

Curious, did you take a look at the release announcement, particularly the parts on the Cloud Access feature and privileged ports?


1 Like

@sniferx1 – So, I gave 5.6.22 a try, without success. :frowning:

The unifi server.log indicated an error with the mongodb database at the time of upgrade, so after stopping the unifi service I attempted a repair with:
mongod --dbpath /usr/lib/unifi/data/db --repair

The db repair was successful, but the controller failed to load regardless, and there was no running instance of mongodb after restarting the unifi service.

I have downgraded to 5.5.24 and the controller is running again. :slight_smile:

Please let me know what ubnt provides as a potential solution.

1 Like

Someone posted below fix and I will try this this weekend…

In my case the problem was, that there was not enough memory.
To get around that, I reduced Video-memory:
sudo nano /boot/config.txt
Added at the end: gpu_mem=16

As this was not enough, I changed size of Swap-File to 1000. Unifi needed around 150 so you could try also with 200:
sudo nano /etc/dphys-swapfile
changed from 100 to 1000: CONF_SWAPSIZE=1000

and enabled Swap-File:
sudo systemctl enable dphys-swapfile

After reboot Controller started without problem. (It took a while):
sudo reboot

In case swap is not installed, use:
sudo apt-get install dphys-swapfile



Steps I posted above worked and below is the formal Unifi forum. Also Ubnt now pushed 5.6.x Branch as stable and you can do the same to get 5.6.22 working as now it’s working for me.


Unifi Stable APT Link:



Thanks for the follow up. I read through the ubiquiti forum post and noted that the support rep advised to install java 8u162 from the early access builds. Seeing that you tried java 8u151 and 8u152, I’m curious if the beta version solves the memory issue …?

I’ve just built the 8u162 deb package and will likely give the upgrade another try before implementing the dphys-swapfile method as I am concerned about it’s potential impact to sdcard lifespan.

Alternatively, I am planning on getting a unifi docker container running on my OMV NAS to try out the controller on that system as well.


1 Like

@ransur0t Unifi finally came out and informed what they have done… More info in below link and below new settings fix the issue now and without having the need to install SWAP file service…

unifi.xms=512 (in /var/lib/unifi/system.properties)


Thanks @sniferx1. I had been following/monitoring ubiquiti forums for anything official and hadn’t checked since this morning.

Yup, it works! :slight_smile:

I can verify that setting unifi.xms=512 in /var/lib/unifi/system.properties, paired with JDK 8u162 built from tar.gz downloaded from JDK 8 Updates Early-Access Builds results in a successful upgrade to UniFi Controller 5.6.22 and snappy performance.

System memory usage under idle and normal loads is up ~10%, with ~ 30% available MEM remaining (and this is with ~340MB allocated to GPU …)

1 Like


Wish you a happy new year… Return from holidays and I have upgraded my OSMC which running the Unifi Controller to latest (Dec Update) and Unifi stop working and when try to install latest Unifi stable (5.6.29) it’s giving some MongoDB package errors

Unpacking unifi (5.6.30-10266) ...
dpkg: dependency problems prevent configuration of unifi:
 unifi depends on mongodb-server (>= 2.4.10) | mongodb-10gen (>= 2.4.14) | mongodb-org-server (>= 2.6.0); however:
  Package mongodb-server is not installed.
  Package mongodb-10gen is not installed.
  Package mongodb-org-server is not installed.

dpkg: error processing package unifi (--install):
 dependency problems - leaving unconfigured
Processing triggers for systemd (232-25+deb9u1) ...
Errors were encountered while processing:

Just want to check are you having any issues?

I think you might be out of luck. The Debian repo doesn’t have an armhf version of mongodb-server (and there’s nothing at all for the other two). Debian -- Package Search Results -- mongodb

The best I can find is someone has compiled a version of mongodb 3.0.14 for Raspbian stretch here.

1 Like

Thanks @dillthedog I also suspected this is the case and thanks for confirming. Saved lot of hours getting this to work. I will wait until MongoDB support V9.

For now I have setup a temp Unifi Server on my MAC and restore from a backup so all good…

I will check when this is available time to time…

Thanks again for super quick response…