1

I used to have Ubuntu as my only OS until I decided to get a new SSD and installed CentOS there. Now upon starting my computer I can't start Ubuntu without modifying the entry for Ubuntu first. I know how to do that, basically I change where it says:

linux /boot/vmlinuz...
initrd /boot/initrd.img...

to

linuxefi /boot/vmlinuz...
initrdefi /boot/initrd.img...

However, I need to make this change every time I want to start Ubuntu, thus my question: how do I make this change permanent?

I read this and this threads, but I'm not sure if the changes should be made in:

/boot/efi/EFI

or

/boot/grub/

or

/boot/grub2/

I can't also find the file with the exact line I change every time upon starting my computer. I suppose the file is named something like grub.cfg. In any case, I wouldn't like to tinker with one of those files without knowing 100% that I won't mess things up further. Also, should this change be made in Ubuntu or CentOS?

Any help would be greatly appreciated. Thanks!

PS: please note that Ubuntu and CentOS are installed in different SSDs, if that matters at all.

YSC
  • 11
  • When you say you are modifying the Ubuntu entry, are you talking about editing the grub entry from the grub menu? – Andrew Shum Nov 10 '17 at 19:10
  • Yes, sorry, should’ve been mor specific: I meant exactly what you said (the entry from the menu). – YSC Nov 10 '17 at 20:23
  • This may be a stupid question but have you tried running sudo update-grub? – Andrew Shum Nov 10 '17 at 23:53
  • @AndrewShum Yup, every time I try that I get a confusing message: "boot meny entry added for EFI configuration", but the problem persists after every restart. – YSC Nov 11 '17 at 13:15
  • If both drives are UEFI/gpt, you should just need to change UEFI boot order to make /EFI/ubuntu entry first in UEFI boot order. see sudo efibootmgr -v & man efibootmgr Ubuntu puts a tiny 3 line grub.cfg in /EFI/ubuntu to configfile (chain) to full grub.cfg in your Ubuntu install. Other distributions may put the full grub.cfg in the ESP in their /EFI/Distribution or /EFI/grub2 folders. If you want lots of detail of configuration run this: Post the link to the Create BootInfo summary report. Is part of Boot-Repair: https://help.ubuntu.com/community/Boot-Info – oldfred Nov 11 '17 at 14:59

1 Answers1

0

I finally found the appropriate file and thought of documenting the solution here just in case someone else has the same (or similar) problem.

In my personal case, when in Ubuntu, the file:

/boot/grub/grub.cfg

would only allow me to modify the entries listed under "Ubuntu Advanced Options."

However, in CentOS (remember the problem first arose when I installed CentOS in a new SSD) the file:

/boot/efi/EFI/centos/grub.cfg

contains the lines for the entry "Ubuntu 16.04."

The only thing that now makes me wonder whether this is an ideal fix or not is that in grub.cfg there's a note that says not to modify the file because it's automatically generated from "/etc/default/grub." The changes in the above directories fixed the problem, though, and thus far I haven't experienced any problem upon booting.

I will leave a few days before accepting this answer in case someone has a better answer or explanation for that "don't edit this file" note at the beginning of grub.cfg.

YSC
  • 11
  • 1
    You normally do not directly edit grub.cfg. Any sudo update-grub or new kernel will create a new one. – oldfred Nov 11 '17 at 14:56
  • @oldfred That makes total sense: would you like to include an answer with an alternative solution to this issue so I can mark it as "solved" (if it works)? – YSC Nov 24 '17 at 07:58
  • 1
    This shows copying a Windows boot stanza into 40_custom, but you can copy any other boot stanza into 40_custom. Then with sudo update-grub the 40_custom entries are added to grub.cfg. https://help.ubuntu.com/community/Grub2/CustomMenus With another install that has all of grub in the ESP, you can probably chain to it like a typical Windows efi entry: https://ubuntuforums.org/showthread.php?t=1769482&p=12868627#post12868627 – oldfred Nov 24 '17 at 21:57