LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   after reinstalling grub, grub comes in command prompt mode (https://www.linuxquestions.org/questions/linux-general-1/after-reinstalling-grub-grub-comes-in-command-prompt-mode-809151/)

daudiam 05-20-2010 03:32 PM

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.

Larry Webb 05-20-2010 05:09 PM

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

daudiam 05-21-2010 07:54 AM

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.

saikee 05-21-2010 08:04 AM

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.

Larry Webb 05-21-2010 08:34 AM

Sorry for the bad advice, that pesky grub2, will have to get up to date on the changes from 1 to 2.

daudiam 05-22-2010 02:33 AM

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.

saikee 05-22-2010 06:53 AM

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.

colorpurple21859 05-22-2010 08:23 AM

Look in /etc/default/grub. This is one of the files that update-grub reads to create grub.cfg

daudiam 05-22-2010 08:27 AM

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


colorpurple21859 05-22-2010 11:15 AM

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.

daudiam 05-22-2010 01:47 PM

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)

colorpurple21859 05-22-2010 05:26 PM

Have you tried Larry Web's method after booting into your ubuntu installation from the grub command prompt?

Larry Webb 05-22-2010 08:23 PM

Quote:

Originally Posted by colorpurple21859 (Post 3977933)
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.

saikee 05-23-2010 03:12 AM

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.

daudiam 05-23-2010 05:42 AM

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 ?


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