Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] GRUB always puts me to command prompt
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
solamour
l33t
l33t


Joined: 21 Dec 2004
Posts: 698
Location: San Diego, CA

PostPosted: Sat Sep 25, 2010 1:18 am    Post subject: [Solved] GRUB always puts me to command prompt Reply with quote

I have a relatively old (several years old) PC that has 320GB IDE hard disk. I'm sure it might not be a good practice, but I like keeping things simple, so I have only 2 partitions.
Code:
/etc/fstab:

/dev/sda1  /     ext4  noatime  0  1
/dev/sda2  none  swap  sw       0  0

When the system boots, it always drops me straight to the GRUB command prompt; I need to type the following commands, and then it starts booting.
Code:
root (hd0,0)
kernel /boot/kernel... root=/dev/sda1
boot

Just to prove I'm not missing anything, I created a small boot partition, and I no longer see GRUB command prompt.
Code:
/etc/fstab:

/dev/sda1  /boot  ext2  noatime  1  2
/dev/sda2  /      ext4  noatime  0  1
/dev/sda3  none   swap  sw       0  0

So I think GRUB isn't able to find "/boot/grub/grub.conf" when there is no separate boot partition, and perhaps that's why it presents me the command prompt.

Is there a way to make GRUB boot automatically without creating a separate boot partition? I'd appreciate any suggestions.
__
sol


Last edited by solamour on Sun Sep 26, 2010 6:38 am; edited 1 time in total
Back to top
View user's profile Send private message
BradN
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2391
Location: Wisconsin (USA)

PostPosted: Sat Sep 25, 2010 2:11 am    Post subject: Reply with quote

As a debugging step, symlink /grub to /boot/grub.

If that makes it work, remove the symlink and try reinstalling grub to the mbr or partition (depending how you have it).

I always thought grub tried to read:
/boot/grub/menu.lst

- and not:
/grub/menu.lst

- just to seamlessly handle boot partition or no boot partition. In the case where there is a boot partition, /boot is symlinked to / so that grub can follow it and still find its stuff. But, it's possible that grub now checks the location when it's installed and alters its search path accordingly.

There really isn't anything to worry about with not having a boot partition in general, but it can cause minor headaches depending what filesystem you use. For example, reiserfs3.6, if uncleanly unmounted, will take many seconds to begin booting, as it seems grub re-checks the journal for every step it makes loading files.


If the /grub symlink doesn't make it work, double check that grub.conf is a symlink to menu.lst, as menu.lst is the file grub actually tries to read.
Back to top
View user's profile Send private message
solamour
l33t
l33t


Joined: 21 Dec 2004
Posts: 698
Location: San Diego, CA

PostPosted: Sat Sep 25, 2010 5:53 pm    Post subject: Reply with quote

I created a symlink "/grub" to "/boot/grub", but that didn't solve the problem.
Code:
$ ls -la /grub
lrwxrwxrwx 1 root root 10 Sep 24 22:41 /grub -> /boot/grub

$ ls -la /boot/grub/menu.lst
lrwxrwxrwx 1 root root 9 Sep 24 14:33 /boot/grub/menu.lst -> grub.conf

The computer came with a 60GB hard disk, which I replaced with 320GB. I suspect that the computer is too old to recognize a big hard disk, because I used to have such a machine a while ago. If I remember correctly, I had to install a PCI interface card in order to use a larger hard disk. Unfortunately this one can't be expanded.
__
sol
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54244
Location: 56N 3W

PostPosted: Sat Sep 25, 2010 5:58 pm    Post subject: Reply with quote

solamour,

Post your grub.conf file and the output of
Code:
ls -l /boot
and
Code:
ls -l /boot/grub

_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
solamour
l33t
l33t


Joined: 21 Dec 2004
Posts: 698
Location: San Diego, CA

PostPosted: Sat Sep 25, 2010 6:28 pm    Post subject: Reply with quote

Here they are. Once I enter "root (hd0,0)" and "kernel..." in GRUB's command prompt, I can boot the system.

Code:
# cat /boot/grub/grub.conf
default 0
timeout 2
splashimage=(hd0,0)/boot/grub/splash.xpm.gz

title Gentoo 2.6.34-r6
root (hd0,0)
kernel /boot/kernel-2.6.34-gentoo-r6 root=/dev/sda1 video=uvesafb:800x600-32,mtrr:3,ywrap


Code:
# ls -la /boot
total 5168
drwxr-xr-x  3 root root    4096 Sep 25 11:15 .
drwxr-xr-x 18 root root    4096 Sep 25 10:51 ..
-rw-r--r--  1 root root       0 Sep 15 21:01 .keep
-rw-r--r--  1 root root 1600145 Sep 24 17:15 System.map-2.6.34-gentoo-r6
lrwxrwxrwx  1 root root       1 Sep 24 14:33 boot -> .
-rw-r--r--  1 root root   66809 Sep 24 17:15 config-2.6.34-gentoo-r6
drwxr-xr-x  2 root root    4096 Sep 24 22:40 grub
-rw-r--r--  1 root root 3605728 Sep 24 17:15 kernel-2.6.34-gentoo-r6


Code:
# ls -l /boot/grub
total 476
-rw-r--r-- 1 root root    197 Aug 31  2009 default
-rw-r--r-- 1 root root     30 Aug 31  2009 device.map
-rw-r--r-- 1 root root   8764 Sep 15 21:01 e2fs_stage1_5
-rw-r--r-- 1 root root   7924 Sep 15 21:01 fat_stage1_5
-rw-r--r-- 1 root root   7176 Sep 15 21:01 ffs_stage1_5
-rw-r--r-- 1 root root    192 Sep 24 17:48 grub.conf
-rw-r--r-- 1 root root    627 Aug 31  2009 grub.conf.x
-rw-r--r-- 1 root root   7180 Sep 15 21:01 iso9660_stage1_5
-rw-r--r-- 1 root root   8736 Sep 15 21:01 jfs_stage1_5
lrwxrwxrwx 1 root root      9 Sep 24 14:33 menu.lst -> grub.conf
-rw-r--r-- 1 root root   7328 Sep 15 21:01 minix_stage1_5
-rw-r--r-- 1 root root   9716 Sep 15 21:01 reiserfs_stage1_5
-rw-r--r-- 1 root root  33856 Sep 15 21:01 splash.xpm.gz
-rw-r--r-- 1 root root    512 Sep 15 21:01 stage1
-rw-r--r-- 1 root root 107704 Sep 15 21:01 stage2
-rw-r--r-- 1 root root 107972 Sep  3 11:05 stage2.old
-rw-r--r-- 1 root root 107704 Sep 15 21:01 stage2_eltorito
-rw-r--r-- 1 root root   7476 Sep 15 21:01 ufs2_stage1_5
-rw-r--r-- 1 root root   6776 Sep 15 21:01 vstafs_stage1_5
-rw-r--r-- 1 root root   9652 Sep 15 21:01 xfs_stage1_5

I have another machine (with the original 60GB hard disk, same CPU, less RAM, same Gentoo), and that one boots properly. If all attempts fail, I'm going to try shrinking 320GB to 60GB and see that makes any difference.
__
sol
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Sat Sep 25, 2010 6:49 pm    Post subject: Reply with quote

i think it's more related to partitions type.

In case one you have / as ext4
In case two you have test with a /boot as ext2

Many people upgrade grub to newer version but always forget to upgrade the grub version INSIDE the mbr.
And grub1 wasn't design to support ext4, this was add by a patch.

So: redo your testing with a /boot partition, but made it ext4 this time instead of ext2, pretty sure your grub won't boot it too

If it work, you should redo the grub setup so newer grub version crush the old one in your mbr
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54244
Location: 56N 3W

PostPosted: Sat Sep 25, 2010 7:06 pm    Post subject: Reply with quote

solamour,

That all looks good. Comment out
Code:
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
for testing.
I suspect your splashimage is broken.

krinn,

Its not grub not supporting ext4, or grubs stage2 would not load.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Veldrin
Veteran
Veteran


Joined: 27 Jul 2004
Posts: 1945
Location: Zurich, Switzerland

PostPosted: Sat Sep 25, 2010 7:25 pm    Post subject: Reply with quote

Code:
kernel /boot/kernel-2.6.34-gentoo-r6 root=/dev/sda1 video=uvesafb:800x600-32,mtrr:3,ywrap

Code:
/dev/sda2  /      ext4  noatime  0  1


the bugger is the root=/dev/sda1 in the grub config, which should be root=/dev/sda2.

HTH
V.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Sat Sep 25, 2010 7:33 pm    Post subject: Reply with quote

NeddySeagoon wrote:

krinn,

Its not grub not supporting ext4, or grubs stage2 would not load.


I think about that too neddy, but a non-ext4 grub in mbr might branch to an ext4-ready grub stage2 file when booting.

Might explain the "grub ignore my grub.conf" but "boot when typing the command"
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54244
Location: 56N 3W

PostPosted: Sat Sep 25, 2010 8:32 pm    Post subject: Reply with quote

krinn,

A non ext4 grub in the MBR cannot read anything from an ext4 boot.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Sat Sep 25, 2010 10:08 pm    Post subject: Reply with quote

This must be the solve then:
http://www.gnu.org/software/grub/manual/grub.html#GRUB-only-offers-a-rescue-shell

As it must have an old grub (or newer one) with a badly "set" that prevent grub from loading "normal" and so cannot find the grub.lst file

I was thinking how could this happen?
Well, answer might be that (or something else, but that's a good reason i think):

mount /boot (from hd0,1) to / (hd0,0)
ask grub install itself in mbr
grub now record it's default "set" = "prefix=(hd0,1)/grub" in your mbr of (hd0)

now unmount & erase the (hd0,1) as you only wish to use the / (hd0,0)
emerge grub = install grub files to /boot (but this boot is in hd0,0), but as you don't install grub in mbr again, prefix remain set as before

when booting, grub is still "set" to "prefix=(hd0,1)/grub where your prefix should now be (hd0,0)/grub


edit: for the op, i'm sometimes (nearly always) not clear, but you can temporaly correct it as they said in the link, and you were doing it when forcing root(hd0,0)...
To fix it, you must boot your gentoo
type grub
(now in grub menu)
root (hd0,0)
setup (hd0)
this will reinstall grub in your mbr, but this time grub should record prefix=(hd0,0)/grub
(well, if i'm right)
Back to top
View user's profile Send private message
BradN
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2391
Location: Wisconsin (USA)

PostPosted: Sat Sep 25, 2010 11:57 pm    Post subject: Reply with quote

You can do the installation commands from grub itself (at system boot) also, but it must be able to read its files from the hard drive (then again, it must be able to read its files from the hard drive to do anything). In fact, if you have problems installing it within gentoo (maybe if it gets the device order wrong with multiple hard drives), that's an option.
Back to top
View user's profile Send private message
solamour
l33t
l33t


Joined: 21 Dec 2004
Posts: 698
Location: San Diego, CA

PostPosted: Sun Sep 26, 2010 6:38 am    Post subject: Reply with quote

Whether the partition is ext2 or ext4 doesn't seem to matter, because
1) booting is OK when there is a separate boot partition (/dev/sda1) in ext4
2) the other machine with the original 60GB hard disk is also ext4 in a single partition.

"splashimage" doesn't seem like the cause of the problem, because even if I comment it out, the problem doesn't go away.

Veldrin:
"/etc/fstab" with 3 partitions ("/boot", "/", swap) was to verify whether creating a separate boot partition was effective or not. After I made sure having a separate boot partition solved the problem, I went back to 2 partitions ("/" and swap).

I vaguely remember the system booted OK with a single partition at one point in the past. Anyhow, I tried to shrink the partition to something smaller (about 20GB), but gparted was taking a very long time to finish it, because the system was pitifully underpowered (AMD Geode 500Mhz).

After several hours, I got tired of watching the endless progress bar, so I stopped the shrinking process despite of gparted's warning on possible corruption of file system if canceled in the middle. Just to ease my mind, I tried booting for the one last time.

And what do I know, the system booted properly. It complained about the file system not clean, but after fsck, everything worked as expected. No more GRUB's command prompt.

I think what's happening is that the system has some sort of a boundary, and if the files are stored outside that boundary, it can't read until Gentoo is fully up and running. Even though I canceled the shrinking process in the middle, the files in "/boot" were moved toward the front of the disk, and perhaps that's why now I'm able to boot. The problem might come back later when the boot files are pushed to the back of the disk.

Because it's working, I'm going to leave it as is for now. If you have any suggestions on how to prevent the problem from coming back, please share your thoughts. Thank you everyone for taking time to respond. I appreciate it.
__
sol
Back to top
View user's profile Send private message
Randy Andy
Veteran
Veteran


Joined: 19 Jun 2007
Posts: 1148
Location: /dev/koelsch

PostPosted: Sun Sep 26, 2010 9:35 am    Post subject: Reply with quote

@ BradN

you wrote:
Quote:
If the /grub symlink doesn't make it work, double check that grub.conf is a symlink to menu.lst, as menu.lst is the file grub actually tries to read.



This is not correct or not default for gentoo (but default for most of the others distros out there, but in my opinion only gentoo did it right and consistent to the other conf. schemes )

The grub.conf is the real file, and the menu.lst is the symbolic link which points to it, so you have to reverse it:
Code:

ln -s grub.conf menu.lst

Beside of this, it doesn't seem to make a diffence for the correct function of grub, so this is for information only.
_________________
If you want to see a Distro done right, compile it yourself!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54244
Location: 56N 3W

PostPosted: Sun Sep 26, 2010 11:03 am    Post subject: Reply with quote

solamour,

Well caught!
Older machines, or rather older BIOSes do indeed have a boundary. So do modern systems. The difference is that with older systems the boundary lies inside the hard drive space.
Going back a few generations , its 137G, 33G ... all the way back to 528Mb, which is why a small /boot at the front of the drive became popular.
The race between BIOSs and hard drive sizes continues. The boundary today is at 144115TB. It will be a while before drives get that big.

What happened to you is that grub.conf was above the boundary and could not be read. Grub uses the BIOS for reading all the files needed to boot.
All your other boot files must have been below the bounday.

If you want the full story, read the Large Drive HOWTO on tldp.org
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Sun Sep 26, 2010 11:21 am    Post subject: Reply with quote

NeddySeagoon wrote:
The boundary today is at 144115TB. It will be a while before drives get that big.


I agree, but you really shoudn't say that, like previous guys saying things like that show us :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum