LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-15-2006, 09:56 AM   #1
pickarooney
Member
 
Registered: Aug 2003
Distribution: (X)ubuntu Maverick
Posts: 152

Rep: Reputation: 15
Need help installing GRUB on SATA drive


After installing a new OS, I can't boot. GRUB is not installed on the primary drive and I can't get it to install.

sudo fdisk -l gives this:
Code:
Disk /dev/sda: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1         127     1020096   83  Linux
/dev/sda2           23948       24321     3004155    5  Extended
/dev/sda3             128        5226    40957717+  83  Linux
/dev/sda4            5227       23947   150376432+  83  Linux
/dev/sda5           23948       24321     3004123+  82  Linux swap / Solaris

Partition table entries are not in disk order

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

   Device Boot      Start         End      Blocks   Id  System
/dev/hda2               1        9729    78148161    5  Extended
/dev/hda5             702         732      248976   82  Linux swap / Solaris
/dev/hda6             733        9729    72268371   83  Linux
/dev/hda7               1         701     5630688   83  Linux

Partition table entries are not in disk order

Disk /dev/hdb: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hdb1   *           1       19193   154167741   83  Linux
/dev/hdb2           19194       24792    44973967+   5  Extended
/dev/hdb5           19194       24792    44973936   83  Linux

Disk /dev/sdf: 65 MB, 65536000 bytes
5 heads, 32 sectors/track, 800 cylinders
Units = cylinders of 160 * 512 = 81920 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1   *           1         800       63983    6  FAT16
Partition 1 has different physical/logical endings:
     phys=(1000, 4, 32) logical=(799, 4, 30)
the relevant part of /boot/grub/menu.lst is now:
Code:
title           Ubuntu, kernel 2.6.17-10-generic
root            (hd2,2)
kernel          /boot/vmlinuz-2.6.17-10-generic root=/dev/sda3 ro quiet splash
initrd          /initrd.img-2.6.17-10-generic
quiet
savedefault
boot
I tried the kernel line with and without /boot, to the same, negative effect.

fstab is like so:
Code:
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
# /dev/sda3
UUID=23cd75dd-8522-4cc8-8026-43d34facd54f /               ext3    defaults,errors=remount-ro 0       1
# /dev/sda1
UUID=38771644-df5d-4863-95ef-4abcf0a9c696 /boot           ext3    defaults        0       2
# /dev/sda4
UUID=6aca9cac-5354-4183-bf88-68e9e62bed9a /home           ext3    defaults        0       2
# /dev/hdb5
UUID=faf11a4c-4365-4982-98c9-fcf80bc73ca5 /media/backup   ext3    defaults        0       2
# /dev/hda6
UUID=f3466d96-c519-11d7-9a37-a027fa319c88 /media/oldhome  ext3    defaults        0       2
# /dev/hda7
UUID=bb8c5418-a024-4cc0-a287-4b1b083042af /media/oldsystem ext3    defaults        0       2
# /dev/hdb1
UUID=f084d777-e5ba-49df-b71b-729b2c0d2475 /media/supersize ext3    defaults        0       2
# /dev/sda5
UUID=7db0edf9-d00d-4b15-a5c3-c738a9091488 none            swap    sw              0       0
/dev/hdd        /media/cdrom0   udf,iso9660 user,noauto     0       0
/dev/hdc        /media/cdrom1   udf,iso9660 user,noauto     0       0
SDA is the SATA HD where I've just installed Kubuntu. HDB is a data disk and HDA is a third HD with an old Linux installation and my backed up home directory from before the reinstall.
I don't know what initrd is but I suppose it should have the same path as the kernel, whether that's with or without the /boot or not I can't figure. /boot is a separate partition on SDA1 by the way. Maybe there should be a boot=/dev/sda somehwere in menus.lst?

/boot contains: abi-2.6.17-10-generic grub lost+found System.map-2.6.17-10-generic
config-2.6.17-10-generic initrd.img-2.6.17-10-generic memtest86+.bin vmlinuz-2.6.17-10-generic

/boot/grub contains: efault e2fs_stage1_5 installed-version menu.lst minix_stage1_5 stage1 xfs_stage1_5
device.map fat_stage1_5 jfs_stage1_5 menu.lst.old reiserfs_stage1_5 stage2

Perhaps I should (re-)run grub-install, but with what parameters?

grub> find /etc/fstab
find /etc/fstab
(hd0,6)
(hd2,2)
grub> find /boot/grub/stage1
find /boot/grub/stage1
(hd0,6)
grub> root (hd2,2)
root (hd2,2)
grub> setup (hd0)
setup (hd0)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... no

Error 15: File not found
grub>

grub> setup (hd2)
setup (hd2)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... no

Error 15: File not found
grub>
 
Old 12-15-2006, 11:19 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Could you repeat the question??.......
Seriously, I'm having some data overload here....a few quick questions/comments;

I think you said that the new Kubuntu is on sda, with /boot mounted to sda1. From your grub config entry, I infer that / is sda3.
Assuming this is right, then this is wrong:
Code:
title           Ubuntu, kernel 2.6.17-10-generic
root            (hd2,2)
kernel          /boot/vmlinuz-2.6.17-10-generic root=/dev/sda3 ro quiet splash
initrd          /initrd.img-2.6.17-10-generic
quiet
savedefault
boot
It should read (in part) root (hd0,0) Remember that GRUB counts from zero. This line points to the partition where /boot is mounted.
Second, you do not want the /boot prefix in the kernel path (because you are sending GRUB to the partition which is aleady designated as /boot)

Also inferred here is that you are somehow able to boot into **some** Linux. Therefore GRUB is installed somewhere. But--no matter. To install GRUB on the primary drive (sda, where Kubuntu is), do this:
Code:
grub     to start the grub shell
root (hd0,0)
setup (hd0)
Once this is done, then the GRUB config file will need to be in sda1 /boot/grub
 
Old 12-15-2006, 12:27 PM   #3
pickarooney
Member
 
Registered: Aug 2003
Distribution: (X)ubuntu Maverick
Posts: 152

Original Poster
Rep: Reputation: 15
There is an old linux install on hda7, which serves no purpose other than to mislead GRUB.
When I go into grub and type find /etc/fstab it gives me results from two disks, hd0,6 and hd2,2.
If I then type root (hd0,6) and cat /etc/fstab it shows the fstab file from the old installation on hda7.
If I type root (hd2,2) and cat /etc/fstab it shows the fstab file from the brand new installation on sda. The same goes for xorg.conf
So, I know hd2,2 is the / partition on sda3.
You gave me a useful hint though. I was trying to install grub by going to root (hd2,2) instead of hd0,0. I tried just now with root (hd2,0) and setup (hd2) and GRUB installed with success.

Getting there. Now, there's still no * next to any of the partitions on the SATA drive when I run sudo fdisk -l, so I'm not sure I can boot to this partition just yet. Is there another command to get it to be bootable?
 
Old 12-15-2006, 12:45 PM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by pickarooney
There is an old linux install on hda7, which serves no purpose other than to mislead GRUB.
When I go into grub and type find /etc/fstab it gives me results from two disks, hd0,6 and hd2,2.
If I then type root (hd0,6) and cat /etc/fstab it shows the fstab file from the old installation on hda7.
If I type root (hd2,2) and cat /etc/fstab it shows the fstab file from the brand new installation on sda. The same goes for xorg.conf
So, I know hd2,2 is the / partition on sda3.
You gave me a useful hint though. I was trying to install grub by going to root (hd2,2) instead of hd0,0. I tried just now with root (hd2,0) and setup (hd2) and GRUB installed with success.

Getting there. Now, there's still no * next to any of the partitions on the SATA drive when I run sudo fdisk -l, so I'm not sure I can boot to this partition just yet. Is there another command to get it to be bootable?
I'm sorry, but this is totally confusing...

What is the primary (#1) drive? (This is set in the bios)
GRUB has to be installed to the mbr of drive #1

This:
Quote:
So, I know hd2,2 is the / partition on sda3.
says that sda is seen by the system as the 3rd drive

Finally, in Linux, partitions do not need to be flagged as bootable.
 
Old 12-15-2006, 12:52 PM   #5
pickarooney
Member
 
Registered: Aug 2003
Distribution: (X)ubuntu Maverick
Posts: 152

Original Poster
Rep: Reputation: 15
I'm not sure without checking. When I bought the PC it had only a SATA drive. I installed Linux on it and then added the other two IDE hard drives. I consider the SATA drive to be my primary drive, but perhaps the BIOS sees it as such. If I force the SATA to be primary drive in the BIOS will all the letters change around and the other partitions drives fail to mount unless I change fstab, or are the hdX letters set now by the OS installation and independent of GRUB's naming convention?

Bearing in mind up until a few days ago I was booting into Linux on the SATA drive and haven't changed the physical setup or the BIOS settings since, I don't understand why it shouldn't be possible to do the same now.

Last edited by pickarooney; 12-15-2006 at 01:00 PM.
 
Old 12-15-2006, 01:34 PM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Just because you were booting into Linux on the SATA does not mean that it was--or is--the primary drive.

All we can say for sure is that the mbr of the primary drive must have boot code in it. That boot code will be tied to some partition which will include its config file. If we have this in place, we can boot into just about anything....

Maybe at this point the question is: How do you WANT your system configured? Do you WANT GRUB on the SATA (as HD#1)
 
Old 12-15-2006, 01:52 PM   #7
pickarooney
Member
 
Registered: Aug 2003
Distribution: (X)ubuntu Maverick
Posts: 152

Original Poster
Rep: Reputation: 15
After installing grub to (hd2,0) I rebooted and there was a grub screen. I picked the first option but got an invalid partition error. Back into a LiveCD environment, I ran grub and now the disk numbers had changed and what was previously 2,2 had become 0,2 and the former 0,6 was now 1,6. After editing the menus.lst to reflect the change, using hd0,0 and without the /boot I rebooted into Linux
Everything is as it should be now, all drives and partitions mounted. Thanks very much for the help.
 
Old 12-15-2006, 01:59 PM   #8
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
We love happy endings. I can't follow how you got there, but as long as YOU know, then all is well......
 
Old 12-15-2006, 03:08 PM   #9
pickarooney
Member
 
Registered: Aug 2003
Distribution: (X)ubuntu Maverick
Posts: 152

Original Poster
Rep: Reputation: 15
They key was rooting to hd2,0. From there I installed GRUB which apparently attributes its own drive letters and order of preference. As SATA drives have no master/slave config, it's not really possible to set a primary master in the BIOS (at least this is the way I understand it, it's my first time working with this type of HD).
'tis good to be back
 
  


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
Installing Slackware 10.2 on SATA drive with a SATA CD-RW drive Voltar Slackware - Installation 19 08-01-2007 04:33 PM
Having problems understanding GRUB config with my sata drive mlsbraves Linux - Software 1 02-16-2006 02:05 PM
Installing grub onto sata drive to redirect to ide in Suse 9.3 d3viant Linux - Hardware 2 06-21-2005 09:14 AM
Using GRUB to load XP on *third* drive (SATA) gvaught Linux - General 11 02-07-2005 07:26 AM
grub won't work with SATA drive gjh Linux - General 3 01-17-2005 10:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:13 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
Open Source Consulting | Domain Registration