Hi all.
I download
ftp://libvirt.org/libvirt/libvirt-5.1.0.tar.xz and build
rpms with lxc support.
LXC containers can be started, but time to time can't be stopped.
With option --mode initctl containers always stopped, but virsh reported error:
"Container does not provide an initctl pipe"
Inside container present /dev/initctl:
# ls -la /dev/initctl
lrwxrwxrwx 1 root root 25 Mar 5 18:40 /dev/initctl -> /run/systemd/initctl/fifo
With option --mode signal, centos 7.5/7.6 systemd not stopped and
rebooted, in containers log:
systemd: Received SIGTERM.
systemd: Reexecuting.
systemd: systemd 219 running in system mode. (+PAM +AUDIT +SELINUX
+IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS
+ACL +XZ +LZ4 -SECCOMP +BLKID +ELFUTILS +KMOD +IDN)
systemd: Detected virtualization lxc-libvirt.
systemd: Detected architecture x86-64.
Runlevel inside container before and after - is 5.
Without option --mode container can stop, mostly when you in gdb
step-by-step debug.
But most often not, with simptoms as with --mode signal. Patch in
attachment fix problem for my environment. Tested only with host
centos 7.6 and guests centos 7.5/7.6
Short comments on patch.
lxcDomainShutdownFlags() return rc 0 and container begin stopped.
We not go to endjob label, but later we pass check:
if (rc == 0 &&
(flags == 0 ||
(flags & VIR_DOMAIN_SHUTDOWN_SIGNAL))) {
and trying next shutdown method with sigterm to pid1.
If container heavy loaded (or waiting in gdb for input), it not
stopped. But if container small, first method with initctl stop
container before second method would be call
b.r.
Maxim Kozin