[libvirt-users] Problem about lxc-enter-namespace interface
Gao feng
gaofeng at cn.fujitsu.com
Thu Nov 14 11:30:11 UTC 2013
On 11/14/2013 05:40 PM, hzguanqiang at corp.netease.com wrote:
> On 2013-11-14 16:40 , Gao feng <mailto:gaofeng at cn.fujitsu.com> wrote:
>
> On 11/14/2013 03:09 PM, hzguanqiang at corp.netease.com wrote:
> > On 2013-11-14 15:03 , Gao feng <mailto:gaofeng at cn.fujitsu.com> wrote:
> >
> > On 11/14/2013 02:57 PM, hzguanqiang at corp.netease.com wrote:
> > > On 2013-11-14 14:17 , Gao feng <mailto:gaofeng at cn.fujitsu.com> wrote:
> > >
> > > On 11/14/2013 01:52 PM, hzguanqiang at corp.netease.com wrote:
> > > > On 2013-11-14 13:41 , Gao feng <mailto:gaofeng at cn.fujitsu.com> wrote:
> > > >
> > > > On 11/14/2013 01:24 PM, Gao feng wrote:
> > > > > On 11/14/2013 10:59 AM, hzguanqiang at corp.netease.com wrote:
> > > > >> Hi experts,
> > > > >>
> > > > >> When I test lxc-enter-namespace interface, it turned out such an error:
> > > > >>
> > > > >> hzguanqiang at debian:~$ <mailto:hzguanqiang at debian:~$> vir version
> > > > >> Compiled against library: libvirt 1.1.4
> > > > >> Using library: libvirt 1.1.4
> > > > >> Using API: LXC 1.1.4
> > > > >> Running hypervisor: LXC 3.9.6
> > > > >>
> > > > >> hzguanqiang at debian:~$ <mailto:hzguanqiang at debian:~$> vir list
> > > > >> Id Name State
> > > > >> ----------------------------------------------------
> > > > >> 1544 instance-00000015 running
> > > > >>
> > > > >> hzguanqiang at debian:~$ <mailto:hzguanqiang at debian:~$> vir lxc-enter-namespace 1544 --noseclabel /bin/df -hl
> > > > >> error: Cannot get namespaces for 1545: Function not implemented
> > > > >>
> > > > >> hzguanqiang at debian:~$ <mailto:hzguanqiang at debian:~$> ls /proc/self/ns
> > > > >> ipc mnt net pid user uts
> > > > >>
> > > > >> What's the problem?
> > > > >>
> > > > >
> > > > > Does your system have system call setns?
> > > >
> > > > grep setns /proc/kallsyms
> > > > and
> > > > grep setns the config.log of libvirt.
> > > >
> > > >
> > > > Hi, Gaofeng, thanks for your help. The info you want are:
> > > >
> > >
> > > Hi,
> > >
> > > > hzguanqiang at debian:~/github/libvirt$ <mailto:hzguanqiang at debian:~/github/libvirt$> sudo grep setns /var/log/libvirt/libvirtd.log
> > >
> > > config.log not libvirtd.log, or you can exec "./configure | grep setns" under libvirt source directory.
> > >
> > > > hzguanqiang at debian:~/github/libvirt$ <mailto:hzguanqiang at debian:~/github/libvirt$> grep setns /proc/kallsyms
> > > > ffffffff8105b993 T sys_setns
> > > >
> > > > What I found really strange is that the error info returned by the command.
> > > > hzguanqiang at debian:~$ <mailto:hzguanqiang at debian:~$> vir lxc-enter-namespace 1544 --noseclabel /bin/df -hl
> > > > error: Cannot get namespaces for 1545: Function not implemented
> > > > The instance id is 1544, but the error info hint cannot get ns for 1545.
> > > >
> > >
> > > we have two libvirt lxc related process at the first start,
> > > one is controller process on host(pid 1544), the other is the container's init task(pid 1545).
> > > since lxc-enter-namespace wants to exec cmd in container environment. so
> > > libvirt will try to get the namespaces of container's init task.
> > >
> > > The problem is libvirt/autoconf thinks your system doesn't support setns system call...
> > >
> > > > The libvirt code of mine is of version 1.1.4 from github (git checkout v1.1.4 -b stable1.1.4 )
> > > >
> > >
> > > I don't know if the libvirt git repo on github is the right thing, but As I know
> > > this repo git://libvirt.org/libvirt.git is official.
> > >
> > > Please have a try.
> > >
> > >
> > > Thanks
> > >
> > >
> > > Sorry, I made a mistake about the libvirt repo, the code I used is just from the official repo.
> > > Maybe it's problem of my kernel. I've tried to build libvirt from code of master branch. The
> > > mistake is just the same.
> > >
> >
> > what's result of "./configure | grep setns"
> >
> >
> >
> >
> > The result is:
> > hzguanqiang at debian:~/github/libvirt$ <mailto:hzguanqiang at debian:~/github/libvirt$> ./configure | grep setns
> > checking for setns... no
> >
> > Is there something need to configure for setns system call? Or something is wrong with my kernel?
> >
>
> Seem your kernel has setns, but autoconf doesn't recognise it.
> you can modify the config.h, change as below
> #define HAVE_SETNS 1
> and make && make install
>
>
> Hi gaofeng,
> I tried as you said, but it report an error when do make operation as following:
>
> util/virprocess.c: In function 'virProcessSetNamespaces':
> util/virprocess.c:568:9: error: implicit declaration of function 'setns' [-Werror=implicit-function-declaration]
> util/virprocess.c:568:9: error: nested extern declaration of 'setns' [-Werror=nested-externs]
> cc1: all warnings being treated as errors
> make[3]: *** [util/libvirt_util_la-virprocess.lo] Error 1
>
> I think something must be wrong about setns system call in my environment.
> But still thanks very much for your help.
>
maybe you need to do make headers_install or make header_install_all under kernel source directory, or
use apt-get install linux-headers-$(uname -r).
More information about the libvirt-users
mailing list