Setting up PostgreSQL Permission Denied

I am new at this building the app but I have been copying the commands and all seems to be going very well thus far until now. I am at the point to install PostgreSQL and I was able to do the following with out any issues :

sudo apt install -y postgresql
sudo systemctl start postgresql@14-main

Then I start to get into trouble.

rhanel@Ubuntu22:~$ sudo -u postgres bash
[sudo] password for rhanel:
postgres@Ubuntu22:/home/rhanel$ createuser -DRS gvm
createdb -O gvm gvmd
could not change directory to “/home/rhanel”: Permission denied
createuser: error: creation of new role failed: ERROR: role “gvm” already exists
could not change directory to “/home/rhanel”: Permission denied
createdb: error: database creation failed: ERROR: database “gvmd” already exists
postgres@Ubuntu22:/home/rhanel$

What Have I done wrong? Please help!

That’s not really an issue the commands are still working as expected. It was already on my todo list to avoid that the error messages gets printed to the console but sadly I forgot about it.

I’ve updated the docs now: Fix: Avoid permission errors when setting up postgres db by bjoernricks · Pull Request #326 · greenbone/docs · GitHub

You can ignore these two issues too because it seems you already did run them previously successfully. If you run them twice you will get these errors. All things for the postgres db should be fine. Just follow the next steps in the docs now :slight_smile:

1 Like