LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   locate grub (https://www.linuxquestions.org/questions/linux-newbie-8/locate-grub-750114/)

wakatana 08-25-2009 09:16 AM

locate grub
 
Hi all, i am reading about USB bootable and it points me to grub in tutorial is issued command:
grub
grub> find /boot/grub/stage1

but it gives me: Error 15: File not found


i do not have any problems with grub, i can choose between M$ and Linux while boot

so when i issue:
sudo fdisk -l
i see which partition is bootable (sda1)
i have multiple partitons
sda1, sda2, sda3, sda4

sda1 windows
sda2 linux
sda3 swap
sda4 ntfs

so my question: how can i know where is grub installed ?
I found on net that is in directory /boot/grub/stage1 (sda2 in my case)
but why I have bootable sda1 ?? can anyody explain that ?

another question: I found grub can be installed on a partition
Code:

grub> setup (hd0,0)
or on a MBR
Code:

grub> setup (hd0)
. How can i know where is ?

last question: can i issue i think in my case command:
Code:

grub> root (hd0,1)
(sould be sda2 where i expecting grub) and then command:
Code:

grub> find /boot/grub/stage1
should gives output ?

realy last question: I create bootalbe usb with unetbootin which uses syslinux, is possible to boot M$ located on HDD throught that ? Thanks a lot

wakatana 08-25-2009 09:31 AM

Seems that i answer 2nd question
Code:

sudo dd if=/dev/sda bs=512 count=1 | od -a | grep G
gives me GRUB but
Code:

sudo dd if=/dev/sda1 bs=512 count=1 | od -a | grep G
did not gives nothing

wakatana 08-25-2009 10:46 AM

I thing I ve found solution so
/boot/grub/ contains grub files that are too big to store in MBR so they have to be located somewhere in hdd.

Code:

grub> root(hd0,0)
now works i forget sudo :rolleyes:

but still i would know if is possible from unetbootin created USB boot directly to harddisk partition (i dont want to press ctrl alt del)

Larry Webb 08-25-2009 10:52 AM

I hope this article can help you. There are three stages of grub. Here is a tutorial on grub that I read four or five times and still refer back to. I suggest starting at the 'Technical details' for the answers and details for your questions.


http://www.justlinux.com/forum/showt...hreadid=147959

Here is another article by the same man that is shorter

http://www.justlinux.com/forum/showthread.php?t=144294

To answer your question yes you can boot usb with grub easy if usb can be booted by m/b bios.

wakatana 08-25-2009 03:18 PM

Thank you for reply i will check links.
I know it is possible boot from USB if mb support it but i read http://www.slax.org/forum.php?action...03#postid45603 and there are troubles using syslinux (Used by unetbootin) they recomend GRUB.
So I decided to install on USB GRUB and DSL linux according to another tutorial http://www.freesoftwaremagazine.com/...tro?page=0%2C0. this boot DSL but just in very "simple" version I must do something wrong...
OK what I am trying to say... When I have booted my USB with GRUB I press 'c' so i can type commands. So if syntax would be strange I am sorry I do not have grub menu now :).
I wanted to to view my grub menu, so i type:
Code:

grub> cat (hd1,1)/boot/grub/menu.lst
OK that is fine, I noticed something like
Code:

/boot/vmlinuz-2.6.28-13-generic
so i decided to do some experiments I typed:
Code:

grub> kernel (hd1,1)/boot/vmlinuz-2.6.28-13-generic
and then I type
Code:

boot
I expected that will boot my system normaly from hard drive, but it started and then writes something like Kernel Panic and computer automaticaly shuted down.
Maybe i know where I had mistake in
Code:

menu.lst
also was "options" uuid and initrd but i did not use them during boot.
So I booted system normaly (without my created USB) and typed
Code:

dmesg
to see what happened but i did not see anything about kernel panic. So where is this info stored ? And Why system did not boot correctly if I do that ? And last question I would like to add to unetbootin USB some features to menu (another distro, boot from first partiton) ist this possible ? Thanks a lot

Larry Webb 08-25-2009 06:27 PM

I have read your last post and do not understand exactly what you want. It would appear you only have a grub shell or are you operating grub from a cd?

wakatana 08-26-2009 04:02 AM

1 I made my live USB vith GRUB.
2 I rebooted system with this plugged USB.
3 So after reboot I had the GRUB menu of my live USB.
4 That GRUB havent option to boot from hard disk (I did not added to menu.lst because i dont know how, if you know please help)
5 I entered to GRUB command console (press 'c')
6 I wanted to boot normaly system from HDD (as is done by GRUB on my HDD)
7 So i tried
Code:

grub> kernel (hd1,1)/boot/vmlinuz-2.6.28-13-generic
8 Instead of booting my linux from HDD it gives me Kernel Panic and I cannot find anything about that in logs.
9 Why system did not boot correctly ?
10 Can you advise me goot tutorial for creating USB live?
11 I wanted to add some more options (other distro, boot directly from HDD...) to unetbootin live USB but it used syslinux and found is better to use GRUB on USB do you agree with that ?

Larry Webb 08-26-2009 07:40 AM

You have not given us a copy of your fdisk -l so I will assume your usb has one partition and your grub menu.lst should be (hd1,0).

With the grub shell try the following

grub>
root (hd1,0)
setup (hd1)
exit

Then in your grub menu.lst add the following

title Linux
root (hd1,0)
chainloader +1

wakatana 08-31-2009 02:39 AM

I am sorry i have not internet and now i am not in front of my PC. I post fdisk -l as soon as possible

wakatana 10-08-2009 05:22 PM

I am sorry that takes a long time, early I forgot that I created this thread, so output is

sudo fdisk -l
[sudo] password for marek:

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x3c2e1ae8

Device Boot Start End Blocks Id System
/dev/sda1 * 1 2547 20458746 7 HPFS/NTFS
/dev/sda2 8530 9623 8787555 83 Linux
/dev/sda3 9624 9729 851445 82 Linux swap / Solaris
/dev/sda4 2548 8529 48050415 7 HPFS/NTFS

Partition table entries are not in disk order

Larry Webb 10-08-2009 06:54 PM

Did you have your usb plugged in when you ran fdisk -l? If you did your usb is not bootable.

saikee 10-08-2009 07:13 PM

I think it is relevant to point out that not all Linux has been arranged to be bootable from a USB device. A ram disk file "initrd" needs to conatin drivers for the USB to load at the right time for the kernel access but that is not univesally done by distros. Therefore many Linux distros boot but only to a panic stage if installed in a USB device. I suspect the slower speed of the USB access has something to do with it too.

Partition (hd0,0) is the first partition of the first hard disk.

device (hd0) is the whole of the hard disk and that usually means the MBR. The MBR full length is actually 512 x 63 = 32256 bytes but the Bios only reads the first sector of 512 bytes. (hd0,0) starts from the end of 32256 bytes. Therefore (hd0) and (hd0,0) are physically two different locations of a hard disk.

wakatana 10-09-2009 12:35 AM

Quote:

Originally Posted by Larry Webb (Post 3712814)
Did you have your usb plugged in when you ran fdisk -l? If you did your usb is not bootable.

USB must be bootable because i createt bootable USB with software unet bootin. I havent it plugged during fdisk -l

saikee 10-09-2009 02:52 AM

wakatana,

The acid test is before you fire up a Linux press the "c" key and drop into a Grub prompt then type
Code:

geometry (hd0)
geometry (hd1)
geometry (hd2)

etc to exhaust all the disks

If Grub reports your (hd0) is the USB drive then you got it. Grub works on the disk order hands by the Bios. So get it from the horse's mouth!

It may surprises you that being a boot loader and has no driver to read a USB port how the hell can Grub boot a USB drive? The answer is Bios forces this arrangement and not Grub.


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