suggestion for clarification in Linux wiki article

#1
In the wiki article about Linux, there is a section detailing how to use the grub command line to install the grub bootloader to the partition. However, it's a little misleading in that it starts off by saying:

find /boot/grub/stage1

It'll return a (hdx,y) value you can use to setup GRUB.

You also have a nice table documenting linux device names:

(hd0,0) first primary partition on first hard disk
(hd0,1) second primary partition
(hd0,2) third primary partition
(hd0,3) fourth primary partition (usually an extended partition)
(hd0,4) first logical partition
(hd0,5) second logical partition

Then goes on later to say,

Once you've got that value, type this in, substituting (hdx,y) for the output of the previous command.

root (hdx,y)
setup (hdx,y)
setup (hdx,y)
quit

What it fails to mention is that the x,y you use in the root command come from the output of the find command, whereas the x,y you use in the setup command relate to the partition where you wish to install grub, and those numbers should come from the table.

The fact that you use x,y in both cases is what's confusing.

Hope this helps someone!
 
#2
What it fails to mention is that the x,y you use in the root command come from the output of the find command, whereas the x,y you use in the setup command relate to the partition where you wish to install grub, and those numbers should come from the table.

The fact that you use x,y in both cases is what's confusing.

Hope this helps someone!
Hi tastewar. The root and setup commands both use the same (hdx,y) location found by the find command, i.e. say if the location was (hd0,0), the first hard drive, first partition, you would enter that in both commands, not just the root...:wink: X = the hard drive or disk, and Y = the partition.

-Coolname007
 
Last edited:
#3
I'm guessing that when you tested this, you did it from an actual Linux install, rather than from a LiveCD, which is what the tutorial is referring to. In my case, I am using a Live Ubuntu USB key, and the find command will return the address of the USB key (hd1,0). It doesn't do me any good to do setup to the USB key.

My understanding of all this is that the find command will tell you what device the /boot files are on; the root command tells grub where to acquire the stage1 file et al; and the setup command tells grub what device to target for the install. Doesn't it make sense that these should be different in a LiveCD scenario?
 

JustinW

Super Moderator
Staff member
#4
Yes, if its pointing to your flash drive than you'll need to give it the correct location for your hard drive instead... (hd0,0) for example.
 
#5
I'm guessing that when you tested this, you did it from an actual Linux install, rather than from a LiveCD, which is what the tutorial is referring to. In my case, I am using a Live Ubuntu USB key, and the find command will return the address of the USB key (hd1,0). It doesn't do me any good to do setup to the USB key.
No, actually I did do it from a LiveCD when I used those commands. The "find" command returned for me the location of my Ubuntu install, which happened to be (hd0,3). :wink: And then the "root" and "setup" commands setup Grub on the partition. As long as you have a partial install of Grub to the partition (happens even when you install Grub to the MBR; only a small portion of Grub is installed to the MBR...the rest gets installed to the root partition inside the "Boot" folder), then the "find" command will locate the "stage1" file for you. If you happen to have multiple files with that name on your system, then the "find" will locate all of them for you. Then it is up to you to figure out which one is where you need to install Grub to.
My understanding of all this is that the find command will tell you what device the /boot files are on; the root command tells grub where to acquire the stage1 file et al; and the setup command tells grub what device to target for the install. Doesn't it make sense that these should be different in a LiveCD scenario?
No, it makes no difference in a LiveCD scenario, because there is no "stage1" file on the CD. The "root" command tells Grub its files are at the location you specify (in my example, it was (hd0,3), and the "setup" command tells Grub to setup at the location you specify ( (hd0,3), in my case ). Now when you're using a USB stick to boot Ubuntu from, I imagine there would be a "stage1" file on it. That is why it found the location of your flash drive instead of the partition Ubuntu was installed to. Grub in your case was not installed at all to the root partition, and that explains why the "find" command did not find any "stage1" file on it. But in most normal cases, there would be a "stage1" file to find on the root partition, so those commands would work to install Grub to the partition.

-Coolname007
 
#6
Thanks for the clarification. I guess I burned myself by not installing GRUB at all in the first place; then in my troubleshooting I copied some other /boot files over to the live USB stick, and that's why they were found there. Sorry for adding to the confusion.
 
#7
Thanks for the clarification. I guess I burned myself by not installing GRUB at all in the first place; then in my troubleshooting I copied some other /boot files over to the live USB stick, and that's why they were found there. Sorry for adding to the confusion.
Ok...so now I'm curious. :smile: How exactly did you manage to install Ubuntu in the first place without installing Grub at all, and more importantly, if you copied /boot files over to the Live USB stick, which ones did you copy, and where did you copy them from? :brows:

-Coolname007
 
#8
At the last install step, where you can say where to install grub, you can also tell it not to. I thought I was being clever, since I had the Windows bootloader all set, and I hadn't read your wiki instructions.

I got the /boot files from another working install.
 
#9
Ok, it all makes sense now. :smile:
Thanks.

-Coolname007