# Services for PostgreSQL 11 and 12 fail to start: "Assertion failed on job for postgresql@11-main.service"

**URL:** <https://travis-ci.community/t/services-for-postgresql-11-and-12-fail-to-start-assertion-failed-on-job-for-postgresql-11-main-service/7069>\
**Category:** Linux\
**Created:** [January 30, 2020, 6:32pm UTC](https://travis-ci.community/t/services-for-postgresql-11-and-12-fail-to-start-assertion-failed-on-job-for-postgresql-11-main-service/7069 "2020-01-30T18:32:48Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![dvarrazzo](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/dvarrazzo/32/3743_2.png) [@dvarrazzo](https://travis-ci.community/u/dvarrazzo)\
**Post date:** [January 30, 2020, 6:32pm UTC](https://travis-ci.community/t/services-for-postgresql-11-and-12-fail-to-start-assertion-failed-on-job-for-postgresql-11-main-service/7069/1 "2020-01-30T18:32:48Z")

</div>

See build failures at [https://travis-ci.org/dvarrazzo/pgmp/jobs/643995581](https://travis-ci.org/dvarrazzo/pgmp/jobs/643995581)

```auto
$ travis_setup_postgresql 11
Starting PostgreSQL v11
Assertion failed on job for postgresql@11-main.service.
sudo systemctl start postgresql@11-main

```

---

<div class="post-metadata">

**Author:** ![dvarrazzo](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/dvarrazzo/32/3743_2.png) [@dvarrazzo](https://travis-ci.community/u/dvarrazzo)\
**Post date:** [January 30, 2020, 6:39pm UTC](https://travis-ci.community/t/services-for-postgresql-11-and-12-fail-to-start-assertion-failed-on-job-for-postgresql-11-main-service/7069/2 "2020-01-30T18:39:15Z")

</div>

The `.travis.yml` file that configured the build is  
[https://github.com/dvarrazzo/pgmp/blob/6e5e612ee428232a5ca30cb3d79a768e7145df43/.travis.yml:](https://github.com/dvarrazzo/pgmp/blob/6e5e612ee428232a5ca30cb3d79a768e7145df43/.travis.yml:)

```auto
matrix:
  include:
    # ...
    - addons:
        postgresql: '11'
        apt:
          packages:
            - postgresql-client-11
            - postgresql-server-dev-11
    # ...

```

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [January 31, 2020, 6:51pm UTC](https://travis-ci.community/t/services-for-postgresql-11-and-12-fail-to-start-assertion-failed-on-job-for-postgresql-11-main-service/7069/3 "2020-01-31T18:51:32Z")

</div>

Looks like we are not installing all the packages required to start the PostgreSQL 11 service.

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [January 31, 2020, 6:59pm UTC](https://travis-ci.community/t/services-for-postgresql-11-and-12-fail-to-start-assertion-failed-on-job-for-postgresql-11-main-service/7069/4 "2020-01-31T18:59:42Z")

</div>

Oh, sorry, it is your configuration.

Our documentation

> **[Travis CI Documentation](https://docs.travis-ci.com/user/database-setup/#using-a-different-postgresql-version)**
>
> Setting up Databases and Services

  
advises you to have this:

```auto
addons:
  postgresql: "11"
  apt:
    packages:
    - postgresql-11
    - postgresql-client-11

```

which [indeed works](https://travis-ci.org/BanzaiMan/travis_production_test/jobs/644498615#L481-L489).

Please try that.

---

<div class="post-metadata">

**Author:** ![dvarrazzo](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/dvarrazzo/32/3743_2.png) [@dvarrazzo](https://travis-ci.community/u/dvarrazzo)\
**Post date:** [January 31, 2020, 7:35pm UTC](https://travis-ci.community/t/services-for-postgresql-11-and-12-fail-to-start-assertion-failed-on-job-for-postgresql-11-main-service/7069/5 "2020-01-31T19:35:36Z")

</div>

It worked indeed, with the addition of the port too: thank you for your help 🙂

[https://travis-ci.org/dvarrazzo/pgmp/builds/644507910](https://travis-ci.org/dvarrazzo/pgmp/builds/644507910)

Isn’t it curious that PG 11 and 12 need such a different configuration from all the other available servers, 9.4-10 (other packages needed, non-standard port)? Here is the config file:

> <https://github.com/dvarrazzo/pgmp/blob/2a3d542fe04ed857e0f68ad55a214d3148969119/.travis.yml>

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [January 31, 2020, 7:39pm UTC](https://travis-ci.community/t/services-for-postgresql-11-and-12-fail-to-start-assertion-failed-on-job-for-postgresql-11-main-service/7069/6 "2020-01-31T19:39:23Z")

</div>

> [@dvarrazzo](#):
>
> Isn’t it curious that PG 11 and 12 need such a different configuration from all the other available servers

I’m writing from memory, but that is most likely due to the base image not containing these newer versions.

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [January 31, 2020, 9:32pm UTC](https://travis-ci.community/t/services-for-postgresql-11-and-12-fail-to-start-assertion-failed-on-job-for-postgresql-11-main-service/7069/7 "2020-01-31T21:32:36Z")

</div>

I thought about this a little more, but maybe the addon should be smarter about what packages to install for various versions of PostgreSQL.

---

<div class="post-metadata">

**Author:** ![dvarrazzo](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/dvarrazzo/32/3743_2.png) [@dvarrazzo](https://travis-ci.community/u/dvarrazzo)\
**Post date:** [January 31, 2020, 9:50pm UTC](https://travis-ci.community/t/services-for-postgresql-11-and-12-fail-to-start-assertion-failed-on-job-for-postgresql-11-main-service/7069/8 "2020-01-31T21:50:14Z")

</div>

I can only give you the PoV of the end user, I don’t know what is in the base image and how difficult is to extend. I suppose if someone asks for a PG 11 service, they expect at least the server and the client packages to be installed (I had already discovered I had to specify to install the `postgres-client-NN` packages because I had a "`psql` not found" error in the first build attempts, but the “assert failed” at service start because the server package is missing is quite the obscure behaviour).
