ubuntu下更新grub2

WBOY
Release: 2016-06-07 15:43:34
Original
1484 people have browsed it

电脑上装多个系统的难免会出现进不了系统的问题,多数是grub的问题。 使用LiveCD光盘启动电脑后进入光盘中的Ubuntu系统,或者用USB启动,打开终端。 sudo -i 先来找一找你的ubuntu安装在那个分区,用: fdisk -l 之后会出来一张表,表中有你的分区信息,找到

电脑上装多个系统的难免会出现进不了系统的问题,多数是grub的问题。

使用LiveCD光盘启动电脑后进入光盘中的Ubuntu系统,或者用USB启动,打开终端。

sudo-i

先来找一找你的ubuntu安装在那个分区,用:

fdisk-l

之后会出来一张表,表中有你的分区信息,找到你安装Ubuntu的分区,如果你不确定的话就找id为83的。下面假如说你的Ubuntu安装在/dev/sda1 分区,则下面挂载原系统的根目录:

mount/dev/sda1/mnt

将/dev/sda1挂载到了/mnt下,当然你也可以选其他地方。这里注意,如果你有单独为/boot分区的话,要单独挂载一次 /boot,比如说 如果你原来的/boot挂载到/dev/sda12上了,那个你这里要再输入

mount/dev/sda12/mnt/boot

下面是最后一步了:

grub-install--root-directory=/mnt/dev/sda

(注意:/mnt后面有空格键)
如果看到
Installation finished.No Error Reported.
就表示已经成功啦!
这时重新启动你的电脑,就能看到grub2的引导界面了,但是这时只能用来引导Ubuntu,还暂时无法引导Windows 7,这时选择进入Ubuntu,再找到并启动终端,在终端输入如下命令:

sudoupdate-grub2

更新一下grub2就可以了。
按照提示输入密码,如果顺利的话,会出现如下类似语句,那就表示成功了。

Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.2.0-26-generic
Found initrd image: /boot/initrd.img-3.2.0-26-generic
Found linux image: /boot/vmlinuz-3.2.0-25-generic
Found initrd image: /boot/initrd.img-3.2.0-25-generic
Found linux image: /boot/vmlinuz-3.2.0-23-generic
Found initrd image: /boot/initrd.img-3.2.0-23-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 7 (loader) on /dev/sda1
Found Ubuntu 10.04.3 LTS (10.04) on /dev/sda10
Found Ubuntu 10.04.3 LTS (10.04) on /dev/sda9
done
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!