One of the methods to modify the default Linux Startup System

Source: Internet
Author: User

There are two main statements about how to modify grub to change the Linux default boot system online:/boot/grub. conf or/boot/grub/menu. the lst also says it is the corresponding file under the/etc directory. Here is my attempt.

Under the Ubuntu-9.10, the specific file is like this:
/Boot/grub. cfg
As for the changed set default = "x", let's take my machine as an example:

 
 
  1. [eg].> ls -l grub.cfg-r--r--r--    grub.cfg  
  2. > sudo chmod 244 grub.cfg> ls -l grub.cfg--w-r--r--    grub.cfg  
  3. > sudo vim grub.cfg  

After modification, do not forget:> sudo chmod 444 grub. cfg // you must remember to change it back.
I'm dizzy. After a while, there are so many things, so I will highlight the key with color. Skip other content automatically. As shown in the blue section, grub has three parts. As shown in the red section, menuentry items are arranged from 0 in sequence, change x in set default = "x" to the entry number. For example, if my computer wants to use windows by default, although this is useless), the other x is 8. the default time mark is displayed on the windows portal when the system is started.
For windows systems, not only should they be set as the default boot system for Linux, but they should be placed at the top of all system entries. Just guess from this file: is it okay to cut the windows menuentry of this file to the beginning? So that the entry number is 0... this speculation is not clear yet.

  1. ------------------------------------ Grub. cfg, start ---------------------------------#
  2. # DO NOT EDIT THIS FILE
  3. #
  4. # It is automatically generated by/usr/sbin/grub-mkconfig using templates
  5. # From/etc/grub. d and settings from/etc/default/grub
  6. #
  7. ### BEGIN/etc/grub. d/00_header ###
  8. If [-s/boot/grub/grubenv]; then
  9. Have_grubenv=True 
  10. Load_env
  11. Fi
  12. SetDefault="0" 
  13. If [$ {prev_saved_entry}]; then
  14. Saved_entry=$ {Prev_saved_entry}
  15. Save_env saved_entry
  16. Prev_saved_entry=
  17. Save_envPrev_saved_entry
  18. Fi
  19. Insmod ext2
  20. SetRoot= (Hd0, 8)
  21. Search -- no-floppy -- fs-uuid -- set ab1eac76-a5d7-4656-8918-ffb406010912
  22. If loadfont/usr/share/grub/unicode. pf2; then
  23. SetGfxmode=640x480 
  24. Insmod gfxterm
  25. Insmod vbe if terminal_output gfxterm; then true; else # For backward compatibility with versions of terminal. mod that don't # understand terminal_output terminal gfxterm policiif [$ {recordfail} = 1]; then setTimeout=-1 else setTimeout=10fi### END/etc/grub. d/00_header ###
  26. ### BEGIN/etc/grub. d/05_debian_theme ### setMenu_color_normal=White/BlacksetMenu_color_highlight=Black/White ### END/etc/grub. d/05_debian_theme ###
  27. ### BEGIN/etc/grub. d/10_linux ### menuentry "Ubuntu, Linux 2.6.31-18-generic" {// 0Recordfail=1If [-n $ {have_grubenv}]; then save_env recordfail; fi setQuiet=1Insmod ext2 setRoot= (Hd0, 8) search -- no-floppy -- fs-uuid -- set ab1eac76-a5d7-4656-8918-ffb406010912 linux/boot/vmlinuz-2.6.31-18-genericRoot=UUID= Ab1eac76-a5d7-4656-8918-ffb406010912 ro quiet splash initrd/boot/initrd. img-2.6.31-18-generic} menuentry "Ubuntu, Linux 2.6.31-18-generic (recovery mode)" {// 1Recordfail=1If [-n $ {have_grubenv}]; then save_env recordfail; fi insmod ext2 setRoot= (Hd0, 8) search -- no-floppy -- fs-uuid -- set ab1eac76-a5d7-4656-8918-ffb406010912 linux/boot/vmlinuz-2.6.31-18-genericRoot=UUID= Ab1eac76-a5d7-4656-8918-ffb406010912 ro single initrd/boot/initrd. img-2.6.31-18-generic} menuentry "Ubuntu, Linux 2.6.31-17-generic" {// 2Recordfail=1If [-n $ {have_grubenv}]; then save_env recordfail; fi setQuiet=1Insmod ext2 setRoot= (Hd0, 8) search -- no-floppy -- fs-uuid -- set ab1eac76-a5d7-4656-8918-ffb406010912 linux/boot/vmlinuz-2.6.31-17-genericRoot=UUID= Ab1eac76-a5d7-4656-8918-ffb406010912 ro quiet splash initrd/boot/initrd. img-2.6.31-17-generic} menuentry "Ubuntu, Linux 2.6.31-17-generic (recovery mode)" {// 3Recordfail=1If [-n $ {have_grubenv}]; then save_env recordfail; fi insmod ext2 setRoot= (Hd0, 8) search -- no-floppy -- fs-uuid -- set ab1eac76-a5d7-4656-8918-ffb406010912 linux/boot/vmlinuz-2.6.31-17-genericRoot=UUID= Ab1eac76-a5d7-4656-8918-ffb406010912 ro single initrd/boot/initrd. img-2.6.31-17-generic} menuentry "Ubuntu, Linux 2.6.31-14-generic" {// 4Recordfail=1If [-n $ {have_grubenv}]; then save_env recordfail; fi setQuiet=1Insmod ext2 setRoot= (Hd0, 8) search -- no-floppy -- fs-uuid -- set ab1eac76-a5d7-4656-8918-ffb406010912 linux/boot/vmlinuz-2.6.31-14-genericRoot=UUID= Ab1eac76-a5d7-4656-8918-ffb406010912 ro quiet splash initrd/boot/initrd. img-2.6.31-14-generic} menuentry "Ubuntu, Linux 2.6.31-14-generic (recovery mode)" {/5Recordfail=1If [-n $ {have_grubenv}]; then save_env recordfail; fi insmod ext2 setRoot= (Hd0, 8) search -- no-floppy -- fs-uuid -- set ab1eac76-a5d7-4656-8918-ffb406010912 linux/boot/vmlinuz-2.6.31-14-genericRoot=UUID= Ab1eac76-a5d7-4656-8918-ffb406010912 ro single initrd/boot/initrd. img-2.6.31-14-generic} ### END/etc/grub. d/10_linux ###
  28. ### BEGIN/etc/grub. d/20_memtest86 + ### menuentry "Memory test (memtest86 +)" {// 6 linux16/boot/memtest86 +. bin} menuentry "Memory test (memtest86 +, serial console 115200)" {// 7 linux16/boot/memtest86 +. binConsole=TtyS0, 115200n8 }### END/etc/grub. d/20_memtest86 + ##### BEGIN/etc/grub. d/30_os-prober ### menuentry "Microsoft Windows XP Professional (on/dev/sda1)" {// 8 insmod ntfs setRoot= (Hd0, 1) search -- no-floppy -- fs-uuid -- set 6044685444682f4a drivemap-s (hd0) $ {root} chainloader + 1 }### END/etc/grub. d/30_os-prober ###
  29. ### BEGIN/etc/grub. d/40_custom #### This file provides an easy way to add custom menu entries. simply type the # menu entries you want to add after this comment. be careful not to change # the 'exec tail' line above. ### END/etc/grub. d/40_custom ###
  30. ------------------------------- Grub. cfg, end ---------------------------------------------

The above is an attempt to use grub to modify the default Linux Startup system.

  1. Parsing Linux Process status T, Z, and X
  2. Analysis of Linux Process status: R, S, and D
  3. Brief Introduction to Linux Process Operation commands
  4. In-depth discussion on Linux partition Solutions
  5. Six advantages of Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.