만쥬의 개발일기

프로젝트를 진행하던 중 python 버전을 바꿀 일이 생겨서, 3.10 버전을 설치하려고 다음 명령어들을 사용하고 있었는데,

  • sudo apt-get update
  • sudo apt-get upgrade
  • sudo apt install python3.10
  • etc..

아래 에러가 공통적으로 발생했다.

 

Setting up postgresql-common (190ubuntu0.1) ...
dpkg: error processing package postgresql-common (--configure):
 installed postgresql-common package post-installation script subprocess returned error exit status 10
dpkg: dependency problems prevent configuration of postgresql-10:
 postgresql-10 depends on postgresql-common (>= 182~); however:
  Package postgresql-common is not configured yet.

dpkg: error processing package postgresql-10 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of postgresql-plpython3-10:
 postgresql-plpython3-10 depends on postgresql-10 (= 10.23-0ubuntu0.18.04.2); however:
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up postgresql-common (190ubuntu0.1) ...
dpkg: error processing package postgresql-common (--configure):
 installed postgresql-common package post-installation script subprocess returned error exit status 10
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          dpkg: dependency problems prevent configuration of postgresql-10:
 postgresql-10 depends on postgresql-common (>= 182~); however:
  Package postgresql-common is not configured yet.

dpkg: error processing package postgresql-10 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of postgresql-plpython3-10:
 postgresql-plpython3-10 depends on postgresql-10 (= 10.23-0ubuntu0.18.04.2); however:
  Package postgresql-10 is not configured yet.

dpkg: error processing package postgresql-plpython3-10 (--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-10
 postgresql-plpython3-10
E: Sub-process /usr/bin/dpkg returned an error code (1)

이는 postgresql 패키지가 손상되었음을 뜻하는데, 이틀동안 온 사이트에 올라온 다양한 해결 방법들을

모두 시도 해보았고 결국 해결했다.

시간이 없는 사람들은 마지막 해결 방법만 보아도 좋다

 

첫번째 해결 방법 : dpkg 패키지 재구성 (실패)

이 오류가 발생하는 원인 중 하나는 dpkg 데이터베이스가 손상되었을 때이다.

sudo dpkg --configure -a

위 명령어를 실행하면 설치되지 않은 압축이 풀린 패키지들이 재구성된다.

 

두번째 해결 방법 : 문제가 발생한 패키지 강제 설치(실패)

sudo apt install -f

-f 옵션을 사용하면 패키지를 강제 설치할 수 있다.

 

세번째 해결 방법 : 손상된 소프트웨어 패키지 제거(실패)

sudo apt remove --purge package_name

소프트웨어 패키지를 직접 제거한다.

 

네번째 해결 방법 : 패키지와 관련된 모든 파일 제거

문제가 발생한 패키지와 관련된 모든 파일을 제거해버리는 방법이다.

sudo ls -l /var/lib/dpkg/info | grep -i package_name

해당 명령어를 통해 문제가 발생한 패키지 (나는 postgresql과 sysstat 두 가지였다.) 와 관련된

모든 파일을 확인한다.

sudo rm -r /var/lib/dpkg/info/package-name

이후 다음 명령어를 사용하면 해당 패키지와 관련된 모든 파일이 제거 되고,

드디어 문제 해결,,!

 

++

sudo apt update

이후 패키지 목록을 업데이트 하였는데 이번엔 

Hit:1 ubuntu bionic InRelease
Ign:3 linux/chrome/deb stable InRelease                   
Get:2 /ubuntu bionic-updates InRelease [88.7 kB]   
Get:5 /linux/chrome/deb stable Release [943 B]             
Get:6 http://dl.google.com/linux/chrome/deb stable Release.gpg [819 B]         
Get:4 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB] 
Get:7 http://security.ubuntu.com/ubuntu bionic-security InRelease [83.2 kB]    
Reading package lists... Done                                 
E: Release file for http://dl.google.com/linux/chrome/deb/dists/stable/Release is not valid yet (invalid for another 2h 45min 28s). Updates for this repository will not be applied.
E: Release file for http://us.archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease is not valid yet (invalid for another 4h 34min 33s). Updates for this repository will not be applied.
E: Release file for http://us.archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease is not valid yet (invalid for another 1h 22min 16s). Updates for this repository will not be applied.
E: Release file for http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease is not valid yet (invalid for another 4h 32min 36s).

다음과 같은 에러가 발생했다.

sudo hwclock --hctosys

이 에러는 위 명령어로 가볍게 해결할 수 있었다.

이제 파이썬 버전을 업그레이드 하고, 다시 작업을 이어나갈 예정

 

레퍼런스 :

 

profile

만쥬의 개발일기

@KangManJoo

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!