第 4 章 Upgrades from Debian 5.0 (lenny)

目录

4.1. 升级前的准备
4.1.1. 备份数据和配置文件
4.1.2. 提前告知用户
4.1.3. Prepare for downtime on services
4.1.4. 准备恢复
4.1.5. 为升级准备安全环境
4.1.6. Remove conflicting packages
4.2. 检查系统状态
4.2.1. 复审包管理器中的未决操作
4.2.2. 禁用 APT pinning 操作
4.2.3. 检查包状态
4.2.4. proposed-updates 区
4.2.5. 非官方源和 backports
4.3. 为 APT 准备源
4.3.1. 添加互联网 APT 源
4.3.2. 添加本地镜像 APT 源
4.3.3. 从 CD-ROM 或 DVD 添加 APT 源
4.4. 升级软件包
4.4.1. 记录会话
4.4.2. 更新包列表
4.4.3. 确保您有足够的空间升级
4.4.4. 最小系统升级
4.4.5. Upgrading the kernel and udev
4.4.6. Upgrading the system
4.5. 升级期间可能遇到的问题
4.5.1. cryptoloop support not included in the squeeze Linux kernel
4.5.2. Expected removals
4.5.3. Errors running aptitude or apt-get
4.5.4. Conflicts or Pre-Depends loops
4.5.5. File conflicts
4.5.6. Configuration changes
4.5.7. Change of session to console
4.5.8. Special care for specific packages
4.6. 升级内核与相关包
4.6.1. 安装内核元数据包
4.6.2. 设备枚举的顺序
4.6.3. Boot timing issues (waiting for root device)
4.7. 为下个发行版做准备
4.8. Deprecated components
4.9. 过时的包
4.9.1. 哑包

4.1. 升级前的准备

我们建议您在升级前阅读第 5 章 squeeze 中需要注意的问题中的信息。它描述了与升级过程有间接联系的潜在问题,但在升级前了解这些信息对您来说还是很重要的。

4.1.1. 备份数据和配置文件

在升级系统前,强烈建议您进行一次完整的备份,或者至少备份您不愿意丢失的数据和配置信息。升级工具和流程是非常可靠的,但升级过程中的硬件错误会对您的系统造成严重损害。

The main things you'll want to back up are the contents of /etc, /var/lib/dpkg, /var/lib/apt/extended_states and the output of dpkg --get-selections "*" (the quotes are important). If you use aptitude to manage packages on your system, you will also want to back up /var/lib/aptitude/pkgstates.

升级过程本身不会修改 /home 下的任何内容。但某些程序(比如部分 Mozilla 套件,以及 GNOME 和 KDE 桌面环境)会在新版本的程序第一次启动时用新的默认值来覆盖现有的用户设置。做为一种预防措施,您也许想备份用户目录下的隐藏文件和目录(dotfiles)。该备份有助于您恢复或者重建原有设置。另外,您可能还需要把该事项通知给用户。

任何软件包安装操作都必须以超级用户权限执行,您可以以 root 身份登录,或使用 su 或者 sudo 来获取必要的访问权限。

升级需要几个前提条件,您应当在实际升级前检查它们。

4.1.2. 提前告知用户

提前通知所有用户您正在计划的任何升级将是明智的决定,但是通过 ssh 连接访问您系统的用户可能在升级过程中不会注意到什么东西,而且应该可以继续正常工作。

如果您希望采取更多的预防措施,请在升级前备份或者卸载 /home 分区。

You will have to do a kernel upgrade when upgrading to squeeze, so a reboot will be necessary.

4.1.3. Prepare for downtime on services

There might be services that are offered by the system which are associated with packages that will be included in the upgrade. If this is the case, please note that, during the upgrade, these services will be stopped while their associated packages are being replaced and configured. During this time, these services will not be available.

The precise downtime for these services will vary depending on the number of packages being upgraded in the system, and it also includes the time the system administrator answers the configuration questions from different package upgrades (if any). Notice that if the upgrade process is left unattended and the system requests input throughout the upgrade there is a high possibility of services being unavailable[4] for a significant period of time.

If the system being upgraded provides critical services for your users or the network[5], you can reduce the downtime if you do a minimal system upgrade, as described in 第 4.4.4 节 “最小系统升级”, followed by a kernel upgrade and reboot (see 第 4.4.5 节 “Upgrading the kernel and udev”), and then upgrade the packages associated with your critical services. Upgrade these packages prior to doing the full upgrade described in 第 4.4.6 节 “Upgrading the system”. This way you can ensure that these critical services are running and available through the full upgrade process, and their downtime is reduced.

4.1.4. 准备恢复

由于 lenny 和 squeeze 的内核在驱动、硬件探测与命名以及设备文件的命名和排序等方面有着诸多变化,在更新后您可能会在重启系统时遇到很大的问题。本章和发行注记的下一章记录了很多已知的潜在问题。

由于这个原因,当您的系统重启失败(或对于远程管理系统来说,无法从网络唤醒)时,请确保您能够将其恢复。

如果您通过 ssh 远程连接进行升级,则强烈建议您采取必要的预防措施以便通过远程串行终端来访问该服务器。因为在升级内核并重启后,某些设备可能会被改名(如在第 4.6.2 节 “设备枚举的顺序”中所描述的情况),而您将不得不通过本地控制台修复系统配置。还有,如果系统在升级过程中意外重启您可能需要使用本地控制台进行修复。

很明显首先应尝试的就是以您原来的内核重启。然而,由于本文档其它地方所描述的各种各样的问题,并不保证可以成功重启。

如果重启失败了,您需要采取替代方案来启动您的系统以便访问和修复它。其中一种选择是使用特制的急救盘或者 Linux live CD。以这些介质引导后,您应该可以挂载您的根文件系统并 chroot 到它里面来检查并修复问题。

我们推荐的另一种选择是使用 squeeze Debian 安装程序的拯救模式。使用安装程序的优点是,您可以从众多安装方式中选择最适合您情况的一种。更多信息请查询安装手册第 8 章的修复损坏的系统一节以及 Debian 安装程序常见问题

4.1.4.1. initrd 引导时使用调试环境

initramfs-tools 在其生成的 initrd 中包含一个调试 shell[6] 。如果 initrd 无法挂载您的根文件系统,您将会进入此调试 shell,里面可以使用基本的命令以帮助跟踪问题甚至有可能解决之。

需要检查的几个基本项目:/dev 下是否存在正确的设备文件;加载了什么模块(cat /proc/modules);dmesg 的输出中有关驱动加载的错误信息。dmesg 的输出还会显示哪个设备文件被指定给哪个磁盘;您还应该检查 echo $ROOT 的输出,以确保根文件系统在预想的设备上。

如果您确实修复了问题,输入 exit 会退出调试 shell,并从先前失败的地方继续启动进程。当然您还需要修复更深层次的问题,并重新生成 initrd,以使下次引导不再失败。

4.1.5. 为升级准备安全环境

发行版升级应该从本机的文本模式虚拟控制台(或者直连串行终端),或者通过 ssh 远程连接进行。

[重要]重要

If you are using some VPN services (such as tinc) they might not be available throughout the upgrade process. Please see 第 4.1.3 节 “Prepare for downtime on services”.

为了在远程升级时获得额外的可靠性保障,我们建议您在由 screen 程序生成的虚拟控制台中执行升级过程。它能进行可靠的重新连接并确保,即使远程连接失败,升级过程也不会被打断。

[重要]重要

You should not upgrade using telnet, rlogin, rsh, or from an X session managed by xdm, gdm or kdm etc on the machine you are upgrading. That is because each of those services may well be terminated during the upgrade, which can result in an inaccessible system that is only half-upgraded. Use of the GNOME application update-manager is strongly discouraged for upgrades to new releases, as this tool relies on the desktop session remaining active.

4.1.6. Remove conflicting packages

Due to bug #512951, the splashy package needs to be purged prior to the upgrade.

	# apt-get purge splashy

4.2. 检查系统状态

此章所述的升级过程是为了从纯粹的 lenny 升级而安排的,即系统中没有第三方的软件。为使升级过程最可靠,您可能会希望在升级前,从系统中移除第三方的软件包。

Direct upgrades from Debian releases older than 5.0 (lenny) are not supported. Please follow the instructions in the Release Notes for Debian GNU/Linux 5.0 to upgrade to 5.0 first.

此过程也假定您的系统已经更新至 lenny 的最新发行点。如果您还未做或是不确定,请按照第 A.1 节 “升级您的 lenny 系统”中的说明做。

4.2.1. 复审包管理器中的未决操作

在某些情况下,使用 apt-get 代替 aptitude 安装软件包时,可能会让 aptitude 认为包未被使用,并安排它被移除。一般来说,在正式升级前您应该确保系统是最新且干净的

有鉴于此,您应该复查包管理器 aptitude 中是否有未决操作。如果包管理器中有软件包被安排为移除或更新,那么这可能对升级过程有负面影响。注意,要更正这一错误只可能是,您的 sources.list 仍然指向 lenny 而非 stable 或是 squeeze。参看第 A.2 节 “检查您的 sources list”

要执行复查的话,您必须以图形模式运行 aptitude 并按下 g (Go)。如果显示有任何未决操作,您都应该复查它们,然后要么修复,要么执行建议的操作。如果没有建议的操作,会有一条信息 没有软件包需要安装、删除或者升级出现。

4.2.2. 禁用 APT pinning 操作

如果已经设置 APT 从一个非 stable(如 testing)版安装特定软件包,您可能必须改变 APT pinning 设置(保存在 /etc/apt/preferences 中)以允许升级至新的 stable 版中的包。更多有关 APT pinning 的信息可以在 apt_preferences(5) 中找到。

4.2.3. 检查包状态

不管用什么方法升级,我们都建议您先检查所有软件包的状态,并验证所有包都处于可升级状态。以下命令会显示任何半安装或是配置失败的包,还有那些有任何错误状态的包。

# dpkg --audit

您也可以用 dselectaptitude 来审查系统中的所有包的状态,也可以用如下的命令来审查

# dpkg -l | pager

或是

# dpkg --get-selections "*" > ~/curr-pkgs.txt

在升级前移除所有的 hold 状态是很有必要的。如果有任何对升级而言有重大影响的包处于 hold 状态,升级会失败。

注意 aptitude 使用一种与 apt-getdselect 不同的方法来注册 hold 状态的包。您可以用以下命令来确认 aptitude 中处于 hold 状态的包。

# aptitude search "~ahold" 

如果您想检查 apt-get 中哪些包设置了 hold 状态,可以用

# dpkg --get-selections | grep hold

如果您在本地更改并重新编译了一个包,且并未重命名,或是在版本号中放入新的纪元号,您就必须将它设为 hold 状态,以防止它被升级。

The hold package state for apt-get can be changed using:

# echo package_name hold | dpkg --set-selections

Replace hold with install to unset the hold state.

如果有任何需要修复的东西,您最好确保 sources.list 仍然指向 lenny ,就像第 A.2 节 “检查您的 sources list”中所说的那样。

4.2.4. proposed-updates 区

如果您已经把 proposed-updates 区加入您的 /etc/apt/sources.list 文件,那么您应当在升级前移除它,这样可以降低冲突发生的概率。

4.2.5. 非官方源和 backports

如果有任何非 Debian 的软件包安装在您的系统中,您应该意识到它们可能会在升级期间因为依赖性冲突而被移除。如果这些包是通过在 /etc/apt/source.list 中添加一个额外的软件源而安装的,您应该检查那个软件源是否也提供 squeeze 下编译好的包,并同时像您的 Debian 软件源那样更改相应的源。

某些用户可能有非官方的 backported 较新的 包版本存在于他们安装的 Debian lenny 系统中。升级期间那样的包是最可能引起问题的,因为它们可能会导致文件冲突[7]第 4.5 节 “升级期间可能遇到的问题”已经有一些关于如何处理将会出现的文件冲突的信息了。

4.3. 为 APT 准备源

在开始升级前,您必须在软件包源列表 /etc/apt/sources.list 中设定 apt 的配置文件。

apt 会查找所有通过任意 deb 行找到的包,并安装带最高版本号的包,给予该文件第一行以优先权(所以,如果有多个镜像地址,您最好先命名本地硬盘,然后是 CD-ROM,最后是 HTTP/FTP 镜像)。

一个发行版通常既能通过它的代号(如:lenny, squeeze)引用,也可以用它的状态名引用(如:oldstable, stable, testing, unstable)。引用发行版的代号的好处在于,您绝对不会被新的发行版问题困扰且被带至此处。当然,这也意味着您不得不自己关注新版的发行。如果转而使用状态名,一旦有新版发行,您将只会看到一堆可用的软件包的更新。

4.3.1. 添加互联网 APT 源

默认配置用于从主 Debian 网络服务器上安装,但您可能希望修改 /etc/apt/sources.list 以使用其它的镜像,离您最近的网络镜像是一种更好的选择。

Debian HTTP 或 FTP 镜像地址能在 http://www.debian.org/distrib/ftplist 找到(参看 Debian 镜像列表一节)。HTTP 镜像通常比 FTP 镜像快。

例如,假设离您最近的 Debian 镜像是 http://mirrors.kernel.org。当用网络浏览器或是 FTP 程序检查那个镜像时,您会注意到主目录被组织成了如下情况:

http://mirrors.kernel.org/debian/dists/squeeze/main/binary-armel/...
http://mirrors.kernel.org/debian/dists/squeeze/contrib/binary-armel/...

要让 apt 使用这个镜像,您将此行添加至 sources.list 文件:

deb http://mirrors.kernel.org/debian squeeze main contrib

注意明显加上去的‘dists’,这个发行版名字后的参数用于将路径扩展成多个目录。

添加新源后,在 sources.list 中通过在以前存在的 deb 行前加上一个井号(#)来禁用它们。

4.3.2. 添加本地镜像 APT 源

您可能希望通过修改 /etc/apt/sources.list 来使用一个本地磁盘上的镜像(也许是通过 NFS 挂载的),来代替 HTTP 或 FTP 软件源镜像。

例如,假设您的镜像位于 /var/ftp/devian/ 下,并且有如下的主目录:

/var/ftp/debian/dists/squeeze/main/binary-armel/...
/var/ftp/debian/dists/squeeze/contrib/binary-armel/...

要让 apt 使用它,需要把这一行添加至 sources.list 文件:

deb file:/var/ftp/debian squeeze main contrib

注意明显加上去的‘dists’,这个发行版名字后的参数用于将路径扩展成多个目录。

添加新源后,在 sources.list 中通过在以前存在的 deb 行前加上一个井号(#)来禁用它们。

4.3.3. 从 CD-ROM 或 DVD 添加 APT 源

如果您想用 CD 安装,在 /etc/apt/sources.list 中的 deb 行前放上井号(#)注释掉它们。

确保在 /etc/fstab 中有一行允许您挂载 CD-ROM 于 /cdrom 挂载点(apt-cdrom 必须指定挂载点为 /cdrom )。例如,假设 /dev/hdc 就是您的 CD-ROM,/etc/fstab 中应该带有一行:

/dev/hdc /cdrom auto defaults,noauto,ro 0 0

注意在第四段 defaults,noauto,ro 之间必须无空格

要验证设置是否有效,插入一片 CD,尝试运行

# mount /cdrom    # 挂载 CD 至挂载点
# ls -alF /cdrom  # 显示 CD 的根目录
# umount /cdrom   # 卸载 CD

下一步,运行:

# apt-cdrom add

每片您所拥有的 Debian 二进制 CD-ROM 都要这么做,以便将每片 CD 的数据添加至 APT 的数据库。

4.4. 升级软件包

The recommended way to upgrade from previous Debian GNU/Linux releases is to use the package management tool apt-get. In previous releases, aptitude was recommended for this purpose, but recent versions of apt-get provide equivalent functionality and also have shown to more consistently give the desired upgrade results.

不要忘记挂载所有必需的分区(尤其是根分区和 /usr 分区)为可读写状态,用以下命令:

# mount -o remount,rw /mountpoint

下一步您应该详细检查 APT 源记录 (/etc/apt/source.list) 要么指向 squeeze 又或指向 stable。不应该有任何指向 lenny 的源记录。

[注意]注意

Source lines for a CD-ROM might sometimes refer to unstable; although this may be confusing, you should not change it.

4.4.1. 记录会话

强烈推荐您使用 /usr/bin/script 程序来记录升级会话中的交互信息。这样如果有问题了,您就有一份问题报告。而且需要的话,您也可以在错误报告中提供额外信息。要开始记录,输入:

# script -t 2>~/upgrade-squeezestep.time -a ~/upgrade-squeezestep.script

or similar. If you have to rerun the typescript (e.g. if you have to reboot the system) use different step values to indicate which step of the upgrade you are logging. Do not put the typescript file in a temporary directory such as /tmp or /var/tmp (files in those directories may be deleted during the upgrade or during any restart).

The typescript will also allow you to review information that has scrolled off-screen. If you are at the system's console, just switch to VT2 (using Alt+F2) and, after logging in, use less -R ~root/upgrade-squeeze.script to view the file.

在完成升级后,您可以在提示符下输入 exit 停止 script

如果已经对 script 使用了 -t 选项,您就可以用 scriptplay 程序来回放整个过程:

# scriptreplay ~/upgrade-squeeze.time ~/upgrade-squeeze.script

4.4.2. 更新包列表

首先,需要获取新发行版的可用包列表。执行:

# apt-get update

4.4.3. 确保您有足够的空间升级

You have to make sure before upgrading your system that you have sufficient hard disk space when you start the full system upgrade described in 第 4.4.6 节 “Upgrading the system”. First, any package needed for installation that is fetched from the network is stored in /var/cache/apt/archives (and the partial/ subdirectory, during download), so you must make sure you have enough space on the file system partition that holds /var/ to temporarily download the packages that will be installed in your system. After the download, you will probably need more space in other file system partitions in order to both install upgraded packages (which might contain bigger binaries or more data) and new packages that will be pulled in for the upgrade. If your system does not have sufficient space you might end up with an incomplete upgrade that might be difficult to recover from.

apt-get can show you detailed information of the disk space needed for the installation. Before executing the upgrade, you can see this estimate by running:

# apt-get -o APT::Get::Trivial-Only=true dist-upgrade
[ ... ]
XXX upgraded, XXX newly installed, XXX to remove and XXX not upgraded.
Need to get xx.xMB of archives. 
After this operation, AAAMB of additional disk space will be used.
[注意]注意

由于下一节将要谈到的问题,在即将开始更新前执行这条命令可能会给出一个错误。如果那样的话,您需要等至已经如第 4.4.4 节 “最小系统升级”所述的那样做过最小系统升级并且升级过内核,这样您才可以运行这条命令来预估所需的磁盘空间。

If you do not have enough space for the upgrade, apt-get will warn you with a message like this:

E: You don't have enough free space in /var/cache/apt/archives/.

In this situation, make sure you free up space beforehand. You can:

  • Remove packages that have been previously downloaded for installation (at /var/cache/apt/archives). Cleaning up the package cache by running apt-get clean will remove all previously downloaded package files.

  • 删除被遗忘的包。如果您安装过 popularity-contest,可以用 popcon-largest-unused 来列出系统中占用大量空间而又不用的那些包。您也可以用 deborphan 或是 debfoster 来找出过时的包(参看第 4.9 节 “过时的包”)。另一种可选方案是,您以图形模式运行 aptitude过时的且由本机创建的包下找到过时的包。

  • 删除占用太多空间且目前不需要的包(您总是可以在升级后重装它们的)。您可以用 dpigs (可在 debian-goodies 包中找到)或是用 wajig (运行 wajig size) 列出占用大量空间的包。

    You can list packages that take up most of the disk space with aptitude. Start aptitude in visual mode, select ViewsNew Flat Package List, press l and enter ~i, press S and enter ~installsize, then it will give you nice list to work with.

  • 如果不需要的话可以从系统中移除翻译和本地化文件。您可以安装并配置 localepurge 软件包,这样只有一小部分选择的本地化设置被保留在系统中。这将减少 /usr/share/locale 所使用的磁盘空间。

  • /var/log/ 下的系统日志临时放到其它系统,或是永久删除。

  • 使用临时目录 /var/cache/apt/archives:您可以使用来自另一个系统的临时缓存目录(USB 存储设备,临时硬盘,使用中的文件系统……)

    [注意]注意

    不要使用 NFS,这是因为网络连接可能在升级期间断开。

    例如,假设您将 USB 盘挂在 /media/usbkey 下:

    1. 删除以前安装时下载的包:

      # apt-get clean

    2. /var/cache/apt/archives 目录复制到 USB 磁盘:

      # cp -ax /var/cache/apt/archives /media/usbkey/

    3. 将临时缓存目录挂载至当前目录:

      # mount --bind /media/usbkey/archives /var/cache/apt/archives

    4. 升级后,还原 /var/cache/apt/archives 目录:

      # umount /media/usbkey/archives

    5. 删除留下的 /media/usbkey/archives

    您可以在挂载于系统中的任何文件系统上创建临时缓存目录。

  • Do a minimal upgrade of the system (see 第 4.4.4 节 “最小系统升级”) or partial upgrades of the system followed by a full upgrade. This will make it possible to upgrade the system partially, and allow you to clean the package cache before the full upgrade.

注意为了安全地移除软件包,建议您换回 lenny 的 sources.list,就像第 A.2 节 “检查您的 sources list”中描述的那样。

4.4.4. 最小系统升级

In some cases, doing the full upgrade (as described below) directly might remove large numbers of packages that you will want to keep. We therefore recommend a two-part upgrade process, first a minimal upgrade to overcome these conflicts, then a full upgrade as described in 第 4.4.6 节 “Upgrading the system”.

To do this first, run:

# apt-get upgrade

这会升级那些不需要删除或安装其它任何包的软件。

The minimal system upgrade can also be useful when the system is tight on space and a full upgrade cannot be run due to space constrains.

4.4.5. Upgrading the kernel and udev

The udev version in squeeze requires a kernel of version 2.6.26 or newer with the CONFIG_SYSFS_DEPRECATED option disabled and the CONFIG_INOTIFY_USER and CONFIG_SIGNALFD options enabled. Because the standard Debian kernels in lenny (version 2.6.26) have CONFIG_SYSFS_DEPRECATED enabled, and the udev version in lenny will not provide all the functionality expected by the latest kernels, special care must be taken when upgrading to avoid putting your system in an unbootable state.

Booting the 2.6.26 kernel from lenny with the udev from squeeze may result in a failure to correctly assign names to network devices, and will also fail to apply certain additional permissions to block devices (such as access by the disk group). The software itself will appear to be working, but some rules (for example, network-based rules) will not be loaded properly. It is therefore strongly recommended that you upgrade the kernel on its own at this point, to ensure a compatible kernel is available before upgrading udev.

要进行此次内核升级,执行:

# apt-get install linux-image-2.6-flavor

参看第 4.6.1 节 “安装内核元数据包”来帮助您决定应该安装哪个修订号的内核包。

The move of some firmware to separate packages in the non-free archive (see 第 2.2.2 节 “Firmware moved to the non-free section”) means that it may be necessary to install additional firmware packages after upgrading to the new kernel to support some hardware. Some hardware that was operating correctly before the upgrade might fail to work once the kernel is upgraded. Look out for warning messages from the kernel install or initramfs generation scripts, and make sure the necessary firmware packages are installed.

Immediately after upgrading the kernel, you should also install the new udev to minimize the risk of other incompatibilities caused by using the old udev with a new kernel [8]. You can do this by running:

# apt-get install udev

You should reboot the system [9] once you have upgraded both the kernel and udev.

4.4.6. Upgrading the system

Once you have taken the previous steps, you are now ready to continue with the main part of the upgrade. Execute:

# apt-get dist-upgrade
[注意]注意

The upgrade process for other releases recommended the use of aptitude for the upgrade. This tool is not recommended for upgrades from lenny to squeeze.

这将对系统进行一次全面的升级,比如:安装所有包的最新可用版本,解决不同发行版的包之间所有潜在的依赖性变动。如有必要,它会安装一些新包(通常是新库,或是重命名的包),并删除任何有冲突的过时包。

当从一套 CD-ROM (或 DVD)升级时,您会在升级期间的某几个地方被要求插入指定的 CD 盘片。您可能不得不多次插入相同的盘片,这是因为互相依赖的包已经被分散到整个 CD 套件中去了。

New versions of currently installed packages that cannot be upgraded without changing the install status of another package will be left at their current version (displayed as held back). This can be resolved by either using aptitude to choose these packages for installation or by trying apt-get -f install package.

4.5. 升级期间可能遇到的问题

The following sections describe known issues that might appear during an upgrade to squeeze.

4.5.1. cryptoloop support not included in the squeeze Linux kernel

Support for cryptoloop has been dropped from the Linux kernel packages included in Debian 6.0. Existing installations using cryptoloop need to be transitioned to dm-crypt before the upgrade.

4.5.2. Expected removals

The upgrade process to squeeze might ask for removal of packages in the system. The precise list of packages will vary depending on the set of packages that you have installed. These release notes give general advice on these removals, but if in doubt, it is recommended that you examine the package removals proposed by each method before proceeding.

Some common packages that are expected to be removed include: autofs (replaced by autofs5), dhcp3 (replaced by isc-dhcp), madwifi-source and python2.4 (replaced by python2.6). For more information about packages obsoleted in squeeze, see 第 4.9 节 “过时的包”.

4.5.3. Errors running aptitude or apt-get

如果使用 aptitude, apt-getdpkg 操作时出现错误

E: Dynamic MMap ran out of room

默认的缓存区空间不足。您可以通过删除或注释掉 /etc/apt/sources.list 中不需要的行,或通过增加缓存大小来解决这个问题。缓存大小能通过在 /etc/apt/apt.conf 中设置 APT::Cache-Limit 来增加。下面的命令会为它设置一个足够升级值:

# echo 'APT::Cache-Limit "12500000";' >> /etc/apt/apt.conf

这里假设您还未在那个文件中对该变量进行过设置。

4.5.4. Conflicts or Pre-Depends loops

Sometimes it's necessary to enable the APT::Force-LoopBreak option in APT to be able to temporarily remove an essential package due to a Conflicts/Pre-Depends loop. apt-get will alert you of this and abort the upgrade. You can work around this by specifying the option -o APT::Force-LoopBreak=1 on the apt-get command line.

It is possible that a system's dependency structure can be so corrupt as to require manual intervention. Usually this means using apt-get or

# dpkg --remove package_name

来消除某些引起问题的包,或是

# apt-get -f install
# dpkg --configure --pending

在极端情况下,您可能不得不像以下命令一样强制重新安装某个包

# dpkg --install /path/to/package_name.deb

4.5.5. File conflicts

如果您从纯粹的 lenny 系统升级就不会出现文件冲突,但如果您装有非官方的 backport 包就可能出现冲突。文件冲突会导致类似以下这样的错误:

Unpacking <package-foo> (from <package-foo-file>) ...
dpkg: error processing <package-foo> (--install):
 trying to overwrite `<some-file-name>',
 which is also in package <package-bar>
dpkg-deb: subprocess paste killed by signal (Broken pipe)
 Errors were encountered while processing:
 <package-foo>

您可以尝试用错误信息中的最后一行提示,强制删除包来解决文件冲突:

# dpkg -r --force-depends package_name

After fixing things up, you should be able to resume the upgrade by repeating the previously described apt-get commands.

4.5.6. Configuration changes

During the upgrade, you will be asked questions regarding the configuration or re-configuration of several packages. When you are asked if any file in the /etc/init.d directory, or the /etc/manpath.config file should be replaced by the package maintainer's version, it's usually necessary to answer `yes' to ensure system consistency. You can always revert to the old versions, since they will be saved with a .dpkg-old extension.

如果您不确定该做什么,那就记下包或文件的名称,并稍后排出它们的顺序。您可以通过在 script 命令记录的输出文件中搜索来查看升级期间显示在屏幕上的信息。

4.5.7. Change of session to console

If you are running the upgrade using the system's local console you might find that at some points during the upgrade the console is shifted over to a different view and you lose visibility of the upgrade process. For example, this will happen in desktop systems when gdm is restarted.

To recover the console where the upgrade was running you will have to use Ctrl+Alt+F1 to switch back to the virtual terminal 1 if in the graphical startup screen or use Alt+F1 if in the local text-mode console. Replace F1 with the function key with the same number of the virtual terminal the upgrade was running in. You can also use Alt+Left Arrow or Alt+Right Arrow to switch between the different text-mode terminals.

4.5.8. Special care for specific packages

In most cases, packages should upgrade smoothly between lenny and squeeze. There are a small number of cases where some intervention may be required, either before or during the upgrade; these are detailed below on a per-package basis.

4.5.8.1. Evolution

Evolution (the GNOME Desktop mail client) has been updated from version 2.22 to 2.30. This changes the storage format used by the package for local data and there is a possibility of data loss if the upgrade is performed whilst evolution is running. Exiting the application itself may not be sufficient, as various related components will continue to run in the background. To avoid any potential issues, it is recommended that you completely exit your desktop environment before beginning the upgrade to squeeze.

As part of the upgrade process, evolution will check whether any related processes are running and will recommend that they be closed. A secondary check for processes will then be performed; if necessary, a choice will be offered between allowing the remaining processes to be killed or aborting the upgrade in order to resolve the situation by hand.

4.6. 升级内核与相关包

这一节解释了如何升级您的内核,以及明确有关此次升级的潜在问题。您可以安装由 Debian 提供的 linux-image-* 包,或者从源码编译一个自定义的内核。

注意本节的很多信息基于假设,即您会使用一个模块化的 Debian 内核,以及initramfs-toolsudev。如果您选择使用一个不需要 initrd 的自定义内核,或是您使用了一种不同的 initrd 生成器,对您来说某些信息可能会不一样。

4.6.1. 安装内核元数据包

当您从 lenny 全面升级至 squeeze 时,强烈推荐您安装新的 linux-image-2.6-* 元数据包。此包可能由 dist-upgrade 自动安装了。您可以验证此步,执行:

# dpkg -l "linux-image*" | grep ^ii

如果您没有看到任何输出,那么您需要手工安装一个新的 linux-image 包。要查看可用的 linux-image-2.6 的元数据包列表,执行:

# apt-cache search linux-image-2.6- | grep -v transition

If you are unsure about which package to select, run uname -r and look for a package with a similar name. For example, if you see '2.6.26-2-686', it is recommended that you install linux-image-2.6-686. You may also use apt-cache to see a long description of each package in order to help choose the best one available. For example:

# apt-cache show linux-image-2.6-686

You should then use apt-get install to install it. Once this new kernel is installed you should reboot at the next available opportunity to get the benefits provided by the new kernel version.

For the more adventurous there is an easy way to compile your own custom kernel on Debian GNU/Linux. Install the kernel-package tool and read the documentation in /usr/share/doc/kernel-package. Alternatively, you can also use the kernel sources, provided in the linux-source-2.6 package. You can make use of the deb-pkg target available in the sources' makefile for building a binary package. There are some differences in these two approaches, please consult the respective package's documentation.

如果有可能,把内核包的升级从主 dist-upgrade 中独立出来是有利的,这能减少出现一个临时不可引导的系统的机会。注意,这只能在最小升级(参看第 4.4.4 节 “最小系统升级”)结束后才能做。

4.6.2. 设备枚举的顺序

In lenny and later, a new kernel mechanism for hardware discovery may change the order in which devices are discovered on your system on each boot, affecting the device names assigned to them. For example, if you have two network adapters that are associated with two different drivers, the devices eth0 and eth1 refer to may be swapped.

For network devices, this reordering is normally avoided by the definitions at /etc/udev/rules.d/70-persistent-net.rules for udev. Since these rules were already in place in lenny, no additional action should be required when upgrading to squeeze to get the benefit of stable network device names. Please note, however, that this udev mechanism means that a given network device name is tied to a particular piece of hardware; if you, for instance, exchange ethernet adapters in a deployed squeeze system, the new adapter will get a new interface name instead of using the existing one. To reuse an existing device name for new hardware, you will need to delete the associated entry from /etc/udev/rules.d/70-persistent-net.rules.

For storage devices, you may be able to avoid this reordering by using initramfs-tools and configuring it to load storage device driver modules in the same order they are currently loaded. However, in light of other changes to the storage subsystem of the Linux kernel as described at 第 5.1.1 节 “Migration of disk drivers from IDE to PATA subsystem”, this is usually not worth the effort and it is recommended instead to use device names that are guaranteed to be stable over time, such as the UUID aliases [10] in the /dev/disk/by-uuid/ directory or LVM device names in /dev/mapper/.

4.6.3. Boot timing issues (waiting for root device)

如果用 initramfs-tools 创建的 initrd 引导系统,在某些情况下由 udev 创建的设备文件可能对于启动脚本的执行来讲太慢了点。

The usual symptoms are that the boot will fail because the root file system cannot be mounted and you are dropped into a debug shell:

Gave up waiting for root device.  Common problems:
 - Boot args (cat /proc/cmdline)
   - Check rootdelay= (did the system wait long enough?)
   - Check root= (did the system wait for the right device?)
 - Missing modules (cat /proc/modules; ls /dev)
ALERT!  /dev/something does not exist.  Dropping to a shell!
(initramfs) 

But if you check afterwards, all devices that are needed are present in /dev. This has been observed in cases where the root file system is on a USB disk or on RAID, especially if LILO is used.

解决此问题的方法就是用引导参数 rootdelay=9。这个超时值(秒)可能需要调整一下。

4.7. 为下个发行版做准备

升级完成后,您可以为下个发行版做点事。

  • 第 4.9 节 “过时的包”中描述的那样移除过时的和未使用的包。您应该核查这些包所用的配置文件,并考虑完全删除这些软件包以移除它们的配置文件。

4.8. Deprecated components

With the next release of Debian GNU/Linux 7.0 (codenamed wheezy) some features will be deprecated. Users will need to migrate to other alternatives to prevent trouble when updating to 7.0.

This includes the following features:

  • OpenVZ and Linux-Vserver: Debian GNU/Linux 6.0 will be the last release to include Linux kernel virtualization featuresets outside of mainline. This means that the OpenVZ and Linux-Vserver featuresets should be considered deprecated, and users should migrate to linux-2.6 upstream merged virtualization solutions like KVM, Linux Containers or Xen.

  • The gdm package (GNOME Display Manager version 2.20) will be obsoleted by gdm3, a rewritten version. See 第 5.6 节 “GNOME 桌面改变与支持” for more information.

4.9. 过时的包

Introducing several thousand new packages, squeeze also retires and omits more than four thousand old packages that were in lenny. It provides no upgrade path for these obsolete packages. While nothing prevents you from continuing to use an obsolete package where desired, the Debian project will usually discontinue security support for it a year after squeeze's release[11],且通常不会同时提供其它支持。推荐用可用的替代品代替它们。

为什么包会从发行版中移除?这有很多原因,如:它们不再被上游作者维护了;没有 Debian 开发者对维护这个包感兴趣;这些包提供的功能被不同的软件(或新版本)替代了;或者由于它们自身的问题,因而被认为不适用于 squeeze。 最后一种情况下,这些包有可能仍然位于 unstable 版之下。

检测在已更新的系统中哪些包是过时的现在容易得很,因为包管理的前台程序会标记它们的。如果您使用的是 aptitude,您将在过时的和本机创建的包条目中看到这些包。dselect 提供类似的条目,但它显示的列表有所不同。

Also, if you have used aptitude or apt-get to manually install packages in lenny it will have kept track of those packages you manually installed and will be able to mark as obsolete those packages pulled in by dependencies alone which are no longer needed if a package has been removed. aptitude and apt, unlike deborphan, will not mark for removal packages that you manually installed, as opposed to those that were automatically installed through dependencies. To remove automatically installed packages that are no longer used, run:

# apt-get autoremove

您可以用其它的工具来找出过时的包,例如 deborphandebfostercruft。推荐使用 deborphan,尽管它(默认情况下)只报告过时的库,即libs或是oldlibs部分中的未被其它包依赖的软件包。不要盲目的移除那些工具要用到的包,尤其是当您正在使用激进的非默认的选项,它们容易引起严重错误。极度推荐在您移除它们之前,手工核查那些建议移除的包(例如:它们的内容、大小以及描述信息)。

Debian 错误跟踪系统通常会提供额外信息,这些都是有关这个包为什么要被移除的信息。您应该既查看此包自身的归档错误报告,同时也要看一下 ftp.debian.org pseudo-package 中的归档错误报告。

The list of obsolete packages includes:

  • The plone content management suite. This has been done on request by the developers to use the Unified Installer for Linux, which they consider their only supported deployment platform. The recommended tool for installing Plone on a Debian GNU/Linux system is the Unified Installer, available for download from http://plone.org/

  • nessus, the vulnerability scanning server and its associated libraries and other software. It has been deprecated in favor of the software provided by OpenVAS which includes openvas-server and openvas-client. As there is no automatic upgrade path you will have to install OpenVAS and manually move over your Nessus service configuration (users, certificates, etc.) to OpenVAS.

  • postgresql-8.3, successor is postgresql-8.4.

  • mysql-server-5.0, successor is mysql-server-5.1.

  • python2.4, successor is python2.6.

  • Java 5 software including the packages sun-java5-jre and sun-java5-bin, successor is Java 6: sun-java6-jre and associated packages.

  • apt-proxy is no longer provided, alternatives to this tool include apt-cacher-ng, apt-cacher and approx. Although no automatic upgrade path exists, user of apt-proxy can switch to these alternatives by manually installing any of these packages.

  • Some of Xorg's video drivers are no longer available in squeeze and are obsolete. This includes xserver-xorg-video-cyrix, xserver-xorg-video-i810, xserver-xorg-video-imstt, xserver-xorg-video-nsc, xserver-xorg-video-sunbw2, and xserver-xorg-video-vga. They might be removed through the upgrade. Users should install xserver-xorg-video-all instead.

  • The utility used in lenny to display a splash image at boot time, usplash, is no longer available. It has been replaced by plymouth.

4.9.1. 哑包

来自 lenny 的某些包在 squeeze 中已经被分为好几个包,通常这是为了改善系统的可维护性。在此情况下,为了能平滑升级,squeeze 通常提供包(即空包),它与 lenny 中的旧包名称相同,但有依赖性,促使它们安装新包。这些包在升级成功后就会被认为是过时的包,且能够被安全地移除。

Most (but not all) dummy packages' descriptions indicate their purpose. Package descriptions for dummy packages are not uniform, however, so you might also find deborphan with the --guess-* options (e.g. --guess-dummy) useful to detect them in your system. Note that some dummy packages are not intended to be removed after an upgrade but are, instead, used to keep track of the current available version of a program over time.



[4] If the debconf priority is set to a very high level you might prevent configuration prompts, but services that rely on default answers that are not applicable to your system will fail to start.

[5] For example: DNS or DHCP services, specially when there is no redundancy or failover. In the DHCP case end-users might be disconnected from the network if the lease time is lower than the time it takes for the upgrade process to complete.

[6] 此功能可以通过在您的启动参数中添加参数 panic=0 来禁用。

[7] Debian 的包管理系统正常情况下不允许一个软件包移除或是替换另一个软件包所拥有的文件,除非已经被设定为替换那个包。

[8] There are also known incompatibilities between the old kernel and the new udev. If you find issues after the reboot with the new kernel you will have to downgrade the udev in order to use the old one.

[9] If you are logging the upgrade as described in 第 4.4 节 “升级软件包”, please, use script again to log the next steps of the upgrade after the reboot in order to log the result of the actions described in 第 4.4.6 节 “Upgrading the system”.

[10] Some devices, such as those used by crypt, RAID or LVM have stable non-UUID identifiers. In these cases you should use the name of the devices, which are already unambiguous and stable.

[11] 只要在那段时间内没有另外的发行版释出。在任意给定时间内,一般仅提供两个 stable 发行版的安全更新。