<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://criu.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Artem</id>
	<title>CRIU - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://criu.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Artem"/>
	<link rel="alternate" type="text/html" href="https://criu.org/Special:Contributions/Artem"/>
	<updated>2026-05-13T14:26:54Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.6</generator>
	<entry>
		<id>https://criu.org/index.php?title=Checkpoint/Restore&amp;diff=2550</id>
		<title>Checkpoint/Restore</title>
		<link rel="alternate" type="text/html" href="https://criu.org/index.php?title=Checkpoint/Restore&amp;diff=2550"/>
		<updated>2015-08-05T06:25:57Z</updated>

		<summary type="html">&lt;p&gt;Artem: /* Checkpoint */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page describes the overall design of how Checkpoint and Restore work in CRIU.&lt;br /&gt;
&lt;br /&gt;
== Checkpoint ==&lt;br /&gt;
&lt;br /&gt;
The checkpoint procedure relies heavily on '''/proc''' file system (it's a general place where criu takes all the information it needs).&lt;br /&gt;
Which includes&lt;br /&gt;
&lt;br /&gt;
* Files descriptors information (via '''/proc/$pid/fd''' and '''/proc/$pid/fdinfo''').&lt;br /&gt;
* Pipes parameters.&lt;br /&gt;
* Memory maps (via '''/proc/$pid/maps''' and '''/proc/$pid/map_files/''').&lt;br /&gt;
* etc.&lt;br /&gt;
&lt;br /&gt;
The process dumper (lets call it a dumper further) does the following steps during checkpoint stage&lt;br /&gt;
&lt;br /&gt;
=== Collect process tree and freeze it ===&lt;br /&gt;
The '''$pid''' of a process group leader is obtained from the command line (&amp;lt;code&amp;gt;--tree&amp;lt;/code&amp;gt; option). By using this '''$pid''' the dumper walks though '''/proc/$pid/task/''' directory collecting threads and through the '''/proc/$pid/task/$tid/children''' to gathers children recursively. While walking tasks are stopped using the &amp;lt;code&amp;gt;ptrace&amp;lt;/code&amp;gt;'s &amp;lt;code&amp;gt;PTRACE_SEIZE&amp;lt;/code&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
=== Collect tasks' resources and dump them ===&lt;br /&gt;
At this step CRIU reads all the information (it knows) about collected tasks and writes them to dump files. The resources are obtained via&lt;br /&gt;
# VMAs areas are parsed from '''/proc/$pid/smaps''' and mapped files are read from '''/proc/$pid/map_files''' links&lt;br /&gt;
# File descriptor numbers are read via '''/proc/$pid/fd'''&lt;br /&gt;
# Core parameters of a task (such as registers and friends) are being dumped via ptrace interface and parsing '''/proc/$pid/stat''' entry.&lt;br /&gt;
&lt;br /&gt;
Then CRIU injects a [[parasite code]] into a task via ptrace interface. This is done in two steps -- at first we inject only a few bytes for ''mmap'' syscall at CS:IP the task has at moment of seizing. Then ptrace allow us to run an injected syscall and we allocate enough memory for a parasite code chunk we need for dumping. After that the parasite code is copied into new place inside dumpee address space and CS:IP set respectively to point to our parasite code.&lt;br /&gt;
&lt;br /&gt;
From parsite context CRIU does more information such as&lt;br /&gt;
# Credentials&lt;br /&gt;
# Contents of memory&lt;br /&gt;
&lt;br /&gt;
=== Cleanup ===&lt;br /&gt;
&lt;br /&gt;
After everything dumped (such as memory pages, which can be written out only from inside dumpee address space) we use ptrace facility again and cure dumpee by dropping out all our parasite code and restoring original code. Then CRIU detaches from tasks and they continue to operate.&lt;br /&gt;
&lt;br /&gt;
== Restore ==&lt;br /&gt;
&lt;br /&gt;
The restore procedure (aka restorer) is done by CRIU morphing itself into the tasks it restores. On the top-level it consists of 4 steps&lt;br /&gt;
&lt;br /&gt;
=== Resolve shared resources ===&lt;br /&gt;
&lt;br /&gt;
At this step CRIU reads in image files and finds out which processes share which resources. Later shared resources are restored by some one process and all the others either inherit one on the 2nd stage (like session) or obtain in some other way. The latter is, for example, shared files which are sent with SCM_CREDS messages via unix sockets, or shared memory areas that are restoring via &amp;lt;code&amp;gt;memfd&amp;lt;/code&amp;gt; file descriptor.&lt;br /&gt;
&lt;br /&gt;
=== Fork the process tree ===&lt;br /&gt;
&lt;br /&gt;
At this step CRIU calls fork() many times to re-created the processes needed to be restored. Note, that threads are not restored here, but on the 4th step.&lt;br /&gt;
&lt;br /&gt;
=== Restore basic tasks resources ===&lt;br /&gt;
&lt;br /&gt;
Here CRIU restores all resources but&lt;br /&gt;
&lt;br /&gt;
# memory mappings exact location&lt;br /&gt;
# timers&lt;br /&gt;
# credentials&lt;br /&gt;
# threads&lt;br /&gt;
&lt;br /&gt;
These for are delayed till the last stage for the reasons described further. On this stage CRIU opens files, prepares namespaces, maps (and fills with data) private memory areas, creates sockets, calls chdir() and chroot() and dome some more.&lt;br /&gt;
&lt;br /&gt;
=== Switch to [[restorer context]], restore the rest and continue ===&lt;br /&gt;
&lt;br /&gt;
The reason for restorer blob is simple. Since criu morphs into the target process, it will have to unmap all its memory and put back the target one. While doing so some code should exist in memory (the code doing the munmap and mmap). So we introduced the restorer blob -- the small piece of code, that doesn't intersect with criu mappings AND target mappings. At the end of stage 2 criu jumps into this blob and restores the memory maps.&lt;br /&gt;
&lt;br /&gt;
At the same place we restore timers not to make them fire too early, here we restore credentials to let criu do priveledged operations (like fork-with-pid) and threads not to make them suffer from sudden memory layout change.&lt;br /&gt;
&lt;br /&gt;
[[Category:Under the hood]]&lt;/div&gt;</summary>
		<author><name>Artem</name></author>
	</entry>
	<entry>
		<id>https://criu.org/index.php?title=External_UNIX_socket&amp;diff=2546</id>
		<title>External UNIX socket</title>
		<link rel="alternate" type="text/html" href="https://criu.org/index.php?title=External_UNIX_socket&amp;diff=2546"/>
		<updated>2015-07-30T07:51:46Z</updated>

		<summary type="html">&lt;p&gt;Artem: /* What to do with socketpair()-s? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This explains the meaning of '''external socket is used''' error message, and the purpose of '''&amp;lt;code&amp;gt;--ext-unix-sk&amp;lt;/code&amp;gt;''' option.&lt;br /&gt;
&lt;br /&gt;
== Error meaning ==&lt;br /&gt;
&lt;br /&gt;
When dumping a process sub-tree, criu checks that the resulting image is consistent and self-contained, meaning if an object A references another object B, and A goes into dump, then B should be dumped as well. For example, if there is a pipe, and criu dumps its one end (object A) because it belongs to a process it dumps, it must also dump the other end of the pipe (object B), meaning it should take a process owning B into the image as well. Same is true for unix sockets: if there is a socket (A) that is &amp;lt;code&amp;gt;connect()&amp;lt;/code&amp;gt;ed to another socket (B), and criu dumps socket A (because it is opened by a process it dumps), it must also dump socket B and the task who owns it. Possibly socket B is dumped some time later in the dumping process, but it must be dumped.&lt;br /&gt;
&lt;br /&gt;
This restriction is in place to make sure that upon restore applications will continue to work, rather than, say, receive SIGPIPE signals due to half-closed pipes or sockets.&lt;br /&gt;
&lt;br /&gt;
With that said, &amp;quot;external socket is used&amp;quot; error means criu detected a unix socket connected to another socket which is not being dumped (because it belongs to a process not going into the image).&lt;br /&gt;
&lt;br /&gt;
== Using the option ==&lt;br /&gt;
&lt;br /&gt;
However, sometimes it is possible to dump and successfully restore only one end of a unix socket pair. One particular example is the datagram sockets with on-way connection (client to server) used e.g. by &amp;lt;code&amp;gt;logd&amp;lt;/code&amp;gt;. Server opens a datagram socket and waits on it for messages to be written into a log file. Processes using logd also create datagram sockets and connect those to the server. These connections are thus uni-directional. In this case it is possible to dump a program with the client-side socket and on restore the socket needs to be reconnected back to the original server.&lt;br /&gt;
&lt;br /&gt;
This is when &amp;lt;code&amp;gt;--ext-unix-sk&amp;lt;/code&amp;gt; option should be used. By providing this option (for both dump and restore commands), user states &amp;quot;I know there may be uni-directional dgram unix connections, and I will make sure the server end will exist on restore&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
For '''criu dump''', this option enables dumping ''datagram'' unix sockets with additional information about that other (&amp;quot;external&amp;quot;) socket it is connected to.&lt;br /&gt;
&lt;br /&gt;
For '''criu restore''', this option asks criu to re-connect such sockets back.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
Named unix sockets with stream/seqpacket options can't be dumped\restored now, see plan below.&lt;br /&gt;
&lt;br /&gt;
== What to do with stream/seqpacket? ==&lt;br /&gt;
&lt;br /&gt;
Such sockets cannot be just dumped and restored as once we dump one end, the other one seen EOF on socket and may close one. The plan for this is to extend the --ext-unix-sk semantics to work like this&lt;br /&gt;
&lt;br /&gt;
* On dump the &amp;lt;code&amp;gt;--ext-unix-sk $id&amp;lt;/code&amp;gt; says that socket with $id is OK to be disconnected&lt;br /&gt;
* On restore the &amp;lt;code&amp;gt;--ext-unix-sk$id[=$path]&amp;lt;/code&amp;gt; says that the socket $id should be reconnected back to the path it say on dump (or to the $path).&lt;br /&gt;
&lt;br /&gt;
== What to do with socketpair()-s? ==&lt;br /&gt;
Unnamed unix sockets created with socketpair() systemcall can be dumped and restored.&lt;br /&gt;
For dump socketpair put inode of this socket in &amp;lt;code&amp;gt;--ext-unix-sk&amp;lt;/code&amp;gt; option, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
criu dump -D images -o dump.log -v4 --ext-unix-sk=11890815 -t 16528&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For restore socketpair the server should create new pair and call criu restore asking it to [[Inheriting FDs on restore|inherit]] one. Example of command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
criu restore -d -D images -o restore.log --pidfile restore.pid -v4 -x --inherit-fd fd[3]:socket:[11890815]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
test source code also available for this feature and can be found in criu source tree under test/socketpairs.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Advanced usage]]&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;br /&gt;
[[Category:Network]]&lt;/div&gt;</summary>
		<author><name>Artem</name></author>
	</entry>
	<entry>
		<id>https://criu.org/index.php?title=External_UNIX_socket&amp;diff=2545</id>
		<title>External UNIX socket</title>
		<link rel="alternate" type="text/html" href="https://criu.org/index.php?title=External_UNIX_socket&amp;diff=2545"/>
		<updated>2015-07-30T07:21:04Z</updated>

		<summary type="html">&lt;p&gt;Artem: /* Limitations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This explains the meaning of '''external socket is used''' error message, and the purpose of '''&amp;lt;code&amp;gt;--ext-unix-sk&amp;lt;/code&amp;gt;''' option.&lt;br /&gt;
&lt;br /&gt;
== Error meaning ==&lt;br /&gt;
&lt;br /&gt;
When dumping a process sub-tree, criu checks that the resulting image is consistent and self-contained, meaning if an object A references another object B, and A goes into dump, then B should be dumped as well. For example, if there is a pipe, and criu dumps its one end (object A) because it belongs to a process it dumps, it must also dump the other end of the pipe (object B), meaning it should take a process owning B into the image as well. Same is true for unix sockets: if there is a socket (A) that is &amp;lt;code&amp;gt;connect()&amp;lt;/code&amp;gt;ed to another socket (B), and criu dumps socket A (because it is opened by a process it dumps), it must also dump socket B and the task who owns it. Possibly socket B is dumped some time later in the dumping process, but it must be dumped.&lt;br /&gt;
&lt;br /&gt;
This restriction is in place to make sure that upon restore applications will continue to work, rather than, say, receive SIGPIPE signals due to half-closed pipes or sockets.&lt;br /&gt;
&lt;br /&gt;
With that said, &amp;quot;external socket is used&amp;quot; error means criu detected a unix socket connected to another socket which is not being dumped (because it belongs to a process not going into the image).&lt;br /&gt;
&lt;br /&gt;
== Using the option ==&lt;br /&gt;
&lt;br /&gt;
However, sometimes it is possible to dump and successfully restore only one end of a unix socket pair. One particular example is the datagram sockets with on-way connection (client to server) used e.g. by &amp;lt;code&amp;gt;logd&amp;lt;/code&amp;gt;. Server opens a datagram socket and waits on it for messages to be written into a log file. Processes using logd also create datagram sockets and connect those to the server. These connections are thus uni-directional. In this case it is possible to dump a program with the client-side socket and on restore the socket needs to be reconnected back to the original server.&lt;br /&gt;
&lt;br /&gt;
This is when &amp;lt;code&amp;gt;--ext-unix-sk&amp;lt;/code&amp;gt; option should be used. By providing this option (for both dump and restore commands), user states &amp;quot;I know there may be uni-directional dgram unix connections, and I will make sure the server end will exist on restore&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
For '''criu dump''', this option enables dumping ''datagram'' unix sockets with additional information about that other (&amp;quot;external&amp;quot;) socket it is connected to.&lt;br /&gt;
&lt;br /&gt;
For '''criu restore''', this option asks criu to re-connect such sockets back.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
Named unix sockets with stream/seqpacket options can't be dumped\restored now, see plan below.&lt;br /&gt;
&lt;br /&gt;
== What to do with stream/seqpacket? ==&lt;br /&gt;
&lt;br /&gt;
Such sockets cannot be just dumped and restored as once we dump one end, the other one seen EOF on socket and may close one. The plan for this is to extend the --ext-unix-sk semantics to work like this&lt;br /&gt;
&lt;br /&gt;
* On dump the &amp;lt;code&amp;gt;--ext-unix-sk $id&amp;lt;/code&amp;gt; says that socket with $id is OK to be disconnected&lt;br /&gt;
* On restore the &amp;lt;code&amp;gt;--ext-unix-sk$id[=$path]&amp;lt;/code&amp;gt; says that the socket $id should be reconnected back to the path it say on dump (or to the $path).&lt;br /&gt;
&lt;br /&gt;
== What to do with socketpair()-s? ==&lt;br /&gt;
&lt;br /&gt;
To restore socketpair we need more help from the server -- the server should create new pair and call criu restore asking it to [[Inheriting FDs on restore|inherit]] one.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Advanced usage]]&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;br /&gt;
[[Category:Network]]&lt;/div&gt;</summary>
		<author><name>Artem</name></author>
	</entry>
	<entry>
		<id>https://criu.org/index.php?title=External_UNIX_socket&amp;diff=2544</id>
		<title>External UNIX socket</title>
		<link rel="alternate" type="text/html" href="https://criu.org/index.php?title=External_UNIX_socket&amp;diff=2544"/>
		<updated>2015-07-30T06:28:40Z</updated>

		<summary type="html">&lt;p&gt;Artem: /* What to do with stream/seqpacket? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This explains the meaning of '''external socket is used''' error message, and the purpose of '''&amp;lt;code&amp;gt;--ext-unix-sk&amp;lt;/code&amp;gt;''' option.&lt;br /&gt;
&lt;br /&gt;
== Error meaning ==&lt;br /&gt;
&lt;br /&gt;
When dumping a process sub-tree, criu checks that the resulting image is consistent and self-contained, meaning if an object A references another object B, and A goes into dump, then B should be dumped as well. For example, if there is a pipe, and criu dumps its one end (object A) because it belongs to a process it dumps, it must also dump the other end of the pipe (object B), meaning it should take a process owning B into the image as well. Same is true for unix sockets: if there is a socket (A) that is &amp;lt;code&amp;gt;connect()&amp;lt;/code&amp;gt;ed to another socket (B), and criu dumps socket A (because it is opened by a process it dumps), it must also dump socket B and the task who owns it. Possibly socket B is dumped some time later in the dumping process, but it must be dumped.&lt;br /&gt;
&lt;br /&gt;
This restriction is in place to make sure that upon restore applications will continue to work, rather than, say, receive SIGPIPE signals due to half-closed pipes or sockets.&lt;br /&gt;
&lt;br /&gt;
With that said, &amp;quot;external socket is used&amp;quot; error means criu detected a unix socket connected to another socket which is not being dumped (because it belongs to a process not going into the image).&lt;br /&gt;
&lt;br /&gt;
== Using the option ==&lt;br /&gt;
&lt;br /&gt;
However, sometimes it is possible to dump and successfully restore only one end of a unix socket pair. One particular example is the datagram sockets with on-way connection (client to server) used e.g. by &amp;lt;code&amp;gt;logd&amp;lt;/code&amp;gt;. Server opens a datagram socket and waits on it for messages to be written into a log file. Processes using logd also create datagram sockets and connect those to the server. These connections are thus uni-directional. In this case it is possible to dump a program with the client-side socket and on restore the socket needs to be reconnected back to the original server.&lt;br /&gt;
&lt;br /&gt;
This is when &amp;lt;code&amp;gt;--ext-unix-sk&amp;lt;/code&amp;gt; option should be used. By providing this option (for both dump and restore commands), user states &amp;quot;I know there may be uni-directional dgram unix connections, and I will make sure the server end will exist on restore&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
For '''criu dump''', this option enables dumping ''datagram'' unix sockets with additional information about that other (&amp;quot;external&amp;quot;) socket it is connected to.&lt;br /&gt;
&lt;br /&gt;
For '''criu restore''', this option asks criu to re-connect such sockets back.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
&lt;br /&gt;
Socket screated with socketpair() systemcall are not one-way connected and do not work with --ext-unix-sk&lt;br /&gt;
&lt;br /&gt;
== What to do with stream/seqpacket? ==&lt;br /&gt;
&lt;br /&gt;
Such sockets cannot be just dumped and restored as once we dump one end, the other one seen EOF on socket and may close one. The plan for this is to extend the --ext-unix-sk semantics to work like this&lt;br /&gt;
&lt;br /&gt;
* On dump the &amp;lt;code&amp;gt;--ext-unix-sk $id&amp;lt;/code&amp;gt; says that socket with $id is OK to be disconnected&lt;br /&gt;
* On restore the &amp;lt;code&amp;gt;--ext-unix-sk$id[=$path]&amp;lt;/code&amp;gt; says that the socket $id should be reconnected back to the path it say on dump (or to the $path).&lt;br /&gt;
&lt;br /&gt;
== What to do with socketpair()-s? ==&lt;br /&gt;
&lt;br /&gt;
To restore socketpair we need more help from the server -- the server should create new pair and call criu restore asking it to [[Inheriting FDs on restore|inherit]] one.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Advanced usage]]&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;br /&gt;
[[Category:Network]]&lt;/div&gt;</summary>
		<author><name>Artem</name></author>
	</entry>
	<entry>
		<id>https://criu.org/index.php?title=Installation&amp;diff=2532</id>
		<title>Installation</title>
		<link rel="alternate" type="text/html" href="https://criu.org/index.php?title=Installation&amp;diff=2532"/>
		<updated>2015-07-21T09:40:17Z</updated>

		<summary type="html">&lt;p&gt;Artem: /* Other deps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;code&amp;gt;criu&amp;lt;/code&amp;gt; is an utility to checkpoint/restore a process tree. This page describes how to manually build and install prerequisites and the tool itself.&lt;br /&gt;
&lt;br /&gt;
== Installing from packages ==&lt;br /&gt;
&lt;br /&gt;
Some distributions provide ready-to-use [[packages]]. If no, or the CRIU version you want is not yet there, you will need to get CRIU sources and compile it.&lt;br /&gt;
&lt;br /&gt;
== Obtaining CRIU Source ==&lt;br /&gt;
&lt;br /&gt;
You can download the source code as a release tarball or sync the [http://git.criu.org/?p=criu.git;a=summary git repository]. If you plan to modify CRIU sources the latter way is highly recommended.&lt;br /&gt;
&lt;br /&gt;
=== Getting source tarball ===&lt;br /&gt;
: {{Latest release}}&lt;br /&gt;
&lt;br /&gt;
=== Cloning git repository ===&lt;br /&gt;
 git clone https://github.com/xemul/criu&lt;br /&gt;
&lt;br /&gt;
== Dependencies ==&lt;br /&gt;
&lt;br /&gt;
=== Compiler and C Library ===&lt;br /&gt;
&lt;br /&gt;
CRIU is mostly written in C and the build system is based on Makefiles. Thus just install standard &amp;lt;code&amp;gt;gcc&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; packages (on Debian, &amp;lt;code&amp;gt;[https://packages.debian.org/build-essential build-essential]&amp;lt;/code&amp;gt; will pull in both at once).&lt;br /&gt;
&lt;br /&gt;
If you are cross compiling for ARM, use distribution packages or download prebuilt toolchains from Linaro.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:800px&amp;quot;&amp;gt;&lt;br /&gt;
Downloading Linaro toolchains&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
 sudo apt-get install lib32stdc++6 lib32z1 # These are ia32 binaries&lt;br /&gt;
 mkdir -p deps/`uname -m`-linux-gnu&lt;br /&gt;
 cd deps&lt;br /&gt;
 wget http://releases.linaro.org/14.09/components/toolchain/binaries/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux.tar.xz&lt;br /&gt;
 tar --strip=1 -C `uname -m`-linux-gnu -xf gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux.tar.xz&lt;br /&gt;
 wget http://releases.linaro.org/14.09/components/toolchain/binaries/gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux.tar.xz&lt;br /&gt;
 tar --strip=1 -C `uname -m`-linux-gnu -xf gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux.tar.xz&lt;br /&gt;
 cd ..&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Protocol Buffers ===&lt;br /&gt;
&lt;br /&gt;
CRIU uses the [https://developers.google.com/protocol-buffers/ Google Protocol Buffers] to read and write [[images]] and thus requires [https://github.com/protobuf-c/protobuf-c C language bindings]. The &amp;lt;code&amp;gt;protoc&amp;lt;/code&amp;gt; tool is required at build time and the &amp;lt;code&amp;gt;libprotobuf-c.so&amp;lt;/code&amp;gt; shared object is required at build and run time. [[CRIT]] also uses python language bindings for protocol buffers and requires the &amp;lt;code&amp;gt;descriptor.proto&amp;lt;/code&amp;gt; file typically provided by a distribution's protobuf development package.&lt;br /&gt;
&lt;br /&gt;
==== Distribution Packages ====&lt;br /&gt;
The easiest way is to install distribution packages.&lt;br /&gt;
&lt;br /&gt;
* RPM package names&lt;br /&gt;
** &amp;lt;code&amp;gt;protobuf&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;protobuf-c&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;protobuf-c-devel&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;protobuf-compiler&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;protobuf-devel&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;protobuf-python&amp;lt;/code&amp;gt;&lt;br /&gt;
* Debian package names&lt;br /&gt;
** &amp;lt;code&amp;gt;libprotobuf-dev&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;libprotobuf-c0-dev&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;protobuf-c-compiler&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;protobuf-compiler&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;python-protobuf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Building Protocol Buffers From Source ====&lt;br /&gt;
If you would like to build from source, you can use the following commands to obtain the source code repositories, configure, and build the code. On a Debian based system, you may have to install &amp;lt;code&amp;gt;autoconf curl g++ libtool&amp;lt;/code&amp;gt; packages first.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:800px&amp;quot;&amp;gt;&lt;br /&gt;
To build protobuf&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
 cd deps&lt;br /&gt;
 git clone https://github.com/google/protobuf.git protobuf&lt;br /&gt;
 cd protobuf&lt;br /&gt;
 ./autogen.sh&lt;br /&gt;
 ./configure --prefix=`pwd`/../`uname -m`-linux-gnu&lt;br /&gt;
 make&lt;br /&gt;
 make install&lt;br /&gt;
 cd ../..&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:800px&amp;quot;&amp;gt;&lt;br /&gt;
To build protobuf-c&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
 cd deps&lt;br /&gt;
 git clone https://github.com/protobuf-c/protobuf-c.git protobuf-c&lt;br /&gt;
 cd protobuf-c&lt;br /&gt;
 ./autogen.sh&lt;br /&gt;
 mkdir ../pbc-`uname -m`&lt;br /&gt;
 cd ../pbc-`uname -m`&lt;br /&gt;
 ../protobuf-c/configure --prefix=`pwd`/../`uname -m`-linux-gnu \&lt;br /&gt;
   PKG_CONFIG_PATH=`pwd`/../`uname -m`-linux-gnu/lib/pkgconfig&lt;br /&gt;
 make&lt;br /&gt;
 make install&lt;br /&gt;
 cd ../..&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:800px&amp;quot;&amp;gt;&lt;br /&gt;
To cross-compile for ARM some more tricks will be required.&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
For ARMv7&lt;br /&gt;
&lt;br /&gt;
 cd deps&lt;br /&gt;
 mkdir -p pbc-arm&lt;br /&gt;
 cd pbc-arm&lt;br /&gt;
 ../protobuf-c/configure --host=arm-linux-gnueabihf --prefix=`pwd`/../arm-linux-gnueabihf \&lt;br /&gt;
                         --disable-protoc PATH=`pwd`/../`uname -m`-linux-gnu/bin:$PATH&lt;br /&gt;
 make PATH=`pwd`/../`uname -m`-linux-gnu/bin:$PATH&lt;br /&gt;
 make install PATH=`pwd`/../`uname -m`-linux-gnu/bin:$PATH&lt;br /&gt;
 cd ../..&lt;br /&gt;
&lt;br /&gt;
For ARM8&lt;br /&gt;
&lt;br /&gt;
 cd deps&lt;br /&gt;
 mkdir -p pbc-aarch64&lt;br /&gt;
 cd pbc-aarch64&lt;br /&gt;
  ../protobuf-c/configure --host=aarch64-linux-gnu --prefix=`pwd`/../aarch64-linux-gnu \&lt;br /&gt;
                          --disable-protoc PATH=`pwd`/../`uname -m`-linux-gnu/bin:$PATH&lt;br /&gt;
 make PATH=`pwd`/../`uname -m`-linux-gnu/bin:$PATH&lt;br /&gt;
 make install PATH=`pwd`/../`uname -m`-linux-gnu/bin:$PATH&lt;br /&gt;
 cd ../..&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Other deps ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;python-ipaddr&amp;lt;/code&amp;gt; is used by CRIT to pretty-print ip.&lt;br /&gt;
* If &amp;lt;code&amp;gt;libbsd&amp;lt;/code&amp;gt; available, CRIU will be compiled with setproctitle() support. It will allow to make process titles of service workers to be more verbose.&lt;br /&gt;
* The iproute2 tool version 3.5.0 or higher is needed for dumping network namespaces. The latest one can be cloned from [http://git.kernel.org/?p=linux/kernel/git/shemminger/iproute2.git;a=summary iproute2]. It should be compiled and a path to ip written in the environment variable &amp;lt;code&amp;gt;CR_IP_TOOL&amp;lt;/code&amp;gt;.&lt;br /&gt;
* If you would like to use &amp;lt;code&amp;gt;make test&amp;lt;/code&amp;gt; you should install &amp;lt;code&amp;gt;libaio-dev&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Linux Kernel ==&lt;br /&gt;
&lt;br /&gt;
Linux kernel v3.11 or newer is required, with some specific options set. If your distribution does not provide needed kernel, you might want to compile one yourself.&lt;br /&gt;
&lt;br /&gt;
=== Configuring the kernel ===&lt;br /&gt;
&lt;br /&gt;
Most likely the first thing to enable is the &amp;lt;code&amp;gt;CONFIG_EXPERT=y&amp;lt;/code&amp;gt; (General setup -&amp;gt; Configure standard kernel features (expert users)) option, which on x86_64 depends on the &amp;lt;code&amp;gt;CONFIG_EMBEDDED=y&amp;lt;/code&amp;gt; (General setup -&amp;gt; Embedded system) one (welcome to Kconfig reverse chains hell).&lt;br /&gt;
&lt;br /&gt;
The following options must be enabled for CRIU to work:&lt;br /&gt;
&lt;br /&gt;
* ''General setup'' options&lt;br /&gt;
** &amp;lt;code&amp;gt;CONFIG_CHECKPOINT_RESTORE=y&amp;lt;/code&amp;gt; (Checkpoint/restore support)&lt;br /&gt;
** &amp;lt;code&amp;gt;CONFIG_NAMESPACES=y&amp;lt;/code&amp;gt; (Namespaces support)&lt;br /&gt;
** &amp;lt;code&amp;gt;CONFIG_UTS_NS=y&amp;lt;/code&amp;gt; (Namespaces support -&amp;gt; UTS namespace)&lt;br /&gt;
** &amp;lt;code&amp;gt;CONFIG_IPC_NS=y&amp;lt;/code&amp;gt; (Namespaces support -&amp;gt; IPC namespace)&lt;br /&gt;
** &amp;lt;code&amp;gt;CONFIG_PID_NS=y&amp;lt;/code&amp;gt; (Namespaces support -&amp;gt; PID namespaces)&lt;br /&gt;
** &amp;lt;code&amp;gt;CONFIG_NET_NS=y&amp;lt;/code&amp;gt; (Namespaces support -&amp;gt; Network namespace)&lt;br /&gt;
** &amp;lt;code&amp;gt;CONFIG_FHANDLE=y&amp;lt;/code&amp;gt; (Open by fhandle syscalls)&lt;br /&gt;
** &amp;lt;code&amp;gt;CONFIG_EVENTFD=y&amp;lt;/code&amp;gt; (Enable eventfd() system call)&lt;br /&gt;
** &amp;lt;code&amp;gt;CONFIG_EPOLL=y&amp;lt;/code&amp;gt; (Enable eventpoll support)&lt;br /&gt;
* ''Networking support -&amp;gt; Networking options'' options for sock-diag subsystem&lt;br /&gt;
** &amp;lt;code&amp;gt;CONFIG_UNIX_DIAG=y&amp;lt;/code&amp;gt; (Unix domain sockets -&amp;gt; UNIX: socket monitoring interface)&lt;br /&gt;
** &amp;lt;code&amp;gt;CONFIG_INET_DIAG=y&amp;lt;/code&amp;gt; (TCP/IP networking -&amp;gt; INET: socket monitoring interface)&lt;br /&gt;
** &amp;lt;code&amp;gt;CONFIG_INET_UDP_DIAG=y&amp;lt;/code&amp;gt; (TCP/IP networking -&amp;gt; INET: socket monitoring interface -&amp;gt; UDP: socket monitoring interface)&lt;br /&gt;
** &amp;lt;code&amp;gt;CONFIG_PACKET_DIAG=y&amp;lt;/code&amp;gt; (Packet socket -&amp;gt; Packet: sockets monitoring interface)&lt;br /&gt;
** &amp;lt;code&amp;gt;CONFIG_NETLINK_DIAG=y&amp;lt;/code&amp;gt; (Netlink socket -&amp;gt; Netlink: sockets monitoring interface)&lt;br /&gt;
* Other options&lt;br /&gt;
** &amp;lt;code&amp;gt;CONFIG_INOTIFY_USER=y&amp;lt;/code&amp;gt; (File systems -&amp;gt; Inotify support for userspace)&lt;br /&gt;
** &amp;lt;code&amp;gt;CONFIG_IA32_EMULATION=y&amp;lt;/code&amp;gt; (x86 only) (Executable file formats -&amp;gt; Emulations -&amp;gt; IA32 Emulation)&lt;br /&gt;
&lt;br /&gt;
For some [[usage scenarios]] there is an ability to track memory changes and produce [[incremental dumps]]. Need to enable the &amp;lt;code&amp;gt;CONFIG_MEM_SOFT_DIRTY=y&amp;lt;/code&amp;gt; (optional) (Processor type and features -&amp;gt; Track memory changes).&lt;br /&gt;
&lt;br /&gt;
Note we also have our [[custom kernel]], which might contain some experimental CRIU related patches.&lt;br /&gt;
&lt;br /&gt;
== Building CRIU From Source ==&lt;br /&gt;
&lt;br /&gt;
=== Native Compilation ===&lt;br /&gt;
Simply run &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; in the CRIU source directory.&lt;br /&gt;
&lt;br /&gt;
=== Compilation in Docker container ===&lt;br /&gt;
&lt;br /&gt;
There's a ''docker-build'' target in Makefile which builds CRIU in Ubuntu Docker container. Just run &amp;lt;code&amp;gt;make docker-build&amp;lt;/code&amp;gt; and that's it.&lt;br /&gt;
&lt;br /&gt;
=== Non-standard compilation ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:800px&amp;quot;&amp;gt;&lt;br /&gt;
Building natively, but specifying built dependencies manually&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
 cd deps&lt;br /&gt;
 rsync -a --exclude=.git --exclude=deps .. criu-`uname -m`&lt;br /&gt;
 cd criu-`uname -m`&lt;br /&gt;
 make \&lt;br /&gt;
   USERCFLAGS=&amp;quot;-I`pwd`/../`uname -m`-linux-gnu/include -L`pwd`/../`uname -m`-linux-gnu/lib&amp;quot; \&lt;br /&gt;
   PATH=&amp;quot;`pwd`/../`uname -m`-linux-gnu/bin:$PATH&amp;quot;&lt;br /&gt;
 sudo LD_LIBRARY_PATH=`pwd`/../`uname -m`-linux-gnu/lib ./criu check&lt;br /&gt;
 cd ../..&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:800px&amp;quot;&amp;gt;&lt;br /&gt;
Cross Compilation for ARM&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
ARMv7&lt;br /&gt;
 cd deps&lt;br /&gt;
 rsync -a --exclude=.git --exclude=deps .. criu-arm&lt;br /&gt;
 cd criu-arm&lt;br /&gt;
 make \&lt;br /&gt;
   ARCH=arm \&lt;br /&gt;
   CROSS_COMPILE=`pwd`/../`uname -m`-linux-gnu/bin/arm-linux-gnueabihf- \&lt;br /&gt;
   USERCFLAGS=&amp;quot;-I`pwd`/../arm-linux-gnueabihf/include -L`pwd`/../arm-linux-gnueabihf/lib&amp;quot; \&lt;br /&gt;
   PATH=&amp;quot;`pwd`/../`uname -m`-linux-gnu/bin:$PATH&amp;quot;&lt;br /&gt;
 cd ../..&lt;br /&gt;
&lt;br /&gt;
ARMv8&lt;br /&gt;
  cd deps&lt;br /&gt;
  rsync -a --exclude=.git --exclude=deps .. criu-aarch64&lt;br /&gt;
  cd criu-aarch64&lt;br /&gt;
  make \&lt;br /&gt;
   ARCH=aarch64 \&lt;br /&gt;
   CROSS_COMPILE=`pwd`/../`uname -m`-linux-gnu/bin/aarch64-linux-gnu- \&lt;br /&gt;
   USERCFLAGS=&amp;quot;-I`pwd`/../aarch64-linux-gnu/include -L`pwd`/../aarch64-linux-gnu/lib&amp;quot; \&lt;br /&gt;
   PATH=&amp;quot;`pwd`/../`uname -m`-linux-gnu/bin:$PATH&amp;quot;&lt;br /&gt;
  cd ../..&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
CRIU works perfectly even when run from the sources directory (with the &amp;quot;./criu&amp;quot; command), but if you want to have in standard paths run &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
You may need to install the following packages to generate docs in Debian-based OS's to avoid errors from install-man:&lt;br /&gt;
* &amp;lt;code&amp;gt;asciidoc&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;xmlto&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Checking That It Works ==&lt;br /&gt;
&lt;br /&gt;
First thing to do is to run &amp;lt;code&amp;gt;criu check --ms&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
At the end it should say &amp;quot;Looks OK&amp;quot;, if it doesn't the messages on the screen explain what functionality is missing. If you're using our custom kernel, then the &amp;lt;code&amp;gt;--ms&amp;lt;/code&amp;gt; option should not be used, in this case CRIU would check for ''all'' the kernel features to work.&lt;br /&gt;
&lt;br /&gt;
You can then try running the [[ZDTM Test Suite]] which sits in the &amp;lt;code&amp;gt;tests/zdtm/&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
== Further reading ==&lt;br /&gt;
&lt;br /&gt;
Please see [[Usage]] and [[Advanced usage]], as well as [[:Category:HOWTO]].&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Artem</name></author>
	</entry>
</feed>