Home Assistant Community Add-on: UniFi Controller

Hi I’ve installed addon and trying to install my old config from backup file. But it seems that it’s stucked in starting unifi controller…

Not sure if this is a notification or a cry for help. In case it is the last one, you should provide some data (like logs and stuff) in order for us to be able to help you.

I also had the adoption problem. I restarted the access points, and everything works now.

Anyone know how to handle problems with mongodb? It’s crashing shortly after starting:

This is logged in /usr/lib/unifi/logs/mongod.log within the container:

2018-06-21T21:25:05.872-0700 ***** SERVER RESTARTED *****
2018-06-21T21:25:05.892-0700 [initandlisten] MongoDB starting : pid=2405 port=27117 dbpath=/usr/lib/unifi/data/db 32-bit host=a0d7b954-unifi
2018-06-21T21:25:05.892-0700 [initandlisten] 
2018-06-21T21:25:05.892-0700 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.
2018-06-21T21:25:05.893-0700 [initandlisten] **       32 bit builds are limited to less than 2GB of data (or less with --journal).
2018-06-21T21:25:05.893-0700 [initandlisten] **       Note that journaling defaults to off for 32 bit and is currently off.
2018-06-21T21:25:05.893-0700 [initandlisten] **       See http://dochub.mongodb.org/core/32bit
2018-06-21T21:25:05.893-0700 [initandlisten] 
2018-06-21T21:25:05.893-0700 [initandlisten] db version v2.6.10
2018-06-21T21:25:05.893-0700 [initandlisten] git version: nogitversion
2018-06-21T21:25:05.894-0700 [initandlisten] OpenSSL version: OpenSSL 1.0.2n  7 Dec 2017
2018-06-21T21:25:05.894-0700 [initandlisten] build info: Linux kishi10 3.2.0-84-highbank #121-Ubuntu SMP PREEMPT Tue May 5 19:44:15 UTC 2015 armv7l BOOST_LIB_VERSION=1_58
2018-06-21T21:25:05.894-0700 [initandlisten] allocator: tcmalloc
2018-06-21T21:25:05.894-0700 [initandlisten] options: { net: { bindIp: "127.0.0.1", http: { enabled: false }, port: 27117, unixDomainSocket: { pathPrefix: "/usr/lib/unifi/run" } }, storage: { dbPath: "/usr/lib/unifi/data/db" }, systemLog: { destination: "file", logAppend: true, path: "/usr/lib/unifi/logs/mongod.log" } }
2018-06-21T21:25:06.001-0700 [initandlisten] waiting for connections on port 27117
2018-06-21T21:25:06.618-0700 [initandlisten] connection accepted from 127.0.0.1:57042 #1 (1 connection now open)
2018-06-21T21:25:06.636-0700 [initandlisten] connection accepted from 127.0.0.1:57044 #2 (2 connections now open)
2018-06-21T21:25:06.707-0700 [conn2] SEVERE: Invalid access at address: 0xf9
2018-06-21T21:25:06.714-0700 [conn2] SEVERE: Got signal: 11 (Segmentation fault).
Backtrace:0x7639be 0x762f6e 0x76300a 0x76728760 0x766c7cec 0x76f2d5e8 0x76f2da3e 0x76f2236a 0x76f225e6 0x76f2e99c 
 bin/mongod(_ZN5mongo15printStackTraceERSo+0x25) [0x7639be]
 bin/mongod() [0x762f6e]
 bin/mongod() [0x76300a]
 /lib/arm-linux-gnueabihf/libc.so.6(+0x25760) [0x76728760]
 /usr/lib/arm-linux-gnueabihf/libunwind.so.8(_ULarm_step+0x5b) [0x766c7cec]
 /usr/lib/arm-linux-gnueabihf/libtcmalloc.so.4(+0x255e8) [0x76f2d5e8]
 /usr/lib/arm-linux-gnueabihf/libtcmalloc.so.4(_Z13GetStackTracePPvii+0x25) [0x76f2da3e]
 /usr/lib/arm-linux-gnueabihf/libtcmalloc.so.4(_ZN8tcmalloc8PageHeap8GrowHeapEj+0xb9) [0x76f2236a]
 /usr/lib/arm-linux-gnueabihf/libtcmalloc.so.4(_ZN8tcmalloc8PageHeap3NewEj+0x79) [0x76f225e6]
 /usr/lib/arm-linux-gnueabihf/libtcmalloc.so.4(malloc+0x13b) [0x76f2e99c]

addon version 0.1.1
HA 0.71.0

Nuking the mongodb databases and letting them get recreated made the problem go away :slight_smile:

rm -rf /usr/lib/unifi/data
mkdir -p /usr/lib/unifi/data/db

Thanks, I’ll try that!

Edit: Didn’t work for me. But for others trying to run embedded MQTT and Unifi add-on in parallell: Change the port on MQTT instead as described here MQTT Embedded broker and websocket

1 Like

Thank you Frenck, this is much appreciated and perfectly fits my setup.

However, after installing and setting up following the 11 steps, all my devices have status “Managed by other” (instead of “Connected”) and I am not able to change the name or add them to my network.

Did any have this same problem or did I miss something?

@frenck for some reason I can never get the add-on to start. I’ve tried changing the ports and so far nothing has worked.

  • Do you have a second instance running in your network?

In that case, turn off the second controller

  • Where the AP’s adopted by another device before?

Reset the devices using a the reset button (paperclip, small button on the back, hold for 10 seconds).

Could you please provide some more details? Like not able to start? In that case, the add-on log should have valuable information you could share?

@frenck after installing the add-on and pressing the start button I only see a spinner inside the button then after a few seconds nothing happens. I hit refresh on the log details and there is nothing there. I even changed the log level from info to trace and still nothing is showing up for me. I changed both port 8080 and 8443 to something else hoping that would solve it but the add-on is still refusing to start.

Running on a Pi 3.

Is there anything visible in the system log?
(Hass.io panel → System tab)

@Frenk Okay I think i see the issue now. I changed the port from 1900 to 1901 and it seems to have started.

18-09-22 15:12:24 ERROR (SyncWeorker_9) [hassio.docker] Can't start addon _a0d7b954_unifi: 500 Servier Error: Internal Server Error ("driver failed programming external connectivity on endpoint addon_a0d7b954_unifi (baadf8fe4e6bc2f7f014ded3ccca313bdda3d926bd81bd5362937af09cd271f3): Error starting userland proxy: listen udp 0.0.0.0:1900: bind: address already in use")

I have installed this addon, but not getting very far. I see no errors in the log just that it is started. Navigating to the URL https://<hass.io>:8443 and I get the prompt to restore an existing backup, select that and I get the message restore is progressing…then nothing.

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Hass.io Add-on: UniFi Controller v0.1.1
 Manage your UniFi network using a web browser
 From: Community Hass.io Add-ons
 By: Franck Nijhof <[email protected]>
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
Log level is set to INFO
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] 02-updates.sh: executing... 
INFO: You are running the latest version of this add-on
[cont-init.d] 02-updates.sh: exited 0.
[cont-init.d] 10-requirements.sh: executing... 
[cont-init.d] 10-requirements.sh: exited 0.
[cont-init.d] 50-persist-data.sh: executing... 
[cont-init.d] 50-persist-data.sh: exited 0.
[cont-init.d] 60-ssl.sh: executing... 
[cont-init.d] 60-ssl.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
INFO: Starting the UniFi Controller

I can’t see anything in the system log either. Any suggestions?

My log does now contain the error:

OpenJDK Client VM warning: You have loaded library /usr/lib/unifi/lib/native/Linux/armv7/libubnt_webrtc_jni.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
1 Like

Thanks a lot Frenck,
I already did have the devices configured using a previous controller, so this did the trick (in case anybody has the same problem):
Reset the devices using a the reset button (paperclip, small button on the back, hold for 10 seconds).

OK I removed the addon and re-added it. Started a restore and left it. After about 20 mins the the web page appeared and it had restored my config. So it seems I was impatient!

I still this error in the log though:

OpenJDK Client VM warning: You have loaded library /usr/lib/unifi/lib/native/Linux/armv7/libubnt_webrtc_jni.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.

Unfortunately I could not get this add-on to work: I left it running for over an hour without result. If I subsequently restarted the add-on, login failed with unkown user/password. Hence something is failing during the config import.

I reverted back to https://github.com/stefanlaheij/hassio-addons which work fine.

Hi,
I’m running the addon succesfully on my Debian install of Hassio. I have added a USG and will need to edit a file within the install (config.gateway.json). This seems to be the only way to change the mac address of the USG. How can I access that file within the docker environment, is there any way to ssh into the running container? Otherwise I may just install the controller directly in the OS and abandon the plugin.

I just install and transfer my old controller config to UniFi Controller Add-on. It’s working like a charm. Is it possible to add shortcut to Hass.io side bar?

Thanks for your efforts.

:tada: Release v0.1.2

Full Changelog

Changed

  • Upgrades UniFi to v5.8.24