A guide on how to install Systemtap on an Ubuntu system (Gutsy+)
Contents
Get the systemtap package
Quite easy:
sudo apt-get install systemtap
Kernel support
The generic kernel comes with CONFIG_DEBUG_FS, CONFIG_DEBUG_KERNEL, CONFIG_DEBUG_INFO and CONFIG_KPROBES enabled, so no recompilation needed. For Ubuntu Gutsy (or older version), you have to recompile your kernel: Bug #140784: Enable CONFIG_AUDITSYSCALL in kernel config.
libdwfl needs an uncompressed, unstripped kernel image, so install the package linux-image-debug-<yourkernelversion>.
For Gutsy and Hardy, the easiest way is to use the linux-image-generic meta-package:
sudo apt-get install linux-image-debug-generic
This will install /boot/vmlinux-debug-<yourkernelversion>. Now create a symlink for vmlinux in /lib/modules:
sudo ln -s /boot/vmlinux-debug-$(uname -r) /lib/modules/$(uname -r)/vmlinux
For Intrepid, there's no linux-image-debug-generic metapackage (see https://bugs.launchpad.net/ubuntu/+source/linux/+bug/289087); you have to download the right one from http://ddebs.ubuntu.com/pool/main/l/linux/ instead of getting it from APT (unfortunately getting "the right one" is basically impossible, as only the latest version is available for download). After downloading the one of these that matches your kernel, install it with dpkg -i. This will install /usr/lib/debug/boot/vmlinux-<yourkernelversion>. The system already knows to look there for it, so you don't need to symlink it into /lib/modules.
Devel environment
Kernel headers and gcc are needed for module compilation, so if you have not done so, install them (assuming the usage of generic kernel again): libcap-dev needed for Systemtap packages > 0.6-1
sudo apt-get install linux-headers-generic gcc libcap-dev
Test & enjoy
stap -e 'probe kernel.function("sys_open") {log("hello world") exit()}'
hello world
Building SystemTap mainline
It's also simple to build SystemTap from source snapshots or from Git HEAD. (Tested on Hardy)
sudo apt-get install git-core dejagnu sudo apt-get build-dep systemtap git clone git://sources.redhat.com/git/systemtap.git cd path/to/systemtap ./configure --disable-pie make && sudo make install
Note: snapshots older than 2008-06-27 had trouble linking to the system libdw in the configure step. You can try "./configure --enable-staticdw" instead, or just download a newer snapshot.
