Debian Bug report logs - #768450
invoke-rc.d: will start a disabled service for systemd-only or systemd+upstart config

version graph

Package: init-system-helpers; Maintainer for init-system-helpers is Debian systemd Maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>; Source for init-system-helpers is src:init-system-helpers (PTS, buildd, popcon).

Reported by: Didier Roche <didrocks@ubuntu.com>

Date: Fri, 7 Nov 2014 13:51:01 UTC

Severity: normal

Found in version init-system-helpers/1.25

Fixed in version init-system-helpers/1.28

Done: Martin Pitt <mpitt@debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#768450; Package sysv-rc. (Fri, 07 Nov 2014 13:51:06 GMT) (full text, mbox, link).


Acknowledgement sent to Didier Roche <didrocks@ubuntu.com>:
New Bug report received and forwarded. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Fri, 07 Nov 2014 13:51:06 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Didier Roche <didrocks@ubuntu.com>
To: submit@bugs.debian.org
Subject: sysv-rc: invoke-rc.d will start a disabled service for systemd-only or systemd+upstart config
Date: Fri, 07 Nov 2014 14:48:20 +0100
Package: sysv-rc
Version: 2.88dsf-57
Severity: normal

Dear Maintainer,

invoke-rc.d will start disabled systemd services when there is no
init script. If we only had an upstart (or none) and systemd job,
the job is started unconditionally on invoke-rc.d [restart|start],
which is called by generated dh_installinit postinst (for upstart).

After a discussion on #debian-systemd, it seems the conscensus is to
use a similar logic in invoke-rc.d than the one built for upstart:
- invoke-rc.d start <unit> don't do anything on systemd if the service is
  disabled.
- invoke-rc.d restart <unit> only restart a disabled service if the daemon
 was already running (forced by the admin).

-- System Information:
Debian Release: jessie/sid
  APT prefers vivid-updates
  APT policy: (500, 'vivid-updates'), (500, 'vivid-security'), (500, 
'vivid')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16.0-24-generic (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages sysv-rc depends on:
ii  debconf [debconf-2.0]  1.5.53ubuntu1
ii  insserv                1.14.0-5ubuntu2
ii  sysvinit-utils         2.88dsf-53.2ubuntu1

Versions of packages sysv-rc recommends:
ii  lsb-base  4.1+Debian11ubuntu8

Versions of packages sysv-rc suggests:
pn  bum           <none>
pn  sysv-rc-conf  <none>




Information forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#768450; Package sysv-rc. (Fri, 07 Nov 2014 14:03:08 GMT) (full text, mbox, link).


Acknowledgement sent to Didier Roche <didrocks@ubuntu.com>:
Extra info received and forwarded to list. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Fri, 07 Nov 2014 14:03:08 GMT) (full text, mbox, link).


Message #10 received at 768450@bugs.debian.org (full text, mbox, reply):

From: Didier Roche <didrocks@ubuntu.com>
To: 768450@bugs.debian.org
Subject: Patch
Date: Fri, 07 Nov 2014 14:59:13 +0100
[Message part 1 (text/plain, inline)]
Please find a debdiff to address the above issue, following what's done 
for upstart.

I'm opened to any suggestion to make it better :)
[add_systemd_status_in_invoke-rc.d.debdiff (text/plain, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#768450; Package sysv-rc. (Fri, 07 Nov 2014 15:21:09 GMT) (full text, mbox, link).


Acknowledgement sent to Didier Roche <didrocks@ubuntu.com>:
Extra info received and forwarded to list. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Fri, 07 Nov 2014 15:21:09 GMT) (full text, mbox, link).


Message #15 received at 768450@bugs.debian.org (full text, mbox, reply):

From: Didier Roche <didrocks@ubuntu.com>
To: 768450@bugs.debian.org
Subject: Second version of the patch
Date: Fri, 07 Nov 2014 16:16:47 +0100
[Message part 1 (text/plain, inline)]
Here is a second version of the patch after feedback on OFTC. It uses 
more robust commands then parsing the status output.

Note that I don't use try-restart as it doesn't map the case of job 
enabled but stopped -> restart on package upgrade is supposed to start 
the daemon (as with init case).
Do not hesitate if you see any other needed changes.

[deb-systemd-invoke_unit-state_v2.debdiff (text/plain, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#768450; Package sysv-rc. (Fri, 07 Nov 2014 15:42:12 GMT) (full text, mbox, link).


Acknowledgement sent to Didier Roche <didrocks@ubuntu.com>:
Extra info received and forwarded to list. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Fri, 07 Nov 2014 15:42:12 GMT) (full text, mbox, link).


Message #20 received at 768450@bugs.debian.org (full text, mbox, reply):

From: Didier Roche <didrocks@ubuntu.com>
To: 768450@bugs.debian.org
Subject: Correct second version of the patch
Date: Fri, 07 Nov 2014 16:38:32 +0100
[Message part 1 (text/plain, inline)]
Sorry, I sent the updated patch of #768456 (which is similar) to that 
package instead of the other one.

Please find attached the correct updated patch, with a more accurate 
changelog.
Any feedback welcome.
[add_systemd_status_in_invoke-rc.d_v2.debdiff (text/plain, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#768450; Package sysv-rc. (Mon, 17 Nov 2014 07:03:05 GMT) (full text, mbox, link).


Acknowledgement sent to Martin Pitt <mpitt@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Mon, 17 Nov 2014 07:03:05 GMT) (full text, mbox, link).


Message #25 received at 768450@bugs.debian.org (full text, mbox, reply):

From: Martin Pitt <mpitt@debian.org>
To: Didier Roche <didrocks@ubuntu.com>, 768450@bugs.debian.org
Subject: Re: Bug#768450: Correct second version of the patch
Date: Mon, 17 Nov 2014 07:59:13 +0100
Didier Roche [2014-11-07 16:38 +0100]:
> +  * invoke-rc.d: don't start disabled systemd services when invoke-rc.d
> +    is directly invoked. The job is then started unconditionally on
> +    invoke-rc.d [restart|start]. (Closes: #768450)
> +    Use a similar logic than for upstart:
> +    - invoke-rc.d start <unit> don't do anything on systemd if the service is
> +      disabled.
> +    - invoke-rc.d restart <unit> only restart a disabled service if the daemon
> +      was already running (forced by the admin).

Thanks for that! The patch looks logically correct to me.

> +                        systemctl --quiet is-enabled "${UNIT}"
> +                        ENABLED=$?
> +                        systemctl --quiet is-active "${UNIT}"
> +                        RUNNING=$?
> +
> +                        if [ $ENABLED != 0 ] && [ "$saction" = "start" ]; then
> +                            exit 0
> +                        fi
> +                        # If the job is disabled and is not currently
> +                        # running, the job is not restarted. However, if
> +                        # the job is disabled but has been forced into
> +                        # the running state, we *do* stop and restart it
> +                        # since this is expected behaviour
> +                        # for the admin who forced the start.
> +                        if [ $ENABLED != 0 ] && [ $RUNNING != 0 ] && [ "$saction" = "restart" ]; then
> +                            exit 0
> +                        fi

Maybe that's just my limited imagination, but I find this hard to read
("[ $ENABLED != 0 ]). I find this structure easier to read:

  # We never start disabled jobs; we only restart them if they are
  # already running (got started manually)
  if ! systemctl --quiet is-enabled "${UNIT}"; then
      if [ "$saction" = "start" ]; then
          exit 0
      elif [ "$saction" = "restart" ] && ! systemctl --quiet is-active "${UNIT}"; then
          exit 0
      fi
  fi

Anyway, I guess which one to take is for the sysvinit maintainers to
decide. :-)

Thanks!

Martin
-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)



Information forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#768450; Package sysv-rc. (Fri, 06 Mar 2015 10:15:08 GMT) (full text, mbox, link).


Acknowledgement sent to Martin Pitt <martin.pitt@ubuntu.com>:
Extra info received and forwarded to list. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Fri, 06 Mar 2015 10:15:08 GMT) (full text, mbox, link).


Message #30 received at 768450@bugs.debian.org (full text, mbox, reply):

From: Martin Pitt <martin.pitt@ubuntu.com>
To: Didier Roche <didrocks@ubuntu.com>, 768450@bugs.debian.org
Subject: Re: Bug#768450: Correct second version of the patch
Date: Fri, 6 Mar 2015 11:10:26 +0100
[Message part 1 (text/plain, inline)]
Hello Didier, sysvinit maintainers,

Didier Roche [2014-11-07 16:38 +0100]:
> +                        systemctl --quiet is-enabled "${UNIT}"
> +                        ENABLED=$?

This is causing some grief: In case $UNIT is from the sysv-generator
(or another generator), is-enabled will fail with

$ systemctl --quiet is-enabled apache2.service; echo $?
Failed to get unit file state for apache2.service: No such file or directory
1

as is-enabled/enable/disable doesn't take /run/systemd/generator* into
account. I fixed this in Ubuntu with

  http://launchpadlibrarian.net/199513710/sysvinit_2.88dsf-53.2ubuntu9_2.88dsf-53.2ubuntu10.diff.gz

but that uses an different version of the patch. (See my previous
comment about readability).

Thanks,

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
[signature.asc (application/pgp-signature, inline)]

Changed Bug title to 'invoke-rc.d: will start a disabled service for systemd-only or systemd+upstart config' from 'sysv-rc: invoke-rc.d will start a disabled service for systemd-only or systemd+upstart config' Request was from Andreas Henriksson <andreas@fatal.se> to control@bugs.debian.org. (Mon, 18 Jan 2016 17:51:48 GMT) (full text, mbox, link).


Bug reassigned from package 'sysv-rc' to 'init-system-helpers'. Request was from Andreas Henriksson <andreas@fatal.se> to control@bugs.debian.org. (Mon, 18 Jan 2016 17:51:49 GMT) (full text, mbox, link).


No longer marked as found in versions sysvinit/2.88dsf-57. Request was from Andreas Henriksson <andreas@fatal.se> to control@bugs.debian.org. (Mon, 18 Jan 2016 17:51:50 GMT) (full text, mbox, link).


Marked as found in versions init-system-helpers/1.25. Request was from Andreas Henriksson <andreas@fatal.se> to control@bugs.debian.org. (Mon, 18 Jan 2016 17:51:50 GMT) (full text, mbox, link).


Added tag(s) pending. Request was from Martin Pitt <martin.pitt@ubuntu.com> to control@bugs.debian.org. (Mon, 25 Jan 2016 22:03:13 GMT) (full text, mbox, link).


Reply sent to Martin Pitt <mpitt@debian.org>:
You have taken responsibility. (Fri, 05 Feb 2016 11:51:26 GMT) (full text, mbox, link).


Notification sent to Didier Roche <didrocks@ubuntu.com>:
Bug acknowledged by developer. (Fri, 05 Feb 2016 11:51:28 GMT) (full text, mbox, link).


Message #45 received at 768450-close@bugs.debian.org (full text, mbox, reply):

From: Martin Pitt <mpitt@debian.org>
To: 768450-close@bugs.debian.org
Subject: Bug#768450: fixed in init-system-helpers 1.28
Date: Fri, 05 Feb 2016 11:49:33 +0000
Source: init-system-helpers
Source-Version: 1.28

We believe that the bug you reported is fixed in the latest version of
init-system-helpers, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 768450@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Martin Pitt <mpitt@debian.org> (supplier of updated init-system-helpers package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Fri, 05 Feb 2016 12:30:53 +0100
Source: init-system-helpers
Binary: init-system-helpers dh-systemd init
Architecture: source all amd64
Version: 1.28
Distribution: unstable
Urgency: medium
Maintainer: pkg-systemd-maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>
Changed-By: Martin Pitt <mpitt@debian.org>
Description:
 dh-systemd - debhelper add-on to handle systemd unit files
 init       - System-V-like init utilities - metapackage
 init-system-helpers - helper tools for all init systems
Closes: 717109 747851 760168 768450
Changes:
 init-system-helpers (1.28) unstable; urgency=medium
 .
   [ Martin Pitt ]
   * invoke-rc.d: Fix actions to run under systemd if there is no init.d
     script. (Closes: #747851)
   * invoke-rc.d: Don't start systemd units which are disabled. Restart them
     only if they were already running (i. e. started manually by the admin).
     (Closes: #768450)
   * update-rc.d: Support /usr/lib/insserv/insserv location too, as with
     newer sysvinit versions.
   * Add autopkgtest which runs the tests in t/.
   * Drop Michael Stapelberg and Tollef Fog Heen from Uploaders:, they stopped
     systemd work long ago. Thanks for your great work in the past!
   * Run wrap-and-sort -at over our debian control files.
 .
   [ Andreas Henriksson ]
   * Add support for -X option. (Closes: #760168)
 .
   [ Michael Biebl ]
   * invoke-rc.d: Allow stop and status requests for masked systemd services.
     (Closes: #717109)
Checksums-Sha1:
 19bc65676c3f27d22851a0642d34b79c10427146 1876 init-system-helpers_1.28.dsc
 8c47dad657808696688fd24d1de0c425581089c4 54624 init-system-helpers_1.28.tar.xz
 7ee558cb0bf94a29f901016e76fed4e39591d29e 19752 dh-systemd_1.28_all.deb
 f39e0e464f782f3a7729ee22a50f9c87565d98ef 32632 init-system-helpers_1.28_all.deb
 9bc360a2db852820bb26bef0e8501a876cee9125 6398 init_1.28_amd64.deb
Checksums-Sha256:
 0350b5c294a445c8fc5860ad799d4be4fad584952aa2786e782beaf738cbd52e 1876 init-system-helpers_1.28.dsc
 476d83a998a9e19d2b05d17341ae1cbfd6d9b7af8bfbaf1b941499ff6f7d4e2b 54624 init-system-helpers_1.28.tar.xz
 7a7662ffc7394817c416210ca51fa3b5881e24fe1a628607adba97da526d1c17 19752 dh-systemd_1.28_all.deb
 33f8dd17a53330f71ed41bc179314018eaea073670a06239cb4be67f1115398c 32632 init-system-helpers_1.28_all.deb
 4440929b5aee71c14f8891d7f8045d2414be001ab41267e7922675735fc4829e 6398 init_1.28_amd64.deb
Files:
 51f78d6d3fb2cc2b27815e688ffb56e1 1876 admin extra init-system-helpers_1.28.dsc
 b5d38db797bb673c6e196d3c416134c6 54624 admin extra init-system-helpers_1.28.tar.xz
 ff5aa34d2eb749b603e1ed5cb1cbfaa6 19752 admin extra dh-systemd_1.28_all.deb
 9116fdccca5e2f3f4607bf758022babf 32632 admin required init-system-helpers_1.28_all.deb
 c1809d59bc9c339134e4a53b714dff3f 6398 metapackages required init_1.28_amd64.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCAAGBQJWtIkgAAoJENFO8V2v4RNHYvcP/1cW07jze8B9WY7BEL3MNfvd
hCk7nzXFBfEdCUplN3FHJnK0hjlqutpFInlebJUuwBATDCoScVRuSP/E573pu+i3
4CGlA8iwXu3HJqO8ZaYPtYnfnzIpX05ZVPqjDyv7i1p29/1LxtMJSNjrbd40NmPO
WI6N1qtFrlvklPWgIFIyIycdjaJi2eSVmb/MFJaRe1vllaYN2+aJR5PbITkj/KIL
RNfBskxFUsKMXDx5iSsdq7OCnXupXZ44pvndb+3PYhJVJFwwv6cp8BhB1g+5w234
X6DRhpyfObu3a7/XNdxcbSF3+zIaWorDye5aLNLzI0wZ04T3Xvz0Op+Vh+uTZEH8
tsu/QlmDy1LLFd5p3JWqbSos537QCKRigv1WRSNWP1SLtaqj869rGjOQztLWT3/e
nzegYUn879nMgHiDPjgK3bQjzpZKpxYe8tkPB3VKLB6EmYSyUENuptgX0lunzymE
/0VdXpxryafoBZ/Jv11J+Yqi69624Q3IsLL83CrkXdD4JjQrsssgsubfXy3Ioog4
aGji/QJmdyw+E7vwDtUyz6y+KrAuDxGQySBS3kl0ttdbCUwdm/LRoszBvrpdyDIc
MNF8z/kGBAkwn3jSSCFqDo3u0o+bta/B/PEXJCXZpbXEzakOjIFQww4cRJ110dLJ
3x4Pwk/sz7mspeuoJIQI
=vJcN
-----END PGP SIGNATURE-----




Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Sun, 06 Mar 2016 07:32:44 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Fri Jan 5 05:14:37 2018; Machine Name: beach

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.