ryansch / docker-unifi-rpi

Unifi Controller for Raspberry Pi 3+ and x86
https://hub.docker.com/r/ryansch/unifi-rpi/
347 stars 42 forks source link

Port 8080 not available (RPI 3B) #66

Closed DiMilan closed 4 years ago

DiMilan commented 4 years ago

Worked fine until last month.

pi@rpiCloudkey:~/unifi $ docker ps
CONTAINER ID        IMAGE                      COMMAND                  CREATED             STATUS              PORTS               NAMES
24d62ed70723        ryansch/unifi-rpi:latest   "/sbin/tini -g -- /d…"   11 months ago       Up 5 seconds                            unifi
pi@rpiCloudkey:~/unifi $ 

pi@rpiCloudkey:~/unifi $ docker port 24
pi@rpiCloudkey:~/unifi $ 

pi@rpiCloudkey:~/unifi $ docker inspect 24 | grep IP
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
                    "IPAMConfig": null,
                    "IPAddress": "",
                    "IPPrefixLen": 0,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
pi@rpiCloudkey:~/unifi $ 

pi@rpiCloudkey:~/unifi $ docker logs 24
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'.
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter INFO: destroy called
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'.
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter INFO: destroy called
Exception in thread "Thread-13" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration: Initialization of bean failed; nested exception is java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:584)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1455)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1419)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1310)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1166)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:855)
    at org.springframework.beans.factory.support.ConstructorResolver.resolvePreparedArguments(ConstructorResolver.java:802)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:143)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1308)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1143)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1455)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1419)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1310)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1166)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:855)
    at org.springframework.beans.factory.support.ConstructorResolver.resolvePreparedArguments(ConstructorResolver.java:802)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:143)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1308)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1143)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.context.support.DefaultLifecycleProcessor.getLifecycleBeans(DefaultLifecycleProcessor.java:289)
    at org.springframework.context.support.DefaultLifecycleProcessor.stopBeans(DefaultLifecycleProcessor.java:195)
    at org.springframework.context.support.DefaultLifecycleProcessor.stop(DefaultLifecycleProcessor.java:116)
    at org.springframework.context.support.AbstractApplicationContext.stop(AbstractApplicationContext.java:1331)
    at com.ubnt.service.B.õÒ0000(Unknown Source)
    at com.ubnt.ace.Launcher$2.run(Unknown Source)
Caused by: java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
    at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:177)
    at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1212)
    at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:340)
    at org.springframework.web.servlet.handler.AbstractHandlerMapping.detectMappedInterceptors(AbstractHandlerMapping.java:318)
    at org.springframework.web.servlet.handler.AbstractHandlerMapping.initApplicationContext(AbstractHandlerMapping.java:293)
    at org.springframework.context.support.ApplicationObjectSupport.initApplicationContext(ApplicationObjectSupport.java:124)
    at org.springframework.web.context.support.WebApplicationObjectSupport.initApplicationContext(WebApplicationObjectSupport.java:77)
    at org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(ApplicationObjectSupport.java:78)
    at org.springframework.context.support.ApplicationContextAwareProcessor.invokeAwareInterfaces(ApplicationContextAwareProcessor.java:120)
    at org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:96)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:419)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1737)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:576)
    ... 45 more
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'.
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'.
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'.
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'.
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'.
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'.
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'.
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'.
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'.
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'.
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'.
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'.
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'.
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'.
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'.
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'.
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'.
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'.
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'.
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'.
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'.
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter INFO: destroy called
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'.
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter INFO: destroy called
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'.
Port 8080 not available
Port 8080 not available
Port 8080 not available
Port 8080 not available
....
ryansch commented 4 years ago

If you are using either a bind mount or a docker volume for storage, you could try removing the container completely and recreating it from a fresh image.

I'd make sure to take a controller backup just in case.

DiMilan commented 4 years ago

I'm just using your default docker-compose.yml from 24 Jul 2019 https://github.com/ryansch/docker-unifi-rpi/blob/master/docker-compose.yml

with following volumes: volumes:

Unifi v5.0.7 creates all of these directories (some remain empty)

  - config:/var/lib/unifi
  - log:/usr/lib/unifi/logs
  - log2:/var/log/unifi
  - run:/usr/lib/unifi/run
  - run2:/run/unifi
  - work:/usr/lib/unifi/work

On the Pi no physical directories are created

pi@rpiCloudkey:~ $ cd unifi pi@rpiCloudkey:~/unifi $ ls docker-compose.yml pi@rpiCloudkey:~/unifi $

Any idea if I can make a backup without the webservice?

ryansch commented 4 years ago

You should be just fine with that setup. All of your data is sitting in docker volumes. Try docker-compose rm -sf unifi; docker-compose up -d

DiMilan commented 4 years ago

first had some errors but after reboot it worked. Webservice still not available tho

pi@rpiCloudkey:~ $ cd unifi pi@rpiCloudkey:~/unifi $ docker-compose rm -sf unifi && docker-compose up -d Going to remove unifi Removing unifi ... done Creating unifi ... done pi@rpiCloudkey:~/unifi $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 392b3b66eba7 ryansch/unifi-rpi:latest "/sbin/tini -g -- /d…" About a minute ago Up 16 seconds unifi pi@rpiCloudkey:~/unifi $ docker logs 39 Port 8080 not available Port 8080 not available Port 8080 not available Port 8080 not available pi@rpiCloudkey:~/unifi $

ryansch commented 4 years ago

Do you know what controller version you're working with there? This error is new to me.

Edit: It seems to be saying that something else is listening on port 8080 inside the container. That doesn't make sense to me yet.

Could you try the following: docker exec -it unifi bash # This gives you a shell inside the running container. apt-get update && apt-get install net-tools netstat -lpn # Lists processes that have open ports; paste result here.

DiMilan commented 4 years ago

Yeah it indeed seems very strange to me too. Do you mean the Unifi controller? the docker-compse.yml file says :latest so I suppose 5.14.23

pi@rpiCloudkey:~/unifi $ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ryansch/unifi-rpi   latest              c8630be24004        11 months ago       496MB
pi@rpiCloudkey:~/unifi $ 
pi@rpiCloudkey:~/unifi $ docker-compose images
Container      Repository        Tag       Image Id      Size 
--------------------------------------------------------------
unifi       ryansch/unifi-rpi   latest   c8630be24004   473 MB
pi@rpiCloudkey:~/unifi $ 

Docker and docker-compose versions:
---------------------------------------
pi@rpiCloudkey:~/unifi $ docker -v
Docker version 19.03.8, build afacb8b
pi@rpiCloudkey:~/unifi $ docker-compose  -v
docker-compose version 1.21.0, build unknown
pi@rpiCloudkey:~/unifi $ 

But those worked for a long time and didn't change anything here. 

On the host there is nothing on port 8080 either

pi@rpiCloudkey:~/unifi $ netstat | grep 8080
pi@rpiCloudkey:~/unifi $ netstat | grep unifi
pi@rpiCloudkey:~/unifi $ netstat | grep 8443
unix  3      [ ]         STREAM     CONNECTED     18443    /run/systemd/journal/stdout
pi@rpiCloudkey:~/unifi $ 

The running services
---------------------
pi@rpiCloudkey:~/unifi $ docker-compose top
unifi
UID     PID    PPID    C    STIME   TTY     TIME                                 CMD                             
-----------------------------------------------------------------------------------------------------------------
root   10545   10526   0    22:55   ?     00:00:00   /sbin/tini -g -- /docker-entrypoint.sh start                
root   10559   10545   69   22:55   ?     00:00:13   /usr/bin/java -Xmx512M -jar /usr/lib/unifi/lib/ace.jar start
pi@rpiCloudkey:~/unifi $ 
ryansch commented 4 years ago

You have latest as it existed about 11 months ago. If you want to run 5.14.23 you need to docker pull ryansch/unifi-rpi:latest.

Did you try running netstat from inside the container with docker exec? I only see you running it on the host.

DiMilan commented 4 years ago

I'm not able to install Netstat in the container (Unable to locate package)

problems: It was hard to get an Interactive terminal as he kicked me out every few seconds and interrupted the process so I had to run the commands from outside:

`pi@rpiCloudkey:~/unifi $ docker exec unifi apt-get update Ign:1 http://deb.debian.org/debian stretch InRelease Get:2 http://archive.raspbian.org/raspbian stretch InRelease [15.0 kB] Get:3 http://deb.debian.org/debian stretch-updates InRelease [93.6 kB] Get:4 http://security.debian.org/debian-security stretch/updates InRelease [53.0 kB] Get:5 http://deb.debian.org/debian stretch Release [118 kB] Get:6 http://deb.debian.org/debian stretch Release.gpg [2410 B] Get:7 http://archive.raspbian.org/raspbian stretch/contrib armhf Packages [56.9 kB] Get:8 http://deb.debian.org/debian stretch-updates/main armhf Packages [2576 B] Get:9 http://archive.raspbian.org/raspbian stretch/main armhf Packages [11.7 MB] Get:10 http://archive.raspbian.org/raspbian stretch/non-free armhf Packages [98.9 kB] Get:11 http://security.debian.org/debian-security stretch/updates/main armhf Packages [540 kB] Get:12 http://deb.debian.org/debian stretch/main armhf Packages [6908 kB]

pi@rpiCloudkey:~/unifi $ docker exec unifi apt-get install net-tools Reading package lists... Building dependency tree... Reading state information... E: Unable to locate package net-tools

pi@rpiCloudkey:~/unifi $ `

ryansch commented 4 years ago

Try running the 3 commands I provided earlier. The -it is important. Also if you start with bash then you stay inside the container until you ctrl-d.

DiMilan commented 4 years ago

Pulling latest version now.

It was very strange, I wasn't able to stay in the it, he kicked me out in the middle of the update back to the rpi prompt. I'll try to make a screencap but it's kinda hard to capture.

ryansch commented 4 years ago

That makes sense if you ran it without -it since STDIN wouldn't have been open and bash would have exited immediately.

ryansch commented 4 years ago

If it's something else, I'd love to see the screencap.

DiMilan commented 4 years ago

it was 100% with the -it option :)

pi@rpiCloudkey:~/unifi $ docker exec -it unifi bash
root@rpiCloudkey:/var/lib/unifi# pi@rpiCloudkey:~/unifi $ apt-get update && apt-get install net-tools
Reading package lists... Done
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)
W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)
pi@rpiCloudkey:~/unifi $ docker exec -it unifi bash
root@rpiCloudkey:/var/lib/unifi# pi@rpiCloudkey:~/unifi $ docker exec -it unifi /bin/bash
root@rpiCloudkey:/var/lib/unifi# apt-get update && apt-get install net-toopi@rpiCloudkey:~/unifi $ docker exec -it unifi /bin/bash
root@rpiCloudkey:/var/lib/unifi# apt-get update
Get:1 http://archive.raspbian.org/raspbian stretch InRelease [15.0 kB]
Ign:2 http://deb.debian.org/debian stretch InRelease                           
Get:3 http://security.debian.org/debian-security stretch/updates InRelease [53.0 kB]
Get:4 http://deb.debian.org/debian stretch-updates InRelease [93.6 kB]                    
Get:5 http://deb.debian.org/debian stretch Release [118 kB]
Get:6 http://deb.debian.org/debian stretch Release.gpg [2410 B]
Get:7 http://archive.raspbian.org/raspbian stretch/non-free armhf Packages [98.9 kB]
Get:8 http://archive.raspbian.org/raspbian stretch/main armhf Packages [11.7 MB]
Get:9 http://deb.debian.org/debian stretch-updates/main armhf Packages [2576 B]     
Get:10 http://security.debian.org/debian-security stretch/updates/main armhf Packages [540 kB]
Get:11 http://archive.raspbian.org/raspbian stretch/contrib armhf Packages [56.9 kB]                                
Get:12 http://deb.debian.org/debian stretch/main armhf Packages [6908 kB]                                           
97% [8 Packages store 0 B]                                                                              2039 kB/s 0spi@rpiCloudkey:~/unifi $ d
pi@rpiCloudkey:~/unifi $ docker exec -it unifi /bin/bash
root@rpiCloudkey:/var/lib/unifi# apt-get install net-tools
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package net-tools
root@rpiCloudkey:/var/lib/unifi# apt-get instapi@rpiCloudkey:~/unifi $ docker exec -it unifi /bin/bash
root@rpiCloudkey:/var/lib/unifi# apt-get update
Get:1 http://archive.raspbian.org/raspbian stretch InRelease [15.0 kB]
Ign:2 http://deb.debian.org/debian stretch InRelease                             
Get:3 http://security.debian.org/debian-security stretch/updates InRelease [53.0 kB]
Get:4 http://deb.debian.org/debian stretch-updates InRelease [93.6 kB]
Get:5 http://deb.debian.org/debian stretch Release [118 kB]     
Get:6 http://deb.debian.org/debian stretch Release.gpg [2410 B]
Get:7 http://archive.raspbian.org/raspbian stretch/non-free armhf Packages [98.9 kB]
Get:8 http://security.debian.org/debian-security stretch/updates/main armhf Packages [540 kB]
Get:9 http://archive.raspbian.org/raspbian stretch/main armhf Packages [11.7 MB]
Get:10 http://archive.raspbian.org/raspbian stretch/contrib armhf Packages [56.9 kB]
Get:11 http://deb.debian.org/debian stretch-updates/main armhf Packages [2576 B]
Get:12 http://deb.debian.org/debian stretch/main armhf Packages [6908 kB]                                           
96% [9 Packages store 0 B]                                                                              1101 kB/s 0spi@rpiCloudkey:~/unifi $ docker exec -it unifi /bin/bash
root@rpiCloudkey:/var/lib/unifi# apt-get install net-tools
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package net-tools
root@rpiCloudkey:/var/lib/unifi# netstat
bash: netstat: command not found
root@rpiCloudkey:/var/lib/unifi# apt-get update
Get:1 http://archive.raspbian.org/raspbian stretch InRelease [15.0 kB]
Get:2 http://security.debian.org/debian-security stretch/updates InRelease [53.0 kB]
Ign:3 http://deb.debian.org/debian stretch InRelease                                         
Get:4 http://deb.debian.org/debian stretch-updates InRelease [93.6 kB]
Get:5 http://deb.debian.org/debian stretch Release [118 kB]
Get:6 http://deb.debian.org/debian stretch Release.gpg [2410 B]
Get:7 http://security.debian.org/debian-security stretch/updates/main armhf Packages [540 kB]
0% [1 InRelease gpgv 15.0 kB] [7 Packages 540 kB]pi@rpiCloudkey:~/unifi $ docker exec  unifi apt-get update 
Ign:1 http://deb.debian.org/debian stretch InRelease
Get:2 http://archive.raspbian.org/raspbian stretch InRelease [15.0 kB]
Get:3 http://deb.debian.org/debian stretch-updates InRelease [93.6 kB]
Get:4 http://security.debian.org/debian-security stretch/updates InRelease [53.0 kB]
Get:5 http://deb.debian.org/debian stretch Release [118 kB]
Get:6 http://deb.debian.org/debian stretch Release.gpg [2410 B]
Get:7 http://archive.raspbian.org/raspbian stretch/contrib armhf Packages [56.9 kB]
Get:8 http://deb.debian.org/debian stretch-updates/main armhf Packages [2576 B]
Get:9 http://archive.raspbian.org/raspbian stretch/main armhf Packages [11.7 MB]
Get:10 http://archive.raspbian.org/raspbian stretch/non-free armhf Packages [98.9 kB]
Get:11 http://security.debian.org/debian-security stretch/updates/main armhf Packages [540 kB]
Get:12 http://deb.debian.org/debian stretch/main armhf Packages [6908 kB]
pi@rpiCloudkey:~/unifi $
ryansch commented 4 years ago

That is so very strange. Bash appears to exit immediately.

Try the docker-compose rm -sf unifi; docker-compose up -d dance after your pull finishes. Hopefully that clears things up.

ryansch commented 4 years ago

If you want to make a manual backup of your docker volume, you can use the instructions here: https://github.com/ryansch/docker-unifi-rpi/wiki/Getting-Started-on-a-Raspberry-Pi#hypriot-upgrade

I don't expect anything to go sideways with upgrading in place (I do it all the time), but it might be a good idea to be extra safe here.

DiMilan commented 4 years ago

Very interesting problem :)

I think i'm going for the backup just to make sure :)

pi@rpiCloudkey:~/unifi $ docker-compose rm -sf unifi
Stopping unifi ... done
Going to remove unifi
Removing unifi ... done
pi@rpiCloudkey:~/unifi $ docker-compose up -d
Creating unifi ... done
pi@rpiCloudkey:~/unifi $ docker-compose ps
Name               Command               State   Ports
------------------------------------------------------
unifi   /sbin/tini -g -- /docker-e ...   Up           
pi@rpiCloudkey:~/unifi $ docker ps
CONTAINER ID        IMAGE                      COMMAND                  CREATED             STATUS              PORTS               NAMES
be023620d7da        ryansch/unifi-rpi:latest   "/sbin/tini -g -- /d…"   41 seconds ago      Up 12 seconds                           unifi
pi@rpiCloudkey:~/unifi $ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ryansch/unifi-rpi   latest              bde8fb6556c1        7 days ago          615MB
ryansch/unifi-rpi   <none>              c8630be24004        11 months ago       496MB
pi@rpiCloudkey:~/unifi $
ryansch commented 4 years ago

Why are there two of them?

Can you try manually stopping and removing c8630be24004? You'll likely need to restart the new latest after that.

Edit: Bah, I misread your docker images as docker ps.

DiMilan commented 4 years ago

Yeah I've already deleted the old image just to make sure but no avail. ¯_(ツ)_/¯

ryansch commented 4 years ago

Ok two ideas:

  1. I'm noticing earlier when you ran netstat on the host that you didn't supply -lpn. By default netstat won't show sockets in state LISTEN.
  2. We don't have to run netstat from within the container as we're using network_mode: host. 🤦
DiMilan commented 4 years ago
pi@rpiCloudkey:~/unifi $ netstat -lpn 
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      -                   
tcp6       0      0 :::139                  :::*                    LISTEN      -                   
tcp6       0      0 :::8080                 :::*                    LISTEN      -                   
tcp6       0      0 :::22                   :::*                    LISTEN      -                   
tcp6       0      0 ::1:3350                :::*                    LISTEN      -                   
tcp6       0      0 :::443                  :::*                    LISTEN      -                   
tcp6       0      0 :::3389                 :::*                    LISTEN      -                   
tcp6       0      0 :::445                  :::*                    LISTEN      -                   
tcp6       0      0 :::6144                 :::*                    LISTEN      -                   
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           -                   
udp        0      0 0.0.0.0:37931           0.0.0.0:*                           -                   
udp        0      0 0.0.0.0:68              0.0.0.0:*                           -                   
udp        0      0 172.17.255.255:137      0.0.0.0:*                           -                   
udp        0      0 172.17.0.1:137          0.0.0.0:*                           -                   
udp        0      0 192.168.31.255:137      0.0.0.0:*                           -                   
udp        0      0 192.168.31.126:137      0.0.0.0:*                           -                   
udp        0      0 0.0.0.0:137             0.0.0.0:*                           -                   
udp        0      0 172.17.255.255:138      0.0.0.0:*                           -                   
udp        0      0 172.17.0.1:138          0.0.0.0:*                           -                   
udp        0      0 192.168.31.255:138      0.0.0.0:*                           -                   
udp        0      0 192.168.31.126:138      0.0.0.0:*                           -                   
udp        0      0 0.0.0.0:138             0.0.0.0:*                           -                   
udp6       0      0 :::5353                 :::*                                -                   
udp6       0      0 :::36315                :::*                                -                   
raw6       0      0 :::58                   :::*                    7           -                   
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node   PID/Program name     Path
unix  2      [ ACC ]     STREAM     LISTENING     16399    -                    /var/run/docker/metrics.sock
unix  2      [ ACC ]     STREAM     LISTENING     17949    808/menu-cached      /run/user/1000/menu-cached-:0
unix  2      [ ACC ]     STREAM     LISTENING     13841    -                    @/tmp/.X11-unix/X0
unix  2      [ ACC ]     STREAM     LISTENING     8998     -                    /var/run/dbus/system_bus_socket
unix  2      [ ACC ]     STREAM     LISTENING     9002     -                    /run/avahi-daemon/socket
unix  2      [ ACC ]     STREAM     LISTENING     9006     -                    /var/run/docker.sock
unix  2      [ ACC ]     STREAM     LISTENING     9009     -                    /run/thd.socket
unix  2      [ ACC ]     STREAM     LISTENING     109320   -                    @/containerd-shim/moby/7c9242a0fb15d09e6adc5aefcc6c8176ef342d9c07b0b9080bf3c9e81bf33209/shim.sock@
unix  2      [ ACC ]     STREAM     LISTENING     15829    -                    /tmp/ssh-AF97lNSwVUiB/agent.569
unix  2      [ ACC ]     STREAM     LISTENING     15431    -                    /run/containerd/containerd.sock
unix  2      [ ACC ]     STREAM     LISTENING     17764    -                    /tmp/ssh-brOjrs1Llem4/agent.728
unix  2      [ ACC ]     STREAM     LISTENING     13842    -                    /tmp/.X11-unix/X0
unix  2      [ ACC ]     STREAM     LISTENING     17794    721/pcmanfm          /run/user/1000/pcmanfm-socket--0
unix  2      [ ACC ]     STREAM     LISTENING     17553    -                    /var/run/docker/libnetwork/47ea0804bb69.sock
unix  2      [ ACC ]     STREAM     LISTENING     9132     -                    /var/run/dhcpcd.sock
unix  2      [ ACC ]     STREAM     LISTENING     9134     -                    /var/run/dhcpcd.unpriv.sock
unix  2      [ ACC ]     STREAM     LISTENING     8113     -                    /run/systemd/private
unix  2      [ ACC ]     STREAM     LISTENING     8119     -                    /run/systemd/fsck.progress
unix  2      [ ACC ]     STREAM     LISTENING     8127     -                    /run/systemd/journal/stdout
unix  2      [ ACC ]     STREAM     LISTENING     15073    473/systemd          /run/user/1000/systemd/private
unix  2      [ ACC ]     SEQPACKET  LISTENING     8164     -                    /run/udev/control
unix  2      [ ACC ]     STREAM     LISTENING     15081    473/systemd          /run/user/1000/gnupg/S.dirmngr
unix  2      [ ACC ]     STREAM     LISTENING     15084    473/systemd          /run/user/1000/gnupg/S.gpg-agent.browser
unix  2      [ ACC ]     STREAM     LISTENING     15086    473/systemd          /run/user/1000/bus
unix  2      [ ACC ]     STREAM     LISTENING     15088    473/systemd          /run/user/1000/gnupg/S.gpg-agent.extra
unix  2      [ ACC ]     STREAM     LISTENING     15090    473/systemd          /run/user/1000/gnupg/S.gpg-agent.ssh
unix  2      [ ACC ]     STREAM     LISTENING     15092    473/systemd          /run/user/1000/gnupg/S.gpg-agent
unix  2      [ ACC ]     STREAM     LISTENING     15358    -                    /var/run/samba/nmbd/unexpected
pi@rpiCloudkey:~/unifi $ 
ryansch commented 4 years ago

So something is listening on that port! If you run it again as root, it'll fill out that last column.

DiMilan commented 4 years ago

So apparently the host is listening on 8080 but I can't make anything out of it...

DiMilan commented 4 years ago
pi@rpiCloudkey:~/unifi $ sudo -i
root@rpiCloudkey:~# netstat -lpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      661/smbd            
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      394/sshd            
tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      661/smbd            
tcp6       0      0 :::139                  :::*                    LISTEN      661/smbd            
tcp6       0      0 :::8080                 :::*                    LISTEN      420/domoticz        
tcp6       0      0 :::22                   :::*                    LISTEN      394/sshd            
tcp6       0      0 ::1:3350                :::*                    LISTEN      375/xrdp-sesman     
tcp6       0      0 :::443                  :::*                    LISTEN      420/domoticz        
tcp6       0      0 :::3389                 :::*                    LISTEN      390/xrdp            
tcp6       0      0 :::445                  :::*                    LISTEN      661/smbd            
tcp6       0      0 :::6144                 :::*                    LISTEN      420/domoticz        
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           263/avahi-daemon: r 
udp        0      0 0.0.0.0:37931           0.0.0.0:*                           263/avahi-daemon: r 
udp        0      0 0.0.0.0:68              0.0.0.0:*                           328/dhcpcd          
udp        0      0 172.17.255.255:137      0.0.0.0:*                           336/nmbd            
udp        0      0 172.17.0.1:137          0.0.0.0:*                           336/nmbd            
udp        0      0 192.168.31.255:137      0.0.0.0:*                           336/nmbd            
udp        0      0 192.168.31.126:137      0.0.0.0:*                           336/nmbd            
udp        0      0 0.0.0.0:137             0.0.0.0:*                           336/nmbd            
udp        0      0 172.17.255.255:138      0.0.0.0:*                           336/nmbd            
udp        0      0 172.17.0.1:138          0.0.0.0:*                           336/nmbd            
udp        0      0 192.168.31.255:138      0.0.0.0:*                           336/nmbd            
udp        0      0 192.168.31.126:138      0.0.0.0:*                           336/nmbd            
udp        0      0 0.0.0.0:138             0.0.0.0:*                           336/nmbd            
udp6       0      0 :::5353                 :::*                                263/avahi-daemon: r 
udp6       0      0 :::36315                :::*                                263/avahi-daemon: r 
raw6       0      0 :::58                   :::*                    7           328/dhcpcd          
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node   PID/Program name     Path
unix  2      [ ACC ]     STREAM     LISTENING     16399    346/dockerd          /var/run/docker/metrics.sock
unix  2      [ ACC ]     STREAM     LISTENING     17949    808/menu-cached      /run/user/1000/menu-cached-:0
unix  2      [ ACC ]     STREAM     LISTENING     13841    396/Xorg             @/tmp/.X11-unix/X0
unix  2      [ ACC ]     STREAM     LISTENING     8998     1/init               /var/run/dbus/system_bus_socket
unix  2      [ ACC ]     STREAM     LISTENING     9002     1/init               /run/avahi-daemon/socket
unix  2      [ ACC ]     STREAM     LISTENING     9006     1/init               /var/run/docker.sock
unix  2      [ ACC ]     STREAM     LISTENING     9009     1/init               /run/thd.socket
unix  2      [ ACC ]     STREAM     LISTENING     110450   17239/containerd-sh  @/containerd-shim/moby/7c9242a0fb15d09e6adc5aefcc6c8176ef342d9c07b0b9080bf3c9e81bf33209/shim.sock@
unix  2      [ ACC ]     STREAM     LISTENING     15829    659/ssh-agent        /tmp/ssh-AF97lNSwVUiB/agent.569
unix  2      [ ACC ]     STREAM     LISTENING     15431    343/containerd       /run/containerd/containerd.sock
unix  2      [ ACC ]     STREAM     LISTENING     17764    734/ssh-agent        /tmp/ssh-brOjrs1Llem4/agent.728
unix  2      [ ACC ]     STREAM     LISTENING     13842    396/Xorg             /tmp/.X11-unix/X0
unix  2      [ ACC ]     STREAM     LISTENING     17794    721/pcmanfm          /run/user/1000/pcmanfm-socket--0
unix  2      [ ACC ]     STREAM     LISTENING     17553    346/dockerd          /var/run/docker/libnetwork/47ea0804bb69.sock
unix  2      [ ACC ]     STREAM     LISTENING     9132     328/dhcpcd           /var/run/dhcpcd.sock
unix  2      [ ACC ]     STREAM     LISTENING     9134     328/dhcpcd           /var/run/dhcpcd.unpriv.sock
unix  2      [ ACC ]     STREAM     LISTENING     8113     1/init               /run/systemd/private
unix  2      [ ACC ]     STREAM     LISTENING     8119     1/init               /run/systemd/fsck.progress
unix  2      [ ACC ]     STREAM     LISTENING     8127     1/init               /run/systemd/journal/stdout
unix  2      [ ACC ]     STREAM     LISTENING     15073    473/systemd          /run/user/1000/systemd/private
unix  2      [ ACC ]     SEQPACKET  LISTENING     8164     1/init               /run/udev/control
unix  2      [ ACC ]     STREAM     LISTENING     15081    473/systemd          /run/user/1000/gnupg/S.dirmngr
unix  2      [ ACC ]     STREAM     LISTENING     15084    473/systemd          /run/user/1000/gnupg/S.gpg-agent.browser
unix  2      [ ACC ]     STREAM     LISTENING     15086    473/systemd          /run/user/1000/bus
unix  2      [ ACC ]     STREAM     LISTENING     15088    473/systemd          /run/user/1000/gnupg/S.gpg-agent.extra
unix  2      [ ACC ]     STREAM     LISTENING     15090    473/systemd          /run/user/1000/gnupg/S.gpg-agent.ssh
unix  2      [ ACC ]     STREAM     LISTENING     15092    473/systemd          /run/user/1000/gnupg/S.gpg-agent
unix  2      [ ACC ]     STREAM     LISTENING     15358    336/nmbd             /var/run/samba/nmbd/unexpected
root@rpiCloudkey:~# 
ryansch commented 4 years ago

It looks like you have a home automation service running on that port.

/me googled domoticz

ryansch commented 4 years ago

Can you visit the controller directly on port 8443? or does the controller fail to start up?

DiMilan commented 4 years ago

Yeah I see now. Domoticz is running on the same port. Feel like a moron right now. No webservice on 8443 is not up

ryansch commented 4 years ago

No worries! There's a very good reason I know how to use netstat -lpn without having to look it up...

I've been here many times!

DiMilan commented 4 years ago

Yeah, anyway, I really learned a lot topday! Very much appreciated! :) I'll try to kill Domoticz as I don't use it anyway and keep you posted!

ryansch commented 4 years ago

That's great! I'm glad to be able to help!

If you're running systemd, you might be able to do a systemctl stop domoticz.

DiMilan commented 4 years ago

yeah I killed the proces first (domoticz in top) and then looked for the package to remove it but strangely enough couldn't find it

root@rpiCloudkey:~# dpkg -l | grep domoticz
root@rpiCloudkey:~# 

But anyway, it's been a great success! It's working now 👍

ryansch commented 4 years ago

Great!

ewheeler commented 3 years ago

@DiMilan @ryansch thanks for working through this in such detail!

i was experiencing similar, baffling behavior- and this thread led to my discovery that zookeeper (also running on my RPI) has a web UI enabled by default and that its default port is 8080!

funny enough, if docker-unifi-rpi starts up first, then zookeeper will silently choose a different port for its web UI- which added a mysterious race condition such that i saw this baffling behavior only intermittently over many many weeks.

thanks again!