-
Notifications
You must be signed in to change notification settings - Fork 662
Open
Description
Code i wrote:
[chamber@cognitive ~]$ cat main.c
#include <stdio.h>
#include <unistd.h>
int main() {
printf("Process started in user namespace (PID: %d)\n", getpid());
while (1) {
printf("Running...\n");
sleep(1);
}
return 0;
}
Ran in new user namespace:
[chamber@cognitive ~]$ unshare --user --map-root-user ./exec
Process started in user namespace (PID: 43804)
Running...
Running...
Running...
Running...
Running...
Running...
Running...
for dumping :
sudo ./criu/scripts/criu-ns dump -t 43804 -D checkpoint/ -j -v4
dump log :
(00.012483)
(00.012484) Dumping pstree (pid: 43804)
(00.012485) ----------------------------------------
(00.012486) Process: 43804(43804)
(00.012498) ----------------------------------------
(00.012504) Dumping 43804(43804)'s namespaces
(00.012505) Namespaces dump complete
(00.012520) cg: Dumping 1 sets
(00.012522) cg: `- Dumping of /user.slice/user-1000.slice/user@1000.service/app.slice/app-org.gnome.Terminal.slice/vte-spawn-472df527-db2e-428c-b76d-068cd9bef18e.scope
(00.012524) cg: Writing CG image
(00.012537) unix: Dumping external sockets
(00.012576) tty: Unpaired slave 1
(00.012579) Writing image inventory (version 1)
(00.012623) Running post-dump scripts
(00.012625) Unfreezing tasks into 2
(00.012626) Unseizing 43804 into 2
(00.012740) Writing stats
(00.012758) Dumping finished successfully
for restore :
sudo ./criu/scripts/criu-ns restore -D checkpoint/ -v4
restore log:
['./criu/scripts/criu-ns', 'restore', '-D', 'checkpoint/', '-v4']
(00.000002) Version: 3.16.1 (gitid 0)
(00.000011) Running on cognitive.local Linux 6.8.0-52-generic #53~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Jan 15 19:18:46 UTC 2 x86_64
(00.000018) Loaded kdat cache from /run/criu.kdat
(00.000025) rlimit: RLIMIT_NOFILE unlimited for self
(00.000080) cpu: x86_family 6 x86_vendor_id GenuineIntel x86_model_id 11th Gen Intel(R) Core(TM) i3-1125G4 @ 2.00GHz
(00.000083) cpu: fpu: xfeatures_mask 0x2e5 xsave_size 2696 xsave_size_max 2696 xsaves_size 2456
(00.000088) cpu: fpu: x87 floating point registers xstate_offsets 0 / 0 xstate_sizes 160 / 160
(00.000090) cpu: fpu: AVX registers xstate_offsets 576 / 576 xstate_sizes 256 / 256
(00.000093) cpu: fpu: AVX-512 opmask xstate_offsets 1088 / 832 xstate_sizes 64 / 64
(00.000094) cpu: fpu: AVX-512 Hi256 xstate_offsets 1152 / 896 xstate_sizes 512 / 512
(00.000097) cpu: fpu: AVX-512 ZMM_Hi256 xstate_offsets 1664 / 1408 xstate_sizes 1024 / 1024
(00.000099) cpu: fpu: Protection Keys User registers xstate_offsets 2688 / 2432 xstate_sizes 8 / 8
(00.000102) cpu: fpu:1 fxsr:1 xsave:1 xsaveopt:1 xsavec:1 xgetbv1:1 xsaves:1
(00.000126) kernel pid_max=4194304
(00.000128) Reading image tree
(00.000142) Add mnt ns 6 pid 43804
(00.000145) Add net ns 2 pid 43804
(00.000146) Add pid ns 1 pid 43804
(00.000148) pstree pid_max=43804
(00.000151) Will restore in 10000000 namespaces
(00.000153) NS mask to use 10000000
(00.000170) Collecting 51/56 (flags 3)
(00.000173) No memfd.img image
(00.000175) `- ... done
(00.000176) Collecting 40/54 (flags 2)
(00.000182) Collected [home/chamber/exec] ID 0x1
(00.000185) Collected [usr/lib/x86_64-linux-gnu/libc.so.6] ID 0x2
(00.000188) Collected [usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2] ID 0x3
(00.000190) Collected [dev/pts/1] ID 0x5
(00.000194) Collected [home/chamber] ID 0x6
(00.000196) Collected [.] ID 0x7
(00.000198) `- ... done
(00.000200) Collecting 46/68 (flags 0)
(00.000202) No remap-fpath.img image
(00.000204) `- ... done
(00.000207) No apparmor.img image
(00.000217) cg: Preparing cgroups yard (cgroups restore mode 0x4)
(00.000312) cg: Opening .criu.cgyard.uUTaL7 as cg yard
(00.000319) cg: Making controller dir .criu.cgyard.uUTaL7/unifie ()
(00.000337) cg: Determined cgroup dir unifie/user.slice/user-1000.slice/user@1000.service/app.slice/app-org.gnome.Terminal.slice/vte-spawn-472df527-db2e-428c-b76d-068cd9bef18e.scope already exist
(00.000339) cg: Skip restoring properties on cgroup dir unifie/user.slice/user-1000.slice/user@1000.service/app.slice/app-org.gnome.Terminal.slice/vte-spawn-472df527-db2e-428c-b76d-068cd9bef18e.scope
(00.000346) Running pre-restore scripts
(00.000520) No pidns-1.img image
(00.000557) uns: Daemon started
(00.000581) Forking task with 43804 pid (flags 0x10000000)
(00.000583) Creating process using clone3()
(00.000714) PID: real 43804 virt 43804
(00.000776) Wait until namespaces are created
(00.000883) 43804: timens: monotonic -1145 939127350
(00.000892) 43804: timens: boottime -1145 939117920
(00.000933) Running setup-namespaces scripts
(00.000954) 43804: cg: Move into 2
(00.000957) 43804: cg: `-> unifie//user.slice/user-1000.slice/user@1000.service/app.slice/app-org.gnome.Terminal.slice/vte-spawn-472df527-db2e-428c-b76d-068cd9bef18e.scope/cgroup.procs
(00.000961) 43804: uns: calling userns_move (-1, 0)
(00.001004) uns: daemon calls 0x5925d3ed97e0 (43804, -1, 0)
(00.010497) 43804: Calling restore_sid() for init
(00.010540) 43804: Error (criu/util.c:1392): Unable to open the proc file system: Operation not permitted
(00.010616) uns: calling exit_usernsd (-1, 1)
(00.010636) uns: daemon calls 0x5925d3f14b00 (1, -1, 1)
(00.010644) uns: `- daemon exits w/ 0
(00.011349) Error (criu/cr-restore.c:1480): 43804 killed by signal 9: Killed
(00.011362) uns: daemon stopped
(00.011365) Error (criu/cr-restore.c:2447): Restoring FAILED.
why its showing restoring failed???