CRIU, a project to implement checkpoint/restore functionality for Linux
CRIU is a Linux tool for freezing and saving container/application states, enabling live migration and snapshots. Integrated into software like Docker, it offers CLI, RPC, and C API for checkpointing. Various resources and events showcase its capabilities and development progress.
Read original articleCRIU, or Checkpoint/Restore In Userspace, is a Linux software that enables freezing a running container or application and saving its state to disk for later restoration. This functionality allows for live migration, snapshots, remote debugging, and more. Initially a Virtuozzo project, CRIU has evolved with community support and is now integrated into various software like OpenVZ, LXC/LXD, Docker, and Podman. Users can access CRIU through different installation methods and utilize its CLI, RPC, and C API for checkpoint/restore operations. The project also offers usage scenarios, troubleshooting guides, and information on what can and cannot be checkpointed. For those interested in development, there are resources available such as mailing lists, image file format descriptions, and plugins. CRIU's capabilities are showcased through events like CloudNativeSecurityCon and Open Source Summit, highlighting topics such as container checkpointing in Kubernetes and GPU-accelerated containers. Additionally, the project provides insights into upcoming features, ongoing development tasks, and external articles related to checkpointing technologies.
Related
FreeBSD Bhyve Companion Tools
The author details transitioning from VirtualBox to FreeBSD Bhyve, praising Bhyve's benefits in a FreeBSD setting. Tools like VNC connection and pause/resume scripts optimize Bhyve operations, simplifying VM management.
I found an 8 years old bug in Xorg
An 8-year-old Xorg bug related to epoll misuse was found by a picom developer. The bug caused windows to disappear during server lock, traced to CloseDownClient events. Despite limited impact, the developer seeks alternative window tree updates, emphasizing testing and debugging tools.
SquirrelFS: Using the Rust compiler to check file-system crash consistency
The paper introduces SquirrelFS, a crash-safe file system using Rust's typestate pattern for compile-time operation order enforcement. Synchronous Soft Updates ensure crash safety by maintaining metadata update order. SquirrelFS offers correctness guarantees without separate proofs, quickly verifying crash consistency during compilation. Comparative evaluations show SquirrelFS performs similarly or better than NOVA and WineFS.
Writing an IR from Scratch and survive to write a post
Eduardo Blázquez developed an Intermediate Representation (IR) for the Kunai Static Analyzer during his PhD, aiming to enhance Dalvik bytecode analysis. The project, shared on GitHub and published in SoftwareX, transitioned to Shuriken. Blázquez drew inspiration from Triton and LLVM, exploring various IR structures like ASTs and CFGs. MjolnIR, Kunai's IR, utilized a Medium Level IL design with control-flow graphs representing methods. Blázquez's approach involved studying compiler design resources.
Homegrown Rendering with Rust
Embark Studios develops a creative platform for user-generated content, emphasizing gameplay over graphics. They leverage Rust for 3D rendering, introducing the experimental "kajiya" renderer for learning purposes. The team aims to simplify rendering for user-generated content, utilizing Vulkan API and Rust's versatility for GPU programming. They seek to enhance Rust's ecosystem for GPU programming.
[1]: https://github.com/qawolf/crik
[2]: The Party Must Go On - Resume Pods After Spot Instance Shutdown, https://kccnceu2024.sched.com/event/1YeP3
The project ended up being a dead end because it turned out running my program in a QEMU whole system vm and then fork()ING QEMU worked faster.
Since everyone is treating containers as cattle CRIU doesn't seem to get much attention, and might be why a video and not a blog post was my first introduction.
Just a few months ago I was talking to a startup founder at KubeCon who built a product based on CRIU. Unfortunately I forgot the company's name. (And I can't find that git repo with the prototype anywhere, even in my backups. Sad.)
Unfortunately, I was disappointed to find `lxd stop --stateful` couldn't save any of my LXD containers. There was always some error or other. This is how I learned about CRIU, as it was due to limitations of CRIU when used with the sorts of things running in LXD.
# lxc stop --stateful test
(00.121636) Error (criu/namespaces.c:423): Can't dump nested uts namespace for 2685261
(00.121645) Error (criu/namespaces.c:682): Can't make utsns id
(00.150794) Error (criu/util.c:631): exited, status=1
(00.190680) Error (criu/util.c:631): exited, status=1
(00.191997) Error (criu/cr-dump.c:1768): Dumping FAILED.
Error: snapshot dump failed
LXD is generally used with "distro-like" containers, like running a small Debian or Ubuntu distro, rather than single-application containers as are used with Docker.It turns out CRIU can't save the state of those types of containers, so in practice `lxd stop --stateful` never worked for me.
I'd have to switch to VMs if I want their state saved across host reboots, but those don't have other behaviours regarding host-guest filesystem sharing that I needed.
In practice this meant I had to live with never rebooting the host. Thankfully Linux just keeps on working for years without a reboot :-)
Back then, CRIU turned out to not be an option for us. E.g. one of the problems was that it was not possible to be used as non-root (https://github.com/checkpoint-restore/criu/pull/1930). I see that this PR was merged now, so maybe this works now? Not sure if there are other issues.
We also considered DMTCP (https://github.com/dmtcp/dmtcp/) as another alternative to CRIU, but that had other issues (I don't remember).
The solution I ended up was to implement a fork server. Some server proc starts initially and only preloads the modules and maybe other things, and then waits. Once I want to execute some script, I can fork from the server and use this forked process right away. I used similar logic as in reptyr (https://github.com/nelhage/reptyr) to redirect the PTY. This worked quite well.
Getting the code cleaned up enough to post it has been on my to-do list for quite some time, and this has inspired me to do it soon!
It's useful because, by design, it's difficult for the process to even notice it's been stopped. And while it's stopped, you can apply arbitrary patches completely atomically.
And Docker is a very convenient way to do this, e.g. workaround the PID limitation.
(Though I really wish it got more attention https://github.com/docker/cli/issues/4245 )
For long running containerised simulations, this saves a lot of time on failures ( as long as you have a safe place to write the snapshots to ) by not restarting from 0 every time.
Related
FreeBSD Bhyve Companion Tools
The author details transitioning from VirtualBox to FreeBSD Bhyve, praising Bhyve's benefits in a FreeBSD setting. Tools like VNC connection and pause/resume scripts optimize Bhyve operations, simplifying VM management.
I found an 8 years old bug in Xorg
An 8-year-old Xorg bug related to epoll misuse was found by a picom developer. The bug caused windows to disappear during server lock, traced to CloseDownClient events. Despite limited impact, the developer seeks alternative window tree updates, emphasizing testing and debugging tools.
SquirrelFS: Using the Rust compiler to check file-system crash consistency
The paper introduces SquirrelFS, a crash-safe file system using Rust's typestate pattern for compile-time operation order enforcement. Synchronous Soft Updates ensure crash safety by maintaining metadata update order. SquirrelFS offers correctness guarantees without separate proofs, quickly verifying crash consistency during compilation. Comparative evaluations show SquirrelFS performs similarly or better than NOVA and WineFS.
Writing an IR from Scratch and survive to write a post
Eduardo Blázquez developed an Intermediate Representation (IR) for the Kunai Static Analyzer during his PhD, aiming to enhance Dalvik bytecode analysis. The project, shared on GitHub and published in SoftwareX, transitioned to Shuriken. Blázquez drew inspiration from Triton and LLVM, exploring various IR structures like ASTs and CFGs. MjolnIR, Kunai's IR, utilized a Medium Level IL design with control-flow graphs representing methods. Blázquez's approach involved studying compiler design resources.
Homegrown Rendering with Rust
Embark Studios develops a creative platform for user-generated content, emphasizing gameplay over graphics. They leverage Rust for 3D rendering, introducing the experimental "kajiya" renderer for learning purposes. The team aims to simplify rendering for user-generated content, utilizing Vulkan API and Rust's versatility for GPU programming. They seek to enhance Rust's ecosystem for GPU programming.