Using CRIU with Tmux - nova-dev-team/nova GitHub Wiki
Restoring the PID
The PID restore process of CRIU requires write accessibility to the /proc/sys/kernel/ns_last_pid
in procfs. Actually, one can perform a thorough examination of the requirements of CRIU by running criu check
, which is included in modern versions of CRIU.
However, when launching a container from libvirt the /proc/sys
file system is mounted as read-only (ro
). The user has to manually remount it as read&write (rw
). In our lxc-cr-wrapper
('cr' is the short for 'checkpoint and restore'), however, the check and remount process is done automatically whenever a C/R operation is performed.
Open a psuedo terminal with Tmux
If the user (literally, the 'user', since CRIU is mostly a user space tool) feels like checking point a program with tty output she may use the argument --shell-job
. Our wrapper opens a psuedo terminal using Tmux to make it work. Tmux is a great utility and it works robustly in most cases. However, one should notice that the terminal devices under /dev/pts
must be identical (EXACTLY the same) when checking point and restoring. This is very important if there are other users who log into the container using ssh
, since ssh
creates a psuedo terminal as well.