Hi all,
I am running unprivileged non-root containers (lxc 4.0.11:latest
head). Everything works well. But I see this message in a log:
WARN start - start.c:lxc_spawn:1835 - Operation not permitted -
Failed to allocate new network namespace id
This message looks scary but if you look at the code, it actually
tries to create a netlink namespace (NEWNSID):
ret = lxc_netns_set_nsid(handler->ns
fd[LXC_NS_NET]);
if (ret < 0)
SYSWARN("Failed to allocate new network namespace id");
That must be equivalent AFAIU to:
$ ip netns add blah
But this operation probably requires having root permissions to make a
shared mount point, besides having the right permissions for the path:
mkdir("/var/run/netns", 0755) = -1 EACCES (Permission denied)
mount("", "/var/run/netns", 0x55f1735bd91f, MS_REC|MS_SHARED,
NULL) = -1 EPERM (Operation not permitted)
For example:
$ mount --make-shared /tmp/1
mount: /tmp/1: must be superuser to use mount.
So, it seems to me, that it's impossible to create an ip netns if the
euid is non-root. Am I correct?
If I am correct about this, shall not we patch LXC not to try to call
lxc_netns_set_nsid() if it is running unpriv containers with euid !=
0?
Related issue:
https://github.com/lxc/lxc/issues/4045
--
-- Regards,
-- Ivan