已安装的 pgadmin4-apache2 包安装后脚本子进程返回错误退出状态 1

已安装的 pgadmin4-apache2 包安装后脚本子进程返回错误退出状态 1

我正在尝试安装 pgAdmin4 桌面模式,遇到此问题。它显示已安装 pgAdmin4 和 pgadmin4-apache2。但在打开 pgAdmin4 应用程序时,它会在弹出窗口中显示错误

Failed to launch the application server, server thread exiting.

尽管安装pgAdmin4pgadmin-apache2

sudo apt-get install pgadmin4 pgadmin4-apache2 

显示以下错误。

pgadmin4 is already the newest version (4.8-3.pgdg18.04+1).
pgadmin4-apache2 is already the newest version (4.8-3.pgdg18.04+1).
The following packages were automatically installed and are no longer required:
  apache2-data apache2-utils libprotobuf-c1 php7.2-cli php7.2-json php7.2-opcache php7.2-readline
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 14 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up pgadmin4-apache2 (4.8-3.pgdg18.04+1) ...
WARNING: Failed to set ACL on the directory containing the configuration database: [Errno 1] Operation not permitted: '/var/www/.pgadmin'
Traceback (most recent call last):
  File "setup.py", line 413, in <module>
    setup_db()
  File "setup.py", line 345, in setup_db
    create_app_data_directory(config)
  File "/usr/share/pgadmin4/web/pgadmin/setup/data_directory.py", line 42, in create_app_data_directory
    os.chmod(config.SESSION_DB_PATH, 0o700)
PermissionError: [Errno 1] Operation not permitted: '/var/www/.pgadmin/sessions'
dpkg: error processing package pgadmin4-apache2 (--configure):
 installed pgadmin4-apache2 package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 pgadmin4-apache2E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

运行以下命令以避免权限错误:

chmod 777 -R /var/www/.pgadmin/sessions

如果目录不存在,则在设置权限之前创建它:

mkdir -p /var/www/.pgadmin/sessions

相关内容