How can I kill a stuck LXC container?

I have a new unprivileged LXC container that I just cannot seem to stop. lxc-stop -n dl hangs. lxc-stop -k --nolock -n dl hangs. lxc-ls hangs. lxc-attach -n dl hangs. Nothing works on this container.

I have restarted lcxfs. All that did was upset a privileged container. This is what the current processes for this container look like (from the host).

lxc-start,24434
  └─systemd,24446 --system --deserialize 9
      ├─agetty,25258 --noclear --keep-baud console 115200 38400 9600 vt220
      ├─agetty,25846 --noclear --keep-baud pts/1 115200 38400 9600 vt220
      ├─agetty,25878 --noclear --keep-baud pts/3 115200 38400 9600 vt220
      ├─agetty,25906 --noclear --keep-baud pts/2 115200 38400 9600 vt220
      ├─agetty,25934 --noclear --keep-baud pts/0 115200 38400 9600 vt220
      ├─rsyslogd,26016 -n
      │   ├─{rsyslogd},26043
      │   └─{rsyslogd},26044
      └─systemd-journal,25962

And the process states:

$ ps aux | grep -P '24434|24446|25258|25846|25878|25906|25934|25934|26016|26043|26044|25962'
oli      24434  0.0  0.0  43400  3552 ?        Ss   10:56   0:00 [lxc monitor] /home/oli/.local/share/lxc dl
100000   24446  0.0  0.1  36896  4972 ?        Ss   10:56   0:00 /lib/systemd/systemd --system --deserialize 9
100000   25258  0.0  0.0  15676  2504 pts/0    Ss+  10:56   0:00 /sbin/agetty --noclear --keep-baud console 115200 38400 9600 vt220
100000   25846  0.0  0.0  15676  2496 pts/1    Ss+  11:33   0:00 /sbin/agetty --noclear --keep-baud pts/1 115200 38400 9600 vt220
100000   25878  0.0  0.0  15676  2380 pts/3    Ss+  11:33   0:00 /sbin/agetty --noclear --keep-baud pts/3 115200 38400 9600 vt220
100000   25906  0.0  0.0  15676  2416 pts/2    Ss+  11:33   0:00 /sbin/agetty --noclear --keep-baud pts/2 115200 38400 9600 vt220
100000   25934  0.0  0.0  15676  2332 pts/0    Ss+  11:33   0:00 /sbin/agetty --noclear --keep-baud pts/0 115200 38400 9600 vt220
100000   25962  0.0  0.0  35256  3500 ?        Ss   11:33   0:00 /lib/systemd/systemd-journald
100104   26016  0.0  0.0 182640  3244 ?        Ssl  11:33   0:00 /usr/sbin/rsyslogd -n

Solution 1:

Force killing the container's systemd process worked for me.

In your example,

kill -9 24446