Secure-Compliance-Solutions-LLC / GVM-Docker

Greenbone Vulnerability Management Docker Image with OpenVAS
https://securecompliance.gitbook.io/projects/
MIT License
248 stars 91 forks source link

Cannot run docker in a compose, getting "useradd: user 'gvm' already exists" #106

Closed Crankinator closed 3 years ago

Crankinator commented 3 years ago

When launching this docker alongside other dockers with a compose, I am having an issue where the docker cannot spin up due to "gvm" already existing.

Tail end snippet of compose-up for the specific service (gvm_1) _gvm_1 | server started gvm_1 | Running first start configuration... gvm_1 | Creating Greenbone Vulnerability system user... gvm1 | useradd: user 'gvm' already exists

Snippet of docker-compose services: _gvm: image: securecompliance/gvm ports:

I am using an .env file for some other containers. Could that be the cause of this issue?

I have also tried using env_file: in the gvm service area with the env file in my directory stating PASSWORD=testpassword

When I then try to start the service, it tries to chown and can't "chown: cannot access '/usr/local/var/lib/openvas': No such file or directory"

And then it loops back and can't start because the user already exists.

gvm_1 | 9:C 03 Nov 2020 21:31:21.257 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo gvm_1 | 9:C 03 Nov 2020 21:31:21.257 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=9, just started gvm_1 | 9:C 03 Nov 2020 21:31:21.257 # Configuration loaded gvm_1 | Wait for redis socket to be created... gvm_1 | Testing redis status... gvm_1 | Redis ready. gvm_1 | Creating Data folder... gvm_1 | Creating Database folder... gvm_1 | The files belonging to this database system will be owned by user "postgres". gvm_1 | This user must also own the server process. gvm_1 | gvm_1 | The database cluster will be initialized with locale "C.UTF-8". gvm_1 | The default database encoding has accordingly been set to "UTF8". gvm_1 | The default text search configuration will be set to "english". gvm_1 | gvm_1 | Data page checksums are disabled. gvm_1 | gvm_1 | fixing permissions on existing directory /data/database ... ok gvm_1 | creating subdirectories ... ok gvm_1 | selecting dynamic shared memory implementation ... posix gvm_1 | selecting default max_connections ... 100 gvm_1 | selecting default shared_buffers ... 128MB gvm_1 | selecting default time zone ... Etc/UTC gvm_1 | creating configuration files ... ok gvm_1 | running bootstrap script ... ok gvm_1 | performing post-bootstrap initialization ... ok gvm_1 | syncing data to disk ... ok gvm_1 | gvm_1 | gvm_1 | Success. You can now start the database server using: gvm_1 | gvm_1 | /usr/lib/postgresql/12/bin/pg_ctl -D /data/database -l logfile start gvm_1 | gvm_1 | initdb: warning: enabling "trust" authentication for local connections gvm_1 | You can change this by editing pg_hba.conf or using the option -A, or gvm_1 | --auth-local and --auth-host, the next time you run initdb. gvm_1 | Starting PostgreSQL... gvm_1 | waiting for server to start....2020-11-03 21:31:37.168 UTC [38] LOG: starting PostgreSQL 12.4 (Ubuntu 12.4-1.pgdg20.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0, 64-bit gvm_1 | 2020-11-03 21:31:37.170 UTC [38] LOG: listening on IPv4 address "127.0.0.1", port 5432 gvm_1 | 2020-11-03 21:31:37.171 UTC [38] LOG: could not bind IPv6 address "::1": Cannot assign requested address gvm_1 | 2020-11-03 21:31:37.171 UTC [38] HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry. gvm_1 | 2020-11-03 21:31:37.203 UTC [38] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" gvm_1 | 2020-11-03 21:31:37.430 UTC [39] LOG: database system was shut down at 2020-11-03 21:31:25 UTC gvm_1 | 2020-11-03 21:31:37.472 UTC [38] LOG: database system is ready to accept connections gvm_1 | done gvm_1 | server started gvm_1 | Creating SSH folder... gvm_1 | Creating SSH2 RSA key; this may take some time ... gvm_1 | 3072 SHA256:w+Naq5URJomuhjwfusZqzkcbPZR9LBYoTr23tnzQAkI root@b77b8a230c90 (RSA) gvm_1 | Creating SSH2 ECDSA key; this may take some time ... gvm_1 | 256 SHA256:psnS/PkJc0IIuQrSX1n6PMHaSUWYuqWa9tb19rm4bFk root@b77b8a230c90 (ECDSA) gvm_1 | Creating SSH2 ED25519 key; this may take some time ... gvm_1 | 256 SHA256:1fyuYYMpOW+21kwBA6WZ5kJ3h56I6jONzFy38VpGftk root@b77b8a230c90 (ED25519) gvm_1 | invoke-rc.d: could not determine current runlevel gvm_1 | invoke-rc.d: policy-rc.d denied execution of restart. gvm_1 | Running first start configuration... gvm_1 | Creating Greenbone Vulnerability system user... gvm_1 | chown: cannot access '/usr/local/var/lib/openvas': No such file or directory gvm_1 | 9:C 03 Nov 2020 21:31:46.229 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo gvm_1 | 9:C 03 Nov 2020 21:31:46.229 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=9, just started gvm_1 | 9:C 03 Nov 2020 21:31:46.229 # Configuration loaded gvm_1 | Wait for redis socket to be created... gvm_1 | Testing redis status... gvm_1 | Redis ready. gvm_1 | Starting PostgreSQL... gvm_1 | pg_ctl: another server might be running; trying to start server anyway gvm_1 | waiting for server to start....2020-11-03 21:31:47.507 UTC [21] LOG: starting PostgreSQL 12.4 (Ubuntu 12.4-1.pgdg20.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0, 64-bit gvm_1 | 2020-11-03 21:31:47.509 UTC [21] LOG: listening on IPv4 address "127.0.0.1", port 5432 gvm_1 | 2020-11-03 21:31:47.509 UTC [21] LOG: could not bind IPv6 address "::1": Cannot assign requested address gvm_1 | 2020-11-03 21:31:47.509 UTC [21] HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry. gvm_1 | 2020-11-03 21:31:47.526 UTC [21] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" gvm_1 | 2020-11-03 21:31:47.737 UTC [22] LOG: database system was interrupted; last known up at 2020-11-03 21:31:37 UTC gvm_1 | 2020-11-03 21:31:47.936 UTC [22] LOG: database system was not properly shut down; automatic recovery in progress gvm_1 | 2020-11-03 21:31:47.951 UTC [22] LOG: invalid record length at 0/1647F50: wanted 24, got 0 gvm_1 | 2020-11-03 21:31:47.951 UTC [22] LOG: redo is not required gvm_1 | 2020-11-03 21:31:48.041 UTC [21] LOG: database system is ready to accept connections gvm_1 | done gvm_1 | server started gvm_1 | Running first start configuration... gvm_1 | Creating Greenbone Vulnerability system user... gvm_1 | useradd: user 'gvm' already exists

Crankinator commented 3 years ago

I found my issue. Apologies.

I had incorrect volumes in my compose, as well as my env file was incorrect. Jumped the gun on an issue submission.

Thank you all for the hard work 👍