跳到主要內容

Ubuntu 安裝 package 出現 conflicts 時的解法

這篇只討論我自己常遇到的一個情境: 明明只是升級某個套件或加裝相關套件, aptitude 卻發瘋似的說有些相關套件的相依版本不合, 要移掉一大堆套件才能繼續。

解法是下指令時同時安裝目標套件和 aptitude 抱怨不合的相依套件。

實例如下:

$ sudo aptitude install git-svn
[100%] Reading package lists
...
The following NEW packages will be installed:
  git-svn libsvn-perl{a} libterm-readkey-perl{a}
The following packages will be upgraded:
  perl perl-base perl-modules
3 packages upgraded, 3 newly installed, 0 to remove and 793 not upgraded.
Need to get 10.3 MB of archives. After unpacking 4,449 kB will be used.
The following packages have unmet dependencies:
 libperl5.14 : Depends: perl-base (= 5.14.2-6ubuntu2.1) but 5.14.2-6ubuntu2.3 is to be installed.
Internal error: the solver Install(libc-bin:amd64 2.15-0ubuntu10.5 <libc6:i386 2.15-0ubuntu10.5 -> {libc-bin:amd64 2.15-0ubuntu10.5 libc-bin:i386 2.15-0ubuntu10.5}>) of a supposedly unresolved dependency is already installed in step 153
Internal error: the solver Install(libc-bin:amd64 2.15-0ubuntu10 <libc6:i386 2.15-0ubuntu10 -> {libc-bin:amd64 2.15-0ubuntu10 libc-bin:i386 2.15-0ubuntu10}>) of a supposedly unresolved dependency is already installed in step 335
Internal error: the solver Install(fontconfig-config:amd64 2.8.0-3ubuntu9 <libfontconfig1:i386 2.8.0-3ubuntu9 -> {fontconfig-config:amd64 2.8.0-3ubuntu9}>) of a supposedly unresolved dependency is already installed in step 337
The following actions will resolve these dependencies:

      Remove the following packages:
1)      gtk2-engines-murrine:i386
2)      hplip
3)      libatk1.0-0:i386
...
73)     printer-driver-hpijs
74)     telepathy-haze
75)     zlib1g:i386

      Leave the following dependencies unresolved:
76)     empathy recommends telepathy-haze
77)     foomatic-db-compressed-ppds recommends printer-driver-hpijs
78)     libsane-hpaio recommends hplip (= 3.12.2-1ubuntu3)
79)     ubuntu-desktop recommends hplip


Accept this solution? [Y/n/q/?] q
Abandoning all efforts to resolve these dependencies.
Abort.
$ sudo aptitude install git-svn libperl5.14
...
The following NEW packages will be installed:
  git-svn libsvn-perl{a} libterm-readkey-perl{a}
The following packages will be upgraded:
  libperl5.14 perl perl-base perl-modules
4 packages upgraded, 3 newly installed, 0 to remove and 792 not upgraded.
Need to get 10.3 MB of archives. After unpacking 4,449 kB will be used.
Do you want to continue? [Y/n/?] y
Selecting previously unselected package git-svn.
Unpacking git-svn (from .../git-svn_1%3a1.7.9.5-1_all.deb) ...
Processing triggers for man-db ...
Setting up libperl5.14 (5.14.2-6ubuntu2.3) ...
Setting up perl-modules (5.14.2-6ubuntu2.3) ...
Setting up perl (5.14.2-6ubuntu2.3) ...
Setting up libsvn-perl (1.6.17dfsg-3ubuntu3.3) ...
Setting up libterm-readkey-perl (2.30-4build3) ...
Setting up git-svn (1:1.7.9.5-1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
...
Current status: 792 updates [-4].
[fcamel@fc-vm ~/dev ]
$ git svn
fatal: Not a git repository (or any of the parent directories): .git
Already at toplevel, but .git not found
 at /usr/lib/git-core/git-svn line 308

2015/01/04 更新

可配合 apt-cache show PKG 了解套件的相依性, 實用例子見《Ubuntu 12.04 安裝 graphviz 遇到 confclit》

另外這個不知要記在那裡, 順便記在這裡: 安裝指定版本的方法: aptitude install PKG=VERSION。PKG=VERSION 的語法可用在 isntall, show, download, forbid-version 等指令。

留言

這個網誌中的熱門文章

(C/C++ ) 如何在 Linux 上使用自行編譯的第三方函式庫

以使用 LevelDB 為例。 抓好並編好相關檔案,編譯方式見第三方函式庫附的說明:$ ls include/ # header files leveldb/ $ ls out-shared/libleveldb.so* # shared library out-shared/libleveldb.so@ out-shared/libleveldb.so.1@ out-shared/libleveldb.so.1.20* 下面的例子用 clang++ 編譯,這裡用到的參數和 g++ 一樣。 問題一:找不到 header$ clang++ sample.cpp sample.cpp:5:10: fatal error: 'leveldb/db.h' file not found #include "leveldb/db.h" ^ 1 error generated. 解法:用 -I 指定 header 位置 問題二:找不到 shared library$ clang++ sample.cpp -I include/ /tmp/sample-2e7dd8.o: In function `main': sample.cpp:(.text+0x1e): undefined reference to `leveldb::Options::Options()' sample.cpp:(.text+0x6f): undefined reference to `leveldb::DB::Open(leveldb::Options const&, std::string const&, leveldb::DB**)' sample.cpp:(.text+0x10c): undefined reference to `leveldb::Status::ToString() const' sample.cpp:(.text+0x7d0): undefined reference to `leveldb::Status::ToString() const' clang: error: linker command failed with exit code 1 (u…

熟悉系統工具好處多多

記一下以前很困擾, 現在秒殺的小事。 更新這篇的時候, 忘了函式庫用的 man page 裝在那個 package。以前就會想辦法 google, 運氣好一下會找到, 運氣不好會多找一會兒。 這回我想到新作法:$ strace -e open man 3 printf > /dev/null # 發現是讀 /usr/share/man/man3/printf.3.gz $ dpkg --search /usr/share/man/man3/printf.3.gz # 找到套件名稱 manpages-dev $ aptitude show manpages-dev # 確認描述符合, 收工

virtualbox 使用 USB 裝置

2012-12-16 更新 現在 (4.x 版) 似乎無需做任何設定, 只要有裝 Oracle VM VirtualBox Extension Pack, 在 VirtualBox 視窗右下角按 USB 的圖示, 再點目標裝置, 即可加入或移除該裝置 同一時間只有 host 或 guest 可擁有該裝置, 所以從 guest OS 移除, 相當於接回 host OS 目前 VirtualBox 只支援 USB 2.0 的插槽, 若偵測不到時, 注意一下是否為這個問題 有時拔拔插插, VirtualBox 會進入奇怪的狀態, 接上去 guest OS 無法連接且跳出 device is busy 的錯誤訊息。試看看拔除該裝置, 重開 guest OS (續上則) 若重開 guest OS 無效, 並且 host OS 已移除該裝置, VirtualBox 的 USB 清單卻仍顯示 "captured", 試看看拔除該裝置, 重開 host OS原文網路上搜一下, 比較多是 Ubuntu 當 host 的解法, 我的情況是 Win7 當 host, Ubuntu 當 guest。 這兩篇說明很詳細《Learn How to Set Up USB and Networking Options in VirtualBox》《幻影千瞳的部落格: VirtualBox 使用筆記(二):使用 USB 裝置》 現在的版本圖形介面很好用了, 不用像第二篇說的那樣用指令操作。這裡記下我的操作步驟: 關掉 guest OS 在 VirtualBox 選單, 選擇 guest OS -> Settings -> USB -> Enable USB 2.0 會出現訊息框, 說明要安裝 Oracle VM VirtualBox Extension Pack。下載後安裝它 host OS 插入 USB 隨身碟 在 VirtualBox 選單, 選擇 guest OS -> Settings -> USB, 點右邊有綠色 "+" 的 USB 頭的圖示, 選擇該 USB 隨身碟, 加入它的 filter 從 host OS 移除 USB 隨身碟 開啟 guest OS 插入 USB 隨身碟, 於是 guest OS 會自動偵測…