灯火互联
管理员
管理员
  • 注册日期2011-07-27
  • 发帖数41778
  • QQ
  • 火币41290枚
  • 粉丝1086
  • 关注100
  • 终身成就奖
  • 最爱沙发
  • 忠实会员
  • 灌水天才奖
  • 贴图大师奖
  • 原创先锋奖
  • 特殊贡献奖
  • 宣传大使奖
  • 优秀斑竹奖
  • 社区明星
阅读:1553回复:0

linux永久修改grub2启动顺序

楼主#
更多 发布于:2013-10-06 15:28
永久修改grub2启动顺序

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

[html]

$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:

[html]

$sudo cp 08_os-prober 17_os-prober

[html]

$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文件把默认启动项改成你要得那个:

[html]

$sudo vim /etc/default/grub

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

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

喜欢0 评分0
游客

返回顶部