GRUB / boot easy problems w / USB stick

Fred Davidson fredbsdavidson at yahoo.com
Sat Jun 2 18:55:22 UTC 2007


********************************************************
I am looking for some help to enable booting from a
USB      stick.  After weeks of reading, and
attempting I am at a total loss.  This all began while
I was trying to follow the many excellent tutorials on
encrypting whole laptop disks with GELI[1].  These
tutorials were great except they didn't really cover
how to make the sticks bootable.  Here is some of the
many things I have tried.

Background: My laptop BIOS allows me to pick the boot
order from 7 devices, I set them as follows:

(1) USB Key (2) USB HDD (3) USB CDROM (4) USB FDC 
(5) IDE CD  (6) IDE HDD (7) PCI BEV

Attempt 1: FreeBSD Boot Manager

# created a dedicated slice on my 512MB stick with a
#UFS2 filesystem.  

(after fdisk)
bsdlabel -Brw /dev/da0s1
newfs /dev/da0s1

# Copied over boot files to usb filesystem.

mount /dev/da0s1 /usb
mkdir /usb/boot
cd /boot
cp -Rpv * /usb/boot

# Placed FreeBSD boot manager on MBR of USB stick.

boot0cfg -B -s 1 -t -v 182 /dev/da0

Problem:  When I reboot the laptop keyboard won't
allow me to select a partition with the F keys.


Attempt 2: GRUB

# make install grub from the ports collection.  copy
#over the files from
#/usr/local/share/grub/i386-freebsd/* to /boot/grub.  
 #My understanding was that Grub can read write UFS2
#because of patches since version 0.94.  So on my
first #attempt I made a single UFS2 partition.    
  
mount /dev/da0s1 /usb
mkdir -p /usb/boot/grub
cd /boot
cp -Rpv * /usb/boot
cd /boot/grub
cp -Rpv * /usb/boot/grub


#I invoke the grub shell.  There are two devices in my
#device map:

(hd0) /dev/ad0
(hd1) /dev/da0

# Now if I try to set root in the following ways I'll
#get the following:

grub> root (hd0,0,a)

Filesystem type is ufs2, partition type 0xa5

grub> root (hd1,0)

Filesystem type is unknown, partition type 0xa5

# now before you say it, I also tried (hd1,0,a) but
#this is even worse in some situations. Basically I
#can't get grub to read or write to the USB stick with
#a UFS2 filesystem.  Yet it will read write to the 
#UFS2 filesystem of the native disk.  Does anyone know
#why? I have tried grub-install which apparently is
#successful, but once I attempt to reboot, it hangs
#with the word, "GRUB" printed.

Attempt 3: Chainloading GRUB

#This time I though I had it.  I created S1 FAT
#partition and S2 UFS2 partition on the stick.  I 
# was able to use setup from the grub shell to setup 
#the FAT slice as the location for stage2.  On the  
#ufs2 partition I set up the proper /boot setup above.
#I read on an old post and someone mentioned that     
#boot2 does "something stupid," and won't work with  a
#chainload scenario.  I tried it anyways, and it
didn't #work.  I had heard that it might work if you
bounce  
#boot0 to the beginning of the slice instead of the 
#disk MBR so I did.

boot0cfg -B -s 2 -t 182 -v /dev/da0s2

#seemed to go well.  I rebooted, and got as far as 
#the F key menu, but again nothing worked, and I
#couldn't boot.  Just to add, I also tried the whole
booting FreeBSD from a FAT partition but that just
plain doesn't work [2].  

Well that's where I am.  I can't tell you how much you
will rock my world if you can show me how to fix this.
 These are some ideas I have, but don't know enough to
do anything about:

(1) BIOS issues; from what I understand each computer
manufacturer takes a base bios (phoenix in my case)
and proprietories it up.  I'm dreading that maybe my  
 
BIOS will prevent any of this from working. Doesn't
seem to be documentation anywhere on my manufac's
site.

(2) Bootblocks; Maybe there's some easy modifications
or config files for boot blocks I don't know about?  
Maybe there are some alternatives?

(3) GRUB patches; I've been downloading ports from
another PC (no network yet)burning to CD, then  
making.  done it twice now.  Is there some wonderful
patch to GRUB that makes it work with FreeBSD I don't
know about?  Do any of you have it working? if so , 
can I copy how you built exactly?

Alright, that's all.  I'm sorry for the length of this
post, it's my first one, and I have seriously dredged
pretty hard on my own for a solution.  Thanks again.

Fred         








[1]
<http://www.proportion.ch/index.php?page=31>
<http://www.daimi.au.dk/~u063592/>
<http://www.bsdforums.org/forums/showthread.php?threadid=43796>


[2]
<http://docs.FreeBSD.org/cgi/mid.cgi?20020111103159.A46044>



       
____________________________________________________________________________________
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more. 
http://mobile.yahoo.com/go?refer=1GNXIC



More information about the freebsd-questions mailing list