永久修改grub2启动顺序

grub2是通过/etc/grub.d/目录下的文件顺序来决定启动项顺序的:

$cd /etc/grub.d
$ls -l

-rwxr-xr-x 1 root root 6743  9月 13  2012 00_header
-rwxr-xr-x 1 root root 5522  4月 18  2012 05_debian_theme
-rw-r--r-- 1 root root 7603  4月 18  2012 08_os-prober
-rwxr-xr-x 1 root root 7780  1月 23  2013 10_linux
-rwxr-xr-x 1 root root 7603  9月 20 13:48 17_os-prober
-rwxr-xr-x 1 root root 6335  4月 18  2012 20_linux_xen
-rwxr-xr-x 1 root root 1588 11月 27  2011 20_memtest86+
-rwxr-xr-x 1 root root 1388  1月 23  2013 30_uefi-firmware
-rwxr-xr-x 1 root root  214  4月 18  2012 40_custom
-rwxr-xr-x 1 root root   95  4月 18  2012 41_custom
-rw-r--r-- 1 root root  483  4月 18  2012 README

08_os-prober是我之前为了默认启动项为win8而改的,因为现在又改成ubuntu为默认启动了,所以将08_os-prober的权限修改为不可执行的。该目录下有个readme

翻译如下:

该目录下的可以执行文件的顺序是按照shell扩展来排列的(就是按首字符排列的意思,用来配置grub的顺序)。

00_开头的文件是预留给00_header的


10_开头的用于系统本身


20_开头的用于第三方程序

可以新建和改变文件的顺序来配置gurb2的启动顺序。

知道以上这些就好办了。我们只要把08_os-prober的顺序设置到10_linux之后就可以让windows的选项在linux之后了。

运行以下命令把08_os-prober复制一份并且重命名为17_os-prober:


$sudo cp 08_os-prober 17_os-prober
$sudo chmod 644 08_os-prober   //去掉08_os-prober的可执行权限
$ls -l


-rwxr-xr-x 1 root root 6743  9月 13  2012 00_header
-rwxr-xr-x 1 root root 5522  4月 18  2012 05_debian_theme
-rw-r--r-- 1 root root 7603  4月 18  2012 08_os-prober
-rwxr-xr-x 1 root root 7780  1月 23  2013 10_linux
-rwxr-xr-x 1 root root 7603  9月 20 13:48 17_os-prober
-rwxr-xr-x 1 root root 6335  4月 18  2012 20_linux_xen
-rwxr-xr-x 1 root root 1588 11月 27  2011 20_memtest86+
-rwxr-xr-x 1 root root 1388  1月 23  2013 30_uefi-firmware
-rwxr-xr-x 1 root root  214  4月 18  2012 40_custom
-rwxr-xr-x 1 root root   95  4月 18  2012 41_custom
-rw-r--r-- 1 root root  483  4月 18  2012 README


然后打开/etc/default/grub文件把默认启动项改成你要得那个:

$sudo vim /etc/default/grub

找到GRUB_DEFAULT=,改成9.(因为linux是从0开始计数的)


然后更新grub即可:sudo update-grub

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值