如何修復 apt-get check` 失敗,您可能損壞了軟體包

如何修復 apt-get check` 失敗,您可能損壞了軟體包

我嘗試透過刪除並重新安裝 box autodl 軟體包來修復運行 Ubuntu 18.04.1 LTS (GNU/Linux 4.9.0-15-amd64 x86_64) 和 Swizzin Box 的租用專用伺服器上損壞的 autodl irssi 安裝。

刪除 autodl 給:-

SUCCESS autodl removed 
ERROR dpkg database is locked by apt-get. Please try again later

嘗試重新安裝它給了:-

INFO Installing autodl 
E: Unable to correct problems, you have held broken packages. 
ERROR The simulation check resulted in an error. Please consult the log.

日誌顯示

Reading package lists...
Building dependency tree...
Reading state information...
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 pkg-config : Depends: libdpkg-perl but it is not installed

運行“apt --fix-broken install”給出:-

0 upgraded, 0 newly installed, 1 to remove and 107 not upgraded.
After this operation, 193 kB disk space will be freed.
Do you want to continue? [Y/n] y

(Reading database ... 87206 files and directories currently installed.)

Removing pkg-config (0.29-4+b1) ...

Can't locate Dpkg/Arch.pm in @INC (you may need to install the Dpkg::Arch module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/share/pkg-config-dpkghook line 14.

BEGIN failed--compilation aborted at /usr/share/pkg-config-dpkghook line 14.

dpkg: error processing package pkg-config (--remove):

 subprocess installed pre-removal script returned error exit status 2

Errors were encountered while processing:

 pkg-config

E: Sub-process /usr/bin/dpkg returned an error code (1)

有人對我如何解決這個問題有任何建議嗎?

答案1

嘗試sudo apt --fix-broken install libdpkg-pearl。另外,請查看是否有任何固定的套件:運行apt policy,並檢查是否有任何有趣的東西。在這種情況下,“有趣”包括任何第三方存儲庫:如果該行不包括“ubuntu.com”,則它是可疑的。

在某些情況下,需要第三方儲存庫(那些不是來自 Canonical 的儲存庫),例如對於無法重新分發的專有軟體或當軟體的最新上游版本是硬性要求時。但是,這些儲存庫必須專門設計用於您擁有的任何作業系統的基本安裝,並且不應包含無關的套件。您絕對不應該嘗試透過新增對另一個作業系統的參考來獲得相容性:例如,透過新增 Debian Stretch 作為 Ubuntu Bionic 版本的軟體套件來源。可能會發生許多奇怪的包衝突和意外的替換。

我無法在 chroot 中重新創建這種情況:apt --fix-broken install即使在進行了一些積極的刪除之後也能正常工作。 Aptitude 或許可以為您提供更多信息,但考慮到您當前的軟體包混亂,我懷疑您是否能夠運行它。的貼箱dpkg --list將是下一個調試資訊。

相關內容