Update grub error

When I run update-grub or I try to reinstall it, I get a "syntax error". The output is somewhat like this: error: syntax error. error: Incorrect command. error: syntax error. error: line no: 262 ...

For me it was a very specific answer, but I want to explain in a more general way how to troubleshoot this.

Actually a lot of the information is already in the error message, but to me it was not obvious at first.

In short:

  • Follow the line number, in /boot/grub/grub.cfg.new. Try to understand why what you find there is a syntax error.
  • Follow the comment in this file, that points to either /etc/default/grub, or a specific file in /etc/grub/*.
  • In case of a proxy script, follow the hint to a file in /etc/grub.d/proxifiedScripts/.

Troubleshooting steps, in detail

The /boot/grub/grub.cfg is automatically created on «update-grub», based on a number of files: /etc/default/grub, and any files in /etc/grub.d/*.

/boot/grub/grub.cfg.new
However, in case of a syntax error (or any error, I suppose), the original /boot/grub/grub.cfg is NOT overwritten, but instead the new file is created in /boot/grub/grub.cfg.new.

The error message contains a line number, in my case 262, that refers to this /boot/grub/grub.cfg.new file. In my case, this was 262. Looking at the file, I found this:

### BEGIN /etc/grub.d/60_memtest86+_proxy ###
if [ "${grub_platform}" == "pc" ]; then
fi
### END /etc/grub.d/60_memtest86+_proxy ###

I learned that en empty if/then/fi block in shell script is not allowed, so this was the syntax error. Quite stupid language design imo, but this is how it is.

I also found a fix, which is to add a meaningless statement in the block. A colon was suggested, but there might be other solutions.

### BEGIN /etc/grub.d/60_memtest86+_proxy ###
if [ "${grub_platform}" == "pc" ]; then
    :
fi
### END /etc/grub.d/60_memtest86+_proxy ###

Even better would be to remove this meaningless block completely.

Now we don’t really want to edit this file manually, because the changes would be wiped on the next update-grub (if successful, which is the goal).

/etc/grub.d/*
The snippet contains a hint where to look next: /etc/grub.d/60_memtest86+_proxy. This file says:

#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/memtest86+' | /etc/grub.d/bin/grubcfg_proxy "+*
+#text
-'Memory Tester (memtest86+)'~30b99791e52c3f0cb32601c5b8f57cc7~
"

/etc/grub.d/proxifiedScripts/*
The relevant part of /etc/grub.d/proxifiedScripts/memtest86+ is this:

    [..]
    cat << EOF
if [ "${grub_platform}" == "pc" ]; then
    menuentry "Memory Tester (memtest86+)" ${CLASS} {
        search --fs-uuid --no-floppy --set=root ${_GRUB_MEMTEST_HINTS_STRING} ${_GRUB_MEMTEST_FS_UUID}
        linux16 ${_GRUB_MEMTEST_REL_PATH} ${GRUB_CMDLINE_MEMTEST86}
    }
fi
EOF
[..]

The file itself is a shell script, but then it has those «cat» statements. These print the shell script snippets that should finally go into /boot/grub/grub.cfg. With some modifications, maybe.

In the /boot/grub/grub.cfg.new, we observe that the «menuentry …» stuff is actually missing, and instead we get an empty then..fi block. Why the «menuentry …» disappears, I don’t know. Maybe grub thinks that it is not needed. Unfortunately, the removal breaks the script.

Workaround

The trick / workaround was to add a colon in this file, like this:

if [ "${grub_platform}" == "pc" ]; then
    :
    menuentry "Memory Tester (memtest86+)" ${CLASS} {
        search --fs-uuid --no-floppy --set=root ${_GRUB_MEMTEST_HINTS_STRING} ${_GRUB_MEMTEST_FS_UUID}
        linux16 ${_GRUB_MEMTEST_REL_PATH} ${GRUB_CMDLINE_MEMTEST86}
    }

When running update-grub, this generates a grub.cfg with the workaround described above.

Background / More investigation

The /etc/grub.d/ folder on my system actually contained two files for memtest86+_proxy: 60_memtest86+_proxy and 62_memtest86+_proxy. I assume that one of them is a leftover of some sort. But both of them have the same updated timestamp, so I really don’t know which of them would be safe to delete. A diff shows this:

--- /etc/grub.d/60_memtest86+_proxy 2015-01-08 15:54:02.228927526 +0100
+++ /etc/grub.d/62_memtest86+_proxy 2015-01-08 15:54:02.228927526 +0100
@@ -1,6 +1,6 @@
 #!/bin/sh
 #THIS IS A GRUB PROXY SCRIPT
-'/etc/grub.d/proxifiedScripts/memtest86+' | /etc/grub.d/bin/grubcfg_proxy "+*
-+#text
--'Memory Tester (memtest86+)'~30b99791e52c3f0cb32601c5b8f57cc7~
+'/etc/grub.d/proxifiedScripts/memtest86+' | /etc/grub.d/bin/grubcfg_proxy "+'Memory Tester (memtest86+)'~30b99791e52c3f0cb32601c5b8f57cc7~
+-*
+-#text
 "
 No newline at end of file

So, both of the files refer to the same proxified script, but the result is piped through the grubcfg_proxy binary, with different parameters. These different parameters could be responsible for removing the «menuentry …» stuff in case of the 60_memtest86+_proxy.

Conclusion

Others may have completely different problems. But the troubleshooting, at least the first steps, should be quite similar.

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"

For me it was a very specific answer, but I want to explain in a more general way how to troubleshoot this.

Actually a lot of the information is already in the error message, but to me it was not obvious at first.

In short:

  • Follow the line number, in /boot/grub/grub.cfg.new. Try to understand why what you find there is a syntax error.
  • Follow the comment in this file, that points to either /etc/default/grub, or a specific file in /etc/grub/*.
  • In case of a proxy script, follow the hint to a file in /etc/grub.d/proxifiedScripts/.

Troubleshooting steps, in detail

The /boot/grub/grub.cfg is automatically created on «update-grub», based on a number of files: /etc/default/grub, and any files in /etc/grub.d/*.

/boot/grub/grub.cfg.new
However, in case of a syntax error (or any error, I suppose), the original /boot/grub/grub.cfg is NOT overwritten, but instead the new file is created in /boot/grub/grub.cfg.new.

The error message contains a line number, in my case 262, that refers to this /boot/grub/grub.cfg.new file. In my case, this was 262. Looking at the file, I found this:

### BEGIN /etc/grub.d/60_memtest86+_proxy ###
if [ "${grub_platform}" == "pc" ]; then
fi
### END /etc/grub.d/60_memtest86+_proxy ###

I learned that en empty if/then/fi block in shell script is not allowed, so this was the syntax error. Quite stupid language design imo, but this is how it is.

I also found a fix, which is to add a meaningless statement in the block. A colon was suggested, but there might be other solutions.

### BEGIN /etc/grub.d/60_memtest86+_proxy ###
if [ "${grub_platform}" == "pc" ]; then
    :
fi
### END /etc/grub.d/60_memtest86+_proxy ###

Even better would be to remove this meaningless block completely.

Now we don’t really want to edit this file manually, because the changes would be wiped on the next update-grub (if successful, which is the goal).

/etc/grub.d/*
The snippet contains a hint where to look next: /etc/grub.d/60_memtest86+_proxy. This file says:

#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/memtest86+' | /etc/grub.d/bin/grubcfg_proxy "+*
+#text
-'Memory Tester (memtest86+)'~30b99791e52c3f0cb32601c5b8f57cc7~
"

/etc/grub.d/proxifiedScripts/*
The relevant part of /etc/grub.d/proxifiedScripts/memtest86+ is this:

    [..]
    cat << EOF
if [ "${grub_platform}" == "pc" ]; then
    menuentry "Memory Tester (memtest86+)" ${CLASS} {
        search --fs-uuid --no-floppy --set=root ${_GRUB_MEMTEST_HINTS_STRING} ${_GRUB_MEMTEST_FS_UUID}
        linux16 ${_GRUB_MEMTEST_REL_PATH} ${GRUB_CMDLINE_MEMTEST86}
    }
fi
EOF
[..]

The file itself is a shell script, but then it has those «cat» statements. These print the shell script snippets that should finally go into /boot/grub/grub.cfg. With some modifications, maybe.

In the /boot/grub/grub.cfg.new, we observe that the «menuentry …» stuff is actually missing, and instead we get an empty then..fi block. Why the «menuentry …» disappears, I don’t know. Maybe grub thinks that it is not needed. Unfortunately, the removal breaks the script.

Workaround

The trick / workaround was to add a colon in this file, like this:

if [ "${grub_platform}" == "pc" ]; then
    :
    menuentry "Memory Tester (memtest86+)" ${CLASS} {
        search --fs-uuid --no-floppy --set=root ${_GRUB_MEMTEST_HINTS_STRING} ${_GRUB_MEMTEST_FS_UUID}
        linux16 ${_GRUB_MEMTEST_REL_PATH} ${GRUB_CMDLINE_MEMTEST86}
    }

When running update-grub, this generates a grub.cfg with the workaround described above.

Background / More investigation

The /etc/grub.d/ folder on my system actually contained two files for memtest86+_proxy: 60_memtest86+_proxy and 62_memtest86+_proxy. I assume that one of them is a leftover of some sort. But both of them have the same updated timestamp, so I really don’t know which of them would be safe to delete. A diff shows this:

--- /etc/grub.d/60_memtest86+_proxy 2015-01-08 15:54:02.228927526 +0100
+++ /etc/grub.d/62_memtest86+_proxy 2015-01-08 15:54:02.228927526 +0100
@@ -1,6 +1,6 @@
 #!/bin/sh
 #THIS IS A GRUB PROXY SCRIPT
-'/etc/grub.d/proxifiedScripts/memtest86+' | /etc/grub.d/bin/grubcfg_proxy "+*
-+#text
--'Memory Tester (memtest86+)'~30b99791e52c3f0cb32601c5b8f57cc7~
+'/etc/grub.d/proxifiedScripts/memtest86+' | /etc/grub.d/bin/grubcfg_proxy "+'Memory Tester (memtest86+)'~30b99791e52c3f0cb32601c5b8f57cc7~
+-*
+-#text
 "
 No newline at end of file

So, both of the files refer to the same proxified script, but the result is piped through the grubcfg_proxy binary, with different parameters. These different parameters could be responsible for removing the «menuentry …» stuff in case of the 60_memtest86+_proxy.

Conclusion

Others may have completely different problems. But the troubleshooting, at least the first steps, should be quite similar.

Contents

  1. Overview
  2. GRUB 2 Terminal Commands

    1. Normal
    2. grub>
    3. grub rescue>
  3. General Troubleshooting Preparation

    1. Boot-Repair
    2. Search & Set

      1. How & Where to Search
  4. Specific Troubleshooting

    1. grub>
    2. grub rescue>
    3. GRUB
  5. Editing the GRUB 2 Menu During Boot

    1. Key Points About Terminal Menu Editing:
    2. Menu Editing Examples
  6. Post Boot Follow Up
  7. Fallback mode
  8. GRUB 2 Errors

    1. Selected Problems and Bugs

      1. External Drive Installs and »grub-pc» Updates
      2. External Drive Installs and MBR Selection
      3. Boot Partition is in Logical Volume whose Volume Group contains a snapshot
      4. insmod fails with «error: no such disk»
  9. Links

This page provides the user with information on options available for repairing GRUB 2 boot issues and specific instructions on how to use the GRUB 2 terminal. The instructions are written for GRUB 1.99, which is the version of GRUB 2 which is included on Ubuntu 11.04, Natty Narwhal, and later. Differences for version 1.98 (Ubuntu 10.4, Lucid Lynx) are noted when the procedures differ.

  • g2_grub_rescue1.png

GRUB 2’s ability to fix boot problems is greatly improved over the original GRUB bootloader. In addition to an automatic fallback mode if booting from a menuentry in a submenu, GRUB 2 allows the user to edit its menu before the operating system is loaded. The rescue mode GRUB 2 terminal can help boot an operating system so that permanent repairs to system files can be made.

The instructions on this page are written for a fully-installed Ubuntu operating system. WUBI boot problems are not covered in detail although they are addressed in several sections.

Overview

GRUB 2 boot problems can leave the system in several states. The user may see one of the following displays on the monitor when a boot fails. The display provides the first indication of what might be causing the failure to boot. Here are the failure prompts and displays, and the possible cause of each:

  • grub> prompt: GRUB 2 loaded modules but was unable to find the grub.cfg file.

  • grub rescue> prompt: GRUB 2 failed to find its grub folder, or failed to load the normal module.

  • grub>: — The grub prompt on a blank screen.

    • GRUB 2 has found the boot information but has been either unable to locate or unable to use an existing GRUB 2 configuration file (usually grub.cfg).

  • grub rescue>: — The rescue mode.

    • GRUB 2 is unable to find the grub folder or its contents are missing/corrupted. The grub folder contains the GRUB 2 menu, modules and stored environmental data.

  • GRUB — a single word at the top left of the screen, with no prompt and no cursor.

    • GRUB has failed to find even the most basic information, usually contained in the MBR or boot sector.
  • Busybox or Initramfs: GRUB 2 began the boot process but there was a problem passing control to the operating system. Possible causes include an incorrect UUID or root= designation in the ‘linux’ line or a corrupted kernel.

  • Frozen splash screen, blinking cursor with no grub> or grub rescue prompt. Possible video issues with the kernel. While these failures are not of GRUB 2’s making, it may still be able to help. GRUB 2 allows pre-boot editing of its menu and the user may restore functionality by adding and/or removing kernel options in a menuentry before booting.

Each of the GRUB 2 failure modes can normally be corrected either from the GRUB 2 terminal or by using an Ubuntu LiveCD. Additionally, there are compatible 3rd party bootable «rescue» CD/USB options which may also work. If using an Ubuntu LiveCD, it is recommended, but not always necessary, to use the same version CD as the system you are trying to repair. This ensures compatability of any modules and configuration files that may be loaded while attempting to repair the system.

GRUB 2 Terminal Commands

info.png Here are some useful tips and features for use with the GRUB 2 terminal:

  • Turning off the splash image. This may make viewing the terminal easier. Press c at the GRUB 2 menu to get to the command line and then type: set color_normal=white/blue or the color combination you wish to use. «black» as the second entry retains the menu’s transparency and should be avoided as a selection if the user wants to work with a solid background color.

  • TAB completion. This feature is very handy. At any point, pressing the TAB key may complete an entry, if the element is unique, or display available options. Typing a few additional characters and pressing TAB again may allow tab completion to finish the entry.

  • set pager=1 To prevent text from scrolling off the screen, type set pager=1.

  • Help. Type help to view a list of all the commands. Type help x to view help commands beginning with the letter «x». Tab completion and using the up arrow to repeat commands work the same as in a normal terminal.

Normal

When GRUB 2 is fully functional, the GRUB 2 terminal is accessed by pressing c. If the menu is not displayed during boot, hold down the SHIFT key until it appears. If it still does not appear, try pressing the ESC key repeatedly.

From a GRUB 2 terminal with the grub> prompt, a wide variety of commands are available.

  • A few of the more important commands:

    Command

    Result / Example

    boot

    Initiate the boot sequence, also F10 or CTRL-x

    cat

    Display the contents of readable files; cat (hd0,1)/boot/grub/grub.cfg

    configfile

    Load a GRUB 2 configuration file such as grub.cfg; configfile (hd0,5)/boot/grub/grub.cfg

    initrd

    Loads the initrd.img, necessary for booting; initrd (hd0,5)/initrd.img

    insmod

    Loads a module; insmod (hd0,5)/boot/grub/normal.mod, or insmod normal

    linux

    Loads the kernel; insmod /vmlinuz root=(hd0,5) ro

    loop

    Mount a file as a device; loopback loop (hd0,2)/iso/my.iso

    ls

    Lists the contents of a partition/folder; ls, ls /boot/grub, ls (hd0,5)/, ls (hd0,5)/boot

    lsmod

    List loaded modules

    normal

    Activate the normal module, if loaded

    search

    Search for a device. Type help search for the available options.

    set

    Review current settings, or set XXX to set a variable such as colors, prefix, root

    vbeinfo

    Display GRUB 2 available resolutions

    To view the complete command list, type help. For details on a particular command, type help [command]

grub>

When GRUB 2 is unable to boot or display the GRUB 2 menu the system will be left at a GRUB 2 terminal if possible. If the system boots to the grub> prompt, the usual modules and commands are normally available. The user may need to manually load modules using the insmod [module] command before some commands will work.

grub rescue>

In the grub rescue mode, only a limited set of commands are available. These commands are sufficient to investigate the contents of the drives, set prefix (path to the grub folder) and root (partition), load modules and boot.

The rescue mode provides fewer commands than the normal GRUB prompt line, but also provides these additional commands:

  • Command

    Result / Example

    dump

    Clears memory

    exit

    Exit GRUB 2

    normal

    Return to the standard «grub>» mode if possible.

Among the commands which can be used in the grub rescue mode:

  • boot

    cat

    chain

    help

    insmod

    linux

    ls

    multiboot

    normal

    search

    set

    unset

General Troubleshooting Preparation

Boot-Repair

The majority of this guide is devoted to working with the GRUB 2 terminal, which is used to enter commands to attempt to repair a broken bootloader. info.png Boot-Repair is a GUI application which can automatically analyze boot problems and select the proper course of action to repair them. Its simple interface provides beginners as well as experienced Linux users an easy method of repairing the majority of GRUB 2 problems.

Additionally, Boot-Repair contains an automated method to run a boot info script which performs a series of tests and provides a file containing much valuable information regarding the status of the computer’s operating and boot systems. This file can be inspected by community helpers on forums or IRC channels to help diagnose boot problems.

Boot-Repair can be run from a LiveCD or an operating Linux system. To download the package run the following commands:

  • sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt-get update
    sudo apt-get install -y boot-repair && boot-repair

Visit the Boot-Repair community document for more information.

Boot-Repair is available from the Launchpad repositories and can be run from a CD or a working Linux OS.

Search & Set

A great many boot problems are due to incorrect paths to required files. The GRUB 2 terminal, in either ‘failure’ mode, provides a robust ability to search hard drive(s) and partitions and to inspect their contents.

In order to boot successfully, the root, prefix, linux and initrd variables must be correct. The user must verify the paths and names of these items. If they are incorrect, use the commands below to find and fix them. GRUB 2 variable settings can be viewed with the set command.

In the following examples, X is a hard drive number; Y is a partition number. If a command example includes either of these replace them with the appropriate value.

How & Where to Search

In the graphic below, the text in red are commands to be entered by the user, and text in green is the output of the command on an operating system (i.e. what you would like to see if your Ubuntu installation is on sda1).

g2_grub_set_color.png

  • The first hard drive is 0. The first partition is 1. Thus sda1 becomes (hd0,1), sdb5 is (hd1,5).

  • Use the ls command in the follow manner

  • «Tab completion» may work — enter part of the filename and press the TAB key.

Command

Purpose

ls

Search the entire computer for devices and partitions: (hd0) (hd1) (hd0,1) (hd0,5) (hd1,1)

ls /

Search the root directory of the device designated as root (use the set command to check root).

ls (hdX,Y)

View information about a partition — format, size, UUID, etc.

ls (hdX,Y)/

View the root contents of a partition. Use this command to look for the presence of vmlinuz and initrd.img symlinks

ls (hdX,Y)/boot/

View the contents of a folder

ls (hdX,Y)/boot/

Inspect the /boot folder. It should contain the actual kernel (linux-3.2…) and initrd image (initrd.img-3.2….)

ls (hdX,Y)/boot/grub/

Inspect the /boot/grub folder. It should contain grub.cfg and many *.mod files. If looking for a specific file, include the name in the search to limit the number of returns. If available, the command set pager=1 will also limit returns to a single screen.

What to Look For

Where It Should Be (Default Installation)

Specific / General Search Example

grub.cfg

(hdX,Y)/boot/grub/ or /boot/grub/

ls (hdX,Y)/boot/grub/grub.cfg or ls /boot/grub/

vmlinuz

(hdX,Y)/ or /

ls (hdX,Y)/vmlinuz or ls /vmlinuz or ls /

linux-3.2.0-14*

(hdX,Y)/boot/ or /boot/

ls (hdX,Y)/boot/vmlinuz-3.2.0-14

initrd

(hdX,Y)/ or /

ls (hdX,Y)/ or ls /initrd

initrd.img-3.20-14

(hdX,Y)/ or /boot/

ls (hdX,Y)/boot/initrd.img-3.20-14 or ls (hdX,Y)/boot/

* Note: Use the full kernel name, including -generic, when searching or setting a kernel variable. Using the «TAB completion» technique may eliminate some typing and be more accurate if available.

Use the following commands to set these parameters (if incorrect). Substitute the correct value for X and Y. (Example: set root=(hdX,Y) becomes set root=(hd0,5) )

Task

Command

Notes

Set the prefix

set prefix=(hdX,Y)/boot/grub

Use the actual location of the grub folder

Set root

set root=(hdX,Y)

Set the kernel

linux /vmlinuz root=/dev/sda1 ro

Set the kernel if the symlink vmlinuz exists in /

Set the kernel

linux (hdX,Y)/boot/vmlinuz-3.0.2-14 root=/dev/sda1 ro

Set the kernel itself

Set the initrd image

initrd /initrd.img

Set the initrd image if the symlink exists in /

Set the initrd image

initrd (hdX,Y)/boot/initrd.img-3.0.2-14

Set the initrd image itself

Specific Troubleshooting

Use the section below based on the type of GRUB 2 terminal prompt displayed on the monitor.

important.png The commands which follow assume you have determined the proper parameters for prefix, root, linux, and initrd. Review the Search & Set section of this page for guidance .

grub>

Terminal Display: The GRUB 2 header/version information and a grub> prompt.

  • g2_grub>.png

If GRUB 2 leaves you at the grub> prompt, it has normally found the grub folder and loaded at least some basic modules. The configuration file (grub.cfg) may be missing, misnamed, or corrupted.

Quick Fix:

  • Use the Search & Set section to confirm the correct paths are set. Inspect the contents of the /boot/grub folder. Look for the grub.cfg file. It could be misnamed or missing. If not located in /boot/grub, use the ls command look for another .cfg file or look in /boot or other locations. If you locate the correct .cfg file:

  1. configfile /boot/grub/grub.cfg or configfile (hdX,Y)/boot/grub/grub.cfg

    If a .cfg with another name is located, substitute its path/filename in the command.

    If the configuration file is loaded and not corrupt, when the above command is executed the GRUB 2 menu should appear and the user can make a selection to boot. Once booted into the system, correct the filename or move the configuration file to its proper location. Run update-grub. If the configuration file is not found, a message will be generated and the user must enter the boot commands manually.

Extended Fix:

The following commands should set the root and prefix paths and load the kernel and initrd image. With this information, GRUB 2 does not need a configuration file and should be able to boot the system if the only problem was a corrupted or missing menu.

  • Press ENTER after completing each line. Some entries will not provide feedback. This is normal.

  • If a «file not found» or similar error message is displayed while running these commands, ensure you are using the correct X,Y values and the correct paths are set.

1. set root=(hdX,Y)

Confirm the correct X,Y values and press ENTER.

Example: If the Ubuntu system is on sda5, enter: set root=(hd0,5)

2. linux /vmlinuz root=/dev/sdXY ro

Example: linux /vmlinuz root=/dev/sda5 ro

If the vmlinuz symlink does not exist, use the full path to the kernel in /boot

Example: linux /boot/vmlinuz-3.2.0-14-generic root=/dev/sda1 ro

If successful, after ENTER there will be a slight delay and no messages.

  • Wubi users only — substitute these commands in Steps 1 and 2:

  • 1.set root=(loop0)

    2. linux /vmlinuz root=/dev/sdXY loop=/ubuntu/disks/root.disk ro

3. initrd /initrd.img

Selects the latest initrd image.

If the vmlinuz symlink does not exist, use the full path to the initrd image in /boot

If successful, after ENTER there will be a slight delay and no messages.

4. boot

Boot to the latest kernel on the selected partition.

If the system fails to boot:

  1. Attempt to find the GRUB 2 configuration file. The normal name is grub.cfg file. If not found, look for a misnamed .cfg file or in alternate locations. The menu configuration file may contain settings required for a successful boot (such as non-standard kernel options) even if the paths/filenames are correct.

    1. Use the set command to confirm the correct root and prefix settngs. Also inspect the folders’ actual contents with the ls command. The grub prompt normally means the GRUB 2 folder is intact but doesn’t guarantee the integrity of other system files.

    2. root= should point to the drive and partition on which Ubuntu is installed. If you use the ls / command you should see the main Ubuntu system folders.

If the system boots, please refer to the [[#Post-Boot Follow Up|Post Boot Follow Up] section

If the system fails to boot, proceed to the [#grub rescue|grub rescue]] section for more detailed troubleshooting options.

grub rescue>

The GRUB 2 rescue mode is a major enhancement to the GRUB bootloader. The presence of the grub rescue> prompt signifies that GRUB 2 has failed to find the grub folder, the grub.cfg file, and/or the associated modules. The rescue prompt is presented so the user can provide the path to the grub folder, load the necessary modules, and provide the proper boot commands.

  • g2_grub_rescue.png

A common reason for the grub rescue> prompt is an incorrect path to the grub folder. Reasons for the prompt also include a failure to update GRUB 2 after certain system or partition operations, improper designation of the grub folder location, missing linux or initrd.img symlinks in /, or a failed installation.

To successfully boot from the grub rescue> prompt:

  • The grub folder must exist and contain the necessary GRUB 2 files and modules.

  • The proper paths must be set via the set prefix command.

    • Many GRUB 2 commands will not work until the correct path is set.

      If the path to the grub folder (normally /boot/grub) is not correct, an unknown command or file not found message is likely.

  • The necessary modules must be loaded.
    • The kernel cannot be loaded until the ‘linux’ module is loaded.
  • A Linux kernel and initrd.img must be located and loaded.

Use the General Troubleshooting Preparation section to locate the correct partitions and file locations. Once the user has confirmed the paths and existence of the proper folders using the Search & Set section, run the following commands:

1. set prefix=(hdX,Y)/boot/grub

Use the values determined earlier.

Example: If the Ubuntu system is on sda5, enter: set prefix=(hd0,5)/boot/grub

2.* set root=(hdX,Y)

Confirm the correct X,Y values and press ENTER.

Example: If the Ubuntu system is on sda5, enter: set root=(hd0,5)

3. insmod normal

Load the normal module.

If the module loads there will be no message.

If the module fails to load, try the full path: insmod (hdX,Y)/boot/grub/normal.mod

4. normal

Transition to the normal GRUB 2 mode with increased functionality.

If the module loads there will be no message.

If the module loads, HELP, TAB completion and command recall using the UP/DN keys should be available.

5. set

(Optional) Review the current settings.

6. insmod linux

Load the linux module. An error message usually means the path is incorrect.

7.* linux /vmlinuz root=/dev/sdXY ro

Selects the latest kernel.

Example: linux /vmlinuz root=/dev/sda5 ro

If the vmlinuz symlink does not exist in /, use the full path to the kernel in /boot

Example: linux /boot/vmlinuz-3.2.0-14-generic root=/dev/sda1 ro

8. initrd /initrd.img

Selects the latest initrd image.

If the initrd symlink does not exist in /, use the full path to the initrd image in /boot

If successful, after ENTER there will be a slight delay and no messages.

9. boot

Boot to the latest kernel on the selected partition.

  • * Wubi users only — substitute these commands in Steps 2 and 7:

  • 1.set root=(loop0)

    2. linux /vmlinuz root=/dev/sdXY loop=/ubuntu/disks/root.disk ro

Some additional considerations:

  • The current prefix and root settings may be checked at any time with the set command. To remove a setting, use the unset command.

    • Example: unset prefix

  • Modules must be loaded before they can be used. If a module has not been loaded a unknown command error is displayed. If an incorrect path is specified, a file not found error message may be displayed.

  • The linux module must be loaded to be able to load both the kernel and the initrd image unless the normal module is loaded first.

  • If the modules cannot be found in the /boot/grub folder, the user may be able to load them from the /usr/lib/grub/i386-pc folder. The address if Ubuntu was installed on sda1 would be (hd0,1)/usr/lib/grub/i386-pc and the command would be:

    • insmod (hd0,1)/usr/lib/grub/i386-pc/normal.mod

Refer to the Post Boot Follow Up section if the system successfully boots.

GRUB

Presence of the word GRUB at the top left of the monitor with no blinking cursor indicates that GRUB 2 can not even find the Master Boot Record (or equivalent) information. Thus, the core.img file, the /boot and /grub folder locations and contents are completely unknown to GRUB 2.

  • g2_grub_fail.png

The seriousness of the problem cannot be assessed without the use of another operating system or an Ubuntu LiveCD or equivalent. The Ubuntu partition should be mounted for inspection and the user can then check to see if the system files are intact. If so, the user can use the »ChRoot» procedure from the LiveCD to reinstall GRUB 2 and rewrite the information to the MBR.

Details on this procedure are contained in the Grub2/Installing community documentation.

Following a failed boot, GRUB 2 is designed to display the GRUB 2 menu on the next boot and await user input. This will happen even if the user has set the system to boot without displaying the GRUB 2 menu. This provides the user the opportunity to select a different menu option or edit a menuentry to change boot parameters. While this can cause problems on a server, for most users it is a benefit which will prevent constant rebooting during unmonitored operations.

  • g2_grub_edit_menu.png

In addition to its troubleshooting benefits, pre-boot editing of the GRUB 2 menu also allows users to add or remove kernel options, change operating modes, and accomplish other tasks such as testing fonts and splash images. For users who like to experiment, the settings altered via the GRUB 2 terminal are non-persistent and won’t affect future boots.

  • If the menu is displayed, the automatic countdown may be stopped by pressing any key other than the ENTER key.
  • If the menu is not normally displayed during boot, hold down the SHIFT key as the computer attempts to boot to display the GRUB 2 menu.
    • In certain circumstances, if holding the SHIFT key method does not display the menu pressing the ESC key repeatedly may display the menu.
  • Press the ‘e’ key to reveal the selection’s settings.
  • Use the UP/DN/Left/Right cursor keys to navigate to the desired point for editing.
  • Make a single or numerous changes at any spot in the menu. Do not use ENTER to move between lines.

  • TAB completion is available, which is useful in entering kernel and initrd entries.

    • After starting to type the kernel or initrd name, press TAB.
    • If additional characters are not added, look at the bottom of the menu as there may be multiple choices. Add characters until only one entry is visible at the bottom, then TAB again.
  • When editing is complete:
    • CTRL-x or F10 — boot with the changed settings (highlighted for emphasis).

    • CTRL-c or F2 — jump to the command line to perform diagnostics, load modules, change settings, etc.

      • If an edit is incomplete and GRUB 2 detects an error in the kernel or initrd line it will return to the line when exiting this mode.

    • ESC — Discard all changes and return to the main menu.

    • The choices are listed at the bottom of the screen as a reminder.
  • Edits made to the menu in this manner are non-persistent. They remain in effect only for the current boot.
    • Once successfully booted, the changes can be made permanent by editing the appropriate file, saving the file, and running update-grub as ‘root’.

  • Change a kernel version if one is available but not listed on the GRUB 2 menu.
    • Use the TAB key after entering part of the kernel or initrd version to see which ones are available.

  • Add or remove kernel options from the linux line.

    • Remove quiet to display system messages during boot.

    • Remove existing options and add nomodeset to avoid module loading, especially if having video issues.

  • Boot to the recovery mode even if it is not listed on the menu.
    • Remove existing kernel options from the linux line and add single

  • Remove references to UUIDs
    • Remove the entire search line

    • On the linux line, replace «root=UUID=<some alphanumeric>» with «root=/dev/sdXY»

Post Boot Follow Up

Any changes made from the GRUB 2 terminal are not permanent. After successfully booting into the system the user must take several steps to ensure the problem is permanently fixed.

  1. Update the GRUB 2 configuration file
    • sudo update-grub

  2. Reinstall GRUB 2 to the drive’s MBR or equivalent

    • Install to the drive, not to the partition. Example: sda, not sda1

      sudo grub-install /dev/sdX  

  3. Inspect the GRUB 2 configuration file. The default is /boot/grub/grub.cfg

    • For problems with booting the main linux kernel, verify the search, linux, and initrd lines in the [### BEGIN /etc/grub.d/10_linux ###] section of the file.

      • Ensure the paths and kernel/initrd image versions are correct.
      • Confirm the UUID numbers.
      • UUIDs can be checked with the sudo blkid command.

  4. Verify the existence and contents of the system boot folders.
    • / should contain the symlinks vmlinuz and initrd.img

    • /boot/ should contain the actual kernel (vmlinuz-X.X.X-XX…) and initrd image (initrd.img-X.X.X-XX…)

    • /boot/grub should contain grub.cfg and numerous module files (*.mod)

For a corrupted GRUB 2 installation, purging and reinstalling GRUB 2 is very easy if the user has a working Internet connection. Refer to Grub2/Installing#Purging & Reinstalling GRUB 2 for guidance.

Fallback mode

It is possible to configure Grub2 to fall back to a known good menu-entry if the default menu-entry for some reason fails to boot. An example script that can be used for this is available at this webpage (in German).

GRUB 2 Errors

GRUB 2 does not report error numbers. If a number is associated with an error, it is a problem with the transition from GRUB legacy to GRUB 2.

A GRUB 2 error will leave the user at the grub> or grub rescue> prompt, the word GRUB with no cursor, or a hung boot caused by improper system path designations or a corrupted operating system. These issues are addressed earlier on this page — go to the General Troubleshooting Preparation section to start the recovery process.

Selected Problems and Bugs

External Drive Installs and »grub-pc» Updates

Launchpad Bug 496435 Installs of Ubuntu on external drives can cause problems as grub-install uses device names (e.g. sda, sdb) rather than UUIDs in certain circumstances. If connected to another machine when an update of grub-pc is made, the upgrade may be written to the incorrect device and make the computer unbootable.

A workaround is posted on the bug link above.

External Drive Installs and MBR Selection

Launchpad Bug 414996

When installing Ubuntu to a USB drive, the potential exists for GRUB 2 to write to the hard drive’s MBR or split the installation between the hard drive and the USB drive (rather than completely on the USB device). This can render the main drive unbootable.

Workaround: During the final stages of the install there is an «Advanced» button which allows the user to select the install location. See the bug report for more details.

Boot Partition is in Logical Volume whose Volume Group contains a snapshot

Launchpad Bug 563895

When your boot partition (the one providing /boot) is a LV, make sure not to have any LVM snapshots inside the containing VG. At reboot this will render your system unbootable, dropping you in a «grub rescue>«-shell with the following message: «error: no such disk.»

The grub-rescue-shell provided does not help you, because all modules (esp. lvm) are unreachable. You’ll have to boot from a install medium and remove all snapshots that are in the same VG as your boot partition by hand.

This issue is extremely annoying if your server is in a remote datacenter since the origin of the problem cannot be spotted easily and repairing the system may be hard.

While this will be fixed in the upcoming Maverick Meerkat 10.10 release, the current Lucid Lynx LTS 10.04 is affected.

A workaround would be to install ubuntu using a separated non-LVM partition for /boot if you are using LVM snapshots regularly.

There’s some kind of irony that if you’re careful and take a LVM snapshot before upgrading (and possibly rebooting) your system, this will trigger the bug.

insmod fails with «error: no such disk»

Several grub2 modules, such as the linux-module depends on other modules, which is attempted to be auto-loaded. For this to work, the variable $prefix, must be set to where the grub2 modules can be found. Usually, this is accomplished with the command «set prefix=/boot/grub«.

Links

Grub2

Grub2/Displays

Grub2/Installing

Grub2/Submenus

Grub2/Upgrading

Boot-Repair


CategoryBootAndPartition

  • Печать

Страницы: [1]   Вниз

Тема: update-grub failed  (Прочитано 1550 раз)

0 Пользователей и 1 Гость просматривают эту тему.

Оффлайн
andruum

В общем такая тема, новый ноут с Windows 10. Решил поставить вторую систему в виде Ubuntu. Сделал live usb, при загрузке выбрал загрузку с флешки. Но в списке было два пункта с USB. Один был с надписью UEFI, другой без UEFI. Выбрал который без UEFI, установил. (При установке ubuntu не нашла вторую систему в виде Windows) В общем, после этого решил что я сделал что-то не так и решил установить снова, выбрав при этом пункт с UEFI в меню выбора загрузки. Предварительно разметил диск заново. Стал устанавливать, винда в этот раз определилась. Но под конец установки установщик выдал ошибку failed update-grub или что-то типа того. В меню выбора устройства загрузки есть пункт OS boot manager uefi ubuntu. Если загрузиться в него, появляется grub 2 командная строка. (Minimal BASH-like line editing is supported.)
Так вот, что теперь делать? Прошу совета, не решаюсь чинить то, что уже сломалось

GPT fdisk (gdisk) version 0.8.8

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): Disk /dev/sda: 500118192 sectors, 238.5 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 353A2D39-6ED5-4DDE-9533-7CBF0138A855
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 500118158
Partitions will be aligned on 2048-sector boundaries
Total free space is 3770989 sectors (1.8 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          534527   260.0 MiB   EF00  EFI system partition
   2          534528          567295   16.0 MiB    0C01  Microsoft reserved part
   3          567296       406441983   193.5 GiB   0700  Basic data partition
   4       469356544       471363583   980.0 MiB   2700  Basic data partition
   5       471363584       500107263   13.7 GiB    0700  Basic data partition
   6       406441984       441597951   16.8 GiB    8300 
   7       441597952       461598719   9.5 GiB     8300 
   8       461598720       465598463   1.9 GiB     8200 


sda6 — это корневой раздел, sda7 — home, sda8 — swap. Остальные с виндой и ее разделами восстановления. Все разделы кроме sda6,sda7,sda8 были, остальные разметил при установке. (Предварительно сжал том в винде). Ошибка появляется на стадии «Running update-grub». Если посмотреть через live ubuntu, в разделе sda6 появились системные папки.


ТС не появлялся на Форуме более полугода по состоянию на 14/07/2019 (последняя явка: 06/01/2017). Модератором раздела принято решение закрыть тему.
—zg_nico

« Последнее редактирование: 14 Июля 2019, 03:38:11 от zg_nico »


toZen


Оффлайн
andruum

τοΖεη, читал. Boot repair может решить эту проблему?


toZen

andruum, т.е., установка сделана в соответствии с инструкцией.
Так?
BootRepair может и решит проблему, в любом случае — нужно пробовать.

### UPD ###
На всякий случай, покажите пожалуйста вывод терминала по команде:

sudo parted -lДля этого, запустите установочный диск в режиме «Try Ubuntu».

« Последнее редактирование: 03 Января 2017, 13:40:49 от τοΖεη »


Оффлайн
andruum

τοΖεη, Первый раз — не по инструкции. Потом да.
Boot repair с рекомендуемыми настройками не помог.

Model: ATA SanDisk SD8SNAT- (scsi)
Disk /dev/sda: 256GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number  Start   End    Size    File system     Name                          Flags
 1      1049kB  274MB  273MB   fat32           EFI system partition          boot
 2      274MB   290MB  16.8MB                  Microsoft reserved partition  msftres
 3      290MB   208GB  208GB   ntfs            Basic data partition          msftdata
 6      208GB   226GB  18.0GB  ext4
 7      226GB   236GB  10.2GB  ext4
 8      236GB   238GB  2048MB  linux-swap(v1)
 4      240GB   241GB  1028MB  ntfs            Basic data partition          hidden, diag
 5      241GB   256GB  14.7GB  ntfs            Basic data partition          hidden, msftdata

Model: A-DATA USB Flash Drive (scsi)
Disk /dev/sdb: 16.2GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  16.2GB  16.2GB  primary  fat32        boot, lba


toZen

andruum, запуститесь ещё раз в LiveCD/USB и дайте в терминал:

sudo grub-install /dev/sda

sudo update-grub


Оффлайн
andruum

τοΖεη,

ubuntu@ubuntu:~$ sudo grub-install /dev/sda
Installing for i386-pc platform.
grub-install: error: failed to get canonical path of `/cow'.
ubuntu@ubuntu:~$ sudo update-grub
/usr/sbin/grub-probe: error: failed to get canonical path of `/cow'.


Оффлайн
EvangelionDeath

andruum, Installing for i386-pc platform.
эм… Точно згружено в EFI режиме?

HP Pro 840 G3: Intel i5-6300U, 32GB DDR4 2133MHz, Intel 520, Intel Pro 2500 180GB/Ubuntu 22.04
Dell Latitude 5590: Intel i5-8350U, 16GB DDR4 2400MHz, Intel 620, Samsung 1TB/Ubuntu 22.04


Оффлайн
symon.2014

ubuntu@ubuntu:~$ sudo grub-install /dev/sda

Судя по всему это лайв. И что куда ставится? Может корень стоит примонтировать?


toZen

 

:- Что-то я стормозил…
Конечно нужно примонтировать раздел с Ubuntu и тогда уже устанавливать загрузчик в корень.
andruum, извините, мой косяк.
Вобщем, из-под LiveCD нужно сделать так:

sudo mount /dev/sda6 /mnt ; cd /mnt

sudo grub-install /dev/sdaИ покажите тогда:

sudo update-grub

« Последнее редактирование: 03 Января 2017, 16:24:35 от τοΖεη »


Оффлайн
andruum

τοΖεη,
Наверное вы имели ввиду с опцией —root-directory=/mnt , без нее не находит, выводит так же error: failed to get canonical path of `/cow’.
В общем, вот результат:

sudo grub-install --root-directory=/mnt /dev/sda
Installing for i386-pc platform.
grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
grub-install: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..
grub-install: error: will not proceed with blocklists.


Пользователь добавил сообщение 04 Января 2017, 14:06:37:


На некоторых ресурсах предлагается установить флаг bios_grub. Это то что нужно или не применимо для данной ситуации?

« Последнее редактирование: 04 Января 2017, 14:06:37 от andruum »


  • Печать

Страницы: [1]   Вверх

#1 2013-12-06 22:56:45

tumas
Member
Registered: 2012-02-08
Posts: 89

[solved] Grub Update gives Syntax error

The new update of grub brings the following error when running grub-mkconfig:

error: out of memory
error: syntax error
error: Incorrect command
Syntax error in line 164

So i looked for line 164, which is:

### END /etc/grub.d/60_memtest86+ ###

The same line was also present in my older grub config, so i have no idea what is wrong.

I am using btrfs for my whole system, but that shouldnt be the Problem.

What i also noticed: When i force the system to use the grub.cfg.new file, i have now 3 entries to boot, instead of two. Standard, fallback and a new entry called «Arch Linux» which is identical to the standard entry.

Edit: Fixed by adding:

# fix broken grub.cfg gen
GRUB_DISABLE_SUBMENU=y

in the /etc/default/grub file.

Last edited by tumas (2013-12-09 17:17:40)

#3 2013-12-07 12:45:07

derJupp
Member
Registered: 2013-09-21
Posts: 1

Re: [solved] Grub Update gives Syntax error

thx tumas ,
now grub well done :-)

#4 2013-12-07 17:42:08

Rob_H
Member
Registered: 2012-06-19
Posts: 63

Re: [solved] Grub Update gives Syntax error

This seems like the kind of thing that should be in the Arch News feed. There was no indication in the pacman log that the grub upgrade was going to break things without this change. :-(

#5 2013-12-07 18:13:11

Potomac
Member
Registered: 2011-12-25
Posts: 519

Re: [solved] Grub Update gives Syntax error

Today  I did a «pacman -Syu» and grub package was updated :

grub-2.00.5086-1 —> grub 1:2.00.1282.g5ae5c54-1

so I run 2 scripts in order to reinstall grub and update configs files :

— grub-install —recheck /dev/sdc
output : «Installation finished. No error reported.»

then I want to regenerate the grub.cfg file :

grub-mkconfig -o /boot/grub/grub.cfg

and I see errors messages :

Generating grub configuration file …
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/initramfs-linux.img
error: out of memory.
error: syntax error.
error: Incorrect command.
error: syntax error.
Syntax error at line 194
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

so it’s seems that grub package has a problem, something is wrong with the file grub-mkconfig

my system: archlinux 64 bits
4 Gb ram

Steps to Reproduce:
— you must have already a grub installation ( package grub-2.00.5086-1 )
— then do a «pacman -Syu» in order to have the last grub package ( grub 1:2.00.1282.g5ae5c54-1 )
— reinstall grub ( grub-install —recheck /dev/sdX )
— regenerate the gruf.cfg file ( grub-mkconfig -o /boot/grub/grub.cfg )
— error messages will be displayed

#6 2013-12-07 18:15:40

ppsalama
Member
From: Spain
Registered: 2012-01-29
Posts: 83

Re: [solved] Grub Update gives Syntax error

#7 2013-12-07 18:30:26

Potomac
Member
Registered: 2011-12-25
Posts: 519

Re: [solved] Grub Update gives Syntax error

ok thanks for the link

#8 2013-12-07 18:58:53

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,011

Re: [solved] Grub Update gives Syntax error

Merged » [Grub] errors during execution of «grub-mkconfig» from grub» with main thread


Nothing is too wonderful to be true, if it be consistent with the laws of nature — Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. — Alan Turing

How to Ask Questions the Smart Way

#9 2013-12-08 02:40:24

Khanfluence
Member
Registered: 2013-12-08
Posts: 2

Re: [solved] Grub Update gives Syntax error

This is my first time with Arch Linux, and I’m trying to set up a system as follows:

sda — NTFS storage
sdb — Arch/W8 dual (BIOS, not UEFI)
sdc — ext4 storage

I’ve cut my boot drive into partitions for W8 and Arch (single root partition) and I’ve installed Arch following the beginner’s guide. However, when I attempt to generate grub.cfg I receive this output (link). When I boot, GRUB lists only Linux and selecting it results in the error «kernel must be loaded before booting».

I’m unsure as to what is happening. AFAIK there is no W8 loader on sdc (I wiped the drive) and Windows should not be hibernating (line 8).

#10 2013-12-08 05:42:21

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: [solved] Grub Update gives Syntax error

#11 2013-12-08 05:49:20

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,376
Website

Re: [solved] Grub Update gives Syntax error

Merging…


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

#12 2013-12-08 19:06:04

Khanfluence
Member
Registered: 2013-12-08
Posts: 2

Re: [solved] Grub Update gives Syntax error

Much appreciated!

#13 2013-12-09 10:55:08

slowpoke1584
Member
From: Dallas Texas, US
Registered: 2013-12-01
Posts: 33
Website

Re: [solved] Grub Update gives Syntax error

I’m not certain how useful it is to have a thread that has two links that link back to itself without actually providing information on how to fix the problem.


Registered Linux User #565082

#14 2013-12-09 11:56:08

Jojonintendo
Member
Registered: 2013-12-06
Posts: 56

Re: [solved] Grub Update gives Syntax error

slowpoke1584 wrote:

I’m not certain how useful it is to have a thread that has two links that link back to itself without actually providing information on how to fix the problem.

I don’t know what happened to those links, but the fix is simply to add those line at the end of /etc/default/grub:

# Fix broken grub.cfg gen
GRUB_DISABLE_SUBMENU=y

M/B: Asus M5A97 LE R2.0 CPU: AMD FX(tm)-6100 Six-Core Processor GPU: XFX R9 390 DD Black Edition RAM: Kingston HyperX Beast DDR3 1866 2X4GB SSD: Crucial M4 128GB SATA 3
CPU and GPU are watercooled by Ibercool kit.

#15 2013-12-09 21:08:53

slowpoke1584
Member
From: Dallas Texas, US
Registered: 2013-12-01
Posts: 33
Website

Re: [solved] Grub Update gives Syntax error

Jojonintendo wrote:

slowpoke1584 wrote:

I’m not certain how useful it is to have a thread that has two links that link back to itself without actually providing information on how to fix the problem.

I don’t know what happened to those links, but the fix is simply to add those line at the end of /etc/default/grub:

# Fix broken grub.cfg gen
GRUB_DISABLE_SUBMENU=y

Apreciate it. I can’t say how many threads I have seen that were about exactly what I was trying to troubleshoot, marked as solved, and no explanation given as to how.


Registered Linux User #565082

#16 2013-12-09 21:14:09

Jojonintendo
Member
Registered: 2013-12-06
Posts: 56

Re: [solved] Grub Update gives Syntax error

I was lucky I saw it this morning. I’m glad I could «help» somehow wink


M/B: Asus M5A97 LE R2.0 CPU: AMD FX(tm)-6100 Six-Core Processor GPU: XFX R9 390 DD Black Edition RAM: Kingston HyperX Beast DDR3 1866 2X4GB SSD: Crucial M4 128GB SATA 3
CPU and GPU are watercooled by Ibercool kit.

#17 2013-12-12 00:16:16

dragonshade
Member
Registered: 2013-12-12
Posts: 1

Re: [solved] Grub Update gives Syntax error

Jojonintendo wrote:

slowpoke1584 wrote:

I’m not certain how useful it is to have a thread that has two links that link back to itself without actually providing information on how to fix the problem.

I don’t know what happened to those links, but the fix is simply to add those line at the end of /etc/default/grub:

# Fix broken grub.cfg gen
GRUB_DISABLE_SUBMENU=y

Wow , you just saved me a day. *salute*

#18 2013-12-23 01:06:32

Cloudane
Member
Registered: 2009-05-04
Posts: 8

Re: [solved] Grub Update gives Syntax error

Thanks!

IMO this sort of thing needs fixing if ever arch is to be taken seriously as a distro. The installation guide is out of date and the config file needs to be correct by default.
The networking guide even still says eth0 even though it’s been something like enp0s1 for several months…

Last edited by Cloudane (2013-12-23 01:10:33)

#19 2013-12-23 01:18:33

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [solved] Grub Update gives Syntax error

The wiki is a community project. It gets updates and expanded when somebody takes time to edit it.
Sadly, few people do.

#20 2013-12-24 05:50:04

kevin24
Member
Registered: 2013-07-20
Posts: 9

Re: [solved] Grub Update gives Syntax error

Hi,

New to Arch.

Having the same problem as expected. My question is when and how do I update the /etc/default/grub file. Given that I am in the middle of the installation. Sorry to be a bit dim.
Thanks

#21 2013-12-24 08:30:26

tumas
Member
Registered: 2012-02-08
Posts: 89

Re: [solved] Grub Update gives Syntax error

kevin24 wrote:

Hi,

New to Arch.

Having the same problem as expected. My question is when and how do I update the /etc/default/grub file. Given that I am in the middle of the installation. Sorry to be a bit dim.
Thanks

Hi and welcome wink

It is probably the best to edit the file right after u installed «grub». During the installation of grub the «/etc/default/grub-file» will already be created. After u changed the file, u should run «grub-mkconfig -o /boot/grub/grub.cfg», followed by «grub-install ….»

Last edited by tumas (2013-12-24 08:30:48)

#22 2013-12-24 09:07:26

kevin24
Member
Registered: 2013-07-20
Posts: 9

Re: [solved] Grub Update gives Syntax error

Hi,

Just so I am absolutely clear.

My install sequence is :-

pacstrap -i /mnt base
pacstrap /mnt grub-bios
genfstab -U -p /mnt >> /mnt/etc/fstab
cat /mnt/etc/fstab 
arch-chroot /mnt

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
BUG FIX

[ADD TO nano /etc/default/grub at the bottom “GRUB_DISABLE_SUBMENU=y”
=================================================================

mkinitcpio -p linux
grub-mkconfig -o /boot/grub/grub.cfg
grub-install /dev/sda
passwd
exit
umount /mnt/home
umount /mnt
systemctl reboot

I tried this but it would not reboot. But the everything seemed to install ok and the FIX cured the error problem.

So I am a l unsure of what I am doing wrong.
Thanks

#23 2013-12-24 11:08:55

tumas
Member
Registered: 2012-02-08
Posts: 89

Re: [solved] Grub Update gives Syntax error

Well, do u have UEFI or normal BIOS? Depending on that, u probably should add a —target=xxx option for the «grub-install-command». And since this is getting a little bit «Off-Topic» here, u maybe want to create a new thread for ur problem (if it still exists)

#24 2013-12-27 18:32:36

Garryck
Member
Registered: 2013-12-27
Posts: 1

Re: [solved] Grub Update gives Syntax error

Just wanted to say thanks.. I’ve just installed my first Arch base tonight, and the first attempt failed because of this bug.  After reading this thread, the second attempt went smoothly!

#25 2013-12-27 20:06:41

RadioGnome1971
Member
From: At home
Registered: 2013-12-27
Posts: 12

Re: [solved] Grub Update gives Syntax error

Made my day….

Forum rules
Before you post please read how to get help. Topics in this forum are automatically closed 6 months after creation.

V1T4MiN_

[SOLVED] sudo update-grub is not working correctly for me

Hi, This may be a bit of a newbie question but I felt that it belonged here, When I run update-grub I get this:

Code: Select all

Generating grub configuration file ...
Script `/boot/grub/grub.cfg.new' contains no commands and will do nothing
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

and the file grub.cfg.new simply contains this:

Code: Select all

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

That’s all it has, I’m on mint 18.3 and unfortunately had a bit of a lapse in judgement a while back and used grub customizer, I know it was stupid and I now have seen the error of my ways (thanks to easy linux tips project), I was thinking that maybe I should just reinstall grub if possible? I’m glad I have skipped the kernel updates or I would have been worse off, at the moment I can boot but I don’t trust it in this state, I would like to fix this issue if possible.
I can make timeshift backups if needed and I also just made one last night.
The output of inxi -Fxz: https://pastebin.com/raw/nB78ExLp
Thanks & Regards
V1T4MiN

Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.

Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.

V1T4MiN_

Re: sudo update-grub is not working correctly for me

Post

by V1T4MiN_ » Thu Mar 21, 2019 9:21 pm

Wow, first off thanks for the fast response! That looks a bit too complex for my skill level, Is that the only way to fix grub? I can boot into my mint 18.3 system, Is there a safer way to fix it from inside mint?
Regards V1T4MiN

User avatar

kevin987

Level 5
Level 5
Posts: 802
Joined: Fri Dec 11, 2015 12:35 pm

Re: sudo update-grub is not working correctly for me

Post

by kevin987 » Thu Mar 21, 2019 9:45 pm

V1T4MiN_ wrote: ↑

Thu Mar 21, 2019 9:21 pm


Wow, first off thanks for the fast response! That looks a bit too complex for my skill level, Is that the only way to fix grub? I can boot into my mint 18.3 system, Is there a safer way to fix it from inside mint?
Regards V1T4MiN

Since I only have one hard drive, I was able to reinstall Grub without giving drive information or using a mount command.

From Live USB of Mint, open the Terminal.

Linux Mint 20.3 (Cinnamon)
Linux Mint 19.3 (Cinnamon)
Bodhi Linux 6.0 (MokshaArcGreen)
Fedora 35 (Cinnamon)

V1T4MiN_

Re: sudo update-grub is not working correctly for me

Post

by V1T4MiN_ » Thu Mar 21, 2019 9:59 pm

Just to confirm before I try any of these fixes, I cannot just do this?

From help.ubuntu.com Reinstalling GRUB 2 from a Working System

If Ubuntu is operating normally, boot into the working installation and run the following command from a terminal.

X is the drive (letter) on which you want GRUB to write the boot information. Normally users should not include a partition number, which would produce an error message as the command would attempt to write the information to a partition.

sudo grub-install /dev/sdX # Example: sudo grub-install /dev/sda

This will rewrite the MBR information to point to the current installation and rewrite some GRUB 2 files (which are already working). Since it isn’t done during execution of the previous command, running sudo update-grub after the install will ensure GRUB 2’s menu is up-to-date.

Or

Code: Select all

sudo apt purge grub-pc grub-pc-bin grub2-common grub-common 
&& sudo apt install grub-pc grub-pc-bin grub2-common grub-common

I’m sorry if It seems I’m being difficult, But I’m just a little scared that I will break grub/mint and I want to make sure I’m using the safest and most full-proof solution possible.
Oh and just in case it matters I do have a small Windows 7 partition on my drive.
Thanks & Regards V1T4MiN

User avatar

Pierre

Level 21
Level 21
Posts: 12788
Joined: Fri Sep 05, 2008 5:33 am
Location: Perth, AU.

Re: sudo update-grub is not working correctly for me

Post

by Pierre » Thu Mar 21, 2019 10:28 pm

that method from Ubuntu, should pull in the original Grub Loader Menu from the location,
that is being specified, by that command line.
https://community.linuxmint.com/tutorial/view/245
would be similar to that method, but using an Live media, instead.

whereas the method from kevin987, may be re-using the Modified grub version, still.
— — try both ways & see which one, will restore the older version, which should still exist.

Image
Please edit your original post title to include [SOLVED] — when your problem is solved!
and DO LOOK at those Unanswered Topics — — you may be able to answer some!.

V1T4MiN_

Re: sudo update-grub is not working correctly for me

Post

by V1T4MiN_ » Thu Mar 21, 2019 10:33 pm

Hmmm, I ran the command from ubuntu help and it still has the same issue, should I try one of the other ideas, it may be outside my comfort zone but I can do it :)
Regards V1T4MiN

User avatar

Pierre

Level 21
Level 21
Posts: 12788
Joined: Fri Sep 05, 2008 5:33 am
Location: Perth, AU.

Re: sudo update-grub is not working correctly for me

Post

by Pierre » Thu Mar 21, 2019 10:39 pm

this method from Ubuntu:
https://howtoubuntu.org/how-to-repair-r … tu-live-cd
should be similar to this method from LinuxMint:
https://community.linuxmint.com/tutorial/view/245

but, the main differences, would be in where, they are pulling the original file from.
& the example from the LinuxMint Community Site, may be the easier example, to follow.

this shouldn’t be above-your-pay-grade, but it’s also not an «job for an expert», either.
NB: the newly restored, Grub Menu — should also include that win-7, as well.
8)

Image
Please edit your original post title to include [SOLVED] — when your problem is solved!
and DO LOOK at those Unanswered Topics — — you may be able to answer some!.

pbear

Level 16
Level 16
Posts: 6544
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: sudo update-grub is not working correctly for me

Post

by pbear » Fri Mar 22, 2019 11:20 am

V1T4MiN_ wrote: ↑

Thu Mar 21, 2019 10:33 pm

Hmmm, I ran the command from ubuntu help and it still has the same issue, should I try one of the other ideas, it may be outside my comfort zone but I can do it :)

Haven’t had to do any of this stuff (yet, knock wood), but have been researching Grub recently because I want to be prepared. Frankly, I think you’re to the point of having to escalate to purge-and-reinstall. This is on the same Ubuntu Help page as you used already, a little further down. By my reading and what I would do in your circumstances, open Terminal and run each of these commands, one line at a time:

Code: Select all

sudo apt-get update
sudo apt-get purge grub-common
sudo apt-get install grub-pc

See the Help page for tips and more info. Notice this is somewhat different from the purge script you posted above, but you didn’t indicate whence that came. Whereas this script comes from a trusted source, so it’s what I would use if I were in your shoes.

User avatar

Valsodar

Level 4
Level 4
Posts: 349
Joined: Thu Jul 19, 2018 11:30 pm
Location: Sofia, Bulgaria
Contact:

Re: sudo update-grub is not working correctly for me

Post

by Valsodar » Fri Mar 22, 2019 1:21 pm

V1T4MiN_ wrote: ↑

Thu Mar 21, 2019 9:21 pm


Wow, first off thanks for the fast response! That looks a bit too complex for my skill level, Is that the only way to fix grub?

It’s not hard at all. Once upon a time I used to think that too but after the first time I tried it, I changed my mind. It only looks hard and complex but it’s not. ;)

Intel Core i7-4770, Palit GTX 1660 Ti 6GB, Corsair 32GB DDR3-1600, Firefox, Arch Cinnamon
https://t.me/linuxtalkbg

V1T4MiN_

Re: sudo update-grub is not working correctly for me

Post

by V1T4MiN_ » Fri Mar 22, 2019 8:48 pm

Hey, Just a bit of an update, I will have to wait for a few weeks to try these ideas as I currently have an important project that needs my main system, So I can’t risk not being able to boot into my main system until that project is done, I will just wait to update my kernel for a bit.
Thanks all and cheers for now, I will update this thread in a few weeks when I try to fix grub :D
Regards V1T4MiN

User avatar

catweazel

Level 19
Level 19
Posts: 9764
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: sudo update-grub is not working correctly for me

Post

by catweazel » Fri Mar 22, 2019 8:51 pm

V1T4MiN_ wrote: ↑

Thu Mar 21, 2019 9:21 pm


That looks a bit too complex for my skill level

I don’t see why it should be. While the commands might look daunting, the only thing you have to work out is the replacement values for /dev/sdXY and /dev/sdX.

«There is, ultimately, only one truth — cogito, ergo sum — everything else is an assumption.» — Me, my swansong.

hcentaur13

Re: sudo update-grub is not working correctly for me

Post

by hcentaur13 » Sat Mar 23, 2019 6:46 am

To be correct, you needs only 2 commands:
sudo grub-install
sudo update-grub

copy and paste! Don’t type. The commands above are miserably faulty!
grub-install will replace the currently grub.
update-grub will insert the options to boot other OSes installed on that PC.
PC grub is ONLY for compatoble ionstallation — it will fail on UEFI that has no MBR but a boot partition.

When you can’t boot your installed system:
Use the live system and burn supergrub onto a stick.

When yor system is up and running you can install the UEFI-bootmanager named rEfind from launchpad and install it. It will find any installed system even when windows or others have destroyed partially the UEFI bootmenu. With this you can easy boot your linux and rebuild your grub from there.

V1T4MiN_

Re: sudo update-grub is not working correctly for me

Post

by V1T4MiN_ » Tue Apr 16, 2019 9:17 pm

Hello, I finished the previously mentioned project and I made an interesting discovery, update-grub is still not working, but the issues with the delayed key presses and input issues have been solved, It was my keyboard, I’m now back to using my old SteelSeries Apex 100, The bad keyboard was the «Gaming Keyboard» from my local Lidl I bought about a year ago, I will be returning it under warranty, My «Gaming» mouse and headphones are still working correctly though so I will be holding on to those, As for fixing grub’s configs, I went to an internet cafe and downloaded «boot-repair-disk» as per the Ubuntu wiki article, I will try to repair grub from the live USB I flashed after I finish typing this, Thanks for being patient with me :)

EDIT/UPDATE: I’m now thoroughly confused, I tried the boot-repair-disk, The only helpful thing it did was teach me how chroot works to an extent, besides that it kind of falls short, in fact, it is just a wizard that tells you to copy and paste commands, that only made things worse might I add, My windows partition was no longer bootable, On the bright side I got to see how well Timeshift works, Brilliant piece of software, But the thing that is worrying is that my old reliable keyboard will not input anything until mint boots, the same kind of issue that my other keyboard was having if you think about it, Now I need to figure out why my computer is having I/O issues on cold boot?
Send help
Regards V1T4MiN

pbear

Level 16
Level 16
Posts: 6544
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: sudo update-grub is not working correctly for me

Post

by pbear » Wed Apr 17, 2019 1:18 am

Go back and read the Ubuntu Help article I linked above. Bear in mind you got into this mess by using Grub Customizer. I’m not sure, as I’ve not had this scenario, but my hunch is that you need to clear out the config files, for which my further hunch is that purge and reinstall is the right answer.

As we say in Linux Land, no warranties whatsoever. All I can say is that this is what I’d do if I were in your shoes. Good luck.

V1T4MiN_

Re: [SOLVED] sudo update-grub is not working correctly for me

Post

by V1T4MiN_ » Wed Apr 17, 2019 3:50 pm

Yay! It’s now working perfectly! sudo update-grub works like a charm and it even applied my custom background automatically! :D
Thanks to all of you! And thank you pbear, The command line fix was what did the trick, I apologize as I know I made this harder than it had to be by being overly cautious, I get a little skittish when it comes to bootloader troubleshooting.
Thanks again :D

Cheers V1T4MiN

V1T4MiN_

Re: [SOLVED] sudo update-grub is not working correctly for me

Post

by V1T4MiN_ » Thu Apr 18, 2019 1:26 am

Yes, Just for clarity this is exactly what I did, I had to add sudo at the top of everything as I was not in a chroot environment, First came:

Next, I did:

After hitting TAB to select YES on the prompt about removing the bootloader I ran:

Code: Select all

sudo apt-get install grub-pc lupin-support os-prober

That is where I differ from the article from help.ubuntu.com, I also reinstalled lupin-support & os-prober as I thought they were quite necessary, Then I followed the prompts making sure to chose the hard disk for install, NOT the partition, and Then it was another prompt asking to confirm I think, after that I saw it find my kernels and my windows bootloader, for which it made two entries for, not sure why, After rebooting I ran update-grub just to test and it works like a charm.
I hope this will help future victims of Grub Customizer :D
Please correct me if I have gotten anything wrong :)
Regards V1T4MiN

  • Home
  • Forum
  • The Ubuntu Forum Community
  • Ubuntu Official Flavours Support
  • Installation & Upgrades
  • [SOLVED] update-grub error {cannot find device for /}

  1. update-grub error {cannot find device for /}

    Hello every1, I’ve been trying to install xubuntu on my Asus EEE 1101ha, which is known to present some problems due to lack of efficient poulsbo drivers. By following the instructions in the official documentation of Ubuntu, I managed to reach a working live CD environment and install Xubuntu. The next step I had to follow was to edit a grub text and then update grub for the changes to take effect {If I discarded this step, grub wouldn’t load, giving me an error message which I will mention if needed}. Unfortunately, when I used «sudo update-grub» to update it, the following error came up:

    /usr/sbin/grub-probe: error: cannot find a device for / (is /dev mounted?).

    I mounted all the filesystems yet it didn’t help. I tried running grub-probe by double clicking it, but again it didn’t seem to run, nor was grub updated since it kept giving me the same error. I googled the error a bit, but although I tried a thing or two, it was no use. Any help would be appreciated.


  2. Re: update-grub error {cannot find device for /}

    It sounds like you’re trying to make the grub changes on your (Xubuntu-installed) filesystem from a LiveCD. Is that correct? Please do explain what was wrong in the first place requiring a change.

    If you are indeed running update-grub from a live CD you’ll need to mount the virtual filesystems and chroot first:

    Code:

    # Mount root partition:
    sudo mount /dev/sdXY /mnt # /dev/sdXY is your root partition, e.g. /dev/sda1
    
    # If you have a separate boot partition you'll need to mount it also:
    sudo mount /dev/sdYY /mnt/boot
    
    # Mount your virtual filesystems:
    for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
    
    # Chroot
    sudo chroot /mnt

    NOW you can do grub-install and update-grub and whatnot and it’ll operate on your installed system rather than the LiveCD.


  3. Question Re: update-grub error {cannot find device for /}

    Hey I’m was having the same problem with 32bit and trying to setup dual boot with xp (got 32bit working minus some drivers missing as a solo OS never dual) but have 4gb ram so wanted to use 64bit to utilize hardware n figured id just emulate xp if I have too, but while installing 64bit server or desktop, I cannot get around this error.

    I was given a vaio vpcz11cgx/x, has dual solid state drives Im pretty sure it’s raid0. I’ve tried letting it auto setup on (striped drive) and errors on bootloader install. /dev/mapper is what shows up as default it, I’ve tried /dev/sda and the Ubuntu OS partition, blank partitions fat/ext/blank on beginning and end of disk =P. On manual partitions I’ve tried just ext4 n swap space as primary, I’ve left a 2gb primary partition to instal grub n put ext4 n swap in extended logical partition, also tried 2gb primary with ext as primary n swap on extended. I think my error due to either a raid config or partitioning… Lol or both

    Also curious which has a more stability 64bit server or desktop. Thanx for help in advanced.


  4. Re: update-grub error {cannot find device for /}

    The virtual filesystems are not found. What do I do wrong? Sry, I’m kinda new to linux… heres what I type and what it returns:

    Code:

    xubuntu@xubuntu:~$ for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
    mount: mount point /mnt/dev does not exist
    mount: mount point /mnt/dev/pts does not exist
    mount: mount point /mnt/proc does not exist
    mount: mount point /mnt/sys does not exist
    mount: mount point /mnt/run does not exist

    I reinstalled Xubuntu in a single partition choosing the automatic installation option. The root partition is therefore /dev/sda1. What is there to be done then?

    P.S. You guessed right, I’m using the console from a Live USB stick


  5. Re: update-grub error {cannot find device for /}

    The error message usually means the system partition was not mounted properly. Did you mount your real xubuntu partition (sda1) on /mnt before running the command?

    You might try installing Boot Repair (see link in my sig line) from the LiveCD/USB Desktop and let it try to fix GRUB. If it can’t do it with the «Recommended repair» button there is an Advanced option that can take you through the ‘chroot’ method.

    If neither of the Boot Repair options fixes things, it has an option to run a boot info script, which can provide us with information we need to give you more specific advice.


  6. Re: update-grub error {cannot find device for /}

    Nvm, although the update-grub didn’t work so the text file wasn’t modified, grub2 loads normally and I finally booted xubuntu from the hard disk installation. I hope grub keeps that way. I won’t label the thread as solved today, cause, I’m not still sure about how stable grub is. Furthermore, maybe Bluphx can get some help from here before I close it. Thanks again for your help guys, I hope someday I’ll be amongst you who offer help around here.


  7. Re: update-grub error {cannot find device for /}

    Yo thanx for the heads up, Im going to try to run the bootrepair program if this install doesn’t work. I’ve setup the partition in gpart before hand this time as:

    ATARaid volume 0 238.48gb /dev/mapper/isw_bfdjejgiae
    extended 238.48gb
    ext4 200gb
    unallocated 39gb
    linux-swap 4.2gb
    unallocated 4mb

    I have left 4mb on the end of the drive b/c all the other screens and my other computer that runs ubuntu fine has an extra 2mb on end of HD. I’ve also left 39gb floating between ext4 and swap b/c if i can get a working install I’d like a XP partition to dualboot or VM from.

    All goes fine till very end of install n get a GRUB error and ask to reselect where to install boot. Default it tries /dev/mapper/, i’ve tried volume #’s and sda/b/ect.

    Thanx again in advanced, ex apple genius so starting to learn the lingo n new ways of ubuntu.


  8. Re: update-grub error {cannot find device for /}

    Here I am again… ok, I don’t know how I did it, but it seems like grub tries to load from the live usb, even though I have already installed xubuntu on the hard disk. Here’s the case: If I try to load xubuntu from the hard disk without having the usb stick plugged, grub doesn’t load. If I plug the usb stick, grub loads normally and xubuntu boots from the hard disk {This means I can’t even boot from the live usb, yet I can’t boot from hard disk without it!}. So… please tell me some good news… I will keep you updated in case I successfully update grub and solve this nonsense


  9. Re: update-grub error {cannot find device for /}

    Well… I’ve done all I could. I followed all three steps of this guide: https://wiki.ubuntu.com/HardwareSupp…oCardsPoulsbo/

    yet nothing changed. I still need the usb stick to boot. If I don’t use it, grub doesn’t start and I only see a flashing cursor. I believe that the problem lies in that grub tries to load from the usb stick instead of the hard disk. I came to this conclusion after I prompted:
    sudo update-grub
    in order to finish the third option given on the guide linked above, for as soon as I pressed enter the usb started flashing, indicating data transmission to the usb stick! I don’t believe its a coincidence. I prompted «sudo update-grub» while the console was running from the hard disk, but I believe that this commanded the update of the usb stick’s grub. When I removed the usb stick and retried using the update-grub command, the update was again completed successfully {Which means that after I removed the usb stick, the command now went for the hard disk’s grub… right? :O} Omg I know all this is confusing but, does anyone know some way to direct grub startup to the hard disk’s grub installation {In human terms: I want the .txt file where the grub boot path is written, so that I can modify it to lead grub to boot from the hard disk}? Or is it something else? Help!!!


  10. Re: update-grub error {cannot find device for /}

    Odys1,

    Normally all that should be required is to change your boot drive’s MBR instructions to point to your Ubuntu partition rather than the external device. You do this with the ‘grub-install’ command.

    Boot to your normal Ubuntu OS (even if it requires using the USB initially). After it boots, run the following command, using the correct drive letter. Just make sure the drive designation is what you think it is (sda, sdb, etc). You can run «sudo fdisk -l» to check first if necessary. Do NOT use the partition number:

    Code:

    sudo grub-install /dev/sda

    The next time you boot just make sure the external is not inserted and the BIOS should look to the sda drive’s MBR for instructions on where the bootloader files are located.


Tags for this Thread

Bookmarks

Bookmarks


Posting Permissions

Понравилась статья? Поделить с друзьями:
  • Unregistering runner from gitlab error status only http or https scheme supported
  • Update google play services как исправить ошибку
  • Unreal engine 4 packagingresults error unknown error
  • Unregistered on api console как исправить
  • Update google play services как исправить на андроид