I have VM with **ubuntu 18.04 server** installed. I have installed **postgres 10** from the repo.

Default installation. I made some connection count related changes in postgres.conf and connection security related changes in pg\_hba.conf.

The install directories are all the default, including the data directory.

Server is running. I was able to create databases and access the same from java client.

But when I start psql from the same VM, it throws the following error.

```
Error: Invalid data directory

```

Just psql without any parameters also gives this error.

People have faced this error when they have tried to change the data directory which is not the case for me. Data directory is the default and it is owned by the postgres user.

```
ubuntu@ubuntu:~$ ls -l /var/lib/postgresql/10/
total 4
drwx------ 20 postgres postgres 4096 Jun 12 02:54 main

```

Any idea what could be the cause or where should I look for detailed error for psql client?