[systemd-devel] debugging guide

Lennart Poettering lennart at poettering.net
Mon Apr 2 13:54:06 PDT 2012

On Fri, 30.03.12 18:26, Gustav Paul (gustav.paul at gmail.com) wrote:

> Hello,
> I'm debugging a systemd shutdown problem where systemd hangs. I would like
> to track the shutdown process - presumably using log_error() all over the
> place.
> What is the best-practices development cycle for testing changes to the
> source? Do you use a VM and if so, do you build an RPM (or whatever flavour
> of package you prefer) after every patch to install the changes into your
> .iso?

I just build systemd from the git tree and run "make install", which
overrides the rpm defaults, but that should be mostly OK.

To test this I am using a little script called "q" that invokes qemu on
a snaphsot of the main disk. (Kay has been using something like this for
ages for udev development.)

The script looks like this:


sudo sync
sudo /bin/sh -c 'echo 3 > /proc/sys/vm/drop_caches'
sudo umount /
sudo modprobe kvm-intel

exec sudo qemu-kvm -smp 2 -m 512 -snapshot /dev/sda

We first drop all caches and sync everything do disk (which is a
side-effect of the "umount /" which will fail -- due to being busy --
but will still sync fs meta data to disk). And then run qemu on the disk,
but throw away all changes that run makes.

It's a pretty useful tool, but you probably should know what you do, and
if you use any fancy storage stuff ymmv.


Lennart Poettering - Red Hat, Inc.

More information about the systemd-devel mailing list