Eu tenho uma máquina onde um usuário excluiu sua pasta postgresql da linha de comando em uma tentativa de desinstalar o postgres.
Agora, quando tentamos instalar outros pacotes - mesmo os não relacionados - continuamos recebendo mensagens de erro sobre o postgresql-common.
Eu tentei desinstalar tudo relacionado ao postgresql-9.3 e postgresql-9.4 manualmente através da linha de comando, mas isso não está funcionando.
Isso é o que acontece quando tento:
jj@testdev:~/Documents/svc_core_design/svc_core_git/svc-core-docs/net-svc$ sudo apt-get purge postgresql-client-9.3
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'postgresql-client-9.3' is not installed, so not removed
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
postgresql-9.3 : Depends: postgresql-client-9.3 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
jj@testdev:~/Documents/svc_core_design/svc_core_git/svc-core-docs/net-svc$
Para ver quais componentes do postgresql ele ainda tem, eu executei o seguinte comando:
sudo dpkg --get-selections | grep -v deinstall
postgresql-9.3 purge
postgresql-client-9.4 install
postgresql-client-common install
postgresql-common install
Eu gostaria de remover todos os itens relacionados ao postgresql, se possível, ou reinstalá-los para que ele funcione corretamente (não é necessário ter as duas versões se reinstalarmos. Apenas 9,4 ficaria bom).
Você pode me dizer como eu posso fazer isso via linha de comando?
EDIT 1
Aqui estão os resultados de tentar executar o "sudo apt-get -f install" sem qualquer nome de pacote:
jj@testdev:/var/lib/postgresql$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libjs-underscore linux-image-3.16.0-25-generic linux-image-3.16.0-33-generic linux-image-extra-3.16.0-25-generic linux-image-extra-3.16.0-33-generic
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up postgresql-common (166.pgdg14.10+1) ...
insserv: warning: script 'mongod' missing LSB tags and overrides
insserv: Default-Start undefined, assuming empty start runlevel(s) for script 'mongod'
insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script 'mongod'
* Starting PostgreSQL 9.3 database server * Error: /var/lib/postgresql/9.3/main is not accessible or does not exist
[fail]
* Starting PostgreSQL 9.4 database server * Error: /var/lib/postgresql/9.4/main is not accessible or does not exist
[fail]
invoke-rc.d: initscript postgresql, action "start" failed.
dpkg: error processing package postgresql-common (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
postgresql-common
E: Sub-process /usr/bin/dpkg returned an error code (1)
jj@testdev:/var/lib/postgresql$ sudo
Eu também me certifiquei de que o dono da pasta / var / lib / postgresql seja postgres, caso isso ajude.
Talvez eu deva criar manualmente a estrutura de pastas que está reclamando?
/var/lib/postgresql/9.3/main
Alguma outra sugestão?
EDIT 2
Eu instalei o aptitude e tentei limpar o postgresql 9.3 e 9.4
Ele falha com:
jj@testdev:/var/lib/postgresql$ sudo aptitude purge postgresql-9.3
The following packages will be REMOVED:
postgresql-9.3{p}
The following partially installed packages will be configured:
postgresql-common
0 packages upgraded, 0 newly installed, 1 to remove and 5 not upgraded.
Need to get 0 B of archives. After unpacking 17.6 MB will be freed.
Do you want to continue? [Y/n/?] Y
(Reading database ... 339475 files and directories currently installed.)
Removing postgresql-9.3 (9.3.5-2.pgdg14.10+1) ...
* Stopping PostgreSQL 9.3 database server * Error: /var/lib/postgresql/9.3/main is not accessible or does not exist
[fail]
invoke-rc.d: initscript postgresql, action "stop" failed.
dpkg: error processing package postgresql-9.3 (--purge):
subprocess installed pre-removal script returned error exit status 1
Errors were encountered while processing:
postgresql-9.3
E: Sub-process /usr/bin/dpkg returned an error code (1)
Failed to perform requested operation on package. Trying to recover:
Setting up postgresql-common (166.pgdg14.10+1) ...
* Starting PostgreSQL 9.3 database server * Error: /var/lib/postgresql/9.3/main is not accessible or does not exist
[fail]
* Starting PostgreSQL 9.4 database server * Error: /var/lib/postgresql/9.4/main is not accessible or does not exist
[fail]
invoke-rc.d: initscript postgresql, action "start" failed.
dpkg: error processing package postgresql-common (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
postgresql-common
jj@testdev:/var/lib/postgresql$
EDIT 3:
Aqui estão os resultados da execução do comando "sudo apt-get purgar postgresql-client-9.4 postgresql-client-common postgresql-common"
Removing postgresql-common (166.pgdg14.10+1) ...
* Stopping PostgreSQL 9.3 database server * Error: /var/lib/postgresql/9.3/main is not accessible or does not exist
[fail]
* Stopping PostgreSQL 9.4 database server * Error: /var/lib/postgresql/9.4/main is not accessible or does not exist
[fail]
invoke-rc.d: initscript postgresql, action "stop" failed.
dpkg: error processing package postgresql-common (--purge):
subprocess installed pre-removal script returned error exit status 1
* Starting PostgreSQL 9.3 database server * Error: /var/lib/postgresql/9.3/main is not accessible or does not exist
[fail]
* Starting PostgreSQL 9.4 database server * Error: /var/lib/postgresql/9.4/main is not accessible or does not exist
[fail]
invoke-rc.d: initscript postgresql, action "start" failed.
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 1
e quando eu verificar o que está instalado:
jj@testdev:/var/lib/postgresql$ sudo dpkg --get-selections | grep -v deinstall | grep post
libreoffice-sdbc-postgresql install
postgresql-9.3 purge
postgresql-9.4 purge
postgresql-common purge
printer-driver-postscript-hp install
jj@testdev:/var/lib/postgresql$