Linux 一般使用 grub2 来引导操作系统, 它不但可以管理各个内核, 而且可以同时管理 Windows 和 Linux. 最近换了个新的机器,虽然是个很不爽的回忆,但总而言之,家里希望能使用我的旧机器.那么,默认启动linux的grub似乎不太合适了(windows都还没搞明白,让我搞linux?你是故意的吧!老妈咆哮.).那么,修改下启动次序,表示下诚意吧. 很多方法[1]可以修改,不过我觉得修改grub.d可能是最合适的.

具体方法如下: 到配置文件夹/etc/grub.d下,ls可以看到一排可执行文件和一个README如下

[root@localhost grub.d]# ls -al
total 76
drwx------.   2 root root  4096 Sep 27 16:56 .
drwxr-xr-x. 192 root root 12288 Sep 27 16:54 ..
-rwxr-xr-x.   1 root root  7528 Dec 21  2012 00_header
-rwxr-xr-x.   1 root root  9623 Dec 21  2012 10_linux
-rwxr-xr-x.   1 root root 10074 Dec 21  2012 20_linux_xen
-rwxr-xr-x.   1 root root  2564 Dec 21  2012 20_ppc_terminfo
-rwxr-xr-x.   1 root root  9339 Dec 21  2012 30_os-prober
-rwxr-xr-x.   1 root root   214 Dec 21  2012 40_custom
-rwxr-xr-x.   1 root root   216 Dec 21  2012 41_custom
-rw-r--r--.   1 root root   483 Dec 21  2012 README

其中,10_linux就是我们fedora的内核的寻找bash,而30_os-prober则是其他操作系统--包括windows的寻找bash grub的生成是依次执行/etc/grub.d/下的各个bash,整出个grub.cfg文件来. 而修改次序的方法也就是针对这个而操作. 修改30_os-prober到10_linux之前 -- 比如 08_os-prober即可 然后重新生成grub.cfg文件即可. 首先使用命令

grub2-mkconfig

查看次序是否是我们希望的,然后替换掉原来的grub.cfg文件即可. 我的fedora中,grub目录是/boot/grub2 所以命令

grub2-mkconfig -o /boot/grub2/grub.cfg

即可.

Categories: Code

Yu

Ideals are like the stars: we never reach them, but like the mariners of the sea, we chart our course by them.

4 Comments

海蓝 · October 14, 2013 at 11:18

Google Chrome 29.0.1547.57 Google Chrome 29.0.1547.57 Windows 7 x64 Edition Windows 7 x64 Edition

咋还提示把英文转换为中文呀

    yu · October 15, 2013 at 21:46

    Google Chrome 30.0.1599.66 Google Chrome 30.0.1599.66 GNU/Linux x64 GNU/Linux x64

    额? chrome浏览器的 google 翻译么?

海涛 · October 11, 2013 at 10:42

Google Chrome 28.0.1500.72 Google Chrome 28.0.1500.72 Windows XP Windows XP

厉害,学习了。感谢。

Leniy · September 29, 2013 at 08:10

UC Browser 2.x UC Browser 2.x Windows 7 Windows 7

竟然还可以这样

Leave a Reply to Leniy Cancel reply

Your email address will not be published. Required fields are marked *