Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: Completely messed up my Grub

  1. #1
    Join Date
    May 2008
    Beans
    42

    Completely messed up my Grub

    I wanted to take some of the options out from Grub and ended up erasing something important. It gives me an error 11, and wont give me the option to boot into Ubuntu (Jaunty).
    ubuntu@ubuntu:~$ sudo fdisk -l

    Disk /dev/sda: 80.0 GB, 80026361856 bytes
    255 heads, 63 sectors/track, 9729 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0x40df40de

    Device Boot Start End Blocks Id System
    /dev/sda1 * 1 7649 61440561 7 HPFS/NTFS
    /dev/sda2 7650 9729 16707600 5 Extended
    /dev/sda5 7650 9729 16707568+ 83 Linux

    Disk /dev/sdc: 1031 MB, 1031798784 bytes
    255 heads, 63 sectors/track, 125 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0x9a36bbaa

    Device Boot Start End Blocks Id System
    /dev/sdc1 1 125 1004031 b W95 FAT32
    ubuntu@ubuntu:~$


    I also tried this from the live cd...

    This will restore grub if you already had grub installed but lost it to a windows install or some other occurence that erased/changed your MBR so that grub no longer appears at start up or it returns an error.

    (This how to is written for Ubuntu but should work on other systems. The only thing to take note of, when you see "sudo" that will mean to you that the following command should be entered at a root terminal.)

    Boot into the live Ubuntu cd. This can be the live installer cd or the older live session Ubuntu cds.

    When you get to the desktop open a terminal and enter. (I am going to give you the commands and then I will explain them later)

    Code:

    sudo grub

    This will get you a "grub>" prompt (i.e. the grub shell). At grub>. enter these commands

    Code:

    find /boot/grub/stage1

    This will return a location. If you have more than one, select the installation that you want to provide the grub files.
    Next, THIS IS IMPORTANT, whatever was returned for the find command use it in the next line (you are still at grub>. when you enter the next 3 commands)

    Code:

    root (hd?,?)

    Again use the value from the find command i.e. if find returned (hd0,1) then you would enter root (hd0,1)

    Next enter the command to install grub to the mbr

    Code:

    setup (hd0)

    Finally exit the grub shell
    Code:

    quit
    There is nothing in the notepad in the menu lst page...

  2. #2
    Join Date
    Jan 2009
    Beans
    366
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Completely messed up my Grub

    There can't be anything since it's not menu.lst you need to boot from HDD. Did you type correct option in root (hd?,?)? You need to enter values returned by find /boot/grub/stage1.

  3. #3
    Join Date
    Jul 2005
    Location
    Hughenden, Australia
    Beans
    5,089
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Completely messed up my Grub

    There is nothing in the notepad in the menu lst page...
    It's a common beginner's mistake to try to open the menu.lst in the live CD instead of in the hard disk partition. The live CD doesn't have a menu.lst file, so what you are probably actually doing is creating a new (empty) file and calling it 'menu.lst'.

    You are not the first and you won't be the last.
    The reason I know is because I tried it myself when I was new around here.

    What you need to do is 'mount' your hard disk installed Ubuntu file system (in the partition), and then access the file through the 'mount point', (through the live CD's /media directory).

    Here's a link that explains what I mean,
    Rescue your Linux system with a Live CD - includes commands for opening vital files.

    Regards, Herman
    Ubuntu user since 2004 (Warty Warthog)

  4. #4
    Join Date
    Apr 2009
    Beans
    78

    Re: Completely messed up my Grub

    I recked my grub so the delay was 0 so it loaded the default option straight away. my default was windows so a had to use the live cd to change it back.
    Did you not make a backup of the menu.lst when u first edited it. if you did use ur live cd to restore the backup.

  5. #5
    Join Date
    May 2008
    Beans
    42

    Re: Completely messed up my Grub

    I didnt make a backup and I really dont know how to edit the grub from within the live cd

  6. #6
    Join Date
    May 2008
    Beans
    42

    Re: Completely messed up my Grub

    Ok I think I can edit the grub but I dont know what Ubuntu info I should put...cause I didnt back it up, how can I getthis resolved.

  7. #7
    Join Date
    Apr 2009
    Beans
    78

    Re: Completely messed up my Grub

    As my name suggest a dont no much about linux so i cant offer any further help.

  8. #8
    Join Date
    May 2008
    Beans
    42

    Re: Completely messed up my Grub

    This is my sudo grub stuff so you guys can tell me what to write for lrst menu which I think I can edit without re
    [ Minimal BASH-like line editing is supported. For
    the first word, TAB lists possible command
    completions. Anywhere else TAB lists the possible
    completions of a device/filename. ]

    grub>

    grub> find /boot/grub/stage1
    (hd0,4)

    grub> root (hd0,4)

    grub> setup (hd0)
    Checking if "/boot/grub/stage1" exists... yes
    Checking if "/boot/grub/stage2" exists... yes
    Checking if "/boot/grub/e2fs_stage1_5" exists... yes
    Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 17 sectors are embedded.
    succeeded
    Running "install /boot/grub/stage1 (hd0) (hd0)1+17 p (hd0,4)/boot/grub/stage2
    /boot/grub/menu.lst"... succeeded
    Done.

    grub>
    installing grub



    this is my lrst menu contents
    # menu.lst - See: grub(8), info grub, update-grub(8)
    # grub-install(8), grub-floppy(8),
    # grub-md5-crypt, /usr/share/doc/grub
    # and /usr/share/doc/grub-doc/.

    ## default num
    # Set the default entry to the entry number NUM. Numbering starts from 0, and
    # the entry number 0 is the default if the command is not used.
    #
    # You can specify 'saved' instead of a number. In this case, the default entry
    # is the entry saved with the command 'savedefault'.
    # WARNING: If you are using dmraid do not use 'savedefault' or your
    # array will desync and will not let you boot your system.
    default 0

    ## timeout sec
    # Set a timeout, in SEC seconds, before automatically booting the default entry
    # (normally the first entry defined).
    timeout 10

    ## hiddenmenu
    # Hides the menu by default (press ESC to see the menu)
    #hiddenmenu

    # Pretty colours
    #color cyan/blue white/blue

    ## password ['--md5'] passwd
    # If used in the first section of a menu file, disable all interactive editing
    # control (menu entry editor and command-line) and entries protected by the
    # command 'lock'
    # e.g. password topsecret
    # password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
    # password topsecret

    #
    # examples
    #
    # title Windows 95/98/NT/2000
    # root (hd0,0)
    # makeactive
    # chainloader +1
    #
    # title Linux
    # root (hd0,1)
    # kernel /vmlinuz root=/dev/hda2 ro
    #

    #
    # Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

    ### BEGIN AUTOMAGIC KERNELS LIST
    ## lines between the AUTOMAGIC KERNELS LIST markers will be modified
    ## by the debian update-grub script except for the default options below

    ## DO NOT UNCOMMENT THEM, Just edit them to your needs

    ## ## Start Default Options ##
    ## default kernel options
    ## default kernel options for automagic boot options
    ## If you want special options for specific kernels use kopt_x_y_z
    ## where x.y.z is kernel version. Minor versions can be omitted.
    ## e.g. kopt=root=/dev/hda1 ro
    ## kopt_2_6_8=root=/dev/hdc1 ro
    ## kopt_2_6_8_2_686=root=/dev/hdc2 ro
    # kopt=root=UUID=7d48d302-f0d0-4700-98a0-e967d414df40 ro

    ## default grub root device
    ## e.g. groot=(hd0,0)
    # groot=7d48d302-f0d0-4700-98a0-e967d414df40

    ## should update-grub create alternative automagic boot options
    ## e.g. alternative=true
    ## alternative=false
    # alternative=true

    ## should update-grub lock alternative automagic boot options
    ## e.g. lockalternative=true
    ## lockalternative=false
    # lockalternative=false

    ## additional options to use with the default boot option, but not with the
    ## alternatives
    ## e.g. defoptions=vga=791 resume=/dev/hda5
    # defoptions=quiet splash

    ## should update-grub lock old automagic boot options
    ## e.g. lockold=false
    ## lockold=true
    # lockold=false

    ## Xen hypervisor options to use with the default Xen boot option
    # xenhopt=

    ## Xen Linux kernel options to use with the default Xen boot option
    # xenkopt=console=tty0

    ## altoption boot targets option
    ## multiple altoptions lines are allowed
    ## e.g. altoptions=(extra menu suffix) extra boot options
    ## altoptions=(recovery) single
    # altoptions=(recovery mode) single

    ## controls how many kernels should be put into the menu.lst
    ## only counts the first occurence of a kernel, not the
    ## alternative kernel options
    ## e.g. howmany=all
    ## howmany=7
    # howmany=all

    ## specify if running in Xen domU or have grub detect automatically
    ## update-grub will ignore non-xen kernels when running in domU and vice versa
    ## e.g. indomU=detect
    ## indomU=true
    ## indomU=false
    # indomU=detect

    ## should update-grub create memtest86 boot option
    ## e.g. memtest86=true
    ## memtest86=false
    # memtest86=true

    ## should update-grub adjust the value of the default booted system
    ## can be true or false
    # updatedefaultentry=false

    ## should update-grub add savedefault to the default options
    ## can be true or false
    # savedefault=false

    ## ## End Default Options ##

    title Ubuntu


    ### END DEBIAN AUTOMAGIC KERNELS LIST

    # This is a divider, added to separate the menu items below from the Debian
    # ones.
    title Other operating systems:
    root


    # This entry automatically added by the Debian installer for a non-linux OS
    # on /dev/sda1
    title Windows XP
    rootnoverify (hd0,0)
    savedefault
    makeactive
    chainloader +1
    As you can see I erased pretty much everything...lol

  9. #9
    Join Date
    May 2008
    Beans
    42

    Re: Completely messed up my Grub

    I found a sample online and took a shot at it and while it changed grub (at least I can access it (thanks Herman) it said error 15 cant find file...
    title Ubuntu, kernel 2.6.17-10-generic
    root (hd0,4)
    kernel /boot/vmlinuz-2.6.17-10-generic root=/dev/sda5 ro quiet splash
    initrd /boot/initrd.img-2.6.17-10-generic
    quiet
    savedefault
    boot

    title Ubuntu, kernel 2.6.17-10-generic (recovery mode)
    root (hd0,4)
    kernel /boot/vmlinuz-2.6.17-10-generic root=/dev/sda5 ro single
    initrd /boot/initrd.img-2.6.17-10-generic
    boot

    title Ubuntu, memtest86+
    root (hd0,4)
    kernel /boot/memtest86+.bin
    quiet
    boot


    ### END DEBIAN AUTOMAGIC KERNELS LIST

    # This is a divider, added to separate the menu items below from the Debian
    # ones.
    title Other operating systems:
    root


    # This entry automatically added by the Debian installer for a non-linux OS
    # on /dev/sda1
    title Windows vvXP
    rootnoverify (hd0,0)
    savedefault
    makeactive
    chainloader +1
    I just need to know what to write for root and kernal...

  10. #10
    Join Date
    May 2008
    Beans
    42

    Re: Completely messed up my Grub

    I tried again and got error 17, if someone can help me get my grub info, I could enter it real quick.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •