您的位置:首页 > 教育 > 培训 > Ubuntu修改双系统默认启动顺序

Ubuntu修改双系统默认启动顺序

2025/4/16 2:08:58 来源:https://blog.csdn.net/hou478410969/article/details/140933668  浏览:    关键词:Ubuntu修改双系统默认启动顺序

1.打开grub的默认启动配置文件

sudo gedit /etc/default/grub# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

2.修改默认启动项

GRUB_DEFAULT=4
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=3
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

GRUB_DEFAULT设置默认启动的系统菜单选项,默认是从0开始的;

3.更新生效配置

$ sudo update-grub
[sudo] mango 的密码: 
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.2.0-36-generic
Found initrd image: /boot/initrd.img-6.2.0-36-generic
Found linux image: /boot/vmlinuz-6.2.0-26-generic
Found initrd image: /boot/initrd.img-6.2.0-26-generic
Found linux image: /boot/vmlinuz-5.17.0-1035-oem
Found initrd image: /boot/initrd.img-5.17.0-1035-oem
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found Windows 10 on /dev/sda1
done

4.grub配置的生成

/etc/default/grub 提供了一些简单的配置选项来控制grub的执行流程;
/etc/grub.d 目录中放置了一些脚本,用于生成/boot/grub/grub.cfg文件;
update-grub 此命令会使用以上两个文件生成最终的配置文件/boot/grub/grub.cfg;

$ ls /etc/grub.d
00_header        10_linux_zfs   30_os-prober      40_custom
05_debian_theme  20_linux_xen   30_uefi-firmware  41_custom
10_linux         20_memtest86+  35_fwupd          README

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com