dist 업그레이드 후 apt(debian 6.1.20-1)가 손상됨

dist 업그레이드 후 apt(debian 6.1.20-1)가 손상됨

최근 분산 업그레이드를 수행하면서 완전히 충돌하는 상태에 빠졌습니다.

% sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 hplip : Depends: hplip-data (= 3.22.10+dfsg0-2) but 3.22.6+dfsg0-1 is installed
         Depends: printer-driver-hpcups (= 3.22.10+dfsg0-2) but 3.22.6+dfsg0-1 is installed
         Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 libpython3-dev : Depends: libpython3.11-dev (>= 3.11.2-1~) but it is not installed
 mercurial : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 python3-apt : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 python3-cairo : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 python3-cffi-backend : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 python3-dbus : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 python3-dev : Depends: python3 (= 3.11.2-1) but 3.10.6-1 is installed
               Depends: python3.11-dev (>= 3.11.2-1~) but it is not installed
               Depends: python3-distutils (>= 3.11.2-1~) but 3.10.7-1 is installed
 python3-gi : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 python3-gi-cairo : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 python3-lxml : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 python3-markupsafe : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 python3-pil : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 python3-pycurl : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 python3-renderpm : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 python3-reportlab-accel : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 python3-venv : Depends: python3.11-venv (>= 3.11.2-1~) but it is not installed
                Depends: python3 (= 3.11.2-1) but 3.10.6-1 is installed
                Depends: python3-distutils (>= 3.11.2-1~) but 3.10.7-1 is installed
 python3-yaml : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

apt install -f를 실행하려고 하면 다음과 같습니다.

% sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  hplip-data libpython3-stdlib libpython3.11-dev printer-driver-hpcups python3 python3-distutils python3-lib2to3 python3-minimal python3-numpy python3.11-dev
  python3.11-venv
Suggested packages:
  hplip-doc python3-doc python3-tk python3-pytest
The following packages will be REMOVED:
  python3.10-venv
The following NEW packages will be installed:
  libpython3.11-dev python3.11-dev python3.11-venv
The following packages will be upgraded:
  hplip-data libpython3-stdlib printer-driver-hpcups python3 python3-distutils python3-lib2to3 python3-minimal python3-numpy
8 upgraded, 3 newly installed, 1 to remove and 4 not upgraded.
31 not fully installed or removed.
Need to get 0 B/17.8 MB of archives.
After this operation, 36.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Traceback (most recent call last):
  File "/usr/bin/apt-listchanges", line 29, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
(Reading database ... 410707 files and directories currently installed.)
Preparing to unpack .../python3-numpy_1%3a1.24.2-1_amd64.deb ...
Unpacking python3-numpy (1:1.24.2-1) over (1:1.21.5-1+b1) ...
dpkg: error processing archive /var/cache/apt/archives/python3-numpy_1%3a1.24.2-1_amd64.deb (--unpack):
 trying to overwrite '/usr/bin/f2py', which is also in package python-numpy 1:1.16.2-1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/python3-numpy_1%3a1.24.2-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

기반으로https://stackoverflow.com/questions/13708180/python-dev-installation-error-importerror-no-module-named-apt-pkg 나는 시도했다:

% cd /usr/lib/python3/dist-packages 
% sudo ln -s apt_pkg.cpython-311-x86_64-linux-gnu.so apt_pkg.so
% sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  hplip-data libpython3-stdlib libpython3.11-dev printer-driver-hpcups python3 python3-distutils python3-lib2to3 python3-minimal python3-numpy python3.11-dev
  python3.11-venv
Suggested packages:
  hplip-doc python3-doc python3-tk python3-pytest
The following packages will be REMOVED:
  python3.10-venv
The following NEW packages will be installed:
  libpython3.11-dev python3.11-dev python3.11-venv
The following packages will be upgraded:
  hplip-data libpython3-stdlib printer-driver-hpcups python3 python3-distutils python3-lib2to3 python3-minimal python3-numpy
8 upgraded, 3 newly installed, 1 to remove and 4 not upgraded.
31 not fully installed or removed.
Need to get 0 B/17.8 MB of archives.
After this operation, 36.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Reading changelogs... Done
(Reading database ... 410707 files and directories currently installed.)
Preparing to unpack .../python3-numpy_1%3a1.24.2-1_amd64.deb ...
Unpacking python3-numpy (1:1.24.2-1) over (1:1.21.5-1+b1) ...
dpkg: error processing archive /var/cache/apt/archives/python3-numpy_1%3a1.24.2-1_amd64.deb (--unpack):
 trying to overwrite '/usr/bin/f2py', which is also in package python-numpy 1:1.16.2-1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/python3-numpy_1%3a1.24.2-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

같은 오류가 발생했습니다.

% sudo mv /usr/bin/python3 /usr/bin/python3.old
% sudo ln -s /usr/bin/python3.11 /usr/bin/python3
% sudo apt --fix-broken install

(위와 결합하여 단독으로)

여기서 어디로 가야할지 모르겠습니다.

답변1

문제는 다음과 같이 귀결됩니다.

dpkg: error processing archive /var/cache/apt/archives/python3-numpy_1%3a1.24.2-1_amd64.deb (--unpack):
 trying to overwrite '/usr/bin/f2py', which is also in package python-numpy 1:1.16.2-1

Python 2 python-numpy패키지는 Debian 11에서 제거되었습니다. 이 패키지도 제거해야 합니다.

sudo dpkg --purge python-numpy

관련 정보