如何修复Postgres安装Ubuntu上的错误

时间:2018-06-26 01:20:54

标签: postgresql ubuntu debian

我正在努力解决postgres客户端安装错误。我正在持续集成版本上安装此程序,因此我需要安装它而不会出现错误。关键是,客户端已经安装,如果我psql进入服务器,我什至可以运行ssh命令,但是我需要在不接触的情况下运行它,这意味着安装必须在没有错误。 我已经完成了所有google-foo的工作,在Ubuntu论坛上也没有看到任何建议,或者这里似乎没有指出正确的方向。这一切都在ubuntu 14.04上。

或者,只要客户端可用,我也许可以使错误保持沉默。

以下是我遇到的错误:

sudo apt-get install postgresql-client

    Reading package lists... Done


    Building dependency tree       


    Reading state information... Done

    The following additional packages will be installed:
      libpq5 postgresql-client-9.6 postgresql-client-common
    Suggested packages:
      postgresql-9.6 postgresql-doc-9.6
    The following NEW packages will be installed:
      libpq5 postgresql-client postgresql-client-9.6 postgresql-client-common
    0 upgraded, 4 newly installed, 0 to remove and 7 not upgraded.
    Need to get 1494 kB of archives.
    After this operation, 6121 kB of additional disk space will be used.

    Get:1 http://deb.debian.org/debian stretch/main amd64 libpq5 amd64 9.6.7-0+deb9u1 [132 kB]

    Get:2 http://deb.debian.org/debian stretch/main amd64 postgresql-client-common all 181+deb9u1 [79.0 kB]

    Get:3 http://deb.debian.org/debian stretch/main amd64 postgresql-client-9.6 amd64 9.6.7-0+deb9u1 [1228 kB]

    Get:4 http://deb.debian.org/debian stretch/main amd64 postgresql-client all 9.6+181+deb9u1 [55.7 kB]

    Fetched 1494 kB in 0s (55.5 MB/s)
    debconf: delaying package configuration, since apt-utils is not installed
    Selecting previously unselected package libpq5:amd64.
    (Reading database ... 31433 files and directories currently installed.)
    Preparing to unpack .../libpq5_9.6.7-0+deb9u1_amd64.deb ...
    Unpacking libpq5:amd64 (9.6.7-0+deb9u1) ...
    Selecting previously unselected package postgresql-client-common.
    Preparing to unpack .../postgresql-client-common_181+deb9u1_all.deb ...
    Unpacking postgresql-client-common (181+deb9u1) ...
    Selecting previously unselected package postgresql-client-9.6.
    Preparing to unpack .../postgresql-client-9.6_9.6.7-0+deb9u1_amd64.deb ...
    Unpacking postgresql-client-9.6 (9.6.7-0+deb9u1) ...
    Selecting previously unselected package postgresql-client.
    Preparing to unpack .../postgresql-client_9.6+181+deb9u1_all.deb ...
    Unpacking postgresql-client (9.6+181+deb9u1) ...
    Setting up libpq5:amd64 (9.6.7-0+deb9u1) ...
    Processing triggers for libc-bin (2.24-11+deb9u3) ...
    Setting up postgresql-client-common (181+deb9u1) ...
    Setting up postgresql-client-9.6 (9.6.7-0+deb9u1) ...
    update-alternatives: using /usr/share/postgresql/9.6/man/man1/psql.1.gz to provide /usr/share/man/man1/psql.1.gz (psql.1.gz) in auto mode
    update-alternatives: error: error creating symbolic link '/usr/share/man/man7/ABORT.7.gz.dpkg-tmp': No such file or directory
    dpkg: error processing package postgresql-client-9.6 (--configure):
     subprocess installed post-installation script returned error exit status 2
    dpkg: dependency problems prevent configuration of postgresql-client:
     postgresql-client depends on postgresql-client-9.6; however:
      Package postgresql-client-9.6 is not configured yet.

    dpkg: error processing package postgresql-client (--configure):
     dependency problems - leaving unconfigured
    Errors were encountered while processing:
     postgresql-client-9.6
     postgresql-client
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    Exited with code 100

我尝试了以下解决方法:


    sudo apt-get purge postgr*
    sudo apt-get autoremove
    sudo apt-get install synaptic
    sudo apt-get update

来自:https://ubuntuforums.org/showthread.php?t=2277582


    which psql
    /usr/bin/psql


    more /etc/apt/sources.list
    deb http://deb.debian.org/debian stretch main
    deb http://deb.debian.org/debian stretch-updates main
    deb http://security.debian.org/debian-security stretch/updates main

我对如何前进感到困惑。

1 个答案:

答案 0 :(得分:3)

我的CI版本也遇到了同样的问题,我发现了创建@A等文件夹的解决方法。 Scherbaum提到了。

sudo mkdir -p /usr/share/man/man1
sudo mkdir -p /usr/share/man/man7
sudo apt-get update
sudo apt-get install postgresql-client

我通过此commit在此issue中找到了这种解决方案

但是我也像您所说的那样测试了错误,使它无效,但我不知道后果

sudo apt-get install postgresql-client || true

我在此circleci article

中发现了类似的内容