2

I've read several previous questions and found no solution. Where I run the update-grub command it gives me this output:

root@Agustin-Ubuntu:/home/agustin# update-grub
Generating grub.cfg ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-3.5.0-45-generic
Found initrd image: /boot/initrd.img-3.5.0-45-generic
Found linux image: /boot/vmlinuz-3.5.0-43-generic
Found initrd image: /boot/initrd.img-3.5.0-43-generic
Found linux image: /boot/vmlinuz-3.5.0-40-generic
Found initrd image: /boot/initrd.img-3.5.0-40-generic
Found linux image: /boot/vmlinuz-3.5.0-39-generic
Found initrd image: /boot/initrd.img-3.5.0-39-generic
Found linux image: /boot/vmlinuz-3.5.0-37-generic
Found initrd image: /boot/initrd.img-3.5.0-37-generic
Found linux image: /boot/vmlinuz-3.5.0-36-generic
Found initrd image: /boot/initrd.img-3.5.0-36-generic
Found linux image: /boot/vmlinuz-3.5.0-34-generic
Found initrd image: /boot/initrd.img-3.5.0-34-generic
Found linux image: /boot/vmlinuz-3.5.0-23-generic
Found initrd image: /boot/initrd.img-3.5.0-23-generic
Found Windows 8 (loader) on /dev/sda1
Found linux image: /boot/vmlinuz-3.5.0-45-generic
Found initrd image: /boot/initrd.img-3.5.0-45-generic
Found linux image: /boot/vmlinuz-3.5.0-43-generic
Found initrd image: /boot/initrd.img-3.5.0-43-generic
Found linux image: /boot/vmlinuz-3.5.0-40-generic
Found initrd image: /boot/initrd.img-3.5.0-40-generic
Found linux image: /boot/vmlinuz-3.5.0-39-generic
Found initrd image: /boot/initrd.img-3.5.0-39-generic
Found linux image: /boot/vmlinuz-3.5.0-37-generic
Found initrd image: /boot/initrd.img-3.5.0-37-generic
Found linux image: /boot/vmlinuz-3.5.0-36-generic
Found initrd image: /boot/initrd.img-3.5.0-36-generic
Found linux image: /boot/vmlinuz-3.5.0-34-generic
Found initrd image: /boot/initrd.img-3.5.0-34-generic
Found linux image: /boot/vmlinuz-3.5.0-23-generic
Found initrd image: /boot/initrd.img-3.5.0-23-generic
Found memtest86+ image: /boot/memtest86+.bin
Found linux image: /boot/vmlinuz-3.5.0-45-generic
Found initrd image: /boot/initrd.img-3.5.0-45-generic
Found linux image: /boot/vmlinuz-3.5.0-43-generic
Found initrd image: /boot/initrd.img-3.5.0-43-generic
Found linux image: /boot/vmlinuz-3.5.0-40-generic
Found initrd image: /boot/initrd.img-3.5.0-40-generic
Found linux image: /boot/vmlinuz-3.5.0-39-generic
Found initrd image: /boot/initrd.img-3.5.0-39-generic
Found linux image: /boot/vmlinuz-3.5.0-37-generic
Found initrd image: /boot/initrd.img-3.5.0-37-generic
Found linux image: /boot/vmlinuz-3.5.0-36-generic
Found initrd image: /boot/initrd.img-3.5.0-36-generic
Found linux image: /boot/vmlinuz-3.5.0-34-generic
Found initrd image: /boot/initrd.img-3.5.0-34-generic
Found linux image: /boot/vmlinuz-3.5.0-23-generic
Found initrd image: /boot/initrd.img-3.5.0-23-generic
Found Windows 8 (loader) on /dev/sda1
error: syntax error.
error: Incorrect command.
error: syntax error.
error: Incorrect command.
error: syntax error.
error: line no: 165
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.
done

The problem here is that the Grub Customizer is not being updated after the update to the 3.5.0-45-generic version, so the entries in the menu are all messed up and i cant get them in the order I want because the Grub Customizer has no effect, it is displaying the proper new entries but it doesn't modify the menu when I boot.

This is my /etc/default/grub file:

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT="1"
#GRUB_HIDDEN_TIMEOUT="0" 
GRUB_HIDDEN_TIMEOUT_QUIET="true" 
GRUB_TIMEOUT="10" 
GRUB_DISTRIBUTOR="`lsb_release -i -s 2> /dev/null || echo Debian`" 
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL="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 `vbeinfo'
#GRUB_GFXMODE="640x480"

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID="true"

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

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

GRUB_SAVEDEFAULT="false"
mchid
  • 43,546
  • 8
  • 97
  • 150
  • your question is similar to - http://askubuntu.com/questions/594924/syntax-error-at-line-245-update-grub-grub-customiser) .so it could solve your problem. – ramkiran Apr 09 '15 at 14:00
  • Grub Customizer edits or creates files in your /etc/default/grub.d directory which is why there is nothing wrong with your /etc/default/grub file. – mchid Feb 02 '20 at 00:20

5 Answers5

2

Grub Customizer adds or edits files in /etc/default/grub.d so the file you need to fix is in this directory, which is why there is nothing wrong with your /etc/default/grub file.

Additionally, the error tells you to inspect line 165 and the file you need to inspect is /boot/grub/grub.cfg.new.

So, go to the file /boot/grub/grub.cfg.new and scroll down to line number 165. This is where the syntax error is. At the beginning of each section of code, there is a line that starts with ### BEGIN followed by a configuration file name. This is the file that contains the error you need to fix.

See this detailed example by user @donquixote.

mchid
  • 43,546
  • 8
  • 97
  • 150
2

I just checked my /etc/default/grub and it looks the same as in your pastebin, but I also get this warning since the default-installation of Ubuntu 14.04 Trusty Thar.

So this does not help for me. The result is still the same. And I found that there is a big discussion already there on launchpad. Just look here:

https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1258597

But the comment #10 on this link shows the trick, how to sort things out. The file /etc/default/grub needs to be edited at the second line and at the third line as shown on the comment #10 on this above link of launchpad:

sudo gedit /etc/default/grub
GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=countdown
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i915.modeset=1"
GRUB_CMDLINE_LINUX=""

Then do:

sudo update-grub

This sorts things out...

guntbert
  • 13,134
Andrea
  • 21
1

I have saved an original /etc/default/grub file in my pastebin for such situations. Open a terminal and do

sudo cp /etc/default/grub ~/default-grub.bad
sudo wget "http://pastebin.com/raw.php?i=g3TMZgTP" -o /etc/default/grub 
sudo update-grub 

See the file in raw format here

Additional suggestion:

You have a bunch of kernels installed. Try to remove the old ones. You can use a program such as ubuntu-tweak or synaptic.

NickTux
  • 17,539
1

I had a similar problem that I resolved it just deleting a menu I had in Grub Customizer. After removing this menu, Grub Customizer has started to save again without problems.

Paolo
  • 111
  • 3
0

You have screwed up your /etc/default/grub file by placing several commands on a single line that is commented out, but broke up the last one in half on the next line that is not a comment. "echo Debian`" GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"" is part of the previous command and must be on the same line.

psusi
  • 37,551