Dump, debug, resume process with criu

hacker_compcriu (previously crtools) is a userspace tool to dump the complete state of a process as a set of image files and resume it later from the same checkpoint. Another advantage of CRIU is you can convert it to a core dump to analyse in GDB. This is particularly useful to debug hung processes. criu can be used as a userland tool, as a RPC tool or as a library in your own tool.

criu has many advanced applications. For example:

  • Container live migration
  • Slow-boot services speed up
  • Seamless kernel upgrade
  • Networking load balancing
  • HPC issues
  • Desktop environment suspend/resume
  • Processes duplication
  • “Save” ability in apps (games), that don’t have such
  • Snapshots of apps
  • Move “forgotten” applications into “screen”
  • Applications behavior analysis on another machine
  • Debugging of hung application
  • Fault-tolerant systems
  • Update dryrun


Unfortunately, the package on Ubuntu Trusty is still crtools. To compile and install criu from source on Ubuntu, run:

$ sudo apt-get install libprotobuf-c0 libprotobuf-c0-dev protobuf-c-compiler protobuf-compiler python-protobuf
$ git clone https://github.com/xemul/criu
$ make
$ sudo make install

Dump a process

To dump a process, run:

$ criu dump -D checkpoint -t 1234

-D : directory to save image files
-t : PID of process to dump

Convert criu images to core dump

Continuing with the examples above where we dumped the process with PID 1234, we can generate the core dump with the crit utility that comes with criu:

$ crit core-dump -i checkpoint -o checkpoint

-i : input directory with criu images
-o : output directory for the core dump

To find the generate core dump file:

$ ls checkpoint/core.*

Check the information with readelf:

$ readelf -a core.45678

Start debugging with GDB:

$ gdb loop core.45678

Resume the process

To resume a process from dump files:

$ criu restore -d -D checkpoint

-d : detach criu from the process after resume

2 thoughts on “Dump, debug, resume process with criu”

Leave a Reply

Your email address will not be published. Required fields are marked *