Apt

APT 持有損壞的安裝

  • August 28, 2018

我正在使用 Debian 9.5 並且最近解除安裝了一個軟體包 ( mariadb),現在當我嘗試安裝一個新軟體包時,我不斷收到以下資訊:

E: Unable to correct problems, you have held broken packages.

我試過這些命令但沒有結果:

sudo dpkg --configure -a
sudo apt-get install -f
apt-get install --fix-broken

我還執行了這個命令來顯示損壞的包,但它沒有顯示任何內容:

apt-mark showhold

即使我嘗試執行 sudoapt-get upgrade我也得到了這個:

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

然後我能夠安裝 aptitude 包管理器(不知道如何),並嘗試安裝新包,sudo aptitude install mysql-server它顯示了一些東西:

The following packages have unmet dependencies:
libdbi-perl : Depends: perlapi-5.24.1 which is a virtual package, provided by:
                       - perl-base (5.24.1-3+deb9u4), but 5.26.2-7 is installed

libfcgi-perl : Depends: perlapi-5.24.1 which is a virtual package, provided by:
                        - perl-base (5.24.1-3+deb9u4), but 5.26.2-7 is installed

libterm-readkey-perl : Depends: perlapi-5.24.1 which is a virtual package, provided by:
                                - perl-base (5.24.1-3+deb9u4), but 5.26.2-7 is installed

libdbd-mysql-perl : Depends: perlapi-5.24.1 which is a virtual package, provided by:
                             - perl-base (5.24.1-3+deb9u4), but 5.26.2-7 is installed

The following actions will resolve these dependencies:

     Keep the following packages at their current version:         
1)      default-mysql-server [Not Installed]                        
2)      libcgi-fast-perl [Not Installed]                            
3)      libdbd-mysql-perl [Not Installed]                           
4)      libdbi-perl [Not Installed]                                 
5)      libfcgi-perl [Not Installed]                                
6)      libterm-readkey-perl [Not Installed]                        
7)      mariadb-server-10.1 [Not Installed]                         
8)      mysql-server [Not Installed]                                

     Leave the following dependencies unresolved:                  
9)      libcgi-pm-perl recommends libcgi-fast-perl (>= 1:2.01)      
10)     mariadb-client-10.1 recommends libdbd-mysql-perl (>= 1.2202)
11)     mariadb-client-10.1 recommends libdbi-perl                  
12)     mariadb-client-10.1 recommends libterm-readkey-perl     

這是輸出apt policy pearl-base

perl-base:    
   Installed: 5.26.2-7    
   Candidate: 5.26.2-7    
   Version table:    
*** 5.26.2-7 500   
   500 http://ftp.us.debian.org/debian testing/main amd64 Packages    
   100 /var/lib/dpkg/status    
5.24.1-3+deb9u4 500    
   500 http://httpredir.debian.org/debian stretch/main amd64 Packages    
   500 http://ftp.de.debian.org/debian stretch/main amd64 Packages     
   500 http://deb.debian.org/debian stretch/main amd64 Packages        

您的儲存庫中有測試,優先級為 500,與您的穩定儲存庫相同;這實際上意味著您正在執行 Debian 測試,而不是 Debian 9.5。(感謝您幫助測試 Debian 的下一個版本!

mysql-server目前無法在測試中使用,因此apt install mysql-server(或其變體)嘗試在 Debian stable 中安裝該版本;但這需要 Perl 的 Debian 穩定版,而不是 Debian 測試版,因此無法繼續安裝。

要解決這個問題,我建議恢復到 Debian stable。如果你想繼續測試,你必須等待 MySQL 遷移到那裡,或者切換到混合測試/不穩定設置。

引用自:https://unix.stackexchange.com/questions/465257