RedHat5.3 升級核心到2.6.33 版本

來源:互聯網
上載者:User

之前嘗試過將系統升級到2.6.31,結果失敗了,由於工作太緊張,也沒有去繼續嘗試,最近的時間稍微有些空,就又想起來這事情了。到www.kernel.org看了下,最新的核心版本都到2.6.33了,就打算直接升級2.6.33了。

一、環境

使用的Vmware安裝裝的RedHat5.3,下面都是使用的root使用者進行操作

#uname -r

2.6.18-53.el5

二、升級過程

1)        
下載核心

升級之前到www.kernel.org看看有沒有最新的核心,目前為止最新的是2.6.33,是:http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.33.tar.bz2

2)        
將linux-2.6.33.tar.bz2拷貝到/usr/local/src目錄下面,使用下面的命令解壓,得到檔案夾linux-2.6.33

tar xjvf
linux-2.6.33.tar.bz2

3)        
make distclean

假如是第一次編譯,這一步驟可以省掉的。

4)        
複製原有的config檔案到linux-2.6.33目錄

#cd /usr/local/src/linux-2.6.33

# cp
/boot/config-2.6.18-53.el5  .config

5)        
make menuconfig

選擇Load an
Alternate Configuration File,匯入.config檔案,更加自己的需要添加功能或者進行精簡。

註:核心配置有兩種方法,一種是直接置入核心* ;另一種是編成模組M ;兩種方法各有優點;直接編入核心的,比如裝置的啟動,不再需要載入模組的這一過程了;而編譯成模組,則需要載入裝置的核心支援的模組;但直接把所有的東西都編入核心也不是可行的,核心體積會變大,系統負載也會過重。我們編核心時最好把極為重要的編入核心;其它的如果您不明白的,最好用預設[3]。

修改完畢選擇Save an Alternate Configuration File,然後退出配置。 

6)        
修改.config檔案

在.config檔案搜尋CONFIG_SYSFS_DEPRECATED_V2,會發現# CONFIG_SYSFS_DEPRECATED_V2
is not set這一行,將該行修改為CONFIG_SYSFS_DEPRECATED_V2=y

假如不修改該行,在升級重新啟動後會報如下的錯,導致啟動失敗

Volume group "VolGroup00" not
found

Unalbe to access resume device
(/dev/VolGroup00/LogVol00)

mount: could not find filesystem
'/dev/root'

setuproot:moving /dev failed: No such
file or directory

setuproot:error mounting /proc: No such
file or directory

setuproot:error mounting /sys: No such
file or directory

switchroot: mount failed: No such file
or directory

Kernel panic - not syncing:Attempted to
kill init!

7)        
編譯核心

#make all

大概需要半個小時到一個小時的時間。

8)        
#make modules_install

9)        
#make install

這時候會出現3個警告[2]

WARNING: No module dm-mem-cache found for kernel 2.6.33, continuing
anyway

WARNING: No module dm-message found for kernel 2.6.33, continuing
anyway

WARNING: No module dm-raid45
found for kernel 2.6.33, continuing anyway

經過測試,這3個警告不會影響核心的升級,參考資料[2]中有相關的說明。

10)    
修改initrd檔案

假如在升級重啟後會報的錯誤insmod: error inserting ‘/lib/dm-region-hash.ko’: –1 File exits,這是由於initrd裡面的init中載入dm-region-hash.ko這個模組重複了,因此需要修改產生的initrd檔案(不是所有的機器都會出現這個錯),修改的方式如下[1],方法見參考資料1:

a)        
解壓initrd

#
cp /boot/initrd-2.6.33.img /tmp

#
cd /tmp/

#
ls

initrd-2.6.33.img

#
mkdir newinitrd

#
cd newinitrd/

#
zcat ../initrd-2.6.33.img |cpio -i

#
ls

bin  dev  etc 
init  lib  proc 
sbin  sys  sysroot

b)        
編輯init,刪掉重複的兩行

echo "Loading dm-region-hash.ko module"

insmod /lib/dm-region-hash.ko

echo "Loading dm-region-hash.ko module"

insmod /lib/dm-region-hash.ko

c)        
重新打包initrd

#
find .|cpio -c -o > ../initrd

#
cd ..

# gzip -9 <
initrd > initrd-2.6.33.img

d)        
將initrd重新複製到/boot目錄下

#cp
initrd-2.6.33.img /boot

11)    
重新啟動

啟動成功。

#uname –r

2.6.33

三、待解決問題

1)        
Iptables啟動失敗

作業系統啟動過程中出現下面的錯誤資訊:

 

Applying
ip6tables firewall rules: ip6tables-restore v1.3.5: ip6tables-restore:unable to
initalizetable 'filter'

Error
accurred at line: 3

Try
"ip6tables-restore -h' or 'ip6tables-restore --help' for more information.

Applying
iptables firewall rules: iptables-restore v1.3.5: iptables-restore:unable to initalizetable
'filter'

Error
accurred at line: 3

Try
"iptables-restore -h' or 'iptables-restore --help' for more information.

啟動後嘗試手動啟動防火牆:

#service iptables status

防火牆已停

#service iptables start

正在卸載 Iiptables 模組:[確定]

應用 iptables 防火牆規則:iptables-restore
v1.3.5: iptables-restore: unable to initializetable 'filter'

Error
occurred at line: 3

Try
`iptables-restore -h' or 'iptables-restore --help' for more information.

[失敗]

2)        
Hidd(Bluetooth HID daemon)啟動失敗

Starting hidd:
Can't open HIDP control socket: Address family not supported by protocol
 [FAILED]

# service hidd status

hidd 已死,但是 subsys 被鎖

# service hidd start

正在啟動 hidd:Can't open
HIDP control socket: Address family not supported by protocol

[失敗]

四、說明

本人也是新手,第一次升級核心成功,很多具體的細節還不是很清楚,還有兩個問題沒有解決,由於升級過程中遇到不少麻煩,大家可能也會遇到這樣的問題,就將這些資訊分享出來,希望以上的升級過程能夠給大家一些協助,假如有什麼疏漏和錯誤,或者大家對上面出現的問題有什麼好的解決方案,希望大家不吝賜教。

                   下面的幾篇文檔給了我很大的協助,謝謝!

郵箱:haifengwang1987#gmail.com

 

參考資料:

[1] 編譯核心2.6.30遇到的問題與解決辦法 http://blog.csdn.net/polisan/archive/2009/11/16/4818921.aspx

[2]
Centos 升級核心 kernel 2.6.30 http://hi.baidu.com/rhca/blog/item/2be78c01bcf5d9df267fb5e7.html

[3] http://linux.chinaunix.net/bbs/viewthread.php?tid=1147827&page=1&extra=#pid7171483

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.