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
Correct, this was due to the extra spaces, I cleaned them by using awk.