Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UISP not starting Symbolic link loop - database dir not found. #68

Open
Raka74 opened this issue Jun 2, 2022 · 20 comments
Open

UISP not starting Symbolic link loop - database dir not found. #68

Raka74 opened this issue Jun 2, 2022 · 20 comments

Comments

@Raka74
Copy link

Raka74 commented Jun 2, 2022

Hi Nico640, Thanks for making UNMS available in a Docker image 👍
I've run this before on my NAS without problems but now after a re-install it looks like it will not start.

In the logging firstly I see a lot of these messages:

_mkdir: cannot create directory ‘/data’: Symbolic link loop
chown: cannot access '/data/ucrm/data/import/csv': Symbolic link loop
chmod: cannot access '/data/ucrm/data/import/csv': Symbolic link loop

{"message":"Creating /data/ucrm/data/ticketing/attachments.","channel":"dirs.sh","datetime":"2022-06-02T13:08:31+00:00","severity":"INFO","level":200}

mkdir: cannot create directory ‘/data’: Symbolic link loop
chown: cannot access '/data/ucrm/data/ticketing/attachments': Symbolic link loop
chmod: cannot access '/data/ucrm/data/ticketing/attachments': Symbolic link loop

{"message":"Creating /data/ucrm/data/mailing/attachments.","channel":"dirs.sh","datetime":"2022-06-02T13:08:31+00:00","severity":"INFO","level":200}

{"message":"Creating symbolic links for /data/updates.","channel":"dirs.sh","datetime":"2022-06-02T13:08:31+00:00","severity":"INFO","level":200}

nginx: [emerg] open() "/data/log/ucrm/nginx/suspended_service_access.log" failed (40: Symbolic link loop)

{"message":"Publishing current /usr/src/ucrm/app/config/version.yml.","channel":"dirs.sh","datetime":"2022-06-02T13:08:31+00:00","severity":"INFO","level":200}

cp: cannot remove '/data/updates/version.yml': Symbolic link loop
chown: cannot access '/data/updates': Symbolic link loop
chmod: cannot access '/data/updates': Symbolic link loop
{"message":"Done creating symbolic links.","channel":"dirs.sh","datetime":"2022-06-02T13:08:31+00:00","severity":"INFO","level":200}

/usr/src/ucrm/scripts/parameters.sh

That seems to be repeating.

After this I see:

[W 2022-06-02 13:08:32] Database directory not found, creating directory '/var/lib/siridb'.

[E 2022-06-02 13:08:32] Cannot create directory '/var/lib/siridb'.

{"message":"Replacing configuration parameters.","channel":"parameters.sh","datetime":"2022-06-02T13:08:32+00:00","severity":"INFO","level":200}

I hope you can help here?

@Nico640
Copy link
Owner

Nico640 commented Jun 2, 2022

Hi, sounds like there's a problem with the /config mapping. How exactly did you re-install the container? Make sure you have the /config directory inside the container mapped to a location on your NAS and try to re-create the container (delete the container and re-create it with the same parameters)

@Raka74
Copy link
Author

Raka74 commented Jun 2, 2022

I have mapped /config like this:

image

Everything in there I deleted and I completely removed the container and re downloaded the 'latest' image.
When I start the container there are three folders created:

postgres, cert and usercert.

@Raka74
Copy link
Author

Raka74 commented Jun 3, 2022

Here is another part of the log, when just starting up:

$ sudo -i

clear

docker run -p 8765:80 -p 4443:443 -p 2055:2055/udp -e TZ=Europe/Amsterdam -v /volume1/docker/UNMS:/config nico640/docker-unms:latest

[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] 10-set-timezone: executing...
[cont-init.d] 10-set-timezone: exited 0.
[cont-init.d] 20-adduser: executing...


GID/UID

User uid: 911
User gid: 911

[cont-init.d] 20-adduser: exited 0.
[cont-init.d] 30-prepare: executing...
mv: failed to access '/config/siridb': Symbolic link loop
mv: failed to access '/config/unms': Symbolic link loop
mv: failed to access '/config/unms/ucrm': Symbolic link loop
mv: failed to access '/config/unms/images': Symbolic link loop
mkdir: cannot create directory ‘/config/unms’: Symbolic link loop
[cont-init.d] 30-prepare: exited 0.
[cont-init.d] 40-permissions: executing...
[cont-init.d] 40-permissions: exited 0.
[cont-init.d] 50-postgres: executing...
The files belonging to this database system will be owned by user "unms".
This user must also own the server process.

The database cluster will be initialized with locales
COLLATE: C
CTYPE: C.UTF-8
MESSAGES: C
MONETARY: C
NUMERIC: C
TIME: C
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

creating directory /config/postgres ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 20
selecting default shared_buffers ... 400kB
selecting default time zone ... Europe/Amsterdam
creating configuration files ... ok
running bootstrap script ... 2022-06-03 11:26:20.164 CEST [346] FATAL: data directory "/config/postgres" has invalid permissions
2022-06-03 11:26:20.164 CEST [346] DETAIL: Permissions should be u=rwx (0700) or u=rwx,g=rx (0750).
child process exited with exit code 1
initdb: removing data directory "/config/postgres"
[cont-init.d] 50-postgres: exited 1.
[cont-init.d] done.
[services.d] starting services
Waiting for rabbitmq to start...
Starting nginx...
Starting rabbitmq-server...
[services.d] done.
Starting siridb-server...
Starting postgres...
postgres: could not access directory "/config/postgres": No such file or directory
Run initdb or pg_basebackup to initialize a PostgreSQL data directory.
/tmp:5432 - no response
Waiting for postgres to come up...
/tmp:5432 - no response
Waiting for postgres to come up...
Running entrypoint.sh
Creating nginx configuration
[W 2022-06-03 09:26:20] Database directory not found, creating directory '/var/lib/siridb'.
[E 2022-06-03 09:26:20] Cannot create directory '/var/lib/siridb'.
Enabling UNMS https and wss connections on port 443
Generating self-signed certificate for 'localhost'.
Starting siridb-server...
Starting postgres...
[W 2022-06-03 09:26:21] Database directory not found, creating directory '/var/lib/siridb'.
[E 2022-06-03 09:26:21] Cannot create directory '/var/lib/siridb'.
postgres: could not access directory "/config/postgres": No such file or directory
Run initdb or pg_basebackup to initialize a PostgreSQL data directory.
Starting postgres...
Starting siridb-server...
[W 2022-06-03 09:26:22] Database directory not found, creating directory '/var/lib/siridb'.
[E 2022-06-03 09:26:22] Cannot create directory '/var/lib/siridb'.
postgres: could not access directory "/config/postgres": No such file or directory
Run initdb or pg_basebackup to initialize a PostgreSQL data directory.
Waiting for pid file '/var/lib/rabbitmq/mnesia/[email protected]' to appear
pid is 392
Waiting for erlang distribution on node 'rabbit@0ad5950a097d' while OS process '392' is running
Error:
process_not_running

If I manually create the postgres folder I get:

fixing permissions on existing directory /config/postgres ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Europe/Amsterdam
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... sh: locale: not found
2022-06-03 11:29:00.555 CEST [321] WARNING: no usable system locales were found
ok
syncing data to disk ... ok

Success.

initdb: warning: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
[cont-init.d] 50-postgres: exited 0.
[cont-init.d] done.
[services.d] starting services
Starting rabbitmq-server...
Starting nginx...
Waiting for rabbitmq to start...
Starting siridb-server...
[services.d] done.
Running entrypoint.sh
Creating nginx configuration
/tmp:5432 - no response
/tmp:5432 - no response
Waiting for postgres to come up...
Waiting for postgres to come up...
Starting postgres...
Enabling UNMS https and wss connections on port 443
[W 2022-06-03 09:29:02] Database directory not found, creating directory '/var/lib/siridb'.
[E 2022-06-03 09:29:02] Cannot create directory '/var/lib/siridb'.
2022-06-03 11:29:02.619 CEST [560] LOG: starting PostgreSQL 13.5 on x86_64-alpine-linux-musl, compiled by gcc (Alpine 10.2.1_pre1) 10.2.1 20201203, 64-bit

@Nico640
Copy link
Owner

Nico640 commented Jun 6, 2022

Weird, can you open a shell in the container and check if for example /var/lib/siridb is a link or a directory? It should point to the /config/siridb directory. I suspect that the 30-prepare script is trying to copy the contents of for example /var/lib/siridb to /config/siridb even though /var/lib/siridb is already a link which causes the loop. I think that I have only seen something like this if you delete the contents of the /config mapping but don't actually re-create the container. Also, can try using the 1.4.4 tag? There shouldn't be any difference, but just to make sure it is using a clean container.

@Raka74
Copy link
Author

Raka74 commented Jun 9, 2022

/var/lib/siridb is a link,
this is what I see:

bash-5.1# ls -la
total 4
drwxr-xr-x 1 root     root     82 Jun  9 09:12 .
drwxr-xr-x 1 root     root     90 Apr 22 22:54 ..
drwxr-xr-x 1 root     root      0 Nov 12  2021 apk
drwxr-xr-x 1 root     root      0 Nov 12  2021 misc
drwxr-x--- 1 postgres postgres  0 Jan 29 19:26 postgresql
drwxr-xr-x 1 root     root     40 Jun  9 09:12 rabbitmq
lrwxrwxrwx 1 root     root     14 Jun  9 09:12 siridb -> /config/siridb
drwx--x--x 1 root     root     16 Jan 29 19:26 sudo
drwxr-xr-x 1 root     root      0 Nov 12  2021 udhcpd
bash-5.1# 

Here is the env and volume settings:

image

Still getting:

Running entrypoint.sh Starting postgres... Creating nginx configuration postgres: could not access directory "/config/postgres": No such file or directory Run initdb or pg_basebackup to initialize a PostgreSQL data directory. Enabling UNMS https and wss connections on port 443 /tmp:5432 - no response Waiting for postgres to come up... /tmp:5432 - no response Waiting for postgres to come up... Will use existing SSL certificate Entrypoint finished Calling exec nginx: [emerg] open() "/data/log/ucrm/nginx/suspended_service_access.log" failed (40: Symbolic link loop) Starting siridb-server... Starting nginx... Running entrypoint.sh [W 2022-06-09 09:28:11] Database directory not found, creating directory '/var/lib/siridb'. [E 2022-06-09 09:28:11] Cannot create directory '/var/lib/siridb'. Starting postgres... Creating nginx configuration postgres: could not access directory "/config/postgres": No such file or directory Run initdb or pg_basebackup to initialize a PostgreSQL data directory. Enabling UNMS https and wss connections on port 443

In /volume1/docker/UNMS only

/usercert and /cert directories are created.

@Nico640
Copy link
Owner

Nico640 commented Jun 10, 2022

Please delete the contents of the /config volume and try out the image tag issue-68. It should (hopefully) fix the symbolic link issues you're having.

@Raka74
Copy link
Author

Raka74 commented Jun 16, 2022

Hi @Nico640 ,

I did this but unfortunately no success

Here is logging from issue-68 run with cleaned /config volume:

`
[W 2022-06-16 08:34:56] Database directory not found, creating directory '/var/lib/siridb'.
[E 2022-06-16 08:34:56] Cannot create directory '/var/lib/siridb'.
postgres: could not access directory "/config/postgres": No such file or directory
Run initdb or pg_basebackup to initialize a PostgreSQL data directory.
Entrypoint finished
Calling exec
/tmp:5432 - no response
Waiting for postgres to come up...
/tmp:5432 - no response
Waiting for postgres to come up...
nginx: [emerg] open() "/data/log/ucrm/nginx/suspended_service_access.log" failed (40: Symbolic link loop)

## RabbitMQ 3.7.14. Copyright (C) 2007-2019 Pivotal Software, Inc.

########## Licensed under the MPL. See https://www.rabbitmq.com/

########## Logs: /var/log/rabbitmq/[email protected]
/var/log/rabbitmq/rabbit@53e790705d96_upgrade.log

          Starting broker...

Starting nginx...
Running entrypoint.sh
Creating nginx configuration
Enabling UNMS https and wss connections on port 443
Starting postgres...
Starting siridb-server...
[W 2022-06-16 08:34:57] Database directory not found, creating directory '/var/lib/siridb'.
[E 2022-06-16 08:34:57] Cannot create directory '/var/lib/siridb'.
postgres: could not access directory "/config/postgres": No such file or directory
Run initdb or pg_basebackup to initialize a PostgreSQL data directory.
`

I then tried connecting to the container - creating a postgres folder in /config and after this running initdb
But this only gets it a little bit further, in the logging I no longer see the EM about postrgres but:

`
[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] 10-set-timezone: executing...
[cont-init.d] 10-set-timezone: exited 0.
[cont-init.d] 20-adduser: executing...


GID/UID

User uid: 911
User gid: 911

[cont-init.d] 20-adduser: exited 0.
[cont-init.d] 30-prepare: executing...
sh: missing ]
mkdir: cannot create directory ‘/config/siridb’: File exists
sh: missing ]
mkdir: cannot create directory ‘/config/unms’: File exists
sh: missing ]
mkdir: cannot create directory ‘/config/unms/ucrm’: Symbolic link loop
sh: missing ]
sh: missing ]
mkdir: cannot create directory ‘/config/unms/images’: Symbolic link loop
mkdir: cannot create directory ‘/config/unms’: Symbolic link loop
[cont-init.d] 30-prepare: exited 0.
[cont-init.d] 40-permissions: executing...
[cont-init.d] 40-permissions: exited 0.
[cont-init.d] 50-postgres: executing...
Database already configured
[cont-init.d] 50-postgres: exited 0.
[cont-init.d] done.
[services.d] starting services
Starting nginx...
Waiting for rabbitmq to start...
Starting siridb-server...
Starting rabbitmq-server...
[services.d] done.
Running entrypoint.sh
Creating nginx configuration
Starting postgres...
Enabling UNMS https and wss connections on port 443
[W 2022-06-16 08:44:31] Database directory not found, creating directory '/var/lib/siridb'.
[E 2022-06-16 08:44:31] Cannot create directory '/var/lib/siridb'.
/tmp:5432 - no response
Waiting for postgres to come up...
/tmp:5432 - no response
Waiting for postgres to come up...
Starting siridb-server...
Will use existing SSL certificate
[W 2022-06-16 08:44:32] Database directory not found, creating directory '/var/lib/siridb'.
[E 2022-06-16 08:44:32] Cannot create directory '/var/lib/siridb'.
2022-06-16 08:44:32.772 UTC [561] LOG: starting PostgreSQL 13.5 on x86_64-alpine-linux-musl, compiled by gcc (Alpine 10.2.1_pre1) 10.2.1 20201203, 64-bit
2022-06-16 08:44:32.775 UTC [561] LOG: listening on IPv4 address "127.0.0.1", port 5432
2022-06-16 08:44:32.775 UTC [561] LOG: could not bind IPv6 address "::1": Address not available
2022-06-16 08:44:32.775 UTC [561] HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
Entrypoint finished
Calling exec
2022-06-16 08:44:33.061 UTC [561] LOG: listening on Unix socket "/run/postgresql/.s.PGSQL.5432"
2022-06-16 08:44:33.270 UTC [561] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
2022-06-16 08:44:33.354 UTC [648] LOG: database system was shut down at 2022-06-16 08:43:10 UTC
2022-06-16 08:44:33.380 UTC [561] LOG: database system is ready to accept connections
nginx: [emerg] open() "/data/log/ucrm/nginx/suspended_service_access.log" failed (40: Symbolic link loop)
Starting nginx...
Running entrypoint.sh
Creating nginx configuration
Starting siridb-server...
[W 2022-06-16 08:44:33] Database directory not found, creating directory '/var/lib/siridb'.
[E 2022-06-16 08:44:33] Cannot create directory '/var/lib/siridb'.
Enabling UNMS https and wss connections on port 443
Will use existing SSL certificate
Waiting for pid file '/var/lib/rabbitmq/mnesia/[email protected]' to appear
pid is 364
Waiting for erlang distribution on node 'rabbit@53e790705d96' while OS process '364' is running
Error:
process_not_running
2022-06-16 08:44:34.373 UTC [816] FATAL: role "root" does not exist
/tmp:5432 - accepting connections
Starting unms-netflow...
tee: /config/unms/logs/unms.log: Symbolic link loop
Entrypoint finished
Calling exec
nginx: [emerg] open() "/data/log/ucrm/nginx/suspended_service_access.log" failed (40: Symbolic link loop)
Starting nginx...
Running entrypoint.sh
Creating nginx configuration
Starting siridb-server...
[W 2022-06-16 08:44:34] Database directory not found, creating directory '/var/lib/siridb'.
[E 2022-06-16 08:44:34] Cannot create directory '/var/lib/siridb'.
Enabling UNMS https and wss connections on port 443
Will use existing SSL certificate
2022-06-16 08:44:35.048 UTC [872] FATAL: role "root" does not exist
/tmp:5432 - accepting connections
2022-06-16 08:44:35.055 UTC [873] FATAL: role "root" does not exist

`

@Nico640
Copy link
Owner

Nico640 commented Jun 18, 2022

The log of the first start seems to be missing the beginning, the interesting part is between [cont-init.d] 30-prepare: executing... and [cont-init.d] 30-prepare: exited 0. on the first start.

Also, there was a syntax error in the script. I have updated the issue-68 tag, please pull it again, start with a clean container and /config volume and check the log between these two lines. The 30-prepare script is responsible for creating the folders and links in /config and it seems to fail to do so on the first start, leaving incorrect symbolic links.

@Raka74
Copy link
Author

Raka74 commented Jun 22, 2022

Hi @Nico640

I pulled it again - here's the part of the log you mentioned:

`
[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] 10-set-timezone: executing...
[cont-init.d] 10-set-timezone: exited 0.
[cont-init.d] 20-adduser: executing...


GID/UID

User uid: 911
User gid: 911

[cont-init.d] 20-adduser: exited 0.
[cont-init.d] 30-prepare: executing...
mv: failed to access '/config/siridb': Symbolic link loop
mkdir: cannot stat ‘/config/siridb’: Symbolic link loop
mv: failed to access '/config/unms': Symbolic link loop
mkdir: cannot stat ‘/config/unms’: Symbolic link loop
mv: failed to access '/config/unms/ucrm': Symbolic link loop
mkdir: cannot create directory ‘/config/unms’: Symbolic link loop
mv: failed to access '/config/unms/images': Symbolic link loop
mkdir: cannot create directory ‘/config/unms’: Symbolic link loop
mkdir: cannot create directory ‘/config/unms’: Symbolic link loop
[cont-init.d] 30-prepare: exited 0.
[cont-init.d] 40-permissions: executing...
[cont-init.d] 40-permissions: exited 0.
[cont-init.d] 50-postgres: executing...
The files belonging to this database system will be owned by user "unms".
This user must also own the server process.

`

@ronaldcs
Copy link

I'm having a similar problem. I did notice that if /var/lib/siridb -> /config/siridb, I see that if I ls /config/siridb, it's a symbolic link to /config/siridb, hence the "Symbolic link loop" error.

@Nico640
Copy link
Owner

Nico640 commented Jun 28, 2022

You're saying /var/lib/siridb is a link to /config/siridb and /config/siridb is also a link to /config/siridb?

I'm still not really sure how this is happening, if you look at the way the link is created (on the issue-68 branch):

#SiriDB
[ ! -e /config/siridb ] && [ -d /var/lib/siridb ] && mv /var/lib/siridb /config/siridb
[ -e /config/siridb ] || mkdir -p /config/siridb
[ -d /var/lib/siridb ] && rm -rf /var/lib/siridb
ln -s /config/siridb /var/lib/siridb

The first two lines should make sure that /config/siridb is a directory. The directory is either moved from /var/lib/siridb (but only if /var/lib/siridb is a directory) or created. The only way I could see this happening is if for some reason, /config/siridb does not exist, but /var/lib/siridb is already a link to /config/siridb, which would presumably create a link from /config/siridb to /config/siridb. However, in every log I have seen so far, /config/siridb is already a symbolic link loop when the 30-prepare script runs: mv: failed to access '/config/siridb': Symbolic link loop.

Interestingly, the line mkdir: cannot stat ‘/config/siridb’: Symbolic link loop implies that the exists check [ -e /config/siridb ] returns false even though /config/siridb exists.

I have added more logging to the issue-68 image. Please run it again and post the log for 30-prepare again. Also, please try running the container without mapping a directory to /config. Does it work without the mapping?

@Raka74
Copy link
Author

Raka74 commented Jul 1, 2022

I've pulled it again.

Running the container without the mapping works for me. (I guess you don't need to see the logs of that)

I then stopped it an recreated the container with the mapping:

image

Issue returned - beginning of log:

`
[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] 10-set-timezone: executing...
[cont-init.d] 10-set-timezone: exited 0.
[cont-init.d] 20-adduser: executing...

GID/UID

User uid: 911
User gid: 911

[cont-init.d] 20-adduser: exited 0.
[cont-init.d] 30-prepare: executing...
DEBUG: /config/siridb IS A SYMBOLIC LINK
DEBUG: /config/siridb DOES NOT EXIST 1
DEBUG: /config/siridb DOES NOT EXIST 2
total 64
drwxr-xr-x 1 root root 5228 Apr 22 22:54 bin
drwxrwxrwx 1 unms users 20 Jul 1 10:28 config
drwxr-xr-x 1 unms unms 34 Apr 22 22:40 data
drwxr-xr-x 5 root root 340 Jul 1 10:32 dev
-rwxr-xr-x 1 root root 5806 Mar 29 11:35 entrypoint.sh
drwxr-xr-x 1 root root 1058 Jul 1 10:32 etc
drwxr-xr-x 1 root root 22 Jul 1 10:32 home
-rwxr-xr-x 1 root root 389 Feb 15 2021 init
-rwxr-xr-x 1 root root 5271 Mar 29 11:35 ip-whitelist.sh
drwxr-xr-x 1 root root 992 Apr 22 22:54 lib
drwxr-xr-x 1 root root 104 Dec 19 2021 libexec
drwxr-xr-x 1 root root 28 Nov 12 2021 media
-rwxr-xr-x 1 root root 2095 Apr 22 22:43 migrate.sh
drwxr-xr-x 1 root root 0 Nov 12 2021 mnt
-rw-r--r-- 1 root root 12317 Mar 29 11:35 openssl.cnf
drwxr-xr-x 1 root root 42 Apr 22 22:54 opt
drwxr-xr-x 1 root root 248 Jan 29 19:26 postgres
dr-xr-xr-x 419 root root 0 Jul 1 10:32 proc
-rwxr-xr-x 1 root root 8927 Mar 29 11:35 refresh-certificate.sh
-rwxr-xr-x 1 root root 10205 Mar 29 11:35 refresh-configuration.sh
drwx------ 1 root root 56 Apr 22 22:54 root
drwxr-xr-x 1 root root 12 Jul 1 10:32 run
drwxr-xr-x 1 root root 1016 Apr 22 22:54 sbin
drwxr-xr-x 1 root root 0 Nov 12 2021 srv
dr-xr-xr-x 12 root root 0 Jun 9 09:15 sys
drwxrwxrwt 1 root root 288 Apr 22 22:54 tmp
drwxr-xr-x 1 root root 74 Apr 22 22:54 usr
drwxr-xr-x 1 root root 90 Apr 22 22:54 var
drwxr-xr-x 1 root root 12 Apr 22 22:43 www
total 8
lrwxrwxrwx 1 unms unms 14 Sep 23 2020 siridb -> /config/siridb
lrwxrwxrwx 1 unms unms 12 Sep 23 2020 unms -> /config/unms
mv: failed to access '/config/siridb': Symbolic link loop
mkdir: cannot stat ‘/config/siridb’: Symbolic link loop
mv: failed to access '/config/unms': Symbolic link loop
mkdir: cannot stat ‘/config/unms’: Symbolic link loop
mv: failed to access '/config/unms/ucrm': Symbolic link loop
mkdir: cannot create directory ‘/config/unms’: Symbolic link loop
mv: failed to access '/config/unms/images': Symbolic link loop
mkdir: cannot create directory ‘/config/unms’: Symbolic link loop
mkdir: cannot create directory ‘/config/unms’: Symbolic link loop
[cont-init.d] 30-prepare: exited 0.
[cont-init.d] 40-permissions: executing...
[cont-init.d] 40-permissions: exited 0.
[cont-init.d] 50-postgres: executing...
The files belonging to this database system will be owned by user "unms".
This user must also own the server process.

The database cluster will be initialized with locales
COLLATE: C
CTYPE: C.UTF-8
MESSAGES: C
MONETARY: C
NUMERIC: C
TIME: C
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

creating directory /config/postgres ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 20
selecting default shared_buffers ... 400kB
selecting default time zone ... UTC
creating configuration files ... ok
2022-07-01 10:32:26.874 UTC [349] FATAL: data directory "/config/postgres" has invalid permissions
2022-07-01 10:32:26.874 UTC [349] DETAIL: Permissions should be u=rwx (0700) or u=rwx,g=rx (0750).

`

@abjugard
Copy link

abjugard commented Jul 7, 2022

2022-07-01 10:32:26.874 UTC [349] FATAL: data directory "/config/postgres" has invalid permissions
2022-07-01 10:32:26.874 UTC [349] DETAIL: Permissions should be u=rwx (0700) or u=rwx,g=rx (0750).

I'm having similar issues running on a Synology DS918+. Running the latest tag.

@Nico640
Copy link
Owner

Nico640 commented Jul 8, 2022

@abjugard I was able to reproduce the postgres permission issue on a virtual Synology NAS. The directory created by initdb had permissions of 755 instead of 700 or 750, which is probably caused by the umask of 0077 on the NAS. I updated the issue-68 tag, it will now create the /config/postgres directory, change the owner to the unms user and set permissions to 700 prior to executing initdb. Please test it and report back.

@Raka74 The date for the two symbolic links is way in the past, which is odd. What happens if you manually delete the two links and restart the container? Will they be re-created with the same date? Also, please test the new image, as the postgres issue also seems to play a role here.

lrwxrwxrwx 1 unms unms 14 Sep 23 2020 siridb -> /config/siridb
lrwxrwxrwx 1 unms unms 12 Sep 23 2020 unms -> /config/unms

@Raka74
Copy link
Author

Raka74 commented Jul 11, 2022

After I deleted the links and restarted the container everything started working -> UISP is running

Before:
image

After:

image

This was done using the latest issue-68 image -> before deleting the symlinks I did notice the postgres folder was now created in /config

@abjugard
Copy link

Had to delete the volume directory entirely, but after doing so and re-creating it, UISP is now running using tag issue-68!

@gordallott
Copy link

On a fresh setup with no pre-existing install both :latest and :issue-68 have this issue for me on DSM, the issue-68 tag does at least create the postgres directory which latest can't

loops on
image

@Nico640
Copy link
Owner

Nico640 commented Aug 1, 2022

@gordallott Interesting, I thought that the reason behind this is an failed update or re-install, which caused these leftover symbolic links. Can you also try to start a container with the issue-68 tag, open a bash inside the container and delete the invalid links inside /config (there shouldn't be any link in /config, only directories)?

This seems to be an edge case specifically with Synology DSM, but I haven't been able to reproduce it creating these invalid links with the issue-68 tag, but I only tested it in a VM running Synology DSM, as I don't own a Synology NAS. I suspect that the contents of /config somehow persist even when deleting the contents of the mapped directory and re-creating the container. Maybe the init script should delete all links in /config? However that kinda feels like a workaround as these links shouldn't exist in the first place.

@gordallott
Copy link

yup, that did it. I had to restart the container after deleting the two symlinks in /config and then it progressed through just fine, super weird. Maybe something permissions related? lots of permissions warnings in general, thanks for the tip!

@Raka74
Copy link
Author

Raka74 commented Dec 1, 2022

@Nico640

As far as I'm concerned you can close this issue - recreating the links solved the problem.
I think this happening is/was a specific thing on Synology?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants