Debian Bug report logs - #768456
init-system-helpers: deb-system-invoke starts disabled systemd service on package upgrade

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 14:12:01 UTC

Severity: normal

Found in version init-system-helpers/1.21

Fixed in version init-system-helpers/1.23

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, pkg-systemd-maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>:
Bug#768456; Package init-system-helpers. (Fri, 07 Nov 2014 14:12:05 GMT) (full text, mbox, link).


Acknowledgement sent to Didier Roche <didrocks@ubuntu.com>:
New Bug report received and forwarded. Copy sent to pkg-systemd-maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>. (Fri, 07 Nov 2014 14:12: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: init-system-helpers: deb-system-invoke starts disabled systemd service on package upgrade
Date: Fri, 07 Nov 2014 15:09:59 +0100
Package: init-system-helpers
Version: 1.21
Severity: normal

Dear Maintainer,

deb-system-invoke starts disabled systemd services (and so, in case
of systemd only services), when there is no init script.

As discuss on #debian-systemd, we can add some conditions to start the job
on deb-system-invoke [restart|start], during package upgrade:
- deb-system-invoke start <unit> don't do anything on systemd if the
  service is disabled.
- deb-system-invoke restart <unit> only restart a disabled service if
  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 init-system-helpers depends on:
ii  perl  5.20.1-2

init-system-helpers recommends no packages.

init-system-helpers suggests no packages.

-- no debconf information



Information forwarded to debian-bugs-dist@lists.debian.org, pkg-systemd-maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>:
Bug#768456; Package init-system-helpers. (Fri, 07 Nov 2014 14:18:04 GMT) (full text, mbox, link).


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


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

From: Didier Roche <didrocks@ubuntu.com>
To: 768456@bugs.debian.org
Subject: Patch
Date: Fri, 07 Nov 2014 15:15:57 +0100
[Message part 1 (text/plain, inline)]
Please find the attached debdiff trying to address the issue.

Any suggestion to enhance it is welcome. :)
[deb-systemd-invoke_unit-state.debdiff (text/plain, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, pkg-systemd-maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>:
Bug#768456; Package init-system-helpers. (Fri, 07 Nov 2014 15:39:09 GMT) (full text, mbox, link).


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


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

From: Didier Roche <didrocks@ubuntu.com>
To: 768456@bugs.debian.org
Subject: Second version of the patch
Date: Fri, 07 Nov 2014 16:36:46 +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.


[Message part 2 (text/html, inline)]
[deb-systemd-invoke_unit-state_v2.debdiff (text/plain, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, pkg-systemd-maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>:
Bug#768456; Package init-system-helpers. (Fri, 07 Nov 2014 16:09:10 GMT) (full text, mbox, link).


Acknowledgement sent to Martin Pitt <mpitt@debian.org>:
Extra info received and forwarded to list. Copy sent to pkg-systemd-maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>. (Fri, 07 Nov 2014 16:09:10 GMT) (full text, mbox, link).


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

From: Martin Pitt <mpitt@debian.org>
To: Didier Roche <didrocks@ubuntu.com>, 768456@bugs.debian.org
Subject: Re: Bug#768456: Second version of the patch
Date: Fri, 7 Nov 2014 17:00:54 +0100
Hey Didier,

thanks for fixing this! The general idea looks good to me, I just have
some nitpicks which the Debian maintainers may or may not want to see
changed.

Didier Roche [2014-11-07 16:36 +0100]:
> +# If the job is disabled and is not currently running, the job is not started or 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 (grep("/^$action$/", ["start", "restart"])) {

I know, regexps are the bread and butter of perl, but wouldn't

  if ($action eq 'start' || $action eq 'restart') {

be a tad easier/robust?

> +        if (($unit_enabled != 0) && ("$action" eq "start")) {
> +            print STDERR "$unit is disabled, don't start it.\n";

"don't start it" sounds like a request to the caller; could this say
"not starting it"?

> +        } elsif (($unit_enabled != 0) && ($unit_active != 0) && ("$action" eq "restart")) {
> +            print STDERR "$unit is disabled and not running, don't start it.\n";

Dito.

> +        else {
> +            system('/bin/systemctl', "$action", "$unit");

This should use exec like below IMHO, so that the exit status of
deb-systemd-invoke is the exit status of systemctl.

> +        }
> +    }
> +} else {
> +    exec '/bin/systemctl', @ARGV;

Merci !

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, pkg-systemd-maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>:
Bug#768456; Package init-system-helpers. (Fri, 07 Nov 2014 16:18:14 GMT) (full text, mbox, link).


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


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

From: Didier Roche <didrocks@ubuntu.com>
To: 768456@bugs.debian.org
Subject: Version 3 including ansgar's and pitti's feedback
Date: Fri, 07 Nov 2014 17:16:03 +0100
[Message part 1 (text/plain, inline)]
Here is the v3 of the patch, which includes ansgar's and pitti's 
feedback. Thanks to them!

The only suggestion I couldn't integrate is Martin's system vs exec one. 
I had to change keep it as system() call as we are evaluating one unit 
after another as the scripts can accepts multiple units, and so exec 
would prefer the evaluation and inclusion of other units passed as 
parameters.
Does this make sense? The downside is that we loose the return code, 
indeed (we could concatenate it if needed).

Cheers,
Didier
[deb-systemd-invoke_unit-state_v3.debdiff (text/plain, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, pkg-systemd-maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>:
Bug#768456; Package init-system-helpers. (Mon, 10 Nov 2014 06:15:04 GMT) (full text, mbox, link).


Acknowledgement sent to Martin Pitt <mpitt@debian.org>:
Extra info received and forwarded to list. Copy sent to pkg-systemd-maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>. (Mon, 10 Nov 2014 06:15:04 GMT) (full text, mbox, link).


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

From: Martin Pitt <mpitt@debian.org>
To: Didier Roche <didrocks@ubuntu.com>, 768456@bugs.debian.org
Subject: Re: Bug#768456: Version 3 including ansgar's and pitti's feedback
Date: Mon, 10 Nov 2014 07:04:22 +0100
Hey Didier,

Didier Roche [2014-11-07 17:16 +0100]:
> The only suggestion I couldn't integrate is Martin's system vs exec one. I
> had to change keep it as system() call as we are evaluating one unit after
> another as the scripts can accepts multiple units

Oh, of course, it's a loop.

> The downside is that we loose the return code, indeed (we could
> concatenate it if needed).

Yes, I think it should save the return code if it's != 0 and return
that. I. e. the script will fail if processing any unit fails.

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, pkg-systemd-maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>:
Bug#768456; Package init-system-helpers. (Wed, 12 Nov 2014 10:51:10 GMT) (full text, mbox, link).


Acknowledgement sent to Didier Roche <didrocks@ubuntu.com>:
Extra info received and forwarded to list. Copy sent to pkg-systemd-maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>. (Wed, 12 Nov 2014 10:51:10 GMT) (full text, mbox, link).


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

From: Didier Roche <didrocks@ubuntu.com>
To: Martin Pitt <mpitt@debian.org>, 768456@bugs.debian.org
Subject: Re: Bug#768456: Version 3 including ansgar's and pitti's feedback
Date: Wed, 12 Nov 2014 11:50:22 +0100
[Message part 1 (text/plain, inline)]
Le 10/11/2014 07:04, Martin Pitt a écrit :

Hey Martin,
>> The downside is that we loose the return code, indeed (we could
>> concatenate it if needed).
> Yes, I think it should save the return code if it's != 0 and return
> that. I. e. the script will fail if processing any unit fails.

done, deb-systemd-invoke now returns latest unit error code it may found 
(and print which one(s) in STDERR).

I added as well, as ansgar's suggested that we don't start static units 
(not being able to find as well any good reason we would want to 
autostart them).

Please find attached v4 of the debdiff with those 2 changes.
Cheers,
Didier
[deb-systemd-invoke_unit-state_v4.debdiff (text/plain, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, pkg-systemd-maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>:
Bug#768456; Package init-system-helpers. (Thu, 08 Jan 2015 11:27:04 GMT) (full text, mbox, link).


Acknowledgement sent to Martin Pitt <mpitt@debian.org>:
Extra info received and forwarded to list. Copy sent to pkg-systemd-maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>. (Thu, 08 Jan 2015 11:27:04 GMT) (full text, mbox, link).


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

From: Martin Pitt <mpitt@debian.org>
To: Didier Roche <didrocks@ubuntu.com>, 768456@bugs.debian.org
Subject: Re: Bug#768456: Version 3 including ansgar's and pitti's feedback
Date: Thu, 8 Jan 2015 12:22:19 +0100
Control: tag -1 pending

Hey Didier,

Didier Roche [2014-11-12 11:50 +0100]:
> done, deb-systemd-invoke now returns latest unit error code it may found
> (and print which one(s) in STDERR).
> 
> I added as well, as ansgar's suggested that we don't start static units (not
> being able to find as well any good reason we would want to autostart them).
> 
> Please find attached v4 of the debdiff with those 2 changes.

Thanks! Committed with two minor grammar fixes to the changelog. As we
are in freeze now I won't upload this to Debian unstable for now
though, but of course we can upload it to experimental (if you think
that's worth doing), and/or to Ubuntu.

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



Added tag(s) pending. Request was from Martin Pitt <mpitt@debian.org> to 768456-submit@bugs.debian.org. (Thu, 08 Jan 2015 11:27:04 GMT) (full text, mbox, link).


Reply sent to Martin Pitt <mpitt@debian.org>:
You have taken responsibility. (Tue, 28 Apr 2015 13:27:10 GMT) (full text, mbox, link).


Notification sent to Didier Roche <didrocks@ubuntu.com>:
Bug acknowledged by developer. (Tue, 28 Apr 2015 13:27:10 GMT) (full text, mbox, link).


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

From: Martin Pitt <mpitt@debian.org>
To: 768456-close@bugs.debian.org
Subject: Bug#768456: fixed in init-system-helpers 1.23
Date: Tue, 28 Apr 2015 13:22:04 +0000
Source: init-system-helpers
Source-Version: 1.23

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 768456@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: Tue, 28 Apr 2015 15:05:44 +0200
Source: init-system-helpers
Binary: init-system-helpers dh-systemd init
Architecture: source all amd64
Version: 1.23
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: 756026 768456 782855
Changes:
 init-system-helpers (1.23) unstable; urgency=medium
 .
   [ Didier Roche ]
   * deb-system-invoke: don't start disabled systemd services (in case
     of systemd only services), when there is no init script. (Closes: #768456)
     Add some conditions to start the job on deb-system-invoke [restart|start],
     during package upgrade:
     - deb-system-invoke start <unit> doesn't do anything on systemd if the
       unit is disabled or static.
     - deb-system-invoke restart <unit> only restarts a disabled or static unit
       if the daemon was already running (forced by the admin).
     - in case of multiple units in error passed to deb-system-invoke, this one
       will exit with last unit in errror exit code.
 .
   [ Martin Pitt ]
   * t/001-deb-systemd-helper.t: Verify that the commands exit successfully.
   * t/001-deb-systemd-helper.t: Add tests for Alias= handling.
   * t/001-deb-systemd-helper.t: Add tests for Alias and mask handling with
     uninstalled .service file (as in package postrm scripts).
   * deb-systemd-helper: Ignore Also= and Alias= referring to itself, and avoid
     mask symlink creation errors on systems where units with those have
     already been installed. Add corresponding test to
     001-deb-systemd-helper.t. (LP: #1439793)
   * init: Add ${misc:Depends} dependency to quiesce lintian.
   * Bump Standards-Version to 3.9.6 (no changes necessary).
   * debian/copyright: Fix short license name for BSD-3-clause.
   * Add myself to Uploaders: (member of pkg-systemd-maintainers)
 .
   [ Jérémy Bobbio ]
   * Make the package build reproducibly by using latest entry in
     debian/changelog to set the manpages date. (Closes: #782855)
 .
   [ Dimitri John Ledkov ]
   * Mark "init" metapackage Multi-Arch: foreign. (Closes: #756026)
Checksums-Sha1:
 1c0ab66ef98ea4afea09066468b07164dae648a3 1912 init-system-helpers_1.23.dsc
 0839449c0f4da752a4562a6d3cda646ab1e1adb3 31868 init-system-helpers_1.23.tar.xz
 9adcc37babfceac4c4300f9f6f0bbab8e6eb638f 15216 init-system-helpers_1.23_all.deb
 fb626e9fc80148cfaede2e1f65eabba8a3a401fe 18686 dh-systemd_1.23_all.deb
 e51ec44ff978d13d0afb0a3f5fefa862c0a2177c 5424 init_1.23_amd64.deb
Checksums-Sha256:
 45cb4e74121c374fec221438a9ee1e1bf49773f102dfe5c9de69e51c71fe22f2 1912 init-system-helpers_1.23.dsc
 7a35ccd8ab4f60a4f53bd6e106b15fe8965f3d9521b88e5ae709d1d8db719f0a 31868 init-system-helpers_1.23.tar.xz
 30159b96f1535f289c2a55dc99bdbbdb706d353bc9b766ae195faa094e0a89d5 15216 init-system-helpers_1.23_all.deb
 79848f623aaa1d740a8c3a45d28a70fb4655f8dda8bf87debe53c7e572cef895 18686 dh-systemd_1.23_all.deb
 fa427d1057b9ace13bc131f02088592851b5fc624c8621544d16f7b743cd2408 5424 init_1.23_amd64.deb
Files:
 c41cad2e79a851077340514211ece08e 1912 admin extra init-system-helpers_1.23.dsc
 cfe1bdfc508b91d77048fe7465f747b4 31868 admin extra init-system-helpers_1.23.tar.xz
 b17a552a2c39f7802e87704b1b10f1af 15216 admin extra init-system-helpers_1.23_all.deb
 dc0ef5cfa68061f9bcefc4c5013e2e91 18686 admin extra dh-systemd_1.23_all.deb
 f62e527e6462c5629381b530a6108278 5424 metapackages required init_1.23_amd64.deb

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

iQIcBAEBCAAGBQJVP4Y1AAoJENFO8V2v4RNHQe4QAJQQGEe0yhvahUAE2+TX+0Gm
jCK5xxLz0MlCU5XQgRYbLyE16Yb9tRFtOczVCSLiYlt6rfw0hzEEHvKCaUoppt58
2q2Q206O6hnrKOG/xTYaVQ87ypvUIkc5J3wweDb9qnYUi7vaC9g7zPhKQ9ISWLxq
cc47NNsNAXVeiFztmrm+g32P6C7qH1mU59+L5tcW4mgnrjszZ5RP6cK/CQu6mlp7
7wFndzkyezFpdKhWlU68pUro6MU3NVWHELLttETud7b0dM85wKiGXRotdBx+ZGXS
NzqqsHBOCuFp5mUbFofc69R3DAF/amEuYKVTb+zyVTqxq69SZF5wEZJcJl9XJpjZ
T73HsdYotlMNCWOP5D4kaK6NCa8B6yu2T96mhTU/bysgG5xI1garErEaM/qCNbJD
fSb3+tl3KphfRFpwaJ7qFhlsBD3XSaSPkTyR8/5CEB4h/lxyQ5R7Mz+yZ1yvRhzd
4g9l3+LWvNIniweunjnurJPaqaCOuJQYwC0ORumo3K8MagFqsy5W31RXiGAHIPTq
JD4RCy20UHAd2a9JGIt+FNb/JLcP8cncXcDZe1y1tlGwOhFOgKW2zvylDQp/CpFV
onx1FEaPVSypjq6cHX0Kg7eSyAU++/d51CryOQtNgr5UqJXwQwCtYfq5n3v+9/oy
7bbQwyThd89S5oglZAYf
=har0
-----END PGP SIGNATURE-----




Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Mon, 01 Jun 2015 07:32:39 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:41 2018; Machine Name: buxtehude

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.