Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve "Operation not permitted: '/var/lib/pgadmin'" error in laradock at Windows Subsystem for Linux?

I am using the Laradock in my Laravel project for dockerizing with Nginx, Postgres, and Pgadmin. All the containers are running well but the Pgadmin is unable to do so. Here is my error log,

pgadmin_1              | WARNING: Failed to set ACL on the directory containing the configuration database: [Errno 1] Operation not permitted: '/var/lib/pgadmin'
pgadmin_1              | Traceback (most recent call last):
pgadmin_1              |   File "run_pgadmin.py", line 4, in <module>
pgadmin_1              |     from pgAdmin4 import app
pgadmin_1              |   File "/pgadmin4/pgAdmin4.py", line 92, in <module>
pgadmin_1              |     app = create_app()
pgadmin_1              |   File "/pgadmin4/pgadmin/__init__.py", line 241, in create_app
pgadmin_1              |     create_app_data_directory(config)
pgadmin_1              |   File "/pgadmin4/pgadmin/setup/data_directory.py", line 40, in create_app_data_directory
pgadmin_1              |     _create_directory_if_not_exists(config.SESSION_DB_PATH)
pgadmin_1              |   File "/pgadmin4/pgadmin/setup/data_directory.py", line 16, in _create_directory_if_not_exists
pgadmin_1              |     os.mkdir(_path)
pgadmin_1              | PermissionError: [Errno 13] Permission denied: '/var/lib/pgadmin/sessions'
pgadmin_1              | sudo: setrlimit(RLIMIT_CORE): Operation not permitted
pgadmin_1              | [2020-06-07 11:48:43 +0000] [1] [INFO] Starting gunicorn 19.9.0
pgadmin_1              | [2020-06-07 11:48:43 +0000] [1] [INFO] Listening at: http://[::]:80 (1)
pgadmin_1              | [2020-06-07 11:48:43 +0000] [1] [INFO] Using worker: threads
pgadmin_1              | /usr/local/lib/python3.8/os.py:1023: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
pgadmin_1              |   return io.open(fd, *args, **kwargs)
pgadmin_1              | [2020-06-07 11:48:43 +0000] [83] [INFO] Booting worker with pid: 83
pgadmin_1              | [2020-06-07 11:48:44 +0000] [83] [ERROR] Exception in worker process
pgadmin_1              | Traceback (most recent call last):
pgadmin_1              |   File "/usr/local/lib/python3.8/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
pgadmin_1              |     worker.init_process()
pgadmin_1              |   File "/usr/local/lib/python3.8/site-packages/gunicorn/workers/gthread.py", line 104, in init_process
pgadmin_1              |     super(ThreadWorker, self).init_process()
pgadmin_1              |   File "/usr/local/lib/python3.8/site-packages/gunicorn/workers/base.py", line 129, in init_process
pgadmin_1              |     self.load_wsgi()
pgadmin_1              |   File "/usr/local/lib/python3.8/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
pgadmin_1              |     self.wsgi = self.app.wsgi()
pgadmin_1              |   File "/usr/local/lib/python3.8/site-packages/gunicorn/app/base.py", line 67, in wsgi
pgadmin_1              |     self.callable = self.load()
pgadmin_1              |   File "/usr/local/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
pgadmin_1              |     return self.load_wsgiapp()
pgadmin_1              |   File "/usr/local/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
pgadmin_1              |     return util.import_app(self.app_uri)
pgadmin_1              |   File "/usr/local/lib/python3.8/site-packages/gunicorn/util.py", line 350, in import_app
pgadmin_1              |     __import__(module)
pgadmin_1              |   File "/pgadmin4/run_pgadmin.py", line 4, in <module>
pgadmin_1              |     from pgAdmin4 import app
pgadmin_1              |   File "/pgadmin4/pgAdmin4.py", line 92, in <module>
pgadmin_1              |     app = create_app()
pgadmin_1              |   File "/pgadmin4/pgadmin/__init__.py", line 241, in create_app
pgadmin_1              |     create_app_data_directory(config)
pgadmin_1              |   File "/pgadmin4/pgadmin/setup/data_directory.py", line 40, in create_app_data_directory
pgadmin_1              |     _create_directory_if_not_exists(config.SESSION_DB_PATH)
pgadmin_1              |   File "/pgadmin4/pgadmin/setup/data_directory.py", line 16, in _create_directory_if_not_exists
pgadmin_1              |     os.mkdir(_path)
pgadmin_1              | PermissionError: [Errno 13] Permission denied: '/var/lib/pgadmin/sessions'
pgadmin_1              | [2020-06-07 11:48:44 +0000] [83] [INFO] Worker exiting (pid: 83)
pgadmin_1              | WARNING: Failed to set ACL on the directory containing the configuration database: [Errno 1] Operation not permitted: '/var/lib/pgadmin'
pgadmin_1              | /usr/local/lib/python3.8/os.py:1023: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
pgadmin_1              |   return io.open(fd, *args, **kwargs)
pgadmin_1              | [2020-06-07 11:48:44 +0000] [1] [INFO] Shutting down: Master
pgadmin_1              | [2020-06-07 11:48:44 +0000] [1] [INFO] Reason: Worker failed to boot.

I have tried many ways to solve this problem. Such as,

OSError: [Errno 13] Permission denied: '/var/lib/pgadmin'

https://www.pgadmin.org/docs/pgadmin4/latest/container_deployment.html

and some other github issues and their solutions. I also run the sudo chmod -R 777 ~/.laradock/data/pgadmin and sudo chmod -R 777 /var/lib/pgadmin command to get the permission but still the same error log. Can you guys help me on this? I think some others are also getting this error on their local machine. Thanks 🙂

like image 693
Shamim Hossain Avatar asked Jun 07 '20 12:06

Shamim Hossain


2 Answers

You may try this:

sudo chown -R 5050:5050 ~/.laradock/data/pgadmin

Then restart the container. Cause in the container with:

uid=5050(pgadmin) gid=5050(pgadmin)

and

drwx------ 4 pgadmin  pgadmin  56 Jan 27 08:25 pgadmin
like image 84
senique Avatar answered Oct 06 '22 01:10

senique


As others have noted above, I found that Permission denied: '/var/lib/pgadmin/sessions' in Docker speaks to the challenge on the persistent local folder not having the correct user permissions.

After running sudo chown -R 5050:5050 ~/.laradock/data/pgadmin and restarting the container, the below error is no longer in my log

PermissionError: [Errno 13] Permission denied:

like image 23
Pedro P Avatar answered Oct 06 '22 01:10

Pedro P