Some irritation due to extended output of systemd / systemctl status for sysv services


Bad is an unpleasant word, right? “On” or “off” implies some final statement, or “failed” may signal something wrong but at least terminated. But “bad”… uuuhh, blameworthy, guilty, unaccountable, still being around. Ok, before diving into linguistic depression, the change eventually turned out simple and was actually in good faith but, however, produced remarkable irritation. You know, systemctl status {service} will show an overview of some systemd unit definition with load state, current activity and so on. The load state, in particular, details, in parantheses, into the path of the unit file, the enablement and the vendor enablement preset, respectively. Original systemd units may give a load state as follows:

Loaded: loaded (/usr/lib/systemd/system/atop.service; enabled; vendor preset: disabled)

However, systemd units, that have just been derived from systemv init scripts, only printed the init script path since lately:

Loaded: loaded (/etc/rc.d/init.d/sysv-thing)

The new irritating factor now is an extension for those derived systemv init scripts, to also state the enablement, but show up as “bad” for the running enablement for whatever weird reason:

Loaded: loaded (/etc/rc.d/init.d/sysv-thing; bad; vendor preset: disabled)

Examining the case, credits to systemd: bad; vendor preset: enabled and sudo service status includes bad;, exhibits nothing more than some missing makeup for systemctl status output of derived systemv init scripts. Executing systemctl is-enabled {sysv-thing} will still return the correct answer. So nothing is “bad” really but a lot of people, searching for problems when getting some code up and running, were way alarmed for a false or for no reason. The following log compares the output of systemctl status {sysv-thing}/{service} on systems at systemd.x86_64 219-19.0.2.el7_2.9 @ol7_latest and systemd.x86_64 219-30.0.1.el7_3.7 @ol7_latest.

[root@tst01 ~]# yum list systemd
Installed Packages      systemd.x86_64 219-19.0.2.el7_2.9 @ol7_latest

[root@tst01 ~]# systemctl status sysv-thing
● sysv-thing.service - LSB: jboss 5
   Loaded: loaded (/etc/rc.d/init.d/sysv-thing)
   Active: active (exited) since Mon 2017-03-06 10:18:51 CET; 45min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 21745 ExecStop=/etc/rc.d/init.d/sysv-thing stop (code=exited, status=0/SUCCESS)
  Process: 21813 ExecStart=/etc/rc.d/init.d/sysv-thing start (code=exited, status=0/SUCCESS)
[root@mp-tst01 ~]# systemctl is-enabled sysv-thing
sysv-thing.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig sysv-thing --level=5
enabled

[root@tst01 ~]# systemctl status atop
● atop.service - Atop advanced performance monitor
   Loaded: loaded (/usr/lib/systemd/system/atop.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2017-03-06 00:00:01 CET; 11h ago
     Docs: man:atop(1)
 Main PID: 17048 (atop)
   CGroup: /system.slice/atop.service
           └─17048 /usr/bin/atop -a -R -w /var/log/atop/atop_20170306 600

[root@tst01 ~]# systemctl is-enabled atop
enabled

From man systemd-sysv-generator:

“bad” : Unit file is invalid or 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.

Note that systemctl is-enabled {sysv-thing} does not show any error message as recorded below and list-unit-files will not list any sysv-thing at all. There should be some dedicated handling of derived systemv init scripts here, as experience tells us that these old fashion creatures will convoy us for another longish time.

[root@tst03 ~]# yum list systemd
Installed Packages      systemd.x86_64 219-30.0.1.el7_3.7 @ol7_latest

[root@tst03 ~]# systemctl status sysv-thing
● sysv-thing.service - LSB: jboss 5
   Loaded: loaded (/etc/rc.d/init.d/sysv-thing; bad; vendor preset: disabled)
   Active: active (exited) since Fri 2017-03-03 14:15:00 CET; 2 days ago
     Docs: man:systemd-sysv-generator(8)
  Process: 29308 ExecStop=/etc/rc.d/init.d/sysv-thing stop (code=exited, status=0/SUCCESS)
  Process: 29405 ExecStart=/etc/rc.d/init.d/sysv-thing start (code=exited, status=0/SUCCESS)
[root@tst03 ~]# systemctl is-enabled sysv-thing
sysv-thing.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig sysv-thing --level=5
enabled

[root@tst03 ~]# systemctl status atop
● atop.service - Atop advanced performance monitor
   Loaded: loaded (/usr/lib/systemd/system/atop.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2017-03-06 00:00:02 CET; 11h ago
     Docs: man:atop(1)
 Main PID: 4979 (atop)
   CGroup: /system.slice/atop.service
           └─4979 /usr/bin/atop -a -R -w /var/log/atop/atop_20170306 600
[root@tst03 ~]# systemctl is-enabled atop
enabled

Enjoy Peter

Advertisements

2 comments

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s