Decoding Ubuntu’s service –status-all Output: Meaning of +, -, and ? Symbols


2 views

When running service --status-all on Ubuntu systems, you'll encounter three primary status indicators:

[ + ]  rsyslog        # Running service
[ - ]  sendmail       # Stopped service 
[ ? ]  sendsigs       # Unknown status

Plus Sign (+): Indicates the service is currently running. For example:

[ + ]  rsyslog
[ + ]  nginx
[ + ]  mysql

Minus Sign (-): Shows the service is stopped but available in init.d. This appears when:

[ - ]  sendmail       # Removed but init script remains
[ - ]  apache2        # Stopped but installed

Question Mark (?): Means the service status couldn't be determined. Common with:

[ ? ]  sendsigs       # No status command implemented
[ ? ]  umountfs       # Legacy script without status

The unexpected - status for SSH while connected occurs because:

# Traditional init scripts check process directly
if ! pgrep sshd >/dev/null; then
  echo " - "
fi

# Systemd services would show correctly:
systemctl status sshd

For packages removed but still showing in status:

# Completely remove all related files
sudo apt-get purge sendmail*
sudo update-rc.d -f sendmail remove

# Alternative cleanup:
sudo rm /etc/init.d/sendmail

For modern Ubuntu systems, better alternatives exist:

# Systemd systems:
systemctl list-units --type=service --all

# For detailed status:
service --status-all | grep -E "\$$(\\+|\\-) \$$"

For services showing ?, you can implement proper status checks:

#!/bin/bash
# Example custom status check for sendsigs
if pidof sendsigs >/dev/null; then
  echo "[ + ] sendsigs"
else
  echo "[ - ] sendsigs"
fi

The service --status-all command provides a quick overview of all system services and their statuses. Here's what each symbol means:

[ + ]  Service is running
[ - ]  Service is stopped
[ ? ]  Service status cannot be determined

Let's examine your specific examples with technical explanations:

[ + ]  rsyslog     # Running system logging daemon
[ - ]  sendmail    # Removed but init script remains
[ ? ]  sendsigs    # Script doesn't support status checks
[ + ]  setvtrgb    # Virtual terminal color service
[ - ]  ssh         # sshd is running but service shows stopped

The SSH discrepancy occurs because Ubuntu uses Upstart/systemd alongside traditional init scripts. Check the actual status with:

# For systems using systemd:
sudo systemctl status ssh

# For traditional init:
sudo /etc/init.d/ssh status

Services showing ? typically have init scripts that don't implement the 'status' command. You can verify manually:

ps aux | grep sendsigs
sudo lsof -i | grep sendsigs

For services like sendmail that were removed but still appear:

# Remove leftover init script
sudo update-rc.d -f sendmail remove
sudo rm /etc/init.d/sendmail

# Alternative for systems using systemd
sudo systemctl disable sendmail

If you're creating custom services, here's how to implement proper status checking:

case "$1" in
    status)
        if [ -f /var/run/myservice.pid ]; then
            echo "Running"
            exit 0
        else
            echo "Stopped"
            exit 1
        fi
        ;;
    *)
        echo "Usage: $0 {start|stop|status}"
        exit 1
        ;;
esac