LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 09-17-2007, 01:35 PM   #1
Mark_in_Hollywood
Member
 
Registered: Jan 2006
Location: USA
Distribution: Ubuntu - Bionic Beaver
Posts: 133

Rep: Reputation: 16
Grub and MBR problem, no kernel to boot


First, I don't have any windows products installed. Second, while I believe this is not a distro specific question, I can't find a better forum for it; and this is where I would look if I had the same OS/problem.

I read up on installing an extra hard disk. I run my regular system with 2 hard drives. Both ubuntu. Prim. Slave is just a safety backup.

I wanted an application called Second Life. When I went to that webpage, I was told it wasn't available for Linux. So I found an old Windows 98 drive, set the jumpers to pri. slave and added a Windows section to /boot/grub/menu.lst, I firmly believed that all I had to do was reboot. Nuts! was I wrong again.

So, horrified that I could no longer boot into the pri. master (fesity ver. 7.04) I removed the offending 2nd drive of win98. I removed the Windows section of /boot/grub/menu.lst. I believed this would remedy the problem. Wrong Again!

I put the original 2nd hard drive back on the cable as pri.slave, where it had been and believed I could boot into that. Wrong again!

So I swapped drives making the pri-master, the slave, and vice versa. Got out the canonical cd and re-installed Feisty on the little drive. I'm back on the net and can work.

I've read up on reinstalling grub and the mbr, but I want to work on the (now) primary-slave (formerly the pri-master) while it is in the slave position, if at all possible. I only want to change it's mbr and /boot/grub/menu.lst, which I think should be possible.

So if you have done this yourself, and can give me some help, it surely is needed. Thanks, community.
 
Old 09-17-2007, 02:23 PM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
I did run into a similar issue on a friends computer. I had installed Windows (again!!!) and knoppix and all was well until she decided to start rearranging drives and partitions and things.
Long story short, what I learned is that:

1 - going back very far in Windows ancestry, if Windows is around your computer, your MBR stands a good chance of getting corrupted. I don't know when it does it or why, but Windows will rewrite and ruin the MBR, so if it decides, it will 'inadvertently' make your Linux unbootable.

2 - Windows, I believe, MUST be installed on the Primary Master hard disk in order to work properly. Matter of fact, the majority of the time, without going through major hoops, Windows also needs to be the FIRST OS installed on the hard drive. Installing it or reinstalling it or repairing it or doing just about anything to or with it at a later time, will corrupt the MBR.
(The major hoops I refer to involve copying the Windows boot sector (512 bytes, freshly installed) to a file, which is then placed somewhere in the C:/ drive, and then when you edit GRUB or LILO, you give the bootloader the path to that file, so that it can boot Windows without needing the MBR.)


SOunds like what happened to you was GRUB tried to boot Windows from the slave drive; Windows didn't like that. Windows then a) didn't boot, and b) borked the MBR.

I know my input here probably doesn't help you accomplish what you're trying to do, but what I think I'm trying to say, is if you now want a windows around, besides your running Linux installations, you probably need to start with a fresh hard disk, install Windows on it on partition 1 and make sure it works (OR leave that Win98 hard disk as primary-master, THEN boot a Linux LiveCD and edit your Linux-OS's GRUB to boot the Windows and your Linux wherever it is connected now, and install the GRUB to the MBR of the Windows hard disk (primary-master).

Did this answer anything for you, or have I totally gone in circles?
 
Old 09-17-2007, 02:50 PM   #3
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
To state it in it's simplest form:
When you re-install mswindows, it WILL overwrite the MBR with it's own bootloader, and any other OS on the disk will not be bootable without some assistance.

So, before re-installing mswindows, boot Linux and make a boot diskette or boot cd. Then re-install mswindows.

After the installation, use the boot disk you made (hopefully) to boot Linux, and run grup-install to re-write grub's first stage to the MBR.

No need to re-install Linux; no need to swap disks; no need to mess with jumbers. Just a need to know what will happen when you re-install mswindows and how to easily overcome what it does.

Having put in my 2 cents worth, on to your problem:
Quote:
've read up on reinstalling grub and the mbr, but I want to work on the (now) primary-slave (formerly the pri-master) while it is in the slave position, if at all possible. I only want to change it's mbr and /boot/grub/menu.lst, which I think should be possible
1) You need to boot into Linux on the primary slave (possibly from the install cd: select 'boot from hard drive). It should look for the installation and find it on the slave.
2) run grub-install /dev/hd0 (without a partition number!) to write the first stage of grub to the MBR of the primary master drive.
3) edit the /boot/grub/menu.lst (or grub.conf on some distros) to show where the root of the filesystem is located [root (hd1,X)] (without square brackets) where hd1 is the slave drive, and X is the partition number. Then edit the kernel and initrd lines to show the partition where /boot is (if on a different partition), otherwise start the kernel and initrd lines like this: kernel /vmlinuz (the root line tells grub where to look) and initrd /initrd.img (or whatever it's called).

I believe that is sufficient to get you booting from Linux on the slave drive, with the grub written to the MBR of the primary master drive. If you go swaping drives around again, you will have to do it all again to fix it.

Last edited by bigrigdriver; 09-17-2007 at 03:07 PM.
 
  


Reply



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
dual boot (RHEL3 and RHEL4) problem: need guidance to edit grub.conf in MBR lgpage Linux - Software 1 02-16-2007 12:05 PM
Installed GRUB on MBR or First Sector of boot zillah Fedora 6 06-16-2005 11:46 AM
How to get GRUB from MBR boot the kernel in CD? DrRider Linux - Software 5 03-01-2005 10:19 PM
Install GRUB in MBR or /boot? kmlinux12 Linux - Enterprise 7 09-25-2004 01:47 AM
Help with Grub in MBR and /boot partition! zLinuxz Linux - General 11 11-17-2003 11:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 09:39 AM.

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
Open Source Consulting | Domain Registration