A bright idea...

Phil Meyer pmeyer at themeyerfarm.com
Mon Jun 25 17:21:30 UTC 2007


Les Mikesell wrote:
> Phil Meyer wrote:
>>>
>>>    Why not buy a 4 GB Flash USB device for around $50.00 and load F7 
>>> on that and then plug it into the USB port of the computer to 
>>> upgrade and away you go. Cheaper than a DVD drive with a USB port :-)
>>>
>>
>> Yup.  My normal mode of operations.  I carry around a 4GB USB thumb 
>> drive with two partitions:  1 = boot ; 2 = FAT32 with a custom (pungi 
>> rocks!) DVD image on it.
>
> Is there a howto somewhere about the partitioning needed for this? Or 
> is it just a matter of making the first partition large enough for a 
> raw copy of the boot.img file, then reformatting what's left?  Can you 
> specify a kickstart file on the 2nd partition?  How do you know where 
> it will be mounted?

Two major issues there.
First one was a trial and error on my part getting the first partition 
just the right size.  It ends up being 13MB, even though the actual 
image is 7MB.  This partion needs to be bootable.

The second issue is kickstart files.  My original requirements were to 
allow a level one tech to install our custom distro on a truck (small 
embedded computer) in the field.  I could not depend upon any resources 
other than the thumb drive.  Here is what I learned:

1.  The USB driver NEVER loads in time to utilize a kickstart file on 
the second partiton, including the DVD iso image.  In fact, the iso gets 
mounted AFTER the kickstart request.

2.  The USB driver SELDOM (varies widely based upon hardware) loads in 
time to totally prevent operator intervention -- the operator has to 
answer the askmethod dialog, and has to wait 5-10 seconds before doing so.

3.  The only reliable method for using kickstart files from a USB thumb 
drive, is to put them inside the initrd image on the boot partition.

This is not such a simple task.

4. If you boot from a USB thumb drive, grub will ASSUME that you want 
this drive as the bootable drive and will stomp on the MBR of the thumb 
drive.  To prevent this, you must have a driveorder argument on your 
bootloader line.  ie:

#System bootloader configuration
bootloader --driveorder=sda,sdb --location=mbr

None of these issues matter with an internal or external DVD, simply 
because the ISO is mounted at boot time.


>
>> So last week-end my son asks me to build him a media server.  I 
>> travel to his place because I want to see my grand babies.  No 
>> sweat.  I pop out my thumb drive -- hmmm... won't boot usb.  OK -- 
>> hmmm... can't burn a DVD for him, he doesn't have a DVD in that 
>> system.  OK, mount the DVD image on my laptop and burn the 
>> diskboot.iso to a CDR.  Plug in the USB to his system, boot the 
>> bootable CD and proceed to load from the USB stick via my custom 
>> kickstart scripts.
>>
>> Whew!
>>
>> The moral of the story?
>>
>> Not all systems will boot from USB, and not all systems have DVD 
>> players. :)  Keep a CDR in your laptop bag.
>
> You could also export the dvd image via NFS from the laptop and 
> install over the network.
>

Yes, and I could access my kickstart file over the net as well (which I 
did) but I wanted to install it stand-alone in this instance because we 
were doing some other network oriented maintenance.

As for a How To:  Another son of mine and I are currently working one up. 

He is smarter than I am, so if I can get him 'into' following up on a 
project of mine, he always finds my 'holes'.  The trick is to get him on 
board with one of my interests.  He asked me over this last weekend how 
to do this very thing, so we have his attention now.  A How To should 
result, soonish.

I will post a link to it when its up.

If the kiskstart file in in the initrd image:

ks=file:/dir/kickstart.cfg

If the kickstart file is in the DVD iso:

ks=CDROM:/dir/kickstart.cfg

If the kickstart file is on the second partition of the thumb drive (not 
in the iso):

ks=hd:sdb2:/dir/kickstart.cfg

To add kickstart files to the initrd of the boot partition:

This is based upon a pungi build, and the names will vary depending upon 
how you do things, but it may be useful.  Don't do these commands unless 
you know for sure ...

ASSUMPTIONS:

Thumb drive is /dev/sdc

---cut---
#!/bin/sh

KS="/var/www/html/ks"

dd if=/srv/pungi/F7Developer/7/Custom/i386/os/images/diskboot.img 
of=/dev/sdc1

mount /dev/sdc1 /mnt

rm -fr /tmp/img
mkdir /tmp/img
cd /tmp/img
gunzip -dc /mnt/initrd.img | cpio -icvdmu

# Copy kickstart files
# adjust below as needed (not everyone uses .ks extiention)
mkdir ks
cp ${KS}/*.ks ks
cp ${KS}/home* ks

# Now put the initrd.img back
find . |cpio --quiet -c -o |gzip -9 > ../initrd.img
cp ../initrd.img /mnt
cd
# rm -fr /tmp/img
umount /mnt

# Copy the DVD image to partition 2
mount /dev/sdc2 /mnt
cp /srv/pungi/F7Developer/7/Custom/i386/iso/F-7-i386-DVD.iso /mnt
umount /mnt

sync
sleep 2
---cut---

Here is my home.usb kickstart file -- you will need your own root password:

---cut ---
#Debug
# autostep
#System  language
lang en_US.UTF-8
#System keyboard
keyboard us
#Sytem timezone
timezone America/Denver
#Root password
rootpw --iscrypted $1$VKHcK4TU$Z12345BuA4/0q2b6xH7br/
#Reboot after installation
# reboot
#Install OS instead of upgrade
install
#Network
network --bootproto=dhcp --hostname=developer
#Use USB disk
harddrive --dir=/ --partition=sdb2
#System bootloader configuration
bootloader --driveorder=sda,sdb --location=mbr
#Clear the Master Boot Record
zerombr
#Partition clearing information
clearpart --drives=sda --all --initlabel
#Disk partitioning information
part /boot --fstype ext3 --size 100 --ondisk=sda
part swap --size 2000 --ondisk=sda
part / --fstype ext3 --size 1000 --grow --ondisk=sda

#System authorization infomation
auth  --useshadow  --enablemd5
#Firewall configuration
firewall --enabled --ssh
selinux --permissive
#
#Package install information
%packages

@ base
@ gnome-desktop
@ kde-desktop
@ base-x
@ editors
@ engineering-and-scientific
@ graphical-internet
@ text-internet
@ office
@ sound-and-video
@ graphics
@ games
@ authoring-and-publishing
@ development-tools
@ development-libs
@ x-software-development
@ gnome-software-development
@ kde-software-development
@ admin-tools
@ system-tools
@ printing
@ eclipse
@ java
@ java-development
@ mysql
@ ruby
@ legacy-software-development
@ other
tomcat5-admin-webapps
imlib
-julie

%post

cd /

# Set Up Applications for install from custom fjks package
mkdir /tmp/local
mv /ks/jdk*.rpm /tmp/local
mv /ks/livna*.rpm /tmp/local
mv /ks/phil*.rpm /tmp/local
mv /ks/codecs.tgz /tmp
mv /ks/fix_host /tmp

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
rpm --import /ks/freshrpms-RPM-GPG-KEY.txt

ln -s /usr/java/jdk1.5.0_09/jre/plugin/i386/ns7/libjavaplugin_oji.so 
/usr/lib/mozilla/plugins/
tar xzPf /tmp/codecs.tgz

cat << _LOCAL > /tmp/S99Local_install
#!/bin/sh
# install local apps
echo "Installing Local Applications"
rpm -ihv /tmp/local/*.rpm
echo "Running depmod"
/sbin/depmod

exit 0
_LOCAL

chmod 755 /tmp/S99Local_install

cat << _EOF >> /etc/rc.local
# install Local Applications on first boot and run modem_check
if [ -f /tmp/S99Local_install ]
        then
        /tmp/S99Local_install
        mv /tmp/S99Local_install /tmp/S99Local-installed
fi
_EOF
#



# fix sshd_config
ed /etc/ssh/sshd_config << _EOF
/#Protocol 2,1
a
Protocol 2
.
/#PermitRootLogin
a
PermitRootLogin no
.
w
q
_EOF

# set run level to 5
ed <<_EOF /etc/inittab
/:initdefault:/
s/id:.:initdefault:/id:5:initdefault:/
w
q
_EOF

# set java alternatives
rm /var/lib/alternatives/java
/usr/sbin/alternatives --install /usr/bin/java java 
/usr/lib/jvm/jre-1.4.2-gcj/bin/java 1
/usr/sbin/alternatives --install /usr/bin/java java 
/usr/java/jdk1.5.0_09/bin/java 2
/usr/sbin/alternatives --install /usr/bin/javac javac 
/usr/lib/jvm/jre-1.4.2-gcj/bin/javac 1
/usr/sbin/alternatives --install /usr/bin/javac javac 
/usr/java/jdk1.5.0_09/bin/javac 2

# turn services on/off
chkconfig autofs off
chkconfig bluetooth off
chkconfig sendmail off
chkconfig isdn off
---cut---


Good luck!




More information about the fedora-list mailing list