LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Fedora (https://www.linuxquestions.org/questions/fedora-35/)
-   -   BOOT GRUB ERROR in switch from ubuntu to fedora (https://www.linuxquestions.org/questions/fedora-35/boot-grub-error-in-switch-from-ubuntu-to-fedora-669797/)

shickidyshade 09-14-2008 12:30 AM

BOOT GRUB ERROR in switch from ubuntu to fedora
 
Hey guys,

So I had Ubuntu on my one computer and it was flaking on me for some reason so I decided to install fedora (which I installed for work on my laptop). However when I currently reboot i get a Error 17 grub not found. It looks to me that the ubuntu grub is currently attempting to load the system. How do I change it so that my comp looks for the new fedora grub. Obviously my computer is dual booting since I am using grub. Vista is my other os. And I can't even get to that right now.

Thanks for the help in advance,
Shade

w3bd3vil 09-14-2008 04:07 AM

boot with the rescue cd. And at the prompt do
Quote:

chroot /mnt/sysimage
grub-install /dev/hdax
where hda is your hdd name. You could very well do a fdisk -l to figure out your hdd name.

Hopefully that should do the trick.

shickidyshade 09-14-2008 07:07 AM

Trying to see my fdisk
 
I am currently trying to look at my
Code:

fdisk-l
but it is longer than the screen size on my computer. How do you scroll up and down the computer to view the results of the previous entry in the command line.

billymayday 09-14-2008 07:15 AM

fdisk -l | less

haxpor 09-14-2008 11:02 AM

I have found this problem for myself.

My notebook has only one disk which contains Windows XP Home and Fedora Core 6.
Now I want to install Ubuntu on my external disk in which whenever I want to boot Ubuntu I just plug that external harddisk with my notebook but when I have no need to boot Ubuntu I just do nothing (and 2 choices remain for me to boot).

From the above is my plan just before the actual intallation of my Ubuntu.
Now I succeed and the following is my solution to boot them without any errors.

I install Ubuntu 7.10 (boot from CD). In the partitioning-process I should to only have '/'(in ext2 format) for the mount point.
Which means all the files contains in that mount point.

From this point on, when you try to reboot your system and boot Ubuntu from the Grub selection. It's work and boot properly.
But when you unplug the external harddisk from your system, and do the same step as I have said above, now the system says something that "It cannot found the grub loader".

I realize that the actual place for the grub to live is places on the external harddisk (/boot/grub). So the solution to this could be replace the currently used grub to another that its place is reside on the notebook.

From what I said to you, I also have Fedora on my notebook.
Now I switch to boot from fedora, and then go to the grub.conf (grub configuration file, resides in /etc/grub.conf or /boot/grub/grub.conf)
to modify the thing.

You must copy the Ubuntu's load section from "menu.lst" file(in /boot/grub) in Ubuntu.
(You can easily see it, it have 3 load command => normal, safe mode, and memtest).

Also note that, in order to do this, you can mount the external disk to be used in fedora, and then try to do what I said.

Now you have modified the grub.conf file.

Just copy that and place in your Fedora's grub file.
Next do the following command.
Quote:

Enter "grub-install hd0" or "grub-install /dev/hda0"
which the parameter you provide is the disk that will hold your grub, for my case I want it to resides in my notebook so I specified hd0.

hd0 means the mapping-device that you can found in "device.map" file in the /boot/grub folder. But you can specified the actual device name like "/dev/hda0".

Now it will says that no errors found.

Just restart the system.
Try to boot with and without external harddisk pluggin-in.

You should get it work for now. :)

(Im sorry for my mistakes in grammar or vocabularies and some of my english explanation).

shickidyshade 09-14-2008 07:26 PM

Quote:

Originally Posted by billymayday (Post 3279958)
fdisk -l | less


how do you get out of the fdisk -l | less ? It letting me scan the entire document but not leave to enter another command.


anyway I'm going to have to try to post the screen but i guess I will try to type it the best i can

Code:

Disk /dev/sda: 160:0 GB, xxx bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 - 8225280 bytes
Disk identifier: 0x0008adb5

Device    Boot  Start    End      Blocks      Id    System
/dev/sda1    *        1    19458    156288000    7    HPFS/NTFS


Disk /dev/sdb: 160:0 GB, xxx bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 - 8225280 bytes
Disk identifier: 0xf0b8a127

Device    Boot  Start    End      Blocks      Id    System
/dev/sdb1    *        1    25      200781      83    Linux
/dev/sdb2            26    19457    156087540  8e    Linux LVM

Disk /dev/sdc: 500.1 GB, xxx bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 - 8225280 bytes
Disk identifier: 0x00080106

Device    Boot  Start    End      Blocks      Id    System
/dev/sdc1    *        1    48631    390625000    7    HPFS/NTFS
/dev/sdc2        48632    60801    97755525    8e    Linux LVM

Disk /dev/dm-0: 257.7 GB, xxx bytes
255 heads, 63 sectors/track, 31338 cylinders
Units = cylinders of 16065 * 512 - 8225280 bytes
Disk identifier: 0x00000000


Disk /dev/dm-1:  2080 MB, xxx bytes
255 heads, 63 sectors/track, 252 cylinders
Units = cylinders of 16065 * 512 - 8225280 bytes
Disk identifier: 0x30307800



I don't know why sdc got split into two partitions. This is supposed to be only a storage drive ... I would eventually prefer to reformat that partition into a single NTFS sector.

As you may have predicted sda1 is Windows and sdb1 is where I installed linux.

Also what is the /dev/dm-(0/1) supposed to be? Where are these 258 or so GB that I do not know where they are installed.

Thanks for any help in advance.

billymayday 09-14-2008 08:05 PM

To exit less, hit "q"

You probably had NTFS on sdc already, and the unused portion has been givern to linux.

/dev/dm are device mappers I gather - do you have any usb drives plugged in?

Where are you at otherwise?

shickidyshade 09-14-2008 08:16 PM

I still do not have any access to fedora or windows. I do see a boot screen trying to load but then I get an Error 17 meaning that it is not looking in the correct location for the boot drive. I am assuming the appropriate place to try to reinstall a grub boot using
Code:

grub-install /dev/hdax
is sdb1. However this did not work when I restarted the computer. Where is the default place for ubuntu to be looking for a boot grub. Is the computer still looking for that at turn on? Why was the old boot grub not deleted on the previous two installation attempts where I told the computer to delete the previous linux versions to install fedora 9.

Thanks
Shade

billymayday 09-14-2008 08:20 PM

Well, I'd assume Fedora is installed on sdb.

First up, if you interrupt the boot process when you first fire up (before grub), can you tell your PC to boot off of the second hard disk (it may take some trial and error, since sdb type designations may not coincide with bios designations). At worst you'll have 3 boots to do.

Let us know how that bit goes.

shickidyshade 09-14-2008 08:21 PM

When i do try to run

Code:

grub-install /dev/sdb1
I receive the following reply
Code:

Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map
Check if this is correct or not. If any of the lines is incorrect fix it and re-run the script 'grub-install'.

# this device map was generated by anaconda
(hd1) /dev/sda
(hd0) /dev/sdb

Is that what this should look like.

Thanks,
Shade

shickidyshade 09-14-2008 08:26 PM

I tried to go into the setup and select which hard drive to look for and the only option was Hard Disk. Can I try another to see if that works? I will try that for a little bit.

Current error is still grub Loading stage1.5

GRUB loading, please wait ...
Error 17

elprawn 09-14-2008 08:32 PM

Try.

Code:

grub-install /dev/sdb
That should install it on the boot sector of the drive rather than the first partition. Then post the contents of your grub.conf.

billymayday 09-14-2008 08:33 PM

To install grub in the MBR, use

grub-install /dev/sdb

I can't tell you if that device map is correct. If you bios is set to boot off the drvie that is /dev/sdb, then yes it is.

I'm guessing a little on the following, but if you are able to find the fedora kernel, make a note of its name, but it will be something like "vmlinuz-2.6.18-92.1.1.el5" (that's a Redhat kernel btw).

When you get your error 17, type

find vmlinuz-2.6.18-92.1.1.el5

You may need to try

find (hd0)/boot/vmlinuz-2.6.18-92.1.1.el5

or

find (hdo)/vmlinuz-2.6.18-92.1.1.el5

for hd0 and hd1 and various combinations thereof.

shickidyshade 09-14-2008 09:20 PM

Quote:

Originally Posted by elprawn (Post 3280471)
Try.

Code:

grub-install /dev/sdb
That should install it on the boot sector of the drive rather than the first partition. Then post the contents of your grub.conf.

I am trying to look at the contents of grub.conf however I do not know how to view the file while in rescue mode.

Thanks,
Shade

shickidyshade 09-14-2008 09:23 PM

Quote:

Originally Posted by billymayday (Post 3280473)
To install grub in the MBR, use

grub-install /dev/sdb

I can't tell you if that device map is correct. If you bios is set to boot off the drvie that is /dev/sdb, then yes it is.

I'm guessing a little on the following, but if you are able to find the fedora kernel, make a note of its name, but it will be something like "vmlinuz-2.6.18-92.1.1.el5" (that's a Redhat kernel btw).

When you get your error 17, type

find vmlinuz-2.6.18-92.1.1.el5

You may need to try

find (hd0)/boot/vmlinuz-2.6.18-92.1.1.el5

or

find (hdo)/vmlinuz-2.6.18-92.1.1.el5

for hd0 and hd1 and various combinations thereof.

Mayday,

I can't type anything when the Error 17 is displayed. I get a blinking underscore that will not let me do anything.

elprawn 09-14-2008 09:45 PM

Code:

mkdir /mnt/osboot
mount /dev/sbd1 /mnt/boot
nano /mnt/boot/grub/grub.conf


elprawn 09-14-2008 09:47 PM

Sorry, that second and third line should be...

Code:

mount /dev/sdb1 /mnt/osboot
nano /mnt/osboot/grub/grub.conf


shickidyshade 09-14-2008 09:51 PM

Quote:

Originally Posted by elprawn (Post 3280527)
Sorry, that second and third line should be...

Code:

mount /dev/sdb1 /mnt/osboot
nano /mnt/osboot/grub/grub.conf


im doing this after i enter
Code:

chroot /mnt/sysimage
Does that sound right??

shickidyshade 09-14-2008 10:00 PM

Quote:

Originally Posted by elprawn (Post 3280527)
Sorry, that second and third line should be...

Code:

mount /dev/sdb1 /mnt/osboot
nano /mnt/osboot/grub/grub.conf


Ok so i followed the second and third line and I now have a blank screen that says GNU nano 2.0.6.

I am going to try to restart now (which didn't work) ... should I go back to that screen and try to reinstall something into the new grub.conf.

At least enough to get linux or windows to boot?

Thanks for help so far,
Shade

elprawn 09-14-2008 10:15 PM

After you mount /dev/sdb1, what do you get when you run...

Code:

ls /mnt/osboot
??

lynnevan 09-15-2008 10:37 AM

If I understand right, you have vista installed on the 2nd HDD, because
you device.map says
Quote:

# this device map was generated by anaconda
(hd1) /dev/sda
(hd0) /dev/sdb
and from fdisk -l you get:
Quote:

Device Boot Start End Blocks Id System
/dev/sda1 * 1 19458 156288000 7 HPFS/NTFS
In yr bios you must have selected the vista drive to be 2nd in boot order.

Now yr trying to write grub to the MBR of the sdb. There should be no problem if you do what somebody said about using yr fedora disk and choose the "rescue option". When you get to the screen w/ the # prompt type
Quote:

chroot /mnt/sysimage
grub-install /dev/sdb"
. It should say it has done that and repeat an image of the device.map. If it's still the same, and yr grub.conf isn't hosed it should boot ok.

Re 'nano', you can't mount a drive if you can't get fedora to run, so do it after you 'chroot /mnt/sysimage' and run "grub-install /dev/sdb". I don't know if you have a boot directory during the rescue operation, but if you do, cd into /boot/grub.
Quote:

nano grub.conf
and if it comes up blank, back out. You're in the wrong place. If yr in the right place, make changes if necessary and F3 to write, and 'return' to save and either esc or ^x to quit(I forget). If there's no boot directory, type exit to get out of the chroot environment, and try what elspawn said.

Quote:

mount /dev/sdb1 /mnt/osboot
(if you still have an 'osboot' directory in /mnt. If not creat it, and mount it.
Quote:

cd /mnt/osboot/boot/grub
Type ls -l to see if yr in the /boot/grub directory. Do whatever you have to do.

If yr still having problems, post'em. Have you managed to mount fedora yet? In yr grub.conf, put "timeout" to 15. That way yr not in such a rush.

Good luck

lynnevan

shickidyshade 09-15-2008 12:19 PM

Well my major problem was that I was still getting an Error 17 when trying to load. I originally put in the rescue cd and typed in [CODE]grub-install /dev/sdb [/CODE}. Then restarted the computer. I remained to get and Error 17. I tried to get a little crazy last night and in my rashness typed in
[CODE]grub-install /dev/sda [/CODE} and when I restarted I finally loaded a boot-grub. Now that I have this much I can see more of where the computer is looking to restart. But when it tries to default to Vista I get a screen that says
Code:

GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB
Repeated over and over and over until I turn the computer off. I am assuming that since I now have a grub menu that Ubuntu originally installed the boot grub to the sda hard drive. I tried booting into Fedora too but I really don't exactly what happened so I will check it out again when I get home tonight. I just wanted to give everyone the update to where I currently am. I can now at least tell the computer where to look for the correct file. So hopefully it will work out tonight if I can get around to working on it.


Thanks,
Shade

elprawn 09-15-2008 12:22 PM

Use fixmbr to put your Vista bootsector back onto sda.

lynnevan 09-15-2008 02:23 PM

I'd go into the bios first and put the vista drive as the 1st hard drive. I've heard of problems with grub and switching drive order. Then vista would be sda and fedora would be sdb, which is normal. Then use the vista rescue to fix mbr. That will get yr vista working normally and after that, use yr fedora rescue disk to do the chroot thing and grub-install and when it shows the device.map, make sure it says (hd0) /dev/sda and (hd1) /dev/sdb. If it doesn't, it gives you an opertunity to fix it and run grub-install again.

After that, it SHOULD work right.

Unless fedora doesn't like not being the 1st hard drive any more. Then you may have to re-install fedora.

luck:)

elprawn 09-15-2008 03:27 PM

I have Windows and Linux both on my second hard drive and even though it's seen as sda by gentoo (the first drive being hdc) and sdb by Fedora, Grub sees it as hd0.

shickidyshade 09-15-2008 09:05 PM

So this is the biggest update of this thread to date. I am now able to boot into Windows Vista!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

I don't think I will ever be this excited to get back into Vista in my entire life, lol. Ok so moving on to how I fixed this.

I used
Code:

grub-install /dev/sda
And I believe this re initiated the boot grub. This boot grub does however remind me more of a Ubuntu boot grub over a fedora boot grub but who cares I can get some things to boot. However it had the two harddrives backwards so I had to go back into the boot/grub/grub.conf and edit the file to switch hd1 and hd0 on both linux and windows drives.

Now I am trying to reinstall Linux since I feel I have found the solution to the problem is installing the boot grub drive to be sda, but when I get into where the X something takes over I get a wonderful screen of blues and oranges or greens and reds and oranges. Directly before the screen goes out anaconda seems to find to locate my video card and seems to be activating it to be used during the installation process. Do I need to create a new boot disk?

Thanks for all the help so far I would have never been able to get this far without all your help,

Shade

lynnevan 09-15-2008 10:44 PM

Elspawn, you must have a very interesting drive setup. Any PATA drives involved? I've never seen GRUB get confused.
For some reason, when I installed suse & fedora on a usb drive, they both called it sda, but grub knew better. Mandriva did ok for a while, w/ hda & sda, but later decided sda came before hda. Only ubuntu has kept the faith and is still correct. You can run grub-install from inside a shell if your drive order is correct, but not if it's screwed up like mine - I can only use fed9 (the only ide drive) and ubuntu usb(hd1,7).

shickidyshade, yr grub boot screen is,if you want Fedora's,
Quote:

splashimage=(hdX,x)/boot/grub/splash.xpm.gz
or you can just use colors:
Quote:

color light-green/black yellow/red
. It shouldn't look anything like ubuntu - orange vs blue? I don't know what OS yr grub mbr was written by.

Maybe the funny colors come from ubuntu trying to run usplash or splasy. Or, have you commented out hidden in the grub menu?
Quote:

#hiddenmenu
Personally, I keep my windoz mbr virgin using DISKSAVE and/or Diskprobe, but don't know if they work on vista and require a floppy drive which everybody has decided is unnecessary in these enlightened times. With DISKSAVE, I backup my unmodified mbr and bootsector (mbr & vbr). Then if grub ever gets confused I boot from the floppy and restore my original mbr. There's a way to use "dd" to save yr mbr too, but I haven't ever used it, so won't say anymore.

There an easy way to make a grub floppy if yr interested. Once you get grub onto a floppy, it's a lot less nerve racking editing things, and there's also a free prog by HP that can put it on a thumb drive for you either from the grub floppy, or from a file made by "dd".

elprawn 09-16-2008 08:32 AM

Yeah there's a PATA drive involved. HDA, HDB and HDD are optical drives, HDC is a PATA hard disk and SDA is an SATA hard disk. Just to make things nice and confusing, though, Fedora calls HDC SDA and SDA SDB.

Code:

Disk /dev/hdc: 102.9 GB, 102935347200 bytes
255 heads, 63 sectors/track, 12514 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xed8360d9

  Device Boot      Start        End      Blocks  Id  System
/dev/hdc1              1        9965    80043831    7  HPFS/NTFS
/dev/hdc2  *        9966      12514    20474842+  af  Unknown

Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x2b792b78

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          1        6527    52428096    7  HPFS/NTFS
/dev/sda2            6528        6553      208845  83  Linux
/dev/sda3            6554      13328    54420187+  f  W95 Ext'd (LBA)
/dev/sda4          13329      38913  205511512+  83  Linux
/dev/sda5            6554        6815    2104483+  82  Linux swap / Solaris
/dev/sda6            6816      13328    52315641  83  Linux

In fact, the trouble I was having with GRUB is why I switched to Gentoo. It was then that I saw that Gentoo's grub.conf called my SATA drive hd0 and Fedora's was calling it hd1. Would switching it have helped in hindsight? Not sure. Can't be bothered to go back now. I prefer Gentoo for several reasons, but that's another matter.

lynnevan 09-16-2008 11:34 PM

Yeah, like I said, fedora, suse & later mandriva all decided my usb drive was the first hard drive as listed by fdisk, sfdisk, and the rest of the operating system agreed, except GRUB (there, in all cases, the ide drive is hd0). Fedora GRUB will (so far) consider the 1st ide drive hd0(sda), the 2nd, hd1(sdb), the next external will be hd2(sdc). Even if the rest of the OS has it upsidedown.
Haven't tried SATA yet, although I've got the fixtures, my drives just keep working. I don't know how a Linux OS decides between an ide drive and a sata drive which is hd0.
I don' know how you avoided yr optical drives being labeled hca, hcb, hcd. Or what kind of filesystem "af" is. Maybe it's a gentoo thing.
Me and Gentoo didn't get along the one time I tried it, so I don't know much about it. Are yr optical drives DVD-rw or MO?

Not nosey, just curious.:study:

elprawn 09-17-2008 01:03 AM

When I upgraded Fedora Core 6 to Fedora 9, I couldn't get past stage 1 of grub and trying to load via rescue mode said the image was corrupt. Fedora's GRUB listed the boot drive as hd1 but the Gentoo GRUB as hd0, so perhaps they differ or perhaps Anaconda got it wrong? :S

af is HFS+ (Mac OS X).

I have a separate DVD reader and Writer for on the fly copying and a separate CD-RW that can write the full 99:59 on 99 minute CDs.

In fstab they're /dev/dvd2, /dev/cdrw1 and /dev/dvdrw (less confusing that way).

lynnevan 09-17-2008 01:11 AM

thanks elsprawn.


All times are GMT -5. The time now is 02:37 PM.