Additional Entries
A few things first.
search line
search can look for 3 things.
uuid, label and file.
search --no-floppy --fs-uuid --set=root <uuid>
search --no-floppy --label --set=root <label>
search --no-floppy --file --set=root <file>
The syntax can be -u, -l and -f
and search.fs_uuid search.fs_label search.file are aliases for the commands.
and 'set' if unspecified is for setting as root
So this line is similar to our familiar first line above.
search.fs_uuid xxxxxxxxxxxxxxxxxxxxxxxx root
linux line
Now linux line too requires that we specify which partition we select as 'root', typically exemplified by
linux /boot/vmlinuz-manjaro root=UUID=xxxxxxxxxxxxxxxxxxxxxxxxxxx quiet splash rw
We can use label instead like
linux /boot/vmlinuz-manjaro root=LABEL=xxxx quiet splash rw
or plain device map like
linux /boot/vmlinuz-manjaro root=/dev/sdxy quiet splash rw
which is very unreliable.
But uuid numbers are of course impossible to memorize and device mapping unreliable.
So I have used mainly labels here in this section of "modifying entries" to boot. If we choose to permanently 'anchor' a particular entry, then we should use its uuid instead.
After all, creating labels is quite easy using gparted or a simple command like
e2label device [ label ] (#for ext fs)
A helpful command to select (rather, set) a uuid is probe
probe -u $root --set=abc
It can also 'set' its label
probe -l $root --set=xyz
but I doubt anyone can forget what he/she labels his/her partition.
So let's start.
Oh, a reminder that all grubs work on all linux distro's (and more), whether they originate from the distros themselves. It's just the content and parameters of their entries.
Direct boot
Easy. Just type in the linux and initramfs and boot.
Here I still use sym-links, but typing the actual vmlinuzes and initramfs's is not too difficult either.
Use "(tab)" (my original tab goes missing on this bbcode thingy) to help autocomplete. Well, intel-ucode - type in if you desire, but if just to boot in and repair, there's no need to be that picky.
menuentry "Label - Vmlinuz-Manjaro " {
insmod part_msdos
insmod ext2
search --no-floppy --label --set=root xxxx
linux /boot/vmlinuz-manjaro root=LABEL=xxxx rw
initrd /boot/initramfs-manjaro.img
}
Chainload
(The original one - we will encounter another 'chainload' in uefi which is not actually)
menuentry "Label - Chainloader " {
insmod part_msdos
insmod ext2
search --no-floppy --label --set=root xxx
chainloader +1
}
The least reliable and my last of my choice.
No further comment.
And typically used for Windows
menuentry "Windows C " {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos1)'
drivemap -s (hd0) ${root}
chainloader +1
}
Note the above has a drivemap command which is necessary for booting windows more reliably in 2 or more disks situation. Oh, typically in sda1. And to segue into windows boot, here's my preferred direct booting of Windows.
Windows - ntldr
menuentry "Windows 10" {
insmod ntfs
search --set=root --fs-uuid xxxxxxxxxxxxxxx
ntldr /bootmgr
}
For Windows XP, the command is different
menuentry "Windows XP" {
insmod ntfs
search --set=root --fs-uuid xxxxxxxxxxxxxxx
ntldr /ntldr
}
Multiboot
What these commands do is to boot up directly (not really chainload) core.img or core.efi of the OS's.
It's like using the OS's direct grub and grub.cfg itself. Note the commands are different in bios-legacy and uefi.
menuentry "Multiboot --bios-legacy" {
search --set=root --label xxxx
multiboot /boot/grub/i386-pc/core.img
}
menuentry "Multiboot --uefi" {
search --set=root --label xxxx
chainloader /boot/grub/x86_64-efi/core.efi
}
One possible disadvantage of using this (I personally like this the most and I use this for testing the OS bootloader) when recommending this method to others is that when there is a problem, there is a likelihood that the first sector is already defective (moving partitions, resizing, etc) and this method to boot could fail for these reasons.
A simple way to remedy the faults is just to "grub-install' again.
Another more 'surgical' way to repair core.img is
grub-install --no-bootsector
but this applies for grub version 2.02~beta3 - not in Manjaro yet - and for bios-legacy.
Configfile
What this do is to use the bootloader of the current grub menu but replace the grub.cfg (and therefore entries) of the selected target OS.
menuentry "Label - Configfile " {
insmod part_msdos
insmod ext2
search --no-floppy --label --set=root xxx
configfile /boot/grub/grub.cfg
}
This would be my preferred recommendation for people who cannot bring up the bootloader of the selected OS but can have other OS's bootloader or at least a grub prompt.
Hope this topic is useful and good luck.
Cheers.
Reference
Grub Manual