[CRIU] [PATCH 00/11] tty: Add c/r for system console

Tycho Andersen tycho.andersen at canonical.com
Mon Sep 29 16:31:51 PDT 2014


Hi Cyrill,

On Mon, Sep 29, 2014 at 08:25:26PM +0400, Cyrill Gorcunov wrote:
> Hi guys, here is a series which implements c/r for /dev/console,
> I'm not really sure how to test it -- I simply modified our pty00
> test case adding
> 
> 	console = open("/dev/console", O_RDONLY);
> 
> into it to check that c/r flow takes proper branches (and looked
> into image data).
> 
> I guess some help needed presumably attempting to c/r lxc conatiner
> with /dev/console bound to some readable output.
> 
> Anyway, any feedback would be highly appreciated!

Thanks for your work on this set. This patch does fix the aforementioned bug
about not being able to checkpoint containers that have been restored. (I'm not
sure which patch does it, but with the entire series applied it works just
fine. I can go back and find out if this information would be useful.)

However, when I try to checkpoint a container with /dev/console and some ttys, I
get:

Error (mount.c:453): 113:./dev/lxc/tty4 doesn't have a proper root mount

On an LXC in my system with ttys enabled, the /proc/self/mountinfo has:

ubuntu at u1:~$ cat /proc/self/mountinfo 
75 76 253:1 /usr/local/var/lib/lxc/u1/rootfs / rw,relatime - ext4 /dev/disk/by-uuid/7fd0b676-46f3-46d6-94a6-5c620e72e7b0 rw,data=ordered
103 75 0:35 / /proc rw,nosuid,nodev,noexec,relatime - proc proc rw
104 75 0:33 / /sys rw,relatime - sysfs sysfs rw
105 104 0:18 / /sys/fs/fuse/connections rw,relatime - fusectl none rw
106 104 0:6 / /sys/kernel/debug rw,relatime - debugfs none rw
107 104 0:10 / /sys/kernel/security rw,relatime - securityfs none rw
108 104 0:22 / /sys/fs/pstore rw,relatime - pstore none rw
109 75 0:12 /7 /dev/lxc/console rw,nosuid,noexec,relatime - devpts devpts rw,gid=5,mode=620,ptmxmode=000
110 75 0:12 /1 /dev/lxc/tty1 rw,nosuid,noexec,relatime - devpts devpts rw,gid=5,mode=620,ptmxmode=000
111 75 0:12 /3 /dev/lxc/tty2 rw,nosuid,noexec,relatime - devpts devpts rw,gid=5,mode=620,ptmxmode=000
112 75 0:12 /5 /dev/lxc/tty3 rw,nosuid,noexec,relatime - devpts devpts rw,gid=5,mode=620,ptmxmode=000
113 75 0:12 /6 /dev/lxc/tty4 rw,nosuid,noexec,relatime - devpts devpts rw,gid=5,mode=620,ptmxmode=000
77 75 0:36 / /dev/pts rw,relatime - devpts devpts rw,gid=5,mode=620,ptmxmode=666
78 75 0:36 /ptmx /dev/ptmx rw,relatime - devpts devpts rw,gid=5,mode=620,ptmxmode=666
79 104 0:37 / /sys/fs/cgroup rw,relatime - tmpfs none rw,size=4k,mode=755
80 75 0:38 / /run rw,nosuid,noexec,relatime - tmpfs none rw,size=200060k,mode=755
81 80 0:39 / /run/lock rw,nosuid,nodev,noexec,relatime - tmpfs none rw,size=5120k
82 80 0:40 / /run/shm rw,nosuid,nodev,relatime - tmpfs none rw
83 80 0:41 / /run/user rw,nosuid,nodev,noexec,relatime - tmpfs none rw,size=102400k,mode=755

When I try to work around that with something like,

diff --git a/mount.c b/mount.c
index 8c60693..a28e041 100644
--- a/mount.c
+++ b/mount.c
@@ -433,8 +433,19 @@ static int validate_mounts(struct mount_info *info, bool for_dump)
 					ret = run_plugins(DUMP_EXT_MOUNT, m->mountpoint, m->mnt_id);
 					if (ret == 0)
 						m->need_plugin = true;
-					else if (ret == -ENOTSUP)
-						ret = try_resolve_ext_mount(m);
+					else if (ret == -ENOTSUP) {
+						/* inside containers
+						 * /dev/console and /dev/tty*
+						 * are mounted from paths like
+						 * /5 or /6, so we ignore
+						 * their path here if things
+						 * go bad.
+						 */
+						if (m->fstype->code == FSTYPE__DEVPTS)
+							ret = 0;
+						else
+							ret = try_resolve_ext_mount(m);
+					}
 				} else {
 					if (m->need_plugin || m->external)
 						/*


I hit:

(00.247031) Error (tty.c:233): tty: Unexpected format on path /dev/lxc/tty4

which looks like it might be a bigger problem :)

Any thoughts are appreciated.

Tycho


More information about the CRIU mailing list