Commit Graph

348 Commits

Author SHA1 Message Date
Christian Rebischke e92b3655b8 fixed ugly colorcodes on brackets
Signed-off-by: Christian Rebischke <Chris.Rebischke@posteo.de>
2018-07-24 10:43:31 +02:00
Zbigniew Jędrzejewski-Szmek f07b548940 man: fix list-files example
The dot is only shown for failed units.

Alternative for #9644.
2018-07-19 11:31:05 +02:00
Lennart Poettering 81d39f0d2c man: fix --ignore-inhibitors docs
Reported here:

https://lists.freedesktop.org/archives/systemd-devel/2018-June/040939.html

Also see:

https://lists.freedesktop.org/archives/systemd-devel/2018-July/041036.html
2018-07-17 09:49:04 -07:00
Zbigniew Jędrzejewski-Szmek 514094f933 man: drop mode line in file headers
This is already included in .dir-locals, so we don't need it
in the files themselves.
2018-07-03 01:32:25 +02:00
Zbigniew Jędrzejewski-Szmek fdbbee37d5 man: drop unused <authorgroup> tags from man sources
Docbook styles required those to be present, even though the templates that we
use did not show those names anywhere. But something changed semi-recently (I
would suspect docbook templates, but there was only a minor version bump in
recent years, and the changelog does not suggest anything related), and builds
now work without those entries. Let's drop this dead weight.

Tested with F26-F29, debian unstable.

$ perl -i -0pe 's/\s*<authorgroup>.*<.authorgroup>//gms' man/*xml
2018-06-14 12:22:18 +02:00
Lennart Poettering 0c69794138 tree-wide: remove Lennart's copyright lines
These lines are generally out-of-date, incomplete and unnecessary. With
SPDX and git repository much more accurate and fine grained information
about licensing and authorship is available, hence let's drop the
per-file copyright notice. Of course, removing copyright lines of others
is problematic, hence this commit only removes my own lines and leaves
all others untouched. It might be nicer if sooner or later those could
go away too, making git the only and accurate source of authorship
information.
2018-06-14 10:20:20 +02:00
Lennart Poettering 818bf54632 tree-wide: drop 'This file is part of systemd' blurb
This part of the copyright blurb stems from the GPL use recommendations:

https://www.gnu.org/licenses/gpl-howto.en.html

The concept appears to originate in times where version control was per
file, instead of per tree, and was a way to glue the files together.
Ultimately, we nowadays don't live in that world anymore, and this
information is entirely useless anyway, as people are very welcome to
copy these files into any projects they like, and they shouldn't have to
change bits that are part of our copyright header for that.

hence, let's just get rid of this old cruft, and shorten our codebase a
bit.
2018-06-14 10:20:20 +02:00
Lennart Poettering c4555ad8f6 core: introduce a new load state "bad-setting"
Since bb28e68477 parsing failures of
certain unit file settings will result in load failures of units. This
introduces a new load state "bad-setting" that is entered in precisely
this case.

With this addition error messages on bad settings should be a lot more
explicit, as we don't have to show some generic "errno" error in that
case, but can explicitly say that a bad setting is at fault.

Internally this unit load state is entered as soon as any configuration
loader call returns ENOEXEC. Hence: config parser calls should return
ENOEXEC now for such essential unit file settings. Turns out, they
generally already do.

Fixes: #9107
2018-06-11 12:53:12 +02:00
Lennart Poettering 443dee9d2e man: don't mention "stub" and "merged" unit load states
These states should never be visible to the outside, as they are used
only internally while loading unit. Hence let's drop them from the
documentation.
2018-06-11 12:53:12 +02:00
Zbigniew Jędrzejewski-Szmek 4910b35078 systemctl: when removing enablement or mask symlinks, cover both /run and /etc
'systemctl disable --runtime' would disable a unit, but only if it was enabled
with '--runtime', and silently do nothing if the unit was enabled persistently.
And similarly 'systemctl disable' would do nothing if the unit was enabled in
/run. This just doesn't seem useful.

This pathch changes enable/disable and mask/unmask to be asymmetrical. enable
and mask create symlinks in /etc or /run, depending on whether --runtime was
specified. disable and unmask remove symlinks from both locations. --runtime
cannot be specified for the disable and unmask verbs.

The advantage is that 'disable' now means that the unit is disabled, period.
And similarly for 'unmask', all masks are removed.

Similarly for preset and preset-all, they now cannot be called with --runtime,
and are asymmetrical: when they enable a unit, symlinks are created in /etc.
When they disable a unit, all symlinks are nuked.

$ systemctl --root=/ enable bluetooth
Created symlink /etc/systemd/system/dbus-org.bluez.service → /usr/lib/systemd/system/bluetooth.service.
Created symlink /etc/systemd/system/bluetooth.target.wants/bluetooth.service → /usr/lib/systemd/system/bluetooth.service.
$ systemctl --root=/ --runtime enable bluetooth
Created symlink /run/systemd/system/dbus-org.bluez.service → /usr/lib/systemd/system/bluetooth.service.
Created symlink /run/systemd/system/bluetooth.target.wants/bluetooth.service → /usr/lib/systemd/system/bluetooth.service.
$ systemctl --root=/ disable bluetooth
Removed /run/systemd/system/bluetooth.target.wants/bluetooth.service.
Removed /run/systemd/system/dbus-org.bluez.service.
Removed /etc/systemd/system/bluetooth.target.wants/bluetooth.service.
Removed /etc/systemd/system/dbus-org.bluez.service.
$ systemctl --root=/ disable --runtime bluetooth
--runtime cannot be used with disable

$ systemctl --root=/ mask --runtime bluetooth
Created symlink /run/systemd/system/bluetooth.service → /dev/null.
$ systemctl --root=/ mask bluetooth
Created symlink /etc/systemd/system/bluetooth.service → /dev/null.
$ systemctl --root=/ unmask bluetooth
Removed /run/systemd/system/bluetooth.service.
Removed /etc/systemd/system/bluetooth.service.
$ systemctl --root=/ unmask --runtime bluetooth
--runtime cannot be used with unmask

$ systemctl --root=/ --runtime enable bluetooth
Created symlink /run/systemd/system/dbus-org.bluez.service → /usr/lib/systemd/system/bluetooth.service.
Created symlink /run/systemd/system/bluetooth.target.wants/bluetooth.service → /usr/lib/systemd/system/bluetooth.service.
$ systemctl --root=/ enable bluetooth
Created symlink /etc/systemd/system/dbus-org.bluez.service → /usr/lib/systemd/system/bluetooth.service.
Created symlink /etc/systemd/system/bluetooth.target.wants/bluetooth.service → /usr/lib/systemd/system/bluetooth.service.
$ systemctl --root=/ preset bluetooth
Removed /run/systemd/system/bluetooth.target.wants/bluetooth.service.
Removed /run/systemd/system/dbus-org.bluez.service.
Removed /etc/systemd/system/bluetooth.target.wants/bluetooth.service.
Removed /etc/systemd/system/dbus-org.bluez.service.
$ systemctl --root=/ preset --runtime bluetooth
--runtime cannot be used with preset

$ systemctl preset-all --runtime
--runtime cannot be used with preset-all
2018-06-01 15:10:33 +02:00
Philip Withnall 7456fa0267 man: Fix a minor typo in systemctl(1)
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-05-11 07:24:05 -07:00
Zbigniew Jędrzejewski-Szmek 11a1589223 tree-wide: drop license boilerplate
Files which are installed as-is (any .service and other unit files, .conf
files, .policy files, etc), are left as is. My assumption is that SPDX
identifiers are not yet that well known, so it's better to retain the
extended header to avoid any doubt.

I also kept any copyright lines. We can probably remove them, but it'd nice to
obtain explicit acks from all involved authors before doing that.
2018-04-06 18:58:55 +02:00
Zbigniew Jędrzejewski-Szmek 24c44fdf56 man: use unicode ellipsis in one more place (#8496)
Also add note where it should *not* be used.

https://github.com/systemd/systemd/pull/8408#discussion_r175606771
2018-03-20 09:54:01 +01:00
Zbigniew Jędrzejewski-Szmek 6fdbb3c821 man: beef up description of systemctl list-units
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=88135.
2018-03-09 10:35:33 +01:00
Zbigniew Jędrzejewski-Szmek 2f3828e5c6 man: document that link-ed files must be on /
Fixes #8307.
2018-03-01 13:11:00 +01:00
Zbigniew Jędrzejewski-Szmek fbf3283bdd systemctl,man: use PROPERTY as the placeholder for a property name 2018-02-22 14:53:56 +01:00
Zbigniew Jędrzejewski-Szmek da5e955fbd systemctl,man: use UNIT as the placeholder for a unit name
NAME is kind of meaningless, because everything has a name. "Unit"
makes it more obvious that a name of a unit is necessary. I was always
momentarily baffled by "set-property NAME ASSIGNMENT...", where there
are two objects (the unit and the property), and it's not clear which of
the two "NAME" is supposed to signify.
2018-02-22 14:53:56 +01:00
Lennart Poettering 71c9f49d73 Revert "man: mention that systemctl is-active or is-failed do not load units"
This reverts commit c7612b2005.
2018-01-25 15:19:13 +01:00
Yu Watanabe c7612b2005 man: mention that systemctl is-active or is-failed do not load units
See the discussion in the issue #7875.
2018-01-16 23:25:56 +09:00
Lennart Poettering f95b0be742 man: "systemd" is to be written in all lower-case, even at beginnings of sentences
This very important commit is very important.
2017-12-13 17:42:04 +01:00
Lennart Poettering 4ff183d419
Merge pull request #7154 from keszybz/bootspec
List bootspec entries in bootctl and use the default for kexec
2017-11-20 13:06:33 +01:00
Zbigniew Jędrzejewski-Szmek 572eb058cf Add SPDX license identifiers to man pages 2017-11-19 19:08:15 +01:00
Lennart Poettering ff946d8243 man: write "stop and start" instead of "restart" when explaining the reload fallback operations
We already made a similar change when talking about the "restart"
command, let's also do this for "systemctl reload" and friends.

Follow-up for: 6539dd7c42

See: #7126
2017-11-17 11:25:02 +01:00
Lennart Poettering c4f2aaa45b man: document the interaction of "systemctl restart" and the FD store
See: #7126
2017-11-17 11:25:02 +01:00
Zbigniew Jędrzejewski-Szmek 1ae17672a2 systemctl: add --dry-run argument 2017-11-07 15:15:09 +01:00
Jakub Wilk dcfaecc70a man: fix typos (#7029) 2017-10-10 21:59:03 +02:00
Lennart Poettering 6324a8a727 man: document which special "systemctl" commands are synchronous and which asynchronous.
This documents the status quo, clarifying when we are synchronous and
when asynchronous by default and when --no-block is support to force
asynchronous operation.

See: #6479
2017-10-04 20:59:15 +02:00
Zbigniew Jędrzejewski-Szmek d9b4b48f3f install: consider non-Alias=/non-DefaultInstance= symlinks as "indirect" enablement
I think this matches the spirit of "indirect" well: the unit
*might* be active, even though it is not "installed" in the
sense of symlinks created based on the [Install] section.

The changes to test-install-root touch the same lines as in the previous
commit; the change in each case is from
   assert_se(unit_file_get_state(...) >= 0 && state == UNIT_FILE_ENABLED)
to
   assert_se(unit_file_get_state(...) >= 0 && state == UNIT_FILE_DISABLED)
to
   assert_se(unit_file_get_state(...) >= 0 && state == UNIT_FILE_INDIRECT)
in the last two commits.
2017-09-22 18:23:02 +02:00
Zbigniew Jędrzejewski-Szmek 5cd8ae3152 install: only consider names in Alias= as "enabling"
When a unit has a symlink that makes an alias in the filesystem,
but that name is not specified in [Install], it is confusing
is the unit is shown as "enabled". Look only for names specified
in Alias=.

Fixes #6338.

v2:
- Fix indentation.
- Fix checking for normal enablement, when the symlink name is the same as the
  unit name. This case wasn't handled properly in v1.

v3:
- Rework the patch to also handle templates properly:
  A template templ@.service with DefaultInstance=foo will be considered
  enabled only when templ@foo.service symlink is found. Symlinks with
  other instance names do not count, which matches the logic for aliases
  to normal units. Tests are updated.
2017-09-22 18:12:52 +02:00
Alan Jenkins d60cb656fc manager: fix job mode when signalled to shutdown etc
The irreversible job mode is required to ensure that shutdown is not
interrupted by the activation of a unit with a conflict.

We already used the correct job mode for `ctrl-alt-del.target`.  But not
for `exit.target` (SIGINT of user manager).  The SIGRT shutdown signals
also needed fixing.

Also change SIGRTMIN+0 to isolate default.target, instead of starting
it.  The previous behaviour was documented.  However there was no reason
given for it, nor can we provide one.  The problem that isolate is too
aggressive anywhere outside of emergency.target (#2607) is orthogonal.
This feature is "accessible by different means and only really a safety
net"; it is confusing for it to differ from `systemctl default` without
explanation.

`AllowIsolate=yes` is retained on poweroff.target etc. for backwards
compatibility.

`sigpwr.target` is also an obvious candidate for linking to a shutdown
target.  Unforunately it is also a possible hook for implementing some
logic like system V init did, reading `/etc/powerstatus`.  If we switched
to starting `sigpwr.target` with REPLACE_IRREVERSIBLY, attempts to run
`systemctl shutdown` from it would fail, if they had not thought to set
`DefaultDependencies=no`.  We had provided no examples for `sigpwr`, and
the whole idea is cruft to keep legacy people happy.  For the moment, I
leave `sigpwr` alone, with no risk of disrupting anyone's
previously-working, half-working, or untested setup.

Fixes #6484.  See also #6471
2017-08-31 16:17:42 +01:00
Alan Jenkins 1d82e6b3ed man: fix note for `systemctl enable --global` (#6592)
The last sentence in the paragraph described the behaviour of `--global`.  But "the last case" we listed was "only this boot", which does not match...  This was the fifth case described, but there are only _four_ different option names.  Fix it.
2017-08-30 18:47:40 +02:00
Jakub Wilk 785889e56d man: fix typos (#6532) 2017-08-03 17:36:21 -04:00
Zbigniew Jędrzejewski-Szmek 26adf7741d man: describe which units types are stopped on isolate
Fixes #6455.
2017-07-28 05:17:05 -04:00
Zbigniew Jędrzejewski-Szmek 804ee07c13 Use "dollar-single-quotes" to escape shell-sensitive strings
Also called "ANSI-C Quoting" in info:(bash) ANSI-C Quoting.

The escaping rules are a POSIX proposal, and are described in
http://austingroupbugs.net/view.php?id=249. There's a lot of back-and-forth on
the details of escaping of control characters, but we'll be only using a small
subset of the syntax that is common to all proposals and is widely supported.
Unfortunately dash and fish and maybe some other shells do not support it (see
the man page patch for a list).

This allows environment variables to be safely exported using show-environment
and imported into the shell. Shells which do not support this syntax will have
to do something like
    export $(systemctl show-environment|grep -v '=\$')
or whatever is appropriate in their case. I think csh and fish do not support
the A=B syntax anyway, so the change is moot for them.

Fixes #5536.

v2:
- also escape newlines (which currently disallowed in shell values, so this
  doesn't really matter), and tabs (as $'\t'), and ! (as $'!'). This way quoted
  output can be included directly in both interactive and noninteractive bash.
2017-06-19 19:39:43 -04:00
Lucas Werkmeister 83ddf5d3d8 man: change /lib to /usr/lib (#5618)
Per man:file-hierarchy(7), /lib is just a compatibility symlink; the
other manpages also refer to /usr/lib.

Found with:

    git grep -P '(?<!/usr|/var|local)/lib' man/
2017-03-20 20:32:23 -04:00
AsciiWolf 3c3fff44b2 man: fix typo (#5468) 2017-02-27 13:59:11 +01:00
Mark Stosberg ccdda9556e man: systemctl list-timers: Provide sample output and document it. (#5463)
As with `systemctl list-sockets` and `systemctl status`, we provide a sample
output for `systemctl list-timers` and document what the columns mean.
2017-02-26 20:03:30 -05:00
AsciiWolf 28a0ad81ee man: use https:// in URLs 2017-02-21 16:28:04 +01:00
Zbigniew Jędrzejewski-Szmek bef19548a2 systemctl: restore --failed (#5198)
'systemctl --failed' is an extremely common operation and it's nice to have
a shortcut for it.

Revert "man: don't document systemctl --failed" and add the option back to
systemctl's help and shell completion scripts.

This reverts commit 036359ba8d.
2017-02-02 00:23:46 +01:00
AsciiWolf 542ca7c9d2 man: fix typo (#5093) 2017-01-17 12:09:38 +01:00
Mark Stosberg ab8864ebc3 man: provide a basic guide to the `systemctl status` output (#4950)
- Show example of all `systemctl status` output and documents what possible
   "Loaded:", "Active" and "Enabled" values mean.

 - Documents what different colors of the dot mean.

 - Documents "gotcha" with load-on-demand behavior which will report units as
   "loaded" even if they are only loaded to show their status.
   (From @poettering: https://github.com/systemd/systemd/issues/5063#issuecomment-272115024 )
2017-01-14 17:43:32 -05:00
micah 6539dd7c42 Document how restart actions work (#5052)
When a user is trying to understand what is going on with a restart action, it is useful to explicitly describe how the action is run. It may seem obvious, but it is helpful to be explicit so one knows there isn't a special ExecRestart= or similar option that they could be looking at.
2017-01-11 15:07:35 -05:00
Lennart Poettering 33d2308c1f man: document that "systemctl show" shows low-level properties
Fixes: #4654
2016-12-14 18:29:30 +01:00
Zbigniew Jędrzejewski-Szmek 1eecafb8c1 man: use unicode ellipsis in more places
As requested in
https://github.com/systemd/systemd/pull/4864#pullrequestreview-12372557.

docbook will substitute triple dots for the ellipsis in man output, so this has
no effect on the troff output, only on HTML, making it infinitesimally nicer.

In some places we show output from programs, which use dots, and those places
should not be changed. In some tables, the alignment would change if dots were
changed to the ellipsis which is only one character. Since docbook replaces the
ellipsis automatically, we should leave those be. This patch changes all other
places.
2016-12-11 17:13:19 -05:00
Lennart Poettering 82948f6c8e systemctl: show waiting jobs when "systemctl list-jobs --after/--before" is called
Let's expose the new bus functions we added in the previous commit in
systemctl.
2016-11-16 17:01:46 +01:00
Lucas Werkmeister 0cc6064c3c man: fix two typos (is → are) (#4544) 2016-11-02 18:10:29 -06:00
Jakub Wilk b17649ee5e man: fix typos (#4527) 2016-10-31 08:08:08 -04:00
Lucas Werkmeister d4a48671bc man: document that systemctl cat shows file content (#4488)
... and that that content might be outdated.
2016-10-25 20:40:21 -04:00
Jan Synacek 3b3557c410 shared, systemctl: teach is-enabled to show installation targets
It may be desired by users to know what targets a particular service is
installed into. Improve user friendliness by teaching the is-enabled
command to show such information when used with --full.

This patch makes use of the newly added UnitFileFlags and adds
UNIT_FILE_DRY_RUN flag into it. Since the API had already been modified,
it's now easy to add the new dry-run feature for other commands as
well. As a next step, --dry-run could be added to systemctl, which in
turn might pave the way for a long requested dry-run feature when
running systemctl start.
2016-10-24 10:19:08 +02:00
Zbigniew Jędrzejewski-Szmek 9b914a9d6b man: mention that systemctl --root=/ operates on the fs directly 2016-10-17 02:26:42 -04:00
Thomas Hindoe Paaboel Andersen 2dd678171e man: typo fixes
A mix of fixes for typos and UK english
2016-10-12 23:02:44 +02:00
Lennart Poettering 2cdbbc9a34 man: avoid using the term "loaded" for units currently in memory, since we also have a unit state of that name
Fixes: #3971
2016-10-11 17:55:04 +02:00
Lennart Poettering 6e16066e8e man: expand the documentation of $SYSTEMD_PAGER and related environment variables
Document the default pagers used, as well as $SYSTEMD_LESSCHARSET.

Fixes: #4143
2016-10-11 17:45:49 +02:00
Martin Pitt 93a0884126 systemctl: Add --wait option to wait until started units terminate again
Fixes #3830
2016-10-01 17:58:59 +02:00
Alfie John 831d3dc8d7 man: remove duplicate "the" for systemctl --plain (#4230) 2016-09-28 11:10:26 +02:00
kristbaum d903a89246 Update systemctl.xml (#4151) 2016-09-15 09:11:33 +02:00
Lennart Poettering 05a98afd3e core: add Ref()/Unref() bus calls for units
This adds two (privileged) bus calls Ref() and Unref() to the Unit interface.
The two calls may be used by clients to pin a unit into memory, so that various
runtime properties aren't flushed out by the automatic GC. This is necessary
to permit clients to race-freely acquire runtime results (such as process exit
status/code or accumulated CPU time) on successful service termination.

Ref() and Unref() are fully recursive, hence act like the usual reference
counting concept in C. Taking a reference is a privileged operation, as this
allows pinning units into memory which consumes resources.

Transient units may also gain a reference at the time of creation, via the new
AddRef property (that is only defined for transient units at the time of
creation).
2016-08-22 16:14:21 +02:00
Lennart Poettering a457bd26cc Merge pull request #3955 from keszybz/fix-preset-all
Fix preset-all
2016-08-19 19:10:30 +02:00
Lennart Poettering fb1bad9d51 man: document that "systemctl switch-root" tries hard to pass state across (#3995)
As suggested:

https://github.com/systemd/systemd/pull/3958#issuecomment-240410958

Let's document that we try hard to pass system state from the initrd to the
host, and even compare the systemd binary paths.
2016-08-19 12:16:28 -04:00
Zbigniew Jędrzejewski-Szmek d923e42eed man: describe what symlinks to unit do, and specify that presets must use real names
The man pages didn't ever mention that symlinks to units can be created, and what
exactly this means. Fix that omission, and disallow presets on alias names.
2016-08-19 09:55:54 -04:00
Zbigniew Jędrzejewski-Szmek e9fbae3f68 man: describe list-dependencies --all
Meaning of --all was mentioned in list-dependencies description, but the this
effect should also be mentioned in the description of the option itself.
2016-08-04 09:03:43 -04:00
Zbigniew Jędrzejewski-Szmek 93f07c8789 man: use "search for unit"
To "search something", in the meaning of looking for it, is valid,
but "search _for_ something" is much more commonly used, especially when
the meaning could be confused with "looking _through_ something"
(for some other object).

(C.f. "the police search a person", "the police search for a person".)

Also reword the rest of the paragraph to avoid using "automatically"
three times.
2016-07-25 10:52:38 -04:00
Lennart Poettering 3990961df0 man: update systemctl man page for unit file commands, in particular "systemctl enable"
Clarify that "systemctl enable" can operate either on unit names or on unit
file paths (also, adjust the --help text to clarify this). Say that "systemctl
enable" on unit file paths also links the unit into the search path.

Many other fixes.

This should improve the documentation to avoid further confusion around #3706.
2016-07-25 15:16:48 +02:00
Doug Christman 39c38ce17c systemctl: Create new unit files with "edit --force" (#3584) 2016-06-24 08:00:35 +02:00
Lennart Poettering 924e44b419 man: document that systemctl -ff reboot does not require PID 1 to work (#3310)
As suggested in

https://github.com/systemd/systemd/issues/3282#issuecomment-220264509
2016-05-31 02:49:57 +03:00
Zbigniew Jędrzejewski-Szmek 21b587cfd9 man: explain what list-units does a bit better (#3324)
https://bugzilla.redhat.com/show_bug.cgi?id=1338584
2016-05-23 15:33:44 +02:00
Zbigniew Jędrzejewski-Szmek 39207373dd systemctl,pid1: do not warn about missing install info with "preset"
When "preset" was executed for a unit without install info, we'd warn similarly
as for "enable" and "disable". But "preset" is usually called for all units,
because the preset files are provided by the distribution, and the units are under
control of individual programs, and it's reasonable to call "preset" for all units
rather then try to do it only for the ones that can be installed.
We also don't warn about missing info for "preset-all". Thus it seems reasonable
to silently ignore units w/o install info when presetting.

(In addition, when more than one unit was specified, we'd issue the warning
only if none of them had install info. But this is probably something to fix
for enable/disable too.)
2016-04-21 20:04:21 -04:00
Lennart Poettering 344ca7556b core,systemctl: add new "systemctl revert" command
This allows dropping all user configuration and reverting back to the vendor
default of a unit file. It basically undoes what "systemctl edit", "systemctl
set-property" and "systemctl mask" do.
2016-04-12 13:43:32 +02:00
Lennart Poettering e4fca67ff0 install: introduce a new unit file state "transient"
Now, that the search path logic knows the unit path for transient units we also
can introduce an explicit unit file state "transient" that clarifies to the
user what kind of unit file he is encountering.
2016-04-12 13:43:31 +02:00
Lennart Poettering f413930863 core: add a new unit file state "generated"
Now that we store the generator directories in LookupPaths we can use this to
intrdouce a new unit file state called "generated", for units in these
directories.

Fixes: #2348
2016-04-12 13:43:29 +02:00
Zbigniew Jędrzejewski-Szmek 4f9a91055c systemctl: add --value option
With this option, systemctl will only print the rhs in show:
$ systemctl show -p Wants,After systemd-journald --value
systemd-journald.socket ...
systemd-journald-dev-log.socket ...

This is useful in scripts, because the need to call awk or similar
is removed.
2016-04-04 22:41:49 -04:00
Zbigniew Jędrzejewski-Szmek da25e02913 man: follow up fixes for #2575 2016-02-10 19:49:40 -05:00
Lennart Poettering a858cd7113 man: correct explanation of "systemctl is-enabled" output
The "is-enabled" command doesn't care whether the symlinks are declared in the
[Install] section of a unit file or not, when returning "enabled". Any alias,
.wants/ or .requires/ symlinks suffice.

Fixes: #975
2016-02-10 23:48:50 +01:00
Lennart Poettering 1534e170b4 man: document that "systemctl enable" supports abbreviated unit file names
Fixes: #1502
2016-02-10 23:48:50 +01:00
Lennart Poettering aabf5d4243 systemctl: rename "reload-or-try-restart" verb to "try-reload-or-restart"
But also keep the old name as (undocumented) compatibility around.

The reload-or-try-restart was documented to be a NOP if the unit is not running, since the previous commits this is
also implemented. The old name suggests that the "try" logic only applies to restarting. Fix this, by moving the "try-"
to the front, to indicate that the whole option is a NOP if the service isn't running.
2016-01-28 18:57:04 +01:00
Lennart Poettering 2fcee0a59a man: stop documenting legacy RedHatisms
We generally document only the supported verbs, but not the compatibility verbs we also support, in order to keep the
documentation minimal.
2016-01-28 18:46:24 +01:00
Daniel Mack 443d6d529c Merge branch 'pr/980' 2016-01-27 17:57:49 +01:00
Andrei Borzenkov ef6187272b man: make systemctl is-enabled description match enable.
systemctl is-enabled is not limited to wants.d - it also checks for
requires.d and alias links.
2016-01-27 17:57:30 +01:00
Lennart Poettering 1f00ededc7 man: document that unit file globbing only operates on primary unit names
See: #2397
2016-01-27 02:21:28 +01:00
Jakub Wilk 7f3fdb7f19 man: fix typos 2015-12-26 20:37:17 +01:00
Michael Biebl 4559a7218c man: fix typo in systemctl(1) 2015-12-21 11:54:41 +01:00
Franck Bui e9fd88f2e9 core: allow 'SetUnitProperties()' to run on inactive units too
'set-property' has been primarly designed to change some properties of
*active* units.

However it can easily work on inactive units as well. In that case
changes are only saved in a drop-in for futur uses and changes will be
effective when unit will be started.

Actually it already works on inactive units but that was not
documented and not fully supported. Indeed the inactive units had to
be known by the manager otherwise it was reported as not loaded:

 $ systemctl status my-test.service
 * my-test.service - My Testing Unit
    Loaded: loaded (/etc/systemd/system/my-test.service; static; vendor preset: disabled)
   Drop-In: /etc/systemd/system/my-test.service.d
    Active: inactive (dead)

 $ systemctl set-property my-test.service MemoryLimit=1000000
 Failed to set unit properties on my-test.service: Unit my-test.service is not loaded.

[ Note: that the unit load state reported by the 'status' command
  might be confusing since it claimed the unit as loaded but
  'set-property' reported the contrary. ]

One can possibily workaround this by making the unit a dependency of
another active unit so the manager will keep it around:

 $ systemctl add-wants multi-user.target my-test.service
 Created symlink from /etc/systemd/system/multi-user.target.wants/my-test.service to /etc/systemd/system/my-test.service.

 $ systemctl set-property my-test.service MemoryLimit=1000000

 $ systemctl status my-test.service
 * my-test.service - My Testing Unit
    Loaded: loaded (/etc/systemd/system/my-test.service; enabled; vendor preset: disabled)
   Drop-In: /etc/systemd/system/my-test.service.d
            `-50-MemoryLimit.conf
    Active: inactive (dead)

This patch simply forces 'SetUnitProperties()' to load the unit if
it's not already the case.

It also documents the fact that 'set-property' can be used on inactive
units.
2015-11-22 15:06:14 +01:00
Michal Schmidt 7152869f0a Merge pull request #1869 from poettering/kill-overridable
Remove support for RequiresOverridable= and RequisiteOverridable=
2015-11-13 14:04:34 +01:00
Lennart Poettering f32b43bda4 core: remove support for RequiresOverridable= and RequisiteOverridable=
As discussed at systemd.conf 2015 and on also raised on the ML:

http://lists.freedesktop.org/archives/systemd-devel/2015-November/034880.html

This removes the two XyzOverridable= unit dependencies, that were
basically never used, and do not enhance user experience in any way.
Most folks looking for the functionality this provides probably opt for
the "ignore-dependencies" job mode, and that's probably a good idea.

Hence, let's simplify systemd's dependency engine and remove these two
dependency types (and their inverses).

The unit file parser and the dbus property parser will now redirect
the settings/properties to result in an equivalent non-overridable
dependency. In the case of the unit file parser we generate a warning,
to inform the user.

The dbus properties for this unit type stay available on the unit
objects, but they are now hidden from usual introspection and will
always return the empty list when queried.

This should provide enough compatibility for the few unit files that
actually ever made use of this.
2015-11-12 19:27:24 +01:00
Lennart Poettering 485630813d man: improve the unit file enable state table a bit 2015-11-12 17:57:04 +01:00
Lennart Poettering 0ec0deaa30 install: follow unit file symlinks in /usr, but not /etc when looking for [Install] data
Some distributions use alias unit files via symlinks in /usr to cover
for legacy service names. With this change we'll allow "systemctl
enable" on such aliases.

Previously, our rule was that symlinks are user configuration that
"systemctl enable" + "systemctl disable" creates and removes, while unit
files is where the instructions to do so are store. As a result of the
rule we'd never read install information through symlinks, since that
would mix enablement state with installation instructions.

Now, the new rule is that only symlinks inside of /etc are
configuration. Unit files, and symlinks in /usr are now valid for
installation instructions.

This patch is quite a rework of the whole install logic, and makes the
following addional changes:

- Adds a complete test "test-instal-root" that tests the install logic
  pretty comprehensively.

- Never uses canonicalize_file_name(), because that's incompatible with
  operation relative to a specific root directory.

- unit_file_get_state() is reworked to return a proper error, and
  returns the state in a call-by-ref parameter. This cleans up confusion
  between the enum type and errno-like errors.

- The new logic puts a limit on how long to follow unit file symlinks:
  it will do so only for 64 steps at max.

- The InstallContext object's fields are renamed to will_process and
  has_processed (will_install and has_installed) since they are also
  used for deinstallation and all kinds of other operations.

- The root directory is always verified before use.

- install.c is reordered to place the exported functions together.

- Stricter rules are followed when traversing symlinks: the unit suffix
  must say identical, and it's not allowed to link between regular units
  and templated units.

- Various modernizations

- The "invalid" unit file state has been renamed to "bad", in order to
  avoid confusion between UNIT_FILE_INVALID and
  _UNIT_FILE_STATE_INVALID. Given that the state should normally not be
  seen and is not documented this should not be a problematic change.
  The new name is now documented however.

Fixes #1375, #1718, #1706
2015-11-12 17:57:04 +01:00
Zbigniew Jędrzejewski-Szmek 36b4a7ba55 Remove snapshot unit type
Snapshots were never useful or used for anything. Many systemd
developers that I spoke to at systemd.conf2015, didn't even know they
existed, so it is fairly safe to assume that this type can be deleted
without harm.

The fundamental problem with snapshots is that the state of the system
is dynamic, devices come and go, users log in and out, timers fire...
and restoring all units to some state from the past would "undo"
those changes, which isn't really possible.

Tested by creating a snapshot, running the new binary, and checking
that the transition did not cause errors, and the snapshot is gone,
and snapshots cannot be created anymore.

New systemctl says:
Unknown operation snapshot.
Old systemctl says:
Failed to create snapshot: Support for snapshots has been removed.

IgnoreOnSnaphost settings are warned about and ignored:
Support for option IgnoreOnSnapshot= has been removed and it is ignored

http://lists.freedesktop.org/archives/systemd-devel/2015-November/034872.html
2015-11-10 19:33:06 -05:00
Jan Engelhardt a8eaaee72a doc: correct orthography, word forms and missing/extraneous words 2015-11-06 13:45:21 +01:00
Jan Engelhardt b938cb902c doc: correct punctuation and improve typography in documentation 2015-11-06 13:00:02 +01:00
Mark Theunissen a20e43c0f6 systemctl: update documentation for --plain option
- Existing documentation did not mention that --plain omits the bullets and works on list-units and list-machines.
2015-11-04 13:14:03 +02:00
Lennart Poettering 23a749f285 Merge pull request #1419 from keszybz/shell-completion
Shell completion tweaks
2015-09-30 22:32:09 +02:00
Lennart Poettering 94f099d813 systemctl: make "systemctl is-system-running" return "offline" if we are not booted with systemd
This sounds like the better place to expose this than in "systemd-notify
--booted".

Also document the so far undocumented "unknown" state the command might
return. And rearrange the table of states documented to be more like the
one for "is-running".

Also, don't document the precise exit code of this function, just say
errors are reported != 0 or > 0...
2015-09-29 21:55:51 +02:00
Zbigniew Jędrzejewski-Szmek e16972e626 systemctl: add --state=help
This mirrors --type=help and simplifies completion scripts.

The array of states is dense, so the is no need to check if the string is null.
2015-09-28 15:09:34 -04:00
Alban Crequy 287419c119 containers: systemd exits with non-zero code
When a systemd service running in a container exits with a non-zero
code, it can be useful to terminate the container immediately and get
the exit code back to the host, when systemd-nspawn returns. This was
not possible to do. This patch adds the following to make it possible:

- Add a read-only "ExitCode" property on PID 1's "Manager" bus object.
  By default, it is 0 so the behaviour stays the same as previously.
- Add a method "SetExitCode" on the same object. The method fails when
  called on baremetal: it is only allowed in containers or in user
  session.
- Add support in systemctl to call "systemctl exit 42". It reuses the
  existing code for user session.
- Add exit.target and systemd-exit.service to the system instance.
- Change main() to actually call systemd-shutdown to exit() with the
  correct value.
- Add verb 'exit' in systemd-shutdown with parameter --exit-code
- Update systemctl manpage.

I used the following to test it:

| $ sudo rkt --debug --insecure-skip-verify run \
|            --mds-register=false --local docker://busybox \
|            --exec=/bin/chroot -- /proc/1/root \
|            systemctl --force exit 42
| ...
| Container rkt-895a0cba-5c66-4fa5-831c-e3f8ddc5810d failed with error code 42.
| $ echo $?
| 42

Fixes https://github.com/systemd/systemd/issues/1290
2015-09-21 17:32:45 +02:00
Jan Synacek ac5e3a505e core: extend KillUnit() to return error when no unit was killed 2015-09-21 10:05:49 +02:00
Evgeny Vereshchagin fb30c438f3 systemctl: add ConsistsOf as the inverse of PartOf 2015-09-08 03:02:49 +03:00
Jan Synacek 9ef15026c0 logind/systemctl: introduce SetWallMessage and --message
Enable unprivileged users to set wall message on a shutdown
operation. When the message is set via the --message option,
it is logged together with the default shutdown message.

$ systemctl reboot --message "Applied kernel updates."

$ journalctl -b -1
...
systemd-logind[27]: System is rebooting. (Applied kernel updates.)
...
2015-08-25 13:52:44 +02:00
Zbigniew Jędrzejewski-Szmek bbd46aadf3 man: update description of --quiet
This description should provide the general rule, without
listing all the subcommands, which is bound to get out of date
too often.

https://github.com/systemd/systemd/issues/216
2015-08-05 20:21:19 -04:00
Zbigniew Jędrzejewski-Szmek ea539eb659 man: information about available properties
https://bugzilla.redhat.com/show_bug.cgi?id=1144496
2015-07-02 09:15:09 -04:00
Andrew Eikum 853382da70 man: Remove instances of pseudo-English "resp."
Me again :) Just noticed one of these in a manpage and did another pass
to clean them up.  See 16dad32e43 for
explanation, though the link needs updating:
<http://transblawg.eu/2004/02/26/resp-and-other-non-existent-english-wordsnicht-existente-englische-worter/>
2015-06-29 10:33:31 -05:00