
postgresql을 제거하는 동안
sudo apt-get remove postgresql
다음과 같은 오류 메시지를 받았습니다.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'postgresql' is not installed, so not removed
The following packages were automatically installed and are no longer required:
account-plugin-windows-live libupstart1
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 17 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up postgresql-common (154ubuntu1) ...
* Starting PostgreSQL 9.3 database server * The PostgreSQL server failed to start. Please check the log output:
2015-07-08 11:16:50 PDT 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 package postgresql-common (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of postgresql-9.3:
postgresql-9.3 depends on postgresql-common (>= 142~); however:
Package postgresql-common is not configured yet.
dpkg: error processing package postgresql-9.3 (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
postgresql-common
postgresql-9.3
E: Sub-process /usr/bin/dpkg returned an error code (1)
Postgres를 제거하려고 할 때도 같은 일이 발생합니다. 여기서 무슨 일이 일어나고 있으며 Postgres를 올바르게 제거하려면 어떻게 해야 합니까?
답변1
너의 문제
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
내 솔루션
그만큼짧은 길
sudo rm /etc/init.d/postgresql
sudo rm /etc/init/postgresql.conf
sudo apt-get remove postgresql
아니면 그먼 길
파일 열기
/var/lib/dpkg/info/postgresql-common.postinst
sudo nano /var/lib/dpkg/info/postgresql-common.postinst
start 명령을 사용하여 행을 검색하십시오.
if [ -x "/etc/init.d/postgresql" ] || [ -e "/etc/init/postgresql.conf" ]; then invoke-rc.d postgresql start || exit $? fi
블록에 주석을 달다
# if [ -x "/etc/init.d/postgresql" ] || [ -e "/etc/init/postgresql.conf" ]; then # invoke-rc.d postgresql start || exit $? # fi
패키지를 다시 제거하십시오.
sudo apt-get remove postgresql
설명
을 제거하는 동안 postgresql
스크립트 postgresql-common.postinst
가 호출됩니다. 스크립트가 서비스를 시작하려고 시도하면 postgresql
실패합니다 invoke-rc.d postgresql start
(이유는 묻지 마세요).
이를 방지해야 합니다. 코드가 실행되는 조건을 변경하면 됩니다. 아니면 코드 자체를 제거하는 방법도 있습니다.