由于无法启动服务,无法卸载 postgresql 包?

Sta*_*ers 6 apt postgresql

我只是不明白发生了什么。

sudo apt-get remove postgresql
Run Code Online (Sandbox Code Playgroud)

结果是:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'postgresql' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 35 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up postgresql-9.1 (9.1.10-0ubuntu13.04) ...
 * Starting PostgreSQL 9.1 database server                                                                                                                                                            * The PostgreSQL server failed to start. Please check the log output:
2013-11-05 12:40:58 PST FATAL:  could not create lock file "/var/run/postgresql/.s.PGSQL.5432.lock": Permission denied
                                                                                                                                                                                              [fail]
invoke-rc.d: initscript postgresql, action "start" failed.
dpkg: error processing postgresql-9.1 (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 postgresql-9.1
E: Sub-process /usr/bin/dpkg returned an error code (1)
Run Code Online (Sandbox Code Playgroud)

我的意思是,它为什么要尝试启动服务器。是的,我是一个 unix noob 和一个巨大的 postgres noob,所以请耐心等待,但是在我尝试卸载时随机启动服务器似乎很随机。只是不明白。

如何完全卸载 postgresql?

Bra*_*iam 9

你的第一次安装是不确定的,这会破坏它:

sudo dpkg --purge postgresql-9.1
Run Code Online (Sandbox Code Playgroud)

现在您可以重新安装软件包:

sudo apt-get -f install
sudo apt-get install postgresql-9.1
Run Code Online (Sandbox Code Playgroud)