Open source software security

Getting TrueCrypt to Work with Mandriva 2007.1

30 November -0001

I've been using TrueCrypt for some time now on my Windows machines and I wanted to explore how easy or hard it was to get it working under Mandriva 2007.1 (Spring). It turns out there are quite a few hidden caveats to getting TrueCrypt working. In my case I had a USB drive connected to the machine that was serving as an encrypted volume. When I booted up Mandriva I wanted to be able to mount the drive.

The first thing to do is to install the kernel-sources package using either URPMI or your Mandriva Control Center. The kernel sources are needed because TrueCrypt has to build custom kernel modules. Installing the kernel sources using URPMI (or the Software Manager in the Control Center) will require all the prerequisite building libraries (binutils, gcc, make, etc.) that you will need to complete the TrueCrypt install as well.

Once you have the kernel-sources installed it's time to download TrueCrypt. You want to download the Linux sources since you'll have to build TrueCrypt by hand. Download the tar.gz package and unpack it:

$ tar -xvzf truecrypt-4.3a-source-code.tar.gz

This should create a new directory called truecrypt-4.3a-source-code. Go ahead and change into that directory then into the Linux directory.

$ cd truecrypt-4.3a-source-code/Linux/

You'll have to build everything from here but there are shell scripts to help. If you get the errors:

Checking build requirements...
Linux kernel (2.6.17-13mdvlegacy) source directory [/usr/src/linux]:
Error: /usr/src/linux does not exist

You need to install the kernel sources or specify the proper directory to where your kernel sources are installed.

$ sudo ./build.sh
Checking build requirements...
Building kernel module... Done.
Building truecrypt... Done.

This will build the kernel headers. This is sort of a long process and really will take some time (the 'Building internal kernel modules (may take a long time)...' warning doesn't lie). I think it took about 20 minutes on my machine. Next you can install TrueCrypt using:

$ sudo ./install.sh

Checking installation requirements...
Testing truecrypt... Done.

Install binaries to [/usr/bin]:    press [Enter]
Install man page to [/usr/share/man]:  press [Enter]
Install user guide and kernel module to [/usr/share/truecrypt]:  [Enter]
Allow non-admin users to run TrueCrypt [y/N]:
 to allow non-root users to use TrueCrypt press [y] else [N]
Installing kernel module... Done.
Installing truecrypt to /usr/bin... Done.
Installing man page to /usr/share/man/man1... Done.
Installing user guide to /usr/share/truecrypt/doc... Done.
installing backup kernel module to /usr/share/truecrypt/kernel... Done.

Once the install is complete you can mount your drives. I was used to the GUI on the Widows side so this took a little doing. In the Mandriva Control center if you check under the Hardware tab and click the 'Look at and configure hardware' option you should get a list of all the devices attached to your machine. This is important because it will allow you to identify the mount points of various drives. If you look under the Partitions listing you can see the mount point (for instance /dev/sdb1).

Once you identify the drive you need to create a folder to mount the drive to. In my case I used:

$ mkdir /home/justin/truecrypt

Finally you want to mount the volume. To do this use the truecrypt command, followed by the target volume and the location of the drive you want to map to. You may get an error though:

$ truecrypt /dev/sdb1 /home/justin/truecrypt
Enter password for '/dev/sdb1': 
insmod: error inserting '/usr/share/truecrypt/kernel/truecrypt-2.6.17.ko': -1 Invalid module format
FATAL: Error inserting truecrypt (/lib/modules/2.6.17-14mdv/extra/truecrypt.ko): Invalid module format
Failed to load TrueCrypt kernel module

To fix this error all you have to do is run the following command:

$ sudo modprobe -f truecrypt

Then run the connect as normal:

$ truecrypt /dev/sdb1 /home/justin/truecrypt
Enter password for '/dev/sdb1':

After that you should be able to browse to the local folder mapping (for instance /home/justin/truecrypt) and see the contents of your encrypted volume.