The behavior of "systemctl list-units" and "systemctl list-units" when they output a service whose state is "unknown"

Solution Verified - Updated -

Issue

  • The status of the service is "unknown" only when a service whose status is inactive and disabled.
[root@rhel7u2-x64 ~]# systemctl status firewalld 
● firewalld.service - firewalld - dynamic firewall daemon 
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled) 
   Active: active (running) since Tue 2017-01-17 21:25:28 JST; 17s ago 
Main PID: 26651 (firewalld) 
   CGroup: /system.slice/firewalld.service 
           mq26651 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

Jan 17 21:25:28 rhel7u2-x64 systemd[1]: Starting firewalld - dynamic firewall daemon... 
Jan 17 21:25:28 rhel7u2-x64 systemd[1]: Started firewalld - dynamic firewall daemon. 
[root@rhel7u2-x64 ~]# systemctl is-active firewalld 
active                                                   <-- active and enabled 
[root@rhel7u2-x64 ~]# systemctl stop firewalld 
[root@rhel7u2-x64 ~]# systemctl is-active firewalld 
inactive                                                 <-- inactive and enabled 
[root@rhel7u2-x64 ~]# systemctl start firewalld 
[root@rhel7u2-x64 ~]# systemctl disable firewalld 
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service. 
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service. 
[root@rhel7u2-x64 ~]# systemctl is-active firewalld 
active                                                   <-- active and disabled 
[root@rhel7u2-x64 ~]# systemctl stop firewalld 
[root@rhel7u2-x64 ~]# systemctl is-active firewalld 
unknown                                                  <-- inactive and disabled  (unknown) ###
[root@rhel7u2-x64 ~]# 
  • A service whose status is "unknown" is not output by "systemctl list-units --type service --all".
[root@rhel7u2-x64 ~]# systemctl status firewalld 
● firewalld.service - firewalld - dynamic firewall daemon 
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled) 
   Active: active (running) since Tue 2017-01-17 21:28:42 JST; 5min ago 
Main PID: 27643 (firewalld) 
   CGroup: /system.slice/firewalld.service 
           mq27643 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

Jan 17 21:28:42 rhel7u2-x64 systemd[1]: Starting firewalld - dynamic firewall daemon... 
Jan 17 21:28:42 rhel7u2-x64 systemd[1]: Started firewalld - dynamic firewall daemon. 
[root@rhel7u2-x64 ~]# systemctl list-units --type service --all | grep firewalld 
  firewalld.service                      loaded    active   running firewalld - dynamic firewall daemon    <-- active and enabled 
[root@rhel7u2-x64 ~]# systemctl stop firewalld 
[root@rhel7u2-x64 ~]# systemctl list-units --type service --all | grep firewalld 
  firewalld.service                      loaded    inactive dead    firewalld - dynamic firewall daemon    <-- inactive and enabled 
[root@rhel7u2-x64 ~]# systemctl start firewalld 
[root@rhel7u2-x64 ~]# systemctl disable firewalld 
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service. 
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service. 
[root@rhel7u2-x64 ~]# systemctl list-units --type service --all | grep firewalld 
  firewalld.service                      loaded    active   running firewalld - dynamic firewall daemon    <-- active and disabled  
[root@rhel7u2-x64 ~]# systemctl stop firewalld 
[root@rhel7u2-x64 ~]# systemctl list-units --type service --all | grep firewalld                           <-- inactive and disabled (unknown) ###
[root@rhel7u2-x64 ~]# 
  • When firewalld is active or enabled, the status of ebtables is not "unknown" although its status is inactive and disabled. As a result, ebtables is output by "systemctl list-units --type service --all".
[root@rhel7u2-x64 ~]# systemctl status firewalld 
● firewalld.service - firewalld - dynamic firewall daemon 
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled) 
   Active: active (running) since Tue 2017-01-17 21:40:16 JST; 58s ago 
Main PID: 29648 (firewalld) 
   CGroup: /system.slice/firewalld.service 
           mq29648 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid                <-- firewalld is active and enabled 

Jan 17 21:40:16 rhel7u2-x64 systemd[1]: Starting firewalld - dynamic firewall daemon... 
Jan 17 21:40:16 rhel7u2-x64 systemd[1]: Started firewalld - dynamic firewall daemon. 
[root@rhel7u2-x64 ~]# systemctl status ebtables 
● ebtables.service - Ethernet Bridge Filtering tables 
   Loaded: loaded (/usr/lib/systemd/system/ebtables.service; disabled; vendor preset: disabled)   <-- ebtables is inactive and disabled 
   Active: inactive (dead)

Jan 16 12:18:18 rhel7u2-x64 systemd[1]: Stopped Ethernet Bridge Filtering tables. 
[root@rhel7u2-x64 ~]# systemctl list-units --type service --all | grep -e firewalld -e ebtables 
  ebtables.service                       loaded    inactive dead    Ethernet Bridge Filtering tables 
  firewalld.service                      loaded    active   running firewalld - dynamic firewall daemon 
[root@rhel7u2-x64 ~]# systemctl stop firewalld                                                    <-- firewalld is inactive and enabled
[root@rhel7u2-x64 ~]# systemctl is-active ebtables 
inactive                                                                 <-- ebtables is not "unknown" but inactive (why?). ebtables is still inactive and disabled.
[root@rhel7u2-x64 ~]# systemctl list-units --type service --all | grep -e firewalld -e ebtables   
  ebtables.service                       loaded    inactive dead    Ethernet Bridge Filtering tables 
  firewalld.service                      loaded    inactive dead    firewalld - dynamic firewall daemon 
[root@rhel7u2-x64 ~]# systemctl start firewalld                          
[root@rhel7u2-x64 ~]# systemctl disable firewalld                        <-- firewalld is active and disabled
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service. 
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service. 
[root@rhel7u2-x64 ~]# systemctl is-active ebtables 
inactive                                                                 <-- ebtables is not "unknown" but inactive (why?). ebtables is still inactive and disabled.
[root@rhel7u2-x64 ~]# systemctl list-units --type service --all | grep -e firewalld -e ebtables 
  ebtables.service                       loaded    inactive dead    Ethernet Bridge Filtering tables 
  firewalld.service                      loaded    active   running firewalld - dynamic firewall daemon 
[root@rhel7u2-x64 ~]# systemctl stop firewalld 
[root@rhel7u2-x64 ~]# systemctl is-active ebtables                       <-- firewalld is inactive and disabled
unknown                                                                  <-- ebtables is "unknown" as expected.
[root@rhel7u2-x64 ~]# systemctl list-units --type service --all | grep -e firewalld -e ebtables 
[root@rhel7u2-x64 ~]#                                                    <-- both firewalld and ebtables are not output because they are inactive and disabled.
  • Those behaviors are expected?
  • When firewalld is active or enabled, and ebtables is stopped and disable, why does the command "systemctl is-active ebtables" output not "unknown" but "inactive"?
  • When firewalld is active or enabled, and ebtables is stopped and disable, why does the command "systemctl list-units --type service --all" output the status of ebtables in the list?

Environment

  • Red Hat Enterprise Linux 7.3
  • systemd-219-30.el7_3.6

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content