Trinity Rescue Kit (TRK) is a Linux distribution specialized in data and system recovery. The latest release as of this writing is 3.4, build 372, and it’s ideal to run off a USB stick or a CD as it’s just over 100 MiB. You can download it from here.
I decided to tackle my latest recovery project with TRK, which proved to be a great tool and apart from giving me access to some really old, mostly useless but full of nostalgia stuff, I also learned some recovery concepts and some more Linux on the way, which was cool. Anyway, after using it for a few days I found the need to run a package that was not included by default in the distro, and was also missing some of the utilities of my own environment, so I decided to put the recovery project on hold and modify TRK a bit.
I had never done something like this before, so I will go through this very newbie style. Fortunately for me, in this case it was a lot easier thanks to the developer, who released a VM with the distro in its full flavor, ready for you to modify and create a new ISO in a few steps. So let’s go through them now.
First of all, read the page in TRK’s site dedicated to customizing the distro, it has some general guidelines that will take you through the whole process. Instead of repeating that here, I will try to point out what problems I found along the way and some notes that helped.
Setting up the dev environment
Pretty straight forward, download the virtual appliance or virtual machine, however you wanna call it, and use VMware Player to run it. If you have problems downloading the VM -which is 1.6 GB- like
bzip2: Data integrity error when decompressing or some corruption related message, don’t download it again straight away and save some of the site’s bandwidth. Instead use some tool to limit the download speed. I had to limit it to 1 MB/s so it wouldn’t be corrupt. Weird but it worked for me.
$ wget --limit-rate=1000k http://trinityhome.org/misc/TRKDev-vm.2010-23-10.tar.bz2
VM’s MD5 is 58cbc1641ce0f5828904abdc69733a67. You should get 12 GB of files when uncompressed. And the source .tar.bz2 is exactly 1683313702 bytes.
This is your playground now, you can change anything. Today we’re going to make 3 small modifications to the distro: add the DOSkey like functionality to bash (history search with arrow keys), add the CDRkit package to the distro and remove the background logo that remains once you’re logged in.
First a few notes about where is what and how to get there. Don’t forget to read the official page on customizing the distro.
Log in with root:trk
There are two main parts in the TRK file system:
/trkdev/trkinitrd/ The initial ramdisk with the root filesystem and /var
/trkdev/usr/ Link to
/linkedfs/usr/ (when running the live cd, this will be read only)
You will find the booting scripts in
You will find the startup scripts in
You will find the easy menu in
When making a new build, you can see the following output, which might come in handy:
"Setting buildnumber in startup logo /etc/issue"
"Writing buildnumber to /etc/build"
"Setting buildnumber in isolinux.cfg"
Install RPMs with:
$ rpm -ivh --nodeps [packagename]
When installing RPMs make sure they are Fedora Core 3, 4 or RHEL 3 or the best compatible: the original Mandriva 2005/10.2 RPMs. Newer distro RPMs will not work. Remember TRK is statically based on Mandriva 2005 libraries, really really old by now. A good base for downloading RPMS is http://packages.sw.be
In general the modifications are easy, it’s just about putting everything in the right place, where it will remain once you create the ISO. Now a step by step on each of the modifications:
1) Add the DOSkey-like functionality to bash
Modify the entries for history-search-* as follows:
2) Add package CDRkit
First time I installed it, it ended up in
/usr/local/bin, which is not copied to the ISO, so we need to put it somewhere where it will persist:
/bin is usually for system commands so let's go for
/usr/bin which in TRK dev corresponds to
$ wget http://www.cdrkit.org/releases/cdrkit-current.tar.gz
Bam! we need cmake to install...
wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz and installs by default to
/usr/local/bin, which is fine for us since we only want it to install CDRkit, and we want to minimize the size of the live CD.
Bam! missing library cap
[/usr/bin/ld: cannot find -lcap], linking failed. More info in FAQ and INSTALL but that's for the linking of wodim, a cd writer tool, and we only want the ISO analyzer tools so...
cd build/genisomake ; make install
genisoimage, devdump, isodebug, isodump, isoinfo, isovfy and their MAN pages installed correctly in
3) Remove the logo
I went brute force with this one and searched for all jpgs. It turned out to be
/trkdev/trkinitrd/etc/bootsplash/trk/images/vt-trk34-800x600.jpg which is referenced in the bootsplash config @
So I modified that file to my liking and done.
Build & Test & Deploy
Just follow the instructions in the official page to build it:
$ ./mknewbuild –b 373
And burn the ISO to a CD.
And run a VM with that ISO to test it out.
The deploy part is really up to you: burn the ISO to a CD or make a bootable USB. For the later you can follow these instructions
There is also a torrent out there with the ISO of the TRK distro modified with the changes described in this post, go ahead and download it from Linux Tracker