[lxc-devel] [PATCH] Remove /dev/kmsg symlinking.

Serge Hallyn serge.hallyn at canonical.com
Mon Jan 7 15:05:32 UTC 2013


Quoting Alexander Vladimirov (alexander.idkfa.vladimirov at gmail.com):
> Symlink cannot resemble /dev/kmsg semantics, so symlinking it is wrong.

Hm.  It works fine in my containers, and gives me nice startup messages
on console.

> Guests probably should not use /dev/kmsg at all.
> Fixes journald crashes and journal corruption in systemd guests.

Can you show exactly what causes the crashes?

I'm not entirely opposed, since eventually (probably soon) we'll
(at least conditionally) remove it anyway, when /dev/kmsg can be
protected by user namespace (or even better be namespaced in
syslogns).

-serge


> ---
>  src/lxc/conf.c | 30 ------------------------------
>  1 file changed, 30 deletions(-)
> 
> diff --git a/src/lxc/conf.c b/src/lxc/conf.c
> index 4f041dc..85d72c9 100644
> --- a/src/lxc/conf.c
> +++ b/src/lxc/conf.c
> @@ -1313,33 +1313,6 @@ static int setup_console(const struct lxc_rootfs *rootfs,
>  	return setup_ttydir_console(rootfs, console, ttydir);
>  }
>  
> -static int setup_kmsg(const struct lxc_rootfs *rootfs,
> -		       const struct lxc_console *console)
> -{
> -	char kpath[MAXPATHLEN];
> -	int ret;
> -
> -	if (!rootfs->path)
> -		return 0;
> -	ret = snprintf(kpath, sizeof(kpath), "%s/dev/kmsg", rootfs->mount);
> -	if (ret < 0 || ret >= sizeof(kpath))
> -		return -1;
> -
> -	ret = unlink(kpath);
> -	if (ret && errno != ENOENT) {
> -		SYSERROR("error unlinking %s\n", kpath);
> -		return -1;
> -	}
> -
> -	ret = symlink("console", kpath);
> -	if (ret) {
> -		SYSERROR("failed to create symlink for kmsg");
> -		return -1;
> -	}
> -
> -	return 0;
> -}
> -
>  int setup_cgroup(const char *name, struct lxc_list *cgroups)
>  {
>  	struct lxc_list *iterator;
> @@ -2566,9 +2539,6 @@ int lxc_setup(const char *name, struct lxc_conf *lxc_conf)
>  		return -1;
>  	}
>  
> -	if (setup_kmsg(&lxc_conf->rootfs, &lxc_conf->console))  // don't fail
> -		ERROR("failed to setup kmsg for '%s'", name);
> -
>  	if (setup_tty(&lxc_conf->rootfs, &lxc_conf->tty_info, lxc_conf->ttydir)) {
>  		ERROR("failed to setup the ttys for '%s'", name);
>  		return -1;
> -- 
> 1.8.1
> 
> 
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_123012
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel




More information about the lxc-devel mailing list