If lxc.lxcpath is set at /etc/lxc/lxc.conf file to something different from '/etc/lxc' and container is created at the set directory, openrc init script fails to start this container. Reproducible: Always Steps to Reproduce: 1. set /etc/lxc/lxc.conf to any directory except /etc/lxc (for example, /var/lxc or /tmp/lxc) 2. create container 3. try to start container with openrc init script Actual Results: Container startup fails: it can't find container's config Expected Results: Container should start successfully
Created attachment 387030 [details] files/lxc.initd.4 Updated openrc config based on latest found in the portage tree (lxc.initd.3). diff: --- /usr/portage/app-emulation/lxc/files/lxc.initd.3 2014-10-18 21:00:37.000000000 +0400 +++ /tmp/lxc.initd.4 2014-10-20 12:53:15.358622759 +0400 @@ -6,10 +6,13 @@ CONTAINER=${SVCNAME#*.} lxc_get_configfile() { - if [ -f "/etc/lxc/${CONTAINER}.conf" ]; then - echo "/etc/lxc/${CONTAINER}.conf" - elif [ -f "/etc/lxc/${CONTAINER}/config" ]; then - echo "/etc/lxc/${CONTAINER}/config" + local confpath + confpath="$(lxc-config lxc.lxcpath)" + + if [ -f "${confpath}/${CONTAINER}.conf" ]; then + echo "${confpath}/${CONTAINER}.conf" + elif [ -f "${confpath}/${CONTAINER}/config" ]; then + echo "${confpath}/${CONTAINER}/config" else eerror "Unable to find a suitable configuration file." eerror "If you set up the container in a non-standard"
Comment on attachment 387030 [details] files/lxc.initd.4 --- files/lxc.initd.3 +++ files/lxc.initd.4 @@ -6,10 +6,13 @@ CONTAINER=${SVCNAME#*.} lxc_get_configfile() { - if [ -f "/etc/lxc/${CONTAINER}.conf" ]; then - echo "/etc/lxc/${CONTAINER}.conf" - elif [ -f "/etc/lxc/${CONTAINER}/config" ]; then - echo "/etc/lxc/${CONTAINER}/config" + local confpath + confpath="$(lxc-config lxc.lxcpath)" + + if [ -f "${confpath}/${CONTAINER}.conf" ]; then + echo "${confpath}/${CONTAINER}.conf" + elif [ -f "${confpath}/${CONTAINER}/config" ]; then + echo "${confpath}/${CONTAINER}/config" else eerror "Unable to find a suitable configuration file." eerror "If you set up the container in a non-standard"
Also, instead of lines: local confpath confpath="$(lxc-config lxc.lxcpath)" variable 'lxc_path' from file '/usr/share/lxc/lxc.functions' may be used. It's defined this way: lxc_path=`lxc-config lxc.lxcpath`
Can this https://bugs.gentoo.org/show_bug.cgi?id=530896 solve your problem?
Yes, scripts from bug #530896 also worked for me, but they produced some warnings on 'stop' action: * Sending signal to stop Linux Container ${name} ... [ !! ] * Try to request a clean shutdown Linux Container ${name} ... [ !! ] * Halting Linux Container ${name} ... [ ok ] Nonetheless LXC container stops.
Lets move to 530896 so we can create a unified to solution to solve both of your problems. *** This bug has been marked as a duplicate of bug 530896 ***