永久修改grub2启动顺序


永久修改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

相关内容

    暂无相关文章