Adrian Challinor
Adrian Challinor

Reputation: 31

Error starting postgresql server - error with snakeoil key

postgresql server refused to start after clean install of Ubuntu 20.04. The instal went find, but on starting the server, I got the following error in my syslog file:

Feb 15 10:05:22 bastet systemd[1]: Starting PostgreSQL Cluster 12-main...
Feb 15 10:05:22 bastet postgresql@12-main[2974450]: Error: /usr/lib/postgresql/12/bin/pg_ctl /usr/lib/postgresql/12/bin/pg_ctl start -D /var/lib/postgresql/12/main -l /var/log/postgresql/postgresql-12-main.log -s -o  -c config_file="/etc/postgresql/12/main/postgresql.conf"  exited with status 1:
Feb 15 10:05:22 bastet postgresql@12-main[2974450]: 2022-02-15 10:05:22.556 GMT [2974455] FATAL:  could not load private key file "/etc/ssl/private/ssl-cert-snakeoil.key": key values mismatch
Feb 15 10:05:22 bastet postgresql@12-main[2974450]: 2022-02-15 10:05:22.556 GMT [2974455] LOG:  database system is shut down
Feb 15 10:05:22 bastet postgresql@12-main[2974450]: pg_ctl: could not start server
Feb 15 10:05:22 bastet postgresql@12-main[2974450]: Examine the log output.
Feb 15 10:05:22 bastet systemd[1]: [email protected]: Can't open PID file /run/postgresql/12-main.pid (yet?) after start: Operation not permitted
Feb 15 10:05:22 bastet systemd[1]: [email protected]: Failed with result 'protocol'.
Feb 15 10:05:22 bastet systemd[1]: Failed to start PostgreSQL Cluster 12-main.

Upvotes: 1

Views: 1238

Answers (1)

Adrian Challinor
Adrian Challinor

Reputation: 31

The above happened when I rebuilt my server. I have a number of SSL certificates in the /etc/ssl/private directory and blindly copied the contents of the directory from a backup. That was a "bad idea". It overwrote the snakeoil.key file.

To correct this, regenerate the snakeoil certificate:

sudo make-ssl-cert generate-default-snakeoil

Upvotes: 2

Related Questions