Debian Bug report logs - #705254
Provide "is-enabled" command for update-rc.d

version graph

Package: sysv-rc; Maintainer for sysv-rc is Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>; Source for sysv-rc is src:sysvinit.

Reported by: Michael Biebl <biebl@debian.org>

Date: Fri, 12 Apr 2013 00:15:02 UTC

Severity: wishlist

Found in version sysvinit/2.88dsf-41

Reply or subscribe to this bug.

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@lists.alioth.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#705254; Package sysv-rc. (Fri, 12 Apr 2013 00:15:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Michael Biebl <biebl@debian.org>:
New Bug report received and forwarded. Copy sent to pkg-systemd-maintainers@lists.alioth.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Fri, 12 Apr 2013 00:15:06 GMT) Full text and rfc822 format available.

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

From: Michael Biebl <biebl@debian.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: Provice "is-enabled" command for update-rc.d
Date: Fri, 12 Apr 2013 02:12:40 +0200
Package: sysv-rc
Version: 2.88dsf-41
Severity: wishlist
File: /usr/sbin/update-rc.d
User: pkg-systemd-maintainers@lists.alioth.debian.org
Usertags: integration

Hi Roger,

as briefly discussed on IRC, I'd like to see a "is-enabled" command
added to update-rc.d which can be used to query, if a SysV init script
has been enabled or not.

The update-rc.d enable|disable interface is vastly superior to the
DISABLED flags in /etc/default/foo config files and the is-enabled
command would suplement that.

One area where we would like to make use of the "is-enabled" command is
for packages whish want to add support for systemd.
When packages add native systemd service files, the initial state of the
systemd service should be based on what the SysV service is using.
I.e., if a SysV service has been disabled by the system administrator,
this should be respected by the systemd service, too. For that we need
to be able to query the state of the SysV service when the package is
upgraded.

Cheers,
Michael

-- 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.8-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

Versions of packages sysv-rc depends on:
ii  debconf [debconf-2.0]  1.5.49
ii  insserv                1.14.0-5
ii  sysvinit-utils         2.88dsf-41

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

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

-- debconf information excluded



Changed Bug title to 'Provide "is-enabled" command for update-rc.d' from 'Provice "is-enabled" command for update-rc.d' Request was from Michael Biebl <biebl@debian.org> to control@bugs.debian.org. (Fri, 12 Apr 2013 00:21:04 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#705254; Package sysv-rc. (Fri, 12 Apr 2013 20:30:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Michael Biebl <biebl@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Fri, 12 Apr 2013 20:30:04 GMT) Full text and rfc822 format available.

Message #12 received at 705254@bugs.debian.org (full text, mbox):

From: Michael Biebl <biebl@debian.org>
To: 705254@bugs.debian.org
Subject: Re: [Pkg-systemd-maintainers] Bug#705254: Provide "is-enabled" command for update-rc.d
Date: Fri, 12 Apr 2013 22:27:18 +0200
[Message part 1 (text/plain, inline)]
A rough idea how this check could look like:
1/ grep for Default-Start and Default-Stop in the LSB header
2/ To check if a service is enabled:
   for i in Default-Start: check if /etc/rc$i.d/S??$service
   for i in Default-Stop: check if /etc/rc$i.d/K??$service
if all of those checks are true, is-enabled returns true
3/ To check if a service is disabled:
   for i in Default-Start: check if exists /etc/rc$i.d/K??$service
   for i in Default-Stop: check if  /etc/rc$i.d/K??$service
if all of those checks are true, is-enabled returns false

otherwise return unknown. I'm not quite sure yet how to map that to
return codes, i.e. if we treat unknown as enabled or disabled. Probably
the latter.

Roger, do you know of a better idea to implement this check? Does that
check work correctly for rcS services?

A few examples:

a/ typical multi-user service: rsyslog
root@pluto:~# grep -E "Default-Start|Default-Stop" /etc/init.d/rsyslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6

root@pluto:~# ls /etc/rc?.d/???rsyslog
/etc/rc0.d/K04rsyslog  /etc/rc1.d/K04rsyslog  /etc/rc2.d/S01rsyslog
/etc/rc3.d/S01rsyslog  /etc/rc4.d/S01rsyslog  /etc/rc5.d/S01rsyslog
/etc/rc6.d/K04rsyslog

root@pluto:~# update-rc.d rsyslog disable
update-rc.d: using dependency based boot sequencing
insserv: warning: current start runlevel(s) (empty) of script `rsyslog'
overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script
`rsyslog' overrides LSB defaults (0 1 6).

root@pluto:~# ls /etc/rc?.d/???rsyslog
/etc/rc0.d/K04rsyslog  /etc/rc1.d/K04rsyslog  /etc/rc2.d/K04rsyslog
/etc/rc3.d/K04rsyslog  /etc/rc4.d/K04rsyslog  /etc/rc5.d/K04rsyslog
/etc/rc6.d/K04rsyslog

b/ rcS-type service: hdparm
root@pluto:~# grep -E "Default-Start|Default-Stop" /etc/init.d/hdparm
# Default-Start:     S
# Default-Stop:

root@pluto:~# ls /etc/rc?.d/???hdparm
/etc/rcS.d/S05hdparm

root@pluto:~# update-rc.d hdparm disable
update-rc.d: using dependency based boot sequencing
insserv: warning: current start runlevel(s) (empty) of script `hdparm'
overrides LSB defaults (S).
insserv: warning: current stop runlevel(s) (S) of script `hdparm'
overrides LSB defaults (empty).

root@pluto:~# ls /etc/rc?.d/???hdparm
/etc/rcS.d/K05hdparm



Michael

-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#705254; Package sysv-rc. (Fri, 12 Apr 2013 20:45:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Michael Biebl <biebl@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Fri, 12 Apr 2013 20:45:04 GMT) Full text and rfc822 format available.

Message #17 received at 705254@bugs.debian.org (full text, mbox):

From: Michael Biebl <biebl@debian.org>
To: 705254@bugs.debian.org
Subject: Re: [Pkg-systemd-maintainers] Bug#705254: Provide "is-enabled" command for update-rc.d
Date: Fri, 12 Apr 2013 22:40:53 +0200
[Message part 1 (text/plain, inline)]
Am 12.04.2013 22:27, schrieb Michael Biebl:
> A rough idea how this check could look like:
> 1/ grep for Default-Start and Default-Stop in the LSB header
> 2/ To check if a service is enabled:
>    for i in Default-Start: check if /etc/rc$i.d/S??$service
>    for i in Default-Stop: check if /etc/rc$i.d/K??$service
> if all of those checks are true, is-enabled returns true
> 3/ To check if a service is disabled:
>    for i in Default-Start: check if exists /etc/rc$i.d/K??$service
>    for i in Default-Stop: check if  /etc/rc$i.d/K??$service
> if all of those checks are true, is-enabled returns false

The point here is to turn S into K symlinks for the is-disabled case.

That said, the above check is flawed, since it doesn't take into account
if the administrator has made custom changes, i.e. deleted symlinks
manually or added one manually. So I'd say we always need to check *all*
runlevels for existing symlinks and compare that with the expected set
of S and K symlinks.

Michael



-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?

[signature.asc (application/pgp-signature, attachment)]

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sun Apr 20 13:47:54 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.