win7+Ubuntu双系统修改启动项顺序

前端之家收集整理的这篇文章主要介绍了win7+Ubuntu双系统修改启动项顺序前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1.在应用程序-附件-打开终端(也可按快捷键Ctrl+Alt+T)
运行 代码:
sudo chmod +w /boot/grub/grub.cfg //(增加写入的权利)

2.然后再运行 代码:
sudo gedit /boot/grub/grub.cfg //(用记事本的方式打开开机启动项的配置信息)

3.阅读代码,将win7 启动项代码部分移动到最选择列表的开始。

修改前后对比 :

修改前:

  1. #
  2. # DO NOT EDIT THIS FILE
  3. #
  4. # It is automatically generated by grub-mkconfig using templates
  5. # from /etc/grub.d and settings from /etc/default/grub
  6. #
  7.  
  8. ### BEGIN /etc/grub.d/00_header ###
  9. if [ -s $prefix/grubenv ]; then
  10. set have_grubenv=true
  11. load_env
  12. fi
  13. if [ "${next_entry}" ] ; then
  14. set default="${next_entry}"
  15. set next_entry=
  16. save_env next_entry
  17. set boot_once=true
  18. else
  19. set default="0"
  20. fi
  21.  
  22. if [ x"${feature_menuentry_id}" = xy ]; then
  23. menuentry_id_option="--id"
  24. else
  25. menuentry_id_option=""
  26. fi
  27.  
  28. export menuentry_id_option
  29.  
  30. if [ "${prev_saved_entry}" ]; then
  31. set saved_entry="${prev_saved_entry}"
  32. save_env saved_entry
  33. set prev_saved_entry=
  34. save_env prev_saved_entry
  35. set boot_once=true
  36. fi
  37.  
  38. function savedefault {
  39. if [ -z "${boot_once}" ]; then
  40. saved_entry="${chosen}"
  41. save_env saved_entry
  42. fi
  43. }
  44. function recordfail {
  45. set recordfail=1
  46. if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
  47. }
  48. function load_video {
  49. if [ x$feature_all_video_module = xy ]; then
  50. insmod all_video
  51. else
  52. insmod efi_gop
  53. insmod efi_uga
  54. insmod ieee1275_fb
  55. insmod vbe
  56. insmod vga
  57. insmod video_bochs
  58. insmod video_cirrus
  59. fi
  60. }
  61.  
  62. if [ x$feature_default_font_path = xy ] ; then
  63. font=unicode
  64. else
  65. insmod part_msdos
  66. insmod ext2
  67. set root='hd0,msdos10'
  68. if [ x$feature_platform_search_hint = xy ]; then
  69. search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos10 --hint-efi=hd0,msdos10 --hint-bareMetal=ahci0,msdos10 9f9c2e5b-f410-48e8-87bb-bbea4f627060
  70. else
  71. search --no-floppy --fs-uuid --set=root 9f9c2e5b-f410-48e8-87bb-bbea4f627060
  72. fi
  73. font="/usr/share/grub/unicode.pf2"
  74. fi
  75.  
  76. if loadfont $font ; then
  77. set gfxmode=auto
  78. load_video
  79. insmod gfxterm
  80. set locale_dir=$prefix/locale
  81. set lang=en_US
  82. insmod gettext
  83. fi
  84. terminal_output gfxterm
  85. if [ "${recordfail}" = 1 ] ; then
  86. set timeout=30
  87. else
  88. if [ x$feature_timeout_style = xy ] ; then
  89. set timeout_style=menu
  90. set timeout=10
  91. # Fallback normal timeout code in case the timeout_style feature is
  92. # unavailable.
  93. else
  94. set timeout=10
  95. fi
  96. fi
  97. ### END /etc/grub.d/00_header ###
  98.  
  99. ### BEGIN /etc/grub.d/05_debian_theme ###
  100. set menu_color_normal=white/black
  101. set menu_color_highlight=black/light-gray
  102. if background_color 44,0,30,0; then
  103. clear
  104. fi
  105. ### END /etc/grub.d/05_debian_theme ###
  106.  
  107. ### BEGIN /etc/grub.d/10_linux ###
  108. function gfxmode {
  109. set gfxpayload="${1}"
  110. if [ "${1}" = "keep" ]; then
  111. set vt_handoff=vt.handoff=7
  112. else
  113. set vt_handoff=
  114. fi
  115. }
  116. if [ "${recordfail}" != 1 ]; then
  117. if [ -e ${prefix}/gfxblacklist.txt ]; then
  118. if hwmatch ${prefix}/gfxblacklist.txt 3; then
  119. if [ ${match} = 0 ]; then
  120. set linux_gfx_mode=keep
  121. else
  122. set linux_gfx_mode=text
  123. fi
  124. else
  125. set linux_gfx_mode=text
  126. fi
  127. else
  128. set linux_gfx_mode=keep
  129. fi
  130. else
  131. set linux_gfx_mode=text
  132. fi
  133. export linux_gfx_mode
  134. menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-9f9c2e5b-f410-48e8-87bb-bbea4f627060' {
  135. recordfail
  136. load_video
  137. gfxmode $linux_gfx_mode
  138. insmod gzio
  139. if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  140. insmod part_msdos
  141. insmod ext2
  142. set root='hd0,msdos9'
  143. if [ x$feature_platform_search_hint = xy ]; then
  144. search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos9 --hint-efi=hd0,msdos9 --hint-bareMetal=ahci0,msdos9 8da40874-25a9-48e7-95ff-7fcd576c67cc
  145. else
  146. search --no-floppy --fs-uuid --set=root 8da40874-25a9-48e7-95ff-7fcd576c67cc
  147. fi
  148. linux /vmlinuz-4.4.0-21-generic root=UUID=9f9c2e5b-f410-48e8-87bb-bbea4f627060 ro quiet splash $vt_handoff
  149. initrd /initrd.img-4.4.0-21-generic
  150. }
  151. submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-9f9c2e5b-f410-48e8-87bb-bbea4f627060' {
  152. menuentry 'Ubuntu,with Linux 4.4.0-21-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-21-generic-advanced-9f9c2e5b-f410-48e8-87bb-bbea4f627060' {
  153. recordfail
  154. load_video
  155. gfxmode $linux_gfx_mode
  156. insmod gzio
  157. if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  158. insmod part_msdos
  159. insmod ext2
  160. set root='hd0,msdos9'
  161. if [ x$feature_platform_search_hint = xy ]; then
  162. search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos9 8da40874-25a9-48e7-95ff-7fcd576c67cc
  163. else
  164. search --no-floppy --fs-uuid --set=root 8da40874-25a9-48e7-95ff-7fcd576c67cc
  165. fi
  166. echo 'Loading Linux 4.4.0-21-generic ...'
  167. linux /vmlinuz-4.4.0-21-generic root=UUID=9f9c2e5b-f410-48e8-87bb-bbea4f627060 ro quiet splash $vt_handoff
  168. echo 'Loading initial ramdisk ...'
  169. initrd /initrd.img-4.4.0-21-generic
  170. }
  171. menuentry 'Ubuntu,with Linux 4.4.0-21-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-21-generic-init-upstart-9f9c2e5b-f410-48e8-87bb-bbea4f627060' {
  172. recordfail
  173. load_video
  174. gfxmode $linux_gfx_mode
  175. insmod gzio
  176. if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  177. insmod part_msdos
  178. insmod ext2
  179. set root='hd0,msdos9 8da40874-25a9-48e7-95ff-7fcd576c67cc
  180. else
  181. search --no-floppy --fs-uuid --set=root 8da40874-25a9-48e7-95ff-7fcd576c67cc
  182. fi
  183. echo 'Loading Linux 4.4.0-21-generic ...'
  184. linux /vmlinuz-4.4.0-21-generic root=UUID=9f9c2e5b-f410-48e8-87bb-bbea4f627060 ro quiet splash $vt_handoff init=/sbin/upstart
  185. echo 'Loading initial ramdisk ...'
  186. initrd /initrd.img-4.4.0-21-generic
  187. }
  188. menuentry 'Ubuntu,with Linux 4.4.0-21-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-21-generic-recovery-9f9c2e5b-f410-48e8-87bb-bbea4f627060' {
  189. recordfail
  190. load_video
  191. insmod gzio
  192. if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  193. insmod part_msdos
  194. insmod ext2
  195. set root='hd0,msdos9 8da40874-25a9-48e7-95ff-7fcd576c67cc
  196. else
  197. search --no-floppy --fs-uuid --set=root 8da40874-25a9-48e7-95ff-7fcd576c67cc
  198. fi
  199. echo 'Loading Linux 4.4.0-21-generic ...'
  200. linux /vmlinuz-4.4.0-21-generic root=UUID=9f9c2e5b-f410-48e8-87bb-bbea4f627060 ro recovery nomodeset
  201. echo 'Loading initial ramdisk ...'
  202. initrd /initrd.img-4.4.0-21-generic
  203. }
  204. }
  205. ### END /etc/grub.d/10_linux ###
  206. ### BEGIN /etc/grub.d/20_linux_xen ###
  207. ### END /etc/grub.d/20_linux_xen ###
  208. ### BEGIN /etc/grub.d/20_memtest86+ ###
  209. menuentry 'Memory test (memtest86+)' {
  210. insmod part_msdos
  211. insmod ext2
  212. set root='hd0,msdos9 8da40874-25a9-48e7-95ff-7fcd576c67cc
  213. else
  214. search --no-floppy --fs-uuid --set=root 8da40874-25a9-48e7-95ff-7fcd576c67cc
  215. fi
  216. knetbsd /memtest86+.elf
  217. }
  218. menuentry 'Memory test (memtest86+,serial console 115200)' {
  219. insmod part_msdos
  220. insmod ext2
  221. set root='hd0,msdos9 8da40874-25a9-48e7-95ff-7fcd576c67cc
  222. else
  223. search --no-floppy --fs-uuid --set=root 8da40874-25a9-48e7-95ff-7fcd576c67cc
  224. fi
  225. linux16 /memtest86+.bin console=ttyS0,115200n8
  226. }
  227. ### END /etc/grub.d/20_memtest86+ ###
  228. ### BEGIN /etc/grub.d/30_os-prober ###
  229. menuentry 'Windows 7 (loader) (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-84AE2FB5AE2F9EA4' {
  230. insmod part_msdos
  231. insmod ntfs
  232. set root='hd0,msdos1'
  233. if [ x$feature_platform_search_hint = xy ]; then
  234. search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-bareMetal=ahci0,msdos1 84AE2FB5AE2F9EA4
  235. else
  236. search --no-floppy --fs-uuid --set=root 84AE2FB5AE2F9EA4
  237. fi
  238. parttool ${root} hidden-
  239. chainloader +1
  240. }
  241. set timeout_style=menu
  242. if [ "${timeout}" = 0 ]; then
  243. set timeout=10
  244. fi
  245. ### END /etc/grub.d/30_os-prober ###
  246. ### BEGIN /etc/grub.d/30_uefi-firmware ###
  247. ### END /etc/grub.d/30_uefi-firmware ###
  248. ### BEGIN /etc/grub.d/40_custom ###
  249. # This file provides an easy way to add custom menu entries. Simply type the
  250. # menu entries you want to add after this comment. Be careful not to change
  251. # the 'exec tail' line above.
  252. ### END /etc/grub.d/40_custom ###
  253. ### BEGIN /etc/grub.d/41_custom ###
  254. if [ -f ${config_directory}/custom.cfg ]; then
  255. source ${config_directory}/custom.cfg
  256. elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
  257. source $prefix/custom.cfg;
  258. fi
  259. ### END /etc/grub.d/41_custom ###

=====================================================================================
修改

  1. #
  2. # DO NOT EDIT THIS FILE
  3. #
  4. # It is automatically generated by grub-mkconfig using templates
  5. # from /etc/grub.d and settings from /etc/default/grub
  6. #
  7.  
  8. ### BEGIN /etc/grub.d/00_header ###
  9. if [ -s $prefix/grubenv ]; then
  10. set have_grubenv=true
  11. load_env
  12. fi
  13. if [ "${next_entry}" ] ; then
  14. set default="${next_entry}"
  15. set next_entry=
  16. save_env next_entry
  17. set boot_once=true
  18. else
  19. set default="0"
  20. fi
  21.  
  22. if [ x"${feature_menuentry_id}" = xy ]; then
  23. menuentry_id_option="--id"
  24. else
  25. menuentry_id_option=""
  26. fi
  27.  
  28. export menuentry_id_option
  29.  
  30. if [ "${prev_saved_entry}" ]; then
  31. set saved_entry="${prev_saved_entry}"
  32. save_env saved_entry
  33. set prev_saved_entry=
  34. save_env prev_saved_entry
  35. set boot_once=true
  36. fi
  37.  
  38. function savedefault {
  39. if [ -z "${boot_once}" ]; then
  40. saved_entry="${chosen}"
  41. save_env saved_entry
  42. fi
  43. }
  44. function recordfail {
  45. set recordfail=1
  46. if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
  47. }
  48. function load_video {
  49. if [ x$feature_all_video_module = xy ]; then
  50. insmod all_video
  51. else
  52. insmod efi_gop
  53. insmod efi_uga
  54. insmod ieee1275_fb
  55. insmod vbe
  56. insmod vga
  57. insmod video_bochs
  58. insmod video_cirrus
  59. fi
  60. }
  61.  
  62. if [ x$feature_default_font_path = xy ] ; then
  63. font=unicode
  64. else
  65. insmod part_msdos
  66. insmod ext2
  67. set root='hd0,0; then
  68. clear
  69. fi
  70. ### END /etc/grub.d/05_debian_theme ###
  71. ### BEGIN /etc/grub.d/30_os-prober ###
  72. menuentry 'Windows 7 (loader) (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-84AE2FB5AE2F9EA4' {
  73. insmod part_msdos
  74. insmod ntfs
  75. set root='hd0,msdos1 84AE2FB5AE2F9EA4
  76. else
  77. search --no-floppy --fs-uuid --set=root 84AE2FB5AE2F9EA4
  78. fi
  79. parttool ${root} hidden-
  80. chainloader +1
  81. }
  82. set timeout_style=menu
  83. if [ "${timeout}" = 0 ]; then
  84. set timeout=10
  85. fi
  86. ### END /etc/grub.d/30_os-prober ###
  87. ### BEGIN /etc/grub.d/10_linux ###
  88. function gfxmode {
  89. set gfxpayload="${1}"
  90. if [ "${1}" = "keep" ]; then
  91. set vt_handoff=vt.handoff=7
  92. else
  93. set vt_handoff=
  94. fi
  95. }
  96. if [ "${recordfail}" != 1 ]; then
  97. if [ -e ${prefix}/gfxblacklist.txt ]; then
  98. if hwmatch ${prefix}/gfxblacklist.txt 3; then
  99. if [ ${match} = 0 ]; then
  100. set linux_gfx_mode=keep
  101. else
  102. set linux_gfx_mode=text
  103. fi
  104. else
  105. set linux_gfx_mode=text
  106. fi
  107. else
  108. set linux_gfx_mode=keep
  109. fi
  110. else
  111. set linux_gfx_mode=text
  112. fi
  113. export linux_gfx_mode
  114. menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-9f9c2e5b-f410-48e8-87bb-bbea4f627060' {
  115. recordfail
  116. load_video
  117. gfxmode $linux_gfx_mode
  118. insmod gzio
  119. if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  120. insmod part_msdos
  121. insmod ext2
  122. set root='hd0,msdos9 8da40874-25a9-48e7-95ff-7fcd576c67cc
  123. else
  124. search --no-floppy --fs-uuid --set=root 8da40874-25a9-48e7-95ff-7fcd576c67cc
  125. fi
  126. echo 'Loading Linux 4.4.0-21-generic ...'
  127. linux /vmlinuz-4.4.0-21-generic root=UUID=9f9c2e5b-f410-48e8-87bb-bbea4f627060 ro recovery nomodeset
  128. echo 'Loading initial ramdisk ...'
  129. initrd /initrd.img-4.4.0-21-generic
  130. }
  131. }
  132. ### END /etc/grub.d/10_linux ###
  133. ### BEGIN /etc/grub.d/20_linux_xen ###
  134. ### END /etc/grub.d/20_linux_xen ###
  135. ### BEGIN /etc/grub.d/20_memtest86+ ###
  136. menuentry 'Memory test (memtest86+)' {
  137. insmod part_msdos
  138. insmod ext2
  139. set root='hd0,115200n8
  140. }
  141. ### END /etc/grub.d/20_memtest86+ ###
  142. ### BEGIN /etc/grub.d/30_uefi-firmware ###
  143. ### END /etc/grub.d/30_uefi-firmware ###
  144. ### BEGIN /etc/grub.d/40_custom ###
  145. # This file provides an easy way to add custom menu entries. Simply type the
  146. # menu entries you want to add after this comment. Be careful not to change
  147. # the 'exec tail' line above.
  148. ### END /etc/grub.d/40_custom ###
  149. ### BEGIN /etc/grub.d/41_custom ###
  150. if [ -f ${config_directory}/custom.cfg ]; then
  151. source ${config_directory}/custom.cfg
  152. elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
  153. source $prefix/custom.cfg;
  154. fi
  155. ### END /etc/grub.d/41_custom ###

猜你在找的Ubuntu相关文章