[systemd-devel] systemctl start completion

foudfou foudil.newbie+systemd at gmail.com
Fri Jan 13 10:50:54 PST 2012

Hi All,

I have issues with the shell completion of the systemctl 'start' command: it does not take disabled units into account.

I've been trying to solve this issue in a zsh completion function of mine. Since there is no straight-forward way to get all inactive units including disabled ones (2), I tried with 'list-unit-files':

   _some_units_files=( $(systemctl --full --no-legend --no-pager list-unit-files | cut -d' ' -f1 | grep -E '[^@]\.*\.(device|snapshot)$' 2>/dev/null ) );
   systemctl show --property "$property" -- $_some_units_files

which produces multiple: "Failed to issue method call: Unknown unit" (1)
BTW, I'm not sure about removing unit files containing '@' ("Unit name autovt at .service is not valid")...

Trying to narrow down:

   for u in $_some_units_files ; do echo "=== $u ==="; systemctl show --no-pager --property "CanStart" -- "$u" ; done

=== udev-configure-printer.service ===
Failed to issue method call: Unknown unit
zsh: exit 1     systemctl show --no-pager --property "CanStart" -- "$u"


   systemctl show --property "CanStart" -- udev-configure-printer.service


kind regards

(1) seems related to: dbus_set_error_const(&e, DBUS_ERROR_UNKNOWN_OBJECT, "Unknown unit");
(2) https://bugzilla.redhat.com/show_bug.cgi?id=748512

More information about the systemd-devel mailing list