如何配置 apt-get 命令来忽略它要删除的命令?

如何配置 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 位包。

答案1

apt-get决定在安装另一个包的过程中删除一个包时,这是因为存在已声明的冲突(可能并不反映实际冲突)。非多架构包与来自另一个架构的相同包发生冲突;正如在回答中所解释的为什么尝试通过 apt 安装 64 位库会威胁删除许多必需的 32 位库?开发包经常出现这种情况。

不过,您可以使用 强制安装冲突的软件包dpkg --force-conflicts。您需要下载受影响的软件包并手动安装它们,并且apt-get在冲突解决之前您将无法使用(或者更确切地说,apt-get将坚持解决冲突)。您可能会破坏冲突中涉及的软件包,但至少您可以尝试...

apt-get我不知道禁用冲突处理的选项。

另一种方法是修复受影响的软件包;在大多数情况下这很简单,并且可以避免任何后续问题apt。例如,对于harfbuzzDebian 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之后ArchitecturePackage: libharfbuzz-dev

  • 添加更改日志条目,以便您的自定义包不会被存档中的当前版本替换:

    dch -n "Enable Multi-Arch on the -dev package."
    
  • 构建包(您需要在amd64构建器和i386构建器上执行此操作 - 这就是派上用场的pbuilder地方)sbuild

    dpkg-buildpackage -us -uc
    

这将生成可共同安装的libharfbuzz-dev软件包。它之所以有效,是因为这些软件包已经可以共同安装,只是缺少必要的元数据。harfbuzzDebian 9 中已修复此问题。

相关内容