Difference between revisions of "LXC"

From CRIU
Jump to navigation Jump to search
(use source highlighting)
 
(One intermediate revision by one other user not shown)
Line 23: Line 23:
 
cat | sudo tee -a /var/lib/lxc/u1/config << EOF
 
cat | sudo tee -a /var/lib/lxc/u1/config << EOF
 
# hax for criu
 
# hax for criu
lxc.console = none
+
lxc.console.path = none
lxc.tty = 0
+
lxc.tty.max = 0
 
lxc.cgroup.devices.deny = c 5:1 rwm
 
lxc.cgroup.devices.deny = c 5:1 rwm
 +
# on older lxc comment the above and uncomment the below
 +
# lxc.console = none
 +
# lxc.tty = 0
 +
# lxc.cgroup.devices.deny = c 5:1 rwm
 
EOF
 
EOF
 
</source>
 
</source>
Line 49: Line 53:
 
</source>
 
</source>
  
===Troubleshooting===
+
== Troubleshooting ==
 
   
 
   
 
=== Error (mount.c:805): fusectl isn't empty: 8388625 ===
 
=== Error (mount.c:805): fusectl isn't empty: 8388625 ===

Latest revision as of 04:33, 1 July 2024

Requirements[edit]

You should have built and installed a recent (>= 1.3.1) version of CRIU.

Checkpointing and restoring a container[edit]

LXC upstream has begun to integrate checkpoint/restore support through the lxc-checkpoint tool. This functionality has been in the recent released version of LXC---LXC 1.1.0 , you can install the LXC 1.1.0 or you can check out the development version on Ubuntu by doing:

sudo add-apt-repository ppa:ubuntu-lxc/daily
sudo apt-get update
sudo apt-get install lxc

Next, create a container:

 sudo lxc-create -t ubuntu -n u1 -- -r trusty -a amd64

And add the following lines (as above) to its config:

cat | sudo tee -a /var/lib/lxc/u1/config << EOF
# hax for criu
lxc.console.path = none
lxc.tty.max = 0
lxc.cgroup.devices.deny = c 5:1 rwm
# on older lxc comment the above and uncomment the below
# lxc.console = none
# lxc.tty = 0
# lxc.cgroup.devices.deny = c 5:1 rwm
EOF

Finally, start, and checkpoint the container:

sudo lxc-start -n u1
sleep 5s  # let the container get to a more interesting state
sudo lxc-checkpoint -s -D /tmp/checkpoint -n u1

At this point, the container's state is stored in /tmp/checkpoint, and the filesystem is in /var/lib/lxc/u1/rootfs. You can restore the container by doing:

sudo lxc-checkpoint -r -D /tmp/checkpoint -n u1

And then, get your container's IP and ssh in:

ssh ubuntu@$(sudo lxc-info -i -H -n u1)

Troubleshooting[edit]

Error (mount.c:805): fusectl isn't empty: 8388625[edit]

Dumping of fuse filesystems is currently not supported. Empty the container's /sys/fs/fuse/connections and try again.

Error (mount.c:517): Mount 58 (master_id: 12 shared_id: 0) has unreachable sharing[edit]

CRIU doesn't yet support shared mountpoints as LXC does; make sure your rootfs is on a non-shared mount.

External links[edit]