Thread: Grub 2 Title Tweaks Thread
grub 2 (title) tweaks
or the
update: day has arrived when guide becomes largely unneccesary
daniel richter has developed great gui app can , following command-line actions accomplish. highly recommend visit grub customizer thread , try application.
i don't want "microsoft windows vista home edition" thread
purpose
thread offers tweaks grub 2 10_linux , 30_os-prober files in /etc/grub.d. purpose change way titles displayed on grub 2 menu.
exception of "but first" section, tweaks in thread outside normal options available in grub 2's /etc/default/grub. grub 2 options incorporated developers these scripts annotated or removed. before deep editing these scripts, remember can create custom menu in can use own titles, include or omit boot options, etc. see meierfra's page creating custom menu.
if looking introduction on how grub 2 works, please visit grub 2 (ubuntu community doc), grub 2 basics or grub 2 introduction elsewhere on ubuntu forums. thread not discuss custom configuration files such /etc/grub.d/40_custom although these tweaks incorporated therein.
feel free post tweaks please limit thread posts concerning grub text see in menu. suggest improvements ones posted - i'll edit them keep them udpated. see end of post suggestions.
capabilities of grub 2 expanded or become better understood many of these tweaks become unnecessary. in meantime anal among can never leave things alone have place of refuge.
tweaks guide covers
- remove memtest86+
- remove recovery mode
- changing/limiting ubuntu & linux titles
- limiting number of main linux kernel entries
- changing windows/other os titles
- hiding recovery/single user partition
- hiding memtest
- hiding windows recovery partition
- changing "windows recovery environment (loader)"
- hiding other partitions
- hiding 32/64 bit osx entry when both appear
- changing menu entry order
- hiding menu on multi-os computers
- hiding partitions using parttool
- removing grub 1.99 submenu
- troubleshooting
- custom menus
- custom tweaks provided others in thread
- get splash screen display before menu (see post #233)
background
grub 2 displays, unlike grub, not controlled single file rather settings in /etc/default/grub , series of script files located in /etc/grub.d/ . these scripts determine, in part, how menu options transferred /boot/grub/grub.cfg , menu see on boot.
see grub 2 basics general overview of grub 2 , links other grub 2 resources.
before start
- make copies of system files altering.
note: if leave .bak files executable , in /etc/grub.d folder run update-grub.
code:sudo cp /etc/grub.d/10_linux /etc/grub.d/10_linux.bak sudo cp /etc/grub.d/30_os-prober /etc/grub.d/30_os-prober.bak sudo chmod -x /etc/grub.d/*.bak- make sure working in correct file, , in applicable section of file.
- run "sudo update-grub" incorporate changes grub 2's menu.
- when defining variables, ` symbol not straight quote symbol 'grave'. found near top left of keyboard.
- wubi users: replace instances of 10_linux 10_lupin in /etc/grub.d/
built-in settings , non-tweak ways limit menu entries
- removing older kernels
if seeing many versions of linux kernel (including associated recovery option), can reduce number physically removing them machine. while it's best keep @ least 1 older kernel backup, others can removed. perhaps easiest method remove kernels install ubuntu-tweak http://ubuntu-tweak.com/. details on how use ubuntu-tweak remove kernels can found in this howto. alternatively, can use synaptic , search "linux-image" , select lower-numbered kernels no longer use. example "linux-image-2.6.31-9-generic". remove "linux-header...." same kernel number. once removed, run "sudo udpate-grub" , menu less cluttered.
- turn off "memtest86+"
there no setting turn off "memtest86+" option in /etc/default/grub can eliminate these entries turning off script searches them. following command removes "executable" bit /etc/grud.d/20_memtest86+ file. restore setting, change "-" "+":
code:sudo chmod -x /etc/grub.d/20_memtest86+
- this effects system partition. if have multiple partitions linux installations there tweak later turn off memtest86+ on them well.
- in tweaks section there explanation of how boot "recovery mode" without menu option.
- turn off recovery mode
if don't want see recovery mode options any item, change setting in /etc/default/grub. while may idea have "recovery" mode option displayed, if don't want it, here how rid of it.
can opening file 'root' text editor , removing # symbol beginning of line, or running following command.
code:sudo sed s/'#grub_disable_linux_recovery="true"'/'grub_disable_linux_recovery="true"'/g -i /etc/default/grub
grub 2 files
basic configuration settings made in /etc/default/grub. thread not deal settings.
2 primary files altered tweaks in thread are:
- /etc/grub.d/10_linux
- this file contains instructions , scripts deal linux kernels on default system partition.
- /etc/grub.d/30_os-prober
- this file contains instructions , scripts deal kernels , other operating systems found on other partitions.
- the file contains 4 sections. changes must made in correct section, changes in 1 section not effect scripts in other sections.
- the 4 sections windows, other linux installations, osx, , hurd.
1. changing/limiting ubuntu & linux titles (on default partition) - /etc/grub.d/10_linux *
- a. changing linux titles on main partition
code:gksu gedit /etc/grub.d/10_linux
- new: starting grub 1.98, user can change codename (ubuntu, kubuntu, etc) /etc/default/grub file. entry add "grub_distributor=", replace "ubuntu" in menuentry whatever entered in setting. example: grub_distributor=mylinux produce entry of "mylinux, linux 2.6.35-23-generic"
- defined variable examples: ${os} ubuntu, kubuntu, etc.; ${version} 2.6.32-25, 2.6.32-25-generic, etc.
added variable example: ${codename} lucid- add new variables codename , version_no_generic. list of variables in 10_linux begins @ approximately line 118.
- if recovery modes displayed, make change in section well. it's next section of 10_linux.
original: ubuntu, linux 2.6.32-25code:while [ "x$list" != "x" ] ; linux=`version_find_latest $list` echo "found linux image: $linux" >&2 basename=`basename $linux` dirname=`dirname $linux` rel_dirname=`make_system_path_relative_to_its_root $dirname` version=`echo $basename | sed -e "s,^[^0-9]*-,,g"` alt_version=`echo $version | sed -e "s,\.old$,,g"` linux_root_device_thisversion="${linux_root_device}" # user-added variable codename="`lsb_release -cs`" version_no_generic="`echo ${version} | cut -d "-" -f 1-2`"
should located @ approximately line 144.
new: ubuntu 2.6.32-25
change original line above following removing ", linux":
new: lucid 2.6.32-25code:# old code # new code # if ${recovery} ; # title="$(gettext_quoted "%s, linux %s (recovery mode)")" # else # title="$(gettext_quoted "%s, linux %s")" # fi if ${recovery} ; title="$(gettext_quoted "%s %s (recovery mode)")" else title="$(gettext_quoted "%s %s")" fi
ensure variable ${codename} has been added file's variable list.
codename returned in script current codename of present linux os (i.e. karmic, lucid, etc.).
change original line @ approximately 148 following (also change same line in recovery section several lines down):
code:#linux_entry "${os} ${version}" \ linux_entry "${codename} ${version}" \
- run "sudo update-grub" update grub 2 menu.
- note: if want capitalize codename (hardy, lucid, maverick) see post #38.
* wubi users should make changes /etc/grub.d/10_lupin rather /etc/grub.d/10_linux
2. limiting main kernel entries
new grub 1.99: older kernels placed in submenu , not visible on main grub2 menu. older kernels can accessed selecting submenu entry. guide not cover hiding kernels displayed in submenu.
grub 1.98 & earlier: when new kernel introduced, automatically entered grub 2 menu. on time, number of kernels listed may become quite long. number of current system kernels displayed can changed via script editing (the kernels remain on system not displayed) or physically removing kernels system via apt (command line, synaptic, etc).
tweak, able set number of main os linux kernels (plus associated recovery modes if enabled) want see on menu. variable called linux_kernels_displayed. in example, 2 kernels listed on menu. edits made /etc/grub.d/10_linux , affect primary partition's linux kernels.
note tweak not remove kernels system or free disk space. see section on removing older kernels in "before start" section if want physically remove kernels system.
find section of /etc/grub.d/10_linux in grub 1.98 (approximately line 116). note not entire file!. added sections in bold dark red:
save file , update-grub.prepare_boot_cache=
# added limit number of linux kernels displayed.
counter=0
linux_kernels_displayed=2
#
while [ "x$list" != "x" ] ; do
linux=`version_find_latest $list`
echo "found linux image: $linux" >&2
.....
..... < omitted lines >
..... < several lines bottom of file >
list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
# added limit number of linux kernels displayed.
counter=`expr $counter + 1`
if [ $counter -eq $linux_kernels_displayed ]; then
list=""
fi
#
done
3. changing windows/other os titles (including linux) - /etc/grub.d/30_os-prober
file divided sections various types of operating systems. first section windows (os), second linux (linux), third osx (macosx), , hurd (hurd).
a. changing windows entriescode:gksu gedit /etc/grub.d/30_os-prober
- changes made via method best done os or kernels user not expect change. if system detects title change entry in #3 may no longer correct.
placing windows @ top of menu:
although can make windows default 'grub_default' setting in /etc/default/grub, if want windows first item on menu there 2 easy ways it.
- rename /etc/grub.d/30_os-prober
if have 1 ubuntu partition , windows, renaming /etc/grub.d/30_os-prober /etc/grub.d/09_os-prober place windows @ top of list- create /etc/grub.d/06_custom menu.
creating custom file in /etc/grub.d folder beginning number of 06 place it's contents before of standard menu entries. create 06_custom file, open /etc/grub.d/40_custom editing root. below existing lines, copy complete windows menu entry /boot/grub/grub.cfg.
entry start "menuentry" line , end "}" on single line itself. make file executable ( sudo chmod +x /etc/grub.d/06_custom ) , update-grub.
original: microsoft windows xp home edition (on /dev/sda1)
1. run command current grub 2 menu entries:
new: whatever (on /dev/sda7)code:sudo cat /boot/grub/grub.cfg | grep "menuentry" | cut -d '"' -f 2
2. section appears around line 150 of file. replace section in red.
3. copy exact title wish change (example: microsoft windows xp home edition ) , place between quotes in first line below. note title does not include portion "(on /dev/sdxx)"
enter desired title between quotes in second line below - in example, "windows xp" replace "enter desired new title here".
5. multiple entries can made in same section:code:# old code # new code # old title # new title # if [ -z "${longname}" ] ; # longname="${label}" # fi if [ "${longname}" = "enter exact title copied" ] ; longname="enter desired new title here" elif [ -z "${longname}" ] ; longname="${label}" fi
code:if [ "${longname}" = "enter exact title copied" ] ; longname="enter desired new title here" elif [ "${longname}" = "enter second title copied" ] ; longname="enter desired second title here" elif [ -z "${longname}" ] ; longname="${label}" fi
b. changing other linux installations
- included in first codeblock below user-defined variables used in section of guide. apply "linux" section of /etc/grub.d/30_os-prober file.
necessary insert ones wish use. simplicity , space-saving, have been included in first codeblock below.- defined variables examples: ${longname} microsoft windows xp home edition, ubuntu 10.04 (9.04); ${device} sda1, sdb6, etc; ${llabel} ubuntu, linux 2.6.32-25
- find linux section of file @ approximately line 170 (before other additions).
- add variables wish use examples below. following added variables examples of possible returned value:
${newtitle} ubuntu 10.04 ;${shortkernel} 2.6.32-25 ; ${nomemtest} memtest86+ ; ${nosingle} single ; shortdevice (sda5) ; ${hidekernel} 2.6.32
original: linux, ubuntu 10.04 2.6.32-25 (on /dev/sda7)code:;; linux) linuxprobed="`linux-boot-prober ${device} 2> /dev/null | tr ' ' '^' | paste -s -d ' '`" linux in ${linuxprobed} ; lroot="`echo ${linux} | cut -d ':' -f 1`" lboot="`echo ${linux} | cut -d ':' -f 2`" llabel="`echo ${linux} | cut -d ':' -f 3 | tr '^' ' '`" lkernel="`echo ${linux} | cut -d ':' -f 4`" linitrd="`echo ${linux} | cut -d ':' -f 5`" lparams="`echo ${linux} | cut -d ':' -f 6- | tr '^' ' '`" # user-added variables newtitle=`echo ${longname} | cut -d " " -f 1-2` shortkernel="`echo ${lkernel} | cut -d "-" -f 2-4`" shortdevice="`echo ${device} | cut -d "/" -f 3`" nomemtest="`echo ${llabel} | cut -d " " -f 1`" nosingle="`echo ${lparams} | sed 's/^.* //'`" hidekernel-all="`echo ${lkernel} | cut -d'-' -f2`" hidekernel-one="`echo ${lkernel} | cut -d'-' -f2-3`"
modify entry in red each section want change (approximately line 193 in original file):
new format: ubuntu 10.04 2.6.32-25 (on /dev/sda7)
new: ubuntu 10.04 2.6.32-25code:# old code # new code # cat << eof #menuentry "${llabel} (on ${device})" { #eof cat << eof menuentry "${newtitle} ${shortkernel} (on ${device})" { eof
code:# old code # new code # new variable # cat << eof #menuentry "${llabel} (on ${device})" { #eof cat << eof menuentry "${newtitle} ${shortkernel}" { eof
c. eliminating or changing "(on /dev/sdx)"
- there specific sections windows (os), linux (linux), , osx (macosx). users must find section(s) wish change or universal search/replace.
- defined variables: ${longname} os title; ${device} partition location (e.g. sda1, sdb6, etc)
- modify entry in red each section want change.
original: windows xp home (on /dev/sda7)
approximately line 144.
new: windows xp home (sda1)code:menuentry "${longname} (on ${device})" {
new: windows xp homecode:menuentry "${longname} (${shortdevice})" {
original: linux, ubuntu 10.04 2.6.32-25 (on /dev/sda7)code:menuentry "${longname}" {
approximately line 193.
new: linux, ubuntu 10.04 2.6.32-25 (sda7)code:menuentry "${llabel} (on ${device})" {
new: linux, ubuntu 10.04 2.6.32-25code:menuentry "${llabel} (${shortdevice})" {
code:menuentry "${llabel}" {
d. hiding specific kernel (all examples use 2.6.26... substitute kernel desire replace)
- there 2 components necessary option:
- the variable, entered either /etc/grub.d/10_os-prober, or linux section of /etc/grub.d/30_os-prober. location of variables, see section 1 main kernel variables or section 2b linux variables on other partitions.
- the conditional statement: if [ ${hidekernel} = "x.x.xx" or "x.x.xx-x" or "x.x.xx-x-generic" ]; then # use appropriate kernel format.
- x.x.xx or x.x.xx-xx example: 2.6.28 or 2.6.28-12
- the dark green items lines inserted script. red items must tailored user. dark blue items variables inserted in appropriate area of script.
- to hide kernel on main partition & listed in 10_linux section of /boot/grub/grub.cfg:
- the variable pre-defined - no additional user entry required: ${version}"
- the conditional statement: if [ ${version} != "x.x.xx" ]; then
- x.x.xx or x.x.xx-xx or x.x.xx-x-generic : 2.6.28 or 2.6.28-12 or 2.6.28-12-generic
- note "!=" translates "run unless entry equal following".
1. determine kernel want hide (example: 2.6.26 ) , change code below in /etc/grub.d/10_linux @ approximately line 144.
code:if [ ${version} != "2.6.32-25-generic" ]; then linux_entry "${os}, linux ${version}" \ "${grub_cmdline_linux} ${grub_cmdline_extra} ${grub_cmdline_linux_default}" \ quiet if [ "x${grub_disable_linux_recovery}" != "xtrue" ]; linux_entry "${os}, linux ${version} (recovery mode)" \ "single ${grub_cmdline_linux}" fi fi
- to hide instances of kernel on partition:
- hidekernel-all="`echo ${lkernel} | cut -d'-' -f2`"
- if [ ${hidekernel-all} = "2.6.26" ]; then
- to hide specific kernel on partition ( in 30_os-prober section of /boot/grub/grub.cfg :
- hidekernel-one="`echo ${lkernel} | cut -d'-' -f2-3`"
- if [ ${hidekernel-one} = "2.6.26-11" ]; then
1. add variable(s) linux variable list (approximately line 175).
2. determine kernel(s) want hide (example: 2.6.26 ) , include in linux section of /etc/grub.d/30_os-prober, @ approximately line 183).code:hidekernel-all="`echo ${lkernel} | cut -d'-' -f2`" hidekernel-one="`echo ${lkernel} | cut -d'-' -f2-3`"
* note: os-prober can disabled in various ways prevent grub 2 searching secondary partitions bootable operating systems. see grub 2 basics more information.code:if [ -z "${llabel}" ] ; llabel="${longname}" fi if [ ${hidekernel-xxx} = "2.6.26" ]; # change xxx 'one' or 'all' continue fi cat << eof menuentry "${llabel} (on ${device}" \ eof
4. hiding recovery/single user entries (from other partitions)
- grub 2 provides ability hide recovery mode (single user) entries default partition without modifying 10_linux or 30_os-prober files (see later in section) .
- refer previous section information on inserting variables. variable associated hiding recovery mode (single-user) ${nosingle}. make sure add variable list.
- the conditional statement below tells grub skip entry if recovery mode[/i] option. while bit inelegant, when inserted in 30_os-prober prevent applicable options appearing in grub 2 menu.
- to remove recovery mode/single user entries for other partitions found 30_os-prober:
- insert code in green after linux variable definitions , before first "menuentry" in linux section (approximately line 180 before additions).
code:linitrd="`echo ${linux} | cut -d ':' -f 5`" lparams="`echo ${linux} | cut -d ':' -f 6- | tr '^' ' '`" # user-added variables newtitle=`echo ${longname} | cut -d " " -f 1-2` shortkernel="`echo ${lkernel} | cut -d "-" -f 2-4`" shortdevice="`echo ${device} | cut -d "/" -f 3`" nosingle="`echo ${lparams} | sed 's/^.* //'`" hidekernel="`echo ${lkernel} | cut -d'-' -f2`" if [ -z "${llabel}" ] ; llabel="${longname}" fi if [ "${nosingle}" = "single" ]; continue fi cat << eof menuentry "${llabel} (on ${device}" \ eof- to inhibit display of recovery options on system partition, uncomment or add line /etc/default/grub:
grub_disable_linux_recovery=true- run "sudo update-grub" incorporate these changes grub menu.
5. hiding memtest+86
- the memtest86+ entry can removed grub2 menu 2 methods.
- change file attribute.
- the memtest86+ entry can removed menu removing executable bit /etc/grub.d/20_memtest86+ file.
- to make memtest86+ non-executable, run following commands:
code:sudo chmod -x /etc/grub.d/20_memtest86+ && sudo update-grub- note: kansasnoob has discovered memtest86+ entries generated partitions containing grub legacy menu.lst file can disabled opening the associated /boot/grub/menu.lst file, finding memtest86+ entry, , changing read:
# memtest86=false- change scripts.
insert code in green.
- in /etc/default/grub, add following lines:
grub_nomemtest=true
export grub_nomemtest- in /etc/grub.d/20_memtest86+, add 2 lines in dark green. (the second line last fi @ bottom of quoted text):
if test -e /boot/memtest86+.bin ; then
if [ ! "x${grub_nomemtest}" = "xtrue" ] ; then
memtestpath=$( make_system_path_relative_to_its_root "/boot/memtest86+.bin" )
echo "found memtest86+ image: $memtestpath" >&2
cat << eof
menuentry "memory test (memtest86+)" {
eof
printf '%s\n' "${prepare_boot_cache}"
cat << eof
$lx $memtestpath
}
menuentry "memory test (memtest86+, serial console 115200)" {
eof
printf '%s\n' "${prepare_boot_cache}"
cat << eof
$lx $memtestpath console=ttys0,115200n8
}
eof
fi
fi- run "sudo update-grub" incorporate these changes grub menu.
6. hiding windows recovery partition (vista)
- grub 2 find , create menuentry windows (vista) recovery partition. @ least in vista, menu name same normal vista operating partition, difference being parttion designation. remove recovery partition entry menu:
- backup existing /etc/grub.d/30_os-prober file, remove executable bit backup isn't run during updates, , open original editing (the section starts around line 134):
code:sudo cp /etc/grub.d/30_os-prober /etc/grub.d/30_os-prober.original && sudo chmod -x /etc/grub.d/30_os-prober.original gksu gedit +83 /etc/grub.d/30_os-prober &- determine exact title , windows recovery partition. these can located in /boot/grub/grub.cfg file. add highlighted entry below. in example, menuentry appeared "windows vista (loader) (on /dev/sda1)". make sure select correct partition title may same normal , recovery titles. area in bright red should exact contents between quotes in menuentry recovery partition:
for os in ${osprobed} ; do
device="`echo ${os} | cut -d ':' -f 1`"
longname="`echo ${os} | cut -d ':' -f 2 | tr '^' ' '`"
label="`echo ${os} | cut -d ':' -f 3 | tr '^' ' '`"
boot="`echo ${os} | cut -d ':' -f 4`"
if [ -z "${longname}" ] ; then
longname="${label}"
fi
# added remove windows recovery
if [ "$longname" = "windows vista (loader)" ] && [ "${device}" = "/dev/sda1" ] ; then
continue
fi
# end added- save file, run:
code:sudo update-grub
7. changing "windows recovery environment (loader)" "windows vista"
or other windows title in 30_os-prober section of grub.cfg
- if grub 2 mistakenly identifies real windows vista partition recovery partition, use section rename menu entry. in example new title windows vista. can change "windows vista" title within quotation marks wish:
- backup existing /etc/grub.d/30_os-prober file, remove executable bit backup isn't run during updates, , open original editing (the section starts around line 134):
code:sudo cp /etc/grub.d/30_os-prober /etc/grub.d/30_os-prober.original && sudo chmod -x /etc/grub.d/30_os-prober.original gksu gedit +83 /etc/grub.d/30_os-prober &- determine exact title , windows recovery partition. these can located in /boot/grub/grub.cfg file. add highlighted entry below. in example, menuentry appeared "windows vista (loader) (on /dev/sda1)". make sure select correct partition title may same normal , recovery titles. area in bright red should exact contents between quotes in menuentry recovery partition:
for os in ${osprobed} ; do
device="`echo ${os} | cut -d ':' -f 1`"
longname="`echo ${os} | cut -d ':' -f 2 | tr '^' ' '`"
label="`echo ${os} | cut -d ':' -f 3 | tr '^' ' '`"
boot="`echo ${os} | cut -d ':' -f 4`"
if [ -z "${longname}" ] ; then
longname="${label}"
fi
# added change "windows recovery environment (loader)" "windows vista"
if [ "$longname" = "windows recovery environment (loader)" ] && [ "${device}" = "/dev/sda1" ] ; then
longname="windows vista"
fi
# end added- save file, run:
code:sudo update-grub
8. hiding other partitions
can hide partition other system partition editing /etc/grub.d/30_os-prober.
- to hide partition linux kernels, insert additional lines, substituting correct drive/partition designations (sda3, sdb5, etc):
- if [ -z "${llabel}" ] ; then
llabel="${longname}"
fi
if [ "${lroot}" = "/dev/sdxy" ]; then
continue
fi
- to hide windows partition, insert additional lines, substituting correct drive/partition designations (sda3, sdb5, etc):
- if [ -z "${longname}" ] ; then
longname="${label}"
fi
if [ "${device}" = "/dev/sdxy" ]; then
continue
fi
9. hiding 32/64 bit osx entry when both appear
if grub 2 lists both 32-bit , 64-bit osx entries , user wishes display 1 or other, edit /etc/grub.d/30_os-prober:
remove either of following lines (approximately line 218) remove associated entry grub 2 menu.
run "sudo update-grub" after saving file incorporate changes grub 2 configuration file.osx_entry xnu_kernel 32
osx_entry xnu_kernel64 64
10. changing menu entry order
2 simple ways change basic order of entries appearing in grub 2 menu:
- create custom menu. /etc/grub.d/40_custom menus appear @ bottom of menu. rename file 06_custom , menu entries appear @ top of menu.
- rename 1 (or more) of existing /etc/grub.d scripts. scripts run in order. if want "other os" entries found 30_os-prober run first (and placed first in menu), rename 30_os-prober 06_os-prober, 07_os-prober, etc or rename 10_linux 99_linux, etc.
11. hiding menu on multi-os systems
design, grub 2 allows hiding menu on single-os systems. established in /etc/grub.d/30_os-prober file. users multiple os's on machines, hiding menu can accomplished altering scripts. there 2 ways accomplish task. first edits 1 file , eliminates conditional; second edits 2 files , adds conditional, bit more 'elegant'.
shown applicable sections. changes highlighted in bold red. lines between altered lines have been omitted.
- method 1. remove conditional /etc/grub.d/30_os-prober.
both grub 1.97~beta (karmic) , 1.98 (lucid & later), first line edit same. appears @ approximately line 25-30 of /etc/grub.d/30_os-prober in both versions.
the second change place # symbol @ end of conditional. there many if statements, , it's important find correct nested fi.# if [ "x${found_other_os}" = "x" ] ;
in karmic, nested fi comes before "grub_disable_prober" section. if lucid , later, preceeds "() adjust timeout" section.
karmic (grub 1.97~beta):
lucid & later (grub 1.98+):fi
fi
# fi
}
if [ "x${grub_disable_os_prober}" = "xtrue" ];
#
fi
}
adjust_timeout () {
- method 2. add conditional.
procedure modifies both /etc/grub.d/30_os-prober , /etc/default/grub. open both with:
add line /etc/default/grub:code:gksu gedit /etc/default/grub /etc/grub.d/30_os-prober
change line in /etc/grub.d/30_os-prober, approximately line 25-30,grub_force_hidden_menu="true"
export grub_force_hidden_menu
this:
to this:if [ "x${grub_disable_os_prober}" = "xtrue" ];
if [ "x${found_other_os}" = "x" ] || [ "x${grub_force_hidden_menu}" = "xtrue" ] ;
12. hiding partitions using parttool
hiding windows partitions other windows installs capability in grub legacy using "hide" option. in grub2, function incorporated using parttool module. section of guide result of post 9142327 gmhilltop, wanted hide 1 windows partition when booting one.
easiest way incorporate grub2 menu through modification of /etc/grub.40_custom file. add following entries, should self-explanatory. if not, gmhilltop provides bit more explanation in post.
code:menuentry "mom & dads" { insmod chain insmod ntfs parttool (hd0,1) hidden- parttool (hd0,2) hidden+ parttool (hd0,5) hidden- set root= (hd0,1) search --no-floppy --fs-uuid --set 9a7a430f7a42e819 chainloader +1 } menuentry "kids operating system" { insmod chain insmod ntfs parttool (hd0,2) hidden- parttool (hd0,1) hidden+ parttool (hd0,5) hidden+ set root= (hd0,2) search --no-floppy --fs-uuid --set 9a18464d18462919 chainloader +1 } menuentry "ubuntu" { parttool (hd0,2) hidden- parttool (hd0,1) hidden- parttool (hd0,5) hidden- parttool (hd0,6) hidden- recordfail=1 if [ -n ${have_grubenv} ]; save_env recordfail; fi set quiet=1 insmod ext2 set root=(hd0,3) search --no-floppy --fs-uuid --set 9a1e8016-a158-4e98-ae38-6da0fd528d9a linux /boot/vmlinuz-2.6.31-14-generic root=uuid=9a1e8016-a158-4e98-ae38-6da0fd528d9a ro quiet splash initrd /boot/initrd.img-2.6.31-14-generic }
13. removing grub 1.99 submenu
if want display kernels , eliminate linux entries submenu feature introduced grub 1.99, here how edit /etc/grub.d/10_linux. these lines (uncommented) appear @ bottom of file. do not comment "done" line.
# if [ "$list" ] && ! $in_submenu; then
# echo "submenu \"previous linux versions\" {"
# in_submenu=:
# fi
done
#if $in_submenu; then
# echo "}"
#fi
14. troubleshooting
if tweaks in section not work there several things check.
- are working correct file? make sure making changes file deals item trying hide. check grub.cfg file see section entry appearing in (10_, 30_, etc).
- is variable producing correct result? easiest way check either echo variable results viewing while update-grub running or insert variable in grub.cfg file review.
- example: memtest86+ option keeps appearing in menu, though have inserted "nomemtest="`echo ${llabel} | cut -d " " -f 1`" 30_os-prober.
- check undesired 'memtest86+' menu item in 30_os-prober section of grub.cfg
- find out value 'llabel' , 'nomemtest' returning.
- alter following line:
tocode:cat << eof menuentry "${llabel} (on ${device})" {ile allowing os-prob
a sample entry this, showing values:code:cat << eof nomemtest=${nomemtest} llabel=${llabel} menuentry "${llabel} (on ${device}" \
now each entry, have line directly above displaying values of nomemtest , llabel before menu entry created. knowledge, should able tweak variable ensure returns correct value current situation.code:nomemtest=memtest86+ llabel=debian gnu/linux, kernel memtest86+ menuentry "debian gnu/linux, kernel memtest86+" (sda8) {
15. custom menus
grub2 allows user place customized menu entries main grub menu via scripts in /etc/grub.d folder. one, 40_custom, prebuilt , items can added it's contents. not change existing lines - add items below. easy way add entries copy entries /boot/grub/grub.cfg file , alter them desired.
note: scripts in /etc/grub.d run, , menu items placed in grub2 menu, sequentially. naming /etc/grub.d custom file 06_custom place custom menu entries before in 10_linux , 30_os-prober. means placed @ top of grub 2's menu. menu items placed in 40_custom appear bottom of menu.
if use numbered filename less 30 may want check "default=" line in /etc/default/grub after running sudo update-grub ensure correct menuentry item identified.
- custom entry based on ranch hand's post #26. provides entry latest kernel on system , remain current after kernel update. uuids may used identify root if desired.
code:menuentry "latest kernel" { set root=(hdx,y) linux /vmlinuz root=/dev/sdxy ro quiet splash initrd /initrd.img }
15. post tweaks!
thread recommendations
- tweaks alter text on grub 2 menu.
- if possible, on first line post existing title , how change.
ery/single user entrie
- original menu entry: microsoft windows xp home edition on sda1 >> new: xp
to achieve on first line, copy/paste code last line of post , alter it.
[size="3"][b]original menu entry: [color="darkred"]microsoft windows xp home edition on sda1[/color] >> new: [color="darkgreen"]xp[/color][/b][/size]
[/size]
moved karmic![]()
Forum The Ubuntu Forum Community Other Discussion and Support Tutorials Grub 2 Title Tweaks Thread
Ubuntu
Comments
Post a Comment