Apt
如何將 apt-get 命令配置為忽略它要刪除的那些?
是否可以將 apt-get 命令配置為忽略它要刪除的某些軟體包。我執行 32 位和 64 位開發包以及在它們上創建的程序,這意味著我需要係統上的 xxx:i386 和它們的 64 位對應項。例如,在這個系統中,我需要安裝一個 64 位開發包所有相關的 32 位開發包都被標記為刪除。
root@ac02:/usr/src/packages/lazarus# apt-get -f install Reading package lists... Done Building dependency tree Reading state information... Done Correcting dependencies... Done The following packages were automatically installed and are no longer required: gir1.2-freedesktop:i386 gir1.2-glib-2.0:i386 gir1.2-pango-1.0:i386 libcairo-gobject2:i386 libcairo-script-interpreter2:i386 libexpat1-dev:i386 libgirepository-1.0-1:i386 libharfbuzz-gobject0:i386 libharfbuzz-icu0:i386 libice-dev:i386 liblzo2-2:i386 libpcre3-dev:i386 libpcrecpp0:i386 libpng12-dev:i386 libpthread-stubs0-dev:i386 libsm-dev:i386 libx11-dev:i386 libxau-dev:i386 libxcb-render0-dev:i386 libxcb-shm0-dev:i386 libxcb1-dev:i386 libxcursor-dev:i386 libxdamage-dev:i386 libxdmcp-dev:i386 libxext-dev:i386 libxfixes-dev:i386 libxinerama-dev:i386 libxrandr-dev:i386 libxrender-dev:i386 zlib1g-dev:i386 Use 'apt-get autoremove' to remove them. The following extra packages will be installed: gir1.2-atk-1.0 gir1.2-gdkpixbuf-2.0 gir1.2-gtk-2.0 libatk1.0-dev libcairo-script-interpreter2 libcairo2-dev libexpat1-dev libfontconfig1-dev libfreetype6-dev libgdk-pixbuf2.0-dev libglib2.0-dev libgtk2.0-dev libharfbuzz-dev libharfbuzz-gobject0 libice-dev libpango1.0-dev libpcre3-dev libpcrecpp0 libpixman-1-dev libpng12-dev libpthread-stubs0-dev libsm-dev libx11-dev libxau-dev libxcb-render0-dev libxcb-shm0-dev libxcb1-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev libxft-dev libxi-dev libxinerama-dev libxrandr-dev libxrender-dev Suggested packages: libcairo2-doc libglib2.0-doc libgtk2.0-doc libice-doc libpango1.0-doc libsm-doc libxcb-doc libxext-doc The following packages will be REMOVED: gir1.2-atk-1.0:i386 gir1.2-gdkpixbuf-2.0:i386 gir1.2-gtk-2.0:i386 libatk1.0-dev:i386 libcairo2-dev:i386 libfontconfig1-dev:i386 libfreetype6-dev:i386 libgdk-pixbuf2.0-dev:i386 libglib2.0-dev:i386 libgtk2.0-dev:i386 libharfbuzz-dev:i386 libpango1.0-dev:i386 libpixman-1-dev:i386 libxcomposite-dev:i386 libxft-dev:i386 libxi-dev:i386 The following NEW packages will be installed: gir1.2-atk-1.0 gir1.2-gdkpixbuf-2.0 gir1.2-gtk-2.0 libatk1.0-dev libcairo-script-interpreter2 libcairo2-dev libexpat1-dev libfontconfig1-dev libfreetype6-dev libgdk-pixbuf2.0-dev libglib2.0-dev libgtk2.0-dev libharfbuzz-dev libharfbuzz-gobject0 libice-dev libpango1.0-dev libpcre3-dev libpcrecpp0 libpixman-1-dev libpng12-dev libpthread-stubs0-dev libsm-dev libx11-dev libxau-dev libxcb-render0-dev libxcb-shm0-dev libxcb1-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev libxft-dev libxi-dev libxinerama-dev libxrandr-dev libxrender-dev 0 upgraded, 38 newly installed, 16 to remove and 33 not upgraded. 1 not fully installed or removed. Need to get 14.0 MB of archives. After this operation, 13.4 MB of additional disk space will be used. Do you want to continue? [Y/n]
當一個包被標記為刪除時,這是否意味著 apt-get 認為它與其他包衝突?我發現這是相當出乎意料的,因為大多數開發系統都在搜尋 32 位開發包時分別從 64 位包中搜尋。
當
apt-get
決定在安裝另一個包的過程中刪除一個包時,這是因為存在已聲明的衝突(可能不反映實際衝突)。非多架構包與來自另一個架構的相同包衝突;正如在回答為什麼試圖通過 apt 安裝 64 位庫威脅要刪除許多必需的 32 位庫時所解釋的那樣?開發包經常出現這種情況。儘管如此,您仍可以使用
dpkg --force-conflicts
. 您需要下載受影響的軟體包並手動安裝它們,並且在衝突解決之前您將無法使用apt-get
(或者更確切地說,apt-get
將堅持解決衝突)。您可能會破壞衝突中涉及的軟體包,但至少您可以嘗試…我不知道禁用
apt-get
衝突處理的選項。另一種方法是修復受影響的軟體包;在大多數情況下,這很簡單,並且可以避免任何後續問題
apt
。例如,harfbuzz
在 Debian 8 中:
- 下載原始碼並解壓:
dget http://httpredir.debian.org/debian/pool/main/h/harfbuzz/harfbuzz_0.9.35-2.dsc cd harfbuzz-0.9.35
- 在下面的行之後編輯
debian/control
並添加Multi-Arch: same``Architecture``Package: libharfbuzz-dev
- 添加更改日誌條目,以便您的自定義包不會被存檔中的目前版本替換:
dch -n "Enable Multi-Arch on the -dev package."
- 建構包(您需要在一個
amd64
建構器和一個i386
建構器上執行此操作 - 這是派上用場pbuilder
或sbuild
派上用場的地方)dpkg-buildpackage -us -uc
這將產生可共同安裝的
libharfbuzz-dev
軟體包。它之所以有效,是因為這些軟體包已經是可共同安裝的,它們只是缺少必要的元數據。因為harfbuzz
這已在 Debian 9 中修復。