博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
grub生成配置文件_如何在Linux上重新生成Grub2配置文件
阅读量:2519 次
发布时间:2019-05-11

本文共 2130 字,大约阅读时间需要 7 分钟。

grub生成配置文件

config file may need to be re-generated after changing Grub2 configurations such as and . The Grub2’s config file may be at different locations depending on your distro and whether your Linux is booted in BIOS or UEFI mode. This makes regenerating Grub2 config file not easy for Linux users especially beginners. In this post, I will introduce a way that should be portable and easy to use. This method is tested on Fedora and will likely work on RHEL / CentOS / Scientific Linux . For Ubuntu users, please check the “Notes for Ubuntu users” at the end.

更改Grub2配置(例如和后,可能需要重新生成配置文件。 Grub2的配置文件可能位于不同的位置,具体取决于您的发行版以及Linux是以BIOS还是UEFI模式启动。 这使得Linux用户(尤其是初学者)不容易重新生成Grub2配置文件。 在这篇文章中,我将介绍一种应该可移植且易于使用的方法。 该方法已在Fedora上进行了测试,可能会在RHEL / CentOS / Scientific Linux上工作。 对于Ubuntu用户,请最后查看“ Ubuntu用户注意事项”。

grub2-efi-files.png

快速方法:使用grub2-regen-cfg.bash脚本 (The quick way: use the grub2-regen-cfg.bash script )

We provide a script that you can directly use to regenerate the Grub2 config file.

我们提供了脚本 ,您可以直接使用该脚本来重新生成Grub2配置文件。

手动方式:逐步 (The manual way: step by step )

Depending whether your Linux is under BIOS or UEFI mode, we choose different config file locations. The files under /etc/ is the most portable location as far as I know as some Linux distros may change the default location that grub2 choose to store the config files under /boot/.

根据您的Linux 是BIOS还是UEFI模式,我们选择不同的配置文件位置。 据我所知, /etc/下的文件是最可移植的位置,因为某些Linux发行版可能会更改grub2选择将配置文件存储在/ boot /下的默认位置。

if [ -d /sys/firmware/efi ]; then    grubcfg="/etc/grub2-efi.cfg"else    grubcfg="/etc/grub2.cfg"fi

After choosing the correct location of the grub2 config file and store it in $grubcfg, we can re-generate the config file by:

选择正确的grub2配置文件位置并将其存储在$grubcfg ,我们可以通过以下方法重新生成配置文件:

# cp $grubcfg $grubcfg.bak # make a backup in case bad things happened# grub2-mkconfig -o $grubcfg

Okay, it is done.

好的,完成了。

给Ubuntu用户的注意事项 (Notes for Ubuntu users )

Ubuntu and its derived distros have a useful script named update-grub and you can use it to update your grub configuration file by running sudo update-grub.

Ubuntu及其衍生发行版有一个名为update-grub的有用脚本,您可以通过运行sudo update-grub来使用它来更新grub配置文件。

翻译自:

grub生成配置文件

转载地址:http://tzlwd.baihongyu.com/

你可能感兴趣的文章
ArcGIS分支版本化( Branch Versioning )技术介绍
查看>>
scrapy过滤重复数据和增量爬取
查看>>
scrapy-redis源码浅析
查看>>
tupian
查看>>
selenium定位非select下拉框的元素 ,定位不到
查看>>
用elasticsearch分析中国大学省份分布
查看>>
elasticsearch 常用查询 + 删除索引
查看>>
sops的配置过程
查看>>
prometheus+grafana监控Linux和kubernetes的例子
查看>>
kubernetes 简单 hello world nginx svc deployment
查看>>
kubenetes 的svc从ClusterPort 改为NodePort
查看>>
kube-metric在kubernetes上的部署
查看>>
kubespray 修改配置
查看>>
部署kubernetes-prometheus和用kubespray部署kubernetes后修改kubelet的
查看>>
Hbase和Hadoop的内存参数调优 + 前端控制台
查看>>
SQuirreL连接Phoenix报java.util.concurrent.TimeoutException
查看>>
开启phoenix命名空间的自动映射
查看>>
Hbase标准配置文件
查看>>
elasticsearch 7.1 401 Unauthorized
查看>>
hbase数据导出和恢复 设置双master
查看>>