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) ? |
I am using the grub version 0.97
|
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. |
First tell us which distro you are trying to boot.
Be patient! |
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. |
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. |
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? |
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? |
Sir, these commands dont work.
Command not found error is shown |
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. |
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 ? |
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 ? |
I just need a little guidance as what shall i do. I will be grateful for generous replies.
Thanks in advance |
Quote:
|
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 |
All times are GMT -5. The time now is 08:00 PM. |