Can't find command linuxefi and initrdefi while booting from uefi

i followed the instruction PXE (with grub2) — Linux Guide and Hints to set up uefi boot
Trying to install rocky 9 linux using PXE boot option in the ARM64 server. but it is not recognizing the linuxefi and initrdefi command in grub.cfg file. even though i use the linux and initrd command , it still didn’t work.

the error i got during the boot:

error: ../../grub-core/script/function.c:119:can't find command `linuxefi'.
error: ../../grub-core/script/function.c:119:can't find command `initrdefi'.

set default=0
set timeout=60
menuentry ‘Install Rocky9’ {
linuxefi rhel9/rocky9/vmlinuz inst.ks=http://192.168.1.10/kickstarts/ks.cfg inst.stage2=http:// 192.168.1.10/rocky9/ISO quiet
initrdefi rhel9/rocky9/initrd.img
}

has anyone ever encountered this issue before? don’t know how to solve it

linuxefi and initrdefi, despite their generic names, are specific to x86/64 and its (deprecated) “EFI Handover Protocol.” Just use the plain linux and initrd commands, which will do a regular EFI Stub entry.

For more information, read me flailing around for a couple weeks in this thread, particularly the review subthreads and the comments I wrote in the patch.

i tried with linux and initrd. i got the same error as below

error: ../../grub-core/script/function.c:119:can't find command `linux'.
error: ../../grub-core/script/function.c:119:can't find command `initrd'

looked through the thread you posted… don’t know how to fix it. :face_exhaling:i did a minimal install of rocky linux 9.2

linuxefi and initrdefi are x86 specific options for grub. As mentioned, linux and initrd are what you would use for ARM systems. With that said, being the author of that page you linked, I have a feeling that you may not have setup your environment correctly. I do not have the issue you are presenting with my ARM systems.




This is the menu configuration.

I press ctrl+x to continue booting.

The installer works.

tty2, showing uname.

Thanks for the info. I will do it from scratch. and try again. and will keep you updated.

linuxefi and initrdefi are x86 specific options for grub.

Do you know of documentation for this, or do we all just figure this out independently while Red Hat’s documentation insists “linux on 64-bit IBM POWER Series, linux16 on x86_64 BIOS-based systems, and linuxefi on UEFI-based systems”?

(Or, say,

linuxefi - Defines the kernel that boots (/images/pxeboot/vmlinuz in the above example) and the other additional options, if any.

for “Systems with uefi firmware”? Or

The GRUB2 menu is available on UEFI-based AMD64, Intel 64, and 64-bit ARM systems. […] On UEFI systems, the kernel command line starts with linuxefi.

None of which the Rocky project are responsible for, just like, did everyone else somehow get some memo, y’know?)

thanks for the info. really don’t know that… the purpose for me is to set up a auto-install of linux system. got some obstacles during the set up… therefore, it ended up in here. meantime, i also look into the cobbler solution. seems promising as well.

I ran into the same issue on our Rocky 9.2 HPC cluster setup, and was able to solve it. Hopefully my experience will help you and anyone else who runs into this issue.

In the instructions you’re following, it recommends setting up a symbolic link at boot/grub2/x86_64-efi/grub.cfg. This didn’t work for me, and I got the same errors you did regarding commands not being found. I tried working with the default config instead, where it tries to source a shared config file:

[root@head x86_64-efi]# cat grub.cfg
source boot/grub2/grub.cfg

This also didn’t work for me. I watched the TFTP traffic, and grub did not make any attempt to load the sourced file. I went back to using a symbolic link to my shared config, and while debugging, tried a gratuituous insmod linux to try and force grub to load the linux module. Here’s what I saw on the TFTP server:

RRQ "boot/grub2/x86_64-efi/x86_64-efi/linux.mod"

You can see that the x86_64-efi directory is being doubled up on requests to the tftp server. I believe the default setup is intended to source the shared config under boot/grub2 and assumes that path will be the prefix when sourcing that shared config, so it appends x86_64-efi to paths for module loading.

I worked around these issues by setting the prefix variable to ‘/boot/grub2/’ and then adding insmod linux to each linux menuentry. Here’s what I have that’s working:

[root@head grub2]# pwd
/var/lib/tftpboot/boot/grub2
[root@head grub2]# ls -al x86_64-efi/grub.cfg
lrwxrwxrwx 1 root root 11 Sep 25 20:11 x86_64-efi/grub.cfg -> ../grub.cfg
[root@head grub2]# cat grub.cfg 
set prefix='/boot/grub2/'
set default='next'
set timeout=30


menuentry ' - - - Operating Systems - - - ' {
  insmod echo
  echo "Please select an OS from the main menu to see options for that OS"
  sleep --interruptible 10
}

submenu 'Rocky Linux 9.2' --id rocky {
  
  menuentry 'Kickstart Rocky 9.2' {
    insmod linux
    linux images/rocky-9.2/vmlinuz inst.repo=http://hpcdata:8080/os/rocky/9.2 inst.ks=http://hpcdata:8080/os/rocky/9.2-hpc.ks
    initrd images/rocky-9.2/initrd.img
  }

  menuentry 'Install Rocky 9.2' {
    insmod linux
    linux images/rocky-9.2/vmlinuz inst.repo=http://hpcdata:8080/os/rocky/9.2
    initrd images/rocky-9.2/initrd.img
  }

  menuentry 'Rescue Rocky 9.2' {
    insmod linux
    linux images/rocky-9.2/vmlinuz inst.repo=http://hpcdata:8080/os/rocky/9.2 inst.rescue
    initrd images/rocky-9.2/initrd.img
  }

}

menuentry ' - - - Maintenance Functions - - - ' {
  insmod echo
  echo "Please select a maintenance function from the main menu"
  sleep --interruptible 10
}

menuentry 'Reboot' {
  reboot
}

menuentry 'Shutdown' {
  halt
}

menuentry 'Exit Network Boot' --id next {
  exit
}

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.