LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 972|回复: 0

解决testing中libc6升级时遇到的问题

[复制链接]
发表于 2007-7-18 13:24:27 | 显示全部楼层 |阅读模式
最近在升级时,遇到了包依赖冲突,后来在debianhelp.org上找到了解决方案。于是大致翻译了一下,希望对碰到类似问题的兄弟有用。

原帖标题: Error upgrading libc6 in Lenny
链接: http://www.debianhelp.org/node/8124

原帖提到的问题:


  1. Hi there,

  2. I tried to upgrade my Lenny installation and ran into an error:

  3. Quote:


  4.     Preconfiguring packages ...
  5.     (Reading database ... 46918 files and directories currently installed.)
  6.     Preparing to replace binutils 2.17-3 (using .../binutils_2.17cvs20070426-8_amd64.deb) ...
  7.     Unpacking replacement binutils ...
  8.     Preparing to replace libc6-dev 2.3.6.ds1-13 (using .../libc6-dev_2.5-9_amd64.deb) ...
  9.     Unpacking replacement libc6-dev ...
  10.     Preparing to replace locales 2.3.6.ds1-13 (using .../archives/locales_2.5-9_all.deb) ...
  11.     Unpacking replacement locales ...
  12.     Preparing to replace libc6 2.3.6.ds1-13 (using .../archives/libc6_2.5-9_amd64.deb) ...
  13.     Unpacking replacement libc6 ...
  14.     dpkg: error processing /var/cache/apt/archives/libc6_2.5-9_amd64.deb (--unpack):
  15.     trying to overwrite `/usr/lib64', which is also in package gtk-qt-engine
  16.     Errors were encountered while processing:
  17.     /var/cache/apt/archives/libc6_2.5-9_amd64.deb
  18.     E: Sub-process /usr/bin/dpkg returned an error code (1)

  19. This is apperently caused by an old version of gtk-qt-engine (see http://groups.google.com/group/linux.debian.user/browse_thread/thread/859db99bd3ca6825/92f2adf1f1100076?lnk=raot).
  20. If I try to remove gtk-qt-engine I'm getting
  21. Quote:


  22.     #apt-get -f remove gtk-qt-engine
  23.     Reading package lists... Done
  24.     Building dependency tree... Done
  25.     You might want to run `apt-get -f install' to correct these:
  26.     The following packages have unmet dependencies:
  27.     binutils: Depends: libc6 (>= 2.5-5) but 2.3.6.ds1-13 is to be installed
  28.     libc6-dev: Depends: libc6 (= 2.5-9) but 2.3.6.ds1-13 is to be installed
  29.     locales: Depends: glibc-2.5-1
  30.     E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

  31. Next attempt:

  32. Quote:


  33.     #apt-get -f install
  34.     Reading package lists... Done
  35.     Building dependency tree... Done
  36.     Correcting dependencies... Done
  37.     The following extra packages will be installed:
  38.     libc6
  39.     Suggested packages:
  40.     glibc-doc
  41.     The following packages will be upgraded:
  42.     libc6
  43.     1 upgraded, 0 newly installed, 0 to remove and 178 not upgraded.
  44.     3 not fully installed or removed.
  45.     Need to get 0B/4905kB of archives.
  46.     After unpacking 1749kB of additional disk space will be used.
  47.     Do you want to continue [Y/n]? Y
  48.     (Reading database ... 46941 files and directories currently installed.)
  49.     Preparing to replace libc6 2.3.6.ds1-13 (using .../archives/libc6_2.5-9_amd64.deb) ...
  50.     Unpacking replacement libc6 ...
  51.     dpkg: error processing /var/cache/apt/archives/libc6_2.5-9_amd64.deb (--unpack):
  52.     trying to overwrite `/usr/lib64', which is also in package gtk-qt-engine
  53.     Errors were encountered while processing:
  54.     /var/cache/apt/archives/libc6_2.5-9_amd64.deb
  55.     E: Sub-process /usr/bin/dpkg returned an error code (1)

  56. And with that my apt-powers are totally exhausted. What should I do now?

  57. TIA, Jabber
复制代码


解决方法,by pinniped

  1. I had a similar problem with a different package. The trick is either to make dpkg believe the older version isn't installed, the file in question doesn't belong to anyone else, or forcibly remove the old package without touching anything else.

  2. 1. Forcibly removing a package: this may fail because of the already existing install requests. Try 'apt-get install -f -s' to see what a 'fix' would do; if it temporarily removes the new package from the requests then that's fine. You might also try to temporarily remove the request for the new package by editing /var/lib/dpkg/status

  3. 2. Tricking dpkg into not seeing the file in the old package:
  4. Try going to /var/lib/dpkg/info and edit the *.list file for the old package - delete the line with a reference to that problem file.

  5. 3. Make dpkg believe the old file isn't installed:
  6. Remove it's entry from the 'status' file. Be sure to back up the status file first before something goes horribly wrong. Use the *.list file for the package to delete all other files installed. Make sure you do this before installing the new package or else you'll delete files that belong to the new one.

  7. Always use the "-s" option until you're happy that your commands won't destroy your system; be especially careful when forcing the removal of packages. I removed 'libc' once and that was fun.
复制代码


翻译过来就是欺骗debian的包管理系统,让 dpkg 相信旧版本的包没有安装、有问题的文件不属于任何包、或者保持其他依赖关系不变的前提下移除旧的包。

1、强制移除包:
由于已有的安装请求,这个方案可能不成功。运行
  1. apt-get install -f -s
复制代码

查看哪些包需要修复。如果可以临时从请求中移除新的包,就可以顺利通过。也可以尝试编辑 /var/lib/dpkg/status,以临时去掉对新包的请求。

2、欺骗 dpkg,使其“看不到”旧的包:
编辑 /var/lib/dpkg/info 下的旧包的 *.list 文件,删除其中包含有引用的有问题文件的行。

3、使 dpkg 相信旧文件没有安装:
status 文件中删除有关条目,编辑前注意先备份!通过此包的 *.list 文件信息删除 status 中的已经安装的其他文件条目。一定要在安装新包之前进行此工作,否则会删掉新包的文件。

一定要使用 -s 参数,确保只是模拟操作,否则会面临不可预料的后果。

下面是帖主的回复

  1. Hi,

  2. Thanks a lot, that worked!

  3. I went with 3. and deleted the entry for gtk-qt-engine, then did an "apt-get -f install && apt-get dist-upgrade". Afterwards I installed gtk-qt-engine, so I had no dangling files from its previous installation. All went fine.

  4. Thanks again!
复制代码


我是因为手动安装了 virtualbox,就导致 libc6 不能升级的一系列问题。也是按照方案3得到了解决。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表