LINUX系统管理----GRUB笔记
生活随笔
收集整理的這篇文章主要介紹了
LINUX系统管理----GRUB笔记
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1.啟動linux系統(如果現有系統無法啟動,可用修復模式) 2.安裝grub的軟件包 3.安裝grub的引導程序到mbr中 步驟:如下 #grub grub> root (hdx,y) //指定/boot目錄所在分區 注:hdx中的X是代表第幾個硬盤, Y代表第幾個區。 grub> setup (hdx) //安裝到指定的硬盤MBR中. 配制GRUB菜單界面 #VI? /boot/grub/grub.conf (1)? 配制默認啟動項 ---DETAULTS=數字 設置默認啟動項為第幾項 ------TIMEOUT=數字 設置菜單延遲 TIMEOUT=0表示直接啟動 不顯示啟動菜單? TIMEOUT=-1 表示永久等待直到用戶確認為止. (2)配置菜單背景圖片 --SPLASHIMAGE=(HDX,Y)/路徑/*.xpm.gz 注:???? --GRUB菜單背景圖片是.XPM.GZ文件 且圖片分辨率為640x140顏色為14色 可以用convert?命令 將JPG/PNG/BMP文件轉換成XPM文件 #convert?? -resize? 640x480!? -colors? 14? 源文件?? XPM文件 (3) 配制GRUB口令 passwd=口令?? /--md5??? 口令密文 注:GRUB口令分為全局口令和私有口令,放在下面為引導項口令? 放在所有引導項上面的為全局口令 --grub口令用明文和密文表示 可用grub-md5-crypt命令生成指定的口令的密文. (4)配制GRUB的啟動項 ---linux啟動項 a??? title?字符串? //設置啟動項標題 b?? root (hdx,y)? //設置LINUX內核所在分區 c???kernel?? /路徑/文件名 [參數]? //指定內核文件路徑 d?? initrd??? 路徑/文件名? ?//指定initrd鏡像文件路徑 --啟動項WINDOWS
??? ?A title? 字符串
??? ?B rootnoverify? (hdx,y) //設置系統的啟動分區位置
???? C chainloader?? +1? //讀取啟動分區的引導扇區
注:? 如果啟動項與GURB不在同一塊硬盤上,則需要添加map選項 map選項的作用用于建立磁盤關聯
???? 格式:map(hdx)(hdy)
???????????????? ?map(hdy)(hdx) (5)GRUB常見問題 1? 如果從MBR中刪除GRUB的引導程序?
?? 解決方法:---利用DOS啟動盤啟動系統
???????????? ---運行fdisk /mbr
? 2? 如何從新加載GRUB引導程序到MBR中?
?? 解決方法:
?-----利用安裝盤啟動LINUX的修復模式
?-----#grub
?-----grub>root (hdx,y)
?-----grub>setup (hdx)
??????? -----grub>quit
3 為什么啟動時不出現GRUB菜單界面,只顯示GRUB命令界面,在GRUB命令行能啟動系統。
原因是:啟動時找不到GRUB菜單界面,
命令行啟動方法如下:
?A、啟動LINUX系統
?????? ??#grub>root (hdx,y)
??#grub>kernel /路徑/
? ??#grub>initrd /路徑/
? ??#grub>boot
??????? B、啟動WINDOWS系統
?????????? ?#grub>rootnoverify (hdx,y)
???#grub>chianloader?? +1
? ??#grub>boot
注:如果需要啟動系統與GRUB不在同一塊硬盤上,必須運行MAP命令。 4 如何使用GRUB菜單編輯模式來啟動LINUX系統的單用戶模式 。
??--GRUB菜單編輯模式
???A 作用:可用于在啟動系統前對菜單界面進行了臨時性的修改。
??B 使用方法:將光標移動到某菜單或啟動項按“e”鍵即可進行編輯模式,編輯模式可按“e”進行修改命令行。按“d”刪除命令行 按“o”是添加空白行,按“b“啟動系統。
??? ??C 啟動單用戶系統、
??? ??? 選中LINUX啟動項——>e——>編輯模式——在kernel這一行按e進行編輯在其后添加“空格1” 最后按b啟動系統
------------------------------------------------------------------------------------- grub引導常見的錯誤:如下 (注:以下內容轉載) 引用:
1 : Filename must be either an absolute filename or blocklist
解釋 :1號錯誤表示文件名格式錯誤。在 GRUB 中要么是以絕對路徑給出文件
例子 :
grub> kernel vmlinuz root=label=/
Error 1: Filename must be either an absolute pathname or blocklist
grub>
引用:
2 : Bad file or directory type
解釋 :2號錯誤表示命令期望的是一個普通文件,但相應文件名的對象是一個符號鏈接、目錄、FIFO
例子 :
grub> kernel /testdir root=LABEL=/
Error 2: Bad file or directory type
grub>
引用:
3 : Bad or corrupt data while decompressing file
解釋 :3號錯誤表示解壓文件時發生錯誤。可能是因為這個文件被損壞了
引用:
4 : Bad or incompatible header in compressed file
解釋 :4號錯誤表示壓縮文件的頭部格式不被兼容或者錯誤
引用:
5 : Partition table invalid or corrupt
解釋 :5 號錯誤表示分區表無效或者被破壞。這是一個不好的預兆
引用:
6 : Mismatched or corrupt version of stage1/stage2
解釋 :6號錯誤表示 install 命令發現 stage1 和 stage2 的頒布號不被兼容
引用:
7 : Loading below 1MB is not supported
解釋 :This error is returned if the lowest address in a kernel is below
???? the 1MB boundary. The Linux zImage format is a special case and
????? can be handled since it has a fixed loading address and maximum size
引用:
8 : Kernel must be loaded before booting
解釋 :8號錯誤表示執行 boot 命令之前沒有先執行 kernel 命令
引用:
9 : Unknown boot failure
解釋 :9 號錯誤表示未知的引導錯誤
引用:
10 : Unsupported Multiboot features requested
解釋 :10 號錯誤表示請求 Multiboot header 所要求功能不被 GRUB 所支持。
引用:
11 : Unrecognized device string
解釋 :11 號錯誤表示無法識別的設備字符串。
例子 :
grub> root hd0
Error 11: Unrecognized device string
grub>
引用:
12 : Invalid device requested
解釋 :12 號錯誤表示請求的設備無效
例子 :
grub> root (hd2)
Error 21: Selected disk does not exist
grub> kernel /grub/grub.conf root=LABEL=/
Error 12: Invalid device requested
grub>
引用:
13 : Invalid or unsupported executable format
解釋 :13 號錯誤表示無效或者無法識別的可執行格式
例子 :
grub> kernel /grub/grub.conf root=LABEL=/
Error 13: Invalid or unsupported executable format
grub>
引用:
14 : Filesystem compatibility error, cannot read whole file
解釋 :14 號錯誤表示文件系統兼容性錯誤,無法讀取整個文件
引用:
15 : File not found
解釋 :請求的文件無法找到
例子 :
grub> find /grub-noexist/grub.conf
Error 15: File not found
grub>
引用:
16 : Inconsistent filesystem structure
解釋 :16 號錯誤表示不一致的文件系統結構。可能是文件系統結構被破壞了。
引用:
17 : Cannot mount selected partition
解釋 :17號錯誤表示無法掛載指定分區。例如 swap 分區
例子 :
grub> root (hd0,2) 這是一個 swap 分區
Filesystem type unknown, partition type 0x82
grub> kernel /vmlinuz
Error 17: Cannot mount selected partition
grub>
引用:
18 : Selected cylinder exceeds maximum supported by BIOS
解釋 :18 號錯誤表示選擇的柱面超過了 BIOS 支持的最大能力。這通常發生在不支持 LBA 模式
的硬盤上。
引用:
19 : Linux kernel must be loaded before initrd
解釋 :19 號錯誤表示執行 initrd 命令前必須先執行 kernel 命令
引用:
20 : Multiboot kernel must be loaded before modules
解釋 :20 號錯誤表示執行 module 或者 moduleunzip 命令前必須先執行 kernel 命令
引用:
21 : Selected disk does not exist
解釋 :21 號錯誤表示選擇的磁盤不存在
例子 :
grub> root (hd2)
Error 21: Selected disk does not exist
grub>
引用:
22 : No such partition
解釋 :22 號錯誤表示分區不存在
例子 :
grub> root (hd0,10)
Error 22: No such partition
grub>
引用:
23 : Error while parsing number
解釋 :23 號錯誤表示參數解釋錯誤,希望是一個數值,但參數卻是其他類型
例子 :
grub> root (hda,0)
Error 23: Error while parsing number
grub>
引用:
24 : Attempt to access block outside partition
解釋 :24 號錯誤表示嘗試訪問的 block 超出了分區
引用:
25 : Disk read error
解釋 :25 號錯誤表示磁盤讀錯誤
引用:
26 : Too many symbolic links
解釋 :26 號錯誤表示太多的符號連接(默認最多允許5個)
引用:
27 : Unrecognized command
解釋 :無法識別的命令
引用:
28 : Selected item cannot fit into memory
解釋 :選擇的對象無法被加載到內存中。
例子 :
[root@monitor boot]# dd if=/dev/zero of=vmlinuz-2.4.20-31.9 bs=1024 count=1 seek=1
讀入了 1+0 個塊
輸出了 1+0 個塊
[root@monitor boot]#grub
grub> kernel /vmlinuz-2.4.20-31.9 root=label=/
[Linux-bzImage, setup=0x1400, size=0xfffff200]
Error 28: Selected item cannot fit into memory
grub>
引用:
29 : Disk write error
解釋 :磁盤寫錯誤
引用:
30 : Invalid argument
解釋 :無效參數
例子 :
grub> serial --noarg=0
Error 30: Invalid argument
grub>
引用:
31 : File is not sector aligned
解釋 :This error may occur only when you access a ReiserFS partition by
????? block-lists (e.g. the command `install'). In this case, you should
????? mount the partition with the `-o notail' option.
引用:
32 : Must be authenticated
解釋 :要求輸入口令才能繼續進行下面的操作。例如配置文件中有 password 或者 lock 命令
例子 :
password root1234
title DOS
lock
???????? rootnoverify (hd0,0)
???????? chainloader +1
引用:
33 : Serial device not configured
解釋 :33 號錯誤表示串口還沒有配置。這一般發生在你執行 terminal serial 的時候
引用:
34 : No spare sectors on the disk
解釋 :磁盤自由空間不足。可能發生在把 stage 1.5 嵌入到 MBR 之后的空間的時候。但這部分空間可能已經被分區表使用了
??? ?A title? 字符串
??? ?B rootnoverify? (hdx,y) //設置系統的啟動分區位置
???? C chainloader?? +1? //讀取啟動分區的引導扇區
注:? 如果啟動項與GURB不在同一塊硬盤上,則需要添加map選項 map選項的作用用于建立磁盤關聯
???? 格式:map(hdx)(hdy)
???????????????? ?map(hdy)(hdx) (5)GRUB常見問題 1? 如果從MBR中刪除GRUB的引導程序?
?? 解決方法:---利用DOS啟動盤啟動系統
???????????? ---運行fdisk /mbr
? 2? 如何從新加載GRUB引導程序到MBR中?
?? 解決方法:
?-----利用安裝盤啟動LINUX的修復模式
?-----#grub
?-----grub>root (hdx,y)
?-----grub>setup (hdx)
??????? -----grub>quit
3 為什么啟動時不出現GRUB菜單界面,只顯示GRUB命令界面,在GRUB命令行能啟動系統。
原因是:啟動時找不到GRUB菜單界面,
命令行啟動方法如下:
?A、啟動LINUX系統
?????? ??#grub>root (hdx,y)
??#grub>kernel /路徑/
? ??#grub>initrd /路徑/
? ??#grub>boot
??????? B、啟動WINDOWS系統
?????????? ?#grub>rootnoverify (hdx,y)
???#grub>chianloader?? +1
? ??#grub>boot
注:如果需要啟動系統與GRUB不在同一塊硬盤上,必須運行MAP命令。 4 如何使用GRUB菜單編輯模式來啟動LINUX系統的單用戶模式 。
??--GRUB菜單編輯模式
???A 作用:可用于在啟動系統前對菜單界面進行了臨時性的修改。
??B 使用方法:將光標移動到某菜單或啟動項按“e”鍵即可進行編輯模式,編輯模式可按“e”進行修改命令行。按“d”刪除命令行 按“o”是添加空白行,按“b“啟動系統。
??? ??C 啟動單用戶系統、
??? ??? 選中LINUX啟動項——>e——>編輯模式——在kernel這一行按e進行編輯在其后添加“空格1” 最后按b啟動系統
------------------------------------------------------------------------------------- grub引導常見的錯誤:如下 (注:以下內容轉載) 引用:
1 : Filename must be either an absolute filename or blocklist
解釋 :1號錯誤表示文件名格式錯誤。在 GRUB 中要么是以絕對路徑給出文件
例子 :
grub> kernel vmlinuz root=label=/
Error 1: Filename must be either an absolute pathname or blocklist
grub>
引用:
2 : Bad file or directory type
解釋 :2號錯誤表示命令期望的是一個普通文件,但相應文件名的對象是一個符號鏈接、目錄、FIFO
例子 :
grub> kernel /testdir root=LABEL=/
Error 2: Bad file or directory type
grub>
引用:
3 : Bad or corrupt data while decompressing file
解釋 :3號錯誤表示解壓文件時發生錯誤。可能是因為這個文件被損壞了
引用:
4 : Bad or incompatible header in compressed file
解釋 :4號錯誤表示壓縮文件的頭部格式不被兼容或者錯誤
引用:
5 : Partition table invalid or corrupt
解釋 :5 號錯誤表示分區表無效或者被破壞。這是一個不好的預兆
引用:
6 : Mismatched or corrupt version of stage1/stage2
解釋 :6號錯誤表示 install 命令發現 stage1 和 stage2 的頒布號不被兼容
引用:
7 : Loading below 1MB is not supported
解釋 :This error is returned if the lowest address in a kernel is below
???? the 1MB boundary. The Linux zImage format is a special case and
????? can be handled since it has a fixed loading address and maximum size
引用:
8 : Kernel must be loaded before booting
解釋 :8號錯誤表示執行 boot 命令之前沒有先執行 kernel 命令
引用:
9 : Unknown boot failure
解釋 :9 號錯誤表示未知的引導錯誤
引用:
10 : Unsupported Multiboot features requested
解釋 :10 號錯誤表示請求 Multiboot header 所要求功能不被 GRUB 所支持。
引用:
11 : Unrecognized device string
解釋 :11 號錯誤表示無法識別的設備字符串。
例子 :
grub> root hd0
Error 11: Unrecognized device string
grub>
引用:
12 : Invalid device requested
解釋 :12 號錯誤表示請求的設備無效
例子 :
grub> root (hd2)
Error 21: Selected disk does not exist
grub> kernel /grub/grub.conf root=LABEL=/
Error 12: Invalid device requested
grub>
引用:
13 : Invalid or unsupported executable format
解釋 :13 號錯誤表示無效或者無法識別的可執行格式
例子 :
grub> kernel /grub/grub.conf root=LABEL=/
Error 13: Invalid or unsupported executable format
grub>
引用:
14 : Filesystem compatibility error, cannot read whole file
解釋 :14 號錯誤表示文件系統兼容性錯誤,無法讀取整個文件
引用:
15 : File not found
解釋 :請求的文件無法找到
例子 :
grub> find /grub-noexist/grub.conf
Error 15: File not found
grub>
引用:
16 : Inconsistent filesystem structure
解釋 :16 號錯誤表示不一致的文件系統結構。可能是文件系統結構被破壞了。
引用:
17 : Cannot mount selected partition
解釋 :17號錯誤表示無法掛載指定分區。例如 swap 分區
例子 :
grub> root (hd0,2) 這是一個 swap 分區
Filesystem type unknown, partition type 0x82
grub> kernel /vmlinuz
Error 17: Cannot mount selected partition
grub>
引用:
18 : Selected cylinder exceeds maximum supported by BIOS
解釋 :18 號錯誤表示選擇的柱面超過了 BIOS 支持的最大能力。這通常發生在不支持 LBA 模式
的硬盤上。
引用:
19 : Linux kernel must be loaded before initrd
解釋 :19 號錯誤表示執行 initrd 命令前必須先執行 kernel 命令
引用:
20 : Multiboot kernel must be loaded before modules
解釋 :20 號錯誤表示執行 module 或者 moduleunzip 命令前必須先執行 kernel 命令
引用:
21 : Selected disk does not exist
解釋 :21 號錯誤表示選擇的磁盤不存在
例子 :
grub> root (hd2)
Error 21: Selected disk does not exist
grub>
引用:
22 : No such partition
解釋 :22 號錯誤表示分區不存在
例子 :
grub> root (hd0,10)
Error 22: No such partition
grub>
引用:
23 : Error while parsing number
解釋 :23 號錯誤表示參數解釋錯誤,希望是一個數值,但參數卻是其他類型
例子 :
grub> root (hda,0)
Error 23: Error while parsing number
grub>
引用:
24 : Attempt to access block outside partition
解釋 :24 號錯誤表示嘗試訪問的 block 超出了分區
引用:
25 : Disk read error
解釋 :25 號錯誤表示磁盤讀錯誤
引用:
26 : Too many symbolic links
解釋 :26 號錯誤表示太多的符號連接(默認最多允許5個)
引用:
27 : Unrecognized command
解釋 :無法識別的命令
引用:
28 : Selected item cannot fit into memory
解釋 :選擇的對象無法被加載到內存中。
例子 :
[root@monitor boot]# dd if=/dev/zero of=vmlinuz-2.4.20-31.9 bs=1024 count=1 seek=1
讀入了 1+0 個塊
輸出了 1+0 個塊
[root@monitor boot]#grub
grub> kernel /vmlinuz-2.4.20-31.9 root=label=/
[Linux-bzImage, setup=0x1400, size=0xfffff200]
Error 28: Selected item cannot fit into memory
grub>
引用:
29 : Disk write error
解釋 :磁盤寫錯誤
引用:
30 : Invalid argument
解釋 :無效參數
例子 :
grub> serial --noarg=0
Error 30: Invalid argument
grub>
引用:
31 : File is not sector aligned
解釋 :This error may occur only when you access a ReiserFS partition by
????? block-lists (e.g. the command `install'). In this case, you should
????? mount the partition with the `-o notail' option.
引用:
32 : Must be authenticated
解釋 :要求輸入口令才能繼續進行下面的操作。例如配置文件中有 password 或者 lock 命令
例子 :
password root1234
title DOS
lock
???????? rootnoverify (hd0,0)
???????? chainloader +1
引用:
33 : Serial device not configured
解釋 :33 號錯誤表示串口還沒有配置。這一般發生在你執行 terminal serial 的時候
引用:
34 : No spare sectors on the disk
解釋 :磁盤自由空間不足。可能發生在把 stage 1.5 嵌入到 MBR 之后的空間的時候。但這部分空間可能已經被分區表使用了
轉載于:https://blog.51cto.com/simply/316563
總結
以上是生活随笔為你收集整理的LINUX系统管理----GRUB笔记的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Linux技巧:自动挂载UDF光盘的技巧
- 下一篇: 想要的生活