(Solved) Cannot boot Linux after deleting windows partition

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read how to get help
Post Reply
alkanator
Level 1
Level 1
Posts: 17
Joined: Mon Mar 19, 2012 6:52 pm

(Solved) Cannot boot Linux after deleting windows partition

Post by alkanator » Sat Dec 08, 2012 11:36 am

Until recently, I had been dual-booting Windows Vista and Linux Mint 12 without any problem. However Vista had become extremely bogged down (using 90% RAM while idling). So I backed up the windows partition, and attempted to do a clean install from the recovery partition. However, after the program from the recovery partition deleted the contents of the Windows partition, it returned an error and had me reboot. So I was left with an empty 90GB partition, a non-functioning 15GB recovery partition, and my working Linux partition. GRUB still worked fine. Then I decided to delete those two partitions, not thinking that one probably contained GRUB. Now when I boot, I just get a message saying it found no bootable media. I tried using "sudo apt-get install grub" and then "sudo update-grub" from a liveCD, but that didn't fix anything. How can I reinstall GRUB so that it works again?
Last edited by alkanator on Sun Dec 09, 2012 10:54 am, edited 1 time in total.

srs5694
Level 6
Level 6
Posts: 1391
Joined: Mon Feb 27, 2012 1:42 pm

Re: Cannot boot Linux after deleting windows partition

Post by srs5694 » Sat Dec 08, 2012 11:51 am

GRUB normally doesn't install to a Windows partition, so your symptoms are a bit weird. That said, you may be on the right track to recovery, but neither "sudo update-grub" nor "sudo apt-get install grub" is the right fix (although "apt-get install grub" might be a necessary pre-requisite). Instead, you need to use "grub-install" to install the GRUB binary to the disk's MBR; however, IIRC there are some extra options you need to make this work from an emergency disk. In particular, you need to tell it where your regular /boot directory is. Therefore, you should:
  1. Mount your regular Linux partition somewhere (say, /mnt). If you've got a separate /boot partition, mount it at /mnt/boot, too.
  2. In a shell, type "sudo grub-install --boot-directory /mnt/boot/ /dev/sda" to re-install GRUB. Change the path as necessary if you mounted your regular system somewhere other than /mnt.
If you have problems with this, give Super GRUB 2 Disk a try. With any luck, that will get you booted into your normal Linux installation, where you can type "sudo grub-install /dev/sda" without any special options to reinstall GRUB.

wayne128
Level 10
Level 10
Posts: 3412
Joined: Tue Jul 13, 2010 12:15 am

Re: Cannot boot Linux after deleting windows partition

Post by wayne128 » Sat Dec 08, 2012 11:52 am

boot from LiveCD
on terminal do

Code: Select all

sudo os-prober
so as to figure out which root partition is Linux OS installed, let say it is /dev/sda5
next command is to mount the sda5 and reinstall grub to MBR

Code: Select all

sudo mount /dev/sda5 /mnt
sudo grub-install --root-directory=/mnt /dev/sda

alkanator
Level 1
Level 1
Posts: 17
Joined: Mon Mar 19, 2012 6:52 pm

Re: Cannot boot Linux after deleting windows partition

Post by alkanator » Sat Dec 08, 2012 2:31 pm

Hmm. I tried the instructions on both of your posts, but each time I get

"grub-probe: error: cannot find a device for /boot (is /dev mounted?).
Installation finished. No error reported."

When I reboot, it just tells me to insert bootable media.

I also tried to Super GRUB2 Disk, and it booted to my Linux partition, but when I tried "sudo grub-install /dev/sda" it again gave me "Installation finished. No error reported." but did the same thing on reboot.

richardsdma
Level 2
Level 2
Posts: 53
Joined: Tue Jan 10, 2012 3:06 am
Location: romania
Contact:

Re: Cannot boot Linux after deleting windows partition

Post by richardsdma » Sat Dec 08, 2012 3:06 pm

you better get a W vista DVD and install vista. call to microsoft and they will tell you if you can activate vista with your serial code.
and then, from windows, with the help from easyBCD you can install grub on mint partition.

srs5694
Level 6
Level 6
Posts: 1391
Joined: Mon Feb 27, 2012 1:42 pm

Re: Cannot boot Linux after deleting windows partition

Post by srs5694 » Sat Dec 08, 2012 3:23 pm

richardsdma wrote:you better get a W vista DVD and install vista. call to microsoft and they will tell you if you can activate vista with your serial code.
and then, from windows, with the help from easyBCD you can install grub on mint partition.
I disagree. It is not necessary to install Windows on a standard PC to debug a Linux problem!

Instead, I recommend downloading the Boot Info Script, running it, and posting the RESULTS.txt file that it produces here, either within a code block or as a link. The cause of the problem is probably something that will show up in the Boot Info Script output, and identifying it will enable fixing the problem without scurrying back to Microsoft.

alkanator
Level 1
Level 1
Posts: 17
Joined: Mon Mar 19, 2012 6:52 pm

Re: Cannot boot Linux after deleting windows partition

Post by alkanator » Sat Dec 08, 2012 3:45 pm

Here are the results (I didn't know how to post as a link)

Code: Select all

                  Boot Info Script 0.61      [1 April 2012]


============================= Boot Info Summary: ===============================

 => Grub2 (v1.99) is installed in the MBR of /dev/sda and looks at sector 1 of 
    the same hard drive for core.img. core.img is at this location and looks 
    for (,msdos3)/boot/grub on this drive.

sda1: __________________________________________________________________________

    File system:       
    Boot sector type:  Unknown
    Boot sector info: 
    Mounting failed:   mount: unknown filesystem type ''

sda3: __________________________________________________________________________

    File system:       ext4
    Boot sector type:  -
    Boot sector info: 
    Operating System:  Linux Mint 12 Lisa
    Boot files:        /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img

============================ Drive/Partition Info: =============================

Drive: sda _____________________________________________________________________

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 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               8,192   102,408,191   102,400,000  83 Linux
/dev/sda3         227,497,984   312,580,095    85,082,112  83 Linux


"blkid" output: ________________________________________________________________

Device           UUID                                   TYPE       LABEL

/dev/loop0                                              squashfs   
/dev/sda3        5f6b9062-c4ba-48a9-8cea-412ff075a9d7   ext4       

================================ Mount points: =================================

Device           Mount_Point              Type       Options

/dev/loop0       /rofs                    squashfs   (ro,noatime)
/dev/sda3        /mnt                     ext4       (rw)
/dev/sr0         /cdrom                   iso9660    (ro,noatime)


=========================== sda3/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="6"
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='(hd0,msdos3)'
search --no-floppy --fs-uuid --set=root 5f6b9062-c4ba-48a9-8cea-412ff075a9d7
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  insmod part_msdos
  insmod ext2
  set root='(hd0,msdos3)'
  search --no-floppy --fs-uuid --set=root 5f6b9062-c4ba-48a9-8cea-412ff075a9d7
  set locale_dir=($root)/boot/grub/locale
  set lang=en_CA
  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 ###
insmod part_msdos
insmod ext2
set root='(hd0,msdos3)'
search --no-floppy --fs-uuid --set=root 5f6b9062-c4ba-48a9-8cea-412ff075a9d7
insmod png
if background_image /usr/share/images/desktop-base/spacefun-grub.png; then
  set color_normal=light-gray/black
  set color_highlight=white/black
else
  set menu_color_normal=white/black
  set menu_color_highlight=black/light-gray
  if background_color 0,0,0; then
    clear
  fi
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/06_mint_theme ###
set menu_color_normal=white/black
set menu_color_highlight=white/light-gray
### END /etc/grub.d/06_mint_theme ###

### BEGIN /etc/grub.d/10_linux ###
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 'Linux Mint 12 32-bit, 3.0.0-17-generic (/dev/sda3)' --class linuxmint --class gnu-linux --class gnu --class os {
	recordfail
	set gfxpayload=$linux_gfx_mode
	insmod gzio
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos3)'
	search --no-floppy --fs-uuid --set=root 5f6b9062-c4ba-48a9-8cea-412ff075a9d7
	linux	/boot/vmlinuz-3.0.0-17-generic root=UUID=5f6b9062-c4ba-48a9-8cea-412ff075a9d7 ro   quiet splash vt.handoff=7
	initrd	/boot/initrd.img-3.0.0-17-generic
}
menuentry 'Linux Mint 12 32-bit, 3.0.0-17-generic (/dev/sda3) -- recovery mode' --class linuxmint --class gnu-linux --class gnu --class os {
	recordfail
	insmod gzio
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos3)'
	search --no-floppy --fs-uuid --set=root 5f6b9062-c4ba-48a9-8cea-412ff075a9d7
	echo	'Loading Linux 3.0.0-17-generic ...'
	linux	/boot/vmlinuz-3.0.0-17-generic root=UUID=5f6b9062-c4ba-48a9-8cea-412ff075a9d7 ro recovery nomodeset 
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initrd.img-3.0.0-17-generic
}
submenu "Previous Linux versions" {
menuentry 'Linux Mint 12 32-bit, 3.0.0-12-generic (/dev/sda3)' --class linuxmint --class gnu-linux --class gnu --class os {
	recordfail
	set gfxpayload=$linux_gfx_mode
	insmod gzio
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos3)'
	search --no-floppy --fs-uuid --set=root 5f6b9062-c4ba-48a9-8cea-412ff075a9d7
	linux	/boot/vmlinuz-3.0.0-12-generic root=UUID=5f6b9062-c4ba-48a9-8cea-412ff075a9d7 ro   quiet splash vt.handoff=7
	initrd	/boot/initrd.img-3.0.0-12-generic
}
menuentry 'Linux Mint 12 32-bit, 3.0.0-12-generic (/dev/sda3) -- recovery mode' --class linuxmint --class gnu-linux --class gnu --class os {
	recordfail
	insmod gzio
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos3)'
	search --no-floppy --fs-uuid --set=root 5f6b9062-c4ba-48a9-8cea-412ff075a9d7
	echo	'Loading Linux 3.0.0-12-generic ...'
	linux	/boot/vmlinuz-3.0.0-12-generic root=UUID=5f6b9062-c4ba-48a9-8cea-412ff075a9d7 ro recovery nomodeset 
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initrd.img-3.0.0-12-generic
}
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/10_lupin ###
### END /etc/grub.d/10_lupin ###

### 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='(hd0,msdos3)'
	search --no-floppy --fs-uuid --set=root 5f6b9062-c4ba-48a9-8cea-412ff075a9d7
	linux16	/boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos3)'
	search --no-floppy --fs-uuid --set=root 5f6b9062-c4ba-48a9-8cea-412ff075a9d7
	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 ntfs
	set root='(hd0,msdos1)'
	search --no-floppy --fs-uuid --set=root 44749E8EE49BED2A
	drivemap -s (hd0) ${root}
	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 ###
--------------------------------------------------------------------------------

=============================== sda3/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/sda4 during installation
UUID=5f6b9062-c4ba-48a9-8cea-412ff075a9d7 /               ext4    errors=remount-ro 0       1
--------------------------------------------------------------------------------

=================== sda3: Location of files loaded by Grub: ====================

           GiB - GB             File                                 Fragment(s)

 120.698898315 = 129.599455232  boot/grub/core.img                             1
 120.727722168 = 129.630404608  boot/grub/grub.cfg                             1
 110.775817871 = 118.944628736  boot/initrd.img-3.0.0-12-generic               2
 131.609390259 = 141.314506752  boot/initrd.img-3.0.0-17-generic               2
 120.611953735 = 129.506099200  boot/vmlinuz-3.0.0-12-generic                  1
 109.632251740 = 117.716733952  boot/vmlinuz-3.0.0-17-generic                  1
 110.775817871 = 118.944628736  initrd.img.old                                 2
 109.632251740 = 117.716733952  vmlinuz                                        1
 120.611953735 = 129.506099200  vmlinuz.old                                    1

======================== Unknown MBRs/Boot Sectors/etc: ========================

Unknown BootLoader on sda1

00000000  7b b1 bd 50 75 30 54 74  c4 53 c7 6d 91 c1 ac 4a  |{..Pu0Tt.S.m...J|
00000010  02 92 6c ef 68 22 ba 2b  08 ab 05 62 9d 8c 94 d3  |..l.h".+...b....|
00000020  03 57 27 95 56 56 5e 2d  51 f4 d4 38 15 4b 00 92  |.W'.VV^-Q..8.K..|
00000030  91 d1 44 47 9a 92 f0 00  1b 3d f2 c6 76 f3 0b 55  |..DG.....=..v..U|
00000040  77 c1 d9 0e 7e 62 d0 64  c1 6a 6e 02 6d d3 89 aa  |w...~b.d.jn.m...|
00000050  9c 28 04 04 04 04 04 04  71 b3 ab 80 26 32 af 09  |.(......q...&2..|
00000060  37 20 c9 09 c9 ca 3c d4  c1 6c 4f 18 d1 58 6c 16  |7 ....<..lO..Xl.|
00000070  1b 00 27 1c 08 ff f8 13  64 40 01 3e 92 50 aa 71  |..'.....d@.>.P.q|
00000080  8b ce c7 15 fe e8 15 ac  68 9b 14 08 5c b4 92 16  |........h...\...|
00000090  51 e4 fc e6 da 50 24 8a  eb f5 6d 14 ab ca 30 76  |Q....P$...m...0v|
000000a0  1b a9 5e f3 3d 87 6a 81  c7 47 c4 db 38 d6 89 52  |..^.=.j..G..8..R|
000000b0  e0 8f c7 1f 59 60 4b 3b  b7 32 e4 36 ae 5b 58 88  |....Y`K;.2.6.[X.|
000000c0  fd 6d b8 d7 3b 48 e6 c3  d1 be a3 35 61 d9 b0 52  |.m..;H.....5a..R|
000000d0  d0 4a 6c 2d 32 29 2c c8  f0 1c d5 88 ee 21 1a 47  |.Jl-2),......!.G|
000000e0  e7 ee 91 dd d2 2e 0a d6  fb 49 4a 4c c0 16 de ff  |.........IJL....|
000000f0  72 ce 21 e7 0c 9a 25 a1  28 0a 73 a3 fa 77 10 f5  |r.!...%.(.s..w..|
00000100  0f 39 05 0d f9 00 10 61  35 62 39 da 4a e1 6f 54  |.9.....a5b9.J.oT|
00000110  6f 4a 54 69 29 2a d1 20  8b 91 b2 06 90 ca ec 34  |oJTi)*. .......4|
00000120  c9 f2 eb b7 aa c6 9a 4f  11 50 8b 03 91 bb 33 52  |.......O.P....3R|
00000130  e1 68 3b 7f 6c dc 4f 36  92 2d cb 79 7c 00 12 af  |.h;.l.O6.-.y|...|
00000140  66 9c d4 94 47 c0 44 20  2f 01 ce 54 68 15 f0 90  |f...G.D /..Th...|
00000150  3e 0e 93 0a 06 8b 92 a9  ac e2 68 95 f2 2c 3e 0e  |>.........h..,>.|
00000160  ca e0 d5 57 d7 74 05 88  92 76 90 ec af 38 38 77  |...W.t...v...88w|
00000170  78 c6 06 39 24 d5 95 b2  af d6 bc e7 9b ba d8 b9  |x..9$...........|
00000180  c2 49 36 cc 66 ef 77 13  90 6c 56 f3 bd 3e 0f 9a  |.I6.f.w..lV..>..|
00000190  34 a5 f0 c4 06 dd ee 0e  92 84 ac ea 9e 68 4d 8c  |4............hM.|
000001a0  e0 87 c2 ae 4e 22 b2 11  92 fb bc de cf 0b fd 0c  |....N"..........|
000001b0  4c a3 eb a7 a0 7f b6 45  75 09 b0 1e eb 0c b6 c4  |L......Eu.......|
000001c0  76 40 cc de a8 2a e1 16  56 e2 52 63 40 fd 74 e2  |v@...*..V.Rc@.t.|
000001d0  11 b6 e3 0e 70 62 ea e1  53 08 d9 21 25 fe c1 6c  |....pb..S..!%..l|
000001e0  43 4c 36 46 68 ca bf 15  59 d2 37 81 98 f1 02 44  |CL6Fh...Y.7....D|
000001f0  ed 00 6d a4 40 9a 63 ce  5a e3 3c 62 21 dd 2d c6  |..m.@.c.Z.<b!.-.|
00000200


=============================== StdErr Messages: ===============================

xz: (stdin): Compressed data is corrupt


srs5694
Level 6
Level 6
Posts: 1391
Joined: Mon Feb 27, 2012 1:42 pm

Re: Cannot boot Linux after deleting windows partition

Post by srs5694 » Sat Dec 08, 2012 8:39 pm

Your Boot Info Script output looks like it should be working, unless I'm overlooking some subtle problem. In particular, GRUB 2 has been found in your MBR, and it seems to be looking in the right place for its configuration files. You do have an enormous "mystery partition" (/dev/sda1), but that's unlikely to be causing boot problems that would generate the error you're reporting.

My best guess at this point is that you've accidentally modified your BIOS's boot options to exclude your hard disk from the boot order. You might therefore try checking those settings to be sure your hard disk is listed among the boot options. If your BIOS is detecting your hard disk and listing it as a boot option, you might consider powering down, opening up the case, and re-seating the SATA connectors at both ends. You might even consider moving the SATA cable from one motherboard connector to another one. The fact that it's working fine from a Super GRUB 2 Disk boot suggests that it's not a loose cable, so this is a bit of a desperation measure, but I've heard of weirder problems/solutions.

spandey
Level 4
Level 4
Posts: 439
Joined: Sat Feb 20, 2010 1:23 pm

Re: Cannot boot Linux after deleting windows partition

Post by spandey » Sat Dec 08, 2012 9:17 pm

Just boot using your livecd.

1. Run Gparted from Menu.
2. In Gparted highlight the partition sda3
3. From gparted menu select partition --> Manage Flags and select the boot radio button
4. Now from menu select apply

Reboot from harddisk!!!
Linux Mint 17 - Mate 64 Bit

alkanator
Level 1
Level 1
Posts: 17
Joined: Mon Mar 19, 2012 6:52 pm

Re: Cannot boot Linux after deleting windows partition

Post by alkanator » Sat Dec 08, 2012 11:33 pm

It works! I followed that, making sda3 bootable in gparted. I guess that should have been something to check earlier, but I'm just a newbie. Thank you guys for your help!

P.S. How do I edit the title of this post (to put "solved" in)?

spandey
Level 4
Level 4
Posts: 439
Joined: Sat Feb 20, 2010 1:23 pm

Re: Cannot boot Linux after deleting windows partition

Post by spandey » Sun Dec 09, 2012 12:22 am

Good that it works !!! You can edit the first post and put solved in the subject.
Linux Mint 17 - Mate 64 Bit

Post Reply

Return to “Installation & Boot”