Ask Your Question
1

Strange names in GRUB

asked 2014-07-02 00:11:31 -0500

abadrinath gravatar image

Hi!

Pretty minor issue, but why are the names so strange in GRUB? For example, Fedora, with Linux 3.11.10-301.fc20.x86_64-6b266543-a497-44de-981f-ee460b85590a instead of Fedora, with Linux 3.11.fc20.x86_64. The safe mode one is even more ugly, with many random numbers and letters.

I know how to change this, but why is this happening?

James

edit retag flag offensive close merge delete

Comments

That's strange. Have you ever run grub2-mkconfig? Would you please run it and see what is the first 'menuentry' it generates? It should not contain such extra characters.

hedayat gravatar imagehedayat ( 2014-07-02 12:40:44 -0500 )edit

@hedayat - Done that....still same issue. :( The menuentry has the strange characters.

abadrinath gravatar imageabadrinath ( 2014-07-03 03:26:21 -0500 )edit

What is the output of this command?

ls /boot/vmlinuz-*
hedayat gravatar imagehedayat ( 2014-07-03 06:49:55 -0500 )edit

/boot/vmlinuz-0-rescue-2bb1123fa8d248028d71f1de699c767d /boot/vmlinuz-3.11.10-301.fc20.x86_64

abadrinath gravatar imageabadrinath ( 2014-07-03 21:39:13 -0500 )edit

Have you ever edited anything in /etc/grub.d/? What does rpm -qV grub2-tools say? The entry for rescue mode is normal, but not the one for 3.11.10 kernel.

hedayat gravatar imagehedayat ( 2014-07-04 03:16:58 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-07-02 02:38:00 -0500

NickTux gravatar image

updated 2014-07-06 08:30:48 -0500

The main Grub entries are generated from the scripts that are listed under /etc/grub.d/ directory. The one that is responsible for the Fedora entries is 10_linux. If you read the script, you will see how the lines are generated, when you invoke the grub2-mkconfig command.

The entries under /etc/grub.d/ directory should be (for grub-pc , I don't have UEFI).

00_header 10_linux 20_linux_xen 20_ppc_terminfo 30_os-prober 40_custom 41_custom README

The contents of 10_linux script can be found here. If you want to replace the contents of your 10_linux script with the ones from fpaste, don't forget to backup first.

sudo cp /etc/grub.d/10_linux /etc/grub.d/10_linux.bak

Manual configuration (not recommended for novice users)

If you want to manually change the entries as you wish, you can do it by removing the execution bit from 10_linux script and add your custom entries in 40_custom .

For example, a custom entry could be

menuentry "Fedora 20 with kernel 3.15" --class fedora --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.14.8-200.fc20.x86_64-advanced-00eb889b-9c66-46e7-b021-99b89d28e23b' {
    load_video
    set gfxpayload=keep
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root='hd0,msdos3'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3  ???????????????????????????????????????????
    else
      search --no-floppy --fs-uuid --set=root ???????????????????????????????????
    fi
    linux   /boot/vmlinuz-3.15.3-200.fc20.x86_64 root=UUID=??????????????????????? ro vconsole.font=latarcyrheb-sun16  rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0 LANG=en_US.UTF-8
    initrd /boot/initramfs-3.15.3-200.fc20.x86_64.img
}

Mind here the double quotes at the name "Fedora 20 with kernel 3.15" .

You can copy-paste the entries you want, directly from /boot/grub2/grub.cfg to /etc/grub.d/40_custom and change the names accordingly. Do not change anything else.

Then, update grub configuration and reboot the system and try the entries you added. If and only if they working as it should, you can remove the execution bit from 10_linux and update grub configuration.

sudo chmod 644 /etc/grub.d/10_linux
sudo grub2-mkconfig -o /boot/grub2/grub.cfg

That way, you will have only your custom entries under grub list.

Be aware of some things

  1. If an update for GRUB comes, the execution bit of the script 10_linux will come back again. The update will replace the scripts permissions with the default ones.
  2. When a new kernel comes, with an update, you have to manually add the entry to 40_custom script, or else it will not be listed under GRUB. Thus, you should always check the updates and searching for a kernel update.
  3. (dangerous). If you forget to replace the entries, when a new kernel update comes, you might be ended with an unbootalbe system. Fedora by default, removes the old kernels every 3 (kernel) updates.
edit flag offensive delete link more

Comments

What are the entries supposed to be???

abadrinath gravatar imageabadrinath ( 2014-07-03 03:26:36 -0500 )edit

I edited the answer and added some more info.

NickTux gravatar imageNickTux ( 2014-07-06 07:27:39 -0500 )edit
2

@NikTh - :) Works like a charm. Thanks

abadrinath gravatar imageabadrinath ( 2014-07-08 02:45:27 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-07-02 00:11:31 -0500

Seen: 400 times

Last updated: Jul 06 '14