Subject: Re: [vserver] chbind -> ncontext: vc_net_create(): Invalid argument - why?
From: Herbert Poetzl <herbert@13thfloor.at>
Date: Thu, 11 Sep 2014 21:39:37 +0200

On Thu, Sep 11, 2014 at 03:54:27PM +0200, Christian Recktenwald wrote:

Hey Christian!

> I'm running 
>   chbind --ip 192.168.4.167 ip a l 
> on the vserver host system and get
> 	ncontext: vc_net_create(): Invalid argument

This maps to:

/usr/sbin/ncontext --create --silentexist -- /usr/sbin/nattribute --set -- /usr/sbin/naddress
--add --ip 192.168.4.167 ip a l 

and

/usr/sbin/ncontext --create --silentexist

is what fails.

> I'm pretty sure this has worked somewhen in the past -
> why does it fail now?

It worked back then when the kernel created dynamic
contexts for unspecified context IDs. This feature
was removed a long time ago, so you basically need
to specify a static context ID to the kernel.

Userspace tools normally work around that by emulating
the dynamic context selection and sending a static
ID to the kernel, but of course, in an explicit
invocation like the chbind, this cannot be done
easily. 

Solution: imply specify an unused context ID yourself.

chbind --nid 999 --ip 192.168.4.167 ip a l

will do what you want, if the network context with
the number 999 does not exist before you call it.

HTC,
Herbert

> -- 
> LiHAS - Adrian Reyer - Hessenwiesenstraße 10 - D-70565 Stuttgart
> Fon: +49 (7 11) 78 28 50 90 - Fax:  +49 (7 11) 78 28 50 91
> Mail: lihas@lihas.de - Web: http://lihas.de
> Linux, Netzwerke, Consulting & Support - USt-ID: DE 227 816 626 Stuttgart