You are not logged in.

#1 2019-08-20 16:25:44

DevAlone
Member
Registered: 2018-10-31
Posts: 19

postgresql doesn't work inside an lxc container after update

I don't remember which version was working, but after I updated, the latest versions of postgresql doesn't run inside a container, it prints this:

> sudo systemctl status postgresql.service                                                                                                                                                 40 ms 
● postgresql.service - PostgreSQL database server
   Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2019-08-20 16:21:18 UTC; 4s ago
  Process: 1547 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGROOT}/data (code=exited, status=226/NAMESPACE)

Aug 20 16:21:18 go systemd[1]: Starting PostgreSQL database server...
Aug 20 16:21:18 go systemd[1547]: postgresql.service: Failed to set up mount namespacing: Permission denied
Aug 20 16:21:18 go systemd[1547]: postgresql.service: Failed at step NAMESPACE spawning /usr/bin/postgresql-check-db-dir: Permission denied
Aug 20 16:21:18 go systemd[1]: postgresql.service: Control process exited, code=exited, status=226/NAMESPACE
Aug 20 16:21:18 go systemd[1]: postgresql.service: Failed with result 'exit-code'.
Aug 20 16:21:18 go systemd[1]: Failed to start PostgreSQL database server.

Offline

#2 2019-08-20 16:29:36

DevAlone
Member
Registered: 2018-10-31
Posts: 19

Re: postgresql doesn't work inside an lxc container after update

Here is output of `sudo journalctl -xe`

Aug 20 16:27:33 go agetty[2068]: /dev/lxc/tty2: cannot open as standard input: No such file or directory                                                                                         
Aug 20 16:27:33 go agetty[2065]: /dev/lxc/tty3: cannot open as standard input: No such file or directory                                                                                         
Aug 20 16:27:36 go sudo[2100]:     user : TTY=pts/5 ; PWD=/home/user ; USER=root ; COMMAND=/usr/bin/systemctl restart postgresql.service
Aug 20 16:27:36 go sudo[2100]: pam_unix(sudo:session): session opened for user root by user(uid=0)
Aug 20 16:27:36 go systemd[1]: Starting PostgreSQL database server...
-- Subject: A start job for unit postgresql.service has begun execution
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/l … temd-devel
--
-- A start job for unit postgresql.service has begun execution.
--
-- The job identifier is 40987.
Aug 20 16:27:36 go systemd[2103]: postgresql.service: Failed to set up mount namespacing: Permission denied
Aug 20 16:27:36 go systemd[2103]: postgresql.service: Failed at step NAMESPACE spawning /usr/bin/postgresql-check-db-dir: Permission denied
-- Subject: Process /usr/bin/postgresql-check-db-dir could not be executed
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/l … temd-devel
--
-- The process /usr/bin/postgresql-check-db-dir could not be executed and failed.
--
-- The error number returned by this process is ERRNO.
Aug 20 16:27:36 go systemd[1]: postgresql.service: Control process exited, code=exited, status=226/NAMESPACE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/l … temd-devel
--
-- An ExecStartPre= process belonging to unit postgresql.service has exited.
--
-- The process' exit code is 'exited' and its exit status is 226.
Aug 20 16:27:36 go systemd[1]: postgresql.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/l … temd-devel
--
-- The unit postgresql.service has entered the 'failed' state with result 'exit-code'.
Aug 20 16:27:36 go systemd[1]: Failed to start PostgreSQL database server.
-- Subject: A start job for unit postgresql.service has failed
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/l … temd-devel
--
-- A start job for unit postgresql.service has finished with a failure.
--
-- The job identifier is 40987 and the job result is failed.
Aug 20 16:27:36 go sudo[2100]: pam_unix(sudo:session): session closed for user root
Aug 20 16:27:40 go sudo[2121]:     user : TTY=pts/5 ; PWD=/home/user ; USER=root ; COMMAND=/usr/bin/journalctl -xe
Aug 20 16:27:40 go sudo[2121]: pam_unix(sudo:session): session opened for user root by user(uid=0)

Offline

#3 2019-08-20 16:40:56

DevAlone
Member
Registered: 2018-10-31
Posts: 19

Re: postgresql doesn't work inside an lxc container after update

-- Subject: Process /usr/bin/postgresql-check-db-dir could not be executed

but /usr/bin/postgresql-check-db-dir can be executed:

ls -la /usr/bin/postgresql-check-db-dir
-rwxr-xr-x 1 root root 1631 Aug  8 20:31 /usr/bin/postgresql-check-db-dir

Offline

#4 2019-08-20 16:45:05

DevAlone
Member
Registered: 2018-10-31
Posts: 19

Re: postgresql doesn't work inside an lxc container after update

When I try to run postgres manually it prints this:

/usr/bin/postgres -D $PGROOT/data
2019-08-20 16:43:35.639 UTC [3739] LOG:  listening on IPv6 address "::1", port 5432
2019-08-20 16:43:35.639 UTC [3739] LOG:  listening on IPv4 address "127.0.0.1", port 5432
2019-08-20 16:43:35.681 UTC [3739] FATAL:  could not create lock file "/run/postgresql/.s.PGSQL.5432.lock": No such file or directory
2019-08-20 16:43:35.681 UTC [3739] LOG:  database system is shut down

Offline

#5 2019-08-20 17:35:00

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 8,975
Website

Re: postgresql doesn't work inside an lxc container after update

Please don't multipost -- if you are the last person to post in a topic, use the edit function to append anything you want to add. Also, use code tags, not quote tags, for terminal output.

https://wiki.archlinux.org/index.php/Co … s_and_code
1https://wiki.archlinux.org/index.php/Code_of_conduct#Bumping


Sakura:-
Mobo: MSI X299 TOMAHAWK ARCTIC // Processor: Intel Core i7-7820X 3.6GHz // GFX: nVidia GeForce GTX 970 // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 5x 1TB HDD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#6 2019-08-20 20:24:12

twelveeighty
Member
From: Alberta, Canada
Registered: 2011-09-04
Posts: 493

Re: postgresql doesn't work inside an lxc container after update

DevAlone wrote:

but /usr/bin/postgresql-check-db-dir can be executed:

I think you're looking in the wrong place, I think this is the key error:

Failed to set up mount namespacing: Permission denied

I do not run lxc, but a couple of Google searches point to security/access issues (either selinux or lxc related), so I don't think this is a PostgreSQL issue, but rather lower level at the lxc container itself.

btw: please use code tags, not quote tags when listing errors. For BBCode help click on the BBCode link below the message.

Offline

Board footer

Powered by FluxBB