Could not change directory to "/home/novski": Permission denied

I followed the doc Do a fresh install of MAAS until step 3 where the command is:

sudo -u postgres psql -c "CREATE USER \"$MAAS_DBUSER\" WITH ENCRYPTED PASSWORD '$MAAS_DBPASS'"

I get:

could not change directory to "/home/novski": Permission denied

While echo $MAAS_DBUSER prints my user maas and same for *pass, *name and hostname.

What is suspect is that if I do that a second time, I get:
ERROR: role "maas" already exists

psql -U $MAAS_DBUSER -W -p 5432 -h localhost logs me in with the given $MAAS_DBPASS successfully

going on with step 4 leads to the same permission error:

sudo -u postgres createdb -O "$MAAS_DBUSER" "$MAAS_DBNAME"
could not change directory to "/home/novski": Permission denied

Checking then if the db exists (\l) shows me the created db as well.

I can get over that by doing it in postgres shell, but seams like a documentation problem to me that should be addressed…

Further I think it should be mentioned in step 5 that the $MAAS_DBNAME & $MAAS_DBUSER values have to be writen plain text.
And the IP in the doc should be not 0/0 but 127.0.0.1/24 or some sample that suites most users.

But regardless in the end by now, i get this:

django.db.utils.OperationalError: connection to server at "maas" (127.0.1.1), port 5432 failed: Connection refused
	Is the server running on that host and accepting TCP/IP connections?

Which i can’t understand.
What is 127.0.1.1?

I am running Ubuntu 22.04.1 LTS and installed maas with sudo snap install --channel=3.3 maas
and psql (PostgreSQL) 14.7 (Ubuntu 14.7-0ubuntu0.22.04.1)

i got an answer in postgres slack channel:

Answer:

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.