linux試用(3)grub rescue

來源:互聯網
上載者:User

I find some useless space  in winXP, so I set an partition for the space, after I restart my computer, I find the grub cannot start!!use more than 1 hours I get the method from internet

 

首先得進入系統阿:

grub2幾種修複方法

1. 雙系統重裝windows造成grub2被改寫的修複
方法一 grub4dos0.4.4
在Windows啟動項上加上grub4dos啟動(不多說了,看置頂貼),重啟選擇進入grub,在命令列下輸入(/boot單獨分區的去掉 /boot)
代碼:
grub>find --set-root /boot/grub/core.img
grub>kernel /boot/grub/core.img
grub>boot

進入grub2菜單,進入系統後再執行
代碼:
sudo grub-install /dev/sd?

方法二 進入Livecd 後修複
引用:
sudo -i
mount 你的根分區 /mnt
mount 你的/boot 分區 /mnt/boot #如果有的話
#掛載你其他的分區,如果有的話
# 重建grub到sda的mbr
grub-install --root-directory=/mnt /dev/sda

2. 由於root分區uuid改變造成的不能正常啟動,只能進入grub rescue模式的修複

代碼:

grub rescue>set

 

grub rescue>prefix=(hd?,?)/grub

grub rescue>root=hd?,?

 

grub rescue>set root=hd?,?

grub rescue>set prefix=(hd?,?)/boot/grub

 

grub rescue>set

 

grub rescue>root=hd?,?

grub rescue>prefix=(hd?,?)/boot/grub

 

grub rescue>insmod /boot/grub/normal.mod

grub rescue>normal

 

這時就可以調出 /boot/grub/grub.cfg,修改相應uuid,
改到命令列下
grub>insmod /boot/grub/linux.mod
grub>set root=hd?,?
grub>linux /boot/vmlinuz-*** root=/dev/sd??
grub>initrd /boot/initrg.img-****
進入系統
hd?,? 是grub檔案所在分區 sda? 是/分區。

3. grub模組和設定檔grub.cfg受損無法啟動時修複

Livcd啟動進入試用
引用:
sudo -i
mount 你的根分區 /mnt
mount 你的/boot 分區 /mnt/boot #如果有的話
# 掛載你其他的分區,如果有的話

# 重建grub到sda的mbr
grub-install --root-directory=/mnt /dev/sda

# 重建grub.cfg
mount --bind /proc /mnt/proc
mount --bind /dev /mnt/dev
mount --bind /sys /mnt/sys
chroot /mnt update-grub
umount /mnt/sys
umount /mnt/dev
umount /mnt/proc

reinstall grub。。

grub-install /dev/sda

 

Searching for GRUB installation directory ... found: /boot/grub
The file /boot/grub/stage1 not read correctly.

depmod

update-grub

 

Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ...

Generating /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-2.6.25-2-686
Found kernel: /boot/vmlinuz-2.6.24-1-686
Found kernel: /boot/vmlinuz-2.6.22-3-686
Updating /boot/grub/menu.lst ... done

然後可以在grub命令列下如此恢複:

 root (hd0,6)

setup (hd0)

 

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.