Can not boot from new Kernels

Hi there,

I am on Fedora 36 KDE with Kernel 5.18.18-200, then the system was updated to 5.18.19-200 and at boot I got the following error messages in grub:

error: …/…/grub-core/script/lexer.c:352:syntax error.
error: …/…/grub-core/script/lexer.c:352:Incorrect command.
error: …/…/grub-core/script/lexer.c:352:syntax error.
error: …/…/grub-core/script/lexer.c:352:Incorrect command.
error: …/…/grub-core/script/lexer.c:352:syntax error.

press any key to continue…

I went for “ok, I didnt play arount with grub, next update will make this go away!” Turns out it didnt. The recent update to 5.19.4-200 fails to boot as well with the same output.

There was an error message when I booted with 5.18.18-200 indicating problems with the contents of this repo:

kallepm/tuxedo-keyboard Copr

I need this as a dependency for my power management in tuxedo-control-center.
I wanted to take care of this later and put the laptop in suspend. On wake up the system froze (again…) and I was unable to capture the error message since it did not reappear.

I have seen 2 different possible fixes for this issue.

  1. update the grub.cfg file with sudo grub2-mkconfig -o /boot/grub2/grub.cfg which sometimes works.
  2. reinstall the kernel which fails to boot properly with dnf reinstall kernel*5.19.4* (or completely remove it with dnf remove kernel*5.19.4* --noautoremove followed by dnf upgrade to reinstall it)

Depending upon the system it seems that one of those may be the workaround to get the newer kernel to boot properly. If step 1 does not work then try step 2.

I seem to recall this has been an issue for several since the release of kernel 5.18.17 but does not seem to affect everyone. Maybe it is related to what else is getting upgraded at the same time.

1 Like

@computersavvy I suppose you mean sudo grub2-mkconfig -o /boot/grub2/grub.cfg. It worked fine, thx!

1 Like

yep. I fixed that typo.

the problem reappears after system update. can I run fedora on a LTS kernel?

It is ulikely the problem is with the kernel. Lately there has been quite a few updates to grub2 related to creating /etc/kernel/cmdline.

Can you show the contents of /etc/kernel/cmdline and /proc/cmdline when booting from the previous kernel?

/etc/kernel/cmdline:

root=UUID=fbba7dd5-08e2-4e91-afe5-f67136c02a07 ro rhgb quiet ${extra_cmdline} rhgb quiet

/etc/proc/cmdline

BOOT_IMAGE=(hd1,gpt2)/boot/vmlinuz-5.19.6-200.fc36.x86_64 root=UUID=fbba7dd5-08e2-4e91-afe5-f67136c02a07 ro rhgb quiet {extra_cmdline}

with kernel 5.19.6-200

The word “{extra_cmdline}” should not be there.

edit /etc/kernel/cmdline and remove “${extra_cmdline} rhgb quiet”

That should fix it for any future kernel installs and re-installs.

Also this word should not occur if you run

grep GRUB_CMDLINE_LINUX /etc/default/grub

This can also be fixed by using grubby, but I never used that command. Perhaps someone else can explain.

you should also check the bls entries:
sudo grep -r options /boot/loader/

or you can check with grubby:
sudo grubby --info=ALL

and compare with /etc/default/grub just to be sure:
cat /etc/default/grub | grep CMDLINE

add options with grubby: (preempt=full is an example)
sudo grubby --args="preempt=full" --update-kernel=ALL

remove options with grubby: (preempt=full is an example)
sudo grubby --remove-args="preempt=full" --update-kernel=ALL

You can also pick a specific kernel to update, the examples above were for all of them.

If this is the same grub/grubby bugs (there were several) it should’ve been resolved by: https://bodhi.fedoraproject.org/updates/FEDORA-2022-a3480ad0d3
If that is not installed yet it may be part of the problem.

For reference:
My /etc/default/grub: UNTITLED - Pastebin Service
sudo grubby --info=ALL from my machine: UNTITLED - Pastebin Service
sudo grep -r options /boot/loader/*: UNTITLED - Pastebin Service

Another way to fix is:
Fall back to a working kernel version
remove /etc/kernel/cmdline
remove non-working kernels
re-install kernel updates.

Thanks

here is what I did:

  1. booted older kernel
  2. deleted “${extra_cmdline} rhgb quiet” from /etc/kernel/cmdline
  3. sudo dnf reinstall kernel-core-5.19.6-200.fc36
  4. sudo grub2-mkconfig -o /boot/grub2/grub.cfg
  5. reboot with new kernel
  6. checked /etc/kernel/cmdline → “${extra_cmdline} rhgb quiet” is gone

Let’s see what happens after the next system update. Thx!

1 Like

I had the same issue but a slightly different solution. For me the issue was the presence of %{_dracutopts} in the grub config. I deleted it from /etc/kernel/cmdline, but it was still in the grub config after grub2-mkconfig. So I found it also in /etc/default/grub, and after removing it from there and running grub2-mkconfig again, it was finally removed from grub.cfg.