Grub says "Incorrect command" and "syntax error" when updating grub config

the problem is in the title, i just was using grub customizer and it made this error all the time, updating grub manually via terminal didnt work too, what is the issue here? Grub cfg down below:

# GRUB boot loader configuration

GRUB_DEFAULT="0"
GRUB_TIMEOUT="5"
GRUB_DISTRIBUTOR="EndeavourOS"
GRUB_CMDLINE_LINUX_DEFAULT="nowatchdog nvme_load=YES loglevel=3"
GRUB_CMDLINE_LINUX=""

# Preload both GPT and MBR modules so that they are not missed
GRUB_PRELOAD_MODULES="part_gpt part_msdos"

# Uncomment to enable booting from LUKS encrypted devices
#GRUB_ENABLE_CRYPTODISK="y"

# Set to 'countdown' or 'hidden' to change timeout behavior,
# press ESC key to display menu.
GRUB_TIMEOUT_STYLE="menu"

# Uncomment to use basic console
GRUB_TERMINAL_INPUT="console"

# Uncomment to disable graphical terminal
#GRUB_TERMINAL_OUTPUT="console"

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `videoinfo'
GRUB_GFXMODE="auto"

# Uncomment to allow the kernel use the same resolution used by grub
GRUB_GFXPAYLOAD_LINUX="keep"

# Uncomment if you want GRUB to pass to the Linux kernel the old parameter
# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx"
#GRUB_DISABLE_LINUX_UUID="true"

# Uncomment to disable generation of recovery mode menu entries
GRUB_DISABLE_RECOVERY="true"

# Uncomment and set to the desired menu colors.  Used by normal and wallpaper
# modes only.  Entries specified as foreground/background.
#GRUB_COLOR_NORMAL="light-blue/black"
#GRUB_COLOR_HIGHLIGHT="light-cyan/blue"

# Uncomment one of them for the gfx desired, a image background or a gfxtheme
GRUB_BACKGROUND="/usr/share/endeavouros/splash.png"

# Uncomment to get a beep at GRUB start
#GRUB_INIT_TUNE="480 440 1"

# Uncomment to make GRUB remember the last selection. This requires
# setting 'GRUB_DEFAULT=saved' above.
#GRUB_SAVEDEFAULT="true"

Thanks in advance!
Artgamer.

I would strongly recommend against this. We have to help tons of people who broke their grub via grub-customizer.

That being said, in your case, you probably need to remove this exatra line from the top of your config:

  GNU nano 7.2  
4 Likes

oh yeah, my bad :sweat_smile:

1 Like

Okay, but what now? How am i going to fix this?

why did you edit your post by deleting
GNU nano 7.2 ? so nobody sees the original issue

Can we see the full output of sudo grub-mkconfig

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_gpt
insmod ext2
set root='hd1,gpt5'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt5 --hint-efi=hd1,gpt5 --hint-baremetal=ahci1,gpt5  0f398b0f-820e-4783-a7ae-d452c0b25904
else
  search --no-floppy --fs-uuid --set=root 0f398b0f-820e-4783-a7ae-d452c0b25904
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_input console
terminal_output gfxterm
Found theme: /boot/grub/themes/msi/theme.txt
insmod part_gpt
insmod ext2
set root='hd1,gpt5'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt5 --hint-efi=hd1,gpt5 --hint-baremetal=ahci1,gpt5  0f398b0f-820e-4783-a7ae-d452c0b25904
else
  search --no-floppy --fs-uuid --set=root 0f398b0f-820e-4783-a7ae-d452c0b25904
fi
insmod gfxmenu
loadfont ($root)/boot/grub/themes/msi/terminus-12.pf2
loadfont ($root)/boot/grub/themes/msi/terminus-14.pf2
loadfont ($root)/boot/grub/themes/msi/terminus-16.pf2
loadfont ($root)/boot/grub/themes/msi/terminus-18.pf2
loadfont ($root)/boot/grub/themes/msi/ubuntu_regular_17.pf2
loadfont ($root)/boot/grub/themes/msi/ubuntu_regular_20.pf2
insmod png
set theme=($root)/boot/grub/themes/msi/theme.txt
export theme
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux_proxy ###
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/intel-ucode.img /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot:  intel-ucode.img initramfs-linux-fallback.img




menuentry "EndeavourOS Linux" --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-0f398b0f-820e-4783-a7ae-d452c0b25904' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_gpt
	insmod ext2
	set root='hd1,gpt5'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt5 --hint-efi=hd1,gpt5 --hint-baremetal=ahci1,gpt5  0f398b0f-820e-4783-a7ae-d452c0b25904
	else
	  search --no-floppy --fs-uuid --set=root 0f398b0f-820e-4783-a7ae-d452c0b25904
	fi
	echo	'Loading Linux linux ...'
	linux	/boot/vmlinuz-linux root=UUID=0f398b0f-820e-4783-a7ae-d452c0b25904 rw  nowatchdog nvme_load=YES loglevel=3
	echo	'Loading initial ramdisk ...'
	initrd	/boot/intel-ucode.img /boot/initramfs-linux.img
}
### END /etc/grub.d/10_linux_proxy ###

### BEGIN /etc/grub.d/45_eos_windows_proxy ###
menuentry "Windows" --class windows --class os $menuentry_id_option 'osprober-efi-04FE-87E8' {
	insmod part_gpt
	insmod fat
	set root='hd1,gpt1'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt1 --hint-efi=hd1,gpt1 --hint-baremetal=ahci1,gpt1  04FE-87E8
	else
	  search --no-floppy --fs-uuid --set=root 04FE-87E8
	fi
	chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
### END /etc/grub.d/45_eos_windows_proxy ###

### BEGIN /etc/grub.d/46_custom_proxy ###
menuentry "Go to BIOS (UEFI)" $menuentry_id_option 'uefi-firmware' {
			fwsetup
}
### END /etc/grub.d/46_custom_proxy ###

### BEGIN /etc/grub.d/47_linux_proxy ###
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/intel-ucode.img /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot:  intel-ucode.img initramfs-linux-fallback.img
submenu "Advanced options for EndeavourOS Linux"{
menuentry "EndeavourOS Linux, with Linux linux" --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-0f398b0f-820e-4783-a7ae-d452c0b25904' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt
		insmod ext2
		set root='hd1,gpt5'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt5 --hint-efi=hd1,gpt5 --hint-baremetal=ahci1,gpt5  0f398b0f-820e-4783-a7ae-d452c0b25904
		else
		  search --no-floppy --fs-uuid --set=root 0f398b0f-820e-4783-a7ae-d452c0b25904
		fi
		echo	'Loading Linux linux ...'
		linux	/boot/vmlinuz-linux root=UUID=0f398b0f-820e-4783-a7ae-d452c0b25904 rw  nowatchdog nvme_load=YES loglevel=3
		echo	'Loading initial ramdisk ...'
		initrd	/boot/intel-ucode.img /boot/initramfs-linux.img
}
menuentry "EndeavourOS Linux, with Linux linux (fallback initramfs)" --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-0f398b0f-820e-4783-a7ae-d452c0b25904' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt
		insmod ext2
		set root='hd1,gpt5'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt5 --hint-efi=hd1,gpt5 --hint-baremetal=ahci1,gpt5  0f398b0f-820e-4783-a7ae-d452c0b25904
		else
		  search --no-floppy --fs-uuid --set=root 0f398b0f-820e-4783-a7ae-d452c0b25904
		fi
		echo	'Loading Linux linux ...'
		linux	/boot/vmlinuz-linux root=UUID=0f398b0f-820e-4783-a7ae-d452c0b25904 rw  nowatchdog nvme_load=YES loglevel=3
		echo	'Loading initial ramdisk ...'
		initrd	/boot/intel-ucode.img /boot/initramfs-linux-fallback.img
}
}
### END /etc/grub.d/47_linux_proxy ###

### BEGIN /etc/grub.d/48_linux_xen ###
### END /etc/grub.d/48_linux_xen ###

### BEGIN /etc/grub.d/49_os-prober ###
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
### END /etc/grub.d/49_os-prober ###

### BEGIN /etc/grub.d/50_uefi-firmware_proxy ###
Adding boot menu entry for UEFI Firmware Settings ...

if [ "$grub_platform" = "efi" ]; then
	fwsetup --is-supported
	if [ "$?" = 0 ]; then

	fi
fi
### END /etc/grub.d/50_uefi-firmware_proxy ###

### BEGIN /etc/grub.d/51_custom_proxy ###

# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.




### END /etc/grub.d/51_custom_proxy ###

### BEGIN /etc/grub.d/52_eos_windows_proxy ###



### END /etc/grub.d/52_eos_windows_proxy ###

### BEGIN /etc/grub.d/53_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg
fi
### END /etc/grub.d/53_custom ###

### BEGIN /etc/grub.d/54_grub-customizer_menu_color_helper ###
### END /etc/grub.d/54_grub-customizer_menu_color_helper ###

That being said, in your case, you probably need to remove this exatra line from the top of your config: gnu nano 7.2
^^

So what is the issue at this point?

i cant update the config

yeah in the file “grub” but NOT in the first posting in the forum… :rofl:

What does this mean?

Where can’t you you update the config? How are you trying? What error are you getting?

1 Like

If you are on legacy (bios) grub, you might want to take a closer look to this forum entry:

1 Like

im on UEFI

this:

Generating grub configuration file ...
Found theme: /boot/grub/themes/msi/theme.txt
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/intel-ucode.img /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot:  intel-ucode.img initramfs-linux-fallback.img
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/intel-ucode.img /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot:  intel-ucode.img initramfs-linux-fallback.img
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
error: syntax error.
error: Incorrect command.
error: syntax error.
Syntax error at line 207
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.

Would it be possible to get all the information at once?

What did you do to generate that output? What specific command did you run?

1 Like

sigh…

sudo grub-mkconfig -o /boot/grub/grub.cfg

But none of those errors in the output above when I asked you to run sudo grub-mkconfig

yes, but the issue is that i cant edit anything without this error, which basically doesnt let me able to configure grub, which makes it a mess.

What does this mean? Please stop only sharing part of the information.

Did you make a change between running sudo grub-mkconfig and sudo grub-mkconfig -o /boot/grub.cfg? If so, what change did you make and how did you make it?

2 Likes