After updating from LXC 0.8.0 to 1.0.4, lxc-info does not print anything for my containers. This in turn confuses the init script, which relies on lxc-info having an output for non-running containers. The result are non-descriptive error messages. Reproducible: Always
Please provide more information for example: your emerge --info emerge -pv lxc lxc-info works for me.
On my ia64 machine, which I booted while having LXC 0.8 installed and later updated to 1.0, lxc-info does not generate any output. Apparently it is unable to find the init PID of the containers. So there exists a codepath in lxc-info, which does not produce any output (even if only due to internal errors), so I think that Gentoo's init script should consider this case, especially as the fix is a simple `if [[ "${init_pid}" ]] ; then … fi`, just as for the pid=-1 case.
(In reply to Dennis Schridde from comment #2) > On my ia64 machine, which I booted while having LXC 0.8 installed and later > updated to 1.0, lxc-info does not generate any output. Apparently it is > unable to find the init PID of the containers. > > So there exists a codepath in lxc-info, which does not produce any output > (even if only due to internal errors), so I think that Gentoo's init script > should consider this case, especially as the fix is a simple `if [[ > "${init_pid}" ]] ; then … fi`, just as for the pid=-1 case. you are right it does not print anything if the container is stopped
(In reply to Markos Chandras from comment #3) > (In reply to Dennis Schridde from comment #2) > > On my ia64 machine, which I booted while having LXC 0.8 installed and later > > updated to 1.0, lxc-info does not generate any output. Apparently it is > > unable to find the init PID of the containers. > > > > So there exists a codepath in lxc-info, which does not produce any output > > (even if only due to internal errors), so I think that Gentoo's init script > > should consider this case, especially as the fix is a simple `if [[ > > "${init_pid}" ]] ; then … fi`, just as for the pid=-1 case. > > you are right it does not print anything if the container is stopped Does this fix your problem? --- lxc.initd.2 2012-11-14 02:15:10.000000000 +0000 +++ lxc.initd.3 2014-07-22 19:16:10.707705009 +0100 @@ -106,7 +106,7 @@ init_pid=$(lxc-info -n ${CONTAINER} --pid | awk '{ print $2 }') - if [ "${init_pid}" = "-1" ]; then + if [ -z "${init_pid}" ]; then ewarn "${CONTAINER} doesn't seem to be running." return 0 fi
That is almost the patch I used, so I am sure: Yes, it will. I think that a change from outputting -1 to having a different exit code for lxc-info was also documented somewhere, but I could not find it anymore when reporting this issue.
(In reply to Dennis Schridde from comment #5) > That is almost the patch I used, so I am sure: Yes, it will. > > I think that a change from outputting -1 to having a different exit code for > lxc-info was also documented somewhere, but I could not find it anymore when > reporting this issue. If you find it useful to return a different exit code when the container is not running I suppose we can 'return 1' in the init script. Though this will break existing scripts which expect the init script to always return 0 if the container is not running so I'd rather not change this behavior. There is another python3 related fix I need to sort out before I revbump so this bug may take a while to be marked as resolved.
(In reply to Markos Chandras from comment #6) > (In reply to Dennis Schridde from comment #5) > > That is almost the patch I used, so I am sure: Yes, it will. > > > > I think that a change from outputting -1 to having a different exit code for > > lxc-info was also documented somewhere, but I could not find it anymore when > > reporting this issue. > > If you find it useful to return a different exit code when the container is > not running I suppose we can 'return 1' in the init script. Though this will > break existing scripts which expect the init script to always return 0 if > the container is not running so I'd rather not change this behavior. What I meant was: I *think* in a release announcement or similiar half a year ago I read something about the behaviour of lxc-info being changed in LXC 1.0 when the container is not running. This would officially confirm that your patch is correct. Sadly I cannot find that text anymore.
This is already fixed