0

I wanted to play around with criu, a project for checkpointing/restoring linux processes. For that I am playing around with the hello-world of criu, which is checkpointing and restoring a simple loop.

I executed the following steps:

create a simple looping program:

$ cat > test.sh <<-EOF
#!/bin/sh
while :; do
    sleep 1
    date
done
EOF
$ chmod +x test.sh

run it:

$ ./test.sh
$ ps -C test.sh
  PID TTY          TIME CMD
  2621 pts/1    00:00:00 test.sh

dump it:

# sudo criu dump -vvvv -o dump.log -t 2621 --shell-job && echo OK
OK

restore it:

#  sudo criu restore -vvvv -o restore.log --shell-job

The restoring does not work. It should restore the loop process where it left off. The process should continue to print in the console, but nothing happens. There are also no error messages.

My System:

Ubuntu 19.04

criu 3.8.1

User12547645
  • 183
  • 2
  • 6
  • Any error messages will be stored in `restore.log` (and `dump.log`) file. Please check their content. One thing to note is that you have not used the `-D|--images-dir` option. This implies that all image files will be stored in the current working directory. Therefore, both `criu dump` and `criu restore` commands should be called in the same current working directory. – Radostin Stoyanov Jun 23 '19 at 10:20

2 Answers2

1

You should to read documentation more closer:

Run (isolated)

Now, if you try to simply run and try to dump such a program, criu will fail. The reason is a program you launch from the shell shares some common resources with the shell, notably its session and terminal. Criu has a built-in check that makes sure there are no such resources.

To remove the dependency on a current terminal, let's executed our script in a new session and redirect its output to a file:

$ setsid ./test.sh < /dev/null &> test.log & [2] 2220 [2]+ Done
setsid ./test.sh < /dev/null &>test.log

Yurij Goncharuk
  • 4,177
  • 2
  • 19
  • 36
  • I know. This is why I added the --shell-job parameter. The code that I posted is the second example from the documentation that you are reffing to. – User12547645 May 16 '19 at 08:19
0

This series of commands worked on my system.

sudo criu dump --images-dir ~/checkpoint --tree 2459 --shell-job

sudo criu restore -D ~/checkpoint --shell-job
bftjoe
  • 1