Windows replaced Grub. Make/Download new Grub?

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read this

Windows replaced Grub. Make/Download new Grub?

Postby Sanjima on Thu Jul 23, 2009 6:44 pm

I have two physical hard drives, with Linux Mint on the secondary. The Grub bootloader was on the primary, which had Windows 7 which I was replacing with Windows XP, but I made the mistake of formatting that drive before backing up my Grub bootloader.

Is there any hope of writing or downloading a new one? :< I really don't want to reinstall Mint, but I guess I will if it's too much of a hassle.
Watch your words spread Hope like Fire.
User avatar
Sanjima
Level 3
Level 3
 
Posts: 104
Joined: Tue Jul 21, 2009 1:40 pm

Linux Mint is funded by ads and donations.
 

Re: Windows replaced Grub. Make/Download new Grub?

Postby Carl on Thu Jul 23, 2009 6:53 pm

Sanjima wrote:I have two physical hard drives, with Linux Mint on the secondary. The Grub bootloader was on the primary, which had Windows 7 which I was replacing with Windows XP, but I made the mistake of formatting that drive before backing up my Grub bootloader.

Is there any hope of writing or downloading a new one? :< I really don't want to reinstall Mint, but I guess I will if it's too much of a hassle.


yes it is fairly simple =]

This howto should give you all you need:



as I have just followed it after I installed Windows 7 :D

if you need any more help just ask!
[AMD Sempron 145 2.8GHz + Unlocked 2nd Core|ATI Radeon™ HD3000 Graphics|4GB DDR3|Biostar A780L3L]
Image
User avatar
Carl
Level 5
Level 5
 
Posts: 667
Joined: Wed Apr 15, 2009 5:20 pm
Location: West Sussex, UK

Re: Windows replaced Grub. Make/Download new Grub?

Postby Sanjima on Thu Jul 23, 2009 7:05 pm

thank youuu! <3
I shall get to work right away x3
Watch your words spread Hope like Fire.
User avatar
Sanjima
Level 3
Level 3
 
Posts: 104
Joined: Tue Jul 21, 2009 1:40 pm

Re: Windows replaced Grub. Make/Download new Grub?

Postby Sanjima on Thu Jul 23, 2009 7:57 pm

Every time I try to do the instructions it gives me, it gives me "Error 17: Cannot mount selected partition."
Any thoughts? :< It does this same error with all my other partitions as well.
Watch your words spread Hope like Fire.
User avatar
Sanjima
Level 3
Level 3
 
Posts: 104
Joined: Tue Jul 21, 2009 1:40 pm

Re: Windows replaced Grub. Make/Download new Grub?

Postby DrHu on Thu Jul 23, 2009 8:03 pm

    Here’s the quick and easy way to re-enable Grub.
    1) Boot off the LiveCD
    2) Open a Terminal and type in the following commands, noting that the first command will put you into the grub “prompt”, and the next 3 commands will be executed there. Also note that hd0,0 implies the first hard drive and the first partition on that drive, which is where you probably installed grub to during installation. If not, then adjust accordingly.
    --unless there is more than one partition on the windows hard drive, you could use windows tools to check the C: drive partition to see its status, or you could use the partition editor from the Linux CD min menu>control center>System>Partition Editor
    sudo grub
    root (hd0,0)
    setup (hd0)
    exit
That is the sequence you used ?
--that section after sudo grub, is entered on each line then the enter key is struck; assumes hd0,0), first drive/first partition..
http://www.uruk.org/orig-grub/errors.html
--GRUB errors..

Checking..
    The first step after the boot from the CD, Open a Terminal
    sudo fdisk -l
    --check that the hard drives are mounted, so that you can write to them
Last edited by DrHu on Thu Jul 23, 2009 8:09 pm, edited 4 times in total.
User avatar
DrHu
Level 16
Level 16
 
Posts: 6292
Joined: Wed Jun 17, 2009 8:20 pm

Re: Windows replaced Grub. Make/Download new Grub?

Postby Sanjima on Thu Jul 23, 2009 8:05 pm

Yeah, that's the instructions I used. But it doesn't carry out the command, instead it only gives me that error message.

*edit: Ah okay I noticed the part you said at the bottom. I'll try that.
Watch your words spread Hope like Fire.
User avatar
Sanjima
Level 3
Level 3
 
Posts: 104
Joined: Tue Jul 21, 2009 1:40 pm

Re: Windows replaced Grub. Make/Download new Grub?

Postby Sanjima on Thu Jul 23, 2009 8:09 pm

mint@mint ~ $ sudo fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x30901854

Device Boot Start End Blocks Id System
/dev/sda1 * 1 26 204800 7 HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2 26 5227 41779200 7 HPFS/NTFS
Partition 2 does not end on cylinder boundary.
/dev/sda3 5227 60802 446400512 7 HPFS/NTFS
Partition 3 does not end on cylinder boundary.

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

Device Boot Start End Blocks Id System
/dev/sdb1 1 9355 75144006 83 Linux
/dev/sdb2 9356 9729 3004155 5 Extended
/dev/sdb5 9356 9729 3004123+ 82 Linux swap / Solaris
mint@mint ~ $


Here's the result I got. o.o

*edit: The drive and partition I wanna put Grub on is the 500GB drive, on the second partition.
*edit2: Would the error I got have to do with my drives being called like "sda1" and such?
Watch your words spread Hope like Fire.
User avatar
Sanjima
Level 3
Level 3
 
Posts: 104
Joined: Tue Jul 21, 2009 1:40 pm

Re: Windows replaced Grub. Make/Download new Grub?

Postby DrHu on Thu Jul 23, 2009 8:40 pm

Its been a while since I had to do any GRUB setups..

Note: GRUB will help you with TAB completion
Enter root (hd0,TAB key) and GRUB will give you a list of partitions to use, you should see 0, as a selection, it will also tell you the format that is on that partition or unknown, if it is not a Linux format..

Apart from the apparent partition errors..
    /dev/sda1 * 1 26 204800 7 HPFS/NTFS
    Partition 1 does not end on cylinder boundary.
    /dev/sda2 26 5227 41779200 7 HPFS/NTFS
    Partition 2 does not end on cylinder boundary.
    /dev/sda3 5227 60802 446400512 7 HPFS/NTFS
    Partition 3 does not end on cylinder boundary.
/dev/sda1 * 1 26 204800 7 HPFS/NTFS
That is the partition you want to install GRUB into (the MBR, Master Boot Record), and despite being named sd?, it is stil called hd when grub uses the partitions for its setup, so it is (hd0)
  • root (hd0,0)
  • setup (hd0)
    --you should see grub start to write into that partition (the MBR), when it finishes
  • exit

This is my fdisk -l, and I also have windows XP running on the first drive, first partition..
Code: Select all
[b]sudo fdisk -l[/b]
[sudo] password for mintuserID:

Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xf1f46159

   Device Boot      Start         End      Blocks   Id  System
[b]/dev/sda1   *   [/b]        1        3891    31254426    7  HPFS/NTFS
/dev/sda2            3892       14593    85963815    5  Extended
/dev/sda5            3892       14152    82421451   83  Linux
/dev/sda6           14153       14593     3542301   82  Linux swap / Solaris

Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000001

nor partition start end errors, and the * indicates the boot partition, which gparted will show as the flag boot..
Last edited by DrHu on Thu Jul 23, 2009 8:49 pm, edited 3 times in total.
User avatar
DrHu
Level 16
Level 16
 
Posts: 6292
Joined: Wed Jun 17, 2009 8:20 pm

Re: Windows replaced Grub. Make/Download new Grub?

Postby Sanjima on Thu Jul 23, 2009 8:43 pm

Alright, I'll try that.
I noticed that your instructions are backwards from the other thing's instructions.
Where the other person wrote "root (hd0,0) -- setup (hd0)" you wrote "root (hd0) -- setup (hd0,0)"
Is this correct?

*edit: I tried what you said, and I got the same error message.

[ 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> root (hd0)

grub> setup (hd0,0)

Error 17: Cannot mount selected partition

grub>
Watch your words spread Hope like Fire.
User avatar
Sanjima
Level 3
Level 3
 
Posts: 104
Joined: Tue Jul 21, 2009 1:40 pm

Re: Windows replaced Grub. Make/Download new Grub?

Postby DrHu on Thu Jul 23, 2009 8:51 pm

OK, now I have a question, does windows boot up at all ?, can you load and login to the windows OS..
No, it should be (hd0,0), first drive, first partition
--and it is setup (hd0) to use that drive (1st drive )

If windows isn't booting, you can reset the mbr from windows, by using from a windows boot disk; fdisk /mbr
http://www.microsoft.com/resources/docu ... ixmbr.mspx
http://www.windowsinternals.com/fixing- ... th-fixmbr/

If windows does boot, ignore the windows repair of the MBR routine(s)
Last edited by DrHu on Thu Jul 23, 2009 9:09 pm, edited 3 times in total.
User avatar
DrHu
Level 16
Level 16
 
Posts: 6292
Joined: Wed Jun 17, 2009 8:20 pm

Re: Windows replaced Grub. Make/Download new Grub?

Postby Sanjima on Thu Jul 23, 2009 8:54 pm

DrHu wrote:OK,now I have a question, does windows boot up at all ?, can you load and login to the windows OS..
no, it should be (hd0,0), first drive, first partition, and it is setup (hd0) to use that drive (1st drive )


There is no bootloader what so ever. If I start my computer without the LiveCD, it says there's some kind of file system error.
*edit: I tried installing Windows XP but apparently it screwed up somehow. o.O
Watch your words spread Hope like Fire.
User avatar
Sanjima
Level 3
Level 3
 
Posts: 104
Joined: Tue Jul 21, 2009 1:40 pm

Re: Windows replaced Grub. Make/Download new Grub?

Postby DrHu on Thu Jul 23, 2009 9:04 pm

Sanjima wrote:There is no bootloader what so ever. If I start my computer without the LiveCD, it says there's some kind of file system error. *edit: I tried installing Windows XP but apparently it screwed up somehow. o.O


Since installing windows takes so long, and you had already done that, I would try the fixmbr routines with windows in order to try and create a bootloader that windows can boot from, then go back to grub and adjust

If that doesn't work, I would just forget the windows loader, user gparted (the Linux Gnome partition editor) to create that first partition as a clean partition, you really shouldn't have start/end boundary errors if you let partition managers make the partitions, in whole size, like MB , they should correctly choose the begin/end of the blocks to use..

Or use windows to do the same thing for the first partition, basically clean it up a bit..
The first partition that the OS uses is not the MBR where the bootloader get installed, that is a separate small area on the disk..

Others may have suggestions about fixing up the boundaries or otherwise changing your setup, but this is as far as I feel comfortable taking it..
User avatar
DrHu
Level 16
Level 16
 
Posts: 6292
Joined: Wed Jun 17, 2009 8:20 pm

Re: Windows replaced Grub. Make/Download new Grub?

Postby Sanjima on Thu Jul 23, 2009 9:24 pm

okie. Just for the record, as you saw I have three partitions on that drive. The drive was partitioned by uh.. Windows 7 I believe. the first 200MB was reserved for some kinda system files that Windows 7 did by itself. The 40GB-ish partition was for Windows 7, and the rest like 460GB or so was all of my data and personal files and everything. Is it safe to modify the partitions of this drive? ._. I'm kinda scared. lol
Watch your words spread Hope like Fire.
User avatar
Sanjima
Level 3
Level 3
 
Posts: 104
Joined: Tue Jul 21, 2009 1:40 pm

Re: Windows replaced Grub. Make/Download new Grub?

Postby DrHu on Thu Jul 23, 2009 9:37 pm

Sanjima wrote:Windows 7 I believe. the first 200MB was reserved for some kinda system files that Windows 7 did by itself. The 40GB-ish partition was for Windows 7, and the rest like 460GB or so was all of my data and personal files and everything.

Now I am lost..
I thought you had replaced win7 with winXP, ???

OK, well to be safe you could attempt some kind of backup..

However windows has always had the ability to install in place, meaning you overwrite the partition/directory where windows has installed its OS with a new install/reinstall of windows, that was usual c:\windows

Another way of doing it is to install to a different directory, which wouldn't tiuch that directory/partition where windows installs it OS system & data (c:\windows),
So you would pick , install to c:\win2 , as an example
--and it would be a minimum install, customize it to remove almost all the software that windows wants to install as part of the OS, like desktop themes, accessories, games, tcp et etc..

But you don't have to do that, just fix windows MBR from windows..
Last edited by DrHu on Fri Jul 24, 2009 12:34 am, edited 3 times in total.
User avatar
DrHu
Level 16
Level 16
 
Posts: 6292
Joined: Wed Jun 17, 2009 8:20 pm

Re: Windows replaced Grub. Make/Download new Grub?

Postby Sanjima on Thu Jul 23, 2009 9:40 pm

Well, what I wanna know is how the MBR got damaged though, and why I'd need to fix it.
Watch your words spread Hope like Fire.
User avatar
Sanjima
Level 3
Level 3
 
Posts: 104
Joined: Tue Jul 21, 2009 1:40 pm

Re: Windows replaced Grub. Make/Download new Grub?

Postby DrHu on Thu Jul 23, 2009 9:42 pm

Sanjima wrote:Well, what I wanna know is how the MBR got damaged though, and why I'd need to fix it.

OK, I am done..
bump!
User avatar
DrHu
Level 16
Level 16
 
Posts: 6292
Joined: Wed Jun 17, 2009 8:20 pm

Re: Windows replaced Grub. Make/Download new Grub?

Postby Sanjima on Thu Jul 23, 2009 9:44 pm

..what? o.o
Watch your words spread Hope like Fire.
User avatar
Sanjima
Level 3
Level 3
 
Posts: 104
Joined: Tue Jul 21, 2009 1:40 pm

Re: Windows replaced Grub. Make/Download new Grub?

Postby Sanjima on Sun Jul 26, 2009 9:54 am

So I just said screw it and reinstalled both windows and Linux Mint lol
Mint is now my main default system, and Windows XP is the alternate on my secondary disk. =D ~is proud~ lol
Watch your words spread Hope like Fire.
User avatar
Sanjima
Level 3
Level 3
 
Posts: 104
Joined: Tue Jul 21, 2009 1:40 pm

Linux Mint is funded by ads and donations.
 

Return to Installation & Boot

Who is online

Users browsing this forum: Bing [Bot], Steeler [Crawler] and 18 guests