由于 perl 错误,无法启动 postgresql

由于 perl 错误,无法启动 postgresql

我已经在我的 Ubuntu 上安装了 postgres,当我尝试运行psql命令时出现以下错误:

$ psql
Can't locate POSIX.pm:   /usr/local/lib/x86_64-linux-gnu/perl/5.22.1/POSIX.pm: Permission denied at /usr/bin/psql line 20.
BEGIN failed--compilation aborted at /usr/bin/psql line 20.

我查看了/usr/local/lib/x86_64-linux-gnu/perl/5.22.1目录,没有POSIX.pm文件。

我已经@INC使用以下命令检查了所有文件夹:

$ perl -e 'print "@INC";' | tr " " "\n"
/usr/share/perl/5.22.1
/etc/perl
/usr/local/lib/x86_64-linux-gnu/perl/5.22.1
/usr/local/share/perl/5.22.1
/usr/lib/x86_64-linux-gnu/perl5/5.22
/usr/share/perl5
/usr/lib/x86_64-linux-gnu/perl/5.22
/usr/share/perl/5.22
/usr/local/lib/site_perl
/usr/lib/x86_64-linux-gnu/perl-base

我使用 option 授予了上述所有目录完全权限chmod -R 777。但仍然出现权限错误。

如果我执行以下命令也会出现错误:

$ perl -e 'use POSIX'
Can't locate POSIX.pm:   /usr/local/lib/x86_64-linux-gnu/perl/5.22.1/POSIX.pm: Permission denied at -e line 1.
BEGIN failed--compilation aborted at -e line 1.

环境详细信息:

$ perl -v

This is perl 5, version 22, subversion 1 (v5.22.1) built for x86_64-linux-gnu-thread-multi
(with 58 registered patches, see perl -V for more detail)

Copyright 1987-2015, Larry Wall

$ uname -a
Linux anil-K55VM 4.4.0-57-generic #78-Ubuntu SMP Fri Dec 9 23:50:32 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux


$ apt list | grep postgresql-server

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

postgresql-server-dev-9.5/xenial-updates 9.5.5-0ubuntu0.16.04 amd64
postgresql-server-dev-all/xenial,xenial 173 all

更新:

root@anil-K55VM:~# ls -l /usr/local/lib/x86_64-linux-gnu/perl/5.22.1/POSIX.pm
ls: cannot access '/usr/local/lib/x86_64-linux-gnu/perl/5.22.1/POSIX.pm': No such file or directory

答案1

我尝试访问本地文件夹 /user/local。我检查了本地文件夹的权限,但我没有该文件夹的所有权限,因此在这种情况下,您可以执行后续步骤

转到用户文件夹... cd /user 之后您可以更改权限: sudo chmod 777 local 然后您可以尝试再次连接

相关内容