使用 apt 安裝或升級時出錯
我試圖將 debian 9 升級到 10,但是當我嘗試執行 sudo apt-get update、sudo apt-get upgrade 和 sudo apt-get full-upgrade 時,它們都收到了以下錯誤消息:
optiplex@optiplex:~$ sudo apt-get upgrade Reading package lists... Done Building dependency tree Reading state information... Done You might want to run 'apt --fix-broken install' to correct these. The following packages have unmet dependencies: linux-image-generic-lts-xenial : Depends: linux-firmware but it is not installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
我試著跑步
apt --fix-broken install
但後來我收到了這個錯誤資訊:
optiplex@optiplex:~$ sudo apt --fix-broken install Reading package lists... Done Building dependency tree Reading state information... Done Correcting dependencies... Done The following package was automatically installed and is no longer required: linux-image-4.9.0-8-amd64 Use 'sudo apt autoremove' to remove it. The following additional packages will be installed: linux-firmware The following NEW packages will be installed: linux-firmware 0 upgraded, 1 newly installed, 0 to remove and 10 not upgraded. 3 not fully installed or removed. Need to get 0 B/33.9 MB of archives. After this operation, 127 MB of additional disk space will be used. Do you want to continue? [Y/n] y WARNING: The following packages cannot be authenticated! linux-firmware Install these packages without verification? [y/N] y (Reading database ... 514688 files and directories currently installed.) Preparing to unpack .../linux-firmware_1.127.24_all.deb ... Unpacking linux-firmware (1.127.24) ... dpkg: error processing archive /var/cache/apt/archives/linux-firmware_1.127.24_all.deb (--unpack): trying to overwrite '/lib/firmware/cis/PE-200.cis', which is also in package firmware-linux-free 3.4 dpkg-deb: error: subprocess paste was killed by signal (Broken pipe) Errors were encountered while processing: /var/cache/apt/archives/linux-firmware_1.127.24_all.deb E: Sub-process /usr/bin/dpkg returned an error code (1)
有人可以幫我嗎?
編輯:
我正在閱讀 GAD3R 給出的說明,但這次每當我嘗試使用 apt 執行任何操作時,我都會收到一條略有不同的錯誤消息:
dpkg: error processing package snapd (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: snapd E: Sub-process /usr/bin/dpkg returned an error code (1)
編輯2:
我做到了,
apt-get upgrade
但我不斷收到錯誤:... Selecting previously unselected package x11proto-dev. Preparing to unpack .../513-x11proto-dev_2018.4-4_all.deb ... Unpacking x11proto-dev (2018.4-4) ... Preparing to unpack .../514-xbrlapi_5.6-10_amd64.deb ... Unpacking xbrlapi (5.6-10) over (5.4-7+deb9u1) ... Preparing to unpack .../515-xscreensaver-data_5.42+dfsg1-1_amd64.deb ... Unpacking xscreensaver-data (5.42+dfsg1-1) over (5.36-1) ... Preparing to unpack .../516-xscreensaver-gl_5.42+dfsg1-1_amd64.deb ... Unpacking xscreensaver-gl (5.42+dfsg1-1) over (5.36-1) ... Preparing to unpack .../517-xserver-xephyr_2%3a1.20.4-1_amd64.deb ... Unpacking xserver-xephyr (2:1.20.4-1) over (2:1.19.2-1+deb9u5) ... Preparing to unpack .../518-xterm_344-1_amd64.deb ... Unpacking xterm (344-1) over (327-2) ... Errors were encountered while processing: /tmp/apt-dpkg-install-3w5XWy/270-libel-api-java_3.0.0-2_all.deb /tmp/apt-dpkg-install-3w5XWy/303-libjsp-api-java_2.3.4-2_all.deb /tmp/apt-dpkg-install-3w5XWy/361-libwebsocket-api-java_1.1-1_all.deb /tmp/apt-dpkg-install-3w5XWy/433-plymouth_0.9.4-1.1_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1)
我在 Optiplex 755 PC 上執行 Debian 9
感謝您的時間!
尼古拉。
要將 debian 9 升級到 10,你應該在你的
/etc/apt/sources.list
:deb http://deb.debian.org/debian buster main deb http://deb.debian.org/debian-security/ buster/updates main deb http://deb.debian.org/debian buster-updates main
禁用目錄下的第三方儲存庫
/etc/apt/sources.list.d/
。在您的情況下,您啟用了 ubuntu-xenial 儲存庫(提供
linux-image-generic-lts-xenial
軟體包)它將破壞您的系統。然後執行:
sudo apt update sudo apt install linux-image-amd64 sudo apt upgrade sudo apt dist-upgrade
正如@Stephen Kitt所說,
linux-firmware_1.127.24_all.deb
屬於 Ubuntu Trusty 導致的error code (1)
,它應該被刪除:apt purge linux-firmware
。解決以下錯誤(
post-removal
腳本):Errors were encountered while processing: /var/cache/apt/archives/linux-firmware_1.127.24_all.deb E: Sub-process /usr/bin/dpkg returned an error code (1)
編輯
/var/lib/dpkg/info/linux-firmware.postrm
文件並將其內容替換為:#!/bin/bash /bin/true
解決以下錯誤(
post-installation
腳本):subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: snapd E: Sub-process /usr/bin/dpkg returned an error code (1)
編輯
/var/lib/dpkg/info/snapd.postinst
如下:#!/bin/bash /bin/true
更新:
備份
/var/lib/dpkg/status
然後/var/lib/dpkg/status-old
替換status
文件status-old
:sudo cp /var/lib/dpkg/status /var/lib/dpkg/status.bak1 sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status-old.bak1 sudo mv /var/lib/dpkg/status-old /var/lib/dpkg/status
然後執行:
sudo dpkg --configure -a sudo apt clean sudo apt autoclean sudo apt update sudo apt upgrade