博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
grub2设置默认启动项_在Grub2和Grub中设置默认条目
阅读量:2514 次
发布时间:2019-05-11

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

grub2设置默认启动项

booting is usually controlled by Grub or the new Grub2. Setting the default booting entry is a frequent operations. Here, we introduce how to set the default entry in Grub2 and Grub.

引导通常由Grub或新的Grub2控制。 设置默认启动项是一项常见的操作。 在这里,我们介绍如何在Grub2和Grub中设置默认条目。

在grub2中设置默认启动项 (Setting the default booting entry in grub2)

Note1: With some version of grub2, the grub2-set-default method and the script below may not work. You can check the “Setting default boot entry for grub2 in /etc/default/grub” method below.

注意1 :对于某些版本的grub2,grub2-set-default方法和下面的脚本可能不起作用。 您可以检查下面的“在/ etc / default / grub中为grub2设置默认启动项”。

The quick method: download the and run

快速方法:下载并运行

# wget https://www.systutorials.com/go/grub2-select.bash/ -O grub2-select.bash && \bash grub2-select.bash

and choose the boot entry.

并选择启动项。

To view the script, please check it .

要查看脚本,请检查。

Following is the manual way and what the grub2-select.bash script does.

以下是手动方式以及grub2-select.bash脚本的作用。

First of all, find out whether your system is in UEFI or BIOS mode and use different config files accordingly:

首先,找出您的系统是处于UEFI还是BIOS模式,并相应地使用不同的配置文件:

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

List all the entries in the grub.cfg by:

通过以下方式列出grub.cfg中的所有条目:

# grep ^menuentry $grubcfg | cut -d "'" -f2

Select the default entry by the entry’s name.

通过条目名称选择默认条目。

For example, the command to set the default entry to be ‘Fedora, with Xen hypervisor’ is as follows.

例如,将默认条目设置为“带有Xen虚拟机管理程序的Fedora”的命令如下。

# grub2-set-default 'Fedora, with Xen hypervisor'

Regenerate the Grub2 config file by:

通过以下方式重新生成Grub2配置文件:

# grub2-mkconfig -o $grubcfg

We also provide a script in with which you can directly use to regenerate the Grub2 config file.

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

Last, verify the default entry is what we just set.

最后,验证默认条目就是我们刚刚设置的内容。

# grub2-editenv list

This should print out what we set.

这应该打印出我们设置的内容。

在/ etc /默认/ grub中设置默认启动项为GRUB2 (Setting default boot entry for grub2 in /etc/default/grub )

We may also want to change the boot option which is stored in ‘/etc/default/grub’. For example, to set the above entry, change the line for setting GRUB_DEFAULT to

我们可能还想更改存储在“ / etc / default / grub”中的引导选项。 例如,要设置上面的条目,请将用于设置GRUB_DEFAULT的行更改为

GRUB_DEFAULT="Fedora, with Xen hypervisor"

After editing the file, we can generate the new configuration file for grub2 following .

编辑完文件后,我们可以按照配置文件的方式为grub2生成新的配置文件。

在grub中设置默认启动项 (Setting the default booting entry in grub)

The quick method: download the and run

快速方法:下载并运行

# bash grub-select.bash

and choose the boot entry.

并选择启动项。

Following is the manual way.

以下是手动方式。

In grub (before version 2, actually it is usually version 0.99), the default entry is stored in /boot/grub/grub.conf. The default entry to boot is specified by the ‘default’ variable such as

在grub(版本2之前,实际上通常是0.99版本)中,默认条目存储在/boot/grub/grub.conf中。 引导的默认条目由“ default”变量指定,例如

default=2

The ‘2’ here is to set the default entry to be the 2nd (start from 0) one.

此处的“ 2”将默认条目设置为第二个(从0开始)。

Update on Apr. 29, 2015: updated posts with support to both BIOS and UEFI based Linux ; suggest the grub2-regen-cfg.bash script for re-generating grub2 config file.

2015年4月29日更新:更新了帖子,同时支持基于BIOS和UEFI的Linux ; 建议使用grub2-regen-cfg.bash脚本重新生成grub2配置文件。

翻译自:

grub2设置默认启动项

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

你可能感兴趣的文章
vue+element-ui 字体自适应不同屏幕
查看>>
Vue 循环为选中的li列表添加效果
查看>>
vue创建脚手架 cil
查看>>
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命名空间的自动映射
查看>>