LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-20-2010, 03:32 PM   #1
daudiam
Member
 
Registered: Mar 2010
Posts: 68

Rep: Reputation: 15
after reinstalling grub, grub comes in command prompt mode


I had Ubuntu 9.04. But when I installed Windows also, the grub was overwritten. To reinstall the grub, I took a live cd of 9.10 and typed the following
Code:
GRUB 1.97 BETA 4
sudo mount /dev/sda8  /mnt
sudo grub-install --root-directory=/mnt  /dev/sda
No error message came, but when I restarted my computer, it showed

Code:
sh:grub>
Perhaps its the command line mode of grub. I want a graphical mode so that I can easily boot either Windows or Ubuntu.

Last edited by daudiam; 05-20-2010 at 03:33 PM.
 
Old 05-20-2010, 05:09 PM   #2
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
From your live cd terminal:

sudo grub
root (hd0,7)
setup (hd0)

I presume your ubuntu root partition is sda8. If you still end up with a grub prompt then we will have to go from a different angle.

If this does not help from terminal:

sudo fdisk -l

copy and paste the results
 
Old 05-21-2010, 07:54 AM   #3
daudiam
Member
 
Registered: Mar 2010
Posts: 68

Original Poster
Rep: Reputation: 15
grub : unknown command

Thanks

I went to Applications->Terminal from the live CD and typed
Code:
sudo grub
It said that command not found. I am using the live CD of Ubuntu 9.10 so I think the earlier grub commands don't work here, the installed command-line grub also shows 1.97 as the version number (The Ubuntu I am trying to restore is 9.04 though)

The Windows is installed on hd0,1 and linux on hd0,8.

Last edited by daudiam; 05-21-2010 at 07:56 AM.
 
Old 05-21-2010, 08:04 AM   #4
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
You have got a Grub prompt.

In my experience there is no intstalled OS that cannpt be booted by a Grub prompt.

Your post suggests that the /boot directory of your Linux has been "sourced" from sda8. You will get a Grub boot menu if you have a healthy grub.cfg in the /boot /grub directory of sda8. The the grub.cfg is missing or defective Grub boots to a Grub prompt.

If sda8 is your Ubuntu Linux with at least /boot inside then these lines at a Grub prompt will fire it up
Code:
set root=(hd1,8)
linux /vmlinuz ro root=/dev/sda8
initrd /initrd.img
boot
By the way you have got Grub2. Larry Webb's advice is for Grub1. Grub shell is not available in Grub2. Only Linux commands like "grub-install" etc are now used.

YOu can check the content of sda8 by mounting it with a Live CD
Code:
sudo mkdir /mnt/sda8
mount /dev/sda8 /mnt/sda8
ls /mnt/sda8
If you have /boot/grub/grub.cfg that means the partition is correct. Post grub.cfg here if it doesn't work.

Last edited by saikee; 05-21-2010 at 08:07 AM.
 
Old 05-21-2010, 08:34 AM   #5
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
Sorry for the bad advice, that pesky grub2, will have to get up to date on the changes from 1 to 2.
 
Old 05-22-2010, 02:33 AM   #6
daudiam
Member
 
Registered: Mar 2010
Posts: 68

Original Poster
Rep: Reputation: 15
linux booted but no GUI boot-menu still

Thanks

I tried the commands on the grub shell and I was able to boot into my Ubuntu. But the GUI boot-menu (through which I can select which OS to boot) still doesn't show. The command mode grub still comes up and i have to type several commands to load Ubuntu or Windows.

For Windows I have to type :
Code:
sh:grub>root (hd0,1)
sh:grub>chainloader +1
sh:grub>boot
For Ubuntu

As saikee told.

I also tried booting into the linux and typing update-grub there. It went smoothly but still the GUI mode of boot menu isn't coming.

Last edited by daudiam; 05-22-2010 at 02:35 AM.
 
Old 05-22-2010, 06:53 AM   #7
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
Show us your /boot/grub/grub.cfg

Every command you use to boot up a system is inside grub.cfg.

I dislike the grpahic screen of Grub becuase only in a text screen one can get a Grub prompt which is the most powerful bit of Grub.
 
Old 05-22-2010, 08:23 AM   #8
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,346

Rep: Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589
Look in /etc/default/grub. This is one of the files that update-grub reads to create grub.cfg
 
Old 05-22-2010, 08:27 AM   #9
daudiam
Member
 
Registered: Mar 2010
Posts: 68

Original Poster
Rep: Reputation: 15
Content of menu.lst

I have a 9.04 version of Ubuntu (only the live CD was of 9.10), so there is menu.lst instead of grub.cfg. Here is its contents.

Code:
# menu.lst - See: grub(8), info grub, update-grub(8)
#            grub-install(8), grub-floppy(8),
#            grub-md5-crypt, /usr/share/doc/grub
#            and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not use 'savedefault' or your
# array will desync and will not let you boot your system.
default		0

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout		10

## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
#hiddenmenu

# Pretty colours
#color cyan/blue white/blue

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line)  and entries protected by the
# command 'lock'
# e.g. password topsecret
#      password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title		Windows 95/98/NT/2000
# root		(hd0,0)
# makeactive
# chainloader	+1
#
# title		Linux
# root		(hd0,1)
# kernel	/vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
##      kopt_2_6_8=root=/dev/hdc1 ro
##      kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=df39ab9b-9e49-42cd-8412-d4f10050405c ro

## default grub root device
## e.g. groot=(hd0,0)
# groot=df39ab9b-9e49-42cd-8412-d4f10050405c

## should update-grub create alternative automagic boot options
## e.g. alternative=true
##      alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
##      lockalternative=false
# lockalternative=false

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash

## should update-grub lock old automagic boot options
## e.g. lockold=false
##      lockold=true
# lockold=false

## Xen hypervisor options to use with the default Xen boot option
# xenhopt=

## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
##      altoptions=(recovery) single
# altoptions=(recovery mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
##      howmany=7
# howmany=all

## specify if running in Xen domU or have grub detect automatically
## update-grub will ignore non-xen kernels when running in domU and vice versa
## e.g. indomU=detect
##      indomU=true
##      indomU=false
# indomU=detect

## should update-grub create memtest86 boot option
## e.g. memtest86=true
##      memtest86=false
# memtest86=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false

## should update-grub add savedefault to the default options
## can be true or false
# savedefault=false

## ## End Default Options ##

title		Ubuntu 9.04, kernel 2.6.28-16-generic
uuid		df39ab9b-9e49-42cd-8412-d4f10050405c
kernel		/boot/vmlinuz-2.6.28-16-generic root=UUID=df39ab9b-9e49-42cd-8412-d4f10050405c ro quiet splash 
initrd		/boot/initrd.img-2.6.28-16-generic
quiet

title		Ubuntu 9.04, kernel 2.6.28-16-generic (recovery mode)
uuid		df39ab9b-9e49-42cd-8412-d4f10050405c
kernel		/boot/vmlinuz-2.6.28-16-generic root=UUID=df39ab9b-9e49-42cd-8412-d4f10050405c ro  single
initrd		/boot/initrd.img-2.6.28-16-generic

title		Ubuntu 9.04, kernel 2.6.28-15-generic
uuid		df39ab9b-9e49-42cd-8412-d4f10050405c
kernel		/boot/vmlinuz-2.6.28-15-generic root=UUID=df39ab9b-9e49-42cd-8412-d4f10050405c ro quiet splash 
initrd		/boot/initrd.img-2.6.28-15-generic
quiet

title		Ubuntu 9.04, kernel 2.6.28-15-generic (recovery mode)
uuid		df39ab9b-9e49-42cd-8412-d4f10050405c
kernel		/boot/vmlinuz-2.6.28-15-generic root=UUID=df39ab9b-9e49-42cd-8412-d4f10050405c ro  single
initrd		/boot/initrd.img-2.6.28-15-generic

title		Ubuntu 9.04, kernel 2.6.28-11-generic
uuid		df39ab9b-9e49-42cd-8412-d4f10050405c
kernel		/boot/vmlinuz-2.6.28-11-generic root=UUID=df39ab9b-9e49-42cd-8412-d4f10050405c ro quiet splash 
initrd		/boot/initrd.img-2.6.28-11-generic
quiet

title		Ubuntu 9.04, kernel 2.6.28-11-generic (recovery mode)
uuid		df39ab9b-9e49-42cd-8412-d4f10050405c
kernel		/boot/vmlinuz-2.6.28-11-generic root=UUID=df39ab9b-9e49-42cd-8412-d4f10050405c ro  single
initrd		/boot/initrd.img-2.6.28-11-generic

title		Chainload into GRUB 2
root		df39ab9b-9e49-42cd-8412-d4f10050405c
kernel		/boot/grub/core.img

title		Ubuntu 9.04, memtest86+
uuid		df39ab9b-9e49-42cd-8412-d4f10050405c
kernel		/boot/memtest86+.bin
quiet

### END DEBIAN AUTOMAGIC KERNELS LIST

# This is a divider, added to separate the menu items below from the Debian
# ones.
title		Other operating systems:
root


# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title		Microsoft Windows XP Professional
rootnoverify	(hd0,0)
savedefault
makeactive
chainloader	+1
 
Old 05-22-2010, 11:15 AM   #10
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,346

Rep: Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589
By entering this at the grub command line, can you boot into ubuntu and then reinstall grub?
Quote:
uuid df39ab9b-9e49-42cd-8412-d4f10050405c
kernel /boot/vmlinuz-2.6.28-16-generic root=UUID=df39ab9b-9e49-42cd-8412-d4f10050405c ro quiet splash
initrd /boot/initrd.img-2.6.28-16-generic
boot
If not, you could use a live cd that uses grub legacy to reinstall grub by Larry Web's method. I don't think you will be able to install your grub legacy from a live cd that uses grub2, except maybe chrooting into your system and then reinstalling grub.
 
Old 05-22-2010, 01:47 PM   #11
daudiam
Member
 
Registered: Mar 2010
Posts: 68

Original Poster
Rep: Reputation: 15
Don't have 9.04 live CD, but do have 9.10 one

I can easily boot into Windows ans well as Ubuntu from the grub command line, but I want a GUI based one.

When I enter Ubuntu I tried typing
Code:
sudo update-grub
It went along fine, but on rebooting I again got the command line grub not the GUI one.

Is there anything else I should try (apart from using 9.04 live CD bcoz I'm not able to get one)
 
Old 05-22-2010, 05:26 PM   #12
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,346

Rep: Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589
Have you tried Larry Web's method after booting into your ubuntu installation from the grub command prompt?
 
Old 05-22-2010, 08:23 PM   #13
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
Quote:
Originally Posted by colorpurple21859 View Post
Have you tried Larry Web's method after booting into your ubuntu installation from the grub command prompt?
If he has the live cd of ubuntu 9.10 my advice is not good. My advice is to make a small partition for grub legacy and chainload the newer distros.
 
Old 05-23-2010, 03:12 AM   #14
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
You may have both Grub1 and Grub2 installed. if you boot a system by specifying the root as
Code:
root (hd0,1)
then you have Grub1 in MBR. Grub2 uses
Code:
set root=(hd0,2)
and counts the partition number from 1 instead of zero.

You can mix the Grub1 and Grub2 but they can both installed. The one that works is the one you put in the MBR.

The GUI bit of Grub is just loading a splash screen or employing the fgxmenu commonly found in Grub1.

You should forget the GUI menu if you have a booting confusion as it added uncertainty to to your problem.
 
Old 05-23-2010, 05:42 AM   #15
daudiam
Member
 
Registered: Mar 2010
Posts: 68

Original Poster
Rep: Reputation: 15
Thanks

But, its 100% Grub 1. From my first post can u tell me why the grub was installed in the shell mode ?

Is there any way to repair it or should I do a fresh install ?
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
GRUB command prompt, which stage?? adnankhawer Linux - Newbie 4 02-23-2009 10:49 AM
only grub in prompt mode? why? tajo01 Linux - General 9 04-06-2006 09:08 AM
how do I boot a cd from a grub command prompt? mangolicious Linux - Software 3 02-12-2006 07:17 PM
reinstalling grub in rescue mode ELconkestador Linux - Newbie 5 02-13-2005 03:43 AM
reinstalling grub on rescue mode mabus92920 Linux - Newbie 3 01-15-2005 05:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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