How to Repair GRUB2 When Ubuntu Won’t Boot
Ubuntu and many other Linux distributions use the GRUB2 boot loader. If GRUB2 breaks—for example, if you install Windows after installing Ubuntu, or overwrite your MBR—you won’t be able to boot into Ubuntu.
You can easily restore GRUB2 from a Ubuntu live CD or USB drive. This process is different from restoring the legacy GRUB boot loader on older Linux distributions.
This process should work on all versions of Ubuntu. It’s been tested on Ubuntu 16.04 and Ubuntu 14.04.
The Graphical Method: Boot Repair
Boot Repair is a graphical tool that can repair GRUB2 with a single click. This is the ideal solution to boot problems for most users.
If you have the media you installed Ubuntu from, insert it into your computer, restart, and boot from the removable drive. If you don’t, download a Ubuntu live CD and burn it to a disc or create a bootable USB flash drive.
When Ubuntu boots, click “Try Ubuntu” to get a usable desktop environment.

Ensure you have an Internet connection before continuing. You may need to choose a Wi-Fi network and enter its passphrase.
Open a Terminal window from the Dash and run the following commands to install and launch Boot Repair:
sudo apt-add-repository ppa:yannubuntu/boot-repair sudo apt-get update sudo apt-get install -y boot-repair boot-repair

The Boot Repair window will automatically scan your system after you run the boot-repair command. After it scans your system, click the “Recommended repair” button to repair GRUB2 with a single click.
You can choose to use the advanced options here, but Ubuntu’s wiki recommends you not use the advanced options unless you know what you’re doing. The recommended repair option can fix most problems automatically, and you could mess up your system even more by selecting the wrong advanced options.

Boot Repair will begin working. It may ask you to open a Terminal and copy/paste a few commands into it.
Just follow the instructions that appear on your screen. Perform the instructions Boot Repair wants you to and click “Forward” to continue through the wizard. The tool will walk you through everything you need to do.

Restart your computer after the Boot Repair tool finishes applying its changes. Ubuntu should boot up normally.
The Terminal Method
If you’d rather get your hands dirty, you can do this yourself from a terminal. You’ll need to boot from a live CD or USB drive, as in the graphical method above. Ensure the version of Ubuntu on the CD is the same as the version of Ubuntu installed on your computer. For example, if you have Ubuntu 14.04 installed, ensure you use a Ubuntu 14.04 live CD.
Open a terminal after booting into the live environment. Identify the partition Ubuntu is installed on using one of the following commands:
sudo fdisk -l sudo blkid
Here’s the output of both commands. In the fdisk -l command, the Ubuntu partition is identified by the word Linux in the System column. In the blkid command, the partition is identified by its ext4 file system.
If you have multiple Linux ext4 partitions, you can get an idea of which is which by viewing the size of the partitions and their order on the disk here.

Run the following commands to mount the Ubuntu partition at /mnt/ubuntu, replacing/dev/sdX# with the device name of your Ubuntu partition from the above commands:
sudo mkdir /mnt/ubuntu sudo mount /dev/sdX# /mnt/ubuntu
In the screenshot above, our Ubuntu partition is /dev/sda1. This means the first partition on the first hard disk device.
Important: If you have a separate boot partition, skip the above command and mount the boot partition at /mnt/ubuntu/boot instead. If you don’t know whether you have a separate boot partition, you probably don’t.

Run the following command to reinstall grub from the live CD, replacing /dev/sdX with the device name of the hard disk above. Omit the number. For example, if you used/dev/sda1 above, use /dev/sda here.
sudo grub-install --boot-directory=/mnt/ubuntu/boot /dev/sdX

Restart your computer and Ubuntu should boot properly.
How to Repair GRUB2 When Ubuntu Won’t Boot的更多相关文章
- ubuntu下提示/boot空间不足,解决办法
在安装 ubuntu的时候 , 给/boot文件目录分配空间的时候,是100M,/boot可以单独分成一个区,也可以不单独分,在/(根目录)下也会自动为其创建一个boot目录.顺便提一下,linux分 ...
- Ubuntu提示卷boot仅剩0字节的硬盘空间,解决办法
查看当前安装的linux内核版本号 dpkg --get-selections |grep linux-image 查看当前使用的内核版本号 uname -a 卸载不需要的内核 sudo apt-ge ...
- 安装ubuntu时将boot目录单独挂载的意义
只有一个意义那就是当你的情况是:单个硬盘里面安装多个系统. 如果不是这样,就别动它.
- Ubuntu升级出现/boot空间不足解决
经常升级Linux内核,导致更新时警告/boot分区空间不足.这是以为多次升级内核后,导致内核版本太多,清理一下没用的内核文件就行了.命令如下: zht@zht-Ubuntu:~$ dpkg -l ' ...
- ubuntu更新提示/boot空间不足
1. 查看当前使用的内核版本 uname -a 2.在终端下察看已经安装的旧的内核: ctrl+alt+t——>进入终端——>输入命令: dpkg --get-selections|gre ...
- Ubuntu升级出现/boot空间不足解决(转)
经常升级Linux内核,导致更新时警告/boot分区空间不足.这是以为多次升级内核后,导致内核版本太多,清理一下没用的内核文件就行了.命令如下: zht@zht-Ubuntu:~$ dpkg -l ' ...
- ubuntu修改grub2
转自修改系统启动项 grub2配置的方法 ubuntu 在早期的Ubuntu中,使用Grub作为系统的启动引导程序,想修改系统启动项非常简单,只要用gedit打开系统菜单设定文件( sudo gedi ...
- 修改系统启动项 grub2配置的方法 ubuntu[转]
在 早期的Ubuntu中,使用Grub作为系统的启动引导程序,想修改系统启动项非常简单,只要用gedit打开系统菜单设定文件( sudo gedit /boot/grub/menu.lst ),修改该 ...
- 使用 boot-repair 对 Windows + Ubuntu 双系统引导修复
问题描述: 由于在windows上进行更新/重装/修改了引导设置以后,windows会“自私”地重写引导,导致Ubuntu系统引导消失而无法选择Ubuntu启动.
随机推荐
- 自学Zabbix2.5-客户端agentd安装过程
点击返回:自学Zabbix之路 ....
- 【洛谷5月月赛】玩游戏(NTT,生成函数)
[洛谷5月月赛]玩游戏(NTT,生成函数) 题面 Luogu 题解 看一下要求的是什么东西 \((a_x+b_y)^i\)的期望.期望显然是所有答案和的平均数. 所以求出所有的答案就在乘一个逆元就好了 ...
- 洛谷 P1452 Beauty Contest 解题报告
P1452 Beauty Contest 题意 求平面\(n(\le 50000)\)个点的最远点对 收获了一堆计算几何的卡点.. 凸包如果不保留共线的点,在加入上凸壳时搞一个相对栈顶,以免把\(n\ ...
- bzoj1494 生成树计数 (dp+矩阵快速幂)
题面欺诈系列... 因为一个点最多只能连到前k个点,所以只有当前的连续k个点的连通情况是对接下来的求解有用的 那么就可以计算k个点的所有连通情况,dfs以下发现k=5的时候有52种. 我们把它们用类似 ...
- Luogu 1081 【NOIP2012】开车旅行 (链表,倍增)
Luogu 1081 [NOIP2012]开车旅行 (链表,倍增) Description 小A 和小B决定利用假期外出旅行,他们将想去的城市从1到N 编号,且编号较小的城市在编号较大的城市的西边,已 ...
- bzoj2870最长道路tree——边分治
简化版描述: 给定一棵N个点的树,求树上一条链使得链的长度乘链上所有点中的最小权值所得的积最大. 其中链长度定义为链上点的个数. 有几个不同的做法: 1.sort+并查集+树的直径.边从大到小加入 ...
- EXGCD 扩展欧几里得
推荐:https://www.zybuluo.com/samzhang/note/541890 扩展欧几里得,就是求出来ax+by=gcd(x,y)的x,y 为什么有解? 根据裴蜀定理,存在u,v使得 ...
- bzoj3698 XWW的难题
题意:给你个n * n的实数矩阵,你需要把它中的每个数上/下取整,并满足如下条件: 每行最后一个数等于前面的和. 每列最后一个数等于前面的和. n行n列的那个元素始终为0,不予考虑. 求满足条件下矩阵 ...
- A1086. Tree Traversals Again
An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example ...
- js中this的总结
http://www.blogjava.net/baoyaer/articles/105864.html 在面向对象编程语言中,对于this关键字我们是非常熟悉的.比如C++.C#和Java等都提供了 ...