1

I am new to PostgreSQL world and I am facing this issue:

When I try to start postgres 14 cluster using the following command:

pg_ctlcluster 14 testcluster start

It starts but gives me the hint that:

Warning: the cluster will not be running as a systemd service. Consider using systemctl:
 sudo systemctl start postgresql@14-testcluster

And when I try the suggested command, it asks for unix user postgres password, which I have ever seen or set.

[sudo] password for postgres:
  • Note 1: Ubuntu 22.04

  • Note 2: I am running as postgres unix user using this command:

    sudo su - postgres
    

What can I do?

asked May 29, 2024 at 19:00
4
  • If you can do sudo su - postgres (apparently as some other user), you can also do sudo systemctl start (as that same user). Commented May 29, 2024 at 19:04
  • My main user is a sudoer, but appearantly postgres user is not. This error: postgres is not in the sudoers file. This incident will be reported. Also trying to run the cluster using the other sudoer user as sudo using this command: sudo systemctl start postgresql@14-testcluster failed: Job for [email protected] failed because the service did not take the steps required by its unit configuration. but when I try: sudo -u postgres systemctl start postgresql@14-testcluster it asks for my sudoer password, which I don't have because I only use keys Commented May 29, 2024 at 19:12
  • As that same user (what you call "main"). Commented May 29, 2024 at 19:24
  • "Job for [email protected] failed because the service did not take the steps required by its unit configuration" OK, so figure out why. Look in the log file. Commented May 30, 2024 at 4:20

1 Answer 1

2

You can either edit /etc/sudoers to allow user postgres to run that command without having to specify a password, or you start and stop PostgreSQL using a different operating system user that has the permission to run the command.

answered May 31, 2024 at 7:34

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.