New menu entry in GRUB2, "file not found" and "you need to load the kernel first" errors

11,388

Because you have a dedicated /boot partition ( you probably don't need one ), that partition has no directory named /boot, hence why the files are not found. Remove the /boot from the path.

Share:
11,388

Related videos on Youtube

r4czek
Author by

r4czek

Updated on September 18, 2022

Comments

  • r4czek
    r4czek over 1 year

    I wanted to add new menu entry to my GRUB2 list. This is how I tried to do this and necessary info:

    Erros after choosing "Debian Wheezy" menu entry from GRUB2 list:

    error:file not found
    error:you need to load the kernel first
    

    /etc/grub.d/12_debian

    #!/bin/sh -e
    cat << EOF
    menuentry "Debian Wheezy" {
    set root=(hd0,5)
    linux /boot/vmlinuz-3.2.0-3-amd64
    initrd /boot/initrd.img-3.2.0-3-amd64
    }
    EOF
    

    ls /boot

    config-3.2.0-3-amd64  initrd.img-3.2.0-3-amd64  vmlinuz-3.2.0-3-amd64
    grub                  System.map-3.2.0-3-amd64
    

    Partitioning

    sda1 - ntfs - Windows boot
    sda2 - ntfs - Windows C:
    sda3 - ntfs - Windows D:
    sda4 - extended
    -sda5 - ext4 - /boot
    -sda6 - lvm - Debian testing
    And inside sda6 there's LVM group calld G1 divided into volumes:
    home, root, tmp, usr, var, swap
    

    Sources that I used during my unsuccessful of setting everything up.

    GRUB2 Naming convention

    GRUB 2 bootloader - Full tutorial on Dedoimedo.com

    What's wrong?

    EDIT #1

    fdisk -l

       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *        2048      206847      102400    7  HPFS/NTFS/exFAT
    /dev/sda2          206848    83473739    41633446    7  HPFS/NTFS/exFAT
    /dev/sda3        83473799   935802314   426164258    7  HPFS/NTFS/exFAT
    /dev/sda4       935802315   976771071    20484378+   f  W95 Ext'd (LBA)
    /dev/sda5       935802880   936779775      488448   83  Linux
    /dev/sda6       936781824   976771071    19994624   8e  Linux LVM
    

    EDIT #2

    Grub console

    linux /[TAB]
    Possible files are:
    lost+found/ bin/ share/ sbin/ lib/ include/ src/ games/ local/
    
    set root=(hd0,msdos5)
    linux/[TAB]
    Possible files are:
    lost+found/ config-3.2.0-3-amd64 vmlinuz-3.2.0-3-amd64 grub/ 
    System.map-3.2.0-3-amd64 initrd.img-3.2.0-3-amd64
    

    Grub console, boot test

    set root=(hd0,msdos5)
    linux /vmlinuz-3.2.0-3-amd64 root=/dev/G1/root
    initrd /initrd.img-3.2.0-3-amd64
    boot
    
    #Many, many, many lines of text. After few seconds they stop. The most
    #interesting i think are:
    
    ALERT! /dev/G1/root does not exist. Dropping to a shell!
    /bin/sh: can't access tty; job control turned off
    

    /etc/grub.d/12_debian another try

    #!/bin/sh -e
    cat << EOF
    menuentry "Debian Wheezy" {
    insmod ext4
    set root=(hd0,msdos5)
    echo 'loading...'
    linux /vmlinuz-3.2.0-3-amd64
    echo 'starting kernel...'
    initrd /initrd.img-3.2.0-3-amd64
    }
    EOF
    

    Result:

    error:file not found
    loading...
    starting kernel...
    

    EDIT #3

    part of /boot/grub/grub.cfg

    ### BEGIN /etc/grub.d/10_linux ###
    menuentry 'Debian GNU/Linux, with Linux 3.2.0-3-amd64' --class debian --    class gnu-linux --class gnu --class os {
        insmod gzio
        insmod lvm
        insmod part_msdos
        insmod ext2
        set root='(G1-root)'
        search --no-floppy --fs-uuid --set=root 94215fad-dcbe-4339-92be-f562b1b37133
        echo    'Loading Linux 3.2.0-3-amd64 ...'
        linux   /boot/vmlinuz-3.2.0-3-amd64 root=/dev/mapper/G1-root ro  quiet
        echo    'Loading initial ramdisk ...'
        initrd  /boot/initrd.img-3.2.0-3-amd64
    }
    ### END /etc/grub.d/10_linux ###
    

    /etc/grub.d/12_debian next try

    #!/bin/sh -e
    cat << EOF
    menuentry "Debian Wheezy" {
    insmod ext4
    set root=(hd0,msdos5)
    echo 'loading...'
    linux /vmlinuz-3.2.0-3-amd64 root=/dev/mapper/G1-root
    echo 'starting kernel...'
    initrd /initrd.img-3.2.0-3-amd64
    }
    

    Result

    error:file not found
    loading...
    starting kernel...
    
  • r4czek
    r4czek over 11 years
    Still, the same problem: error: file not found. loading... error:file not found. starting kernel... error:you need to load the kernel first Where I could make a mistake? Maybe there's something I could check that'll help with diagnosis? I've posted "fdisk -l" in my question.
  • perilbrain
    perilbrain over 11 years
    I will suggest you to first troubleshoot it at grubs command prompt. Probably grub is unable to locate the file.You can put command in line by line order, and use tab key to see if grub can locate the file.Example linux [press TAB]/boot/[press TAB] if your file is listed then its some other problem otherwise use a right value in set root
  • r4czek
    r4czek over 11 years
    I think that there's some progress... I added some new info in my first post!
  • perilbrain
    perilbrain over 11 years
    @r4czek:- Can you paste your grub.cfg somewhere where I can read.I'll recommend to copy paste the contents from some other menu after linux /boot/vmlinuz-3.2.0-3-amd64. like root=UUID=... OR root=/dev/disk/by-id/...
  • r4czek
    r4czek over 11 years
    @perlibrain That was my first guess and I've tried it without success... I posted everything you asked for and another try with my menuentry. PS. Thank you for your endurance and help!
  • vonbrand
    vonbrand over 11 years
    Where did you get this stuff from? Installing a kernel should create the correct entries automatically...
  • Martin Mucha
    Martin Mucha over 2 years
    @vonbrand well, 9y into future and no, sometimes correct entries aren't created automatically, neither by grub2-mkconfig.