Control: forcemerge 852127 871476 Control: title 852127 qcontrold is not started under systemd
On Sun, 2017-10-15 at 17:00 +1000, Tim Kent wrote: > I was able to get qcontrold to start properly with the following: > > tim@mars:~$ sudo apt-get install insserv > tim@mars:~$ sudo insserv qcontrold,start=S,2,3,4,5 > > I suspect that systemd-sysv-generator behaves differently than System > V, as the generated unit file for qcontrold (in > /run/systemd/generator.late) is not symlinked to any targets. > > I can help with the transition to unit files if you want? Any help fixing the system unit files in the upstream repo so they can be properly included in the package would be appreciated for sure! It's been a while since I last looked into that but IIRC there were two main issues: * starting the daemon early enough, specifically before any long items such as fsck which might lead to the watchdog triggering before the daemon is started (and prods the watch dog). * there's also a corresponding sub-desire to run the qcontrol job as late as possible so the lights flash red etc until the system is mostly up. That's not as critical though * there is a a dependency on the GPIO event device appearing. The "right" way is apparently to watch udev events and do it dynamically, the "tollerable" way is to tag the device (via a udev rule) such that it generates a magic dev-input-by\x2dpath- platform\x2dgpio\x2dkeys\x2devent.device thing the service can depend on. THere is some more background on some of that (especially the last one) in #781886. My most revent attempt to get this working is below (based on tip of the packaging git tree). I honestly can't remember quite what state it was in last I looked at it, ISTR not being quite happy with the approach, especially the udev tagging, but that looks like the only sane path forward (I did investigate lua bindings for udev but not much luck, https://github.com/dodo/lua-udev seems to be abandoned). Sorry for not giving this more time sooner, my qnap systems are sticking with sysvinit for the forseeable future (only because they are working fine for me as is, not because I want to avoid systemd in general). Ian. commit 910a6d6f37c8829ddb935f82cd15093ca6790159 Author: Ian Campbell <i...@debian.org> Date: Sun Jan 29 14:44:33 2017 +0000 Add systemd unit files The rcS transition means that LSB compat mode is no longer sufficient for qcontrol (closes: #852127). The upstream provided unit files were not quite usable as is, so patch as follows: - dev-input-*.device doesn't exist, use a Wants+After on systemd-udev-settle.service as a workaround (this was suggested in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=781886#35, although not as the preferred option) - qcontrol service needs the qcontrold service to already have started, so add a Requires. - We would like qcontrol to run as near the end as possible, so mark it After basic and multi-user targets - We want qcontrol to run always, so mark it WantedBy=default.target. The last three seem likely to be suitable for upstream. diff --git a/debian/changelog b/debian/changelog index 4e634e7..19f42a5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +qcontrol (0.5.5-3~wip) UNRELEASED; urgency=medium + + * Add systemd unit files, rcS transition means that LSB compat mode is no + longer sufficient for qcontrol (closes: #852127). + + -- Ian Campbell <i...@debian.org> Sun, 29 Jan 2017 13:05:49 +0000 + qcontrol (0.5.5-2) unstable; urgency=medium * Update standards version, no changes required. diff --git a/debian/control b/debian/control index 3675e7c..8e241f8 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: qcontrol Section: utils Priority: optional Maintainer: Ian Campbell <i...@debian.org> -Build-Depends: debhelper (>= 9), liblua5.1-0-dev, pkg-config +Build-Depends: debhelper (>= 9), dh-systemd (>= 1.5), liblua5.1-0-dev, pkg-config Standards-Version: 3.9.8 Vcs-Git: git://anonscm.debian.org/collab-maint/qcontrol.git Vcs-Browser: http://anonscm.debian.org/cgit/collab-maint/qcontrol.git diff --git a/debian/patches/series b/debian/patches/series index 75a113c..1e9d8a8 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,2 +1,3 @@ multiarch.patch debian-config.patch +systemd-service-fixes.patch diff --git a/debian/patches/systemd-service-fixes.patch b/debian/patches/systemd-service-fixes.patch new file mode 100644 index 0000000..711801c --- /dev/null +++ b/debian/patches/systemd-service-fixes.patch @@ -0,0 +1,29 @@ +--- a/systemd/qcontrold.service ++++ b/systemd/qcontrold.service +@@ -1,7 +1,7 @@ + [Unit] + Description=qcontrold +-Requires=dev-input-by\x2dpath-platform\x2dgpio\x2dkeys\x2devent.device +-After=dev-input-by\x2dpath-platform\x2dgpio\x2dkeys\x2devent.device ++Wants=systemd-udev-settle.service ++After=systemd-udev-settle.service + # If the config file is there, we assume qcontrol works on this machine. + ConditionPathExists=/etc/qcontrol.conf + +--- a/systemd/qcontrol.service ++++ b/systemd/qcontrol.service +@@ -2,6 +2,8 @@ + Description=qcontrol + # If the config file is there, we assume qcontrol works on this machine. + ConditionPathExists=/etc/qcontrol.conf ++Requires=qcontrold.service ++After=basic.target multi-user.target + + [Service] + Type=oneshot +@@ -14,4 +16,4 @@ + ExecStop=/usr/sbin/qcontrol powerled 1hz + + [Install] +-WantedBy=multi-user.target ++WantedBy=default.target diff --git a/debian/qcontrol.install b/debian/qcontrol.install index ab7899e..25d1727 100644 --- a/debian/qcontrol.install +++ b/debian/qcontrol.install @@ -1 +1,4 @@ -qcontrol usr/sbin/ +qcontrol usr/sbin/ +systemd/qcontrold.service lib/systemd/system/ +systemd/qcontrold.socket lib/systemd/system/ +systemd/qcontrol.service lib/systemd/system/ diff --git a/debian/rules b/debian/rules index 9b88a50..272ab0c 100755 --- a/debian/rules +++ b/debian/rules @@ -12,7 +12,7 @@ UDEB_DIRS = lib/debian-installer-startup.d \ CONFIGS = ts209.lua ts219.lua ts409.lua ts41x.lua %: - dh $@ + dh $@ --with systemd override_dh_auto_install: dh_install