How to fix 'grub error file not found' when installing 12.04?

59,380

Solution 1

The symptom of being able to see some files but not all on a filesystem with grub usually means that your BIOS is buggy and can't properly handle large drives ( http://tldp.org/HOWTO/Large-Disk-HOWTO-4.html ). What happens is that the BIOS can't read blocks past a certain point in the drive, and so if your root filesystem starts before that limit, but ends after that limit, then some files will be accessible at boot through the BIOS and others won't. The standard way to work around this problem is to create a small /boot/ partition near the beginning of the drive, to ensure that everything that needs to be read through the BIOS, can be.

I would normally expect "out of disk" errors from grub were this the case, and I don't know why we're not seeing those. One way to confirm that the problem is a BIOS limit is to go into your BIOS menus and see what size it lists the drive as being, if it lists it as being less that the actual size, you know your BIOS is buggy. Another way, if your BIOS doesn't list sizes anywhere in its menus, is to run "ls -l" from grub and look at the size listed there. Unfortunately, you can't run "ls -l" from the rescue shell, so you'd need to boot from a grub CD, or have already fixed the problem with a small /boot/ partition, before you could do the check from within grub.

Solution 2

If your still having issues with this try the "GRUB Customizer"

sudo apt-get grub-customizer

PLUG IN YOUR PENDRIVE or external USB

start it from the gui Administrator tools Admin->grub-Customizer or Q!

After it starts it will read your boot script similar to bootinfoscript so wait a few seconds for it to finish then the boot information window will change color from grey to normal.

You can then edit the boot information for each drive as it was found.

to Add a new entry just press edit->Add then select Linux. using the tab button verify that the disk UUID matches the disk you want to boot from.

click finish.

click save button

verify your edits manual view the grub-boot menu to ensure edits were saved. I am assuming your grub boot loader is on hd0 or sda0. cat out

/hd0/boot/grub/grub.cfg # don't edit this file just view or verify it. or run your bootinfoscript again.

if this doesn't fix the problem then you could be having issues with the kernel. I had to reinstall my Ubuntu-LTS this way because another Linux 64bit install diddled with the boot loader too much. If your using a 64bit machine then verify that the usb-drive /pendrive is also 64-bit OS. Otherwise the USB driver will fork when it tries to load the USB drive.

It was a good idea that the new OS be kept small about 6-10MB so you don't hit the upper bound limits on Large GB-HDs. You also need to verify that any external USB drivers are installed before grub runs. To do this press the down-arrow key on the purple screen to see what modules are being installed and which ones fork.

If this didn't help you try using a rescue disk to pick up the missing kernel/files. I use bootrecovery-CD (sourceforge:boot-repair-diskx64) or Linux-remix-CD (www.ubuntu-rescue-remix.org) when things go wrong with Grub-Customizer.

Solution 3

Change your booting preferences to boot from the external hard disk. The computer is trying to find grub on your in- built HDD but its actually in the external HDD. So you will have to change your booting options to use that external HDD for booting as the first preference and then the in - built HDD the second preference. So if your insert your external HDD then it will automatically boot ubuntu and if you don't then it will boot up the system that you have installed it in the in - built HDD.

Share:
59,380

Related videos on Youtube

Tomasz Grabowski
Author by

Tomasz Grabowski

Updated on September 18, 2022

Comments

  • Tomasz Grabowski
    Tomasz Grabowski over 1 year

    i'm trying to install Ubuntu. I don't know if it is important, but i'm trying to install it on external HDD.

    In the end i have external bootable HDD which only displays:

    error: file not found
    grub recovery>
    

    From the beginning:

    • I've downloaded ubuntu-12.04-desktop-i386.iso
    • I've used LiLi USB Creator (LinuxLive) to create bootable pendrive from that image
    • I've bootet from it, it works
    • I've clicked "Try ubuntu", it works too.

    I've used GParted to look over drivers (disks)

    My primary embedded disk is seen as /dev/sda

    My attached external disk as /dev/sdb

    My PenDrive as /dev/sdc

    • I've created partitions on /dev/sdb

    • Fist partition for system (over 200GiB)

    • Second was there already (it's xsf, and i don't want to touch it :P)
    • Third is extended partition, with 1 locital partiton (10GiB) for swap

    • I've started installation

    • i've choose "somethin else" in ... i belive secound screeb
    • then is selected /dev/sdb as boot disk
    • for first partiton of /dev/sdb i set i want ext3 file system, i've check "formattin" checkbox, and mount path set to "/"
    • firs logical partiton set as swap partition

    After installation finished, i restarted my computer. When i boot from my primary disc it's work ok, my previous operating system - vista - works ok. When i set my BIOS to boot from my external disc, i only get that message:

    error: file not found
    grub recovery>
    
    • I've try to reinstall it, but didn't help...

    In desperation, i've try to read a bit about that "grub recovery>" command-line and experiment a bit... I'm not sure if this has had any point, or if it give you some information (notice, that i don't know what i'm doing :P )

    when i've type command:

    insmod (hd1,1)/boot/grub/linux.mod
    

    i've get message:

    unknown filesystem
    

    the same with:

    insmod (hd1,msdos1)/boot/grub/linux.mod
    

    the same with:

    insmod ext3
    

    but i get no message after command:

    insmod ext2
    

    ...

    notice that i really don't know what this command exactly do, but than i thought that maybe if i reinstall ubuntu with ext2 filesystem, it will work. I've done that, but symptoms are the same.

    I've go back to that Live version of ubuntu, filesystem and basics directories seems to be present on /dev/sdb1 ... i'm completely unfamiliar with GRUB. I'm also don't know which wersion of GRUB it is, i hope there is only one version on ubuntu-12.04-desktop-i386.iso

    Any help? Thax

    ======================= edit 17.06.2012 22:05 =========================

    This is RESULTS.txt from bootinfoscript

    sda is my in-build HDD

    sdb is external HDD (disk-destination for Ubuntu)

    sdc is PenDrive with Live Ubuntu

                      Boot Info Script 0.61      [1 April 2012]
    
    
    ============================= Boot Info Summary: ===============================
    
     => Windows is installed in the MBR of /dev/sda.
     => Grub2 (v1.99) is installed in the MBR of /dev/sdb and looks at sector 1 of 
        the same hard drive for core.img. core.img is at this location and looks 
        for (,msdos1)/boot/grub on this drive.
     => Syslinux MBR (4.04 and higher) is installed in the MBR of /dev/sdc.
    
    sda1: __________________________________________________________________________
    
        File system:       vfat
        Boot sector type:  Windows 7: FAT32
        Boot sector info:  No errors found in the Boot Parameter Block.
        Operating System:  
        Boot files:        /bootmgr /boot/bcd
    
    sda2: __________________________________________________________________________
    
        File system:       ntfs
        Boot sector type:  Windows Vista/7: NTFS
        Boot sector info:  No errors found in the Boot Parameter Block.
        Operating System:  Windows Vista
        Boot files:        /bootmgr /Boot/BCD /Windows/System32/winload.exe
    
    sda3: __________________________________________________________________________
    
        File system:       Extended Partition
        Boot sector type:  -
        Boot sector info: 
    
    sda5: __________________________________________________________________________
    
        File system:       ntfs
        Boot sector type:  Windows Vista/7: NTFS
        Boot sector info:  According to the info in the boot sector, sda5 starts 
                           at sector 63.
        Operating System:  
        Boot files:        
    
    sdb1: __________________________________________________________________________
    
        File system:       ext2
        Boot sector type:  -
        Boot sector info: 
        Operating System:  Ubuntu 12.04 LTS
        Boot files:        /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img
    
    sdb3: __________________________________________________________________________
    
        File system:       xfs
        Boot sector type:  -
        Boot sector info: 
        Mounting failed:   mount: /dev/sdb3: can't read superblock
    
    sdb4: __________________________________________________________________________
    
        File system:       Extended Partition
        Boot sector type:  -
        Boot sector info: 
    
    sdb5: __________________________________________________________________________
    
        File system:       swap
        Boot sector type:  -
        Boot sector info: 
    
    sdc1: __________________________________________________________________________
    
        File system:       vfat
        Boot sector type:  SYSLINUX 4.04 2011-04-18
        Boot sector info:  Syslinux looks at sector 3250552 of /dev/sdc1 for its 
                           second stage. SYSLINUX is installed in the  directory. 
                           The integrity check of the ADV area failed. No errors 
                           found in the Boot Parameter Block.
        Operating System:  
        Boot files:        /syslinux/syslinux.cfg /ldlinux.sys
    
    ============================ Drive/Partition Info: =============================
    
    Drive: sda _____________________________________________________________________
    
    Disk /dev/sda: 160.0 GB, 160041885696 bytes
    16 heads, 63 sectors/track, 310101 cylinders, total 312581808 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    
    Partition  Boot  Start Sector    End Sector  # of Sectors  Id System
    
    /dev/sda1               2,048    20,482,047    20,480,000  1c Hidden W95 FAT32 (LBA)
    /dev/sda2    *     20,482,048   176,771,071   156,289,024   7 NTFS / exFAT / HPFS
    /dev/sda3         176,771,072   312,580,095   135,809,024   f W95 Extended (LBA)
    /dev/sda5         176,773,120   312,580,095   135,806,976   7 NTFS / exFAT / HPFS
    
    
    Drive: sdb _____________________________________________________________________
    
    Disk /dev/sdb: 640.1 GB, 640135028736 bytes
    255 heads, 63 sectors/track, 77825 cylinders, total 1250263728 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    
    Partition  Boot  Start Sector    End Sector  # of Sectors  Id System
    
    /dev/sdb1    *          2,048   574,773,569   574,771,522  83 Linux
    /dev/sdb3         574,773,570 1,208,315,584   633,542,015   7 NTFS / exFAT / HPFS
    /dev/sdb4       1,208,317,950 1,229,289,471    20,971,522   f W95 Extended (LBA)
    /dev/sdb5       1,208,317,952 1,229,289,471    20,971,520  82 Linux swap / Solaris
    
    
    Drive: sdc _____________________________________________________________________
    
    Disk /dev/sdc: 1971 MB, 1971322880 bytes
    129 heads, 40 sectors/track, 746 cylinders, total 3850240 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    
    Partition  Boot  Start Sector    End Sector  # of Sectors  Id System
    
    /dev/sdc1    *             40     3,850,239     3,850,200   6 FAT16
    
    
    "blkid" output: ________________________________________________________________
    
    Device           UUID                                   TYPE       LABEL
    
    /dev/loop0                                              squashfs   
    /dev/loop1       7aa47a24-93a0-d54f-a03c-495cf2ee0927   ext2       
    /dev/sda1        3C98-AC5D                              vfat       RECOVERY
    /dev/sda2        94CA2D3CCA2D1BCC                       ntfs       VistaOS
    /dev/sda5        A2F09F72F09F4B83                       ntfs       DATA
    /dev/sdb1        a4befd4a-f91f-4f09-9d5f-a44991ed6a2e   ext2       
    /dev/sdb3        973a36d7-5828-4291-b455-db286cd69668   xfs        
    /dev/sdb5        9ce43dea-fd93-4343-969d-1243397724bd   swap       
    /dev/sdc1        7232-C522                              vfat       GOODDRIVE
    
    ================================ Mount points: =================================
    
    Device           Mount_Point              Type       Options
    
    /dev/loop0       /rofs                    squashfs   (ro,noatime)
    /dev/sdc1        /cdrom                   vfat       (rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
    
    
    =========================== sdb1/boot/grub/grub.cfg: ===========================
    
    --------------------------------------------------------------------------------
    #
    # DO NOT EDIT THIS FILE
    #
    # It is automatically generated by grub-mkconfig using templates
    # from /etc/grub.d and settings from /etc/default/grub
    #
    
    ### BEGIN /etc/grub.d/00_header ###
    if [ -s $prefix/grubenv ]; then
      set have_grubenv=true
      load_env
    fi
    set default="0"
    if [ "${prev_saved_entry}" ]; then
      set saved_entry="${prev_saved_entry}"
      save_env saved_entry
      set prev_saved_entry=
      save_env prev_saved_entry
      set boot_once=true
    fi
    
    function savedefault {
      if [ -z "${boot_once}" ]; then
        saved_entry="${chosen}"
        save_env saved_entry
      fi
    }
    
    function recordfail {
      set recordfail=1
      if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
    }
    
    function load_video {
      insmod vbe
      insmod vga
      insmod video_bochs
      insmod video_cirrus
    }
    
    insmod part_msdos
    insmod ext2
    set root='(hd1,msdos1)'
    search --no-floppy --fs-uuid --set=root a4befd4a-f91f-4f09-9d5f-a44991ed6a2e
    if loadfont /usr/share/grub/unicode.pf2 ; then
      set gfxmode=auto
      load_video
      insmod gfxterm
      insmod part_msdos
      insmod ext2
      set root='(hd1,msdos1)'
      search --no-floppy --fs-uuid --set=root a4befd4a-f91f-4f09-9d5f-a44991ed6a2e
      set locale_dir=($root)/boot/grub/locale
      set lang=pl_PL
      insmod gettext
    fi
    terminal_output gfxterm
    if [ "${recordfail}" = 1 ]; then
      set timeout=-1
    else
      set timeout=10
    fi
    ### END /etc/grub.d/00_header ###
    
    ### BEGIN /etc/grub.d/05_debian_theme ###
    set menu_color_normal=white/black
    set menu_color_highlight=black/light-gray
    if background_color 44,0,30; then
      clear
    fi
    ### END /etc/grub.d/05_debian_theme ###
    
    ### BEGIN /etc/grub.d/10_linux ###
    function gfxmode {
        set gfxpayload="$1"
        if [ "$1" = "keep" ]; then
            set vt_handoff=vt.handoff=7
        else
            set vt_handoff=
        fi
    }
    if [ ${recordfail} != 1 ]; then
      if [ -e ${prefix}/gfxblacklist.txt ]; then
        if hwmatch ${prefix}/gfxblacklist.txt 3; then
          if [ ${match} = 0 ]; then
            set linux_gfx_mode=keep
          else
            set linux_gfx_mode=text
          fi
        else
          set linux_gfx_mode=text
        fi
      else
        set linux_gfx_mode=keep
      fi
    else
      set linux_gfx_mode=text
    fi
    export linux_gfx_mode
    if [ "$linux_gfx_mode" != "text" ]; then load_video; fi
    menuentry 'Ubuntu, za pomocą systemu Linux 3.2.0-23-generic-pae' --class ubuntu --class gnu-linux --class gnu --class os {
        recordfail
        gfxmode $linux_gfx_mode
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='(hd1,msdos1)'
        search --no-floppy --fs-uuid --set=root a4befd4a-f91f-4f09-9d5f-a44991ed6a2e
        linux   /boot/vmlinuz-3.2.0-23-generic-pae root=/dev/sdb1 ro   quiet splash $vt_handoff
        initrd  /boot/initrd.img-3.2.0-23-generic-pae
    }
    menuentry 'Ubuntu, za pomocą systemu Linux 3.2.0-23-generic-pae (tryb ratunkowy)' --class ubuntu --class gnu-linux --class gnu --class os {
        recordfail
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='(hd1,msdos1)'
        search --no-floppy --fs-uuid --set=root a4befd4a-f91f-4f09-9d5f-a44991ed6a2e
        echo    'Wczytywanie systemu Linux 3.2.0-23-generic-pae...'
        linux   /boot/vmlinuz-3.2.0-23-generic-pae root=/dev/sdb1 ro recovery nomodeset 
        echo    'Wczytywanie początkowego dysku RAM...'
        initrd  /boot/initrd.img-3.2.0-23-generic-pae
    }
    ### END /etc/grub.d/10_linux ###
    
    ### BEGIN /etc/grub.d/20_linux_xen ###
    ### END /etc/grub.d/20_linux_xen ###
    
    ### BEGIN /etc/grub.d/20_memtest86+ ###
    menuentry "Memory test (memtest86+)" {
        insmod part_msdos
        insmod ext2
        set root='(hd1,msdos1)'
        search --no-floppy --fs-uuid --set=root a4befd4a-f91f-4f09-9d5f-a44991ed6a2e
        linux16 /boot/memtest86+.bin
    }
    menuentry "Memory test (memtest86+, serial console 115200)" {
        insmod part_msdos
        insmod ext2
        set root='(hd1,msdos1)'
        search --no-floppy --fs-uuid --set=root a4befd4a-f91f-4f09-9d5f-a44991ed6a2e
        linux16 /boot/memtest86+.bin console=ttyS0,115200n8
    }
    ### END /etc/grub.d/20_memtest86+ ###
    
    ### BEGIN /etc/grub.d/30_os-prober ###
    menuentry "Windows Recovery Environment (loader) (on /dev/sda1)" --class windows --class os {
        insmod part_msdos
        insmod fat
        set root='(hd0,msdos1)'
        search --no-floppy --fs-uuid --set=root 3C98-AC5D
        drivemap -s (hd0) ${root}
        chainloader +1
    }
    menuentry "Windows Vista (loader) (on /dev/sda2)" --class windows --class os {
        insmod part_msdos
        insmod ntfs
        set root='(hd0,msdos2)'
        search --no-floppy --fs-uuid --set=root 94CA2D3CCA2D1BCC
        chainloader +1
    }
    ### END /etc/grub.d/30_os-prober ###
    
    ### BEGIN /etc/grub.d/40_custom ###
    # This file provides an easy way to add custom menu entries.  Simply type the
    # menu entries you want to add after this comment.  Be careful not to change
    # the 'exec tail' line above.
    ### END /etc/grub.d/40_custom ###
    
    ### BEGIN /etc/grub.d/41_custom ###
    if [ -f  $prefix/custom.cfg ]; then
      source $prefix/custom.cfg;
    fi
    ### END /etc/grub.d/41_custom ###
    --------------------------------------------------------------------------------
    
    =============================== sdb1/etc/fstab: ================================
    
    --------------------------------------------------------------------------------
    # /etc/fstab: static file system information.
    #
    # Use 'blkid' to print the universally unique identifier for a
    # device; this may be used with UUID= as a more robust way to name devices
    # that works even if disks are added and removed. See fstab(5).
    #
    # <file system> <mount point>   <type>  <options>       <dump>  <pass>
    proc            /proc           proc    nodev,noexec,nosuid 0       0
    # / was on /dev/sdb1 during installation
    UUID=a4befd4a-f91f-4f09-9d5f-a44991ed6a2e /               ext2    errors=remount-ro 0       1
    # swap was on /dev/sdb5 during installation
    UUID=9ce43dea-fd93-4343-969d-1243397724bd none            swap    sw              0       0
    --------------------------------------------------------------------------------
    
    =================== sdb1: Location of files loaded by Grub: ====================
    
               GiB - GB             File                                 Fragment(s)
    
                   =                boot/grub/core.img                             1
                   =                boot/grub/grub.cfg                             1
                   =                boot/initrd.img-3.2.0-23-generic-pae           6
                   =                boot/vmlinuz-3.2.0-23-generic-pae              3
                   =                initrd.img                                     6
                   =                vmlinuz                                        3
    
    ========================= sdc1/syslinux/syslinux.cfg: ==========================
    
    --------------------------------------------------------------------------------
    # D-I config version 2.0
    include menu.cfg
    default vesamenu.c32
    prompt 0
    timeout 50
    ui gfxboot bootlogo
    --------------------------------------------------------------------------------
    
    ================= sdc1: Location of files loaded by Syslinux: ==================
    
               GiB - GB             File                                 Fragment(s)
    
                ?? = ??             ldlinux.sys                                    1
                ?? = ??             syslinux/chain.c32                             1
                ?? = ??             syslinux/gfxboot.c32                           1
                ?? = ??             syslinux/syslinux.cfg                          1
                ?? = ??             syslinux/vesamenu.c32                          1
    
    ============== sdc1: Version of COM32(R) files used by Syslinux: ===============
    
     syslinux/chain.c32                 :  COM32R module (v4.xx)
     syslinux/gfxboot.c32               :  COM32R module (v4.xx)
     syslinux/vesamenu.c32              :  COM32R module (v4.xx)
    
    =============================== StdErr Messages: ===============================
    
    xz: (stdin): Compressed data is corrupt
    awk: cmd. line:36: Math support is not compiled in
    awk: cmd. line:36: Math support is not compiled in
    awk: cmd. line:36: Math support is not compiled in
    awk: cmd. line:36: Math support is not compiled in
    awk: cmd. line:36: Math support is not compiled in
    awk: cmd. line:36: Math support is not compiled in
    /home/ubuntu/Pobrane/bootinfoscript-061/bootinfoscript: line 1646: [: 2.73495e+09: integer expression expected
    

    I have to say that script print on terminal:

    Boot Info Script 0.61      [1 April 2012]
    
    
    "gawk" could not be found, using "busybox awk" instead.
    This may lead to unreliable results.
    
    Identifying MBRs...
    Computing Partition Table of /dev/sda...
    Computing Partition Table of /dev/sdb...
    Computing Partition Table of /dev/sdc...
    Searching sda1 for information... 
    Searching sda2 for information... 
    Searching sda3 for information... 
    Searching sda5 for information... 
    Searching sdb1 for information... 
    Searching sdb3 for information... 
    Searching sdb4 for information... 
    Searching sdb5 for information... 
    Searching sdc1 for information... 
    
    Finished. The results are in the file "RESULTS.txt"
    located in "/home/ubuntu/Pobrane/bootinfoscript-061/".
    

    ============== edit 18.06.2012 18:38 ===============

    ok, this is more or less copy of my grub recovery session:

    error: file not found
    grub recovery> set
    prefix=(hd0,msdos1)/boot/grub
    root=hd0,msdos1
    grub recovery> ls
    (hd0) (hd0,msdos3) (hd0,msdos1) (hd1) (hd1,msdos5) (hd1,msdos2) (hd1,msdos1)
    grub recovery> ls $prefix
    
    error: file not found
    grub recovery> 
    

    then i've used 'ls' cmd on few path, results are strange (i think):

    grub recovery> ls (hd0,msdos1)/boot
    
    grub recovery> ls (hd0,msdos1)/boot/grub
    
    error: file not found
    grub recovery> ls (hd0,msdos1)/lib
    
    grub recovery> ls (hd0,msdos1)/bin
    
    grub recovery> ls (hd0,msdos1)/sys
    ./ ../
    grub recovery> ls (hd0,msdos1)/sbin
    
    grub recovery> ls (hd0,msdos1)/usr
    ./ ../ local/ (and some other things)
    

    is this normal? i can see /boot/grub and its content when i mount this external HDD by Live Ubuntu

    • Oscar
      Oscar almost 12 years
      At the grub rescue shell, could you run "set" (which will print all environment variables) and post what the exact value of $prefix is? Could you also run "ls", and "ls $prefix" and post the output of both? (if it's too much work to copy it down exactly, taking a picture with a camera and posting that works too).
  • Tomasz Grabowski
    Tomasz Grabowski almost 12 years
    This is the solution. Thank you for your knowledge and time. Now i'm happy user of Ubuntu :P