<?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=Shawn+Landden</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=Shawn+Landden"/>
	<link rel="alternate" type="text/html" href="https://criu.org/Special:Contributions/Shawn_Landden"/>
	<updated>2026-05-13T17:58:16Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.6</generator>
	<entry>
		<id>https://criu.org/index.php?title=What%27s_bad_with_V1_images&amp;diff=1314</id>
		<title>What's bad with V1 images</title>
		<link rel="alternate" type="text/html" href="https://criu.org/index.php?title=What%27s_bad_with_V1_images&amp;diff=1314"/>
		<updated>2013-12-20T19:37:39Z</updated>

		<summary type="html">&lt;p&gt;Shawn Landden: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Current [[images]] format is great, but sometimes we find problems with it. This page collects all we don't like about them and would like to change some time in the future (once we change this, image format version will be changed as well).&lt;br /&gt;
&lt;br /&gt;
* vma.proto vma_entry-&amp;gt;fd is unused&lt;br /&gt;
* ipc-msg.proto ipc_msg/ipc_msg_entry names mess&lt;br /&gt;
* sk-packet.proto vs packet-sock.proto names mess (all sockets .proto files are sk-&amp;lt;something&amp;gt;)&lt;br /&gt;
* core.proto blk_sigset for master thread is on task_core_entry, but should be in respective thread_core_entry&lt;br /&gt;
* pstree.proto: sid and pgid should NOT be there, but in core image&lt;br /&gt;
* core.proto -- padding for fpu is not used&lt;br /&gt;
* what to do with absent image files? Backward compatibility requires we still restore, common sense -- abort. Flooding inventory with every single new image doesn't sound that great.&lt;br /&gt;
* core.proto -- unused (though optional) ids field&lt;br /&gt;
* clear_thread_info in per-arch members&lt;br /&gt;
* it would be great to unify inotify and fanotify images into one fsnotify file&lt;br /&gt;
* currently we write checkpoint files with '''*.img''' extension, which might be confusing since this extension is a way overloaded by meaning and quite widespreaded, thus it might be worth to change extension to '''*.criu'''&lt;br /&gt;
* mnt_entry::fstype (in mnt.proto) should have enum fstype type&lt;br /&gt;
* all IDs in image should be in uint64 format (not uint32, like in reg_file_entry), this allows us to use unified ID generator over all images&lt;br /&gt;
* IPC mqueue sysctls are required, while in kernel they  can be missing&lt;br /&gt;
* In proto files for registers (and more) it's better to use fixed- types, rather than plain&lt;br /&gt;
* use fixed32 and fixed64 where approiate instead of uint32 and uint64 https://developers.google.com/protocol-buffers/docs/proto&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Shawn Landden</name></author>
	</entry>
	<entry>
		<id>https://criu.org/index.php?title=RPC&amp;diff=1282</id>
		<title>RPC</title>
		<link rel="alternate" type="text/html" href="https://criu.org/index.php?title=RPC&amp;diff=1282"/>
		<updated>2013-12-14T00:13:06Z</updated>

		<summary type="html">&lt;p&gt;Shawn Landden: /* Run */ systemd&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CRIU-RPC is a remote procedure call (RPC) protocol which uses Google Protocol Buffers to encode its calls. The requests are served by CRIU service launched with &amp;lt;code&amp;gt;criu service&amp;lt;/code&amp;gt; command. It uses a SEQPACKET Unix domain socket listening at &amp;lt;code&amp;gt;/var/run/criu-service.socket&amp;lt;/code&amp;gt; as a transport.&lt;br /&gt;
&lt;br /&gt;
== Protobuf messages ==&lt;br /&gt;
criu_req/criu_resp -- wrappers for requests/responses. They are to be used for transferring messages and needed to provide compatibility with an older versions of rpc. Field type in them _must_ be set accordingly to type of request/response that is stored. Types of request/response are defined in enum criu_req_type.&lt;br /&gt;
&lt;br /&gt;
=== Request ===&lt;br /&gt;
==== criu_req ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
message criu_req {&lt;br /&gt;
	required criu_req_type type	= 1;&lt;br /&gt;
&lt;br /&gt;
	optional criu_opts opts		= 2;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== criu_req_type ====&lt;br /&gt;
There are only 2 request/response types for now.&lt;br /&gt;
&amp;lt;pre&amp;gt;enum criu_req_type {&lt;br /&gt;
	EMPTY		= 0;&lt;br /&gt;
	DUMP		= 1;&lt;br /&gt;
	RESTORE		= 2;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== criu_opts ====&lt;br /&gt;
It is used to store options.&lt;br /&gt;
&amp;lt;pre&amp;gt;message criu_opts {&lt;br /&gt;
	required int32 images_dir_fd	= 1;&lt;br /&gt;
	optional int32 pid		= 2;&lt;br /&gt;
&lt;br /&gt;
	optional bool leave_running	= 3;&lt;br /&gt;
	optional bool ext_unix_sk	= 4;&lt;br /&gt;
	optional bool tcp_established	= 5;&lt;br /&gt;
	optional bool evasive_devices	= 6;&lt;br /&gt;
	optional bool shell_job		= 7;&lt;br /&gt;
	optional bool file_locks	= 8;&lt;br /&gt;
	optional int32 log_level	= 9 [default = 2];&lt;br /&gt;
	optional string log_file	= 10;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If no pid is set and type is DUMP, CRIU will dump client process by default.&lt;br /&gt;
Note: Whole tree &amp;lt;pid&amp;gt; must have the same uid, as a client, or client's uid must be == 0, otherwise CRIU won't dump nothing at all.&lt;br /&gt;
&lt;br /&gt;
Only images_dir_fd is required, all other fields may not be set.&lt;br /&gt;
Client must open directory for/with images by himself and set images_dir_fd to it's fd.&lt;br /&gt;
CRIU will open /proc/&amp;lt;client's_pid&amp;gt;/fd/&amp;lt;images_dir_fd&amp;gt;, so it will work, if client is in another namespace.&lt;br /&gt;
&lt;br /&gt;
The logic of setting request is the same as when setting options in console. Here is an example:&lt;br /&gt;
&amp;lt;pre&amp;gt;#criu restore -D /path/to/imgs_dir -v4 -o restore.log&amp;lt;/pre&amp;gt;&lt;br /&gt;
is equal to:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
request.type = RESTORE;&lt;br /&gt;
&lt;br /&gt;
request.opts.imgs_dir_fd	= open(&amp;quot;/path/to/imgs_dir&amp;quot;)&lt;br /&gt;
request.opts.log_level		= 4&lt;br /&gt;
request.opts.log_file		= &amp;quot;restore.log&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Response ===&lt;br /&gt;
==== criu_resp ====&lt;br /&gt;
&amp;lt;pre&amp;gt;message criu_resp {&lt;br /&gt;
	required criu_req_type type	= 1;&lt;br /&gt;
	required bool success		= 2;&lt;br /&gt;
&lt;br /&gt;
	optional criu_dump_resp	dump	= 3;&lt;br /&gt;
	optional criu_restore_resp restore = 4;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Field &amp;quot;success&amp;quot; reports result of processing request, while criu_***_resp store some request-specific information. The response type is set to the corresponding request type or to &amp;lt;code&amp;gt;EMPTY&amp;lt;/code&amp;gt; to report a &amp;quot;generic&amp;quot; error.&lt;br /&gt;
==== criu_dump_resp ====&lt;br /&gt;
criu_dump_resp is used to store dump response from CRIU.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
message criu_dump_resp {&lt;br /&gt;
	optional bool restored		= 1;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Field &amp;quot;restored&amp;quot; is set to &amp;quot;true&amp;quot; if process was restored.&lt;br /&gt;
&lt;br /&gt;
==== criu_restore_resp ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
message criu_restore_resp {&lt;br /&gt;
	required int32 pid		= 1;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Field &amp;quot;pid&amp;quot; is set to the PID of the restored process.&lt;br /&gt;
&lt;br /&gt;
== Run ==&lt;br /&gt;
=== Server ===&lt;br /&gt;
On a server side, CRIU creates SOCK_SEQPACKET Unix socket and listens for connections on it. After receiving criu_req, CRIU processes it, do what is requested and sends criu_resp with set request-specific criu_***_resp field back.&lt;br /&gt;
If CRIU gets unknown type of request, it will return criu_resp with type == EMPTY and success == false.&lt;br /&gt;
&lt;br /&gt;
To launch service server, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;#criu service [options]&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Options accepted by service are&lt;br /&gt;
&lt;br /&gt;
; --address &amp;lt;path&amp;gt;&lt;br /&gt;
: is where to put listening socket&lt;br /&gt;
&lt;br /&gt;
; --pid-file &amp;lt;path&amp;gt;&lt;br /&gt;
: is where to write pid of service process&lt;br /&gt;
&lt;br /&gt;
; --daemon&lt;br /&gt;
: tells service to daemonize&lt;br /&gt;
&lt;br /&gt;
; -o &amp;lt;file&amp;gt;&lt;br /&gt;
: says where to write logs&lt;br /&gt;
&lt;br /&gt;
; -v[N]&lt;br /&gt;
: sets the log-level&lt;br /&gt;
&lt;br /&gt;
====systemd====&lt;br /&gt;
If you are running systemd you can just:&lt;br /&gt;
;systemctl start criu.socket&lt;br /&gt;
&lt;br /&gt;
to get /var/run/criu-service.socket, and&lt;br /&gt;
;systemctl enable criu.socket&lt;br /&gt;
&lt;br /&gt;
to make /var/run/criu-service.socket available at boot&lt;br /&gt;
=== Client ===&lt;br /&gt;
Client, in its turn, must connect to service socket, send criu_req with request in it, and wait for a criu_resp with response.&lt;br /&gt;
You can find examples of client programs in C and Python in test/rpc/.&lt;br /&gt;
&lt;br /&gt;
With RPC facilities one can perform a [[self dump]].&lt;br /&gt;
&lt;br /&gt;
== Security ==&lt;br /&gt;
&lt;br /&gt;
See [[Usage#Security]].&lt;/div&gt;</summary>
		<author><name>Shawn Landden</name></author>
	</entry>
</feed>