Ubuntu14.04引导菜单修复
原文鏈接:http://www.metsky.com/archives/636.html
??? ? ? 獨立分區下的Ubuntu引導菜單修復有點麻煩,執行掛載等命令時要小心檢查,修復此類引導,首先需要確保當前系統和數據安全(包括Windows和Ubuntu),不可因為分區盤符輸入錯誤導致數據丟失或誤刪除。
Wubi安裝菜單修復要簡單些,請參考《Ubuntu引導菜單修復(一)》。
一、使用Ubuntu LiveCD
(親測,可行.....)
使用Ubuntu LiveCD光盤啟動系統,然后在Terminal終端中查找Ubuntu安裝根分區(fdisk -l),并修復啟動,步驟如下(依次執行):
1、提升root權限 sudo -i2.查看磁盤列表
(該命令會顯示當前磁盤列表,找到Ubuntu根分區,假設為sda2)
3、掛載根分區
mkdir /mnt/temp mount /dev/sda2 /mnt(根分區/dev/sda2需據實際情況確定)
(如果有/boot分區,假設為sda3,如果無/boot獨立分區則跳過本步驟)
5、掛載系統目錄
for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt$i; done6、進入原系統 chroot /mnt 7、重裝grub到MBR grub-install /dev/sda update-grub8、退出原系統 exit9、重啟電腦備注:swap分區似乎不用掛載?
以上命令執行后,有可能WIN7的菜單又沒有了,不過沒關系,只用進入Ubuntu然后,再次執行sudo update-grub,會自動添加WIN7引導菜單,重啟即可。
tst@tst-laptop:~$ sudo update-grub [sudo] password for tst: Generating grub.cfg ... Found linux image: /boot/vmlinuz-2.6.32-38-generic Found initrd image: /boot/initrd.img-2.6.32-38-generic Found memtest86+ image: /boot/memtest86+.bin Found Windows 7 (loader) on /dev/sda1 done tst@tst-laptop:~$二、使用傳統Grub menu.lst
如沒有Ubuntu光盤,也可以修復引導,但需要通過Windows或WinPE等方式先安裝一個Grub引導程序,比如Grub4dos,(安裝方法可參考Windows下如何硬盤安裝CentOS 和Windows 7下硬盤安裝Ubuntu方法)。然后再啟動進入Grub菜單后使用命令行形式修改menu.lst。
注意:Ubuntu的Grub2引導啟動菜單放在/boot/grub/grub.cfg,早期則用/boot/grub/menu.lst和/boot/grub/stage1。
如果想windows引導Ubuntu(即Grub1引導Grub2),示例如下(該方法已驗證,參考來源下文論壇地址):
/boot非單獨分區
title Ubuntu root (hd0,x) kernel /boot/grub/core.img boot/boot單獨分區
title Ubuntu root (hd0,x) kernel /grub/core.img boot請注意,不同版本的Ubuntu,core.img可能在不同的目錄下,比如:
- Ubuntu 10.04 /boot/grub/core.img
- Ubuntu 12.04 /boot/grub/core.img
- Ubuntu 12.10 /boot/grub/i386-pc/core.img
- Ubuntu 14.04 /boot/grub/i386-pc/core.img
這樣修改后的menu.lst就可以引導Ubuntu,即windows引導Ubuntu。
如果想使用Ubuntu默認的引導器來引導Windows,可以在進入Ubuntu之后執行如下兩句即可:
- sudo grub-install /dev/sda
- sudo update-grub
這樣系統引導菜單就又交給Ubuntu,把前面的Windows引導菜單就多余了,在Windows下刪除即可。
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎
總結
以上是生活随笔為你收集整理的Ubuntu14.04引导菜单修复的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 内增高鞋垫几厘米合适
- 下一篇: 哪些因素会对服务器安全有危害