4

Recently I've installed CentOS 7 on my pc, previously I had debian 7 and manjaro installed. When I installed manjaro I overwrote the bootloader of debian and manjaro's grub recognized the two systems and all worked perfectly, now that I installed CentOS I overwrote /boot/efi and the new grub recognized the three systems but only CentOS works. When I try to boot debian or manjaro the following message appears:

error: cant't find command linux
error: cant't find command initrd
Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
carloscarcamo
  • 141
  • 1
  • 1
  • 3
  • CentOS probably cleared the MBR with its own. May need to fix off a live cd – Kevin Huntly Apr 15 '15 at 02:49
  • 1
    Do you have Secure Boot enabled? In that case, CentOS GRUB might be restricted to using only the `linuxefi` and `initrdefi` keywords instead of plain `linux` and `initrd`. – telcoM Nov 20 '18 at 21:50

1 Answers1

4

The problem is the linux and initrd command used in /boot/efi/EFI/centos/grub.cfg is not found in your centos (or any default boot OS).

You must replace the linux to linuxefi and initrd to initrdefi inside the grub.cfg file.So follow this operatins:

1 - boot to your centos terminal

2 - install grub2-efi

# yum install grub2-efi

4 - open the /boot/efi/EFI/centos/grub.cfg using a text editor.

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

note: if grub.cfg did not exist try to /boot/grub2/grub.cfg... if was not exist too, try to generate that: # grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg

5 - find all linux command and replace to linuxefi. So, find all initrd command and replace to initrdefi

befor edit saples

linux /boot/vmlinuz-0-rescue-d1268bb1d6df49758a1ec5715984725c root=/dev/sda1
initrd /boot/initramfs-0-rescue-d1268bb1d6df49758a1ec5715984725c.img

after edit sample :

linuxefi /boot/vmlinuz-0-rescue-d1268bb1d6df49758a1ec5715984725c root=/dev/sda1
initrdefi /boot/initramfs-0-rescue-d1268bb1d6df49758a1ec5715984725c.img

6 - reboot

ultra.deep
  • 149
  • 5
  • I have been struggling for hours with an EFI system that wouldn't boot, and this finally made the difference. (Why isn't it documented anywhere?) Thank you. – Steve Summit Mar 30 '23 at 00:35