Bug 29066 - Cannot start pgadmin4; missing dependency for python3-simplejson; missing /var/lib/pgadmin?
Summary: Cannot start pgadmin4; missing dependency for python3-simplejson; missing /va...
Status: RESOLVED DUPLICATE of bug 30385
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 8
Hardware: x86_64 Linux
Priority: Normal normal
Target Milestone: ---
Assignee: Joseph Wang
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-01 12:01 CEST by Herman Viaene
Modified: 2022-07-12 22:44 CEST (History)
6 users (show)

See Also:
Source RPM: pgadmin4-4.22-3.mga8.src.rpm
CVE:
Status comment:


Attachments
konsole output while trying to apply updates, and get pgadmin4 running. (10.29 KB, text/plain)
2022-07-02 08:14 CEST, Pierre Fortin
Details
urpmi pgadmin4 --test output in text file (17.19 KB, text/plain)
2022-07-02 15:01 CEST, Rolf Pedersen
Details

Description Herman Viaene 2021-06-01 12:01:48 CEST
Description of problem:
When trying to access postgresql from pgadmin4 i get error  that the server cannot be accessed.
There are at least two problems :
1. checking the status of the pgadmin4 service shows: no module simplejson. This is overcome by installing the package python3-simplejson. But shouldn't it then be a dependency which is installed by default???
2. Once this is overcome, then the service still cannot be started: 
# systemctl -l status pgadmin4
shows
PermissionError: [Errno 13] Permission denied: '/var/lib/pgadmin'
But that file or folder is simply not there as shows
# cd /var/lib
# ls -als pgadmin
ls: cannot access 'pgadmin': file of folder does not exist.



Version-Release number of selected component (if applicable):
4.22

How reproducible:
always

Steps to Reproduce:
1.
2.
3.
Comment 1 Lewis Smith 2021-06-02 10:20:30 CEST
Thanks for the report.
/var/lib/pgadmin does not appear anywhere.

Assigning to the registered & active maintainer joequant.

Source RPM: python3-simplejson => pgadmin4-4.22-3.mga8.src.rpm
Assignee: bugsquad => joequant
Summary: Cannot start pgadmin4 => Cannot start pgadmin4; missing dependency for python3-simplejson; missing /var/lib/pgadmin?

Comment 2 Florian Hubold 2021-08-11 17:36:50 CEST
FWIW, this has already been fixed for cauldron in the meantime: http://svnweb.mageia.org/packages/cauldron/pgadmin4/current/SPECS/pgadmin4.spec?r1=1659294&r2=1730112
Although it would still need to be backported to 8.


As an interim workaround, this should make it work (run as root):

groupadd -r pgadmin
useradd  -g pgadmin -s /bin/false -r -c "pgadmin4" -d /var/lib/pgadmin pgadmin
mkdir -p /var/lib/pgadmin/{sessions,storage}
chown -R pgadmin:pgadmin /var/lib/pgadmin

CC: (none) => doktor5000

david Cossé 2021-11-30 18:12:58 CET

CC: (none) => saveurlinux

Comment 3 david Cossé 2021-11-30 18:16:20 CET
(In reply to Florian Hubold from comment #2)
> FWIW, this has already been fixed for cauldron in the meantime:
> http://svnweb.mageia.org/packages/cauldron/pgadmin4/current/SPECS/pgadmin4.
> spec?r1=1659294&r2=1730112
> Although it would still need to be backported to 8.
> 
> 
> As an interim workaround, this should make it work (run as root):
> 
> groupadd -r pgadmin
> useradd  -g pgadmin -s /bin/false -r -c "pgadmin4" -d /var/lib/pgadmin
> pgadmin
> mkdir -p /var/lib/pgadmin/{sessions,storage}
> chown -R pgadmin:pgadmin /var/lib/pgadmin

I've got same problem and tried this work around but starting the service failed:
sudo systemctl start pgadmin4 
➜  ~ sudo systemctl status pgadmin4
● pgadmin4.service - pgAdmin4
     Loaded: loaded (/usr/lib/systemd/system/pgadmin4.service; disabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Tue 2021-11-30 18:13:56 CET; 3s ago
    Process: 48543 ExecStart=/usr/bin/python3 /usr/lib/python3.8/site-packages/pgadmin4-web/pgAdmin4.py (code=exite>
   Main PID: 48543 (code=exited, status=1/FAILURE)
        CPU: 762ms

nov. 30 18:13:56 linux-2.local python3[48543]:     from pgadmin.utils import env, IS_WIN, fs_short_path
nov. 30 18:13:56 linux-2.local python3[48543]:   File "/usr/lib/python3.8/site-packages/pgadmin4-web/pgadmin/__init>
nov. 30 18:13:56 linux-2.local python3[48543]:     from pgadmin.utils import PgAdminModule, driver, KeyManager
nov. 30 18:13:56 linux-2.local python3[48543]:   File "/usr/lib/python3.8/site-packages/pgadmin4-web/pgadmin/utils/>
nov. 30 18:13:56 linux-2.local python3[48543]:     from .preferences import Preferences
nov. 30 18:13:56 linux-2.local python3[48543]:   File "/usr/lib/python3.8/site-packages/pgadmin4-web/pgadmin/utils/>
nov. 30 18:13:56 linux-2.local python3[48543]:     import simplejson as json
nov. 30 18:13:56 linux-2.local python3[48543]: ModuleNotFoundError: No module named 'simplejson'
nov. 30 18:13:56 linux-2.local systemd[1]: pgadmin4.service: Main process exited, code=exited, status=1/FAILURE
nov. 30 18:13:56 linux-2.local systemd[1]: pgadmin4.service: Failed with result 'exit-code'.
Comment 4 david Cossé 2021-11-30 18:28:55 CET
I add this required not installed package : python3-simplejson-3.17.2-1.mga8.x86_64

but now I'm facing the following problem:
sudo systemctl status pgadmin4
● pgadmin4.service - pgAdmin4
     Loaded: loaded (/usr/lib/systemd/system/pgadmin4.service; disabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Tue 2021-11-30 18:26:08 CET; 5s ago
    Process: 49622 ExecStart=/usr/bin/python3 /usr/lib/python3.8/site-packages/pgadmin4-web/pgAdmin4.py (code=exite>
   Main PID: 49622 (code=exited, status=1/FAILURE)
        CPU: 945ms

nov. 30 18:26:08 linux-2.local python3[49622]: Traceback (most recent call last):
nov. 30 18:26:08 linux-2.local python3[49622]:   File "/usr/lib/python3.8/site-packages/pgadmin4-web/pgAdmin4.py", >
nov. 30 18:26:08 linux-2.local python3[49622]:     exec(open(file_quote(setup_py), 'r').read())
nov. 30 18:26:08 linux-2.local python3[49622]:   File "<string>", line 409, in <module>
nov. 30 18:26:08 linux-2.local python3[49622]:   File "<string>", line 341, in setup_db
nov. 30 18:26:08 linux-2.local python3[49622]:   File "/usr/lib/python3.8/site-packages/pgadmin4-web/pgadmin/setup/>
nov. 30 18:26:08 linux-2.local python3[49622]:     os.chmod(config.SESSION_DB_PATH, 0o700)
nov. 30 18:26:08 linux-2.local python3[49622]: PermissionError: [Errno 1] Operation not permitted: '/var/lib/pgadmi>
nov. 30 18:26:08 linux-2.local systemd[1]: pgadmin4.service: Main process exited, code=exited, status=1/FAILURE
nov. 30 18:26:08 linux-2.local systemd[1]: pgadmin4.service: Failed with result 'exit-code'.
Comment 5 david Cossé 2021-12-01 10:45:28 CET
I did succues to get it.
The process was:
groupadd -r pgadmin
useradd  -g pgadmin -s /bin/false -r -c "pgadmin4" -d /var/lib/pgadmin pgadmin
mkdir -p /var/lib/pgadmin/{sessions,storage}
chown -R pgadmin:pgadmin /var/lib/pgadmin
urpmi python3-psycopg2
urpmi python3-py-bcrypt
urpmi python3-flask-gravatar
urpmi python3-flask-security
urpmi python3-sshtunnel
urpmi python3-paramiko
urpmi python3-sqlparse

then I started as:
/usr/bin/python3 /usr/lib/python3.8/site-packages/pgadmin4-web/pgAdmin4.py

But I think somewhere by RPM database was maybe corrupt as I also tried to install package from cauldron but it required python3.9
Comment 6 david Cossé 2021-12-01 18:18:29 CET
(In reply to Herman Viaene from comment #0)
> Description of problem:
> When trying to access postgresql from pgadmin4 i get error  that the server
> cannot be accessed.
> There are at least two problems :
Maybe it could help you, I succed to get it works, see message "comment 5"
> 1. checking the status of the pgadmin4 service shows: no module simplejson.
> This is overcome by installing the package python3-simplejson. But shouldn't
> it then be a dependency which is installed by default???
> 2. Once this is overcome, then the service still cannot be started: 
> # systemctl -l status pgadmin4
> shows
> PermissionError: [Errno 13] Permission denied: '/var/lib/pgadmin'
> But that file or folder is simply not there as shows
> # cd /var/lib
> # ls -als pgadmin
> ls: cannot access 'pgadmin': file of folder does not exist.
> 
> 
> 
> Version-Release number of selected component (if applicable):
> 4.22
> 
> How reproducible:
> always
> 
> Steps to Reproduce:
> 1.
> 2.
> 3.
Comment 7 Herman Viaene 2021-12-02 11:27:01 CET
Checked my configuration, found the user and group and files and access rights as you described in Comment 5 OK.
Checked the list of packages and found I missed
python3-psycopg2
python3-py-bcrypt
python3-flask-gravatar
but on trying to install these from MCC I get:
file /usr/lib64/python3.8/site-packages/bcrypt/__init__.py from install of python3-py-bcrypt-0.4-20.mga8.x86_64 conflicts with file from package python3-bcrypt-3.1.7-4.mga8.x86_64

file /usr/lib64/python3.8/site-packages/bcrypt/__pycache__/__init__.cpython-38.opt-1.pyc from install of python3-py-bcrypt-0.4-20.mga8.x86_64 conflicts with file from package python3-bcrypt-3.1.7-4.mga8.x86_64

file /usr/lib64/python3.8/site-packages/bcrypt/__pycache__/__init__.cpython-38.pyc from install of python3-py-bcrypt-0.4-20.mga8.x86_64 conflicts with file from package python3-bcrypt-3.1.7-4.mga8.x86_64

As this is on my daily working desktop, I surely will not draw in anything from cauldron.
Comment 8 david Cossé 2021-12-07 08:12:17 CET
(In reply to Herman Viaene from comment #7)
> Checked my configuration, found the user and group and files and access
> rights as you described in Comment 5 OK.
> Checked the list of packages and found I missed
> python3-psycopg2
> python3-py-bcrypt
> python3-flask-gravatar
> but on trying to install these from MCC I get:
> file /usr/lib64/python3.8/site-packages/bcrypt/__init__.py from install of
> python3-py-bcrypt-0.4-20.mga8.x86_64 conflicts with file from package
> python3-bcrypt-3.1.7-4.mga8.x86_64
> 
> file
> /usr/lib64/python3.8/site-packages/bcrypt/__pycache__/__init__.cpython-38.
> opt-1.pyc from install of python3-py-bcrypt-0.4-20.mga8.x86_64 conflicts
> with file from package python3-bcrypt-3.1.7-4.mga8.x86_64
> 
> file
> /usr/lib64/python3.8/site-packages/bcrypt/__pycache__/__init__.cpython-38.
> pyc from install of python3-py-bcrypt-0.4-20.mga8.x86_64 conflicts with file
> from package python3-bcrypt-3.1.7-4.mga8.x86_64
> 
> As this is on my daily working desktop, I surely will not draw in anything
> from cauldron.

I didn't install anything from cauldron, did you tried to remove the package that cause conflict ?
David Walser 2022-05-05 17:47:06 CEST

See Also: (none) => https://bugs.mageia.org/show_bug.cgi?id=30385

Comment 9 Pierre Fortin 2022-07-02 08:14:40 CEST
Created attachment 13319 [details]
konsole output while trying to apply updates, and get pgadmin4 running.

I'm having the same issue on mga8...  Trying to install packages in comment 5:

urpmi python3-psycopg2   (already installed) 
urpmi python3-py-bcrypt  (failed, conflict) 
urpme python3-bcrypt-3.1.7-4.mga8.x86_64  (removed conflict)
urpmi python3-py-bcrypt  (installed OK now)
urpmi urpmi python3-flask-gravatar  (already installed)
urpmi python3-flask-security 
      (dep fails on above install of python3-py-bcrypt)  :p
urpmi python3-sshtunnel 
      (dep fails on above install of python3-py-bcrypt)  :p
urpmi python3-paramiko
      (dep fails on above install of python3-py-bcrypt)  :p
urpmi python3-sqlparse  (installed OK)

chmod -R 700 /var/lib/pgadmin   gets me past permissions issue; but now fails on missing flask-security

CC: (none) => pfortin

Comment 10 Pierre Fortin 2022-07-02 14:34:12 CEST
This is where I am, trying to install pgadmin4...  I seem to be going in circles with these dependencies...  pgadmin4 won't install on Cauldron either (bug 30373).

$ urpmi pgadmin4
To satisfy dependencies, the following packages are going to be installed:
  Package                        Version      Release       Arch    
(medium "Core Release")
  pgadmin4                       4.22         3.mga8        x86_64  
  python3-bcrypt                 3.1.7        4.mga8        x86_64  
  python3-flask-security         3.0.0        1.mga8        noarch  
  python3-paramiko               2.7.2        1.mga8        noarch  
  python3-sshtunnel              0.1.5        1.mga8        noarch  
3MB of additional disk space will be used.
919KB of packages will be retrieved.
Proceed with the installation of the 5 packages? (Y/n)  


    http://mirrors.mageia.org/api/mageia.8.x86_64.list: media/core/release/pgadmin4-4.22-3.mga8.x86_64.rpm
installing pgadmin4-4.22-3.mga8.x86_64.rpm python3-paramiko-2.7.2-1.mga8.noarch.rpm python3-bcrypt-3.1.7-4.mga8.x86_64.rpm python3-sshtunnel-0.1.5-1.mga8.noarch.rpm python3-flask-security-3.0.0-1.mga8.noarch.rpm from /var/cache/urpmi/rpms
Preparing...                     #######################[snip]
Installation failed:    file /usr/lib64/python3.8/site-packages/bcrypt/__init__.py from install of python3-bcrypt-3.1.7-4.mga8.x86_64 conflicts with file from package python3-py-bcrypt-0.4-20.mga8.x86_64
        file /usr/lib64/python3.8/site-packages/bcrypt/__pycache__/__init__.cpython-38.opt-1.pyc from install of python3-bcrypt-3.1.7-4.mga8.x86_64 conflicts with file from package python3-py-bcrypt-0.4-20.mga8.x86_64
        file /usr/lib64/python3.8/site-packages/bcrypt/__pycache__/__init__.cpython-38.pyc from install of python3-bcrypt-3.1.7-4.mga8.x86_64 conflicts with file from package python3-py-bcrypt-0.4-20.mga8.x86_64
Comment 11 Rolf Pedersen 2022-07-02 15:01:34 CEST
Created attachment 13320 [details]
urpmi pgadmin4 --test output in text file

Not using this software and not wanting to add so many packages to my 64-bit mga8 installation, I ran 'urpmi pgadmin4 --test' and attach the output, fwiw.

CC: (none) => rolfpedersen

Comment 12 sturmvogel 2022-07-02 18:56:33 CEST
@Pierre the original problem of the reporter seems a little bit different to yours. Rolfs output is on a clean MGA8 system without tinkered permissions/tweaks/alterations whatever. I can create also Rolfs behaviour here on a clean MGA8 installation.

Did you already try to remove python3-py-bcrypt as this is no dependency for pgadmin4 and clearly conflicts with pgadmin4 installation? By following the recommendation in comment 5 (which seems to be for slightly different issue than yours) you seem to have borked your MGA8 pgadmin4 installation.

There is no doubt, that there is a real issue in cauldron atm to install pgadmin. But for that you have already bug 30373
Comment 13 Pierre Fortin 2022-07-02 19:02:57 CEST
Actually, there's rogress...

urpme python3-py-bcrypt-0.4-20.mga8.x86_64
urpmi pgadmin4

Finally installed pgAdmin4; but...  now, I have to figure out how to get around firefox insisting on secure connections; or how to secure pgAdmin4's port so that firefox doesn't refuse to connect.
Comment 14 sturmvogel 2022-07-02 19:13:25 CEST
For Firefox maybe this helps: https://support.mozilla.org/en-US/kb/https-only-prefs#firefox:linux:fx91
Comment 15 Pierre Fortin 2022-07-02 19:44:10 CEST
Thanks; but already had to do this months ago...  I've also been through the about:config settings; still no luck though...  
Just tried "links http://localhost:5432" - it returns:
 Error: Unable to retrieve http://localhost:5432 : Error reading from socket

lynx returns:
 Unexpected network read error; connection aborted.

Konqueror returns: 
  This page isn’t working
  localhost didn’t send any data.
  ERR_EMPTY_RESPONSE

Looks like I'll be spending some time with wireshark to make sure the connection is http and see what the exchange is...
Comment 16 Dave Hodgins 2022-07-02 20:49:04 CEST
Got it working.

pgadmin4-4.22-3.mga8 has the following problems.
/var/lib/pgadmin/ and
/var/log/pgadmin/ must be created and
chown apache:apache /var/lib/pgadmin and
chown apache:apache /var/log/pgadmin

The following packages need to be installed. They should be added to the
list of packages required by pgadmin4 ...
python3-psycopg2
python3-flask-gravatar
python3-sqlparse

Successfully loaded the pgAdmin page using http://localhost:5050/browser/
in firefox.

Pierre, note port 5050, not 5432. Found using
# netstat -tlpn|grep python3
tcp        0      0 127.0.0.1:5050          0.0.0.0:*               LISTEN      38165/python3

CC: (none) => davidwhodgins

Comment 17 Pierre Fortin 2022-07-02 23:36:39 CEST
Hmm...  changed ownership on those two directories. Packages were already installed.
$ netstat -tlpn
tcp        0      0 127.0.0.1:5432   0.0.0.0:*   LISTEN      3862132/postgres    

port 5050 never shows up; BTW, it's listed as:
$ grep 5050  /etc/services 
mmcc            5050/tcp                # multimedia conference control tool
mmcc            5050/udp                # multimedia conference control tool
so guessing you chose that port...?

Opened both ports in the firewall; but only ever see 5432 (postgres)

pgAdmin4 whines if browser is already running...

I get this whether firefox is already running, or not:
$ pgAdmin4 &
[GFX1-]: glxtest: X error, error_code=1, request_code=155, minor_code=1
[GFX1-]: glxtest: process failed (exited with status 1)

Yesterday, I was getting pgAdmin4's Configuration panel where I set the port to 5432; now that all seems installed, no Configuration is presented.  I probably need to specify "--new-window" as well as change the port number in the config file; but cna't find it...

Ah...  just found /usr/lib/python3.8/site-packages/pgadmin4-web/config.py which contains:
DEFAULT_SERVER = '127.0.0.1'
DEFAULT_SERVER_PORT = 5050

While pgAdmin4 appears to be running, no port 5050...  All I get is:

$ pgAdmin4 &
[1] 3951471
pfortin@prf   Sat Jul 02 17:26:08
~
$  * Serving Flask app "pgadmin" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
[GFX1-]: glxtest: X error, error_code=1, request_code=155, minor_code=1
[GFX1-]: glxtest: process failed (exited with status 1)

I must be missing something basic...

* postgresql is running on port 5432
* as normal user: pgAdmin4 &
* browser is invoked with "localhost:5432"
* change port to 5050; still unable to connect...
Comment 18 Dave Hodgins 2022-07-03 00:45:47 CEST
I started it with "systemctl start pgadmin4.service". No modifications to
any files provided with pgadmin4 after installing the package.

$ systemctl status pgadmin4.service 
● pgadmin4.service - pgAdmin4
     Loaded: loaded (/usr/lib/systemd/system/pgadmin4.service; disabled; vendor preset: disabled)
     Active: active (running) since Sat 2022-07-02 14:37:45 EDT; 4h 5min ago
   Main PID: 38165 (python3)
      Tasks: 1 (limit: 19119)
     Memory: 91.8M
        CPU: 11.486s
     CGroup: /system.slice/pgadmin4.service
             └─38165 /usr/bin/python3 /usr/lib/python3.8/site-packages/pgadmin4-web/pgAdmin4.py

Jul 02 14:37:45 x3.hodgins.homeip.net systemd[1]: Started pgAdmin4.
Jul 02 14:37:51 x3.hodgins.homeip.net python3[38165]: Starting pgAdmin 4. Please navigate to http://127.0.0.1:5050 in your browser.
Jul 02 14:37:51 x3.hodgins.homeip.net python3[38165]:  * Serving Flask app "pgadmin" (lazy loading)
Jul 02 14:37:51 x3.hodgins.homeip.net python3[38165]:  * Environment: production
Jul 02 14:37:51 x3.hodgins.homeip.net python3[38165]:    WARNING: This is a development server. Do not use it in a production deployment.
Jul 02 14:37:51 x3.hodgins.homeip.net python3[38165]:    Use a production WSGI server instead.
Jul 02 14:37:51 x3.hodgins.homeip.net python3[38165]:  * Debug mode: off

I assume it must be started as by root to get access to the tcp port before
dropping privileges.
Comment 19 papoteur 2022-07-04 14:13:05 CEST
Hi Dave,
Is all tree from /var/lib/pgadmin owned by apache:apache?
Is /var/log/pgadmin created at installation?

CC: (none) => yves.brungard_mageia

Comment 20 Dave Hodgins 2022-07-04 20:22:23 CEST
I created /var/lib/pgadmin and /var/log/pgadmin and changed those two
directories to be owned by apache. That should have been done during the
install of pgadmin4 with a file in /usr/lib/tmpfiles.d/, but wasn't.
# ls -ld /var/lib/pgadmin /var/log/pgadmin
drwx------ 4 apache apache 4096 Jul  2 14:41 /var/lib/pgadmin/
drwxr-xr-x 2 apache apache 4096 Jul  2 14:32 /var/log/pgadmin/

Once those two directories were manually created and changed to be owned
by apache, I was able to start pgadmin4.service. It then created files
and directories in those two directories. Those files/directories are
owned by apache:apache.
Comment 21 papoteur 2022-07-11 14:21:17 CEST
See this report: https://bugs.mageia.org/show_bug.cgi?id=30385
A new build is to test.
Comment 22 Pierre Fortin 2022-07-12 22:24:30 CEST
Seeing updates come through; but nothing for this report. What should I be looking for?
Comment 23 Dave Hodgins 2022-07-12 22:44:13 CEST
Closing as a duplicate of bug 30385 where it's being fixed. Please see that
bug.

*** This bug has been marked as a duplicate of bug 30385 ***

Status: NEW => RESOLVED
Resolution: (none) => DUPLICATE


Note You need to log in before you can comment on or make changes to this bug.