'update-grub' syntax error

2,962

Solution 1

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...

Solution 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.

Solution 3

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.

Solution 4

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.

Share:
2,962

Related videos on Youtube

SmartDeveloper
Author by

SmartDeveloper

Updated on September 18, 2022

Comments

  • SmartDeveloper
    SmartDeveloper over 1 year

    I have read and researched this throughout the internet and hoping now someone can help me through this. I am writing to read three different text files with different names, but I need to read through the text file name in order to determine which method I have to execute for that particular file. This is what I have so far, any help would be greatly appreciated.

    var readers = new List<StreamReader>();
    
    foreach (var filename in names_of_files)
    {
        if (do something?)
        {
            switch
        }
    }
    
    using (StreamReader file = new StreamReader(filename))
    {
      (reads the file and does other stuff)
    }
    

    Below is the method that I am using to select multiple files.

    private void LoadNewFile()
    {
        OpenFileDialog ofd = new OpenFileDialog();
        ofd.Multiselect = true;
        System.Windows.Forms.DialogResult dr = ofd.ShowDialog();
        ofd.Filter = "Text Files(*.txt) | *.txt";
    
        foreach (String file in ofd.FileNames)
        {
            if (dr == DialogResult.OK)
            {
                userSelectedFilePath += file;
                names_of_files.Add(userSelectedFilePath);
            }
        }
    }
    
    • ramkiran
      ramkiran about 9 years
      your question is similar to - askubuntu.com/questions/594924/…) .so it could solve your problem.
    • Dour High Arch
      Dour High Arch over 7 years
      It is not clear what you want. If you need to do something different depending on file name then in your foreach you could do something like if (filename == "first name") DoFirstThing() ; else if (filename == "second name") DoSecondThing();.
    • mchid
      mchid about 4 years
      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.
  • SmartDeveloper
    SmartDeveloper over 7 years
    What if the file names are different everytime?
  • GantTheWanderer
    GantTheWanderer over 7 years
    You explained in the question "I need to read through the text file name in order to determine which method I have to execute for that particular file." What is it about the file name that allows you determine what to do with it? And what are you trying to acheive?
  • SmartDeveloper
    SmartDeveloper over 7 years
    I have three different types of files with three different names(new file for everyday with date), I need to run through each file. I was able to use the contains but now getting "The given paths format is not supported".
  • GantTheWanderer
    GantTheWanderer over 7 years
    Can you provide the name of the file when that error happens?