0

I had to reinstall postgres almost 5 times, but still with no success. The port just doesn't seem to listen to 5432.

Whenever I type

systemctl list-dependencies postgresql

I see it like that

● ├─[email protected]
● ├─system.slice
● └─sysinit.target
●   ├─apparmor.service
●   ├─dev-hugepages.mount
●   ├─dev-mqueue.mount
●   ├─keyboard-setup.service
●   ├─kmod-static-nodes.service
●   ├─plymouth-read-write.service
●   ├─plymouth-start.service
●   ├─proc-sys-fs-binfmt_misc.automount
●   ├─setvtrgb.service
●   ├─sys-fs-fuse-connections.mount
●   ├─sys-kernel-config.mount
●   ├─sys-kernel-debug.mount
●   ├─systemd-ask-password-console.path
●   ├─systemd-binfmt.service
●   ├─systemd-hwdb-update.service
●   ├─systemd-journal-flush.service
●   ├─systemd-journald.service
●   ├─systemd-machine-id-commit.service
●   ├─systemd-modules-load.service
●   ├─systemd-random-seed.service
●   ├─systemd-sysctl.service
●   ├─systemd-timesyncd.service
●   ├─systemd-tmpfiles-setup-dev.service
●   ├─systemd-tmpfiles-setup.service
●   ├─systemd-udev-trigger.service
●   ├─systemd-udevd.service
●   ├─systemd-update-utmp.service
●   ├─cryptsetup.target
●   ├─local-fs.target
●   │ ├─-.mount
●   │ ├─boot-efi.mount
●   │ ├─systemd-fsck-root.service
●   │ └─systemd-remount-fs.service
●   └─swap.target
●     └─swapfile.swap

With a red circle next to [email protected]. However, if I execute

sudo /etc/init.d/postgresql status

I get the following output:

● postgresql.service - PostgreSQL RDBMS
   Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
   Active: active (exited) since Thu 2019-11-21 15:19:29 +05; 5min ago
  Process: 24403 ExecReload=/bin/true (code=exited, status=0/SUCCESS)
  Process: 24368 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
 Main PID: 24368 (code=exited, status=0/SUCCESS)

systemd[1]: Starting PostgreSQL RDBMS...
systemd[1]: Started PostgreSQL RDBMS.
systemd[1]: Reloading PostgreSQL RDBMS.
systemd[1]: Reloaded PostgreSQL RDBMS.

And then If I run

netstat -tulpn | grep :5432

There's no output. Same goes for service postgresql start

I can't find the process with PID 24368 using sudo lsof -i -P -n

What's the problem?

EDIT

While installing postgres I noticed the following output

Ver Cluster Port Status Owner    Data directory              Log file
10  main    5432 down   postgres /var/lib/postgresql/10/main /var/log/postgresql/postgresql-10-main.log

With latter line red-highlighted. What is that?

BTW, both folders are empty, I can't check what's in these files

EDIT

Finally, after executing systemctl status [email protected]

I see

[email protected] - PostgreSQL Cluster 10-main
       Loaded: loaded (/lib/systemd/system/[email protected]; disabled; vendor preset: enabled)
       Active: failed (Result: protocol) since Thu 2019-11-21 15:04:20 +05; 58min ago
    Condition: start condition failed at Thu 2019-11-21 15:57:01 +05; 5min ago
               └─ ConditionPathExists=/etc/postgresql/10/main/postgresql.conf was not met

systemd[1]: Starting PostgreSQL Cluster 10-main...
postgresql@10-main[22146]: Error: /usr/lib/postgresql/10/bin/pg_ctl /usr/lib/postgresql/10/bin/pg_ctl start -D /var/lib/postgresql/10/main -l
postgresql@10-main[22146]: 2019-11-21 15:04:20.265 +05 [22151] FATAL:  private key file "/etc/ssl/private/ssl-cert-snakeoil.key" must be owne
postgresql@10-main[22146]: 2019-11-21 15:04:20.265 +05 [22151] LOG:  database system is shut down
postgresql@10-main[22146]: pg_ctl: could not start server
postgresql@10-main[22146]: Examine the log output.
systemd[1]: [email protected]: Can't open PID file /var/run/postgresql/10-main.pid (yet?) after start: No such file or directory
systemd[1]: [email protected]: Failed with result 'protocol'.
systemd[1]: Failed to start PostgreSQL Cluster 10-main.
2
  • Any errors in postgres log? Commented Nov 21, 2019 at 10:42
  • How can I see it? Commented Nov 21, 2019 at 10:45

2 Answers 2

1

I have no idea what was wrong but after deleting user postgres, deleting the folders from this second answer and reinstalling with

sudo apt-get update
sudo apt-get install postgresql postgresql-contrib

Now I can see it. Bloody hell spent almost 4 hours doing that!

Sign up to request clarification or add additional context in comments.

Comments

0

Did you define a specific security configuration in PostgreSQL or your server?

I never a line like this one:

FATAL: private key file "/etc/ssl/private/ssl-cert-snakeoil.key" must be owne

From your systemctl status [email protected] results

Can you modify the ownership of the certificate file?

4 Comments

I did, rebooted my computer, got [email protected] - PostgreSQL Cluster 10-main Loaded: loaded (/lib/systemd/system/[email protected]; disabled; vendor preset: enabled) Active: inactive (dead)
After executing systemctl status [email protected]
I did not set a specific security conf
Can you send us the full log line (right side was truncated)? + ``` ls -al /etc/ssl/private/ssl-cert-snakeoil.key" ```

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.