Another Ubuntu on external drive question
Peter Garrett
peter.garrett at optusnet.com.au
Mon Dec 31 00:05:11 UTC 2007
On Sun, 30 Dec 2007 10:36:41 -0400
Derek Broughton <news at pointerstop.ca> wrote:
> Peter Garrett wrote:
>
> > On Sat, 29 Dec 2007 09:27:49 -0400
> > Derek Broughton <news at pointerstop.ca> wrote:
> >
> >> If I go into grub:
> >> grub> root (<TAB>
> >> the tab-completion shows only hd0 as an option - so grub doesn't see the
> >> drive (the light is on, but apparently nobody's home :-))
> >
> > Grub is a finicky little beast :)
[snipped contents of /boot/grub/ etc.]
>
> That's all there, and device.map =
> (hd0) /dev/sda
> (hd1) /dev/sdb
This could be the problem ? Does the USB drive install even need to know
about other drives? Surely udev, hal etc. pick this up on boot?
>
> > In my case I needed to do:
> > echo "(hd0) $DRIVE" > /mnt/boot/grub/device.map
> >
> > ( DRIVE being the whole target drive of course, à la /dev/hda, /dev/sda
> > etc. and the /mnt is the mountpoint of my chroot, that is, the file
> > system we are installing to.)
>
> Now, part of the problem (for me at least) is that I'm never sure what that
> drive should be - right now, while running off my hard drive (/dev/sda)
> it's /dev/sdc, but on a fresh boot it would be /dev/sdb
Right - I have to confess that I have not done this with a detachable
drive, so I may be off base. As I sent my reply I remember thinking "Wait
a minute, what happens if you have two drives attached?" and so on...
>
> > chroot to the relevant file system, ( sudo chroot /mnt ) and run grub:
> >
> > grub> root (hd0,1)
> > # ( substitute according to your device/partition. Note that hd0 refers
> > # to the $DRIVE that grub is *on* i.e. it doesn't care that the drive
> > # might actually be /dev/sdb from your viewpoint, or whatever)
>
> That's never made any sense to me. Surely, hd0 points to whatever drive the
> device.map file calls hd0 - and if we are actually booting direct from the
> USB (rather than chaining to the USB from the grub on the internal drive),
> I have no idea what the device map should contain - should the external
> drive be /dev/sda?
This is the thorny question... I don't know. I think, as you say, that if
you are chain loading you can just put grub on the root partition and off
you go - but for a direct boot the device would need grub on its MBR,
wouldn't it? Hence the device map is relative to the chroot - the chroot
has no idea that the internal drive exists, at least until it boots, at
which point I would expect /dev/ to be populated, and to show the internal
drive(s) with, for example, fdisk -l from the booted USB drive ( in a
similar manner to the way a live CD works).
Assumption: on boot, the system sees the USB device as the first (and only)
USB device, thus /dev/sda
Hence, if you run grub from a chroot *in* the USB device, the only entry in
device.map would be the (hd0) entry. Another example: I am testing my
install script using a qemu image. My device.map in that image contains
only (hd0) /dev/hda . Grub finds the root partition, specified in
this case as (hd0,1) during the setup of grub. So, I'm guessing that
(hd0) /dev/sda should be the only entry in yours....
in /boot/grub/menu.lst on the USB device's root partition. (note that I
say "I'm guessing" )
Snippets from my script, with wry comments, are attached
[ snippets.grub.derek.txt ]
Actually, all this would probably be easier with isolinux instead of
grub...
>
> > grub> setup (hd0) # this blats the MBR on $DRIVE - you have been
> > warned. Adjust as needed. grub> quit
> >
> > Hopefully, now that grub has a device.map that makes sense, this will
> > work... you may see some "non-fatal" errors.
>
> Ah well, off to try another boot...
>
> > If the above incantations work, you should now have a working grub, and it
> > should boot... I suggest sacrificing a goat and a chicken at the full moon
> > at about this point...
>
> Damn, Peter, I should have asked this a week ago - it's going to be a while
> to the next full moon!
Alternatively, you could sacrifice a couple of virgins - but they are
increasingly hard to find ;p
Peter
--
"INX Is Not X" based on Ubuntu 7.04 Live CD: http://inx.maincontent.net
Screenshots slideshow: http://inx.maincontent.net/album/1.png.html
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: snippets.grub.derek.txt
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20071231/909ec572/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20071231/909ec572/attachment.sig>
More information about the ubuntu-users
mailing list