Announcement

Collapse
No announcement yet.

HOWTO build Truecrypt 4.3 in Feisty - Correct way and avoiding common problems

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    HOWTO build Truecrypt 4.3 in Feisty - Correct way and avoiding common problems

    HOWTO compile / build Truecrypt 4.3 in Feisty - Correct way to avoid common problems

    After spending long time looking for howtos on this topic, I have seen that all of them have some people reporting success but most people reporting problems. Looking at all the reported problems, I wanted to put together all identified issues and how to avoid them, as well as put together a much simple and efficient HOWTO for the building/installing from Truecrypt 4.3 sources process, eliminating some unnecessary stuff that has been "cut and paste" from howto to howto.

    Very important: there is no need at all to make any patches to the Truecrypt 4.3 sources as mentioned in other "howtos" !!

    This one is also based on the general idea, but - I honestly hope - improved, based on so many posts I have followed and experiences from myself.

    The biggest credit goes here to programming/security guru capi from the security-forums-dot-com who discovered a bug in the TC Makefile script and pointed important information (see below).

    FIRST than everything: Avoid Common Problems

    1.- Make sure you have enough space in the partition that contains /usr/src .

    Only the build of the linux sources is going to occupy more than 1.2 Gigabytes (for example, with kernel 2.6.20-15) .

    Tip: if your hard drive is quite full, try
    Code:
      sudo apt-get clean
    That clears out the local repository of retrieved package files. You might be surprised how big the cache folder can be. After I made my upgrade to Feisty, for example, apt-get clean gave me additional 850 Mb.

    2.- Make sure that you don't have any spaces in the name of any of the directories in the path of the Truecrypt's sources. Truecrypt's Makefile script does not handle correctly filenames or directory names with spaces, e.g.:

    This path:
    Code:
      /home/username/foo bar/truecrypt-4.3-source-code
    will create problems, while this other path:

    Code:
      /home/username/foo-bar/truecrypt-4.3-source-code
    should work.

    capi has documented this in the Truecrypt forum:
    http://forums.truecrypt.org/viewtopic.php?p=30755#30755

    3.- Make sure you are using the right version of gcc. For compiling Truecrypt, you must use the same gcc version that was used to compile your kernel. Currently (Feisty), the Linux kernel is compiled with gcc version 4.1.2, but if you don't know, do this:

    Code:
      cat /proc/version
    
      gcc --version
    The first command will tell you which version of gcc was used for compiling your kernel. The second one, you guessed, will tell you which version of gcc you have currently installed in your system. If (and only if) they don't match, then you need to install gcc-x.y , where x.y are the first two digits from the gcc version used for the kernel.

    ***** Example: your kernel was compiled with gcc-3.4.x and your gcc is another one *****

    Then, you should do:

    Code:
      sudo apt-get install gcc-3.4
    
      export CC=gcc-3.4
    The last command ensures that from that moment on, any compiling done in this particular terminal (shell) will use this version of gcc. Remember: only valid for this shell.

    ***** End of the example *****


    NOW, THAT PRELIMINARIES ARE OK, LET'S GO!!

    ******** Procedure ********

    1.- Install the required software:

    Code:
      sudo apt-get install build-essential dmsetup gawk linux-source-`uname -r` linux-headers-`uname -r`
    Little note for newbies: linux-source-`uname -r` and linux-headers-`uname -r`will install the appropriate version (same as your current kernel version). It is likely you already have linux-headers installed, though.

    2.- Decompress the linux-source-2.6.xx.tar.bz2 file, where xx is specific version of your kernel. In this example, in my case it is 2.6.20, but just replace this part with your version.

    Code:
      cd /usr/src/
    
      sudo tar xvjf linux-source-2.6.20.tar.bz2
    3.- Create a symbolic link to the linux sources. This will ensure that the build process will use the correct sources, minimizing the possibilities of mistakes.

    Code:
      sudo ln -s linux-source-2.6.20 linux
    4.- Compile the linux modules

    Code:
      sudo make -C linux modules_prepare
    Note: This will take long time. It maybe more than one hour. Be patient. It took ~1h10min in my Pentium IV 2.6Ghz, 1Gb RAM. Also, be aware that in several "howto", you will see after the command make, not only the -C flag, but also a -d . Don't use -d, that's a nonsense, it will show you many hundreds of strange debugging information, just to confuse you.

    5.- Once the make process is finished successfuly, then change to truecrypt sources download directory and decompress/untar the sources (remember: NO spaces in the path!!):

    Code:
      cd /foo/where-tc-file-was-downloaded/
    
      tar xzvf truecrypt-4.3-source-code.tar.gz
    6.- Now that the TC sources directory is created, get in and launch the build.sh script:

    Code:
      cd truecrypt-4.3-source-code/Linux/
    
      sudo ./build.sh
    7.- When the build process succeed, then run the installer script:

    Code:
      sudo ./install.sh
    The script will put some questions. Must of them, just accept the defaults by pressing <Enter>. For the first question, type y . Make sure that the path for the man page is /usr/share/man, before pressing <Enter>, and for the final question about letting non-admin users to run Truecrypt, if you don't mind that any user be able to run Truecrypt without making sudo, then also type y. Here is how it goes:

    /dev/mapper/control not found - create? [Y/n]: y <--- Type y And press <Enter>
    Install binaries to [/usr/bin]: <--- Just press <Enter>
    Install man page to [/usr/share/man]: <--- Just press <Enter>
    Install user guide and kernel module to [/usr/share/truecrypt]: <--- Just press <Enter>
    Allow non-admin users to run TrueCrypt [y/N]: y <--- Type y And press <Enter>

    After this is finished, you have successfully compiled and installed your Truecrypt!

    8.- Now it is time to clean up. You may delete the compressed and decompressed truecrypt sources files that you downloaded, those are not needed anymore. Regarding the linux sources directory and the .tar.bz2 file, remember that the linux sources directory will be huge after compilation. If you can't afford that, it is OK to delete it (you can always compile again later), and you may, if you want, keep the .tar.bz2 file if you wish for other future projects. If not, then simply

    Code:
      sudo apt-get remove linux-source-`uname -r`
    and why not, if you are really wanting to save space, just in case:

    Code:
      sudo apt-get clean

    Enjoy!

    Ocumo


    How to install Truecrypt in Kubuntu Feisty - How to install Truecrypt in ubuntu Feisty - How to build Truecrypt in Kubuntu Feisty - How to build Truecrypt in ubuntu Feisty How to install Truecrypt 4.3 in Kubuntu Feisty - How to install Truecrypt 4.3 in ubuntu Feisty - How to build Truecrypt 4.3 in Kubuntu Feisty - How to build Truecrypt 4.3 in ubuntu Feisty
Working...
X