[Support] Linuxserver.io - Unifi-Controller


Recommended Posts

I have a really weird issue -- Home Assistant is polling Unifi to see what devices are connected.  If my docker daemon restarts or my server restarts, the connection from HA to Unifi-Controller times out.  If I manually restart my HA service it connects just fine.  I've tried increasing the delay of the HA server to 10m after the Unifi-Controller starts but it still times out when trying to connect.  Anyone have any ideas what else I can try?

 

(Posting here because there isn't a support thread for the HA container -- which is likely the problem.)

Link to comment

@pingmanping

 

I get exactly the same message in my browser, when trying to open: https://127.0.0.1:8843

UniFi Controller is starting up...

Please wait a moment

When refreshing the webpage, or trying further times, it is getting worse:

HTTP Status 400 - Bad Request

I am running the linuxserver/unifi-controller:LTS in docker, tried it both on a Ubuntu 16.04 LTS as a 18.04 LTS. Both have the same result. This is my installation history to this:

## steps to install docker and linuxserver-unifi-controller on ubuntu 16.04 LTS / 18.04 LTS

# installing docker
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

# fix "permission denied while trying to connect to the Docker daemon socket at unixL///var/run/docker.sock ..."
sudo usermod -a -G docker $USER


# installing docker-compose for processing .yml files
# for ubuntu 16.04 LTS
sudo curl -L "https://github.com/docker/compose/releases/download/1.18.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
# for ubuntu 18.04 LTS
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

# set permission for docker-compose
sudo chmod +x /usr/local/bin/docker-compose

# docker-compose bash completion
sudo curl -L https://raw.githubusercontent.com/docker/compose/1.24.0/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose


# create a data volume for unifi
cd $HOME/Backup/docker/unifi/
mkdir data

# create in the same directory a docker-compose.yml file with following contents:

version: "2"
services:
  unifi-controller:
    image: linuxserver/unifi-controller:LTS
    container_name: unifi-controller
    environment:
      - PUID=1000
      - PGID=1000
    volumes:
      - $HOME/Backup/docker/unifi/data:/config
    ports:
      - 3478:3478/udp
      - 10001:10001/udp
      - 8080:8080
      - 8081:8081
      - 8443:8443
      - 8843:8843
      - 8880:8880
      - 6789:6789
    restart: unless-stopped


# and start the docker with command:
docker-compose up



# ergo: HTTP Status 400 - Bad Request
# ???

 

The next steps were originally in this post and were an assumption to partly fix web access issues, but did not help after all and can be completely left out:

 

# fix further issues in the shell (there as user root):
docker exec -it unifi-controller bash

# while in the docker shell do apt update etc.
apt update
apt upgrade

# install vi:
apt install vim

# make sure mongod is not confused with wrong commands. Modify /usr/bin/mongod:
# see: https://community.ui.com/questions/Unifi-controller-on-Ubuntu-18-04/93b00b88-7542-40ba-bb0b-a80a84415e1d
cd /usr/bin
mv mongod mongod.bin

# replace mongod with following three lines, using vi:

#!/bin/bash
cleaned_args=$(echo $* | sed -e 's/--nohttpinterface//')
exec /usr/bin/mongod.bin ${cleaned_args}

# then make executable:
chmod +x mongod

# now restart the docker (press ctrl+c in the other docker window, and repeat the last command)

 

In the log files, I do not find a clue. in /usr/lib/unifi/logs/server.log it looks like it is running fine, since it is receiving an event from the access point:

...
[2019-07-13 11:21:32,944] <discover> INFO  event  - [event] AP[fc:ec:da:68:68:ee] was discovered and waiting for adoption
...

It looks like there is just something wrong configured with the web server. But so far I have no clue yet.

 

I have spent already more than two days troubleshooting this, read almost everything I could find about unifi and a HTTP Status 400 - Bad Request error.

 

Can someone help here?

 

Addendum 1: Problem solved: click here > to find the solution. <

Addendum 2: Moved the part above starting with: "fix further issues..." out of the main text, to clarify that these instructions have become obsolete.

 

 

=== sources ===

  * https://hub.docker.com/r/linuxserver/unifi-controller
  * https://stackoverflow.com/questions/48957195/how-to-fix-docker-got-permission-denied-issue

  * https://base64.co.za/unifi-db-server-info-db-dbserver-stopped-unifi-controller-solved/

  * https://community.ui.com/questions/Unifi-controller-on-Ubuntu-18-04/93b00b88-7542-40ba-bb0b-a80a84415e1d

Edited by w_m0zart
Take out obsolete instructions
Link to comment
2 hours ago, EmEnAr said:

I can not find the Unifi controller app in the comunity applications plugin. Is it removed? or do i need to install it in another way?

Shows up on my Apps page. Are you sure your Community Applications plugin is up-to-date?

Link to comment
On 7/13/2019 at 8:44 AM, w_m0zart said:

tried it both on a Ubuntu 16.04 LTS as a 18.04 LTS.

28 minutes ago, Squid said:

You should chat up LSIO on discord for support for their containers and other OS's outside of unRaid.

As it says in the first post in this thread.

Link to comment

I am sorry I did not read the first post. After searching via google, I stumbled directly upon the earlier post from user pingmanping as I found exactly the same problem. However, I solved the problem in the meantime:  The IP-address for the web interface was wrong: instead of https://127.0.0.1:8843 it should have been https://127.0.0.1:8443

 

After changing that URL the Unifi Controller webpage was served correctly. Then, in order to configure the access points, I had to configure at the left bottom, at SETTINGS -> Controller -> CONTROLLER SETTINGS -> Controller Hostname/IP, the IP address of the Host and Enable the "Override inform host with controller hostname/IP". After that all worked smoothly.

Link to comment
21 hours ago, tknx said:

SInce I have it running in its own IP, how do I change the ports to be standard http/https ports? I've tried editing system.properties and the docker settings with no luck

Port mappings are configured in the docker configuration. Just go to the docker tab and click the unifi-controller link. This will open the configuration page and you can use the edit buttons to change the port mappings.

Link to comment
3 hours ago, wgstarks said:

Port mappings are configured in the docker configuration. Just go to the docker tab and click the unifi-controller link. This will open the configuration page and you can use the edit buttons to change the port mappings.

Except that it doesn't seem to work. I set the web interface in the docker edit screen to 443 and it still maps to 8443.1634166972_ScreenShot2019-07-18at09_03_13.thumb.png.b6f0ca04bc6f591a560390fcc857b203.png

 

1519534424_ScreenShot2019-07-18at09_03_47.thumb.png.220782f233196666830d80bc16b22668.png

 

Link to comment
44 minutes ago, tknx said:

Except that it doesn't seem to work. I set the web interface in the docker edit screen to 443 and it still maps to 8443.1634166972_ScreenShot2019-07-18at09_03_13.thumb.png.b6f0ca04bc6f591a560390fcc857b203.png

 

1519534424_ScreenShot2019-07-18at09_03_47.thumb.png.220782f233196666830d80bc16b22668.png

 

If you click on 'Show docker allocations' at the bottom of the docker container edit screen, does it show another container as already using port 443 in bridge mode (assuming you are using the container in bridge mode on the host IP)?

 

Both Heimdall and Pihole (and probably others) want to use that port by default.

 

EDIT: Oops, just noticed you said in a previous post it is running on its own IP.

Edited by Hoopster
Link to comment
44 minutes ago, ozzyc said:

This sounds like a dumb question and I am probably missing something super obvious, but how do I select which branch when adding the container in unraid?

Use a version tag. See the instructions on GitHub and docker hub linked in the first post.SafariScreenSnapz164.jpg.654d81c911be2161dd6d3b3c98afe872.jpg

  • Like 1
Link to comment
  • 2 weeks later...
3 hours ago, MandalorePatriot said:

Why isn't there a beta or unstable branch? Just got the USW-24-POE-BETA and have to setup a controller on a different system. If the beta branch would be too much work, then I totally understand. Just curious.

There's alot of history with our unifi container and to be perfectly honest, unifi aren't known for quality releases. We've already been through the pain of users asking us for a new version that's been released instantly then we'd update them and then we would get complaint's that X/Y/Z wouldn't work. Adding a beta/unstable branch would increase the questions even if we stated we don't give support for it.

 

Abit of back story: https://blog.linuxserver.io/2019/02/18/changes-to-our-unifi-image/

Link to comment

Been really debating using Letsencrypt to reverse proxy this container. I see Letsencrypt has a subdomain conf. template. Im assuming you guys here have successfully dont that but I have three questions...

1- Is it really THAT risky to expose my Unifi Controller to www?

2- Does it make the issues with APs found/linked to Unifi Controller worse?

3- What other issues should I plan to face if I reverse proxy this docker?

 

Any thoughts would be awesome! Thanks!!

Link to comment
6 hours ago, Spoonsy1480 said:

Hi,

im trying to set this up, I have sabnzbd setup on port 8080.

so I can not use port 8080 and I have tried to change the port to 8083 and it keeps reading port 8080.

how can I overcome this?

 

Where do you change the port?

You only change it on the host side in the template.

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.