Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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_TIMEOUT=5 GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` 
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 ...)

# Uncomment to disable graphical terminal (grub-pc only)

# 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'

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

# Uncomment to disable generation of recovery mode menu entries

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
share|improve this question
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

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

In your file, change the line




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.

share|improve this answer

One of the issues was in this block:

GRUB_DEFAULT=0  #Add newline here
GRUB_TIMEOUT=5 #Add newline here too
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` 
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.

share|improve this answer

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
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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