No PostgreSQL clusters exist; see “man pg_createcluster”

Problem

After installing postgresql in a new Ubuntu 14.04 installation you get the error:

No PostgreSQL clusters exist; see "man pg_createcluster"

and when you try to start the server with:

sudo service postgresql start

you get the error that the server does not exist:

psql: coud not create to server: No such file or directory ...

Solution

The solution can be found in the article here, and is to create manually the first cluster by:

sudo pg_createcluster 9.3 main

Fixing a broken sudoers file without rebooting

Problem

If by accident you make a mistake in your sudoers file then you won’t be able to run sudo command after saving the file.

Solution

Following the answer here, you can simply run the command pkexec visudo, supply your password and provided you already had sudo permissions, fix the sudoers file, make sure that you save it using the Q when prompted, and you should be able to use sudo commands again.