Another Ubuntu on external drive question
Peter Garrett
peter.garrett at optusnet.com.au
Sat Dec 29 14:37:10 UTC 2007
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 :)
I have recently had to give it several kicks to make it recognise a drive
here ( trying to write an install script for my live CD) I am no grub
expert, far from it, so what follows is probably a horrible hack... and
may not even work for you.
Check what is in /boot/grub/ on the drive concerned. It should look
something like this:
default e2fs_stage1_5 installed-version menu.lst
minix_stage1_5 stage1 stage2_eltorito device.map fat_stage1_5
jfs_stage1_5 menu.lst~ reiserfs_stage1_5 stage2 xfs_stage1_5
Most of this is of course superfluous, but note the "device.map". Now if
the dir doesn't contain all of this stuff, (it was pristinely empty here)
you can give grub a kick thus:
(Take /mnt as your mount point in what follows)
sudo cp -a /mnt/usr/lib/grub/i386-pc/* /mnt/boot/grub/
( obviously the "i386" is arch dependent)
Now make sure the device.map actually exists and points at the right drive:
cat /mnt/boot/grub/device.map
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.)
The following may not be necessary, but it can't hurt...
mount --bind /proc /mnt/proc
mount --bind /dev /mnt/dev
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)
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.
If it doesn't appear to work, run around in circles, bash head on keyboard,
tear your hair etc. etc. ad lib. If it looks OK, then, still in the chroot
do
update-grub
This, theoretically, will write a /boot/grub/menu.lst
# (sounds of hollow laughter)
But wait, there's more, as they say... that was not enough - I got an
error 15 on boot. Google led me to some hints that resulted in this: still
in chroot
grub-set-default default
If you have any special parameters, say for "defoptions" ( like vga=791
etc.), then you need to edit /boot/grub/menu.lst now, and then re-run
"update-grub" to make it stick.
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...
Hope this helps, and all those conventional sentiments. All care but no
responsibility etc. etc.
Best of luck... I have more or less the above scripted, and so far it
works here in my install script. ( This is not specifically a usb install
script though, but I imagiine grub doesn't actually care or know)
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 --------------
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/20071230/d2f9c0ff/attachment.sig>
More information about the ubuntu-users
mailing list