LinuxQuestions.org
Help answer threads with 0 replies.
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 06-02-2007, 02:31 PM   #1
almon
Member
 
Registered: May 2007
Location: india
Distribution: ubuntu7
Posts: 73

Rep: Reputation: 15
Recovering grub


I had windows xp,vista and ubuntu in my system.So when i used to boot my computer then first grub comes.It had option to boot into vista.then vista boot loader had xp boot loader in it. Due to some prob I deleted windows vista drive.Now when I boot computer then grub loads and says error 17.what should I do.I want xp and ubuntu both.........help!!!!!!!!!
 
Old 06-02-2007, 03:44 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
Probably the easiest thing to do is boot off of a live/recovery CD, manipulate the partitions, and re-run grub-install to reinstall the bootloader. Depoending on how you're doing it, you may need to use the --root-directory flag to grub-install to tell it where it should puyt its second stage loader (usually this is /boot/grub and you may also need to edit the menu.lst to make sure both XP and Ubuntu are bootable.

Probably you screwed up the partition numbers by deleting the Vista partition.
 
Old 06-03-2007, 12:51 AM   #3
almon
Member
 
Registered: May 2007
Location: india
Distribution: ubuntu7
Posts: 73

Original Poster
Rep: Reputation: 15
When i run this grub-install /dev/sda depending command I get this error:
could not find device for /boot:not found or not a block device

also I dont have /boot/grub/menu.lst present in my grub folder

and my fdisk command gives output like this
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 1305 10482381 c W95 FAT32 (LBA)
/dev/sda2 1306 19456 145797907+ f W95 Ext'd (LBA)
/dev/sda5 1306 6404 40957686 7 HPFS/NTFS
/dev/sda6 6405 11503 40957686 7 HPFS/NTFS
/dev/sda7 11504 12721 9783553+ 7 HPFS/NTFS
/dev/sda8 * 12722 13994 10225341 83 Linux
/dev/sda9 13995 14053 473886 82 Linux swap / Solaris
/dev/sda10 14054 16602 20474811 7 HPFS/NTFS
/dev/sda11 16603 19456 22924723+ 7 HPFS/NTFS

Now tell what I should do
 
Old 06-03-2007, 12:55 AM   #4
almon
Member
 
Registered: May 2007
Location: india
Distribution: ubuntu7
Posts: 73

Original Poster
Rep: Reputation: 15
help pls!!!!!
 
Old 06-03-2007, 03:24 AM   #5
khajakhalid
LQ Newbie
 
Registered: Jul 2006
Posts: 3

Rep: Reputation: 0
Grub loader

Dear

it is easy to recover grub.
i think you have all OS cd. set of Ubuntu
just insert first cd in sys. and reboot sys.
now when you get first boot screen, which we are getting at the time of
installation,
on that screen give following command

linux rescue

and press enter.

it will ask you few things and will tell you few things,
give proper answer regarding your network and as per your environment.
then you will get single user prompt. on that shell environment check that
whether your grub.conf file is there or it get currepted.

cat /boot/grub/grub.conf

if you can see this file then it is good.
then its meanding that you need to reconfigure MBR. but as you had told
that you had install xp again, it iwill not there.
so just use follow commands to generate your grub.conf file.

grub-install-/dev/hda or whatever your boot device is there.

after giving this comman you will get message that Done.

simple reboot sys. and check that did u get grub boot loader or not.

pl.reply with your experience.

Best Regards
M.K.Khalid
Linux Administrator
K.S.A
 
Old 06-03-2007, 04:47 AM   #6
almon
Member
 
Registered: May 2007
Location: india
Distribution: ubuntu7
Posts: 73

Original Poster
Rep: Reputation: 15
But sir where do I type these commands....i mean that whenever i boot into live cd of ubuntu then their is no option to type any command they have their own options like start or install ubuntu
mem test
and etc
tell me where I should I type them
 
Old 06-03-2007, 07:08 AM   #7
khajakhalid
LQ Newbie
 
Registered: Jul 2006
Posts: 3

Rep: Reputation: 0
Dear ,

All you have to do at the Linux Rescue Mode

you know how to go to Rescue Mode

1) if you have rescue CD boot with and do as i said earlier

2) if no rescue CD then boot with First OS(Ubuntu) Installation CD

when you boot up with this CD it will ask for several options

there you need to select the RESCUE Option

The you have to do as I said in my fisrt post

share your troubles if you face any.

Best Regards
M.K.Khalid
 
Old 06-03-2007, 10:29 AM   #8
almon
Member
 
Registered: May 2007
Location: india
Distribution: ubuntu7
Posts: 73

Original Poster
Rep: Reputation: 15
if i am right then there is no such rescue mode in ubuntu linux cd....thats y i m asking......
 
Old 06-03-2007, 11:02 AM   #9
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
The rescue mode is provided by some but not all Linux.

The standard method is to boot up any Linux Live CD (in this case just use Ubuntu CD) make a temp directory in /mnt, then mount the Linux partition and then change root into it. This is the standard technique of booting up the kernel of a Live CD but using the Bash shell of the unbootable Linux.

The rescue mode in any installation CD is doing exactly the same thing except it makes the tempoarary directory and mounts the partition for for automatically. The steps are simple Linux commands so learn it once and kiss good bye to all your booting problems because it is the same method to rescue a Lilo.

Thus using Ubuntu CD in the OP case would involve

(1) Boot up the Ubuntu CD
(2) click terminal, make a temp directory in /mnt/sda8, mount the device sda8 on it, chroot into the unbootable Ubuntu in sda8, fire up grub-install command and exit back to the LIve CD Linux
Code:
sudo mkdir /mnt/sda8
sudo mount /dev/sda8 /mnt/sda8
sudo chroot /mnt/sda8
after this point the user is actually inside the unbootable Ubuntu of sda8 and so the grub-install will repair the Grub there by
Code:
grub-install /dev/sda
exit
sudo reboot
One must exit first from the unbootable Ubuntu in sda8 first back to the Live CD.

Since the user enters into unbootable Ubuntu of sda8 as the root user the red commands are privileged and will be accepted without preceding with "Sudo".

If the above does not yield expected result using a Grub shell should do the trick as a Grub shell is more robust than "grub-install" inside a Bash shell.

The Grub shell method needs no change root but the Live CD must have Grub. Since Ubuntu CD has it so the commands on booting it up are
Code:
sudo grub
root (hd0,7)
setup (hd0)
quit
sudo reboot
The blue commands are inside the Grub shell.

The OP's partition scheme shows only one Linux partition of sda8. To Grub that should be the (hd0,7) as Grub counts from 0.

If the OP's problem isn't resolved by the above then post the following information (after booting Ubuntu CD)

(1) /boot/grub/menu.lst inside sda8 (make a temp directory, mount it and display its content)
(2) /boot/grub/device.map in sda8

Confirm XP boots or not and which Vista partition was deleted.

Last edited by saikee; 06-03-2007 at 11:11 AM.
 
Old 06-17-2007, 10:16 AM   #10
almon
Member
 
Registered: May 2007
Location: india
Distribution: ubuntu7
Posts: 73

Original Poster
Rep: Reputation: 15
after this command sudo chroot /mnt/sda8
I get this error

chroot: cannot run command `/bin/bash': Exec format error

What is this???
 
Old 06-17-2007, 03:00 PM   #11
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
There needs to be a shell to run in the chroot environment. Since you (should be) chrooting into your Linux / partition /bin/bash should work fine. Can you do an "ls /mnt/sda8/bin/bash" before trying the chroot to make sure it is there and a valid executable file. If not, please go through saikee's commands again, note any errors you get trying to set up and mount /dev/sda8, and post them here.
 
Old 06-18-2007, 03:24 AM   #12
almon
Member
 
Registered: May 2007
Location: india
Distribution: ubuntu7
Posts: 73

Original Poster
Rep: Reputation: 15
At last I recovered my grub!!!but no I am trapped in one more prob....When I try to load the linux it says
error 17:cannot mount the selected partition
Now whats that!!!!!
 
Old 06-18-2007, 06:43 AM   #13
almon
Member
 
Registered: May 2007
Location: india
Distribution: ubuntu7
Posts: 73

Original Poster
Rep: Reputation: 15
I m not able to understand whats the problem ,after succesfully recovering grub
 
Old 06-18-2007, 11:41 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
To help to resolve your problem you need to supply information. Take a look at the last part of the Post #9.

Basically you need to post here the Grub's menu.lst that fails.
 
Old 06-19-2007, 11:12 PM   #15
almon
Member
 
Registered: May 2007
Location: india
Distribution: ubuntu7
Posts: 73

Original Poster
Rep: Reputation: 15
Here is menu.lst
# 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 change this entry to 'saved' 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=c9da3458-9d9f-480f-90b2-47226115b63c ro

## Setup crashdump menu entries
## e.g. crashdump=1
# crashdump=0

## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,9)

## 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

## 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

## ## End Default Options ##

title Ubuntu, kernel 2.6.20-15-generic
root (hd0,9)
kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=c9da3458-9d9f-480f-90b2-47226115b63c ro quiet splash
initrd /boot/initrd.img-2.6.20-15-generic
quiet
savedefault

title Ubuntu, kernel 2.6.20-15-generic (recovery mode)
root (hd0,9)
kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=c9da3458-9d9f-480f-90b2-47226115b63c ro single
initrd /boot/initrd.img-2.6.20-15-generic

title Ubuntu, kernel 2.6.17-10-generic
root (hd0,9)
kernel /boot/vmlinuz-2.6.17-10-generic root=UUID=c9da3458-9d9f-480f-90b2-47226115b63c ro quiet splash
initrd /boot/initrd.img-2.6.17-10-generic
quiet
savedefault

title Ubuntu, kernel 2.6.17-10-generic (recovery mode)
root (hd0,9)
kernel /boot/vmlinuz-2.6.17-10-generic root=UUID=c9da3458-9d9f-480f-90b2-47226115b63c ro single
initrd /boot/initrd.img-2.6.17-10-generic

title Ubuntu, memtest86+
root (hd0,9)
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 Windows Vista/Longhorn (loader)
root (hd0,0)
savedefault
makeactive
chainloader +1

Last edited by almon; 06-19-2007 at 11:18 PM.
 
  


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
Recovering GRUB on dual boot XP/RH box ericcarlson Linux - Software 2 06-05-2007 07:55 PM
LXer: Howto: Recovering grub boot loader password LXer Syndicated Linux News 0 02-22-2006 04:16 AM
Recovering Grub after Windows Install paul-r Debian 1 01-28-2006 11:52 PM
Problem in recovering GRUB ilyushin Linux - Newbie 1 07-07-2005 11:55 PM
Lilo config or recovering Grub....??? avols143 Linux - Newbie 5 03-03-2004 07:03 AM

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

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

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