openhpc / ohpc

OpenHPC Integration, Packaging, and Test Repo
http://openhpc.community
Apache License 2.0
867 stars 190 forks source link

Local disk boot failed: Missing mandatory option for `class` #1351

Closed BeingGod closed 1 month ago

BeingGod commented 3 years ago

When I try to use warewulf to make stateful system, I meet a problem of boot failed. It may be /boot/grub2/grub.cfg missing some options. It’s OK when I try to boot system by PXE.

I follow below commands:

# Add GRUB2 bootloader and re-assemble VNFS image
[sms]# yum -y --installroot=$CHROOT install grub2 [sms]# wwvnfs --chroot $CHROOT

# Select (and customize) appropriate parted layout example
[sms]# cp /etc/warewulf/filesystem/examples/gpt_example.cmds /etc/warewulf/filesystem/gpt.cmds [sms]# wwsh provision set --filesystem=gpt "${compute_regex}"
[sms]# wwsh provision set --bootloader=sda "${compute_regex}"

Description: It have no boot options for Linux System. And missing mandatory option for `class`. OS: CentOS 8.3 Kernel: 4.18.0-240 Version: ohpc 2.1

juanmac17 commented 3 years ago

Hi, I have the same problem with Rocky_linux+Warewulf stateful installation.

percyj-vcu commented 3 years ago

I am having the same issue as above.

surinco commented 3 years ago

Hi, I have had the same problem. The error I get as mentioned above is:

image missing mandatory option for 'class'

When I looked closely at the grub file (type e to change the grub file at boot or look in /boot/grub2/grub.cfg) there is a bug in the first line as follows:

image there is a --class with nothing after it, basically two --class one after the other

my solution was when the compute node is provisioned the first time and before restarting, login and change the grub file and remove the extra --class.

This is a temporary fix, for a more permanent solution I cannot find the /boot/grub2/grub.cfg in the vnfs image on the master node. I have 10s of nodes to provision and it will be a hassle to change every single grub file manually.

I am not sure, but I beleive the grub.cfg file is created when the PXE boots and the node is being provisioned. There is probably a bug somewhere in the ohpc-warewulf or the grub2 scripts.

Someone with a better knowledge of ohpc should comment on this.

Hope this helps.

j2322 commented 2 years ago

TL:DR: add GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" to $CHROOT/etc/default/grub

In line 31 in /etc/grub.d/10_linux from the grub2-tools package (which should have also provided /etc/default/grub but for some reason did not)

if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
  ...
  CLASS="--class $(eval $(grep '^ID_LIKE=\|^ID=' /etc/os-release) ; [ -n "${ID_LIKE}" ] && echo ${ID_LIKE} || echo ${ID}) ${CLASS}"
else
  ...
  CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
fi

The grep doesn't work in the first half, in Rocky at least, the line is PLATFORM_ID="platform:el8" in /etc/os-release. As for the second half, GRUB_DISTRIBUTOR is usually set in the /etc/default/grub file but because it isn't installed it doesn't get set. Either way you get the empty "--class" argument. Really don't know where the fault lies, but just setting the GRUB_DISTRIBUTOR variable in /etc/default/grub in the image solved it for me.

luciandf commented 2 years ago

I am trying to run some nodes stateful but there is no grub file in $CHROOT/etc/default/. Also as soon as I add the wwsh provision set --filesystem=gpt "${compute_regex}" command, I get an error at boot: /newroot/sbin/init could not be verified

Before that I get the /dev/sda is not ready error. How can I make /dev/sda ready at boot? If I boot stateless, /dev/sda appears in lsblk.

github-actions[bot] commented 4 months ago

A friendly reminder that this issue had no activity for 30 days.