I am experiencing this issue with my Ubuntu 18.04 container.
lxc stop ubuntu-xen-lxd-2 --timeout 60
Error: shutting down the container failed
Try `lxc info --show-log ubuntu-xen-lxd-2` for more info
>
> lxc ubuntu-xen-lxd-2 20191112204406.394 ERROR cgfsng - cgroups/cgfsng.c:mkdir_eexist_on_last:1219 - File exists - Failed to create directory "/sys/fs/cgroup/unified//lxc/ubuntu-xen-lxd-2"
> lxc ubuntu-xen-lxd-2 20191112204406.394 ERROR cgfsng - cgroups/cgfsng.c:create_path_for_hierarchy:1243 - Failed to create cgroup "/sys/fs/cgroup/unified//lxc/ubuntu-xen-lxd-2"
> lxc ubuntu-xen-lxd-2 20191112204406.412 ERROR cgfsng - cgroups/cgfsng.c:cgfsng_payload_create:1321 - Failed to create cgroup "/sys/fs/cgroup/unified//lxc/ubuntu-xen-lxd-2"
> lxc ubuntu-xen-lxd-2 20191112204406.151 WARN conf - conf.c:lxc_setup_devpts:1616 - Invalid argument - Failed to unmount old devpts instance
> lxc 20191112204930.183 ERROR commands_utils - commands_utils.c:lxc_cmd_sock_rcv_state:70 - Resource temporarily unavailable - Failed to receive message
It stops only by running the following command:
lxc stop ubuntu-xen-lxd-2 --force
UPDATE:
For the test purposes, I have run in the container in question:
poweroff -p
It successfully/gracefully shutdown the container:
root@ubuntu-xen-lxd-2:~# last -n2 -x shutdown
shutdown system down 4.15.0-66-generi Tue Nov 12 16:47 - 16:48 (00:01) - <**this one is recorded after poweroff**>
shutdown system down 4.15.0-66-generi Tue Nov 12 15:06 - 15:07 (00:00)
wtmp begins Mon Jul 1 15:50:34 2019
When I run this:
lxc exec ubuntu-xen-lxd-2 -- /bin/bash -c "/sbin/poweroff -p"
it behaves like lxc stop
(hangs)
lxc list
lists this container’s state as running.
lxc.signal.halt (defaults to SIGPWR) sends halt
to the container OS?
Does container exit on the halt command?