[CRIU] PID mismatch problem

Cyrill Gorcunov gorcunov at gmail.com
Tue Dec 22 02:56:21 PST 2015


On Tue, Dec 22, 2015 at 11:37:55AM +0100, Federico Reghenzani wrote:
> Ok, I'm trying to restore in a new namespace (I would prefer this solution
> to start the orted directly in a dedicated namespace), but I can't do it
> with C API. From command line via ssh:
> 
> ssh root at 10.10.1.2 unshare -p --fork criu restore -D /tmp/ckpt_B2BLJ
> 
> it works (even if it provides some error messages), but using orted-restore
> in C API:
> 
>     unshare(CLONE_NEWPID);
	fork();

After unshare you need to call a fork as far as I remember
and continue inside child.

>     if (pid != 0) {
>          ...
>     }
>     // getpid == 1 now
>     dir = ...
>     criu_init_opts();
>     criu_set_images_dir_fd(dir);
>     criu_set_log_file("criu_restore.log");
>     criu_set_log_level(4);
>     int status = criu_restore_child();
> //or int status = criu_restore();
> 
> I obtain:
> 
>     Error (image.c:405): Can't open dir /proc/1/fd/11: No such device or
> address
>     Error (cr-service.c:254): Can't open images directory: No such device
> or address
> 
> I've never used unshare, so I probably missed something ;-)
> 
> ----
> 
> P.S. the tty problem happens only when I open an ssh session and then
> execute the command (sshd: root at pts/0), no problem if I call criu restore
> directly from ssh command (sshd: root at notty).

So you borrow the 0 index for sshd itself I guess, that;s why criu
is complaining. I think you shouldn't do that (but I'm not sure
how internally sshd operates with pty devices)


More information about the CRIU mailing list