Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 427078 - app-emulation/lxc-0.8.0_rc1-r5 kills host on stopping dead container
Summary: app-emulation/lxc-0.8.0_rc1-r5 kills host on stopping dead container
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Diego Elio Pettenò (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-18 11:41 UTC by Alexander Zubkov
Modified: 2012-07-21 05:08 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Zubkov 2012-07-18 11:41:58 UTC
I am trying to stop container, that is not running already (it was stopped by halt -p inside container). And this kills processes in my host system.

lxc ~ # lxc-info -n test
state:   STOPPED
pid:        -1

lxc ~ # /etc/init.d/lxc.test stop
 * Shutting down system in test ...
Connection to lxc closed by remote host.
Connection to lxc closed.

ssh session drops. From console, I see that sshd, acpid and other were killed.
In /etc/init.d/lxc I see lines:
        init_pid=$(lxc-info -n ${CONTAINER} --pid | cut -d: -f 2)

        if [ "${init_pid}" = "-1" ]; then
            ewarn "${CONTAINER} doesn't seem to be running."
            return 0
        fi

        ebegin "Shutting down system in ${CONTAINER}"
        kill -INT ${init_pid}
$init_pid should be "-1" and I should see "test } doesn't seem to be running." instead "Shutting down system in test". But this is not happen.
I think this is because of extra spaces passed into init_pid variable:

lxc ~ # CONTAINER=test
lxc ~ # lxc-info -n ${CONTAINER} --pid | cut -d: -f 2
        -1
lxc ~ # init_pid=$(lxc-info -n ${CONTAINER} --pid | cut -d: -f 2)
lxc ~ # echo "${init_pid}"
        -1
Comment 1 Diego Elio Pettenò (RETIRED) gentoo-dev 2012-07-21 05:08:16 UTC
Correct, this was due to the extra spaces, I cleaned them by using awk.