Installing GRUB using grub-install
平时总是弄得grub出错进不来系统,给我来个grub-rescue,我用livecd的Ubuntu进入系统后,重新安装grub到mbr,方法如下:
grub-install --boot-directory=/mnt/boot /dev/sda
其中的boot目录就是挂载的boot分区,如果没有boot分区,那就是根目录
下面是安装文档的原文:
3.1 Installing GRUB using grub-install
For information on where GRUB should be installed on PC BIOS platforms,see BIOS installation.
In order to install GRUB under a UNIX-like OS (suchas gnu), invoke the programgrub-install (seeInvoking grub-install) as the superuser (root).
The usage is basically very simple. You only need to specify oneargument to the program, namely, where to install the boot loader. Theargument has to be either a device file (like ‘/dev/hda’). For example, under Linux the following will install GRUB into the MBRof the first IDE disk:
# grub-install /dev/hda
Likewise, under GNU/Hurd, this has the same effect:
# grub-install /dev/hd0
But all the above examples assume that GRUB should put images underthe /boot directory. If you want GRUB to put images under a directoryother than/boot, you need to specify the option--boot-directory. The typical usage is that you create a GRUBboot floppy with a filesystem. Here is an example:
# mke2fs /dev/fd0
# mount -t ext2 /dev/fd0 /mnt
# mkdir /mnt/boot
# grub-install --boot-directory=/mnt/boot /dev/fd0
# umount /mnt
Some BIOSes have a bug of exposing the first partition of a USB drive as afloppy instead of exposing the USB drive as a hard disk (they call it“USB-FDD” boot). In such cases, you need to install like this:
# losetup /dev/loop0 /dev/sdb1 # mount /dev/loop0 /mnt/usb # grub-install --boot-directory=/mnt/usb/bugbios --force --allow-floppy /dev/loop0
This install doesn't conflict with standard install as long as they are inseparate directories.
Note that grub-install is actually just a shell script and thereal task is done bygrub-mkimage andgrub-setup. Therefore, you may run those commands directly to install GRUB, withoutusinggrub-install. Don't do that, however, unless you are veryfamiliar with the internals of GRUB. Installing a boot loader on a runningOS may be extremely dangerous.
Installing GRUB using grub-install相关推荐
- 开机黑屏且显示the GNU GRUB version grub>命令行解决办法
开机黑屏且显示the GNU GRUB version grub>命令行解决办法 开机黑屏且显示the GNU GRUB version 2.02~beta2-36ubuntu2 minimal ...
- 格式化linux grub,linux grub 引导启动过程详解
机器加电启动后,BIOS开始检测系统参数,如内存的大小,日期和时间,磁盘 设备以及这些磁盘设备用来引导的顺序,通常情况下,BIOS都是被配置成首先检查 软驱或者光驱(或两者都检查),然后再尝试从硬盘引 ...
- 服务器开机修改grub,修改 grub
修改 grub 内容精选 换一换 @[TOC](联想 Yoga 14s 2021 (Intel) 安装 ubuntu) 新设备最容易遇到驱动问题.Yoga 14s 2021 安装ubuntu就遇到了屏 ...
- 双linux grub rescue,Grub Rescue修复方法
症状: 开机显示:GRUB loading error:unknow filesystem grub rescue> 原因: 已经发现下面几种操作会导致这种问题: 1,想删除ubuntu,于是直 ...
- linux grub 下载,GRUB 2.04发布下载,附新功能介绍
GRUB 2.04版本发布了,它是在GRUB 2.02/2.00的基础上更新的,GRUB 2.02是目前使用得最多的多重启动管理器,全称为GRand Unified Bootloader,使用它可以引 ...
- linux grub 串口,grub重定向到串口 - Emmoblin Blog
将GRUB输出重定向到串口(Edit /boot/grub/grub.conf) serial --unit=0 --speed=115200 --word=8 --parity=no --stop= ...
- 卸载linux grub rescue,Grub Rescue 修复方法
症状: 开机显示:GRUB loading error:unknow filesystem grub rescue> 原因: 由于操作者不知道grub2分为两部分,一部分(一般情况下)写在了mb ...
- linux gnu grub,GNU GRUB命令的使用方法与GNU GRUB详细介绍
先使用ls命令,找到Ubuntu的安装在哪个分区: grub>ls 会罗列所有的磁盘分区信息,比方说: (hd0,1),(hd0,5),(hd0,3),(hd0,2) 然后依次调用如下命令: X ...
- 【Grub】Grub引导的安装配置
Grub引导是安装Linux经常需要的东西,有时无法进入linux系统了,也没有安装镜像,那么也可以用Grub来进入系统,修复grub2引导. Grub安装步骤 一.下载必备软件 软件主要有2个: ...
- ubuntu 16.04(Windows 10双系统+grub引导)无法进入tt1~tt6(NVIDIA驱动安装相关-黑屏,login loop,分辨率)...
目录 前言回顾 最终解决: 0.关闭x服务 1.禁用nouveau 2.加入 3.更新 4.查找匹配驱动 5.选择推荐版本 6.等待安装后重启,nvidia-smi查看是否安装成功,或者lsmod | ...
最新文章
- 计算机基本水平测试内容,浙江师范大学计算机基础水平测试大纲(2018级新生使用)...
- *** FATAL ERROR: too many grib files .. 1st=F:\data\预测数据 2nd=- ***
- 修改Apache的默认站点目录的方法,需要的朋友可以参考下
- 数据同步的解决方案Canal
- ansible 容器部署_如何使用Ansible Container管理Linux容器
- Android开发学习之路-带文字的图片分享
- MDK5如何生成bin文件
- 程序猿的中秋节——浪漫至死不渝!!
- 如何实现一个安全的Web登陆
- html+css简单的实现360搜索引擎首页面
- 手机软件自动化测试探索
- 色相 色调_如何使用色相调光器开关控制飞利浦色相灯
- mac 命名 报错 请尝试使用字符较少,或不含标点符号的名称。
- 网易云课堂---布尔教育《8小时学会html》 笔记
- 射线法判断点是否在多边形内-JAVA
- PHP加密函数与解密函数详解
- 成功解决:由于找不到 MSVCP100D.dll, 无法继续执行代码。重新安装可能会解决此问题。
- 总裁演说思维应用:坚持用讲故事五步训练法,练好口才并不难!
- 浅谈设计模式 | 先有鸡还是先有蛋?先有代码后有设计模式还是先有设计模式再写代码?
- 关于文件夹和快捷方式