4

When I run

sudo update-grub

I get the following error:

/usr/sbin/grub-mkconfig: 1: /etc/default/grub: #: not found

This is my /etc/default/grub:

# 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=0 GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` 
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX="splash quiet"

# 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"
  • 2
    The formating in the first lines of the file seems pretty messed up. There must not be more than one option per line. The error message does not reflect this though and there might be something else wrong in addition. – Paul Hänsch Oct 20 '13 at 22:21
  • What command did you run? Also the output of ls -l /etc/default/grub and cat /etc/default/grub. – Braiam Oct 20 '13 at 22:33
  • One GRUB option per line, as Paul says. – user85164 Oct 21 '13 at 0:55
  • The particular error #: not found suggests that there may be a hidden (non-printing) character or characters in the file as well - a cat -nv might help if so. If all else fails, there should be a 'clean' grub file at /usr/share/grub/default/grub (at least in grub2). – steeldriver Oct 21 '13 at 12:45
  • For me I copied a new tune from a page and it had a fancy ″ instead of the proper ". Hope that helps someone – Michael Mantion Oct 5 '17 at 16:19
4

Try editing the file using gksudo gedit /etc/default/grub.

In your file, change the line

GRUB_DEFAULT=0 GRUB_HIDDEN_TIMEOUT=0

to

GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0

That is, there should be only one option in every line. Also, in the line that're commented out, inserting a space after a # where it isn't would be a good idea.

2

One of the issues was in this block:

GRUB_DEFAULT=0  #Add newline here
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=5 #Add newline here too
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` 
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX="splash quiet"

There should be one variable per line in the file.

However, there may be other problems too as the error message is saying something else entirely. Try this, and then update your question.

2

This happened to me when I edited the file with OpenOffice Writer rather than pluma/gedit. I assume it added some kind of weird unicode characters.
I fixed it with

sudo cp /usr/share/grub/default/grub /etc/default/grub
  • I was looking for a solution like this for hours. Thank you. – BCR Aug 22 '18 at 19:58

protected by Community Sep 27 '17 at 19:07

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.