Bug 55318 - systemctl is-enabled does not work for templated units
Summary: systemctl is-enabled does not work for templated units
Status: RESOLVED FIXED
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: All All
: medium normal
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-25 14:14 UTC by Eivind Uggedal
Modified: 2016-06-07 10:40 UTC (History)
6 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Eivind Uggedal 2012-09-25 14:14:58 UTC
I expect templated units enabled with "systemctl enable" to be queryable with "systemctl is-enabled":


# systemctl --version
systemd 189
arch
+PAM -LIBWRAP -AUDIT -SELINUX -IMA -SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ

# uname -a
Linux sodium 3.0.42-1-lts #1 SMP Mon Aug 27 19:44:47 CEST 2012 x86_64 GNU/Linux

# cat /etc/issue
Arch Linux \r (\l)

#  cat /usr/lib/systemd/system/uwsgi@.service
[Unit]
Description=uWSGI service for %i
After=syslog.target

[Service]
ExecStart=/usr/bin/uwsgi --ini /etc/uwsgi/%i.ini
ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGINT
Restart=always
Type=simple

[Install]
WantedBy=multi-user.target

# systemctl enable uwsgi@mediaqueries.service
ln -s '/usr/lib/systemd/system/uwsgi@.service' '/etc/systemd/system/multi-user.target.wants/uwsgi@mediaqueries.service'

# systemctl status uwsgi@mediaqueries.service
uwsgi@mediaqueries.service - uWSGI service for mediaqueries
          Loaded: loaded (/usr/lib/systemd/system/uwsgi@.service; enabled)
          Active: active (running) since Mon, 03 Sep 2012 12:29:37 +0200; 3 weeks and 1 days ago
        Main PID: 21577 (uwsgi)
          CGroup: name=systemd:/system/uwsgi@.service/mediaqueries
                  ├ 21577 mediaqueries: uWSGI master
                  └ 21578 mediaqueries: uWSGI worker 1

# systemctl is-enabled uwsgi@mediaqueries.service
Failed to issue method call: No such file or directory

# systemctl is-enabled uwsgi@.service
enabled
Comment 2 Zbigniew Jedrzejewski-Szmek 2013-05-31 01:05:05 UTC
Applied in http://cgit.freedesktop.org/systemd/systemd/commit/?id=67820a0cbdc.
Comment 3 j.witteveen 2014-04-26 12:18:36 UTC
Instances that are not enabled trigger a "Failed to get unit file state" (No such file or directory), but it seems better to output 'disabled' if their template unite file exists.
Comment 4 Maxime de Roucy 2016-03-23 14:47:50 UTC
I agree that if templates unit file exist "is-enabled" should output "disabled" instead of "Failed to get unit file state".

```
max@max-server % systemctl is-enabled systemd-nspawn@.service
disabled
max@max-server % systemctl is-enabled systemd-nspawn@test.service
Failed to get unit file state for systemd-nspawn@test.service: No such file or directory
```

`systemctl is-enabled systemd-nspawn@test.service` should output "disabled"
Comment 5 Lennart Poettering 2016-06-07 10:40:03 UTC
All of this got fixed these days afaics, including the issues in the last comment.

Closing hence. If any issue remains please open a new bug on github systemd.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.