Cannot launch Postgresql’s pgadmin4 on Fedora36

linuxpostgresql

I have just installed pgadmin4-desktop on Fedora36 and after initially working it has suddenly stopped. The steps I followed are documented here: https://www.pgadmin.org/download/pgadmin-4-rpm/

Now I cannot launch it via Gnome or the command line. E.g.

$ pwd
/usr/pgadmin4/bin 
$ ./pgadmin4
[0623/155920.067580:ERROR:zip_reader.cc(153)] Cannot open ZIP from file handle 3
[0623/155920.067718:ERROR:zip.cc(202)] Cannot open ZIP from file handle 3 Opening in existing browser session. 
$

When launching from Gnome Shell the journalctl output is:

Jun 24 09:09:31 rh-brbaker systemd[1908]: Started app-glib-pgadmin4-5600.scope - Application launched by gnome-shell.
Jun 24 09:09:31 rh-brbaker systemd[1908]: Started app-gnome-pgadmin4-5600.scope - Application launched by gnome-shell.
Jun 24 09:09:31 rh-brbaker pgadmin4.desktop[5600]: [0624/090931.654802:ERROR:zip_reader.cc(153)] Cannot open ZIP from file handle 3
Jun 24 09:09:31 rh-brbaker pgadmin4.desktop[5600]: [0624/090931.654863:ERROR:zip.cc(202)] Cannot open ZIP from file handle 3
Jun 24 09:09:31 rh-brbaker gnome-keyring-daemon[1935]: asked to register item /org/freedesktop/secrets/collection/login/1, but it's already registered
Jun 24 09:09:31 rh-brbaker pgadmin4.desktop[5600]: Opening in existing browser session.

I am not sure about the last entry referencing to opening a browser session because I installed the desktop version. (That is probably a distractor.)

Installed details from "yum list installed" are:

pgadmin4-desktop.x86_64                              6.10-1.fc35                         @pgAdmin4              
pgadmin4-fedora-repo.noarch                          2-1                                 @System                
pgadmin4-server.x86_64                               6.10-1.fc35                         @pgAdmin4  

While investigating this I found someone else with the same issue on Ubuntu but there is no answer: https://askubuntu.com/questions/1414609/run-pgadmin-4-on-ubuntu-22-04 . So it clearly not a Fedora-specific issue.

Does anyone have any suggestions on how to resolve this? Thanks

Best Answer

I worked around the problem by deploying it as a container instead.The bash script for this follows (you can replace podman with docker if you want):

#! /bin/bash

[email protected]
ADMIN_PWD=password
PGADMIN_PORT=8089

echo "Starting pgadmin4"
podman run -d --rm --name pgadmin4 -p $PGADMIN_PORT:80 -e PGADMIN_DEFAULT_PASSWORD=$ADMIN_PWD -e PGADMIN_DEFAULT_EMAIL=$ADMIN_EMAIL docker.io/dpage/pgadmin4:latest

echo
echo "Postgresql Admin Console access details:"
echo "========================================"
echo "Pgadmin URL: http://localhost:8089"
echo "DB Admin email: " $ADMIN_EMAIL
echo "DB Admin password: "$ADMIN_PWD
echo
echo "Database connection details:"
echo "============================"
echo "Database server url is: " $HOSTNAME
echo "Database connection port: 5432"

It takes about 30 seconds before pgadmin4 starts so be patient waiting for the url to work.

Note that if you are accessing a database on the host machine you need to use the host machine's machine name for the server, not localhost.

Related Question