Installing trixbox Pro v2.0 from a USB stick

Ok, so most of the legwork for this blog post was done by Ricardo Villa who posted this article detailing how to install trixbox CE v2.2 from a USB flash drive. I took most of the information below from that article, but made a few tweaks for trixbox Pro. Mad props to Ricardo for his original article.

That being said, the reason for this article is that I had a customer ask me recently about how to reinstall the trixbox Pro ISO on his trixbox Appliance (which has no optical media). He was trying to get it to work, but was crunched for time, and ended up purchasing a USB CDROM to get it installed (which, by the way, is the preferred method of reinstalling trixbox CE or Pro on an Appliance). If, however, you don’t have a USB CDROM, I have figured out the necessary tweaks to Ricardo’s article to get this working with trixbox Pro. Here we go…

The steps to this process is as follows:

1. Install a new MBR (Master Boot Record) onto the USB flash drive.
2. Create 2 partitions on the flash drive, one for booting, and one for the data (trixbox Pro ISO).
3. Configure the BIOS of the Appliance to boot from the USB flash drive primarily.
4. Boot the Appliance with the USB flash drive.
5. Tell Linux where the install media is (partition 2 of the USB flash drive)
6. Install trixbox Pro normally.

Requirements:

1. USB Flash Drive (at least 1GB)
2. A working Linux system that you can use to prepare the USB Flash Drive
3. The target system BIOS must be able to boot from a USB Flash Drive (I’m using the trixbox Appliance which does have this feature, but it should work on any system whose BIOS allows boot from USB HDD or USB Flash Drive)

Prepare the USB Flash Drive:

First, download trixbox Pro. This can be done via the trixbox.com download page. Choose ‘Download, activate or buy a new trixbox Pro server.’ (Choose this even if you already have an existing server).

On the next screen, choose ‘I want to re-download the ISO for an existing trixbox Pro server.’

Click on ‘Download Now’ and save the ISO to your local computer. I’m going to assume you’re not on the Linux ‘prep’ system yet.

Once you have the trixboxPro.iso file saved, we need to get it over to the Linux prep system. The easiest way to do this (from Windows) is to use WinSCP. The setup and install of WinSCP is beyond the scope of this document, but basically, it gives you a Windows Explorer style interface to your Linux system using SSH.

Log onto your prep system and copy the trixboxPro.iso file to the /tmp directory.

Now get to the CLI of your Linux prep system (this can be through an SSH client such as Putty, or directly at the console).

Change directory to /tmp:

cd /tmp

Make a directory so that you can mount the ISO file:

mkdir trixbox

You have now created /tmp/trixbox. Now it’s time to mount the trixboxPro.iso file to the directory we just created:

mount -o loop -t iso9660 /tmp/trixboxPro.iso /tmp/trixbox
cd /tmp/trixbox/images
ls -la

total 11622
dr-xr-xr-x 3 root root 2048 Sep 15 2006 .
drwxr-xr-x 8 root root 4096 Apr 17 00:12 ..
-r–r–r– 1 root root 5599232 Sep 15 2006 boot.iso
-r–r–r– 1 root root 6291456 Sep 15 2006 diskboot.img
dr-xr-xr-x 2 root root 2048 Sep 15 2006 pxeboot
-r–r–r– 1 root root 662 Sep 15 2006 README
-r–r–r– 1 root root 881 Apr 17 00:13 TRANS.TBL

The file that we’re looking for is diskboot.img. It is designed to be installed on a USB Flash Drive and enables you to boot the OS.

Ok…now we have our trixbox Pro ISO downloaded and we can browse the ISO through the Linux CLI. It’s time to get the necessary info over to the USB Flash Drive.

The first thing we need to do is create a Master Boot Record on the USB Flash Drive. For this, we can use a program called ms-sys. Before we can use that program though, we need to download and install it. Do the following from the Linux CLI:

cd /usr/src
wget http://voxel.dl.sourceforge.net/sourceforge/ms-sys/ms-sys-2.1.3.tgz

Version 2.1.3 of ms-sys is the current version as of the writing of this blog post…if there is a different version by the time you are trying this, you’ll have to adjust the wget command to reflect the latest version. You can find the latest version here.

You have now downloaded ms-sys to /usr/src. Let’s extract and install it:

tar -xzvf ms-sys-2.1.3.tgz
cd ms-sys-2.1.3
make
make install

Now that ms-sys has been installed, we need to figure out where our USB Flash Drive is (according to Linux). Linux SATA hard drives are distinguished as sda (drive 1), sdb (drive 2), sdc (drive 3), etc. The partitions on the drives are numbers after the sda, sdb, sdc…so for instance, the 2nd partition of your 3rd drive would be sdc2.

Run the following command to figure out which drive is your USB Flash Drive:

dmesg | grep ‘SCSI device’

You should see output similar to this:

SCSI device sda: 156299375 512-byte hdwr sectors (80025 MB)
SCSI device sdb: 156301488 512-byte hdwr sectors (80026 MB)
SCSI device sdc: 1539583 512-byte hdwr sectors (788 MB)

My Linux prep system has 2 80GB SATA HDD’s, and a 1GB USB Flash Drive. From the output above, we can determine that my flash drive resides at ‘SCSI device sdc.’ Your configuration may differ…if your flash drive appears as a different device ID, substitute that device ID for the remainder of this document.

Now it’s time to write the MBR to the USB Flash Drive:

ms-sys -s /dev/sdc

You should get a message telling you that the MBR was successfully installed on your USB Flash Drive.

Now let’s make 2 partitions. The first partition will be used to boot, and the 2nd partition will be used for the ISO and other data.

fdisk /dev/sdc

Use ‘p’ to print the partition table and then ‘d’ to delete existing partitions:
————————–
Command (m for help): p

Disk /dev/sdc: 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/sdc1 * 1 14 13857 e W95 FAT16 (LBA)
/dev/sdc2 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
——————————
In this example, there are already 2 partitions, and I used ‘d’ to delete them both. If you only have one partition, you won’t be asked which one to delete.

Now use ‘n’ to add 2 new partitions, the first one 13M and the 2nd one the rest of the space on the USB Flash Drive:

——————————-
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’ or ‘W95 FAT16 (LBA).’ The second partition must be type ‘c’ or ‘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/sdc: 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/sdc1 1 14 13857 e W95 FAT16 (LBA)
/dev/sdc2 15 1014 992000 c W95 FAT32 (LBA)

————————–

The last fdisk step is to make the 1st partition bootable with the ‘a’ command:

————————–

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

Command (m for help): p

Disk /dev/sdc: 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/sdc1 * 1 14 13857 e W95 FAT16 (LBA)
/dev/sdc2 15 1014 992000 c W95 FAT32 (LBA)

——————————

Use ‘w’ to write out the new partition table and exit fdisk.

——————————

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.

——————————

Now that our USB Flash Drive is properly partitioned, it is time to start bringing everything together.

First we want to ‘dd’ the diskboot.img file onto the boot partition (partition 1) of the USB Flash Drive:

cd /tmp/trixbox/images
dd if=/tmp/trixbox/images/diskboot.img of=/dev/sdc1

You should see output that is something like this:

24576+0 records in
24576+0 records out

Now, format the 2nd partition of the USB Flash Drive as FAT32:

mkfs -t vfat -F 32 /dev/sdc2

Mount your 2nd partition of the USB Flash drive to a temporary location so that you can copy files to it:

mkdir /tmp/flash
mount /dev/sdc2 /tmp/flash

Copy the ISO file to /tmp/flash:

cp /tmp/trixboxPro.iso /tmp/flash

Copy the ks.cfg file to /tmp/flash:

cp /tmp/trixbox/ks.cfg /tmp/flash

Now we need to bring over the entire /tmp/trixbox/Fonality directory to the 2nd partition of the USB Flash Drive:

cp -rv /tmp/trixbox/Fonality /tmp/flash

At this point, all necessary files are on the USB Flash Drive, but we need to configure those files a bit. First, we want to convert the ks.cfg file to UNIX format:

cd /tmp/flash
dos2unix ks.cfg

The ks.cfg (Kickstart config) file contains all of the directives necessary to install the trixbox components. Without it, you will end up just installing plain ol’ CentOS. You need to edit the file and make appropriate changes to eliminate all references to the CD ROM.

nano -w /tmp/flash/ks.cfg

Fine the line that says:

cdrom

And change it to:

# cdrom

The # comments out this line. Next, find the line that says:

clearpart –all

And change it to:

clearpart –drives=hda –all –initlabel

(*Edit 8/1/08 – note, those are dash dash ( – - ) before the options…doesn’t display properly on my blog)

(*Edit 8/4/08 – note, if you have SATA drives in your system, you want to set drives=sda instead of hda)

This ensures that your USB Flash Drive isn’t erased.

Next find the line that says:

mount /dev/cdrom /tempdir || mount /dev/scd0 /tempdir

And change it to:

mount /dev/sdc2 /tempdir

This uses the USB Flash Drive instead of the CD ROM for all of the data.

Your USB Flash drive is now prepared! Let’s install trixbox Pro:

Insert the USB Flash Drive into the target system and go into that system’s BIOS. BIOS settings vary, so your system may not be exactly the same, but these are the options for the trixbox Appliance.

Hit DEL when the system is booting up to go into the BIOS.

Select ‘Advanced BIOS Features’ and then ‘Hard Disk Boot Priority.’ My USB Flash Drive shows up as ‘Kingston DT Elite.’ Move that to the top of the list using PGUP. ESC to exit.

Now change USB HDD to the 1st boot option. Save and exit the BIOS config.

When your system comes up and has booted to the USB Flash Drive, it should be the default ‘Cent OS’ installation screen (instead of the usual trixbox Pro screen). At the prompt, type the following:

linux ks=hd:sdc2:/ks.cfg

This tells CentOS to boot linux using the KickStart file located the root of sdc2. When the installation starts, you are asked a few questions:

Keyboard: US

What type of media contains the packages to be installed?: Hard Drive

What partition and directory…: /dev/sdc2 (or the location of your USB Flash Drive partition 2)

That’s it! From here, the trixbox Pro installation moves forward normally.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

You must be logged in to post a comment.