我在远程服务器群中有一个相当老旧的机器。所以我无法直接访问。只能通过远程 SSH(以及通过 SSH 连接到串行控制台)。我已经很久没有更新过这个机器了。现在,每当我想安装新软件包时,就会出现对 glibc 的依赖。不幸的是,glibc 的安装依赖于 2.6 内核,而我正在运行一个古老的 2.4 内核(这也是升级的另一个原因)。
问题是,安装新内核对 glibc 有间接(通过语言环境)依赖性。因此,要安装 glibc,我需要一个新内核。对于新内核,我需要升级 glibc。本质上我被阻止了。考虑到我没有“硬件”访问权限,最好的处理方法是什么?
以下是升级过程的简要记录:
[green:~]% sudo aptitude install linux-image-686
Reading Package Lists... Done
Building Dependency Tree
Reading extended state information
Initializing package states... Done
Reading task descriptions... Done
The following packages are unused and will be REMOVED:
gcc-4.3-base
The following NEW packages will be automatically installed:
dash libc6-i686 libparse-recdescent-perl linux-image-2.6-686
linux-image-2.6.18-6-686 module-init-tools yaird
The following packages have been kept back:
adduser apache2 apache2-mpm-prefork apache2-utils apache2.2-common apt
apt-utils aptitude autoconf autotools-dev awstats base-files base-passwd
[...snip...]
util-linux vacation vim vim-common wamerican wbritish wget whiptail whois
wwwconfig-common zlib1g
The following NEW packages will be installed:
dash libc6-i686 libparse-recdescent-perl linux-image-2.6-686
linux-image-2.6.18-6-686 linux-image-686 module-init-tools yaird
The following packages will be upgraded:
hotplug libc6
2 packages upgraded, 8 newly installed, 1 to remove and 277 not upgraded.
Need to get 0B/22.7MB of archives. After unpacking 52.1MB will be used.
Do you want to continue? [Y/n/?]
Writing extended state information... Done
Preconfiguring packages ...
(Reading database ... 34065 files and directories currently installed.)
Preparing to replace libc6 2.3.6.ds1-13 (using .../libc6_2.7-18lenny2_i386.deb) ...
Checking for services that may need to be restarted...
Checking init scripts...
WARNING: init script for postgresql not found.
[ --- libc6 config screen appears here --- ]
WARNING: POSIX threads library NPTL requires kernel version
2.6.8 or later. If you use a kernel 2.4, please upgrade it
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 etch sources to your /etc/apt/sources.list and run:
apt-get install -t etch linux-image-2.6
Then reboot into this new kernel, and proceed with your upgrade
dpkg: error processing /var/cache/apt/archives/libc6_2.7-18lenny2_i386.deb (--unpack):
subprocess pre-installation script returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/libc6_2.7-18lenny2_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Ack! Something bad happened while installing packages. Trying to recover:
dpkg: dependency problems prevent configuration of locales:
locales depends on glibc-2.7-1; however:
Package glibc-2.7-1 is not installed.
dpkg: error processing locales (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
locales
Reading Package Lists... Done
Building Dependency Tree
Reading extended state information
Initializing package states... Done
Reading task descriptions... Done
现在,如果我按照提示操作,我会得到以下结果。请注意,我使用的是aptitude
而不是,apt-get
以便从更好的依赖性跟踪中受益。我做过先尝试apt-get
一下。但是那又让我遇到了同样的问题。
[green:~]% sudo aptitude install -t etch linux-image-2.6.26-2-686
Reading Package Lists... Done
Building Dependency Tree
Reading extended state information
Initializing package states... Done
Reading task descriptions... Done
E: Unable to correct problems, you have held broken packages.
E: Unable to correct dependencies, some packages cannot be installed
E: Unable to resolve some dependencies!
Some packages had unmet dependencies. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following packages have unmet dependencies:
linux-image-2.6.26-2-686: Depends: initramfs-tools (>= 0.55) but it is not installable or
yaird (>= 0.0.13) but it is not installable or
linux-initramfs-tool which is a virtual package.
有任何想法吗?
答案1
在主题中,您说机器正在运行 Debian 3.1 (Sarge)。但是,您发布的 glibc 依赖性和错误消息表明您正在尝试安装来自 Debian 5.0 (Lenny) 的软件包。这可能意味着您的/etc/apt/sources.list
文件引用stable
而不是sarge
(即您正在从当前最新的稳定版本中获取软件包,而不是您已安装的版本)。
尝试编辑/etc/apt/sources.list
,将所有对 的引用替换stable
为sarge
。例如,如下一行:
deb http://ftp.uk.debian.org/debian/ stable main non-free contrib
应该变成:
deb http://ftp.uk.debian.org/debian/ sarge main non-free contrib
运行aptitude update
后您就能从 sarge 升级到最新的软件包。
然而,Sarge取消支持2008 年 3 月 31 日,因此最好将机器升级到 Lenny。由于 Lenny 是自 Sarge 以来发布的第二个主要版本,因此首先升级到中间版本 Etch 可能更容易。请查看发行说明的第 4 部分蚀刻和伦尼了解具体操作方法。在开始之前,最好确保有一个可行的备份,以防万一出现问题。
答案2
我有一个想法,但它可能会导致包装损坏,因此请先备份,或者在其他机器上尝试:
dpkg
您可以通过选项安装包--force-depends
,该选项将所有依赖问题转变为警告。
我曾用它安装过打印机驱动程序,效果很好 - 因为从技术上讲,一切都安装正确。唯一的问题是,aptitude 随后报告了损坏的软件包。我不知道如何修复它们(而且打印机驱动程序并不重要,不值得投入大量时间,所以我只是卸载了它)。