为什么我升级到 12.04 会失败,并出现“未找到 glibc”或“libc6”或“需要内核 2.6.24”错误?

为什么我升级到 12.04 会失败,并出现“未找到 glibc”或“libc6”或“需要内核 2.6.24”错误?

我通过 ssh 将服务器安装从 11.04 升级到 11.10,然后升级到 12.04。一切似乎都正常 - 但 glibc 有一个小问题,它弄乱了我的 apt。

我试过了sudo apt-get install -f,但它没有得到它需要的东西。我在 OpenVZ 虚拟机中运行。

我该如何修复我的 apt 依赖项?

sysadmin@svr:~$ sudo apt-get update 
Ign http://archive.canonical.com precise InRelease
Ign http://archive.ubuntu.com precise InRelease
Ign http://archive.ubuntu.com precise-updates InRelease
Ign http://archive.ubuntu.com precise-security InRelease
Get:1 http://archive.ubuntu.com precise Release.gpg [198 B]
Hit http://archive.canonical.com precise Release.gpg 
Get:2 http://archive.ubuntu.com precise-updates Release.gpg [198 B]
Hit http://archive.canonical.com precise Release      
Get:3 http://archive.ubuntu.com precise-security Release.gpg [198 B]
Hit http://archive.canonical.com precise/partner i386 Packages
Get:4 http://archive.ubuntu.com precise Release [49.6 kB]
Ign http://archive.canonical.com precise/partner TranslationIndex
Get:5 http://archive.ubuntu.com precise-updates Release [49.6 kB]
Get:6 http://archive.ubuntu.com precise-security Release [49.6 kB]               
Get:7 http://archive.ubuntu.com precise/main i386 Packages [1274 kB]            
Ign http://archive.canonical.com precise/partner Translation-en                  
Get:8 http://archive.ubuntu.com precise/restricted i386 Packages [8431 B]
Get:9 http://archive.ubuntu.com precise/universe i386 Packages [4796 kB]
Hit http://archive.ubuntu.com precise/main TranslationIndex                                                                                                                       
Hit http://archive.ubuntu.com precise/restricted TranslationIndex                                                                                                                 
Hit http://archive.ubuntu.com precise/universe TranslationIndex                                                                                                                   
Get:10 http://archive.ubuntu.com precise-updates/main i386 Packages [20.2 kB]                                                                                                     
Get:11 http://archive.ubuntu.com precise-updates/restricted i386 Packages [770 B]                                                                                                 
Get:12 http://archive.ubuntu.com precise-updates/universe i386 Packages [2258 B]                                                                                                  
Get:13 http://archive.ubuntu.com precise-updates/main TranslationIndex [72 B]                                                                                                     
Get:14 http://archive.ubuntu.com precise-updates/restricted TranslationIndex [71 B]                                                                                               
Get:15 http://archive.ubuntu.com precise-updates/universe TranslationIndex [72 B]                                                                                                 
Get:16 http://archive.ubuntu.com precise-security/main i386 Packages [11.8 kB]                                                                                                    
Get:17 http://archive.ubuntu.com precise-security/restricted i386 Packages [14 B]                                                                                                 
Get:18 http://archive.ubuntu.com precise-security/universe i386 Packages [1357 B]                                                                                                 
Get:19 http://archive.ubuntu.com precise-security/main TranslationIndex [72 B]                                                                                                    
Get:20 http://archive.ubuntu.com precise-security/restricted TranslationIndex [70 B]                                                                                              
Get:21 http://archive.ubuntu.com precise-security/universe TranslationIndex [71 B]                                                                                                
Hit http://archive.ubuntu.com precise/main Translation-en                                                                                                                         
Hit http://archive.ubuntu.com precise/restricted Translation-en                                                                                                                   
Hit http://archive.ubuntu.com precise/universe Translation-en                                                                                                                     
Get:22 http://archive.ubuntu.com precise-updates/main Translation-en [9145 B]                                                                                                     
Hit http://archive.ubuntu.com precise-updates/restricted Translation-en                                                                                                           
Get:23 http://archive.ubuntu.com precise-updates/universe Translation-en [1344 B]                                                                                                 
Get:24 http://archive.ubuntu.com precise-security/main Translation-en [3549 B]                                                                                                    
Hit http://archive.ubuntu.com precise-security/restricted Translation-en                                                                                                          
Get:25 http://archive.ubuntu.com precise-security/universe Translation-en [760 B]                                                                                                 
Fetched 6279 kB in 57s (109 kB/s)                                                                                                                                                 
Reading package lists... Done
sysadmin@svr:~$ sudo apt-get ugrade
E: Invalid operation ugrade
sysadmin@svr:~$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 libc6 : Depends: libc-bin (= 2.13-20ubuntu5.1) but 2.15-0ubuntu10 is installed
 libncurses5 : Depends: libtinfo5 (= 5.9-1ubuntu5) but 5.9-4 is installed
 libnih-dbus1 : Depends: libnih1 (= 1.0.3-4ubuntu9) but 1.0.3-4ubuntu2 is installed
E: Unmet dependencies. Try using -f.
sysadmin@svr:~$ sudo apt-get install -f
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:
  libswscale0 libavutil50 python-support g++-4.5 libboost-program-options1.42.0 librpmio1 libpostproc51 libavformat52 libstdc++6-4.5-dev libavfilter1 libavcodec52
  libboost-filesystem1.42.0 libboost-system1.42.0 libavdevice52
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  libc-dev-bin libc6 libc6-dev libncurses5 libnih1
Suggested packages:
  glibc-doc
The following packages will be upgraded:
  libc-dev-bin libc6 libc6-dev libncurses5 libnih1
5 upgraded, 0 newly installed, 0 to remove and 335 not upgraded.
2 not fully installed or removed.
Need to get 0 B/9099 kB of archives.
After this operation, 1618 kB disk space will be freed.
Do you want to continue [Y/n]? 
locale: /lib/i386-linux-gnu/libc.so.6: version `GLIBC_2.15' not found (required by locale)
Preconfiguring packages ...
Setting up libc-bin (2.15-0ubuntu10) ...
(Reading database ... 31190 files and directories currently installed.)
Preparing to replace libc6-dev 2.13-20ubuntu5.1 (using .../libc6-dev_2.15-0ubuntu10_i386.deb) ...
Unpacking replacement libc6-dev ...
Preparing to replace libc-dev-bin 2.13-20ubuntu5.1 (using .../libc-dev-bin_2.15-0ubuntu10_i386.deb) ...
Unpacking replacement libc-dev-bin ...
Preparing to replace libc6 2.13-20ubuntu5.1 (using .../libc6_2.15-0ubuntu10_i386.deb) ...
locale: /lib/i386-linux-gnu/libc.so.6: version `GLIBC_2.15' not found (required by locale)
Checking for services that may need to be restarted...
Checking init scripts...
runlevel:/var/run/utmp: No such file or directory
Checking for services that may need to be restarted...
Checking init scripts...
runlevel:/var/run/utmp: No such file or directory
WARNING: init script for samba not found.
Stopping some services possibly affected by the upgrade (will be restarted later):
  cron: stopping...done.

WARNING: this version of the GNU libc requires kernel version
2.6.24 or later. Please upgrade your kernel before installing
glibc.

The installation of a 2.6 kernel _could_ ask you to install a new libc
first, this is NOT a bug, and should *NOT* be reported. In that case,
please add lenny sources to your /etc/apt/sources.list and run:
  apt-get install -t lenny linux-image-2.6
Then reboot into this new kernel, and proceed with your upgrade
dpkg: error processing /var/cache/apt/archives/libc6_2.15-0ubuntu10_i386.deb (--unpack):
 subprocess new pre-installation script returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Processing triggers for man-db ...
locale: /lib/i386-linux-gnu/libc.so.6: version `GLIBC_2.15' not found (required by locale)
Errors were encountered while processing:
 /var/cache/apt/archives/libc6_2.15-0ubuntu10_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
sysadmin@svr:~$ 

答案1

首先解释,然后解决方案:)

发生这种情况的原因是您的主机几乎肯定在 2.6.18 内核上运行 OpenVZ(所有 OpenVZ 容器共享主机内核)。原因可能包括稳定性,也可能只是纯粹的懒惰。问题是 Precise 附带的 libc 2.15 需要最低 2.6.24 内核才能运行。有时这会导致发布升级失败,但有可能完成并陷入部分升级的“两难”情况,就像您遇到的情况一样。

不过不用担心,libc 要求是一个编译时选项,可以将其设置得更低(在这种情况下,库包含旧内核的解决方法)。我猜将最低限度设置为 .24 是将人们拖入 2012 年的一种方法 :)

我已经建立了一个包含重新编译的 libc 的 PPA这将适用于2.6.18或更新版本(请检查uname -r!),它应该覆盖 Precise 提供的当前 libc。只需添加ppa:izx/ovz-libc,更新,然后应该让你克服这个问题。具体来说,像这样:

apt-add-repository ppa:izx/ovz-libc
apt-get update
apt-get -f install
do-release-upgrade

并继续,直到升级成功完成。我强烈建议不要替换任何已更改或不存在的配置文件。

当 libc 上游更新时,我将保持 ppa 更新。如果您想避免发生类似错误,您可能需要将libc-bin我的 PPA 设置为高优先级,这样它就不会更新,直到 PPA 提供“修复”版本。

希望这会有所帮助,如果有人有任何问题或其他反馈,请在此处发布。

答案2

尝试这个命令。你可以用 ++Alt打开终端:CtrlT

sudo apt-get -o APT::Immediate-Configure=0 -f install

之后你就可以做了sudo apt-get upgrade

我遇到了同样的问题...使用 Ubuntu 服务器...很奇怪不是吗?
希望它能帮到你。

答案3

对于所有陷入 do-dist-grade 而无法运行的人

apt-add-repository ppa:izx/ovz-libc

只需手动添加以下行即可/etc/apt/sources.list

deb http://ppa.launchpad.net/izx/ovz-libc/ubuntu lucid main

答案4

我不知道是否存在其他方法,但当 Ubuntu 以那种方式崩溃时,我没有备份桌面上的重要文件,碰巧我手头有 Ubuntu 11.10 启动多选项安装 CD,因此我使用该 CD 重新启动,然后选择“从 12.04 LTS 升级到 11.10”,在花费大量时间重新安装 11.10 之后,我终于可以重新启动并运行,并且重要文件完好无损。

相关内容