CRIU, a system to save and restore the state of processes in Linux

CRIU (Checkpoint and Restore In Userspace) is a tool that allows you to save the state of one or a group of processes and then resume work from the saved position, even after restarting the system or on another server without breaking already established network connections.

With this tool, it is possible to freeze a running application (or part of it) and put it on persistent storage as a collection of files. The files can then be used to restore and run the application from where it was frozen.

The distinctive feature of the CRIU project is that it is implemented primarily in user space, rather than in the kernel.

About CRIU

The CRIU tool is being developed as part of the OpenVZ project, with the goal of overriding the checkpoint / restore in the kernel.

Although their primary focus is supporting container migration, allowing users to verify and restore the current state of running processes and process groups.

Currently, the tool can be used on x86-64 and ARM systems y supports the following functions:

  • Processes: their hierarchy, PIDs, user and group authenticators (UID, GID, SID, etc.), system capabilities, threads, and running and stopped states
  • Application memory: memory mapped files and shared memory
  • Open files
  • Pipes and FIFOs
  • Unix domain sockets
  • Network sockets, including TCP sockets in the ESTABLISHED state
  • System V IPC
  • Timers
  • Signals
  • Tips
  • Kernel calls to specific system: inotify, signalfd, eventfdyepoll

Between application areas of CRIU technology, it is observed that the operating system restarts without interrupting the continuity of the processes long-running, isolated containers live migration, speeding up the launch of slow processes (can start from saved state after initialization), performing kernel updates without restarting services, periodically saving long-running state of tasks to resume work in the event of a crash, load balance across clustered nodes, duplicate processes on another machine (branch to a remote system), create snapshots of user applications during operation for analysis on another system or on in case you need to cancel more actions in program. CRIU is used in container management systems like OpenVZ, LXC / LXD, and Docker.

About the new version of CRIU 3.15

Currently the tool is in its version 3.15, which was recently launched and it introduces the criu-image-streamer service, which allows the transmission of process images directly from / to CRIUs during freeze / restore operations.

  • Images can be transferred from external storage (S3, GCS, etc.) without buffering on the local file system.
  • Support for MIPS architecture was added.
  • Allowed to freeze processes not belonging to the existing PID namespace, followed by restore to the existing PID namespace.
  • Additional mechanisms were added to verify files.
  • Added support for freezing and restoring BPF structures BPF_HASH_OF_MAPS and BPF_ARRAY_OF_MAPS.
  • Added initial support for the second version of cgroup.

How to install CRIU on Linux?

For those who are interested in being able to install this tool, they should know that it is available within the official channels of most Linux distributions.

So in order to install the tool just open a terminal and with the help of your package manager look for the tool or use one of the following commands that we share.

For the case of those who are Debian, Ubuntu users and derivatives of these two:

sudo apt install criu

While for those who are users of Arch Linux and any derivatives of it:

sudo pacman -S criu

In the case of those who are users of opensuse:

sudo zypper install criu

Finally for those who want to compile the tool they can do it by typing:

git clone https://github.com/checkpoint-restore/criu.git
cd criu
make clean
make
make install
sudo criu check
sudo criu check --all

If you want to know more about it about this tool, you can check the details In the following link.


Leave a Comment

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

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.