Package: systemd
Version: 44-11+deb7u4
Severity: important
Tags: upstream patch

Hello,

I am running a Debian Wheezy system in a OpenVZ container and found that
systemd just shuts down when "systemctl reboot" is run. The container then
has to be started again via the control panel. A OpenVZ developer had posted
a patch to the systemd-devel mailinglist in August 2012 but the systemd
version in wheezy iss too old to include the patch. This is the post:

    http://lists.freedesktop.org/archives/systemd-devel/2012-August/006379.html

I have applied the patch to the sources of the systemd debian package and
attached the diff to this report. The problem seems to be that OpenVZ needs
the reboot systemcall to be issued in the container to reboot. Version 44-11
just exits inside of a container.

It would be great if the package in wheezy could be fixed, as the systemd
version from wheezy-backports (204) is not compatible with the OpenVZ kernel
(systemd 204 needs a kernel >= 2.6.39 and OVZ only has kernels up to 2.6.32).
It is unfortunately not possible to use SysVInit in OVZ, because this hangs
when init starts up.

Best wishes,
Daniel Edwards

-- System Information:
Debian Release: 7.8
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-042stab093.4 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages systemd depends on:
ii  dpkg                 1.16.15
ii  initscripts          2.88dsf-41+deb7u1
ii  libacl1              2.2.51-8
ii  libaudit0            1:1.7.18-1.1
ii  libc6                2.13-38+deb7u6
ii  libcap2              1:2.22-1.2
ii  libcryptsetup4       2:1.4.3-4
ii  libdbus-1-3          1.6.8-1+deb7u5
ii  libkmod2             9-3
ii  liblzma5             5.1.1alpha+20120614-2
ii  libpam0g             1.1.3-7.1
ii  libselinux1          2.1.9-5
ii  libsystemd-daemon0   44-11+deb7u4
ii  libsystemd-id128-0   44-11+deb7u4
ii  libsystemd-journal0  44-11+deb7u4
ii  libsystemd-login0    44-11+deb7u4
ii  libudev0             175-7.2
ii  libwrap0             7.6.q-24
ii  udev                 175-7.2
ii  util-linux           2.20.1-5.3

Versions of packages systemd recommends:
pn  libpam-systemd  <none>

Versions of packages systemd suggests:
ii  python        2.7.3-4+deb7u1
pn  python-cairo  <none>
pn  python-dbus   <none>
pn  systemd-gui   <none>

-- no debconf information
Index: systemd-44/src/shutdown.c
===================================================================
--- systemd-44.orig/src/shutdown.c	2012-01-22 03:44:56.000000000 +0100
+++ systemd-44/src/shutdown.c	2015-01-15 15:45:53.240364002 +0100
@@ -305,8 +305,9 @@
 int main(int argc, char *argv[]) {
         int cmd, r;
         unsigned retries;
-        bool need_umount = true, need_swapoff = true, need_loop_detach = true, need_dm_detach = true;
+        bool need_umount = true, need_swapoff = true, need_loop_detach = true, need_dm_detach = true, need_reboot = true;
         bool killed_everbody = false, in_container;
+        const char *container_type;
 
         log_parse_environment();
         log_set_target(LOG_TARGET_CONSOLE); /* syslog will die if not gone yet */
@@ -326,7 +327,7 @@
                 goto error;
         }
 
-        in_container = detect_container(NULL) > 0;
+        in_container = detect_container(&container_type) > 0;
 
         if (streq(argv[1], "reboot"))
                 cmd = RB_AUTOBOOT;
@@ -352,8 +353,11 @@
         log_info("Sending SIGKILL to remaining processes...");
         send_signal(SIGKILL);
 
-        if (in_container)
+        if (in_container) {
                 need_swapoff = false;
+                if (!streq(container_type, "openvz"))
+                        need_reboot = false;
+        }
 
         /* Unmount all mountpoints, swaps, and loopback devices */
         for (retries = 0; retries < FINALIZE_ATTEMPTS; retries++) {
@@ -438,7 +442,7 @@
 
         /* If we are in a container, just exit, this will kill our
          * container for good. */
-        if (in_container) {
+        if (!need_reboot) {
                 log_error("Exiting container.");
                 exit(0);
         }

Reply via email to