![Ubuntu 22.04 上的軟體包系統已損壞](https://rvso.com/image/1072177/Ubuntu%2022.04%20%E4%B8%8A%E7%9A%84%E8%BB%9F%E9%AB%94%E5%8C%85%E7%B3%BB%E7%B5%B1%E5%B7%B2%E6%90%8D%E5%A3%9E.png)
Ubuntu 22.04 中軟體更新時提示錯誤。如何修復錯誤:「嘗試覆蓋與套件名稱的其他實例不同的共用檔案」。下面的例子:
trying to overwrite shared '/usr/lib/llvm-14/lib/libunwind.so.1.0',
which is different from other instances of package libunwind-14:i386
...
完整的終端輸出位於這個問題的底部
Errors were encountered while processing:
/var/cache/apt/archives/libunwind-14_1%3a14.0.0-1ubuntu1_i386.deb
/var/cache/apt/archives/libc++abi1-14_1%3a14.0.0-1ubuntu1_i386.deb
/var/cache/apt/archives/libc++1-14_1%3a14.0.0-1ubuntu1_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
螢幕1
螢幕2
螢幕3
完整輸出:
lis@lenovo:~$ sudo apt-get install -f
[sudo] password for lis:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
libc++1-14:i386 libc++abi1-14:i386 libunwind-14:i386
Suggested packages:
clang:i386
The following NEW packages will be installed:
libc++1-14:i386 libc++abi1-14:i386 libunwind-14:i386
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
5 not fully installed or removed.
Need to get 0 B/391 kB of archives.
After this operation, 1 475 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 215160 files and directories currently installed.)
Preparing to unpack .../libunwind-14_1%3a14.0.0-1ubuntu1_i386.deb ...
Unpacking libunwind-14:i386 (1:14.0.0-1ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/libunwind-14_1%3a14.0.0-1ubuntu1_i386.deb (--unpack):
trying to overwrite shared '/usr/lib/llvm-14/lib/libunwind.so.1.0', which is different from other instances of package libunwind-14:i386
Preparing to unpack .../libc++abi1-14_1%3a14.0.0-1ubuntu1_i386.deb ...
Unpacking libc++abi1-14:i386 (1:14.0.0-1ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/libc++abi1-14_1%3a14.0.0-1ubuntu1_i386.deb (--unpack):
trying to overwrite shared '/usr/lib/llvm-14/lib/libc++abi.so.1.0', which is different from other instances of package libc++abi1-14:i386
Preparing to unpack .../libc++1-14_1%3a14.0.0-1ubuntu1_i386.deb ...
Unpacking libc++1-14:i386 (1:14.0.0-1ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/libc++1-14_1%3a14.0.0-1ubuntu1_i386.deb (--unpack):
trying to overwrite shared '/usr/lib/llvm-14/lib/libc++.so.1.0', which is different from other instances of package libc++1-14:i386
Errors were encountered while processing:
/var/cache/apt/archives/libunwind-14_1%3a14.0.0-1ubuntu1_i386.deb
/var/cache/apt/archives/libc++abi1-14_1%3a14.0.0-1ubuntu1_i386.deb
/var/cache/apt/archives/libc++1-14_1%3a14.0.0-1ubuntu1_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
您應該刪除快取的版本並重試,因為它們有衝突。
第一的,刪除快取的版本:
sudo rm /var/cache/apt/archives/*.deb
sudo rm -R /var/cache/apt/archives/partial
下一個, 再試一次:
sudo apt update
sudo apt -f install
sudo apt dist-upgrade
請發布任何未來的錯誤。
編輯(請參閱下面的解決方案):
每個有問題的軟體包都是 i386 版本。每個包的 amd64 和 i386 版本在同一位置包含一個同名的文件,但該文件的哈希和不同。對於這些特定的軟體包,amd64 和 i386 版本不能共存。
解決方案是刪除 i386 版本,除非絕對有必要安裝 i386 版本。
只要小心一點且在接受 Y 之前,請務必檢查要刪除的軟體包列表運行後:
sudo apt remove libc++1-14:i386 libc++abi1-14:i386 libunwind-14:i386
在這種特殊情況下,OP 報告稱,libc++1-14:i386
僅刪除即可解決問題。