LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-06-2013, 09:26 PM   #1
InventiousTech
LQ Newbie
 
Registered: Oct 2013
Posts: 20

Rep: Reputation: Disabled
grub not booting the correct device


Hi,

Well, first a bit of background:
I got an old HP DL380 G4 to run a minecraft server on, but I mostly got it to learn about linux server architecture, so don't tell me it's old and slow, because believe me, I know. First off, I tried installing Fedora 18, Centos 6.4, archlinux, and Ubuntu. Fedora, Centos, and Ubuntu couldn't resolve the display driver properly and the monitor kicked an error which I spent several days trying to fix. With Archlinux, I was able to boot to the disk prompt, and from there I could install the system and chroot in. However, when I tried to boot the the drive itself, I got the monitor error again. Finally I tried an older version of CentOS (5.9), and that worked all the way through the graphical install with one important caveat. When I had installed Arch, I used GPT for the partition tables, but CentOS 5.9 doesn't support that, so I had to go and change it to MBR. After CentOS was installed, I booted the system, and got a
Code:
grub
Error, no such partition
Grub rescue>
So, eventually, I figured out how to see and change the boot device from the rescue prompt. the set command returned that grub was looking for (hd0, gpt1) as the root device, but I don't think that's valid. My partitions are like so:
#1 4GB Swap /dev/cciss/c0d0p1
#2 10GB ext3 /dev/cciss/c0d0p2 (this is where the grub files are)
#3 340GB ext3 /dev/cciss/c0d0p3 (This is where /boot, /home, /var etc. are) Also this is flagged as the boot device.
In /grub/device.map it shows hda0 /dev/cciss/c0d0, which is the main raid controller device. I tried to set the root partition from the grub rescue prompt with set root=(hda0,2) but it was not persistent through a reboot. It just went back to (hda0, gpt1). It seems like grub is leftover from the arch install when the partition table was GPT, and it hasn't changed the device map. I tried
Code:
grub-install /dev/cciss/c0d0p2
from the arch disk prompt, but I got an error (something like cannot create file x, sorry I don't remember the actual message). Any idea how I might re-install grub to get it to see the proper partitions for boot?
 
Old 10-06-2013, 11:26 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,140

Rep: Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123
Quote:
Originally Posted by InventiousTech View Post
When I had installed Arch, I used GPT for the partition tables, but CentOS 5.9 doesn't support that, so I had to go and change it to MBR.
How did you do that ?.
Let's see (as root) the output from "parted -l" (use Arch, not the old CentOS).
 
Old 10-07-2013, 04:31 AM   #3
voleg
Member
 
Registered: Oct 2013
Distribution: RedHat CentOS Fedora SuSE
Posts: 354

Rep: Reputation: 51
Boot from rescue disk and chroot into installation.
Double check your parttion schema to detect /boot.
Check that /boot have kernel, initrd, grub, grub/*stage*, grub/grub.conf

Use (hd1,0) if your /boot is first partition on cciss, (hd1,1) if second; see below
Now update grub record like:
# grub
grub> device (hd1) /dev/cciss/c0d0

grub> root (hd1,0)
Filesystem type is ext2fs, partition type 0x83

grub> setup (hd1)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... yes
Checking if "/grub/stage2" exists... yes
Checking if "/grub/e2fs_stage1_5" exists... yes
Running "embed /grub/e2fs_stage1_5 (hd1)"... failed (this is not fatal)
Running "embed /grub/e2fs_stage1_5 (hd1,0)"... failed (this is not fatal)
Running "install /grub/stage1 (hd1) /grub/stage2 p /grub/grub.conf "... succeeded
Done.

grub> quit
 
Old 10-07-2013, 04:35 AM   #4
voleg
Member
 
Registered: Oct 2013
Distribution: RedHat CentOS Fedora SuSE
Posts: 354

Rep: Reputation: 51
Ha !
Just paid attention, you have first SWAP partition 4G.
Grub cannot jump to partition above 2G from disk start.

You have to remove first swap partition, create small /boot instead, copy all content to it,
then follow my previous post.
 
Old 10-07-2013, 04:38 AM   #5
voleg
Member
 
Registered: Oct 2013
Distribution: RedHat CentOS Fedora SuSE
Posts: 354

Rep: Reputation: 51
As you've create 10G /boot, looks like you have a lot free space.

Just format your first partition and use it instead /boot
/boot rarely runs out of 100m.

Once boot will be successfull, format secong 10g partition as swap.
 
Old 10-07-2013, 05:32 PM   #6
InventiousTech
LQ Newbie
 
Registered: Oct 2013
Posts: 20

Original Poster
Rep: Reputation: Disabled
Well, I re-partitioned the drive with parted like so:

p1 /boot 4GB exf3 /dev/cciss/c0d0p1
p2 10GB swap /dev/cciss/c0d0p2
p3 / 350GB exf3 /dev/cciss/c0d0p3

Then I re-installed CentOS 5.9 to p3 and selected "install grub on first sector of /dev/cciss/c0d0p1". Am I correct in thinking that the grub files should be on the /boot partition? Anyway, after doing this, I booted and the partition error is gone, but it just sits at "Grub Loading" forever. I also tried installing CentOS with the default option of installing grub on /dev/sda, but no dice. Same grub loading screen. I can't chroot (arch-chroot) into p3 (mounted on /mnt) because it says /mnt/run doesn't exist. I tried grub-install on /dev/cciss/c0d0p1, but it says
Code:
'/boot/grub' is not readable by GRUB on boot. Installation is impossible. Aborting.
Any ideas what might be the issue now? Also I should mention that I can't figure out how to get to the grub prompt to execute the setup command like you mentioned. There's no "grub" command, if that's what you mean.

Last edited by InventiousTech; 10-07-2013 at 05:54 PM.
 
Old 10-07-2013, 06:43 PM   #7
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,366

Rep: Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591
at the grub prompt what is the output of set,set will show what partition grub is looking for /boot/grub on and the root partition among other things. ls will list the partitions present and ls /, ls /boot, and ls /boot/grub will display what is in the directories of the partition that grub has for root.
 
Old 10-07-2013, 08:24 PM   #8
InventiousTech
LQ Newbie
 
Registered: Oct 2013
Posts: 20

Original Poster
Rep: Reputation: Disabled
Ahh, but therein lies the problem. I never get to a grub prompt, it hangs at "grub loading". Is there a way to get the grub prompt from the arch DVD command line? I can't chroot into the system because there's no /mnt/run mount point (with the CentOS drive being mounted at /mnt), so I can't actually get to a local system terminal. How is the grub prompt normally reached?
 
Old 10-07-2013, 08:40 PM   #9
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,366

Rep: Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591
create a new directory mount the boot partition to the new directory then run
grub-install --root-directory=<new directory>
 
Old 10-07-2013, 09:11 PM   #10
InventiousTech
LQ Newbie
 
Registered: Oct 2013
Posts: 20

Original Poster
Rep: Reputation: Disabled
Well, I tried "grub-install --root-directory=/mnt/boot" (That's where I mounted partition 1), but I got an error "ext2 file system does not support embedding". So, I tried it with the --force option and it seemed to work, but the boot sequence still stops at "grub loading".
 
Old 10-07-2013, 09:22 PM   #11
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,366

Rep: Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591
I think you need to install to mbr, instead of first partition.
 
Old 10-07-2013, 09:52 PM   #12
InventiousTech
LQ Newbie
 
Registered: Oct 2013
Posts: 20

Original Poster
Rep: Reputation: Disabled
Sorry for my ignorance, but how exactly would I target MBR from grub-install?
 
Old 10-07-2013, 09:56 PM   #13
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,366

Rep: Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591
Code:
grub-install --root-directory=<new directory> /dev/sda
It may be /dev/cciss I don't use raid.

Last edited by colorpurple21859; 10-07-2013 at 09:57 PM.
 
Old 10-07-2013, 10:19 PM   #14
InventiousTech
LQ Newbie
 
Registered: Oct 2013
Posts: 20

Original Poster
Rep: Reputation: Disabled
Ok, so I did what you said:
Code:
mount /dev/cciss/c0d0p1 /mnt
grub-install --root-directory=/mnt /dev/cciss/c0d0
After I did that, the system boots into the grub prompt. How do you boot to linux from the prompt? Also, since there's only one install, why would grub not boot to it automatically?
 
Old 10-08-2013, 01:26 AM   #15
voleg
Member
 
Registered: Oct 2013
Distribution: RedHat CentOS Fedora SuSE
Posts: 354

Rep: Reputation: 51
My recepie (one of first replies) was relevant for inital situation, when you had rescued
chrooted environment. Then in this environment, you have command grub.

Now, you reinstall over and over, and have no even rescue system.

I had no problem with G4 and RH4 and RH5 on it. I think RH6 will run also.
So CentOS6, probably, good.

Make fresh install, choose text mode, accept wipe all disks and default layout.
Everything should work.
 
  


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
[SOLVED] Grub can't find grub.cfg when booting - error: no such device Breagha Linux - Software 8 03-14-2010 12:40 PM
Get the correct boot device scristiv Linux - Newbie 7 12-28-2007 03:36 PM
correct grub.conf, reboot and cannot get grub prompt... sportivo888 Linux - Newbie 1 12-10-2007 11:47 PM
Booting with GRUB/LILO using a floppy form an ISO on a USB device? :s Toxyn Linux - Software 1 02-08-2007 08:49 AM
GRUB is not booting the correct partition in a dual drives system ps6000 Linux - Software 4 01-11-2007 10:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:33 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