Howto Install Trixbox 2.2 from a USB Flash Drive

Howto Install Trixbox 2.2 from a USB Flash Drive
--------------------------------------------

The Summary of the Entire Process is:

1. Install new MBR (Master Boot Record) onto the Flash
2. Create 2 Partitions on the Flash Drive, one for the diskboot.img image and the other for the Trixbox ISO file.
3. Boot the target system with the USB Drive
4. When asked where the install media is, point it to the second partition on the flash.
5. The Install Process will begin.

Requirements:

1. At least a 1GB USB Flash Drive
2. A working Linux Box that can load the Flash Drive so you can format it and install the images.
3. The target system BIOS must be able to Boot from USB Device

Detailed Instructions:

1. Copy the trixbox-2.2.12.iso file onto your working Linux system into /tmp.

cd /tmp

Make a temporary directory

	
mkdir trixbox

Mount the ISO Image into that temporary directory so that you can extract the diskboot.img file

mount -o loop -t iso9660 /tmp/trixbox-2.2.12.iso /tmp/trixbox
cd /tmp/trixbox/images
[root@wailea images]# ls -al
total 120967
drwxr-xr-x  4 root root     2048 Dec 27 20:20 .
drwxr-xr-x  7 root root     2048 Dec 27 20:22 ..
-rw-r--r--  1 root root  7610368 Dec 27 20:11 boot.iso
-rw-r--r--  1 root root 12582912 Dec 27 20:11 diskboot.img
-rw-r--r--  1 root root 35532800 Dec 27 20:16 minstg2.img
drwxr-xr-x  2 root root     2048 Dec 27 20:11 pxeboot
-rw-r--r--  1 root root      651 Dec 27 20:10 README
-rw-r--r--  1 root root 68132864 Dec 27 20:20 stage2.img
-r--r--r--  1 root root     1541 Dec 27 20:22 TRANS.TBL
drwxr-xr-x  2 root root     2048 Dec 27 20:12 xen

The file we are interested in is diskboot.img. It is designed to be installed in a
USB Flash Drive and enables us to boot the operating system.

2. Now we must install a new MBR (Master Boot Record) in the flash drive. We can use the ms-sys program for this which can be found at http://ms-sys.sourceforge.net/
Insert the USB Flash Drive into the working Linux box and determine the device name it loads under.

[root@wailea images]# dmesg | grep 'SCSI device'
SCSI device sda: 2013184 512-byte hdwr sectors (1031 MB)

In this case it is loaded as /dev/sda
Now use the ms-sys program with the ‘-s’ option to install the MBR (ms-sys -s /dev/sdX)

[root@wailea images]# ms-sys -s /dev/sda
Public domain syslinux master boot record successfully written to /dev/sda

3. You are now ready to make the 2 partitions.
Use fdisk (on that same Linux Box) to create two partitions on the Flash drive.
The first one should be 13 MB, and the other one should occupy the rest of the space.

[root@wailea images]# fdisk /dev/sda

{use ‘p’ to print the partition table and then ‘d’ to delete existing partitions}

Command (m for help): p

Disk /dev/sda: 1030 MB, 1030750208 bytes
32 heads, 62 sectors/track, 1014 cylinders
Units = cylinders of 1984 * 512 = 1015808 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          14       13857    e  W95 FAT16 (LBA)
/dev/sda2              15        1014      992000    c  W95 FAT32 (LBA)

Command (m for help): d
Partition number (1-4): 1

Command (m for help): d
Selected partition 2

{then use ‘n’ to add 2 new partitions, the first one 13M and the second one with the rest of the space}

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1014, default 1): 
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1014, default 1014): +13M

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (15-1014, default 15): 
Using default value 15
Last cylinder or +size or +sizeM or +sizeK (15-1014, default 1014): 
Using default value 1014

{Now use ‘t’ to change the partition type, the first 13MB partition must be type "e W95 FAT16 (LBA)" and the second, where the Trixbox ISO image will be located must be type "c W95 FAT32 (LBA)}

Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): e
Changed system type of partition 1 to e (W95 FAT16 (LBA))

Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): c
Changed system type of partition 2 to c (W95 FAT32 (LBA))

Command (m for help): p

Disk /dev/sda: 1030 MB, 1030750208 bytes
32 heads, 62 sectors/track, 1014 cylinders
Units = cylinders of 1984 * 512 = 1015808 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1          14       13857    e  W95 FAT16 (LBA)
/dev/sda2              15        1014      992000    c  W95 FAT32 (LBA)

{finally use 'a' to make 1st parition bootable}

Command (m for help): a
Partition number (1-4): 1

Command (m for help): p

Disk /dev/sda: 1030 MB, 1030750208 bytes
32 heads, 62 sectors/track, 1014 cylinders
Units = cylinders of 1984 * 512 = 1015808 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          14       13857    e  W95 FAT16 (LBA)
/dev/sda2              15        1014      992000    c  W95 FAT32 (LBA)

{confirm there is a star under the Boot Column for the fist partition, that means its bootable}
{write the new partition table with ‘w’ and exit}

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.

4. Remember the diskboot.img file, now we will need it.
'dd' the bootdisk.img to the first partition and it will be bootable.

[root@wailea images]# dd if=/tmp/trixbox/images/diskboot.img of=/dev/sda1
24576+0 records in
24576+0 records out

5. Format the second partition as FAT32

[root@wailea images]# mkfs -t vfat -F 32 /dev/sda2
mkfs.vfat 2.8 (28 Feb 2001)

6. Mount the Filesystem into temporary directory /tmp/flash

[root@wailea images]# mkdir /tmp/flash
[root@wailea images]# mount /dev/sda2 /tmp/flash

7. Copy the Trixbox ISO File into /tmp/flash.

[root@wailea tmp]# cp /tmp/trixbox-2.2.12.iso /tmp/flash

8. Copy the ks.cfg (Kickstart file) and trixbox.tar.gz into /tmp/flash. You will thus be saving it to the second partition on the flash for later access.

[root@wailea tmp]# cp /tmp/trixbox/ks.cfg /tmp/flash
[root@wailea tmp]# cp /tmp/trixbox/trixbox.tar.gz /tmp/flash

9. Convert it to Unix Format

[root@wailea tmp]# cd /tmp/flash
[root@wailea flash]# dos2unix ks.cfg
dos2unix: converting file ks.cfg to UNIX format ...

10. The ks.cfg file contains all the directives needed to install the trixbox components. Without it you will end up just installing plain CentOS. You will need to edit the file and make appropiate changes to eliminate all references to the cdrom.
remove these lines:

# CDROM Based Installation
cdrom

change line ‘mount /tmp/cdrom /mnt/source’ to:

mount /dev/sda2 /mnt/source

change line ‘clearpart --all –initlabel’ to:

clearpart --drives=hda --all –initlabel  #do not clear partitions on flash

11. Unmount the Partition and remove the USB Drive

[root@wailea tmp]# umount /tmp/flash

12. Insert the Drive into the Target Machine where you want to install Trixbox.

13. Follow the instructions. You will not see the usual Trixbox splash screen. You will see the default CentOS screen. At the boot prompt you must indicate where the kickstart file is. You do that with the following command. Substitute ‘sda2’ for whatever the path of your second partition is on the flash.

linux ks=hd:sda2:/ks.cfg

If you get a message later saying that it did not find the file. Just wait a few seconds and retry. It sometimes takes a moment to load the Flash Drive.

14. When it asks for the type of media which contains the packages, select ‘Hard drive’. When it asks for the partition and directory that hold the CD images for trixbox, you must select that second partition on the USB Drive. In my test system it loaded as ‘sda2’. You might have to test by trial an error if you have multiple drives. In any case, do not press F2 to ‘configure additional devices’ as this will take you nowhere.

15. When the installation is finished, remove the Flash Drive and let the system reboot from the Hard Drive.

Enjoy!
Ricardo Villa