Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: Grub troubles after deleting partition..

  1. #1
    Join Date
    Mar 2011
    Location
    New Zealand
    Beans
    443
    Distro
    Ubuntu 12.04 Precise Pangolin

    Grub troubles after deleting partition..

    I had ubuntu 11.04 and 11.10 installed on my laptop. After restoring my home folder I proceeded to delete the partition with 11.10 on it (I decided to keep 11.04).
    After deleting the partition and rebooting my pc, I'm left with a grub rescue> prompt.
    I have tried all the tutorials I could find, I have tried boot-repair but that didn't fix it.
    atm I'm running from a liveusb with ubuntu 11.04 on it, Im stumped.
    Code:
     sudo fdisk -l
    
    Disk /dev/sda: 60.0 GB, 60011642880 bytes
    255 heads, 63 sectors/track, 7296 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x3ea65017
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1               1        1212     9732631    7  HPFS/NTFS
    /dev/sda2            1212        7296    48871425    5  Extended
    /dev/sda5            7042        7296     2043904   82  Linux swap / Solaris
    /dev/sda6            1212        6069    39016122+  83  Linux
    /dev/sda7   *        6070        7041     7807558+  83  Linux
    
    Partition table entries are not in disk order
    
    Disk /dev/sdb: 2065 MB, 2065694720 bytes
    64 heads, 62 sectors/track, 1016 cylinders
    Units = cylinders of 3968 * 512 = 2031616 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x000b6e2c
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1   *           1        1016     2015713    c  W95 FAT32 (LBA)
    ubuntu@ubuntu:~$
    EDIT: sda1 is windows xp
    sda2 extended
    sda5 swap
    sda6 home
    sda7 has the 11.04 system on it
    Last edited by jonnyboysmithy; November 17th, 2011 at 09:18 PM.

  2. #2
    Join Date
    Mar 2011
    Location
    New Zealand
    Beans
    443
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Grub troubles after deleting partition..

    Code:
    ubuntu@ubuntu:~$ sudo mount dev/sda7 /media/mountpoint
    mount: special device dev/sda7 does not exist
    ubuntu@ubuntu:~$ sudo mount dev/sda7 /media/mountpoint
    this is where I'm stuck at. (the directory /media/mountpoint exists)

  3. #3
    Join Date
    Nov 2009
    Location
    Mataro, Spain
    Beans
    13,139
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Grub troubles after deleting partition..

    You're missing one more /.

    sudo mount /dev/sda7 /mnt (no need to create anything for temporary fix, /mnt exists by default)
    sudo grub-install --root-directory=/mnt /dev/sda

    It always has / at the start.

    I guess you are sure sda7 is your root since you are using that command.

    Another thing I noted is that the boot flag is on sda7 while it probably should be on sda1, the XP partition. On the other hand grub might boot XP successfully even without a boot flag. For windows bootloader it should be on sda1.
    Darko.
    -----------------------------------------------------------------------
    Ubuntu 14.04 LTS 64bit & Windows 10 Pro 64bit

  4. #4
    Join Date
    Mar 2011
    Location
    New Zealand
    Beans
    443
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Grub troubles after deleting partition..

    Quote Originally Posted by darkod View Post
    You're missing one more /.

    sudo mount /dev/sda7 /mnt (no need to create anything for temporary fix, /mnt exists by default)
    sudo grub-install --root-directory=/mnt /dev/sda

    It always has / at the start.

    I guess you are sure sda7 is your root since you are using that command.

    Another thing I noted is that the boot flag is on sda7 while it probably should be on sda1, the XP partition. On the other hand grub might boot XP successfully even without a boot flag. For windows bootloader it should be on sda1.
    Thanks! that worked. I manualy changed the boot flag, I've changed it back now.

  5. #5
    Join Date
    Mar 2011
    Location
    New Zealand
    Beans
    443
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Grub troubles after deleting partition..

    http://paste.ubuntu.com/741581/ probably a case of purging and reinstalling grub... (if i can manage that :/)
    EDIT: boot-repair couldn't fix my grub so I'll try manually when I've got time.
    Last edited by jonnyboysmithy; November 17th, 2011 at 10:06 PM.

  6. #6
    Join Date
    Nov 2009
    Location
    Mataro, Spain
    Beans
    13,139
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Grub troubles after deleting partition..

    You have no boot files or kernel files on sda7. Are you sure you deleted the correct partition? there doesn't seem to be an ubuntu installation present.
    Darko.
    -----------------------------------------------------------------------
    Ubuntu 14.04 LTS 64bit & Windows 10 Pro 64bit

  7. #7
    Join Date
    Mar 2011
    Location
    New Zealand
    Beans
    443
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Grub troubles after deleting partition..

    Quote Originally Posted by darkod View Post
    You have no boot files or kernel files on sda7. Are you sure you deleted the correct partition? there doesn't seem to be an ubuntu installation present.
    Oh...

    EDIT:Okay I'm sure I kept the right partititon, I installed some themes manually on the 11.04 partition and they are there.
    I can't make much of the log/report, what do you suggest I do?

    EDIT2: Heres a list of the files under /boot/

    /media/ffdb517d-a8fc-483a-80c0-8775fb906c4e/boot/grub
    /media/ffdb517d-a8fc-483a-80c0-8775fb906c4e/boot/abi-2.6.38-8-generic
    /media/ffdb517d-a8fc-483a-80c0-8775fb906c4e/boot/abi-2.6.38-12-generic
    /media/ffdb517d-a8fc-483a-80c0-8775fb906c4e/boot/config-2.6.38-8-generic
    /media/ffdb517d-a8fc-483a-80c0-8775fb906c4e/boot/config-2.6.38-12-generic
    /media/ffdb517d-a8fc-483a-80c0-8775fb906c4e/boot/initrd.img-2.6.38-8-generic
    /media/ffdb517d-a8fc-483a-80c0-8775fb906c4e/boot/initrd.img-2.6.38-12-generic
    /media/ffdb517d-a8fc-483a-80c0-8775fb906c4e/boot/memtest86+.bin
    /media/ffdb517d-a8fc-483a-80c0-8775fb906c4e/boot/memtest86+_multiboot.bin
    /media/ffdb517d-a8fc-483a-80c0-8775fb906c4e/boot/System.map-2.6.38-8-generic
    /media/ffdb517d-a8fc-483a-80c0-8775fb906c4e/boot/System.map-2.6.38-12-generic
    /media/ffdb517d-a8fc-483a-80c0-8775fb906c4e/boot/vmcoreinfo-2.6.38-8-generic
    /media/ffdb517d-a8fc-483a-80c0-8775fb906c4e/boot/vmcoreinfo-2.6.38-12-generic
    /media/ffdb517d-a8fc-483a-80c0-8775fb906c4e/boot/vmlinuz-2.6.38-8-generic
    /media/ffdb517d-a8fc-483a-80c0-8775fb906c4e/boot/vmlinuz-2.6.38-12-generic
    Last edited by jonnyboysmithy; November 18th, 2011 at 12:26 AM.

  8. #8
    Join Date
    Nov 2009
    Location
    Mataro, Spain
    Beans
    13,139
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Grub troubles after deleting partition..

    Uhhh, I've never done this, but I can give it a shot. If sda7 is surely the root partition, we can try entering it from live mode with chroot and trying to install the kernel and grub files. I know recreating grub files works, but installing a kernel is a different thing.

    First to enter as chroot:

    Code:
    sudo mount /dev/sda7 /mnt
    sudo mount --bind /dev /mnt/dev
    sudo mount --bind /sys /mnt/sys
    sudo mount --bind /proc /mnt/proc
    sudo chroot /mnt
    Now you should be inside as if the installation was running and not live mode. Trying to install the kernel and recreate grub files:

    Code:
    apt-get install linux-image (not sure if you need a number or it picks it up itself)
    grub-mkconfig
    update-grub
    Note: In the second group of commands you don't need to use sudo because entering with chroot you are already the root user.

    Hopefully if that worked, exit the chroot and unmount and reboot:

    Code:
    exit
    sudo umount /mnt/proc
    sudo umount /mnt/sys
    sudo umount /mnt/dev
    sudo umount /mnt
    Out of all this, it's actually the command about installing the kernel I'm not sure about. Try googling also if it gives you any ideas. The rest is surely working.

    EDIT after yout EDIT2. Looks like the kernel files are there, not sure why aren't they showing up. Try the above commands without the apt-get install to see if recreating the grub files will do the trick.
    Last edited by darkod; November 18th, 2011 at 12:29 AM.
    Darko.
    -----------------------------------------------------------------------
    Ubuntu 14.04 LTS 64bit & Windows 10 Pro 64bit

  9. #9
    Join Date
    Mar 2011
    Location
    New Zealand
    Beans
    443
    Distro
    Ubuntu 12.04 Precise Pangolin

    Smile Re: Grub troubles after deleting partition..

    Thank you very much for the help!
    All the commands ran smoothly.

    I rebooted and grub tells me it cannot find "the" partition, something is probably still directing it to the deleted partition.
    EDIT: it did fetch some archives and configure the kernel.

  10. #10
    Join Date
    Nov 2009
    Location
    Mataro, Spain
    Beans
    13,139
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Grub troubles after deleting partition..

    Grub on the MBR might still be looking for the old one. We should have run the command to reinstall on the MBR just in case. Do it again from live mode as before:

    Code:
    sudo mount /dev/sda7 /mnt
    sudo grub-install --root-directory=/mnt /dev/sda
    And after that (without rebooting), run the script again and post the link as you did previously. Lets look at it again after those commands.
    Darko.
    -----------------------------------------------------------------------
    Ubuntu 14.04 LTS 64bit & Windows 10 Pro 64bit

Page 1 of 3 123 LastLast

Tags for this Thread

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
  •