Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 525956 - app-emulation/lxc - /etc/init.d/lxc should respect 'lxc.lxcpath' setting
Summary: app-emulation/lxc - /etc/init.d/lxc should respect 'lxc.lxcpath' setting
Status: RESOLVED DUPLICATE of bug 530896
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Diego Elio Pettenò (RETIRED)
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2014-10-20 09:02 UTC by i.Dark_Templar
Modified: 2014-12-20 13:36 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
files/lxc.initd.4 (lxc.initd.4,3.74 KB, text/plain)
2014-10-20 09:04 UTC, i.Dark_Templar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description i.Dark_Templar 2014-10-20 09:02:47 UTC
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
Comment 1 i.Dark_Templar 2014-10-20 09:04:18 UTC
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 2 Jeroen Roovers (RETIRED) gentoo-dev 2014-10-20 09:05:37 UTC
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"
Comment 3 i.Dark_Templar 2014-10-20 09:33:09 UTC
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`
Comment 4 mike 2014-11-27 17:54:02 UTC
Can this https://bugs.gentoo.org/show_bug.cgi?id=530896 solve your problem?
Comment 5 i.Dark_Templar 2014-12-03 13:06:44 UTC
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.
Comment 6 Markos Chandras (RETIRED) gentoo-dev 2014-12-20 13:36:57 UTC
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 ***