将Ubuntu 12.04升级到14.04后,PostgreSQL无法重新安装

肖恩

我跑去do-release-upgrade将Ubuntu 12.04服务器更新为Ubuntu 14.04。它似乎运行顺利,但是当我apt-get update在升级后这样做时,我注意到PostgreSQL软件包仍在寻找精确的存储库,而不是可信赖的存储库。我按照此处说明添加了可信赖的存储库,并将.list包含精确存储库文件移至临时目录作为备份。完成此操作后,它sudo apt-get upgrade失败了,即使恢复了精确的设置后,我也无法使其再次完全运行回购。我没有碰到错误消息。由于这是开发服务器,并且所有数据都不是必需的,因此我决定仅重新安装PostgreSQL。在尝试清除我认为可能会干扰的服务器上的任何自定义配置后,此操作反复失败。我能够sudo apt-get install postgresql-common成功完成操作,但是如果尝试sudo apt-get install postgresql-9.5执行以下操作,将失败:

Setting up postgresql-9.5 (9.5.5-1.pgdg14.04+1) ...
Creating new cluster 9.5/main ...
  config /etc/postgresql/9.5/main
  data   /var/lib/postgresql/9.5/main
  locale en_US.UTF-8
  socket /var/run/postgresql
  port   5432
update-alternatives: using /usr/share/postgresql/9.5/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode
 * Starting PostgreSQL 9.5 database server                                                                                             
 * Failed to issue method call: Unit [email protected] failed to load: No such file or directory. See system logs and 'systemctl status [email protected]' for details.
                                                                                                                               [fail]
invoke-rc.d: initscript postgresql, action "start" failed.
dpkg: error processing package postgresql-9.5 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of postgresql-contrib-9.5:
 postgresql-contrib-9.5 depends on postgresql-9.5 (= 9.5.5-1.pgdg14.04+1); however:
  Package postgresql-9.5 is not configured yet.

dpkg: error processing package postgresql-contrib-9.5 (--configure):
 dependency problems - leaving unconfigured
Setting up sysstat (10.2.0-1) ...
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          update-alternatives: using /usr/bin/sar.sysstat to provide /usr/bin/sar (sar) in auto mode
Processing triggers for libc-bin (2.19-0ubuntu6.9) ...
Errors were encountered while processing:
 postgresql-9.5
 postgresql-contrib-9.5
E: Sub-process /usr/bin/dpkg returned an error code (1)

Jan 17 15:31:31 beta kernel: [    4.029504] systemd-journald[543]: Failed to resolve 'systemd-journal' group: No such process

如果我尝试systemctl status [email protected]得到:

[email protected]
   Loaded: error (Reason: No such file or directory)
   Active: inactive (dead)

/var/log/postgresql/postgresql-9.5-main.log日志文件是空的,所以我不知道还有什么地方检查日志。安装失败后,请按照此处的步骤进行完全卸载。我无法确定这是PostgreSQL还是升级服务器的问题。

更新:的输出dpkg -l "postgresql*"

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                         Version             Architecture        Description
+++-============================-===================-===================-==============================================================
un  postgresql-7.4               <none>              <none>              (no description available)
un  postgresql-8.0               <none>              <none>              (no description available)
un  postgresql-9.1               <none>              <none>              (no description available)
iF  postgresql-9.5               9.5.5-1.pgdg14.04+1 amd64               object-relational SQL database, version 9.5 server
un  postgresql-client            <none>              <none>              (no description available)
ii  postgresql-client-9.5        9.5.5-1.pgdg14.04+1 amd64               front-end programs for PostgreSQL 9.5
ii  postgresql-client-common     178.pgdg14.04+1     all                 manager for multiple PostgreSQL client versions
ii  postgresql-common            178.pgdg14.04+1     all                 PostgreSQL database-cluster manager
iU  postgresql-contrib-9.5       9.5.5-1.pgdg14.04+1 amd64               additional facilities for PostgreSQL
un  postgresql-doc-9.5           <none>              <none>              (no description available)
湿婆

我遇到了同样的问题,将Ubuntu 12.04升级到14.04。不知道,但它也使用systemd。在检查/etc/init.d/postgresql文件时,它使用/usr/share/postgresql-common/init.d-functions

该文件执行/ usr / bin / pg_ctlcluster来启动和停止postgresql服务器。

if [ "$1" = "stop" ] || [ "$1" = "restart" ]; then
    ERRMSG=$(pg_ctlcluster --force "$2" "$name" $1 2>&1)
else
    ERRMSG=$(pg_ctlcluster "$2" "$name" $1 2>&1)
fi

/usr/bin/pg_ctlcluster文件接受--skip-systemctl-redirect选项来启动或停止不带systectl的postgresql。

所以,你需要添加--skip-systemctl-redirect/usr/share/postgresql-common/init.d-functions在do_ctl_all()函数。因此它将看起来像这样。

if [ "$1" = "stop" ] || [ "$1" = "restart" ]; then
    ERRMSG=$(pg_ctlcluster --skip-systemctl-redirect --force "$2" "$name" $1 2>&1)
else
    ERRMSG=$(pg_ctlcluster --skip-systemctl-redirect "$2" "$name" $1 2>&1)
fi

或者您可以$skip_systemctl_redirect = 1;$skip_systemctl_redirect检入之前添加/usr/bin/pg_ctlcluster

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

无法解析的主机/通过浏览器将12升级到14 Ubuntu / Net Connection正常

将ubuntu 12.10升级到13.04后,我需要重新安装所有软件吗?

从12升级到Intellij 13.1后,Maven项目将无法编译

从ubuntu 12升级到ubuntu 16后,打印机在纸张的反面打印

从节点12升级到14后,要求功能无法识别

如果我将Ubuntu 13.04升级到13.10,是否需要重新安装所有软件?

将Ubuntu 14.04升级到16.04后,Steam安装程序将无法启动

无法从Ubuntu 17.04升级到17.10

无法从Ubuntu 13.04升级到13.10

无法将JHipster从5.0.1升级到5.1.0

由于Dropbox升级问题,我无法将ubuntu 12.04升级到14.04

从Ubuntu 10.10升级到14.04.3,易于无法识别新安装的python 2.7.9

从14升级到Ubuntu 16后卡在fsck“ / dev / sda1:清洁xxx / xxx文件[...]”

将EOL Ubuntu 13.10升级到14.04后系统无法启动

将Ubuntu 14.04升级到16.04后无法导入python naoqi库

将Ubuntu 13.04升级到14.04后Unity无法正常工作

将Ubuntu 17.10升级到18.04后,PHP无法正常工作

将weblogic服务器从10.3升级到12是否会对OBIEE 11g安装造成任何问题?

如何在不丢失OpenProject数据的情况下将Postgresql数据库从10升级到12

从32位升级到64位,安装程序中的“重新安装Ubuntu”会破坏我的系统吗?

如何将JDeveloper11升级到12c?

将Postgres从10升级到12-编码问题

将OBIEE 11.1.6升级到12C

将ubuntu从14.04升级到16.04后,NFS变慢

将ubuntu 15.10升级到16.04后,virtualenv python断开了

将Ubuntu 16.04升级到16.10后Unity崩溃

将ubuntu从14.04升级到16.04后,启动和关闭速度缓慢

将ubuntu 13.10升级到14.04后启动时间增加

将Ubuntu从14.04升级到16.04后,声音停止工作