$ sudo service cassandra status
● cassandra.service - LSB: distributed storage system for structured data
   Loaded: loaded (/etc/init.d/cassandra; bad; vendor preset: enabled)
   Active: active (running) since Wed 2016-10-12 15:54:40 IDT; 4min 4s ago

What does the bad; part on the 2nd line of the output stand for? I get this for many services, e.g. mysql, winbind, virtualbox, some of which I've flawlessly used already (cassandra being a fresh install).

share|improve this question

Short answer:

  • bad : It shows Systemd Unit files status
  • you will find this option in system which use systemd
  • you can check this option using command:

    sudo systemctl is-enabled <unit-name>
    

    if that unit file support native systemd then it will give output enabled , disabled etc. if not support then it will give status with message like.

    sudo systemctl is-enabled apache2
    apache2.service is not a native service, redirecting to systemd-sysv-install
    Executing /lib/systemd/systemd-sysv-install is-enabled apache2
    enabled
    

    but with command :

    systemctl status apache2
    or
    service apache2 status
    

    it gives status bad. ( may be it is because not able to print complete message or developer decided to print bad)

Long Answer:

what is system unit files ?

Units are the objects that systemd knows how to manage. These are basically a standardized representation of system resources that can be managed by the suite of daemons and manipulated by the provided utilities. It can be used to abstract services, network resources, devices, filesystem mounts, and isolated resource pools. You can read in detail about systemd units here and here

example:

systemctl status apache2
* apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           `-apache2-systemd.conf
   Active: active (running) since Wed 2016-10-12 14:29:42 UTC; 17s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 1027 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)

systemctl will check apache2 is native units or not. if not then it will ask systemd-sysv-generator to generate a file in unit format that support similarly to native units. In above example generated file kept at /lib/systemd/system/apache2.service.d/apache2-systemd.conf

Drop-In: /lib/systemd/system/apache2.service.d
               `-apache2-systemd.conf

Note: you can find generator at /lib/systemd/system-generators/systemd-sysv-generator and you can read more about that

man systemd-sysv-generator

Main point:

is-enabled NAME...
       Checks whether any of the specified unit files are enabled (as with
       enable). Returns an exit code of 0 if at least one is enabled,
       non-zero otherwise. Prints the current enable status (see table).
       To suppress this output, use --quiet.

       Table 1.  is-enabled output
       +------------------+-------------------------+-----------+
       |Name              | Description             | Exit Code |
       +------------------+-------------------------+-----------+
       |"enabled"         | Enabled via             |           |
       +------------------+ .wants/, .requires/     |           |
       |"enabled-runtime" | or alias symlinks       |           |
       |                  | (permanently in         | 0         |
       |                  | /etc/systemd/system/,   |           |
       |                  | or transiently in       |           |
       |                  | /run/systemd/system/).  |           |
       +------------------+-------------------------+-----------+
       |"linked"          | Made available through  |           |
       +------------------+ one or more symlinks    |           |
       |"linked-runtime"  | to the unit file        |           |
       |                  | (permanently in         |           |
       |                  | /etc/systemd/system/    |           |
       |                  | or transiently in       | > 0       |
       |                  | /run/systemd/system/),  |           |
       |                  | even though the unit    |           |
       |                  | file might reside       |           |
       |                  | outside of the unit     |           |
       |                  | file search path.       |           |
       +------------------+-------------------------+-----------+
       |"masked"          | Completely disabled,    |           |
       +------------------+ so that any start       |           |
       |"masked-runtime"  | operation on it fails   |           |
       |                  | (permanently in         | > 0       |
       |                  | /etc/systemd/system/    |           |
       |                  | or transiently in       |           |
       |                  | /run/systemd/systemd/). |           |
       +------------------+-------------------------+-----------+
       |"static"          | The unit file is not    | 0         |
       |                  | enabled, and has no     |           |
       |                  | provisions for enabling |           |
       |                  | in the "[Install]"      |           |
       |                  | section.                |           |
       +------------------+-------------------------+-----------+
       |"indirect"        | The unit file itself is | 0         |
       |                  | not enabled, but it has |           |
       |                  | a non-empty Also=       |           |
       |                  | setting in the          |           |
       |                  | "[Install]" section,    |           |
       |                  | listing other unit      |           |
       |                  | files that might be     |           |
       |                  | enabled.                |           |
       +------------------+-------------------------+-----------+
       |"disabled"        | Unit file is not        | > 0       |
       |                  | enabled, but contains   |           |
       |                  | an "[Install]" section  |           |
       |                  | with installation       |           |
       |                  | instructions.           |           |
       +------------------+-------------------------+-----------+
       |"bad"             | Unit file is invalid or | > 0       |
       |                  | another error occurred. |           |
       |                  | Note that is-enabled    |           |
       |                  | will not actually       |           |
       |                  | return this state, but  |           |
       |                  | print an error message  |           |
       |                  | instead. However the    |           |
       |                  | unit file listing       |           |
       |                  | printed by              |           |
       |                  | list-unit-files might   |           |
       |                  | show it.                |           |
       +------------------+-------------------------+-----------+

if we run command :

sudo systemctl is-enabled ssh
enabled

sudo systemctl is-enabled docker
enabled

sudo systemctl is-enabled apache2
apache2.service is not a native service, redirecting to systemd-sysv-install
Executing /lib/systemd/systemd-sysv-install is-enabled apache2
enabled

you can see if units are native to systemd like ssh and docker in above output it will show only enabled and units that are not support native like apache2 still enabled but giving messages with that but not printing bad here because of this condition:

       +------------------+-------------------------+-----------+
       |"bad"             | Unit file is invalid or | > 0       |
       |                  | another error occurred. |           |
       |                  | Note that is-enabled    |           |
       |                  | will not actually       |           |
       |                  | return this state, but  |           |
       |                  | print an error message  |           |
       |                  | instead. However the    |           |
       |                  | unit file listing       |           |
       |                  | printed by              |           |
       |                  | list-unit-files might   |           |
       |                  | show it.                |           |
       +------------------+-------------------------+-----------+

Solution:

status bad will not create problem (i am not sure it depends) but it will not provide all functionality of systemctl. you can wait for next release of that package that will natively support systemd. or you can write unit file for your service or any other resource using given references.

You can read in detail about systemd , systemctl and units using below References :

  1. Systemctl

  2. Systemd units and Here

  3. Systemd

share|improve this answer
    
Really thanks for the complete and considerate deliberation of the topic! – matt Oct 16 '16 at 7:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.