init.d-status
Table of Contents |
Note The data on this page was generated from the alpha-6 hardy-server-i386.iso:/pool/main/ directory. If you want this data for all of Ubuntu, run the script at the bottom of the page across a full mirror. Mind you, there is no testing for spaces in path names, so make sure there are none in your mirror!
What is this
The LSB suggests that init scripts provide a status method. This page documents the process of finding out which scripts do that and which don't.
Full List
This list was generated from the get_process_package_scripts - one liner - see below. It contains all processes that have a path name, thus excludes kernel processes and processes that do not show a path in the process list. From the list of processes was generated a list of packages and dependencies that have an init.d script.
/usr/sbin/apache2 -> apache2.2-common -> /etc/init.d /etc/init.d/apache2 /usr/sbin/apache2 -> libc6 -> /etc/init.d /etc/init.d/glibc.sh /usr/sbin/atd -> at -> /etc/init.d /etc/init.d/atd /usr/sbin/atd -> libc6 -> /etc/init.d /etc/init.d/glibc.sh /usr/sbin/atd -> sysv-rc -> /etc/init.d /etc/init.d/rc /etc/init.d/README /etc/init.d/rcS /bin/bash -> libc6 -> /etc/init.d /etc/init.d/glibc.sh /bin/sh -> libc6 -> /etc/init.d /etc/init.d/glibc.sh /usr/sbin/named -> bind9 -> /etc/init.d /etc/init.d/bind9 /usr/sbin/named -> libc6 -> /etc/init.d /etc/init.d/glibc.sh /usr/sbin/named -> netbase -> /etc/init.d /etc/init.d/networking /bin/dd -> libc6 -> /etc/init.d /etc/init.d/glibc.sh /usr/sbin/cron -> cron -> /etc/init.d /etc/init.d/cron /usr/sbin/cron -> libc6 -> /etc/init.d /etc/init.d/glibc.sh /usr/sbin/cron -> sysv-rc -> /etc/init.d /etc/init.d/rc /etc/init.d/README /etc/init.d/rcS /usr/sbin/cupsd -> cupsys -> /etc/init.d /etc/init.d/cupsys /usr/sbin/cupsd -> libc6 -> /etc/init.d /etc/init.d/glibc.sh /usr/sbin/cupsd -> procps -> /etc/init.d /etc/init.d/procps /usr/sbin/cupsd -> sysv-rc -> /etc/init.d /etc/init.d/rc /etc/init.d/README /etc/init.d/rcS /usr/sbin/dovecot -> dovecot-common -> /etc/init.d /etc/init.d/dovecot /usr/sbin/dovecot -> libc6 -> /etc/init.d /etc/init.d/glibc.sh /usr/sbin/dovecot -> sysv-rc -> /etc/init.d /etc/init.d/rc /etc/init.d/README /etc/init.d/rcS /sbin/klogd -> klogd -> /etc/init.d /etc/init.d/klogd /sbin/klogd -> libc6 -> /etc/init.d /etc/init.d/glibc.sh /sbin/klogd -> sysklogd -> /etc/init.d /etc/init.d/sysklogd /sbin/klogd -> sysv-rc -> /etc/init.d /etc/init.d/rc /etc/init.d/README /etc/init.d/rcS /bin/login -> libc6 -> /etc/init.d /etc/init.d/glibc.sh /usr/sbin/mysqld -> mysql-server-5.0 -> /etc/init.d /etc/init.d/mysql-ndb-mgm /etc/init.d/mysql-ndb /etc/init.d/mysql /usr/sbin/mysqld -> libc6 -> /etc/init.d /etc/init.d/glibc.sh /usr/sbin/sshd -> openssh-server -> /etc/init.d /etc/init.d/ssh /usr/sbin/sshd -> libc6 -> /etc/init.d /etc/init.d/glibc.sh /usr/lib/postfix/master -> postfix -> /etc/init.d /etc/init.d/postfix /usr/lib/postfix/master -> libc6 -> /etc/init.d /etc/init.d/glibc.sh /usr/lib/postfix/master -> netbase -> /etc/init.d /etc/init.d/networking /usr/sbin/nmbd -> samba -> /etc/init.d /etc/init.d/samba /usr/sbin/nmbd -> libc6 -> /etc/init.d /etc/init.d/glibc.sh /usr/sbin/nmbd -> procps -> /etc/init.d /etc/init.d/procps /usr/sbin/smbd -> samba -> /etc/init.d /etc/init.d/samba /usr/sbin/smbd -> libc6 -> /etc/init.d /etc/init.d/glibc.sh /usr/sbin/smbd -> procps -> /etc/init.d /etc/init.d/procps /sbin/syslogd -> sysklogd -> /etc/init.d /etc/init.d/sysklogd /sbin/syslogd -> libc6 -> /etc/init.d /etc/init.d/glibc.sh /sbin/syslogd -> klogd -> /etc/init.d /etc/init.d/klogd /sbin/syslogd -> sysv-rc -> /etc/init.d /etc/init.d/rc /etc/init.d/README /etc/init.d/rcS /sbin/udevd -> udev -> /etc/init.d /etc/init.d/udev /etc/init.d/udev-finish /sbin/udevd -> libc6 -> /etc/init.d /etc/init.d/glibc.sh /sbin/udevd -> module-init-tools -> /etc/init.d /etc/init.d/module-init-tools /sbin/udevd -> procps -> /etc/init.d /etc/init.d/procps /sbin/init -> libc6 -> /etc/init.d /etc/init.d/glibc.sh /sbin/getty -> util-linux -> /etc/init.d /etc/init.d/hwclock.sh /etc/init.d/hwclockfirst.sh /sbin/getty -> libc6 -> /etc/init.d /etc/init.d/glibc.sh /usr/sbin/winbindd -> winbind -> /etc/init.d /etc/init.d/winbind /usr/sbin/winbindd -> libc6 -> /etc/init.d /etc/init.d/glibc.sh
List of unique processes
/bin/bash /bin/dd /bin/login /bin/sh /sbin/getty /sbin/init /sbin/klogd /sbin/syslogd /sbin/udevd /usr/lib/postfix/master /usr/sbin/apache2 /usr/sbin/atd /usr/sbin/cron /usr/sbin/cupsd /usr/sbin/dovecot /usr/sbin/mysqld /usr/sbin/named /usr/sbin/nmbd /usr/sbin/smbd /usr/sbin/sshd /usr/sbin/winbindd
List of unique packages
apache2.2-common at bind9 cron cupsys dovecot-common klogd libc6 module-init-tools mysql-server-5.0 netbase openssh-server postfix procps samba sysklogd sysv-rc udev util-linux winbind
List of unique scripts
/etc/init.d/apache2 /etc/init.d/atd /etc/init.d/bind9 /etc/init.d/cron /etc/init.d/cupsys /etc/init.d/dovecot /etc/init.d/glibc.sh /etc/init.d/hwclockfirst.sh /etc/init.d/hwclock.sh /etc/init.d/klogd /etc/init.d/module-init-tools /etc/init.d/mysql /etc/init.d/mysql-ndb /etc/init.d/mysql-ndb-mgm /etc/init.d/networking /etc/init.d/postfix /etc/init.d/procps /etc/init.d/rc /etc/init.d/rcS /etc/init.d/README /etc/init.d/samba /etc/init.d/ssh /etc/init.d/sysklogd /etc/init.d/udev /etc/init.d/udev-finish /etc/init.d/winbind
List of affected source packages
This list is not final yet. Once it is, this disclaimer will be removed. This list does not include lsb, it is the list of source packages that have init.d scripts that require a patch to return a 'status'.
apache2 at bind9 cron dovecot openssh samba * sysklogd udev
* Package has been partially patched.
Scripts which already support status
/etc/init.d/apparmor /etc/init.d/cupsys /etc/init.d/mysql /etc/init.d/postfix /etc/init.d/postgresql-8.3
Observations
- apparmor isn't running a process, because the initscript modifies kernel state and does not keep a long-running process around.
- postgesql-8.3 isn't running a process, likely because it's not automatically configured.
- mysql has a status, but mysql-ndb and mysql-ndb-mgm do not.
- /etc/init.d/rc, /etc/init.d/rcS and /etc/init.d/README will not need status support.
- hdparm has some check to do with raid status which may or may not be relevant to supporting "status" in its init.d script.
- due to a bug in the hardy alpha installer, the postgresql process isn't running, so it does not show up correctly in the above lists.
Resources
The scripts in this section are not bullet-proof and are intended only to create initial test output. If this process needs repeating at some future time, most likely a LP project will be created. For now, user beware.
one-liner to generate raw list of processes -> packages -> scripts
get_process_package_scripts
ps -ealf | cut -b76- | grep ^/ | cut -d' ' -f1 | sort | uniq | while read process ; do dpkg -S $process ; done | grep -v 'diversion by' | sort | uniq | sed 's/://' | while read package process ; do init=`dpkg -L $package|grep /etc/init.d` ; if test "$init" ; then echo $process -\> $package -\> $init ; fi; apt-cache --installed depends $package | grep Depends: | cut -d: -f2 | while read depend ; do init=`dpkg -L $depend | grep /etc/init.d` ; if test "$init" ; then echo $process -\> $depend -\> $init ; fi; done ; done
get_init_script
This script can be used to create some raw data: (get_init_script)
# # Assumptions: # - all the files in the current directory tree are package files # - there are no spaces in either the package name or the temp_dir path # - a package with init.d script has it stored inside the /etc/init.d directory, not created by post installation script # # # #cd /media/cdrom/pool/main # find -type f | while read file ; do ( temp_dir=`mktemp -d` ; dpkg -x ${file} ${temp_dir} if test -d ${temp_dir}/etc/init.d/ ; then ( package=`dpkg-deb --showformat='${Package}' -W ${file}` echo -ne ${file}"\t"${package}"\t" if grep -a 'status)' ${temp_dir}/etc/init.d/* > /dev/null ; then echo 'status' else echo 'none' fi ) fi rm -rf ${temp_dir} ) done
The output will look like this (in tab separated format):
./acct/acct_6.4~pre1-4ubuntu1_i386.deb acct none ./alsa-utils/alsa-utils_1.0.14-1ubuntu4_i386.deb alsa-utils none ./apache2/apache2.2-common_2.2.4-3build1_i386.deb apache2.2-common none ./apparmor/apparmor_2.1+993-0ubuntu3_i386.deb apparmor status ./at/at_3.1.10ubuntu4_i386.deb at none ./autofs/autofs_4.1.4+debian-1_i386.deb autofs status
get_task_pkg
This snippet will create a list of packages that are installed by the server tasks: (get_task_pkg)
tasksel --list-tasks | grep server | while read a task b ; do tasksel --task-packages $task ; done | sort | uniq
Generate server task init.d status
This snippet will create a list of packages installed by the server tasks, complete with init.d status:
get_init_script > init.scripts get_task_pkg > task.list grep -f task.list init.scripts
Comments
- The /var/lib/dpkg/info directory contains many references to init.d and needs to be investigated.
- What about init.d scripts that are generated or copied by a package, either on first run, or on installation.
- Will using source packages give us more scripts?
References
OnnoBenschop/ubuntu-server/init.d-status (last edited 2008-08-06 16:41:04 by localhost)