Bug 66912

Summary: Autocompletion does not propose template units which have some instances enabled
Product: systemd Reporter: trusktr <jp>
Component: generalAssignee: systemd-bugs
Status: RESOLVED FIXED QA Contact: systemd-bugs
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description trusktr 2013-07-14 22:55:00 UTC
Any idea why typing "systemctl enable kmsconv" then pressing tab won't autocomplete to "systemctl enable kmsconvt@.service" like with other services? The same thing happens with getty@.service, but autocompletion works with other units like netcfg@.service and dhcpcd@.service.

Does something specific need to be added to getty@.service and kmsconvt@.service?
Comment 1 Zbigniew Jedrzejewski-Szmek 2013-07-15 01:51:46 UTC
Autocompletion only works for units that are already loaded (it's a long-standing limitation). Please check if autocompletion works after
forcing of loading of the module, e.g. with systemctl status.
Comment 2 trusktr 2013-07-24 09:03:38 UTC
using systemctl status didn't work.

For example, I tried "systemctl status multi-user.target" and it shows that it is "active". Same for the graphical.target (which I'm in). But when I try "systemctl isolate mul" and press tab, it won't complete to "systemctl isolate multi-user.target" like I remember it did before.

When I try "systemctl status kmsconvt@.service", it says "Failed to issue method call: Unit name kmsconvt@.service is not valid." The same with all other units that accept the @parameter, though some of them autocomplete.

What other info would you like me to provide?
Comment 3 Zbigniew Jedrzejewski-Szmek 2013-09-13 00:04:44 UTC
Hi, sorry for the delay.

Looking at your report again, I think that my initial guess that this is something about loaded vs. unloaded units is wrong.

In general, 'systemctl status <something>@.service' doesn't work:

systemctl status user@.service
Failed to issue method call: Unit name user@.service is not valid.

and for me 'systemctl status user<TAB>' doesn't propose user@.service as a possible completion, which is OK, because if it won't work, it shouldn't be proposed as a completion.

I don't have netcfg@.service and dhcpd@.service, so I have no idea why they behave differently. Recently (post systemd-206) there have been a bunch of fixes wrt. completions. Could you retest with systemd-207 when it is released (this week), if you have any units for which systemctl status actually runs, but are not proposed as completions?
Comment 4 Zbigniew Jedrzejewski-Szmek 2013-12-30 17:51:48 UTC
Ah, OK:

$ systemctl is-enabled getty@.service
enabled

$ systemctl status getty@*.service
getty@tty1.service - Getty on tty1
   Loaded: loaded (/usr/lib/systemd/system/getty@.service; enabled)

So getty@ is not proposed as completion for 'systemctl enable'.

Limiting 'systemctl enable' to disabled units is counterproductive for template units.
Comment 5 Zbigniew Jedrzejewski-Szmek 2014-10-15 01:21:46 UTC
Should be fixed with http://cgit.freedesktop.org/systemd/systemd/commit/?id=e9a19bd882.

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.