[Pkg-sysvinit-devel] Bug#680293: update-rc.d manual: `update-rc.d remove name` works when `/etc/init.d/name` exists

Roger Leigh rleigh at codelibre.net
Wed Jul 4 22:01:25 UTC 2012


On Wed, Jul 04, 2012 at 11:00:53PM +0200, Paul Menzel wrote:
> Am Mittwoch, den 04.07.2012, 21:33 +0100 schrieb Roger Leigh:
> > On Wed, Jul 04, 2012 at 10:17:10PM +0200, Paul Menzel wrote:
> > > 
> > > the manual of `update-rc.d` contains the following paragraph.
> > > 
> > >         $ man update-rc.d
> > >         […]
> > >         When invoked with the remove option, update-rc.d removes any
> > >         links in the /etc/rcrunlevel.d directories to the
> > >         script /etc/init.d/name. The script must have been deleted
> > >         already.  If the script is still present then update-rc.d aborts
> > >         with an error message.
> > >         […]
> > 
> > This is my understanding.  It should only remove the links if you use
> > "-f remove" to force removal.

I'm not entirely certain of the historical reasons, but it's likely a
safety feature to prevent accidental removal of links, since you could
make your system unbootable if you removed a critical link.

> > > It looks like `update-rc.d remove name` still works though when the
> > > script in `/etc/init.d/name` is not removed beforehand.
> > > 
> > >         $ sudo update-rc.d pulseaudio remove
> > >         update-rc.d: using dependency based boot sequencing
> > >         $ ls -l /etc/init.d/pulseaudio
> > >         -rwxr-xr-x 1 root root 2227  1. Okt 2011  /etc/init.d/pulseaudio
> > >         $ ls -l /etc/rc*.d/*audio
> > >         ls: Zugriff auf /etc/rc*.d/*audio nicht möglich: Datei oder Verzeichnis nicht gefunden
> > >         $ sudo service pulseaudio stop
> > >         PulseAudio configured for per-user sessions ... (warning).
> > > 
> > > Does the manual need updating?
> > 
> > No, I think the manual is correct and update-rc.d is not behaving as
> > documented.
> 
> I wonder though, what is the disadvantage of leaving `/etc/init.d/name`
> behind and `-f` has to be used to do so?

As above, I think it's not so much about leaving the init script behind,
as it is about preventing removing needed links inadvertently.

> > Mind you, I've not seen this before.  But I can also reproduce it:
> > 
> > % ls /etc/init.d/cups 
> > /etc/init.d/cups
> > % ls /etc/rc*.d/*cups
> > /etc/rc1.d/K01cups  /etc/rc2.d/S04cups  /etc/rc3.d/S04cups  /etc/rc4.d/S04cups  /etc/rc5.d/S04cups
> > % sudo update-rc.d cups remove
> > update-rc.d: using dependency based boot sequencing
> > % ls /etc/rc*.d/*cups         
> > zsh: no matches found: /etc/rc*.d/*cups
> > % sudo update-rc.d cups defaults
> > update-rc.d: using dependency based boot sequencing
> > % ls /etc/rc*.d/*cups           
> > /etc/rc1.d/K01cups  /etc/rc2.d/S04cups  /etc/rc3.d/S04cups  /etc/rc4.d/S04cups  /etc/rc5.d/S04cups
> > 
> > I'm fairly sure this didn't happen until recently.  But there were only
> > two changes to update-rc.d in 2012, and both were trivial changes which
> > didn't affect this.  This will need investigating in more detail.
> 
> I tried it on a system with sysv-rc 2.88dsf-22.1 which has *not* been
> converted to dependency based boot yet. There it behaved as described in
> the manual.

Thanks, that's useful to know.

> > % sudo update-rc.d cups disable 
> > update-rc.d: using dependency based boot sequencing
> > insserv: warning: current start runlevel(s) (empty) of script `cups' overwrites defaults (2 3 4 5).
> > insserv: warning: current stop runlevel(s) (1 2 3 4 5) of script `cups' overwrites defaults (1).
> > % ls /etc/rc*.d/*cups          
> > /etc/rc1.d/K01cups  /etc/rc2.d/K01cups  /etc/rc3.d/K01cups  /etc/rc4.d/K01cups  /etc/rc5.d/K01cups
> > 
> > % sudo update-rc.d cups enable 
> > update-rc.d: using dependency based boot sequencing
> > % ls /etc/rc*.d/*cups         
> > /etc/rc1.d/K01cups  /etc/rc2.d/S04cups  /etc/rc3.d/S04cups  /etc/rc4.d/S04cups  /etc/rc5.d/S04cups
> > 
> > This converts the start links to stop links, and enable reverses this.
> 
> Thank you for the explanation. Although skimming through the manual
> pages, I did not find how these links are used. Links starting with »S«
> are executed with the `start` argument and links starting with »K« with
> the `stop` argument?

Yes.  This is classic System V init behaviour.  When you enter a runlevel,
you run all the S links with "start".  When you leave a runlevel, you
run all the "K" links with "stop"; actually the ways the scripts are run
when you switch runlevels isn't quite that straightforward, but that's
almost essentially what happens.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux    http://people.debian.org/~rleigh/
 `. `'   schroot and sbuild  http://alioth.debian.org/projects/buildd-tools
   `-    GPG Public Key      F33D 281D 470A B443 6756 147C 07B3 C8BC 4083 E800





More information about the Pkg-sysvinit-devel mailing list