Debian Bug report logs - #824804
update-rc.d: may invoke insserv without -f flag when initscripts is installed but not configured

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: Felipe Sateler <fsateler@debian.org>

Date: Thu, 19 May 2016 22:00:02 UTC

Severity: normal

Found in version init-system-helpers/1.33

Fixed in version init-system-helpers/1.36

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, andreas@fatal.se, Debian systemd Maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>:
Bug#824804; Package init-system-helpers. (Thu, 19 May 2016 22:00:06 GMT) (full text, mbox, link).


Acknowledgement sent to Felipe Sateler <fsateler@debian.org>:
New Bug report received and forwarded. Copy sent to andreas@fatal.se, Debian systemd Maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>. (Thu, 19 May 2016 22:00:06 GMT) (full text, mbox, link).


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

From: Felipe Sateler <fsateler@debian.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: update-rc.d: may invoke insserv without -f flag when initscripts is installed but not configured
Date: Thu, 19 May 2016 17:57:40 -0400
X-Debbugs-Cc: andreas@fatal.se
Package: init-system-helpers
Version: 1.33
Severity: normal

Filing so that this is tracked somewhere.

update-rc.d currently has support for invoking insserv with the -f flag,
to allow initscripts-less installations. This should allow packages to drop
dependencies on the initscripts package. However, this does not work if the
dependency is dropped, because now apt/dpkg can choose to configure the
package before it configures initscripts. This leads to the situation that
/etc/init.d/mountkernfs.sh exists (and thus invoke-rc.d does not pass -f flag),
but the links in /etc/rc?.d/S??mountkernfs.sh are not created yet, and then
insserv fails.

A practical example of this happened when util-linux dropped the initscripts
dependency on #823665.

Possible solutions:

1. Unconditionally pass -f to insserv. This has some appeal to me as I don't
   think packaging bugs should in general abort installations, but I can see
   the argument for preserving the check.
2. Extend the check to the links (ie, check if
   `glob /etc/rc?.d/S??mountkernfs.sh` is not empty.
3. Consult the dpkg database via dpkg-query to determine if initscripts has been
   configured
4. Have dpkg/apt support ordering without dependencies (not likely to
   happen soon).


I think (2) is the easiest and fastest way out of this problem, but
(4) would be the real fix.

-- 

Saludos,
Felipe Sateler



Information forwarded to debian-bugs-dist@lists.debian.org, Debian systemd Maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>:
Bug#824804; Package init-system-helpers. (Tue, 28 Jun 2016 10: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 Debian systemd Maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>. (Tue, 28 Jun 2016 10:15:04 GMT) (full text, mbox, link).


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

From: Martin Pitt <mpitt@debian.org>
To: Felipe Sateler <fsateler@debian.org>, 824804@bugs.debian.org
Subject: Re: Bug#824804: update-rc.d: may invoke insserv without -f flag when initscripts is installed but not configured
Date: Tue, 28 Jun 2016 12:13:05 +0200
Control: tag -1 pending

Hello Felipe,

CC'ing Andreas for the util-linux part.

Felipe Sateler [2016-05-19 17:57 -0400]:
> update-rc.d currently has support for invoking insserv with the -f flag,
> to allow initscripts-less installations. This should allow packages to drop
> dependencies on the initscripts package. However, this does not work if the
> dependency is dropped, because now apt/dpkg can choose to configure the
> package before it configures initscripts. This leads to the situation that
> /etc/init.d/mountkernfs.sh exists (and thus invoke-rc.d does not pass -f flag),
> but the links in /etc/rc?.d/S??mountkernfs.sh are not created yet, and then
> insserv fails.

I have some trouble reproducing this. In a schroot without initscipts,
when I do

  dpkg --unpack initscripts_2.88dsf-59.7_amd64.deb

then there's only /etc/init.d/mountkernfs.sh.dpkg-new, as the
conffiles are only moved into place at configure time, not at unpack
time yet. And on upgrades the script and the previous rc?.d links
should already be in place.

So could it be that this is limited to debootstrap as that might just
directly unpack conffiles instead of installing them as *.dpkg-new on
unpack? This would make sense for debootstrap as that isn't concerned
about upgrades.

With this synthetic test I can reproduce it:

  apt-get download initscripts
  dpkg --unpack initscripts_*.deb
  mv /etc/init.d/mountkernfs.sh{.dpkg-new,}
  update-rc.d hwclock.sh defaults

> 2. Extend the check to the links (ie, check if
>    `glob /etc/rc?.d/S??mountkernfs.sh` is not empty.

I agree that this seems to be the best solution for now. Checkin for
/etc/init.d/mountkernfs.sh was supposed to be a test for "initscripts
is installed", but as you found it is only a sufficient test for
"initscripts is unpacked".

So I think this is mostly just limited to debootstrap and thus
util-linux. But I'd indeed prefer if we do this in update-rc.d and
drop the workaround from util-linux again.

> 3. Consult the dpkg database via dpkg-query to determine if initscripts has been
>    configured

Sounds fine as well, but more expensive than globbing, and actually
not quite trivial either. "dpkg-query --showformat='${Status}' --show"
needs parsing and has a trap as its package arguments are patterns,
not fixed names. And "dpkg-query --status" would also need a
non-trivial (but still simple, however) grep.

So I committed this now:

  http://anonscm.debian.org/cgit/collab-maint/init-system-helpers.git/commit/?id=14008bd4a

I tested this with three scenarios (no initscripts, unpacked
initscripts, configured initscripts) in a schroot and it now works
fine. Does that sound ok to you?

Thanks,

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 824804-submit@bugs.debian.org. (Tue, 28 Jun 2016 10:15:04 GMT) (full text, mbox, link).


Reply sent to Martin Pitt <mpitt@debian.org>:
You have taken responsibility. (Tue, 28 Jun 2016 20:51:18 GMT) (full text, mbox, link).


Notification sent to Felipe Sateler <fsateler@debian.org>:
Bug acknowledged by developer. (Tue, 28 Jun 2016 20:51:18 GMT) (full text, mbox, link).


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

From: Martin Pitt <mpitt@debian.org>
To: 824804-close@bugs.debian.org
Subject: Bug#824804: fixed in init-system-helpers 1.36
Date: Tue, 28 Jun 2016 20:49:48 +0000
Source: init-system-helpers
Source-Version: 1.36

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 824804@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 Jun 2016 22:10:37 +0200
Source: init-system-helpers
Binary: init-system-helpers dh-systemd init
Architecture: source all amd64
Version: 1.36
Distribution: unstable
Urgency: medium
Maintainer: Debian 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       - init metapackage
 init-system-helpers - helper tools for all init systems
Closes: 358496 758139 768609 770344 824804 827376
Changes:
 init-system-helpers (1.36) unstable; urgency=medium
 .
   [ Martin Pitt ]
   * init: Don't depend on sysvinit-core when building on/for Ubuntu and
     derivatives.
   * init: Drop "essential" from the package description as it is not essential
     any more.
   * invoke-rc.d: Quiesce error message if "runlevel" does not exist, which is
     now the case in chroots since init stopped being essential.
     (Closes: #827376)
   * update-rc.d: Testing for /etc/init.d/mountkernfs.sh is not sufficient as
     initscripts might only be unpacked but not configured yet (during
     debootstrap). Thus test if /etc/rcS.d/S??mountkernfs.sh exists. Thanks to
     Felipe Sateler for the idea! (Closes: #824804)
   * init-system-helpers: Ship README.invoke-rc.d and README.policy-rc.d.
   * invoke-rc.d.8: Update the SEE ALSO link to README.policy-rc.d.
     (Closes: #358496)
   * service.8: Document that this starts systemd units as well.
     (Closes: #758139)
   * invoke-rc.d: Show "systemctl status" on a failed (re)start if running
     under systemd. This makes logs with failed package installations much more
     useful, and human users will most likely do exactly that anyway.
     (LP: #1596056)
 .
   [ Luca Boccassi ]
   * dh_systemd_enable: Add support for installing templated service units.
     (Closes: #770344)
   * dh_systemd_enable: Add support for installing path units.
     (Closes: #768609)
Checksums-Sha1:
 8388f73f7606f19f98c2bdd19d5ce93664608454 1867 init-system-helpers_1.36.dsc
 20d671314cdab1ae775cbce9402897d505fb91be 58424 init-system-helpers_1.36.tar.xz
 1fb4f7a0e5a29947651666d5d8d63b08dbb4cf7c 22608 dh-systemd_1.36_all.deb
 43c422cd399d224d8b41e4e259a18a994112fddf 40870 init-system-helpers_1.36_all.deb
 467e3f316827b897cccf3aa697d53f64fa4c9166 8748 init_1.36_amd64.deb
Checksums-Sha256:
 590e455e7d2abb1433c1a1bd5d58df31f3f4b2e5d5db73afbe216c9a1d063f81 1867 init-system-helpers_1.36.dsc
 1b4151b05d5edf5af53c4ae74bffe017c964a943fa58c8badb4fcc6acf2138fd 58424 init-system-helpers_1.36.tar.xz
 8f7ead15d1539d511447961093cad16635df6ade2b7090696035a0092a30c0a2 22608 dh-systemd_1.36_all.deb
 58041a9d32809668338f2b4492fcd6898a795c0b56102c4010df986ed690cfb0 40870 init-system-helpers_1.36_all.deb
 3e558efc23c5b2bdbdf10d860ec7795c121af3069fb141069e03bc7ad5409170 8748 init_1.36_amd64.deb
Files:
 3f5ce4454f533afceb969ce8803c850f 1867 admin extra init-system-helpers_1.36.dsc
 05e7ed9d015668f3e0d416997d9a8b09 58424 admin extra init-system-helpers_1.36.tar.xz
 842d0f80a121d63336d5749cc5f380c7 22608 admin extra dh-systemd_1.36_all.deb
 f2ac30fb3d91888e23c329afa9b6acd6 40870 admin required init-system-helpers_1.36_all.deb
 f1a92102837f51e27ec4189c640a5fc6 8748 metapackages important init_1.36_amd64.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJXcttIAAoJENFO8V2v4RNHQBsQAKIK6yjlt9Zx8zGgyL+xwf+L
h08pFYkGIP7GPzXopDrIz7M76DSGBGlNx7p+0TCnBCrf5WGGwdgjiFsLvdGNqXcj
CRLYp2Fy+YTQ59sEg1CJrnrM1jjwrFfPBGpkM0xaAD5c1CytKW7GgVlTfaVd2kCW
qgS1iDJUOBYgQGL1UIhYbCsjf/TwoqmGMChxPlogJJIA5izwMQ3eHmgRdRbKGzjH
1My2nU/I21xFSdi/ck+a5cHABBF3Kl1Un4TRrKRS/beJloJf0JCqZjswYDf3QrA/
pZS01xqR0E4aNzld4Y4Oa09Nj4uuWTAHV9omFMWLBfyOFggGgeppYUyMqXm3sKXi
nYOmez8JFNAdsbTGA8vXukoGl3Cl212ZQkSUwcMyHJCsucAKrBN1lWOsOUJBIlIX
4Lg+QFRUlv0VG997JvzjGnebUKUN5t4ugRrudKdDKtvEMUpi3wVKcPvQJ2BwxCEo
WramhpdqHZO125wW8Anb11Ktb8sAmA8pjhfIc4/LVvkZ626eQHnLEp2j4t/jCJgX
P9CEVjHy3MpN1SSPbXKRUakktZUmv1Gz4mq0ihH2SeAstAfBdKzqBOTRX5cHKSYA
gVYmGxWpDMLag/HZjnPVohduhWe6w6cgGogAF4dMSNfKtIvqC8WyNL5zaZb9GD1d
e3ifXA6/pWZPpVGuwsLw
=m+ot
-----END PGP SIGNATURE-----




Information forwarded to debian-bugs-dist@lists.debian.org, Debian systemd Maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>:
Bug#824804; Package init-system-helpers. (Wed, 29 Jun 2016 13:39:08 GMT) (full text, mbox, link).


Acknowledgement sent to Felipe Sateler <fsateler@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian systemd Maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>. (Wed, 29 Jun 2016 13:39:08 GMT) (full text, mbox, link).


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

From: Felipe Sateler <fsateler@debian.org>
To: Martin Pitt <mpitt@debian.org>
Cc: 824804@bugs.debian.org
Subject: Re: Bug#824804: update-rc.d: may invoke insserv without -f flag when initscripts is installed but not configured
Date: Wed, 29 Jun 2016 10:36:52 -0300
On 28 June 2016 at 06:13, Martin Pitt <mpitt@debian.org> wrote:
> Control: tag -1 pending
>
> Hello Felipe,
>
> CC'ing Andreas for the util-linux part.
>
> Felipe Sateler [2016-05-19 17:57 -0400]:
>> update-rc.d currently has support for invoking insserv with the -f flag,
>> to allow initscripts-less installations. This should allow packages to drop
>> dependencies on the initscripts package. However, this does not work if the
>> dependency is dropped, because now apt/dpkg can choose to configure the
>> package before it configures initscripts. This leads to the situation that
>> /etc/init.d/mountkernfs.sh exists (and thus invoke-rc.d does not pass -f flag),
>> but the links in /etc/rc?.d/S??mountkernfs.sh are not created yet, and then
>> insserv fails.
>
> I have some trouble reproducing this. In a schroot without initscipts,
> when I do
>
>   dpkg --unpack initscripts_2.88dsf-59.7_amd64.deb
>
> then there's only /etc/init.d/mountkernfs.sh.dpkg-new, as the
> conffiles are only moved into place at configure time, not at unpack
> time yet. And on upgrades the script and the previous rc?.d links
> should already be in place.
>
> So could it be that this is limited to debootstrap as that might just
> directly unpack conffiles instead of installing them as *.dpkg-new on
> unpack? This would make sense for debootstrap as that isn't concerned
> about upgrades.
>
> With this synthetic test I can reproduce it:
>
>   apt-get download initscripts
>   dpkg --unpack initscripts_*.deb
>   mv /etc/init.d/mountkernfs.sh{.dpkg-new,}
>   update-rc.d hwclock.sh defaults
>
>> 2. Extend the check to the links (ie, check if
>>    `glob /etc/rc?.d/S??mountkernfs.sh` is not empty.
>
> I agree that this seems to be the best solution for now. Checkin for
> /etc/init.d/mountkernfs.sh was supposed to be a test for "initscripts
> is installed", but as you found it is only a sufficient test for
> "initscripts is unpacked".
>
> So I think this is mostly just limited to debootstrap and thus
> util-linux. But I'd indeed prefer if we do this in update-rc.d and
> drop the workaround from util-linux again.
>
>> 3. Consult the dpkg database via dpkg-query to determine if initscripts has been
>>    configured
>
> Sounds fine as well, but more expensive than globbing, and actually
> not quite trivial either. "dpkg-query --showformat='${Status}' --show"
> needs parsing and has a trap as its package arguments are patterns,
> not fixed names. And "dpkg-query --status" would also need a
> non-trivial (but still simple, however) grep.
>
> So I committed this now:
>
>   http://anonscm.debian.org/cgit/collab-maint/init-system-helpers.git/commit/?id=14008bd4a
>
> I tested this with three scenarios (no initscripts, unpacked
> initscripts, configured initscripts) in a schroot and it now works
> fine. Does that sound ok to you?

I was very confused by this mail. We had already committed this same
fix in 79a4036f (in 1.34), so I wondered why was this still a problem.
Turns out the patch I applied on c167d9498a inadvertently reverted the
change :/

So, +1 from me.

-- 

Saludos,
Felipe Sateler



Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Mon, 01 Aug 2016 07:26:40 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: Sat Jan 6 07:20:58 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.