LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-15-2010, 08:45 AM   #1
noony123
Member
 
Registered: Oct 2010
Posts: 167

Rep: Reputation: 0
Grub issue


Hi all.

Please dont be mad at me, i ran into this issue only because i wanted to learn. I was reading the book, linux troubleshooting and decided to give it a try.

1) I went to /boot/ and moved vmlinuz (kernel file) to my home directory. (/root/)

2) I booted, it didnt boot (as expected) and now the troubleshooting part begins.

3) i entered to grub config mode using c

4) When i press root (hd0, (tab)
it gave me 2 partitions.
hd0 which is my boot partition
hd1 which is my '/' partition. Please keep in mind its LVM and not a physical partition

5) If i do this, root (hd0,1), and press boot, it gives the following error

Error 17: Cannot mount selected partition

During my research i found that, LVM is not supported by grub, so kindly confirm me this ? is this the reason i am not able to access my root partition ? i am doing this on vmware so no issues, but just for the sake of learning, can someone tell me some way of restoring it without using any rescure disk (livecd, liveusb etc) ?

Last edited by noony123; 12-15-2010 at 08:48 AM.
 
Old 12-15-2010, 08:54 AM   #2
noony123
Member
 
Registered: Oct 2010
Posts: 167

Original Poster
Rep: Reputation: 0
I am using the grub version 0.97
 
Old 12-15-2010, 01:27 PM   #3
noony123
Member
 
Registered: Oct 2010
Posts: 167

Original Poster
Rep: Reputation: 0
I checked on internet, and i found that in Grub 1.98, it can access LVM partitions. After installing 1.98, i am still not able to read the partitions from grub prompt !!

Pls someone guide me in right direction.
 
Old 12-15-2010, 02:26 PM   #4
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
First tell us which distro you are trying to boot.

Be patient!
 
Old 12-16-2010, 02:24 AM   #5
gd2shoe
Member
 
Registered: Jun 2004
Location: Northern CA
Distribution: Debian
Posts: 835

Rep: Reputation: 49
I second. This is going to be easier to fix if we know what distro you use.

Bear in mind, you can restore vmlinuz from other sources. Your installation disk would be a good source (generally, though it probably has a different name). For example, if you have Ubuntu already installed, you can boot the install disk, and copy the kernel to your /boot partition. This way, you don't need to read your root partition at all. Once your system boots again, I'd move your original back, just to be safe.

This is most likely to work with a kernel compiled by your distro.
 
Old 12-16-2010, 05:30 AM   #6
noony123
Member
 
Registered: Oct 2010
Posts: 167

Original Poster
Rep: Reputation: 0
I am sorry i didnt mention the distro

Distro -> Centos 5.5
Vmware -> Vmware Workstation 6
Grub -> Grub 1.98


Note: I am just doing this to strengthen my concepts, thats why i dont want to use any rescue CD, live cd etc

My partition lay out is as below

[root@WAN-Admin ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
12G 3.1G 7.8G 28% /
/dev/hda1 99M 13M 81M 14% /boot
tmpfs 252M 0 252M 0% /dev/shm
[root@WAN-Admin ~]#

My grub.conf and grub.cfg files are as below

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/hda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS
root (hd0,0)
kernel /vmlinuz-2.6.18-194.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.18-194.el5.img
[root@WAN-Admin ~]#

[root@WAN-Admin ~]# cat /boot/grub/grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
load_env
fi
set default="0"
if [ ${prev_saved_entry} ]; then
set saved_entry=${prev_saved_entry}
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi

function savedefault {
if [ -z ${boot_once} ]; then
saved_entry=${chosen}
save_env saved_entry
fi
}
if sleep --interruptible 0 ; then
set timeout=3
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "GNU/Linux, with Linux 2.6.18-194.el5" --class gnu-linux --class gnu --class os {
set gfxpayload=keep
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set e27eef61-f761-449c-bcb7-2f4e7620b4a2
echo Loading Linux 2.6.18-194.el5 ...
linux /vmlinuz-2.6.18-194.el5 root=/dev/mapper/VolGroup00-LogVol00 ro
echo Loading initial ramdisk ...
initrd /initrd-2.6.18-194.el5.img
}
menuentry "GNU/Linux, with Linux 2.6.18-194.el5 (recovery mode)" --class gnu-linux --class gnu --class os {
set gfxpayload=keep
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set e27eef61-f761-449c-bcb7-2f4e7620b4a2
echo Loading Linux 2.6.18-194.el5 ...
linux /vmlinuz-2.6.18-194.el5 root=/dev/mapper/VolGroup00-LogVol00 ro single
echo Loading initial ramdisk ...
initrd /initrd-2.6.18-194.el5.img
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###
[root@WAN-Admin ~]#

So basically, what i did, i simply moved the kernel (vmlinuz) from /boot to my home directory i.e. /root/

Now when i was using grub 0.97, i came to know that it cant read LVM partitions. So i upgraded it to grub 1.98. Even now, its not able to read lvm partition. When i do the following on grub prompt

grub> root (hd0, (press tab)

1 -> /boot
2 -> unknown filesystem

I am really lost here, kindly guide me. My task is simple. I want to boot kernel from by /root/ partition which is a LVM partition.

Pls guide me and sorry for the late reply.
 
Old 12-16-2010, 05:51 AM   #7
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,838

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
Try
"sudo os-prober"
then
"sudo update-grub"

Not sure if it'll work but worth a shot.
When you installed grub2 it didn't do a probe?
 
Old 12-16-2010, 05:51 AM   #8
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,838

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
Try
"sudo os-prober"
then
"sudo update-grub"

Not sure if it'll work but worth a shot.
When you installed grub2 it didn't do a probe?
 
Old 12-16-2010, 06:08 AM   #9
noony123
Member
 
Registered: Oct 2010
Posts: 167

Original Poster
Rep: Reputation: 0
Sir, these commands dont work.

Command not found error is shown
 
Old 12-16-2010, 06:19 AM   #10
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
You do not need sudo with centos, su - and a password to become root.

If you are doing this to learn then undo what you have done.

If that does not work then reinstall, you have missed a step or need to use a live cd to repair.

Last edited by Larry Webb; 12-16-2010 at 06:21 AM.
 
Old 12-16-2010, 07:14 AM   #11
noony123
Member
 
Registered: Oct 2010
Posts: 167

Original Poster
Rep: Reputation: 0
Yes sir, i did above commands without sudo since i was logged in as root

I didnt get your second part, kindly guide me, what i missed ?

I downloaded grub 1.98 from a site and simply installed as was told. Kindly guide me what shall i do ? i have vmware image of my machine in which grub 0.97 was installed, so what shall i do now ?
 
Old 12-16-2010, 07:17 AM   #12
noony123
Member
 
Registered: Oct 2010
Posts: 167

Original Poster
Rep: Reputation: 0
If you think that i havent installed grub properly then kindly guide me how to install grub1.98 on centos ? will installing it solve my issue ?

So am i right in my assumption that 1.98 can indeed access lvm partition ?
 
Old 12-16-2010, 07:34 AM   #13
noony123
Member
 
Registered: Oct 2010
Posts: 167

Original Poster
Rep: Reputation: 0
I just need a little guidance as what shall i do. I will be grateful for generous replies.

Thanks in advance
 
Old 12-16-2010, 08:19 AM   #14
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 noony123 View Post
I didnt get your second part, kindly guide me, what i missed ?
Take a live cd and from terminal mount your centos distro and put the files you moved back where they were. You should not need grub2.

Last edited by Larry Webb; 12-16-2010 at 08:20 AM.
 
Old 12-16-2010, 08:51 AM   #15
noony123
Member
 
Registered: Oct 2010
Posts: 167

Original Poster
Rep: Reputation: 0
Dear Sir,

I mentioned above that due to knowledge gain, i dont want to use any live cd approach. I want to solve it as it is. In this exercise i want to learn how should i make grub to load kernel from a non boot partition i.e. lvm partition.

Kindly guide me
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Unable to boot into GRUB loader: GRUB command shell boots up: urgent issue wombat53 Linux - Software 9 09-04-2009 06:20 AM
GRUB issue Ubuntu213 Linux - Newbie 4 02-13-2009 03:15 PM
Grub Issue rvijay Linux - Newbie 3 09-23-2006 02:07 PM
Grub Issue BittaBrotha Linspire/Freespire 2 09-03-2005 08:38 PM
Grub Issue david_harvard Linux - Newbie 2 06-09-2004 01:59 AM


All times are GMT -5. The time now is 01:29 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration