3

On my Arch systemd install, the name of the root mount unit is -.mount. (It is not listed in /etc/fstab, rather, it get the details of the root mount for the kernel options specified in the boot manager.)

If I try run any systemctl command on this unit, e.g:

systemctl show -.mount

I get this error:

systemctl: invalid option -- '.'

It is confusing the unit name for a option argument. How do I do this? Is there some why to escape the name so that it is not confused for a option argument?

2 Answers 2

4

By commonly used rules of specifying command-line parameters, a dash in front of an argument makes it interpreted as a short option.

More precisely, -.mount is interpreted as 6 consecutive options, equivalent to: -. -m -o -u -n -t.

To avoid this, place two dashes (--) in front of an argument:

systemctl show -- -.mount

This will ignore any option parsing in the remainder of the command line.

2

Mountpoint paths can be used to specify a .mount-type unit in any subcommand of systemctl, so you can do

systemctl show /
1
  • Beautiful. I did not know of this possibility. However, I'd rephrase a bit (see suggested edit)...
    – intelfx
    Jan 16, 2015 at 12:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.