Error: Can’t find command linux during boot

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.

  1. boot to your CentOS terminal (If can’t boot, you can try boot into Netboot mode or rescue mode)

  2. Install grub2-efi

# yum install grub2-efi
  1. Edit the /boot/efi/EFI/centos/grub.cfg
# vim /boot/efi/EFI/centos/grub.cfg
  1. If the file grub.cfg doesn’t exist, generate it.
# grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
  1. 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
  1. Reboot it
# reboot

Tags:

Discover more from Juzhax Technology

Subscribe now to keep reading and get access to the full archive.

Continue reading