Last updated on February 27th, 2021 at 02:05 am
Recently one of my server unable to start during boot time. I received the screenshot from my web hosting company and showing with these error.
error: can't find command `linux` .
Press any key to continue ...
Solution
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.
-
boot to your CentOS terminal (If can’t boot, you can try boot into Netboot mode or rescue mode)
-
Install grub2-efi
# yum install grub2-efi
- Edit the /boot/efi/EFI/centos/grub.cfg
# vim /boot/efi/EFI/centos/grub.cfg
- If the file grub.cfg doesn’t exist, generate it.
# grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
- Replace all linux command to linuxefi and replace initrd to initrdefi
Sample before edit
linux /boot/bzImage-4.19.177-xxxx-std-ipv6-64 root=/dev/md2 ro crashkernel=auto rhgb quiet rootdelay=10 noquiet nosplash net.ifnames=0 biosdevname=0
Sampel after edit
linuxefi /boot/bzImage-4.19.177-xxxx-std-ipv6-64 root=/dev/md2 ro crashkernel=auto rhgb quiet rootdelay=10 noquiet nosplash net.ifnames=0 biosdevname=0
- Reboot it
# reboot