Bug 1656639 - systemctl doesn't recognize root unit names (-.mount, -.slice) on command-line
Summary: systemctl doesn't recognize root unit names (-.mount, -.slice) on command-line
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 29
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-12-05 22:39 UTC by Steve
Modified: 2019-01-11 12:41 UTC (History)
6 users (show)

Fixed In Version: systemd-240-1.fc30
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-01-11 12:40:59 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Steve 2018-12-05 22:39:19 UTC
Description of problem:
Systemctl accepts most unit names on the command-line. However, there are two failure cases:

$ systemctl status -.mount
systemctl: invalid option -- '.'

$ systemctl status -.slice
systemctl: invalid option -- '.'

The workaround is to interpose "--" in those two cases. Thus:

$ systemctl status -- -.mount
● -.mount - Root Mount
...

Version-Release number of selected component (if applicable):
systemd-239-6.git9f3aed1.fc29.x86_64

How reproducible:
Always.

Steps to Reproduce:
1. See above.

Actual results:
See above.

Expected results:
Systemctl recognizes root unit names on the command-line and handles them like any other unit name.

Additional info:

AFAICT, "-.mount" and "-.slice" are the only two cases:

$ systemctl list-units --all | fgrep -- '-.'
  -.mount  loaded    active   mounted   Root Mount                                                                                 
  -.slice  loaded    active   active    Root Slice         

"-.mount" and "-.slice" are documented in SYSTEMD.SPECIAL(7).

Comment 1 Zbigniew Jędrzejewski-Szmek 2018-12-06 14:10:17 UTC
https://github.com/systemd/systemd/pull/11065

Comment 2 Steve 2018-12-06 14:37:32 UTC
(In reply to Zbigniew Jędrzejewski-Szmek from comment #1)
> https://github.com/systemd/systemd/pull/11065

Thanks, although the message blames the user for using a *valid* systemd unit name:

log_notice("Hint: invalid to specify units starting with a dash, use \"--\":\n"

Nicer to say: "Hint: use \"--\" before units starting with a dash, ..."

Comment 3 Zbigniew Jędrzejewski-Szmek 2018-12-06 14:41:00 UTC
It's better to comment on github, since almost nobody looks here.
This was a just a copy&paste error from the previous line. I'll push a new version.

Comment 4 Steve 2018-12-06 15:27:07 UTC
(In reply to Zbigniew Jędrzejewski-Szmek from comment #3)
> It's better to comment on github, since almost nobody looks here.
> This was a just a copy&paste error from the previous line. I'll push a new
> version.

Thanks:

"Hint: to specify units starting with a dash, use \"--\":\n" ...

https://github.com/systemd/systemd/compare/f55dbf808f6735ff7ea232a70869fe95498824e6..7a5165f45e0224d8280a3c928ed30bc000f9384c

Comment 5 Zbigniew Jędrzejewski-Szmek 2019-01-11 12:40:59 UTC
This will be available in F30. Possibly also in F29 if systemd is upgraded to 241 there, but this is not certain yet.


Note You need to log in before you can comment on or make changes to this bug.