Grub syntax error and Incorrect command when updating

Hello all, I’ve been using Manjaro for quite awhile but there’s one problem that I cant seem to fix for a long while. Everytime I update I get an error like this:

[main@main-manjaro ~]$ sudo update-grub
[sudo] password for main:
Generating grub configuration file …
Found theme: /usr/share/grub/themes/manjaro/theme.txt
Found linux image: /boot/vmlinuz-5.4-x86_64
Found initrd image: /boot/intel-ucode.img /boot/initramfs-5.4-x86_64.img
Found initrd fallback image: /boot/initramfs-5.4-x86_64-fallback.img
Found linux image: /boot/vmlinuz-5.4-x86_64
Found initrd image: /boot/intel-ucode.img /boot/initramfs-5.4-x86_64.img
Found initrd fallback image: /boot/initramfs-5.4-x86_64-fallback.img
Found memtest86+ image: /boot/memtest86+/memtest.bin
Found memtest86+ image: /boot/memtest86+/memtest.bin
error: syntax error.
error: Incorrect command.
error: syntax error.
Syntax error at line 246
Syntax errors are detected in generated GRUB config file.
Ensure that there are no errors in /etc/default/grub
and /etc/grub.d/* files or please file a bug report with
/boot/grub/grub.cfg.new file attached.

No matter how many times I try to reinstall grub, this keep happening.

Hello,

Please share from terminal:
cat /etc/default/grub
and attach here https://pastebin.com/ the content of the /boot/grub/grub.cfg.new file.

I guess that you use or have used grub-customizer. It tampers with grub scripts in /etc/grub.d and error is coming from it. I recommend you:

  • to uninstall grub customizer if installed: sudo pacman -R grub-customizer
  • delete or move scripts folder: sudo mv /etc/grub.d{,.bak}
  • Regenerate scripts folder by reinstalling grub: sudo pacman -S grub

And now update-grub should work (and scripts old folder can be deleted)

2 Likes

Oh wow, it really was that simple. Thanks for the fix!
I remember I was trying to add windows into the bootloader one time since I was duel booting with 2 different drives and something went wrong.

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