1. 程式人生 > >安裝軟體時依賴衝突的萬能解決方案

安裝軟體時依賴衝突的萬能解決方案

宣告

前言

好吧,可能是個標題黨了.

不過如果你這個方法還不能解決依賴衝突,那就我目前就不知道有什麼辦法了.

不過一般情況下,使用這個方法都可以修復問題的.

正文

基礎的解決方案

如果你是剛遇到依賴衝突問題,可以先參考這裡基本的解決方案.

進入正題

先說說背景吧.

使用基礎解決方案不能解決的,更嚴重的是,想重灌那些軟體,卻解除安裝不了,提示依賴衝突.

這個時候我都想重灌系統了,可是我配置了這個多東西,安裝了這個多軟體等原因,不到最後一步我不想選擇重灌系統這個方法,畢竟重灌系統不一定能解決衝突問題.

不過,我最終還是找到了解決方案.

這就分享出來,幫大家多一個選擇的解決方案,當然不到萬不得已請不要選擇這個方法.

現在我們來看看這個依賴的衝突問題吧.

安裝軟體時提示的是什麼錯誤資訊呢?

安裝的軟體依賴的軟體版本過低.

首先系統怎麼知道依賴衝突呢?

應該是每個軟體都寫清楚了自己依賴哪些軟體以及這些軟體的最低版本.

那我們能不能手動修改這些依賴的軟體的版本呢?

如果知道這些資訊在哪裡儲存,那就可以修改了.

那這些資訊在哪裡儲存呢?

貌似在 /var/lib/dpkg/status 這個檔案裡面.

比如我的 vim-common 的資訊

Package: vim-common
Status: install ok installed
Priority: important
Section: editors
Installed-Size: 296
Maintainer: Ubuntu Developers <
[email protected]
> Architecture: i386 Source: vim Version: 2:7.3.547-6ubuntu3~blueyed1~precise Depends: libc6 (>= 2.3.4) Recommends: vim | vim-gnome | vim-gtk | vim-athena | vim-nox | vim-tiny Conffiles: /etc/vim/vimrc 682aa2a07693cc27756eee9751db3903 Description: Vi IMproved - Common files Vim is an almost compatible version of the UNIX editor Vi. . Many new features have been added: multi level undo, syntax highlighting, command line history, on-line help, filename completion, block operations, folding, Unicode support, etc. . This package contains files shared by all non GUI-enabled vim variants (vim and vim-tiny currently) available in Debian. Examples of such shared files are: manpages, common executables like xxd, and configuration files. Homepage: http://www.vim.org/ Original-Maintainer: Debian Vim Maintainers <
[email protected]
>

可以看到裡面的兩個對我們來說重要的資料

Version: 2:7.3.547-6ubuntu3~blueyed1~precise
Depends: libc6 (>= 2.3.4)

假設我們的 libc6 的版本是 2.3.2 的話,安裝 vim-common 的話機會提示依賴衝突,說需要 libc6 的版本至少是 2.3.4.

此時我們可以做修改了最低依賴版本會怎麼樣呢?

比如

Version: 2:7.3.547-6ubuntu3~blueyed1~precise
Depends: libc6 (>= 2.3.2)
這是再次修復竟然成功了,也可以解除安裝了.

好吧,解決方案就是這個:把依賴的軟體的版本修改為目前安裝的版本即可.

參考