Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix error on postgres install ubuntu

I'm struggling to fix an error on install of the postgres client. I'm installing this on a Continuous Integration build, so I need it to install without error. The thing is, the client is installed, and I can even run psql commands, if I ssh into the server, but I need this to run without my touch, which means the install has to happen without error. I've done all the google-foo, and none of the suggestions I've seen on Ubuntu forums, or here seem to point in the right direction. This is all on ubuntu 14.04.

Alternatively, maybe I can just silence the errors, as long as the client is usable.

Following is the error I run into:

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

I've tried the following to fix:


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

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


    which psql
    /usr/bin/psql

And


    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

I'm stumped on how to move forward.

like image 339
icicleking Avatar asked Jun 26 '18 01:06

icicleking


People also ask

Why is PostgreSQL not installing?

If you encounter an error about being unable to create the postgres service user, turn off any antivirus programs and re-run the installer. >\database directory and manually set the permissions for the \data subdirectory. If the subdirectory \data does not exist, create. Then uninstall PostgreSQL and re-install.


1 Answers

I had the same problem with my CI build, and I found a workaround creating the folders like @A. Scherbaum mentioned.

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

I found this solution in this commit through this issue

However I also did the test silencing the error like you said and It worked, but I don't know the consequences

sudo apt-get install postgresql-client || true

I found something similar in this circleci article

like image 91
Rafael Lebre Avatar answered Sep 23 '22 10:09

Rafael Lebre