章 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. 增加 APT 的 CD-ROM 或 DVD 的套件來源
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. 替您的 Kernel 及相關套件進行升級
4.6.1. 安裝 Kernel 的虛擬套件
4.6.2. 重新排序裝置列表
4.6.3. Boot timing issues (waiting for root device)
4.7. 替下一個釋出版本進行準備
4.7.1. Upgrade to GRUB 2
4.8. Deprecated components
4.9. 被廢棄的套件
4.9.1. 替代 (Dummy) 套件

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,以 . 開頭的檔案或目錄)進行備份。這個備份可以用來回復或重新建立舊有的設定。您也許有必要讓使用者知道有這個問題存在。

Any package installation operation must be run with superuser privileges, so either log in as root or use su or sudo to gain the necessary access rights.

升級有其必要條件,您應該在實地進行升級之前先行確認一次。

4.1.2. 事先知會使用者

您應該在進行任何升級之前先把您的計畫告知所有使用者,雖然一些像是利用 ssh 連線來從遠端存取系統的使用者在升級過程中可能不會發現什麼異狀,且他們的工作也應該不會因而中斷。如果您希望能採取額外的預防措施的話,請在升級前備份或卸載使用者的分割區 (/home)。除非您計劃同時進行 Kernel 的升級,否則您在升級前後通常並不需要重新開機。

If you wish to take extra precautions, back up or unmount the /home partition before upgrading.

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 間的 kernel 在像是驅動程式、硬體偵測、命名方式及裝置檔的順序上之變動太大了,在升級完成之後、重新啟動系統之時,您必須冒著可能會遭遇問題的風險。一些已知的可能問題記述於發行情報中的這個及下個章節。

也因此,當您的系統可能會再也無法開機,或者是無法啟用網路(對於遠端管理系統而言)之時,確保您有辨法進行回復就變得很重要了。

如果您是藉由 ssh 連線來從遠端進行更新的話,在此非常建議您能採取必要的預防措施,讓您能有辨法經由遠端序列終端來存取伺服器。這是因為偶爾在升級 Kernel 並重新開機之後,有些裝置的名稱被改變了(如同 節 4.6.2, “重新排序裝置列表” 裡的說明),導致您得經由本機主控台才能修正系統的設定。同樣的,如果系統在升級途中意外得重新開機了,您將可能得由本機主控台才能進行修復。

第一個最顯而易見的方法是試著用您舊的 Kernel 開機,儘管如此,由於在本文件其它地方所陳述的種種原因,這個方法無法保証一定有效。

如果這個方法失敗了,您必須另尋其它方式來啟動您的系統,讓您可以進行存取並修復它。方法之一是利用特定的救援影像檔或 Linux 的 live CD。利用它們開機之後,您應該可以掛載您的 root 檔案系統並 chroot 進去以檢查並修復問題。

另一個我們建議的作法是使用 squeeze Debian 安裝程式的 rescue mode。使用安裝程式的好處是您可以在它所提供的許多安裝方式中選擇一個最符合您的狀況的方式。請參閱在 Installation Guide 的第 8 節回復毀損的系統Debian Installer FAQ以取得更詳盡的資訊。

4.1.4.1. 在開機過程中使用 initrd 的除錯介面 (debug shell)

initramfs-tools 會在它所產生的 initrds 裡放入一個 debug shell[6]。比如說,當您無法掛載您的 root 檔案系統時,您會進入這個提供了一些基本功能的 debug shell,以用來追蹤問題並試著修復它。

基本的檢查包括了:在 /dev 中是否有出現正確的裝置檔;已載入了哪些模組(cat /proc/modules);在 dmesg 的輸出裡是否有驅動無法載入的資訊。在 dmesg 的輸出裡也會顯示了哪個裝置檔已被指定為使用哪個磁碟;您應該把它和 echo $ROOT 的輸出進行比較以確保 root 檔案系統是掛載在正確的裝置上。

如果您已採取行動解決問題,鍵入 exit 將會跳出除錯介面並會由開機失敗的地方繼續進行開機。當然了,您也必須由根本修復問題並重新產生 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 認為某個套件是無用的且會計劃要將其移除。一般來說,您應該在進行升級程序前確保系統已完全更新且乾淨

Because of this you should review if there are any pending actions in the package manager aptitude. If a package is scheduled for removal or update in the package manager, it might negatively impact the upgrade procedure. Note that correcting this is only possible if your sources.list still points to lenny and not to stable or squeeze; see 節 A.2, “檢查您的來源列表”.

To perform this review, launch aptitude in visual mode and press g (Go). If it shows any actions, you should review them and either fix them or implement the suggested actions. If no actions are suggested you will be presented with a message saying No packages are scheduled to be installed, removed, or upgraded.

4.2.2. 關閉 APT 的釘鎖 (Pinning) 功能

如果您將 APT 設定為可以安裝除了 stable 發行版之外的套件,(像是:testing),您可能必須修改您的 APT 的釘鎖 (Pinning) 設定(儲存於 /etc/apt/preferences 中)來讓將要進行升級的套件能夠升級至新的 stable 發行版。您可以在 apt_preferences(5) 取得 APT 的釘鎖功能的更多詳盡資訊。

4.2.3. 檢查套件的狀態

不論您是用什麼方式進行系統的更新,我們都建議您先檢查所有套件的狀態,並確認所有的套件都能夠順利升級。以下的指令會顯示所有狀態為半安裝 (Half-Installed) 或設定失敗 (Failed-Config) 或有其他任何錯誤的套件。

# dpkg --audit

除此之外,檢查系統中所有套件狀態的方法還包括使用使用 dselectaptitude、或是利用以下的指令:

# dpkg -l | pager

或是

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

最佳的做法是在進行系統升級前將所有的套件解除保留 (hold) 狀態。如果在升級過程中有任何的關鍵套件的狀態被設定為保留,那麼升級的作業就會失敗。

請注意到,aptitude 使用了和 apt-getdselect 迥然不同的方式來登錄哪些是保留套件。您可以使用以下方式來確認在 aptitude 裡有哪些套件是被保留住的:

# aptitude search "~ahold" 

如果您想要檢查那些套件是被 apt-get 所保留住的,請使用:

# dpkg --get-selections | grep hold

如果您自行在系統中變更並重新編譯了某個套件,但卻沒有將其更名或在版本號碼中使用 epoch(自行定義版本號碼),那您就必須把它設定為保留狀態,以防止它被升級到新的版本。

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, “檢查您的來源列表” 裡的說明。

4.2.4. proposed-updates

如果您有把 proposed-updates 區段加入了您的 /etc/apt/sources.list 檔中的話,您應當在進行系統升級之前把它從檔案中移除。這是降低潛在的衝突發生前的預防工作。

4.2.5. 非官方的來源及 backports

如果在您的系統裡安裝了不是由 Debian 所提供的套件,您必須要知道,在升級的過程中它們可能會因為相依性的關係而被移除掉。如果這些套件是先在 /etc/apt/sources.list 新增了額外的套件檔案庫然後再加以安裝的,您應該檢查一下那個檔案庫是否也提供了特別為 squeeze 而編譯的套件,在替 Debian 變更套件來源時也同時適當得修改這些套件的來源項目。

也許有些使用者會在他們的 lenny 上安裝了在 Debian 已有套件的非官方但較新的 backported 版本。這些套件很可能在升級的時候產生檔案衝突的問題,[7]。在 節 4.5, “在升級過程中可能會發生的問題” 有一些當發生了檔案衝突時該如何解決的資訊。

4.3. APT 來源之準備工作

在開始進行升級之前,您必須先在 apt 的設定檔 /etc/apt/sources.list 中設定套件列表。

apt will consider all packages that can be found via any deb line, and install the package with the highest version number, giving priority to the first line in the file (thus where you have multiple mirror locations, you'd typically first name a local hard disk, then CD-ROMs, and then HTTP/FTP mirrors).

發行版通常可以使用它的代碼(如,lennysqueeze)或是它的狀態名稱(如,oldstablestabletestingunstable)來表示。使用發行版的代碼有個好處是您將不用為了新的發行版的到來而感到不安,這也是為什麼會在此提出這個技巧的原因。理所當然的,這也表示了您必須自行去注意發行版是何時發佈的。如果您是替而使用狀態名稱的,在新的發行版發佈的同時,您將會立即發覺大量套件已有新的版本可供更新。

4.3.1. 加入網際網路上的 APT 套件來源

雖然系統的預設設定是使用 Debian 在網際網路上的主要伺服器來進行安裝,但您還是可能會希望修改 /etc/apt/sources.list 來改為使用在網路上離您最近的其它鏡像站。

您也可以在 http://www.debian.org/distrib/ftplist 取得 Debian 的 HTTP 或 FTP 鏡像站的位址(請參考 list of mirrors 小節)。HTTP 鏡像站的傳輸速度通常會比 FTP 鏡像站來得快。

舉例來說,假設離您最近的 Debian 鏡像站是 http://mirrors.kernel.org。當您透過網頁瀏覽器或 FTP 程式來檢視這個網站時,您會發現其中的主要目錄架構會像是這個樣子:

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

為了要讓 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/debian/ 之下,而主要的目錄看起來是像這樣的話:

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

如果要和 apt 搭配使用,請把下行加入 sources.list 檔案之中:

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

請注意,`dists' 將會被自動加到路徑中,而在發佈代號之後的參數則會被用來展開成多個不同目錄的路徑。

在加入了新的來源之後,請在 sources.list 中原本的 deb 項目前加上井字符號 (#) 以關閉這些套件來源。

4.3.3. 增加 APT 的 CD-ROM 或 DVD 的套件來源

如果光碟是唯一您想使用的媒體,請在 /etc/apt/sources.list 中原有的 deb 設定行前加入井字符號 (#) 以關閉這些套件來源。

請確定在 /etc/fstab 中有著能讓您的光碟機掛載在 /cdrom 這個掛載點下的項目(apt-cdrom 限定掛載點必須是 /cdrom)。舉例來說,如果您的光碟機的裝置是 /dev/hdc,那麼 /etc/fstab 中就應該要有像這樣的一行:

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

請注意在第四欄的 defaults,noauto,ro 的字中間一定不能參雜空白字元

要確認您的設定是否正確,請放入一張光碟片,並試著執行

# mount /cdrom    # 這樣將會將這張 CD 掛載在該掛載點上
# ls -alF /cdrom  # 這樣將會列出 CD 的根目錄
# umount /cdrom   # 這樣將會卸載這張 CD

接下來對每一張 Debian 的程式光碟執行

# apt-cdrom add

來把每一張光碟的資料加到 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 和 root 分割區)重新以可讀寫的模式掛載:

# mount -o remount,rw /mountpoint

接下來,您必須再次確認在 /etc/apt/sources.list 中的 APT 來源項目是指向 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 參數,您可以利用 scriptreplay 程式來重新播放整個過程:

# 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.
[注意]注意

Running this command at the beginning of the upgrade process may give an error, for the reasons described in the next sections. In that case you will need to wait until you've done the minimal system upgrade as in 節 4.4.4, “系統最低限度升級” and upgraded your kernel before running this command to estimate the disk space.

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.

  • Remove forgotten packages. If you have popularity-contest installed, you can use popcon-largest-unused to list the packages you do not use that occupy the most space. You can also use deborphan or debfoster to find obsolete packages (see 節 4.9, “被廢棄的套件” ). Alternatively you can start aptitude in visual mode and find obsolete packages under Obsolete and Locally Created Packages.

  • Remove packages that take up too much space and are not currently needed (you can always reinstall them after the upgrade). You can list the packages that take up the most disk space with dpigs (available in the debian-goodies package) or with wajig (running 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.

  • Remove translations and localization files from the system if they are not needed. You can install the localepurge package and configure it so that only a few selected locales are kept in the system. This will reduce the disk space consumed at /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.

請注意到,為了能夠安全得移除套件,最好將您的 sources.list 換回 lenny,如同 節 A.2, “檢查您的來源列表” 裡的說明。

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.

要進行 kernel 的升級,請執行:

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

請參閱 節 4.6.1, “安裝 Kernel 的虛擬套件” 來幫助您決定您該安裝的 kernel 套件的類別。

The move of some firmware to separate packages in the non-free archive (see 節 2.1.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.

Users of the grub bootloader should make sure that update-grub is run as part of the kernel upgrade, or run it manually.

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.

這將會在您的系統上進行完整的更新,也就是安裝所有套件目前所提供的最新版本,並解決套件在不同發行版之間可能會有的相依性問題。如果有必要的話,它也會安裝一些新的套件(通常是新版的函式庫或是被更名的套件),並移除任何和新版套件發生衝突的過時套件。

When upgrading from a set of CD-ROMs (or DVDs), you will be asked to insert specific CDs at several points during the upgrade. You might have to insert the same CD multiple times; this is due to inter-related packages that have been spread out over the CDs.

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

如果在使用 aptitudeapt-getdpkg 的過程中失敗了並顯示以下錯誤

E: Dynamic MMap ran out of room

the default cache space is insufficient. You can solve this by either removing or commenting lines you don't need in /etc/apt/sources.list or increasing the cache size. The cache size can be increased by setting APT::Cache-Limit in /etc/apt/apt.conf. The following command will set it to a value that should be sufficient for the upgrade:

# 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 進行升級的話,應該不會有檔案衝突的情況發生;但如果您安裝了非官方的 backports 套件時就不一定了。如果發生檔案衝突時,會產生類似以下的錯誤:

正在解開 <package-foo>(由 <package-foo-file>)...
dpkg: 在處理時出錯 <package-foo> (--install):
 試圖覆寫 `<some-file-name>',
 但它同時包含於套件 <package-bar> 中
dpkg-deb: 子程序 paste 因錯誤訊息(損毀的 pipe)而被中斷
 在處理時發生了錯誤:
 <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.

如果您不太確定要怎麼做的話,把套件或檔案的名稱寫下來,等稍後再想辨法理出頭緒來。您可以在記錄檔中搜尋,以便能重新檢視在系統升級時出現在螢幕上的資訊。

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. 替您的 Kernel 及相關套件進行升級

這一節中解釋了如何升級您的 kernel 及和升級有關的潛在問題。您可以安裝由 Debian 提供的某個 linux-image-* 套件,或是由原始碼自行編譯一個自訂的 kernel。

請注意到,在這一節中的許多資訊是假設了您使用著某個模組化、和 initramfs-toolsudev 搭配使用的 Kernel。如果您是使用不需 initrd 的自訂 kernel 或是您使用的是另一種 initrd 產生程式,這些資訊中有些是和您無關的。

4.6.1. 安裝 Kernel 的虛擬套件

當您由 lenny 完整升級至 squeeze 後,強烈建議您安裝某個 linux-image-2.6-* 虛擬套件。這個套件可能會在完整升級的過程中被自動安裝。若想確認,請執行:

# 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.

If possible, it is to your advantage to upgrade the kernel package separately from the main dist-upgrade to reduce the chances of a temporarily non-bootable system. Note that this should only be done after the minimal upgrade process described in 節 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 建立裝置檔的時機比開機 scripts 的動作還慢。

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, “被廢棄的套件” 裡所說明的已廢棄及已不再使用的套件移除掉。您應該重新檢視它們使用了哪些設定檔並考慮完全將套件清除 (purge) 掉以移去它們的設定檔。

4.7.1. Upgrade to GRUB 2

During the upgrade, you will normally have been offered the option to "chainload" GRUB 2: that is, to keep GRUB Legacy as the primary boot loader but to add an option to it to load GRUB 2 and then start your Debian GNU/Linux system from that. This allows you to verify that GRUB 2 works on your system before committing to use it permanently.

Once you have confirmed that GRUB 2 works, you should switch to using it properly: the chainloading setup is only intended to be used temporarily. You can do this by running upgrade-from-grub-legacy.

The GRUB Manual has more information on the changes between GRUB Legacy and GRUB 2, some of which may require changes to complex configurations. If you have not modified your boot loader configuration, you should not need to do anything further.

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 的開發者有意願想要繼續維護這些套件了;有的是因為它們所提供的功能已經被其它的軟體(或是新的版本)所取代了;有的是因為它們本身所包含的一些 Bug 使得我們認為它們已無法和 squeeze 相容。如果是最後一個情況,這些套件很可能是被放在 unstable 這個分類裡。

Detecting which packages in an updated system are obsolete is easy since the package management front-ends will mark them as such. If you are using aptitude, you will see a listing of these packages in the Obsolete and Locally Created Packages entry. dselect provides a similar section but the listing it presents might differ.

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,因為它在預設的模式下只會報告已遭廢棄了的函式庫:位於 libsoldlibs 區的套件就表示它們已不再被其它的套件所使用了。但請不要輕率得依據這些工具所回報的列表就把這些套件給移掉了,尤其是您在執行時使用的不是預設的,而是較為寬鬆的選項時,它們很可能會因而做出不正確的判定。因此在此強烈建議您,在進行移除的動作之前,您必須親自再重新檢視一次這些將要被移除的套件,包括它們的內容、大小,及它們的詳細說明。

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. 替代 (Dummy) 套件

有時為了讓系統能更易於管理,有些原來是包含於 lenny 的套件在 squeeze 裡已被分開成數個套件。在此況狀下,為了能讓升級的過程更加順遂,squeeze 通常會採取提供替代 (Dummy)套件的方式:使用一個和原本是包含於 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 的發行版。