TL;DR
Your Backtrack 5 R2-64 bit PostgreSQL database isn’t starting? This guide walks you through common causes and fixes, focusing on permissions, configuration files, and service management.
Fixing a Non-Loading Postgres Database in Backtrack 5
- Check the Service Status
- First, see if the PostgreSQL service is even running. Open a terminal and type:
sudo /etc/init.d/postgresql status - If it’s not running (shows ‘stopped’), try to start it:
sudo /etc/init.d/postgresql start - Look for any error messages during the startup attempt. These are crucial clues!
- First, see if the PostgreSQL service is even running. Open a terminal and type:
- Examine Log Files
- PostgreSQL logs errors to a specific file. The location varies, but common places include:
/var/log/postgresql/var/log/postgres- Check the
postgresql.conffile (see step 3) for the exact log path.
- Use a text editor or command like
tail -f /path/to/logfileto view the latest entries in real-time as you attempt to start the service.sudo tail -f /var/log/postgresql/postgresql.log
- PostgreSQL logs errors to a specific file. The location varies, but common places include:
- Verify Configuration File Permissions
- The
postgresql.conffile needs to be readable by the PostgreSQL user (usually ‘postgres’). Check its permissions:ls -l /etc/postgresql/9.1/main/postgresql.conf(Replace ‘9.1’ with your Postgres version if different.)
- If the permissions are incorrect (e.g., owned by root and not readable by postgres), change them:
sudo chown postgres:postgres /etc/postgresql/9.1/main/postgresql.confsudo chmod 640 /etc/postgresql/9.1/main/postgresql.conf
- The
- Check Data Directory Permissions
- The PostgreSQL data directory also needs the correct permissions. Find its location in
postgresql.conf(look for the ‘data_directory’ setting).grep data_directory /etc/postgresql/9.1/main/postgresql.conf - Once you know the path, verify permissions:
ls -l /var/lib/postgresql/9.1/main(Replace ‘9.1’ with your version and adjust the path as needed.)
- Ensure the ‘postgres’ user owns the directory and has read/write access:
sudo chown -R postgres:postgres /var/lib/postgresql/9.1/mainsudo chmod -R 700 /var/lib/postgresql/9.1/main
- The PostgreSQL data directory also needs the correct permissions. Find its location in
- Ensure the Data Directory Exists
- If the data directory specified in
postgresql.confdoesn’t exist, PostgreSQL won’t start.ls -l /var/lib/postgresql/9.1/main - Create it if necessary:
sudo mkdir -p /var/lib/postgresql/9.1/main(Replace ‘9.1’ with your version and adjust the path as needed.)
- If the data directory specified in
- Restart PostgreSQL
- After making any changes to permissions or configuration, restart the service:
sudo /etc/init.d/postgresql restart - Check the status again to confirm it’s running.
sudo /etc/init.d/postgresql status
- After making any changes to permissions or configuration, restart the service:
- Database Cluster Initialization (If Data Directory Was Empty)
- If you had to create the data directory, you need to initialize a new database cluster:
sudo -u postgres initdb -D /var/lib/postgresql/9.1/main(Replace ‘9.1’ with your version and adjust the path as needed.)
- If you had to create the data directory, you need to initialize a new database cluster:

