Bionic: PostgresQL 10 no longer starts up

Recently my builds started failing although the Travis config did not change. I’m trying to run Postgres v10 in Bionic. The error I get is:

Starting PostgreSQL v10
Job for postgresql@10-main.service failed because the service did not take the steps required by its unit configuration.
See "systemctl status postgresql@10-main.service" and "journalctl -xe" for details.
sudo systemctl start postgresql@10-main

I’ve created a minimal repro to demonstrate. Here is the failed job. Here are the relevant parts of the config:

dist: bionic
sudo: false
services:
  - postgresql
addons:
  postgresql: "10"
  apt:
    packages:
      - postgresql-10
      - postgresql-client-10
      - postgresql-contrib-10
before_install:
  - psql -d template1 -U postgres -c "CREATE USER pinafore WITH PASSWORD 'pinafore' CREATEDB;"

Of course it fails when it tries to run psql because it cannot connect:

psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

This code was working as of about a week ago.

1 Like

Update: switching from bionic to xenial works. So this appears to just be a problem with bionic.

We are running into the same issue since today. Nothing changed on our end. Anyone else is experiencing it?

@san983 same here, have raised a ticket but no response yet.

If it’s happening recently, please point to the failing build URL.

My quick tests are working.

https://travis-ci.org/BanzaiMan/travis_production_test/builds/650527368#L196
https://travis-ci.org/BanzaiMan/travis_production_test/builds/650528532#L213

Can’t post links (I’m on .com not .org), but my builds continue to fail:

travis_setup_postgresql 10
eStarting PostgreSQL v10e
Job for postgresql@10-main.service failed because the service did not take the steps required by its unit configuration.
See "systemctl status postgresql@10-main.service" and "journalctl -xe" for details.

psql -c "CREATE DATABASE travisci;" -U postgres
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

@BanzaiMan I think I’ve figured out what’s causing it by looking at your config. My project’s .travis.yml file looked like this:

addons:
    postgresql: "10"
    apt:
        packages:
            - postgresql-10
            - postgresql-client-10

This was working absolutely fine as recently as yesterday. However, yours looks like this:

addons:
    postgresql: "10"

Removing the apt section from mine resolved the issue, but this is definitely a change on Travis’ end as my config has not changed since yesterday and previously passing builds now fail.

2 Likes

I see. My guess would be that our addon is making changes to the apt packages (which is installed earlier) and that is causing the problem.

Thanks @HappyTepid. I drove my fix, but just removing postgresql-10, I needed the postgresql-client-10 package

So, this configuration is explicitly stated in our documentation.

We will look into fixing this.

1 Like

@BanzaiMan Thanks for providing a suggestion. For what is worth, I shared links and detailed examples via support on the ticket I opened on Thursday. I yet have to receive a reply after 4 days :confused:

We ultimately addressed it by removing postgresql-10 as suggested here. I’d love to better understand if my support request got lost in the wire.

Still have this issue here https://travis-ci.org/github/Suor/django-cacheops/builds/687369517. Surprisingly PostgreSQL still starts up sometimes, but usually don’t.

Me too. It appears that postgresql 9.3 is now starting up somehow. Still debugging too :frowning:

I’m experiencing the same issue. Builds that were passing until about May 14th are now failing.

I can also confirm that removing postgresql-10 and postgresql-client-10 appears to fix it:

Failing build: https://travis-ci.org/github/pypa/warehouse/jobs/688517321
Passing build: https://travis-ci.org/github/pypa/warehouse/jobs/688522096

diff --git a/.travis.yml b/.travis.yml
index 738b4e53..62d89c27 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -13,8 +13,6 @@ addons:
   postgresql: 10
   apt:
     packages:
-    - postgresql-10
-    - postgresql-client-10
     - nasm
     - libgnutls28-dev
1 Like

I’m still seeing this issue today in Bionic. Unfortunately since I’m using postgresql-contrib-10, none of the solutions posted above worked for me. However, this did:

diff --git a/.travis.yml b/.travis.yml
index 1a30299..40d188c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,6 +2,7 @@ language: node_js
 node_js:
   - "10"
 dist: bionic
+group: dev
 sudo: false
 services:
   - postgresql
@@ -9,7 +10,6 @@ addons:
   postgresql: "10"
   apt:
     packages:
-      - postgresql-10
       - postgresql-client-10
       - postgresql-contrib-10
 before_install:

I don’t know why group: dev is required, but it seems to work. Here’s the passing PR in my minimal repro.