[lxc-users] jenkins init script and lxc

Serge Hallyn serge.hallyn at ubuntu.com
Thu Mar 31 16:28:06 UTC 2016


Quoting Ivan Ogai (lxc-users at ogai.name):
> Hello lxc user list,
> 
> first of all thanks for lxc, which is amazing.
> 
> When installing Jenkins from its official apt-repositoty in Ubuntu
> 14.04, a user 'jenkins' and an init script are created.
> 
> We have followed Stéphane Graber's blog for the user jenkins to be able
> to create unprivilaged containers, which works fine.
> 
> However, when restarting Jenkins (e.g. from the web interface), the
> Jenkins' jobs are no longer able to create containers:
> 
>     + lxc-create -t download -n grical -- -d ubuntu -r trusty -a amd64
>     lxc-create: utils.c: mkdir_p: 202 Permission denied - failed to create directory '/run/user/0/lxc/'

This isn't a cgroup issue.  It's a XDG_RUNTIME_DIR issue.  (Or really a pam
stack not being run issue)  You have it still set to root's runtime dir,
which obviously you cannot and should not be able to use.

>     failed to create lock
>     System error loading container
> 
> Rebooting the whole server solves it, but we would like to understand
> how to avoid a reboot after a restart of Jenkins.
> 
> I guess the problem is how the official init script of Jenkins starts
> itself.  In /etc/init.d/jenkins:
> 
>     SU=/bin/su
>     ...
>     # --user in daemon doesn't prepare environment variables like HOME, USER, LOGNAME or USERNAME,
>     # so we let su do so for us now
>     $SU -l $JENKINS_USER --shell=/bin/bash -c "$DAEMON $DAEMON_ARGS -- $JAVA $JAVA_ARGS -jar $JENKINS_WAR $JENKINS_ARGS" || return 2
> 
> How would you recommend to solve the issue?
> 
> Internet is full of people having similar problems, and some tell you
> how to use some obscure and mysterious cgm commands to solve them. All
> complain however that there is no introductory place to understand what
> these cgm commands really do.
> Is there any FAQ or other resource to easily understand the
> basics of cgroups with lxc and related implications when using
> subshells, su, and init scripts?
> 
> Kind regards,
> --
> Ivan F. Villanueva
> https://timefyme.com
> --
> Vorgründungsgesellschaft GridMind
> Ivan Fernando Villanueva Barrio EU
> --
> Malmöer Str. 6
> 10439 Berlin
> Germany
> --
> Tel: +49 30  398 20 596
> Fax: +49 30  340 60 473
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users


More information about the lxc-users mailing list