更改Ubuntu的grub启动时间

背景

在使用Ubuntu时,有时需要更改启动时间,或因图形化界面启动失败需要进入高级模式时,需要调整操作系统在启动时的选择时间.以下以Ubuntu 20.04为例.

如果能进入ubuntu系统或命令行

以管理员身份打开/boot/grub/grub.cfg:

找到下面语句的位置:
terminal_output gfxterm
if [ " r e c o r d f a i l " = 1 ] ; t h e n s e t t i m e o u t = 30 e l s e i f [ x {recordfail}" = 1 ] ; then set timeout=30 else if [ x recordfail"=1];thensettimeout=30elseif[xfeature_timeout_style = xy ] ; then
set timeout_style=hidden
set timeout=0

Fallback hidden-timeout code in case the timeout_style feature is

unavailable.

elif sleep --interruptible 0 ; then
set timeout=0
fi
fi

改成:

terminal_output gfxterm
if [ " r e c o r d f a i l " = 1 ] ; t h e n s e t t i m e o u t = 5 e l s e i f [ x {recordfail}" = 1 ] ; then set timeout=5 else if [ x recordfail"=1];thensettimeout=5elseif[xfeature_timeout_style = xy ] ; then
set timeout_style=menu
set timeout=5

Fallback hidden-timeout code in case the timeout_style feature is

unavailable.

elif sleep --interruptible 0 ; then
set timeout=5
fi
fi

重启动后会有选择项.可进入Advanced options for Ubuntu. 在Recovery Menu中选择root.

如果不能正常进入ubuntu系统

如果启动时无法进行 grub选项,并且无法打开 grub.cfg文件,可以考虑使用临时ubuntu系统进入.

  1. 准备U盘和Ubuntu系统镜像软件,制作启动盘.
  2. 更改电脑启动顺序,选择从U盘启动.
  3. 选择"Try Ubuntu",进入U盘下的Ubuntu系统.
  4. 进入/boot/grub/文件夹,修改grub.cfg的可写权限:chmod +w grub.cfg
  5. 按照上面所属修改,保存,重启即可进入grub.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值