title: Eliminating non-working PostgreSQL installations on Ubuntu 10.04 and starting afresh
body: <p>I find I have the wreckage of two old PostgreSQL installations on Ubuntu 10.04:</p>
  
  <pre><code>$ pg_lsclustersVersion Cluster   Port Status Owner    Data directory                     Log file
  Use of uninitialized value in printf at /usr/bin/pg_lsclusters line 38.
  8.4     main      5432 down   /var/lib/postgresql/8.4/main /var/log/postgresql/postgresql-8.4-main.log  
  Use of uninitialized value in printf at /usr/bin/pg_lsclusters line 38.
  9.1     main      5433 down   /var/lib/postgresql/9.1/main /var/log/postgresql/postgresql-9.1-main.log  
  $
  </code></pre>
  
  <p>Attempts to perform basic functions return errors, for instance:</p>
  
  <pre><code>createuser: could not connect to database postgres: could not connect to server: No such file or directory
      Is the server running locally and accepting
      connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
  </code></pre>
  
  <p>More information comes when I try to start the database server:</p>
  
  <pre><code>$ sudo /etc/init.d/postgresql start 
   * Starting PostgreSQL 9.1 database server
   * Error: The cluster is owned by user id 109 which does not exist any more
     ...fail!
  $ 
  </code></pre>
  
  <p>My question: how do I completely remove both clusters and set up a new one? I've tried removing, purging, and reinstalling <code>postgresql</code>, following the advice here: <a href="https://stackoverflow.com/a/2748644/621762">https://stackoverflow.com/a/2748644/621762</a>. Now <code>pg_lsclusters</code> shows no clusters in existence, but the <code>No such file or directory</code> error persists when I try to <code>createuser</code>, <code>createdb</code> or run <code>psql</code>. What have I failed to do?</p>