Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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"
share|improve this question
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

2 Answers 2

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

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.