0

I want to remove postgresql-9.1 from Ubuntu 12.04

I use apt-get remove --purge postgresql-9.1

And I get error * Use of uninitialized value $info{"pgdata"} in -d at /usr/bin/pg_ctlcluster line 331.

I correctly set PGDATA="/var/lib/postgresql/data" in /etc/environment

Other actions, as pg_ctl stop or service postgresql stop make the same error

1 Answer 1

1

You could try this on your command line:

export PGDATA=/var/lib/postgresql/data

Then try the remove again. You might want to play around with different -f -m combinations to 'ignore' the error.

apt-get remove -f -m --purge postgresql-9.1

Or, you could, as root, just remove the files. First, make sure no postgres stuff is running (ps -ax | grep post). On my system I would:

rm -rf /var/lib/postgresql/data
rm -rf /usr/local/pgsql

(Careful with those rm -rf commands :-) )

The other thing that would need cleanup would be the startup and library stuff: Try:

ls /etc/*/postgr

if you see files like this:

/etc/init.d/postgresql             /etc/rc2.d/S20postgresql
/etc/ld.so.conf.d/postgresql.conf  /etc/rc3.d/S20postgresql
/etc/profile.d/postgres_path.sh    /etc/rc4.d/S20postgresql
/etc/rc0.d/K20postgresql           /etc/rc5.d/S20postgresql
/etc/rc1.d/K20postgresql           /etc/rc6.d/K20postgresql

then the next step would be to just rm them:

rm -f /etc/*/*postgr*

The aptitude management of packages is pretty handy. I haven't ever used it to remove packages, I always worry if that will really work right. Good luck.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.