使用 ubuntu 软件中心安装 postgresql 时出现“包操作失败”错误

使用 ubuntu 软件中心安装 postgresql 时出现“包操作失败”错误

我正在尝试安装 JDownloader。但是,在使用以下方式安装时安装 jdownloader,我遇到了一些错误。像这样:

j@ubuntu:~$ sudo apt-get install jdownloader
Reading package lists... Done
Building dependency tree       
Reading state information... Done
jdownloader is already the newest version.
The following package was automatically installed and is no longer required:
  acroread-common
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 46 not upgraded.
2 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 postgresql-9.1 (9.1.9-0ubuntu12.04) ...
 * Starting PostgreSQL 9.1 database server                                       * The PostgreSQL server failed to start. Please check the log output:
2013-05-15 18:52:29 GMT FATAL:  data directory "/var/lib/postgresql/9.1/main" has group or world access
2013-05-15 18:52:29 GMT DETAIL:  Permissions should be u=rwx (0700).
                                                                         [fail]
invoke-rc.d: initscript postgresql, action "start" failed.
dpkg: error processing postgresql-9.1 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of postgresql:
 postgresql depends on postgresql-9.1; however:
  Package postgresql-9.1 is not configured yet.
dpkg: error processing postgresql (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                          Errors were encountered while processing:
 postgresql-9.1
 postgresql
E: Sub-process /usr/bin/dpkg returned an error code (1)
j@ubuntu:~$

并且尝试sudo apt-get -f 安装导致这个..

j@ubuntu:~$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  acroread-common
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 46 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up postgresql-9.1 (9.1.9-0ubuntu12.04) ...
 * Starting PostgreSQL 9.1 database server                                       * The PostgreSQL server failed to start. Please check the log output:
2013-05-15 18:53:13 GMT FATAL:  data directory "/var/lib/postgresql/9.1/main" has group or world access
2013-05-15 18:53:13 GMT DETAIL:  Permissions should be u=rwx (0700).
                                                                         [fail]
invoke-rc.d: initscript postgresql, action "start" failed.
dpkg: error processing postgresql-9.1 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of postgresql:
 postgresql depends on postgresql-9.1; however:
  Package postgresql-9.1 is not configured yet.
dpkg: error processing postgresql (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              No apport report written because MaxReports is reached already
                                            Errors were encountered while processing:
 postgresql-9.1
 postgresql
E: Sub-process /usr/bin/dpkg returned an error code (1)
j@ubuntu:~$

我尝试使用安装它Ubuntu 软件中心,仍然出现以下错误,标题为“包操作失败”:

installArchives() failed: Selecting previously unselected package postgresql.
(Reading database ... 100%
(Reading database ... 368757 files and directories currently installed.)
Unpacking postgresql (from .../postgresql_9.1+129ubuntu1_all.deb) ...
Setting up postgresql-9.1 (9.1.9-0ubuntu12.04) ...
 * Starting PostgreSQL 9.1 database server
 * The PostgreSQL server failed to start. Please check the log output:
2013-05-15 18:45:26 GMT FATAL:  data directory "/var/lib/postgresql/9.1/main" has group or world access
2013-05-15 18:45:26 GMT DETAIL:  Permissions should be u=rwx (0700).
   ...fail!
invoke-rc.d: initscript postgresql, action "start" failed.
dpkg: error processing postgresql-9.1 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of postgresql:
 postgresql depends on postgresql-9.1; however:
  Package postgresql-9.1 is not configured yet.
dpkg: error processing postgresql (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
 postgresql-9.1
 postgresql
Error in function: 
Setting up postgresql-9.1 (9.1.9-0ubuntu12.04) ...
 * Starting PostgreSQL 9.1 database server
 * The PostgreSQL server failed to start. Please check the log output:
2013-05-15 18:45:28 GMT FATAL:  data directory "/var/lib/postgresql/9.1/main" has group or world access
2013-05-15 18:45:28 GMT DETAIL:  Permissions should be u=rwx (0700).
   ...fail!
invoke-rc.d: initscript postgresql, action "start" failed.
dpkg: error processing postgresql-9.1 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of postgresql:
 postgresql depends on postgresql-9.1; however:
  Package postgresql-9.1 is not configured yet.
dpkg: error processing postgresql (--configure):
 dependency problems - leaving unconfigured

有什么帮助吗?提前谢谢。

答案1

运行此操作来修复权限:

sudo chmod -R 700 /var/lib/postgresql/9.1/main
sudo chown -R postgres:postgres /var/lib/postgresql/9.1/main

然后运行:

sudo apt-get -f install

再次完成 postgres 安装。

相关内容