UniFi Controller Server Reject fix

I can’t believe I’ve been bitten by this again. I’ve been upgrading my home network recently, which included some new UniFi switches. A second batch turned up today — USW Flex 5-port 1Gs — and like other UniFi gear, you plug them into your network and adopt them in the controller.

After 2 hours or so of battling with them failing to adopt — where they show in the controller as available for adoption but don’t, showing Server Reject as the error message after SSHing in (ubnt/ubnt as user/pass!) to run the info command — something sparked in my brain. I’ve searched the Ubiquiti forums, various blogs and Stack Overflow tonight, and nothing on any of those sites fixed it. Then I remembered: I’ve seen this issue before! And not only that, I’ve blogged about it before!

So why didn’t I find my own blog post about the issue, which is related to one of the Java libraries the controller uses not working, in my case on FreeBSD, when I searched? No idea. However, just in case it’s because I titled it poorly and so the Google juice the post gets is poor, rather than just my blog not getting any readers, here’s the fix again.

Install FreeBSD’s snappy Java library if you haven’t already, with pkg install snappyjava, stop the controller, then wherever your UniFi controller install lives on disk, move the existing snappy .jar in the lib directory out of the way (snappy-java-1.1.7.5.jar at the time of writing) and symlink /usr/local/share/java/classes/snappy-java.jar to the original filename instead. Restart the controller and the device should adopt.

Because snappy’s API doesn’t change much any more, this tends to work even when FreeBSD’s snappy and the one UniFi package in the controller get out of sync slightly, which is nice. Currently they’re in sync!

Here’s hoping “UniFi Controller Server Reject fix” is a decent title this time, so I can find it 4 years later when I inevitably get bitten by this again and don’t remember my own fixes.