LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-28-2012, 10:45 PM   #1
Ansonite
LQ Newbie
 
Registered: Jul 2012
Posts: 3

Rep: Reputation: Disabled
GRUB not working


Hi all,

I am having trouble with my hard disk. Previously, I had a working Linux Mint Debian Edition partition and a Windows XP partition, all working and bootable through GRUB.

However, I decided to replace LMDE with Debian, so on my Windows parition I deleted the LMDE parition. I downloaded Debian Live on to a USB flash drive, booted it, however during Debian installation it fails to install GRUB (or any other bootloader it offers). Somewhat confused, I aborted installation and went to reboot into Windows. However, when loading GRUB the error "no such parition" appears, and a rescue prompt appears.

I am not sure how this happened, however I want to try and repair GRUB so I can have both my old Windows XP partiion (it's still fine, I can mount it in Debian) and a fresh Debian 6 partition. Here is my fdisk output:

Code:
user@debian:~$ sudo fdisk -l

Disk /dev/sda: 40.0 GB, 40007761920 bytes
255 heads, 63 sectors/track, 4864 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: 0x04fa04fa

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            3297        4864    12580864    7  HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2               1        3297    26480641    5  Extended
/dev/sda5   *           1        3157    25355264   83  Linux
/dev/sda6            3157        3297     1124352   82  Linux swap / Solaris

Partition table entries are not in disk order

Disk /dev/sdb: 8006 MB, 8006926336 bytes
247 heads, 62 sectors/track, 1021 cylinders
Units = cylinders of 15314 * 512 = 7840768 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x20ac7dda

This doesn't look like a partition table
Probably you selected the wrong device.

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   ?      210559      238826   216435558+   7  HPFS/NTFS
Partition 1 has different physical/logical beginnings (non-Linux?):
     phys=(187, 180, 14) logical=(210558, 221, 10)
Partition 1 has different physical/logical endings:
     phys=(784, 0, 13) logical=(238825, 64, 22)
Partition 1 does not end on cylinder boundary.
/dev/sdb2   ?      213663      341223   976730017   16  Hidden FAT16
Partition 2 has different physical/logical beginnings (non-Linux?):
     phys=(906, 235, 61) logical=(213662, 17, 20)
Partition 2 has different physical/logical endings:
     phys=(262, 116, 59) logical=(60762, 71, 9)
Partition 2 does not end on cylinder boundary.
/dev/sdb3   ?           1           1           0   6f  Unknown
Partition 3 has different physical/logical beginnings (non-Linux?):
     phys=(370, 101, 50) logical=(0, 0, 1)
Partition 3 has different physical/logical endings:
     phys=(10, 114, 13) logical=(280460, 46, 4)
Partition 3 does not end on cylinder boundary.
/dev/sdb4            3279       63637   462167897    0  Empty
Partition 4 has different physical/logical beginnings (non-Linux?):
     phys=(0, 0, 0) logical=(3278, 20, 45)
Partition 4 has different physical/logical endings:
     phys=(0, 0, 0) logical=(63636, 236, 34)
Partition 4 does not end on cylinder boundary.

Partition table entries are not in disk order

Disk /dev/sdc: 987 MB, 987738624 bytes
31 heads, 61 sectors/track, 1020 cylinders
Units = cylinders of 1891 * 512 = 968192 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
user@debian:~$
/dev/sda1 is my Windows parition, and /dev/sda5 seems to be my corrupted Debian installation. Not sure about the other one (/dev/sda6 is swap space). I'm not sure what that message under /dev/sda1 means, either.

So would anyone be able to help me in fixing this error?

And I am unable to use apt-get to install packages that may fix this due to lack of Internet connection (had this in LMDE, I needed to install MadWifi which I'll do once I get it set up properly) however if need be I can get and transfer .deb packages from my phone.

Thanks!
 
Old 07-28-2012, 11:43 PM   #2
gentisle
Member
 
Registered: May 2005
Location: USA
Distribution: LinuxMint
Posts: 204

Rep: Reputation: 7
If I am understanding you correctly, you deleted the LMDE partitions from within Windows, and that would be your problem. Windows Disk Adminstrator now called disk management in XP is nothing but problems; I'm leery of even opening it on a multi-OS system. That program will screw up any partition table that has anything on the disk that is NOT NTFS or FAT. I suspect that's how you got these errors:

Quote:
Partition 1 does not end on cylinder boundary.
Partition table entries are not in disk order
This doesn't look like a partition table Probably you selected the wrong device.
I've never even seen that 3rd error, but it looks bad.

If you haven't done anything else to it, you may be able to bring the old LMDE back so you can start from there.

1. You need to back up the partitions of what you have so you can return to that if needed.
sudo dd if=/dev/sda of=/dev/SomeUSBstick/WhateverFileNameUwant.mbr bs=512 count=1

2. Then you need to go backwards in partitioning. So if you tried to install Debian, and it partitioned, then boot it, run fdisk to delete the partitions it created.

3. Or go back into Windows (I think you boot the install disk, select recover w/F5 or something like that and run FIXMBR). Use this as a last resort, it will wipe out GRUB.

4. You may not need to do anything in Windows, if you just delete (w/Linux fdisk) all the other partitions that Debian created, and there is nothing but the sda1 NTFS part.

5. Now from a Linux live disk you can run gpart (use the man command to find out how) and it will try to Guess PARTitions. This will take awhile, and I forget the option it gives, but take the LONG, SLOW route if it asks you. IT should find the old partitions. IF you know the correct sizes, placements, let it restore.

6. After this, you'll probably have to reboot the Linux boot disk. Use fdisk to check and see if the correct partition has the bootable flag set. If so, GRUB *MAY* be restored and working correctly. If it is, and you can boot either Windows or LMDE, then boot your Linux live disk/USB and use the fdisk in the LMDE version or another of the LM editions to delete the LMDE partitions. At this point, if you're going to use Debian, you need to research how the install program handles the partitioning. If you can select empty Linux partitions that are already on the disk, I would create them the way I wanted while I had the LM live disk booted. Then do the Debian install. But if the Debian program expects to do the partitioning, then get rid of everything except the NTFS partition before starting the install.

There should be *NO* partition errors w/a Windows/Linux system. You just have to partition and install correctly. Here's what I do to avoid problems.

A. Boot Linux live and partition for Windows only - no other partition.
B. Install Windows
C. After Windows is installed, finished all it's rebooting through the installation, installing all the drivers, etc., i.e., when it's actually usable, then I
D. Boot Linux live again, partition the rest of the disk, and install Linux.
E. After Linux is installed, and both systems are bootable, I save a copy of the MBR so I can restore if something goes wrong (and w/Windows, it's a matter of when -- not IF).

This MIGHT get you back going, but w/partitioning, there are NO guarentees.
gentile
 
Old 07-29-2012, 12:20 AM   #3
Ansonite
LQ Newbie
 
Registered: Jul 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Sounds a bit tricky and I do not have Windows CD or removable media except USB with debian. Can I not remove grub and Debian partitions?
 
Old 07-29-2012, 12:30 AM   #4
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,838

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
Quote:
Originally Posted by Ansonite View Post
Sounds a bit tricky and I do not have Windows CD or removable media except USB with debian. Can I not remove grub and Debian partitions?
I almost think that you partitioned sdb, is sdb your usb device?
You can start all over by repairing your windows xp os.
Hiren's-BCD has miniwinsxp you can repair from the command console.
Then you can reinstall whatever linux distro you want.
 
Old 07-29-2012, 04:18 AM   #5
Ansonite
LQ Newbie
 
Registered: Jul 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Alright, I have decided that I want to return to my Windows installaion. I will install Debian later on.

I have removed all partitions on my disk apart from the one Windows XP is on (/dev/sda1) and have set the boot flag on this parition.

Code:
Disk /dev/sda: 40.0 GB, 40007761920 bytes
16 heads, 16 sectors/track, 305235 cylinders
Units = cylinders of 256 * 512 = 131072 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x04fa04fa

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *      206889      305176    12580864    7  HPFS/NTFS
I have rebooted several times, however when I reach GRUB it tells me 'no such parition':

Code:
GRUB loading.
Welcome to GRUB!

error: no such parition
Starting rescue mode
grub rescue>
I am thinking and I want to know if it is possible to remove GRUB from my hard drive using the USB that still has Debian Live on it, seeing as I only have one partition -- my Windows one.

On a side note, while the kernel loads with my Debian stick, a warning appears mentioning that my Windows parition is "dirty". I'm not sure what this means or if it relates to the issue, but it says I should run chkdsk on Windows. I can't post the full message as I'm unable to copy it.

Would anyone be able to tell me how it is possible to remove GRUB, still keeping my Windows parition (I don't want to re-install it, as I can't back up and I don't have a Windows CD/image).

Thanks again!
 
Old 07-29-2012, 01:20 PM   #6
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,838

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
You can run chdisk from gpated-live-cd.
You can possibly run fsck from debian live.
I noticed your wins installation is not at beginning of drive did you move it or erase some other partitions?
Winsxp can be reinstalled via i386 folder you just have to findout if it's still there.
 
Old 07-29-2012, 02:49 PM   #7
z99
Member
 
Registered: Aug 2009
Location: Iran-Sari
Distribution: CentOS,Fedora,Slitaz
Posts: 136

Rep: Reputation: 20
Quote:
still keeping my Windows parition (I don't want to re-install it, as I can't back up and I don't have a Windows CD/image).
hope this one work.
insert your windows cd then press R for (recovery mode),then press C (console),then enter 1(your windows installation drive 1 for c),and at last type fixmbr
 
Old 07-29-2012, 03:16 PM   #8
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,186

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
When you get the GRUB rescue prompt, enter the command set and note the value of prefix. That's probably the partition that's missing, and it's the one in which GRUB is trying to look for its grub.cfg file, and all the other files it needs to dynamically load in order to boot properly.

I.e., if you've deleted that partition, you need to re-install GRUB. That can, I believe, be done from inside a Windows system, but - other then telling you to look on-line - I don't know much more than that.
 
Old 07-29-2012, 03:35 PM   #9
gentisle
Member
 
Registered: May 2005
Location: USA
Distribution: LinuxMint
Posts: 204

Rep: Reputation: 7
Try not to give up on this; it's really not that hard. It just takes some time and patience. The software will take care of you most of the time, you just need to understand how to use it so it will work right.
 
Old 08-22-2012, 10:36 PM   #10
techguru666
LQ Newbie
 
Registered: Jul 2012
Posts: 24

Rep: Reputation: Disabled
If you want to remove GRUB from the MBR, you can use dd command:

dd if=/dev/zero of=/dev/sda bs=512 count=1

This will remove GRUB, but remember, then your system won't even show the grub prompt. You will have to install the windows bootloader on the MBR. fixmbr command will install the windows bootloader on MBR.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Debian Squeeze: Grub not working (XP removing grub) wearetheborg Debian 10 02-16-2010 06:33 PM
[SOLVED] Grub timeout is not working procfs Linux - Newbie 16 05-04-2009 01:26 AM
GRUB not working RoninBlade Fedora 5 02-23-2005 12:10 PM
Grub Loader Not working kamowa Fedora 4 09-19-2004 09:22 PM
got GRUB working OK hoffman Linux - Newbie 2 11-13-2003 05:30 PM


All times are GMT -5. The time now is 03:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration