goofball222 / unifi

UniFi Docker Container
Apache License 2.0
251 stars 38 forks source link

goofball222/unifi:latest-beta 7.2.92 - "DBServer stopped" #103

Closed srrsparky closed 2 years ago

srrsparky commented 2 years ago

Reporting bugs/issues

Sorry - just quickly - using image goofball222/unifi:latest-beta

get constant repeating DBServer stopped after update to 7.2.92.

[2022-08-10T02:02:11,937] XXX <db-server> INFO db - 2022-08-10T02:02:11.936+0000 I STORAGE [main] Engine custom option: cache_size=256M [2022-08-10T02:02:11,951] XXX <db-server> INFO db - DbServer stopped

kodek commented 2 years ago

I did some poking around, and I found a workaround for my install. I don't actually know what's changed between these two versions, though. It seems to be a permission issue with /var/run/unifi.

From /usr/lib/unifi/logs/mongodb.log:

...
2022-08-12T05:32:03.033+0000 I CONTROL  [main] ***** SERVER RESTARTED *****
2022-08-12T05:32:03.038+0000 I CONTROL  [main] ERROR: Cannot write pid file to /usr/lib/unifi/run/mongod.pid: Permission denied
...

Going into the container:

docker exec -it unifi /bin/bash

Checking permissions. Everything seems fine here:

root@docker:/usr/lib/unifi# ls -nsah
total 68K
8.0K drwxr-xr-x 1 1000 1004 4.0K Aug 12 04:02 .
8.0K drwxr-xr-x 1    0    0 4.0K Aug  8 19:03 ..
8.0K drwxr-xr-x 1 1000 1004 4.0K Aug  8 19:03 bin
4.0K drwxr-xr-x 2 1000 1004 4.0K Sep  2  2018 cert
   0 lrwxrwxrwx 1 1000 1004   14 Aug  8 19:03 data -> /var/lib/unifi
8.0K drwxr-xr-x 1 1000 1004 4.0K Aug  8 19:03 dl
 16K drwxr-xr-x 1 1000 1004  12K Aug  8 19:03 lib
   0 lrwxrwxrwx 1 1000 1004   14 Aug  8 19:03 logs -> /var/log/unifi
   0 lrwxrwxrwx 1 1000 1004   14 Aug  8 19:03 run -> /var/run/unifi
4.0K -rw-r--r-- 1 1000 1004 1.2K Aug  8 19:00 system.properties.default
8.0K drwxr-xr-x 1 1000 1004 4.0K Aug  8 19:03 webapps
4.0K drwxr-xr-x 3 1000 1004 4.0K Aug 12 04:02 work

Following the symlink:

root@docker:/usr/lib/unifi# cd /var/run
root@docker:/var/run# ls -nsah
total 16K
4.0K drwxr-xr-x 1   0   0 4.0K Aug  8 19:03 .
4.0K drwxr-xr-x 1   0   0 4.0K Aug 12 05:31 ..
4.0K drwxrwxrwt 2   0   0 4.0K Aug  1 00:00 lock
4.0K drwxr-x--- 2 999 999 4.0K Aug  8 19:03 unifi
   0 -rw-rw-r-- 1   0  43    0 Aug  1 00:00 utmp

Notice how the unifi directory wasn't fixed by chown at startup. We can fix it manually, at least for this instance:

root@docker:/var/run# chown 1000:1004 -R unifi
root@docker:/var/run# exit

Checking mongod.log again:

tail -f mongod.log
2022-08-12T05:32:47.632+0000 I CONTROL  [initandlisten] build environment:
2022-08-12T05:32:47.632+0000 I CONTROL  [initandlisten]     distmod: debian92
2022-08-12T05:32:47.632+0000 I CONTROL  [initandlisten]     distarch: x86_64
2022-08-12T05:32:47.632+0000 I CONTROL  [initandlisten]     target_arch: x86_64
...
srrsparky commented 2 years ago

There's a couple of comments about the directories in the release forum: https://community.ui.com/releases/UniFi-Network-Application-7-2-92/f1903cbc-4daa-4695-ac8c-7324bcff529a

kodek commented 2 years ago

I'm pretty new at contributing on Github, but I figured I'd try to fix this myself. Sent out #104. Hopefully it's done correctly :)