InitScriptStatusActions

Differences between revisions 19 and 79 (spanning 60 versions)
Revision 19 as of 2008-07-23 17:53:59
Size: 6413
Editor: cpe-66-68-158-133
Comment: added ToC
Revision 79 as of 2009-11-29 13:27:58
Size: 8458
Editor: 77-21-62-108-dynip
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
||<tablestyle="float:right; font-size: 0.9em; width:40%; background:#F1F1ED; margin: 0 0 1em 1em;" style="padding:0.5em;">'''Contents'''[[BR]][[TableOfContents(3)]]|| ||<tablestyle="float:right; font-size: 0.9em; width:40%; background:#F1F1ED; margin: 0 0 1em 1em;" style="padding:0.5em;"><<TableOfContents(3)>>||
Line 8: Line 8:
DustinKirkland worked with Debian to [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=490095 provide a status_of_proc() method] in /lib/lsb/init-functions, in the [http://packages.qa.debian.org/l/lsb.html lsb-base] library package. This function is fully integrated in Intrepid as of [https://launchpad.net/ubuntu/+source/lsb lsb-3.2-14]. DustinKirkland worked with Debian to [[http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=490095|provide a method]], {{{ status_of_proc() }}}, in /lib/lsb/init-functions, in the [[http://packages.qa.debian.org/l/lsb.html|lsb-base]] library package. This function is fully integrated in Intrepid as of [[https://launchpad.net/ubuntu/+source/lsb|lsb-3.2-14]].
Line 12: Line 12:
Numerous init scripts should be patched to call status_of_proc() and provide a ''status'' action. A simple recipe follows for adding such functionality. Numerous init scripts should be patched to call {{{ status_of_proc() }}} and provide a ''status'' action. A simple recipe follows for adding such functionality.
Line 15: Line 15:
When you encounter an init script that lacks a status action: When you encounter an init script that [[https://wiki.ubuntu.com/InitScriptStatusActions#head-75448d0a482c28a007476b3be2394d9db3213662|lacks a status action]]:
Line 31: Line 31:
 1. Test your patched init script for the new functionality and regressions  1. Assuming that you have the package installed, test your patched init script for the new functionality and regressions. Check that $? after the status calls are 0 on success, and non-zero on failure.
  * {{{ sudo sh debian/FOO.init start }}}
   * {{{ * Starting FOO [ OK ] }}}
Line 33: Line 35:
   * {{{ * FOO is running. }}}
Line 34: Line 37:
   * {{{ * Stopping FOO [ OK ] }}}
Line 35: Line 39:
   * {{{ * FOO is not running. }}}
Line 36: Line 41:
  * {{{ sh debian/FOO.init status; echo $? }}}    * {{{ * Starting FOO [ OK ] }}}
Line 42: Line 47:
  * [http://launchpadlibrarian.net/15924139/at.status.debdiff atd]
  * [http://launchpadlibrarian.net/15936081/openssh.status.debdiff openssh-server]
 1. Add your patch to the Launchpad bug you filed, mark as ''In Progress''
  * [[http://launchpadlibrarian.net/15924139/at.status.debdiff|atd]]
  * [[http://launchpadlibrarian.net/15936081/openssh.status.debdiff|openssh-server]]
 1. Add your patch to the Launchpad bug you filed, mark as ''Confirmed''
Line 46: Line 51:
 1. For bonus points, file a bug in Debian, and work the patch back upstream
  * Use [[Debian/Usertagging]]
   * {{{User: ubuntu-devel@lists.ubuntu.com}}}
   * {{{Usertags: origin-ubuntu ubuntu-patch intrepid}}}
Line 51: Line 60:
You can run '''dpkg -S /etc/init.d/...''' to determine the source package of any of the following scripts. You can run {{{ dpkg -S /etc/init.d/... }}} to determine the source package of any of the following scripts.
Line 54: Line 63:
=== /etc/init.d/... init scripts with associated daemon(s) ===
 1. acpid
 1. at: wiki:Bug:247091 (FIXED)
 1. bind9: wiki:Bug:247084 (Patch submitted, awaiting sponsorship)
 1. bip - (not in main, but a pet peeve of mine when it goes down, would like a status action)
 1. bluetooth
 1. bootlogd
 1. brltty
 1. cron: wiki:Bug:201504 (FIXED)
 1. dbus
 1. dhcdbd
 1. dovecot: wiki:Bug:247096 (FIXED)
 1. gdm
 1. hal
 1. kdm
=== Init scripts with daemon(s) ===

===== /etc/init.d/... =====

 1. acpid: Bug:251681 (FIXED)
 1. at: Bug:247091 (FIXED)
 1. bind9: Bug:247084 (Patch submitted, awaiting main sponsorship)
 1. bip: Bug:251287 (FIXED), [[http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=492126|Debian #492126]]
 1. bluetooth: Bug:251684 (FIXED)
 1. bootlogd: Bug:259435 (Patch submitted, awaiting main sponsorship)
 1. brltty: Bug:251626 (FIXED)
 1. cron: Bug:201504 (FIXED)
 1. dbus Bug:252214 (FIXED), [[http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=492541|Debian #492541]]
 1. dhcdbd: Bug:251624 (FIXED)
 1. dovecot: Bug:247096 (FIXED)
 1. gdm: Bug:251375 (FIXED)
 1. hal: Bug:252350 (FIXED), [[http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=492625|Debian #492625]]
 1. kdm: Bug:259446 (Patch submitted, awaiting main sponsorship)
 1. lighttpd: Bug:251924 (FIXED)
Line 72: Line 85:
 1. mythtv-backend Bug:251325 (FIXED)
 1. nginx: Bug:251985 (FIXED)
 1. nis
Line 73: Line 89:
 1. openssh: wiki:Bug:247103 (FIXED)  1. openssh: Bug:247103 (FIXED)
 1. portmap: Bug:254499 (Patch submitted, awaiting main sponsorship)
Line 75: Line 92:
 1. pulseaudio
 1. rsync
 1. samba: wiki:Bug:247087 (Patch submitted, awaiting sponsorship)
 1. squid
 1. sysklogd: wiki:Bug:247106 (FIXED)
 1. system-tools-backends
 1. pulseaudio (Be careful with this one: the default for desktop installs is via session, not via this initscript.)
 1. rsync: Bug:251320 (FIXED), [[http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=492138|Debian #492138]]
 1. samba: Bug:247087 (Patch submitted, awaiting main sponsorship)
 1. squid: Bug:251299 (FIXED), [[http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=492131|Debian #492131]]
 1. sysklogd: Bug:247106 (FIXED)
 1. system-tools-backends: Bug:300743 (Patch submitted)
Line 82: Line 99:
 1. winbind: wiki:Bug:247087 (Patch submitted, awaiting sponsorship)

=== /etc/init.d/... Non-daemon init scripts ===
 1. winbind: Bug:247087 (FIXED)
 1. xinetd: Bug:251975 (FIXED)
 
=== Init scripts without daemon(s) ===
Line 88: Line 106:

===== /etc/init.d/... =====
Line 94: Line 114:
 1. mythtv-status: Bug:251330 (Patch awaiting sponsorship), checks if mythtv-status has run successfully
Line 102: Line 123:
 1. firehol - status could check if current iptables match those firehol generates from its configuration ("firehol debug") else dispay the diff. Bug:185978
Line 106: Line 128:

===== /etc/init.d/... =====
Line 150: Line 174:
= References = == References ==
 1. http://lists.debian.org/debian-devel/2008/07/msg01031.html
Line 153: Line 178:
 1. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=291148
 1. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=208010

Background

The LSB suggests that init scripts provide a status action:

DustinKirkland worked with Debian to provide a method,  status_of_proc() , in /lib/lsb/init-functions, in the lsb-base library package. This function is fully integrated in Intrepid as of lsb-3.2-14.

Adding status actions to init scripts

Numerous init scripts should be patched to call  status_of_proc()  and provide a status action. A simple recipe follows for adding such functionality.

Patch Checklist

When you encounter an init script that lacks a status action:

  1. Determine the source package
    •  dpkg -S /etc/init.d/FOO 

  2. Open a bug in Launchpad against the package
  3. Grab the source and build dependencies
    •  apt-get source FOO 

    •  sudo apt-get build-dep FOO 

  4. Locate the init script in the source tree, sometimes
    •  debian/*.init 

    •  debian/rc 

  5. Patch the source to
    • have the init script call status_of_proc()
    • have the init script add "status" to the usage statement
    • add a dependency in debian/control for lsb-base >= 3.2-14

    • add the changelog entry referencing your Launchpad bug, (LP: #999999)
  6. Assuming that you have the package installed, test your patched init script for the new functionality and regressions. Check that $? after the status calls are 0 on success, and non-zero on failure.
    •  sudo sh debian/FOO.init start 

      •   * Starting FOO      [ OK ] 

    •  sh debian/FOO.init status; echo $? 

      •   * FOO is running. 

    •  sudo sh debian/FOO.init stop 

      •   * Stopping FOO      [ OK ] 

    •  sh debian/FOO.init status; echo $? 

      •   * FOO is not running. 

    •  sudo sh debian/FOO.init start 

      •   * Starting FOO      [ OK ] 

  7. Build a source package
    •  debuild -S 

  8. Generate a patch
    •  debdiff 

  9. Compare your work to some of the other patches
  10. Add your patch to the Launchpad bug you filed, mark as Confirmed

  11. Subscribe kirkland, and (ubuntu-main-sponsors or ubuntu-universe-sponsors) as appropriate

  12. For bonus points, file a bug in Debian, and work the patch back upstream
    • Use Debian/Usertagging

      • User: ubuntu-devel@lists.ubuntu.com

      • Usertags: origin-ubuntu ubuntu-patch intrepid

Init Scripts that Need a Status Action

The following is a crude list of init scripts in Intrepid that are lacking a "status" action. I say "crude" in that this list was generated on 2008-07-21 by installing the Intrepid Ubuntu (server, ubuntu-desktop, kubuntu-desktop, xubuntu-desktop), and grepping through /etc/init.d for scripts that lacked the string "status)". Please help improve this list by adding/removing init scripts to/from this list, and linking to a bug number. Please leave an informative note in this wiki page's changelog.

You can run  dpkg -S /etc/init.d/...  to determine the source package of any of the following scripts.

Init scripts with daemon(s)

/etc/init.d/...
  1. acpid: 251681 (FIXED)

  2. at: 247091 (FIXED)

  3. bind9: 247084 (Patch submitted, awaiting main sponsorship)

  4. bip: 251287 (FIXED), Debian #492126

  5. bluetooth: 251684 (FIXED)

  6. bootlogd: 259435 (Patch submitted, awaiting main sponsorship)

  7. brltty: 251626 (FIXED)

  8. cron: 201504 (FIXED)

  9. dbus 252214 (FIXED), Debian #492541

  10. dhcdbd: 251624 (FIXED)

  11. dovecot: 247096 (FIXED)

  12. gdm: 251375 (FIXED)

  13. hal: 252350 (FIXED), Debian #492625

  14. kdm: 259446 (Patch submitted, awaiting main sponsorship)

  15. lighttpd: 251924 (FIXED)

  16. mysql
  17. mysql-ndb
  18. mysql-ndb-mgm
  19. mythtv-backend 251325 (FIXED)

  20. nginx: 251985 (FIXED)

  21. nis
  22. openvpn
  23. openssh: 247103 (FIXED)

  24. portmap: 254499 (Patch submitted, awaiting main sponsorship)

  25. powernowd
  26. pulseaudio (Be careful with this one: the default for desktop installs is via session, not via this initscript.)
  27. rsync: 251320 (FIXED), Debian #492138

  28. samba: 247087 (Patch submitted, awaiting main sponsorship)

  29. squid: 251299 (FIXED), Debian #492131

  30. sysklogd: 247106 (FIXED)

  31. system-tools-backends: 300743 (Patch submitted)

  32. usplash
  33. winbind: 247087 (FIXED)

  34. xinetd: 251975 (FIXED)

Init scripts without daemon(s)

No daemon, but detectable status

The following init scripts do not have an associated daemon, however, they do perform actions on the system which could be algorithmically checked. I'm noting some suggested items that could be checked in a 'status' action.

/etc/init.d/...
  1. apport - status should look at /proc/sys/kernel/core_pattern
  2. binfmt-support - status should check update-binfmts --display, perhaps
  3. checkfs.sh - status could show the time/date/results of the last check
  4. checkroot.sh - similar to checkfs.sh, perhaps?
  5. mountoverflowtmp - status could check the tmp mountpoint
  6. mythtv-status: 251330 (Patch awaiting sponsorship), checks if mythtv-status has run successfully

  7. networking - status could check network connectivity
  8. pcmciautils - status could check lsmod for needed modules
  9. policykit - status could check directory existence and permissions
  10. rmnologin - status could check /var/lib/initscripts/nologin
  11. screen-cleanup - status could check /var/run/screen
  12. single - status could check if in single user mode or not
  13. skeleton - the skeleton init script itself should be enhanced to have a status action!
  14. urandom - status could check /dev/urandom
  15. firehol - status could check if current iptables match those firehol generates from its configuration ("firehol debug") else dispay the diff. 185978

No daemon

The following init scripts do not have an associated deamon. On initial review of the code, a 'status' action for these scripts does not necessarily make sense. If you have an idea of a sensible status action, please note the suggestion and move the item to the list above (detectable status).

/etc/init.d/...
  1. acpi-support
  2. alsa-utils
  3. bootmisc.sh
  4. console-screen.sh
  5. console-setup
  6. dns-clean
  7. glibc.sh
  8. halt
  9. hostname.sh
  10. hotkey-setup
  11. hwclockfirst.sh
  12. hwclock.sh
  13. keyboard-setup
  14. killprocs
  15. loopback
  16. module-init-tools
  17. mountall-bootclean.sh
  18. mountall.sh
  19. mountdevsubfs.sh
  20. mountkernfs.sh
  21. mountnfs-bootclean.sh
  22. mountnfs.sh
  23. powernowd.early
  24. pppd-dns
  25. procps
  26. rc
  27. rc.local
  28. rcS
  29. readahead
  30. readahead-desktop
  31. reboot
  32. resolvconf
  33. sendsigs
  34. stop-bootlogd
  35. stop-bootlogd-single
  36. stop-readahead
  37. umountfs
  38. umountnfs.sh
  39. umountroot
  40. vbesave
  41. wpa-ifupdown
  42. xserver-xorg-input-wacom

References

  1. http://lists.debian.org/debian-devel/2008/07/msg01031.html

  2. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=490095

  3. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=483285

  4. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=291148

  5. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=208010

  6. http://packages.qa.debian.org/l/lsb.html

  7. https://wiki.ubuntu.com/OnnoBenschop/ubuntu-server/init.d-status

InitScriptStatusActions (last edited 2009-11-29 13:27:58 by 77-21-62-108-dynip)