內容目錄
在進行升級之前,我們建議您能同時參閱 章 5, 在 squeeze 裡您必須知道的一些問題 所提供的資訊。在那個章節裡包含了一些和升級程序無直接相關,但在開始之前您仍然得要知道的可能潛在問題。
在升級您的系統之前,我們強烈建議您能進行一次完整的備份,或至少您也應該把那些絕對不能出任何差錯的資料和設定資訊給備份起來。升級時所使用的工具和升級過程應該不會出什麼差錯,但在升級過程中若發生了什麼硬體錯誤可能會導致系統嚴重受損。
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.
升級有其必要條件,您應該在實地進行升級之前先行確認一次。
您應該在進行任何升級之前先把您的計畫告知所有使用者,雖然一些像是利用 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.
During the upgrade process, there might be services associated with packages that will be include in the upgrade. If this is the case, these services might be stopped while the packages that are going to be upgraded are being replaced and configured. During this time, these services will not be available.
The precise downtime for these service 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 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.
由於 lenny 和 squeeze 間的 kernel 在像是驅動程式、硬體偵測、命名方式及裝置檔的順序上之變動太大了,在升級完成之後、重新啟動系統之時,您必須冒著可能會遭遇問題的風險。一些已知的可能問題記述於發行情報中的這個及下個章節。
也因此,當您的系統可能會再也無法開機,或者是無法啟用網路(對於遠端管理系統而言)之時,確保您有辨法進行回復就變得很重要了。
如果您是藉由 ssh 連線來從遠端進行更新的話,在此非常建議您能採取必要的預防措施,讓您能有辨法經由遠端序列終端來存取伺服器。這是因為偶爾在升級 Kernel 並重新開機之後,有些裝置的名稱被改變了(如同 節 4.6.2, “重新排序裝置列表” 裡的說明),導致您得經由本機主控台才能修正系統的設定。同樣的,如果系統在升級途中意外得重新開機了,您將可能得由本機主控台才能進行修復。
第一個最顯而易見的方法是試著用您舊的 Kernel 開機,儘管如此,由於在本文件其它地方所陳述的種種原因,這個方法無法保証一定有效。
如果這個方法失敗了,您必須另尋其它方式來啟動您的系統,讓您可以進行存取並修復它。方法之一是利用特定的救援影像檔或 Linux 的 live
CD。利用它們開機之後,您應該可以掛載您的 root 檔案系統並 chroot
進去以檢查並修復問題。
另一個我們建議的作法是使用 squeeze Debian 安裝程式的 rescue mode。使用安裝程式的好處是您可以在它所提供的許多安裝方式中選擇一個最符合您的狀況的方式。請參閱在 Installation Guide 的第 8 節“回復毀損的系統”及 Debian Installer FAQ以取得更詳盡的資訊。
initramfs-tools
會在它所產生的 initrds
裡放入一個 debug shell[6]。比如說,當您無法掛載您的 root 檔案系統時,您會進入這個提供了一些基本功能的 debug
shell,以用來追蹤問題並試著修復它。
基本的檢查包括了:在 /dev
中是否有出現正確的裝置檔;已載入了哪些模組(cat
/proc/modules
);在 dmesg 的輸出裡是否有驅動無法載入的資訊。在
dmesg 的輸出裡也會顯示了哪個裝置檔已被指定為使用哪個磁碟;您應該把它和 echo
$ROOT
的輸出進行比較以確保 root 檔案系統是掛載在正確的裝置上。
如果您已採取行動解決問題,鍵入 exit
將會跳出除錯介面並會由開機失敗的地方繼續進行開機。當然了,您也必須由根本修復問題並重新產生 initrd,讓下次開機時不會又因而失敗。
您應該在本機透過文字模式的虛擬主控台(或直接連線的序列終端機)、或由遠端透過 ssh 連線來進行發行版間的升級。
重要 | |
---|---|
If you are using some VPN services (such as |
在以遠端進行更新時,為了能得到更多的安全保障,在此建議您在 screen 程式所提供的虛擬主控台裡進行升級程序。它能夠讓您一再地重複連線,以確保如果遠端連線中斷時,也不會干擾到升級程序的進行。
重要 | |
---|---|
您不應該透過 telnet、rlogin、rsh,或是由您要進行升級的機器上的 xdm、gdm 或 kdm 等等所管理的 X 行程來進行升級。這是因為這些服務在升級的過程中都可能會被中斷,因而將會留下了一個只完成部分升級而無法存取的系統。 |
Due to bug #512951, the splashy
package needs to be purged prior to the
upgrade.
# apt-get purge splashy
在這個章節中所說明的升級過程是專門為“純粹的” 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 系統” 裡的相關說明。
在某些情況下,使用 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”.
如果您將 APT 設定為可以安裝除了 stable 發行版之外的套件,(像是:testing),您可能必須修改您的 APT 的釘鎖 (Pinning)
設定(儲存於 /etc/apt/preferences
中)來讓將要進行升級的套件能夠升級至新的 stable
發行版。您可以在 apt_preferences(5) 取得 APT 的釘鎖功能的更多詳盡資訊。
不論您是用什麼方式進行系統的更新,我們都建議您先檢查所有套件的狀態,並確認所有的套件都能夠順利升級。以下的指令會顯示所有狀態為半安裝 (Half-Installed) 或設定失敗 (Failed-Config) 或有其他任何錯誤的套件。
# dpkg --audit
除此之外,檢查系統中所有套件狀態的方法還包括使用使用 dselect、aptitude、或是利用以下的指令:
# dpkg -l | pager
或是
# dpkg --get-selections "*" > ~/curr-pkgs.txt
最佳的做法是在進行系統升級前將所有的套件解除保留 (hold) 狀態。如果在升級過程中有任何的關鍵套件的狀態被設定為保留,那麼升級的作業就會失敗。
請注意到,aptitude 使用了和 apt-get 及 dselect 迥然不同的方式來登錄哪些是保留套件。您可以使用以下方式來確認在 aptitude 裡有哪些套件是被保留住的:
# aptitude search "~ahold" | grep "^.h"
如果您想要檢查那些套件是被 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, “檢查您的來源列表” 裡的說明。
如果您有把 proposed-updates
區段加入了您的
/etc/apt/sources.list
檔中的話,您應當在進行系統升級之前把它從檔案中移除。這是降低潛在的衝突發生前的預防工作。
如果在您的系統裡安裝了不是由 Debian 所提供的套件,您必須要知道,在升級的過程中它們可能會因為相依性的關係而被移除掉。如果這些套件是先在
/etc/apt/sources.list
新增了額外的套件檔案庫然後再加以安裝的,您應該檢查一下那個檔案庫是否也提供了特別為 squeeze 而編譯的套件,在替 Debian
變更套件來源時也同時適當得修改這些套件的來源項目。
也許有些使用者會在他們的 lenny 上安裝了在 Debian 已有套件的非官方但“較新”的 backported 版本。這些套件很可能在升級的時候產生檔案衝突的問題,[7]。在 節 4.5, “在升級過程中可能會發生的問題” 有一些當發生了檔案衝突時該如何解決的資訊。
在開始進行升級之前,您必須先在 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).
發行版通常可以使用它的代碼(如,lenny
、squeeze
)或是它的狀態名稱(如,oldstable
、stable
、testing
、unstable
)來表示。使用發行版的代碼有個好處是您將不用為了新的發行版的到來而感到不安,這也是為什麼會在此提出這個技巧的原因。理所當然的,這也表示了您必須自行去注意發行版是何時發佈的。如果您是替而使用狀態名稱的,在新的發行版發佈的同時,您將會立即發覺大量套件已有新的版本可供更新。
雖然系統的預設設定是使用 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-i386/... http://mirrors.kernel.org/debian/dists/squeeze/contrib/binary-i386/...
為了要讓 apt
能夠使用這個鏡像站,請把以下的這一行加入您的
sources.list
檔案之中:
deb http://mirrors.kernel.org/debian squeeze main contrib
請注意,`dists
' 將會被自動加到路徑中,而在發佈代號之後的參數則會被用來展開成多個不同目錄的路徑。
在加入了新的來源之後,請在 sources.list
中原本的
“deb
” 項目前加上井字符號 (#
)
以關閉這些套件來源。
您可能也會想修改 /etc/apt/sources.list
中的設定,以使用本機(像是透過
NFS 掛載的)磁碟上的鏡像資料來取代透過 HTTP 或 FTP 存取遠端的套件鏡像站。
舉例來說,如果您的套件鏡像是放在 /var/ftp/debian/
之下,而主要的目錄看起來是像這樣的話:
/var/ftp/debian/dists/squeeze/main/binary-i386/... /var/ftp/debian/dists/squeeze/contrib/binary-i386/...
如果要和 apt
搭配使用,請把下行加入
sources.list
檔案之中:
deb file:/var/ftp/debian squeeze main contrib
請注意,`dists
' 將會被自動加到路徑中,而在發佈代號之後的參數則會被用來展開成多個不同目錄的路徑。
在加入了新的來源之後,請在 sources.list
中原本的
“deb
” 項目前加上井字符號 (#
)
以關閉這些套件來源。
如果光碟是唯一您想使用的媒體,請在
/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 的資料庫中。
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
“ |
我們強烈建議您使用 /usr/bin/script 這個程式來記錄升級的完整過程。因為一旦發生了任何問題,您手上就會有發生了什麼問題的確實記錄,而在必要之時,在錯誤報告中也能據此提供確實的資訊。若要開始進行記錄,請使用
# script -t 2>~/upgrade-squeeze.time -a ~/upgrade-squeeze.script
或類似的指令。請不要把記錄檔放在像是 /tmp
或 /var/tmp
之類的暫存目錄下(這些目錄中的檔案可能會在升級的過程中或在重新開機時被清除掉)。
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
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.10, “被廢棄的套件” ). 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
→ , 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
上:
移除之前在安裝時所下載的套件:
# apt-get clean
把 /var/cache/apt/archives
目錄複製到 USB
裝置:
# cp -ax /var/cache/apt/archives /media/usbkey/
將暫存快取目錄掛載到該目錄上:
# mount --bind /media/usbkey/archives /var/cache/apt/archives
在升級完畢後,還原原本的 /var/cache/apt/archives
目錄:
# umount /media/usbkey/archives
移除剩下的 /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, “檢查您的來源列表” 裡的說明。
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.
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 套件的類別。
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
Once you have upgraded both the kernel and udev
the system should be rebooted.
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
The following sections describe known issues that might appear during an upgrade to squeeze.
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.
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
, python-setuptools
and python2.4
(replaced by python2.6
). For more information about packages
obsoleted in squeeze, see 節 4.10, “被廢棄的套件”.
如果在使用 aptitude、apt-get 或 dpkg 的過程中失敗了並顯示以下錯誤
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
在此則假設了您尚未在該檔案中設定這個變數。
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
如果您是由一個“純粹”的 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.
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.
如果您不太確定要怎麼做的話,把套件或檔案的名稱寫下來,等稍後再想辨法理出頭緒來。您可以在記錄檔中搜尋,以便能重新檢視在系統升級時出現在螢幕上的資訊。
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.
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.
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.
這一節中解釋了如何升級您的 kernel 及和升級有關的潛在問題。您可以安裝由 Debian 提供的某個 linux-image-*
套件,或是由原始碼自行編譯一個自訂的 kernel。
請注意到,在這一節中的許多資訊是假設了您使用著某個模組化、和 initramfs-tools
及 udev
搭配使用的 Kernel。如果您是使用不需 initrd 的自訂 kernel
或是您使用的是另一種 initrd 產生程式,這些資訊中有些是和您無關的。
當您由 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, “系統最低限度升級”.
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
[9] in the /dev/disk/by-uuid/
directory or LVM
device names in /dev/mapper/
.
Some users have reported that an upgrade could cause the kernel not to find the system root partition after a system reboot.
此時,系統開機會當掉,並顯示如下資訊:
Waiting for root file system ...
and after a few seconds a bare busybox prompt will appear.
This problem can occur when the upgrade of the kernel introduces the use of
the new generation of IDE drivers. The
IDE disk naming convention for the old drivers was
hda
, hdb
, hdc
,
hdd
. The new drivers will name the same disks
respectively sda
, sdb
,
sdc
, sdd
.
The problem appears when the upgrade does not generate a new
/boot/grub/menu.lst
file to take the new naming
convention into account. During the boot, Grub will pass a system root
partition to the kernel that the kernel doesn't find. It can also appear
when mounting filesystems if the /etc/fstab
has not
been updated accordingly. Although the upgrade process to squeeze
should cover both situations automatically.
如果您在升級後遇到了這個問題,請參閱 節 4.7.2, “如何在升級後再修復這個問題”。而關於如何在升級之前避開這個問題,請繼續閱讀。
One can avoid this problem entirely by using an identifier for the root filesystem that does not change from one boot to the next. There are two possible methods for doing this - labeling the filesystem, or using the filesystem's universally unique identifier (UUID). These methods are supported in Debian since the etch release.
The two approaches have advantages and disadvantages. The labeling approach is more readable, but there may be problems if another filesystem on your machine has the same label. The UUID approach is uglier, but having two clashing UUIDs is highly unlikely.
在以下的範例中,我們假設 root 檔案系統是位於 /dev/hda6
。我們也同時假設了您的系統安裝並使用了
udev,同時使用的是 ext2 或 ext3 檔案系統。
To implement the labeling approach:
可以利用以下指令來替檔案系統命名(該名稱必須 < 16 個字元):e2label /dev/hda6 rootfilesys
然後,編輯 /boot/grub/menu.lst
並將以下這一行:
# kopt=root=/dev/hda6 ro
修改為
# kopt=root=LABEL=rootfilesys ro
注 | |
---|---|
請不要刪掉最開頭的 |
執行 update-grub 指令,讓它更新 menu.lst
裡的
kernel
設定。
修改 /etc/fstab
,修改用來掛載 /
分割區的那一行,例如:
/dev/hda6 / ext3 defaults,errors=remount-ro 0 1
修改為
LABEL=rootfilesys / ext3 defaults,errors=remount-ro 0 1
在此主要是修改第一個欄位,您不需要修改該行中的其它欄位。
To implement the UUID approach:
Find out the universally unique identifier of your filesystem by issuing: ls -l /dev/disk/by-uuid | grep hda6. You can also use blkid /dev/hda6.
If you list the contents in /dev/disk/by-uuid
, you
should get a line similar to this one:
lrwxrwxrwx 1 root root 24 2008-09-25 08:16 d0dfcc8a-417a-41e3-ad2e-9736317f2d8a -> ../../hda6
If you use blkid, you should get an output similar to this one:
/dev/hda6: UUID="d0dfcc8a-417a-41e3-ad2e-9736317f2d8a" TYPE="ext3"
UUID 就是那個指向 /dev/hda6
的符號連結。亦即:d0dfcc8a-417a-41e3-ad2e-9736317f2d8a
。
注 | |
---|---|
您的檔案系統的 UUID 應該會是一個完全不同的字串。 |
然後,編輯 /boot/grub/menu.lst
並將以下這一行:
# kopt=root=/dev/hda6 ro
to use UUID instead:
# kopt=root=UUID=d0dfcc8a-417a-41e3-ad2e-9736317f2d8 ro
注 | |
---|---|
請不要刪掉最開頭的 |
執行 update-grub 指令,讓它更新 menu.lst
裡的
kernel
設定。
修改 /etc/fstab
,修改用來掛載 /
分割區的那一行,例如:
/dev/hda6 / ext3 defaults,errors=remount-ro 0 1
修改為
UUID=d0dfcc8a-417a-41e3-ad2e-9736317f2d8 / ext3 defaults,errors=remount-ro 0 1
在此主要是修改第一個欄位,您不需要修改該行中的其它欄位。
讓 Grub 顯示開機選單,讓您能夠選擇您要從哪個項目開機是個很合乎情理的作法。但若這個選單沒有出現,請在 kernel 開機之前按下 Esc 鍵即可讓這個選單出現。如果還是沒辨法弄出這個選單的話,請試試 節 4.7.2.2, “方案 2” 或 節 4.7.2.3, “方案 3”。
在 Grub 選單上,選擇您想要開機的項目,然後按下 e 鍵來修改這個項目的相關選項。您會看到類似的文字如下:
root (hd0,0) kernel /vmlinuz-2.6.32-5-686 root=/dev/hda6 ro initrd /initrd.img-2.6.32-5-686
選擇該項目
kernel /vmlinuz-2.6.32-5-686 root=/dev/hda6 ro
按下 e 鍵並將 hd
取代為 X
sd
(其中的
X
X
為字母
a
、b
、c
或
d
,依您的系統而定)。在這個例子中,這個項目就變成了:
kernel /vmlinuz-2.6.32-5-686 root=/dev/sda6 ro
然後按下 Enter 來儲存這些修改。如果有其它的項目中也有 show
hd
,請也同時修改。不要將這些項目修改成類似
X
root (hd0,0)
。在全數修改完成後,按下 b
鍵,然後您的系統應該就能正常開機了。
等到您的系統開完機,您必須手動修復這個問題。請參閱 節 4.7.1, “如何在升級之前避開這個問題” 並從 2 個解決方案之中選擇其中 1 個進行。
Boot from Debian GNU/Linux installation media
(CD/DVD) and when prompted, pick
rescue
to launch rescue mode. Select your language,
location, and keyboard mapping; then let it configure the network (no matter
whether it succeeds or not). After a while, you should be asked to select
the partition you want to use as root file system. The proposed choices will
look something like:
/dev/sda1 /dev/sda2 /dev/sda5 /dev/sda6
如果您知道哪個分割區是您的 root 檔案系統,請逕行選擇。否則,請直接嘗試第一個。如果程式回覆說這並不是一個 root 檔案系統,再試下一個,依此類推。這樣依次嘗試並不會對您的分割區造成什麼影響,但如果您的磁碟上只安裝了一個作業系統的話,您可以輕易得找到正確的 root 檔案系統分割區。但如果您在您的磁碟上安裝了好幾個作業系統,那麼您最好能清楚得知道哪個才是正確的分割區。
一旦您選擇了某個分割區,會出現一系列的選項供您使用。請選擇在選定的分割區上執行一個 Shell 的那個選項。如果程式回應說無法進行,請再試另一個分割區。
Now you should have shell access as user root
on your
root file system mounted on /target
. You need access to
the contents of the /boot
, /sbin
and /usr
directories on your hard disk, which should
now be available under /target/boot
,
/target/sbin
and /target/usr
. If
these directories need to be mounted from other partitions, do so (see
/etc/fstab
if you have no idea of which partition to
mount).
請參閱 節 4.7.1, “如何在升級之前避開這個問題” 並採取 2
種解決方案之一來手動修正這些問題。然後按下 exit
來離開這個救援 shell,然後選擇
reboot
來將系統重新開機(別忘了要取出開機媒體)。
從您想用的 LiveCD 發行版,像是 Debian Live、Knoppix、Ubuntu Live 來進行開機。
將您的 /boot
分割區給掛載起來。如果您不清楚是哪一個,請利用
dmesg 命令的輸出文字來找出您的磁碟是
hda
、hdb
、hdc
、hdd
或是
sda
、sdb
、sdc
、sdd
。等到您知道是哪個磁碟後,比如說是
sdb
,執行以下命令來檢視該碟碟的磁碟分割表,並找到正確的分割區:fdisk -l
/dev/sdb
在此假設您已將正確的分割區掛載在 /mnt
下,且這個分割區也包含了
/boot
目錄及裡面的所有東西,然後修改
/mnt/boot/grub/menu.lst
檔案,
找到類似的段落如下:
## ## End Default Options ## title Debian GNU/Linux, kernel 2.6.32-5-686 root (hd0,0) kernel /vmlinuz-2.6.32-5-686 root=/dev/hda6 ro initrd /initrd.img-2.6.32-5-686 title Debian GNU/Linux, kernel 2.6.32-5-686 (single-user mode) root (hd0,0) kernel /vmlinuz-2.6.32-5-686 root=/dev/hda6 ro single initrd /initrd.img-2.6.32-5-686 ### END DEBIAN AUTOMAGIC KERNELS LIST
and replace every hda
, hdb
,
hdc
, hdd
with sda
,
sdb
, sdc
, sdd
, as
appropriate. Don't modify the line similar to:
root (hd0,0)
將系統重新開機,移除 LiveCD 然後您的系統應該能正常開機了。
在關機後,請採取在 節 4.7.1, “如何在升級之前避開這個問題” 中那 2 種解決方案之一來手動修正這些問題。
在更新完畢之後,您可以進行某些工作來替下一個釋出版本進行準備:
將在 節 4.10, “被廢棄的套件” 裡所說明的已廢棄及已不再使用的套件移除掉。您應該重新檢視它們使用了哪些設定檔並考慮完全將套件清除 (purge) 掉以移去它們的設定檔。
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.
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.5, “GNOME 桌面的變更和支援” for more information.
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[10],而除此之外,我們在這段期間內一般並不會再提供其它方面的支援。如果可以的話,我們建議您能採用其它的替代方案來取代這些套件。
而這些套件為什麼會從發行版中移去的原因不一而足:有的是因為它的原始程式已經沒有人在繼續維護了;有的是因為已經沒有 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
還有一些其它的套件可以讓您用來尋找這些廢棄了的套件,像是
deborphan、debfoster 或
cruft。其中推薦使用
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.
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
.
有時為了讓系統能更易於管理,有些原來是包含於 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] 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.
[10] 或是直到在這段期間內有新的發行版推出為止。基本上,我們只會同時維護兩個 stable 的發行版。