[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#700626: unblock: systemd/44-9



Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock

Please unblock package systemd

It fixes a couple of annoying issues. Especially #673309 and #692150 are
rather important. The implemented fixes are mostly workarounds to make
systemd integrate better in wheezy.

The changelog reads:

systemd (44-9) unstable; urgency=low

  * Team upload.
  * Fix typo in systemd.socket man page.  Closes: #700038
  * Use color specification in "systemctl dot" which is actually
    understood by dot.  Closes: #643689
  * Fix mounting of remote filesystems like NFS.  Closes: #673309
  * Use a file trigger to automatically enable service and socket units. A lot
    of packages simply install systemd units but do not enable them. As a
    result they will be inactive after the next boot. This is a workaround for
    wheezy which will be removed again in jessie.  Closes: #692150

 -- Michael Biebl <biebl@debian.org>  Fri, 15 Feb 2013 13:35:39 +0100

The last bug fix for #692150, is probably the more controversial one.
There is a more detail explanation in the git commit message [1] which I've
copied for convenience sake:

---
Use a file trigger to automatically enable service and socket units

A lot of packages simply install systemd units but do not enable them.
Running "systemctl enable" in the maintainer scripts is not really an
option since it is not guaranteed that systemd is installed. We
therefore implement a workaround for wheezy which is supposed to go away
in jessie once we have the necessary tools support in debhelper etc.

What the proposed workaround does is:
- Install a dpkg file trigger for /lib/systemd/system which triggers a
  script named /lib/systemd/debian-enable-units every time a package
  installs a systemd unit.
- Run this script also upon initial installation of systemd and once on
  upgrades from earlier releases.

The script in particular does the following:
- Run "systemctl enable" for each service or socket it finds in
  /lib/systemd/system but does that only once, so the administrator can
  disable them if wanted.
- Record the state and installed symlinks. When a package shipping
  systemd units is uninstalled, we remove those symlinks again.
- Use a blacklist for internal services.
- If systemd is not the active init, it will only create a tag file
  and next time we boot with systemd, the script will be run early
  during boot. For that we install a service named
  debian-enable-units.service which is run in basic.target.
---

I made did an analysis of existing packages [2] shipping service and socket
units in sid and especially wheezy and based unit.blacklist on that.

Instead of having to fix ~30 packages at this point of the release cycle
we opted for adding that workaround to systemd instead until we have
proper tools support in jessie.

Full diff is attached. Due to systemd's use of gitpkg, the debdiff is
very noisy, so I've used git diff 44-8..44-9 instead. Sorry for the
inconvenience.

Thanks in advance.

Cheers,
Michael


unblock systemd/44-9

[1] http://anonscm.debian.org/gitweb/?p=pkg-systemd/systemd.git;a=commitdiff;h=d7e578179529
[2] http://titanpad.com/qcJ193mypd
-- System Information:
Debian Release: 7.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (200, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.7-trunk-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff --git a/debian/changelog b/debian/changelog
index 0f02ea2..cfcb136 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,17 @@
+systemd (44-9) unstable; urgency=low
+
+  * Team upload.
+  * Fix typo in systemd.socket man page.  Closes: #700038
+  * Use color specification in "systemctl dot" which is actually
+    understood by dot.  Closes: #643689
+  * Fix mounting of remote filesystems like NFS.  Closes: #673309
+  * Use a file trigger to automatically enable service and socket units. A lot
+    of packages simply install systemd units but do not enable them. As a
+    result they will be inactive after the next boot. This is a workaround for
+    wheezy which will be removed again in jessie.  Closes: #692150
+
+ -- Michael Biebl <biebl@debian.org>  Fri, 15 Feb 2013 13:35:39 +0100
+
 systemd (44-8) unstable; urgency=low
 
   * Team upload.
diff --git a/debian/debian-enable-units b/debian/debian-enable-units
new file mode 100755
index 0000000..63db656
--- /dev/null
+++ b/debian/debian-enable-units
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+static_blacklist=/usr/share/systemd/unit.blacklist
+enabled_units=/var/lib/systemd/enabled-units
+statedir=/var/lib/systemd
+unitdir=/lib/systemd/system
+
+# If systemd is not running, schedule a run on next boot
+if ! [ -e /sys/fs/cgroup/systemd ] ; then
+    touch $statedir/run-debian-enable-units
+    exit 0
+else
+    rm -f $statedir/run-debian-enable-units
+fi
+
+# Get all installed service and socket unit files
+installed=$(mktemp)
+find $unitdir -type f \( -name "*.socket" -o -name "*.service" \) -printf "%f\n" | sort -u > $installed
+
+
+# Generate a blacklist from previously enabled units and
+# static ones, like the one in systemd itself while ignoring comments
+blacklist=$(mktemp)
+cat $static_blacklist $enabled_units 2>/dev/null | sed '/^#.*/d' | sort -u > $blacklist
+
+
+# Skip blacklisted entries
+while read unit ; do
+    sed -i "/$unit/d" $installed
+done < $blacklist
+
+
+# Get entries which need to be enabled
+needs_enable=$(mktemp)
+while read unit ; do
+    systemctl is-enabled "$unit" >/dev/null || echo "$unit" >> $needs_enable
+done < $installed
+
+
+# Enable entries and record their state
+while read unit ; do
+    echo "systemctl: enabling $unit"
+    systemctl enable "$unit" 2>&1 | awk '{print $4}' | sed s/\'//g > "$statedir/${unit}.symlinks"
+    echo "$unit" >> $enabled_units
+done < $needs_enable
+
+
+# Cleanup phase
+# Find deleted units and remove their symlinks
+if [ -f $enabled_units ] ; then
+    while read unit ; do
+        if ! [ -f "$unitdir/$unit" ] ; then
+            echo "systemctl: disabling $unit"
+            while read symlink ; do
+                 rm -f "$symlink"
+            done < "$statedir/${unit}.symlinks"
+            rm -f "$statedir/${unit}.symlinks"
+            sed -i "/$unit/d" $enabled_units
+        fi
+    done < $enabled_units
+fi
+
+rm -f $installed
+rm -f $blacklist
+rm -f $needs_enable
+
diff --git a/debian/debian-enable-units.service b/debian/debian-enable-units.service
new file mode 100644
index 0000000..8d5e136
--- /dev/null
+++ b/debian/debian-enable-units.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Automatically Enable Systemd Units
+ConditionPathExists=/var/lib/systemd/run-debian-enable-units
+DefaultDependencies=no
+Wants=local-fs.target
+After=local-fs.target
+
+[Service]
+ExecStart=/lib/systemd/debian-enable-units
+Type=oneshot
+RemainAfterExit=true
diff --git a/debian/systemd.install b/debian/systemd.install
index 4d2e7b4..afe9f7f 100644
--- a/debian/systemd.install
+++ b/debian/systemd.install
@@ -48,3 +48,6 @@ debian/tmpfiles.d/debian.conf usr/lib/tmpfiles.d
 debian/ifup@.service lib/systemd/system
 debian/units/run-lock.mount lib/systemd/system/
 debian/units/run-user.mount lib/systemd/system/
+debian/unit.blacklist usr/share/systemd/
+debian/debian-enable-units lib/systemd/
+debian/debian-enable-units.service lib/systemd/system/
diff --git a/debian/systemd.links b/debian/systemd.links
index c8999b2..c41bead 100644
--- a/debian/systemd.links
+++ b/debian/systemd.links
@@ -57,6 +57,7 @@
 
 # Run fixups early
 /lib/systemd/system/debian-fixup.service /lib/systemd/system/sysinit.target.wants/debian-fixup.service
+/lib/systemd/system/debian-enable-units.service /lib/systemd/system/sysinit.target.wants/debian-enable-units.service
 # Compat symlink
 /lib/systemd/systemd /bin/systemd
 
diff --git a/debian/systemd.postinst b/debian/systemd.postinst
index 366f7f5..1f10087 100644
--- a/debian/systemd.postinst
+++ b/debian/systemd.postinst
@@ -8,6 +8,16 @@ _systemctl() {
     fi
 }
 
+if [ "$1" = triggered ]; then
+    /lib/systemd/debian-enable-units
+    exit 0
+fi
+
+# Run the script after the initial installation or once on upgrades
+if [ -z "$2" ] || dpkg --compare-versions "$2" lt "44-9"; then
+    /lib/systemd/debian-enable-units
+fi
+
 if [ -n "$2" ]; then
     _systemctl daemon-reexec || true
 fi
diff --git a/debian/systemd.postrm b/debian/systemd.postrm
new file mode 100644
index 0000000..d95feca
--- /dev/null
+++ b/debian/systemd.postrm
@@ -0,0 +1,19 @@
+#! /bin/sh
+
+set -e
+
+# Clean up the mess we created
+if [ "$1" = "purge" ]; then
+    statedir=/var/lib/systemd
+    find $statedir -name "*.symlinks" | while read file ; do
+        while read symlink ; do
+             rm -f "$symlink"
+        done < "$file"
+        rm -f "$file"
+    done
+    rm -f $statedir/enabled-units
+    rm -f $statedir/run-debian-enable-units
+    rmdir --ignore-fail-on-non-empty $statedir
+fi
+
+#DEBHELPER#
diff --git a/debian/systemd.prerm b/debian/systemd.prerm
index e067387..929f494 100644
--- a/debian/systemd.prerm
+++ b/debian/systemd.prerm
@@ -12,5 +12,4 @@ if [ "$1" = "remove" ] && [ -e /sys/fs/cgroup/systemd ]; then
     exit 1
 fi
 
-
 #DEBHELPER#
diff --git a/debian/systemd.triggers b/debian/systemd.triggers
new file mode 100644
index 0000000..f6c3c0c
--- /dev/null
+++ b/debian/systemd.triggers
@@ -0,0 +1 @@
+interest /lib/systemd/system
diff --git a/debian/unit.blacklist b/debian/unit.blacklist
new file mode 100644
index 0000000..28c0c7b
--- /dev/null
+++ b/debian/unit.blacklist
@@ -0,0 +1,55 @@
+# systemd internal services and sockets
+console-shell.service
+debian-fixup.service
+emergency.service
+fsck-root.service
+fsck@.service
+getty@.service
+halt.service
+ifup@.service
+kexec.service
+poweroff.service
+quotacheck.service
+quotaon.service
+reboot.service
+remount-rootfs.service
+rescue.service
+serial-getty@.service
+systemd-ask-password-console.service
+systemd-ask-password-wall.service
+systemd-binfmt.service
+systemd-hostnamed.service
+systemd-initctl.service
+systemd-journald.service
+systemd-localed.service
+systemd-logind.service
+systemd-modules-load.service
+systemd-random-seed-load.service
+systemd-random-seed-save.service
+systemd-readahead-collect.service
+systemd-readahead-done.service
+systemd-readahead-replay.service
+systemd-remount-api-vfs.service
+systemd-shutdownd.service
+systemd-sysctl.service
+systemd-timedated.service
+systemd-tmpfiles-clean.service
+systemd-tmpfiles-setup.service
+systemd-update-utmp-runlevel.service
+systemd-update-utmp-shutdown.service
+systemd-user-sessions.service
+systemd-vconsole-setup.service
+user@.service
+systemd-journald.socket
+syslog.socket
+systemd-shutdownd.socket
+systemd-initctl.socket
+# udev-settle should only be enabled when needed
+udev-settle.service
+# this delays the boot process so should only be enabled as needed
+NetworkManager-wait-online.service
+# thinkfan is disabled by default since it can damage the hardware
+# if not configured correctly
+thinkfan.service
+# pyroman is disabled by default as it needs explicit configuration
+pyroman.service
diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml
index d9921e4..160ab62 100644
--- a/man/systemd.socket.xml
+++ b/man/systemd.socket.xml
@@ -75,7 +75,7 @@
                 <option>ExecStartPre=</option>,
                 <option>ExecStartPost=</option>,
                 <option>ExecStopPre=</option> and
-                <option>ExecStoptPost=</option> commands are executed
+                <option>ExecStopPost=</option> commands are executed
                 in.</para>
 
                 <para>For each socket file a matching service file
diff --git a/src/mount.c b/src/mount.c
index ed0f819..ee0959b 100644
--- a/src/mount.c
+++ b/src/mount.c
@@ -390,7 +390,7 @@ static int mount_add_fstab_links(Mount *m) {
                 else /* automount + nofail */
                         return unit_add_two_dependencies(tu, UNIT_AFTER, UNIT_WANTS, am, true);
 
-        } else if (handle && !noauto) {
+        } else if (handle && !noauto && !mount_is_network(p)) {
 
                 /* Automatically add mount points that aren't natively
                  * configured to local-fs.target */
diff --git a/src/service.c b/src/service.c
index 808a1b8..6c4a220 100644
--- a/src/service.c
+++ b/src/service.c
@@ -344,7 +344,7 @@ static int sysv_translate_facility(const char *name, const char *filename, char
                 "network",              SPECIAL_NETWORK_TARGET,
 #endif
                 "named",                SPECIAL_NSS_LOOKUP_TARGET,
-                "portmap",              SPECIAL_RPCBIND_TARGET,
+                "portmap",              SPECIAL_RPCBIND_SERVICE,
                 "remote_fs",            SPECIAL_REMOTE_FS_TARGET,
                 "syslog",               SPECIAL_SYSLOG_TARGET,
                 "time",                 SPECIAL_TIME_SYNC_TARGET,
diff --git a/src/special.h b/src/special.h
index 8185eaf..fc647cc 100644
--- a/src/special.h
+++ b/src/special.h
@@ -54,7 +54,7 @@
 /* LSB compatibility */
 #define SPECIAL_NETWORK_TARGET "network.target"           /* LSB's $network */
 #define SPECIAL_NSS_LOOKUP_TARGET "nss-lookup.target"     /* LSB's $named */
-#define SPECIAL_RPCBIND_TARGET "rpcbind.target"           /* LSB's $portmap */
+#define SPECIAL_RPCBIND_SERVICE "rpcbind.service"         /* LSB's $portmap */
 #define SPECIAL_SYSLOG_TARGET "syslog.target"             /* LSB's $syslog; Should pull in syslog.socket or syslog.service */
 #define SPECIAL_TIME_SYNC_TARGET "time-sync.target"       /* LSB's $time */
 #define SPECIAL_DISPLAY_MANAGER_SERVICE "display-manager.service"       /* Debian's $x-display-manager */
diff --git a/src/systemctl.c b/src/systemctl.c
index f51085f..13a797a 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -761,7 +761,7 @@ static int dot_one_property(const char *name, const char *prop, DBusMessageIter
                 "RequiresOverridable",   "[color=\"black\"]",
                 "Requisite",             "[color=\"darkblue\"]",
                 "RequisiteOverridable",  "[color=\"darkblue\"]",
-                "Wants",                 "[color=\"darkgrey\"]",
+                "Wants",                 "[color=\"grey66\"]",
                 "Conflicts",             "[color=\"red\"]",
                 "ConflictedBy",          "[color=\"red\"]",
                 "After",                 "[color=\"green\"]"

Reply to: