UniFi Controller Version/Upgrade Question

Distilled

Cadet
Joined
Mar 2, 2022
Messages
1
I have UniFi Controller version 6.5.55 installed in Jail within TrueNAS, whenever I log in to the UI I get notified that an update is available; "Network update 7.0.23 is now available."

From what I can tell there is not an update available, I tried entering the shell and updating/upgrading and version 6.5.55 remains.

Being a little afraid to screw something up with my current controller I thought I'd be smart and open an additional Jail and attempt a fresh install using; pkg install unifi7, but there does not seem to be anything available past "unifi6".

I'm pretty green when it comes to linux based systems, most of my experience is in Windows, so I very well could be missing something, but I just wanted to reach out and see if anyone could confirm that 6.5.55 is the most current version available for FreeBSD/TrueNAS and that the notification to update doesn't apply.

Thank you.
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
Unifi controller is packaged separately for each major version. You'll need to run pkg delete unifi6 followed by pkg install unifi7 to get the latest version.

Having said that this worked seamlessly for me when I uypgraded from unifi5 to unifi6 but I haven't tried this with unifi7. Make sure you take a snapshot of your jail before upgrading in case something goes wrong so you can roll back if needed. Also note that these instrucrtions are for a manual install in a standard jail. If you are running the Unifi plugin then wait for the maintainer to update the plugin before you upgrade.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Just did that (followed by pkg upgrade at the end) with a stop and start of the unifi service before and after respectively in the plugin version.

It worked fine.
 

georgelza

Patron
Joined
Feb 24, 2021
Messages
417
Just followed steps provided by Jailer and worked, no problems.

G
 

logiboy

Cadet
Joined
Oct 13, 2021
Messages
3
Nice one. Was able to upgrade from UC 6.5.x to 7.1.66 following this.

Make sure you take a snapshot before you start anything, makes for quick restore in case something goes wrong.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
It should be noted that once you deviate like this from a plugin, you must under no circumstances ever update the plugin via the provided methods, you're now on a Frankenstein track where you're on your own for adding and/or repairing limbs, etc.

If you were to do what I just recommended against, you're likely to end up with a lower version of unifi installed than your database is at (unless you did rigorous checking of the state of the updated plugin in advance and were suitably convinced you would be OK).

What this also means is that your jail is now stuck at the same BSD version as the plugin was at when you started.

Plugin updates remove the installed packages and install them again at the new versions following an update of the BSD version, so can't be trusted to not mess with the "latest and greatest" we have manually intervened to have.

The alternative is (of course) just to build yourself a jail and wade through the mess of mongodb and getting the app to work nicely on your own in a fresh jail... no mean feat.

Anyway, just hoping to avoid tears for somebody down the road.
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
The alternative is (of course) just to build yourself a jail and wade through the mess of mongodb and getting the app to work nicely on your own in a fresh jail... no mean feat.
If you install unifi controller in a standard jail via the package it automagically installs all the dependencies needed to run and there's nothing to configure. It really is a simple install, just create a standard jail and run the following:

pkg install unifi7
sysrc "unifi_enable=YES"
service unifi start
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Well, that's an even better argument for dumping the plugin altogether... I might just do that.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Although, don't forget the step to change /etc/pkg/FreeBSD.conf to be "latest" instead of "quarterly" or you end up with exactly the problem I mentioned when you try to restore your db.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
So, if I write that up as a migration process from the plugin to a self-managed jail...

In the Unifi GUI, navigate to Settings | System | Backup, then select "No limit" or whatever you feel OK with and then click Download (keep the resulting download for the end.

Stop your existing jail
iocage stop ufPlugin or whatever your jail is named

create a new jail:
iocage create -n "unifi" -r 13.1-RELEASE defaultrouter="192.168.1.1" dhcp="on" vnet="on" boot="on" (assumes your existing jail isn't called that... if it is, iocage rename unifi ufPlugin... watch out for jail naming... if your existing jail starts with "unifi", this may be an issue)

After it's created:
iocage console unifi

then in the jail:
ee /etc/pkg/FreeBSD.conf find and update quarterly to latest and ESC to exit, selecting to save.

pkg update Say yes to go ahead

pkg install unifi7 Agree one or more times to proceed

sysrc "unifi_enable=YES"

service unifi start

Then connect to your unifi GUI in a browser at the jail's IP on port 8443

Select the option to restore from a backup file and supply the downloaded one.

after a little while, back at the jail console:

service unifi status

If it's still running, wait longer and try again.

Once it's not running:
service unifi start

Connect to the GUI again in the browser and confirm all is now good and as before.

then clean up the old plugin jail:
iocage destroy --recursive ufPlugin
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
Although, don't forget the step to change /etc/pkg/FreeBSD.conf to be "latest" instead of "quarterly" or you end up with exactly the problem I mentioned when you try to restore your db.
So the plugin uses the "latest" repository? That doesn't seem very prudent. If the plugin uses the quarterly branch and you migrate to a fresh standard jail you should be on the same or newer version of mongodb and there shouldn't be an issue.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
The other way around... I think I probably changed the repo to latest in order to see the unifi7 pkg in the first place, so my version was already modified to latest, but the plugin possibly not... in any case, I think the plugins specify version details, so may still install older version even with the latest repo.
 

Redcoat

MVP
Joined
Feb 18, 2014
Messages
2,925
If you install unifi controller in a standard jail via the package it automagically installs all the dependencies needed to run and there's nothing to configure. It really is a simple install, just create a standard jail and run the following:

pkg install unifi7
sysrc "unifi_enable=YES"
service unifi start
I second @Jailer on this. Maintenance (keeping up to date) is painless.
 

ilium007

Explorer
Joined
Apr 9, 2012
Messages
61
I can't work out how to get 7.1.66 installed in a jail? This command below installs 7.0.23

Code:
xxxx@unificontroller:~ % sudo pkg install unifi7
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
    unifi7: 7.0.23

Number of packages to be installed: 1

The process will require 200 MiB more space.

Proceed with this action? [y/N]:
 

Pierce

Explorer
Joined
Sep 4, 2013
Messages
64
I note that for FreeBSD 13.1-RELEASE, 7.4.156 is in ports, but only 7.3.something is in pkg ....
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
I note that for FreeBSD 13.1-RELEASE, 7.4.156 is in ports, but only 7.3.something is in pkg ....
Not quite. You need to change your package repo like explained here:


The default repo is the "quarterly" one. As the name suggests it receives updates once per quarter and only security patches inbetween.
 

Pierce

Explorer
Joined
Sep 4, 2013
Messages
64
ahhhh, dunno how I missed that. so now i have my unifi7 running from a ports build of 7.4.156... I gather 7.4.162 just got released, when that bubbles to pkg, will I be able to update my 'ports' build with the pkg? or do I need to scrape the ports build and redo it with pkg ?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
A port in the end performs a pkg install, so you will be able to update with pkg.
 

Pierce

Explorer
Joined
Sep 4, 2013
Messages
64
thanks. I'm kind of a novice when it comes to BSD package management. I'm retired, so my "IT" now is restricted to what dabbling I do to run my home 'stack', which I'm intentionally keeping as simple as I can, one pfsense, one truenas, and my unifi stuff for wireless (several u6-lr) and switching (USW-Pro-24-PoE)....
 
Top