Age | Commit message (Collapse) | Author |
|
Make this an output flag instead, so that our function prototypes can lose one
parameter
|
|
This adds a new GetProcesses() bus call to the Unit object which returns an
array consisting of all PIDs, their process names, as well as their full cgroup
paths. This is then used by "systemctl status" to show the per-unit process
tree.
This has the benefit that the client-side no longer needs to access the
cgroupfs directly to show the process tree of a unit. Instead, it now uses this
new API, which means it also works if -H or -M are used correctly, as the
information from the specific host is used, and not the one from the local
system.
Fixes: #2945
|
|
|
|
|
|
Nicer error message is symlinking chokes on an existing file
|
|
Before:
$ systemctl preset getty@.service
Failed to preset unit, file /etc/systemd/system/getty.target.wants/getty@tty1.service
already exists and is a symlink to ../../../../usr/lib/systemd/system/getty@.service.
After:
$ systemctl preset getty@.service
Created symlink /etc/systemd/system/getty.target.wants/getty@tty1.service,
pointing to /usr/lib/systemd/system/getty@.service.
We don't really care where the symlink points to. For example, it might point
to /usr/lib or /etc, and systemd will always load the unit from /etc in
preference to /usr/lib. In fact, if we make a symlink like
/etc/systemd/system/multi-user.target.wants/b.service -> ../a.service, pid1
will still start b.service. The name of the symlink is the only thing that
matters, as far as systemd is concerned. For humans it's confusing when the
symlinks points to anything else than the actual unit file. At the very least,
the symlink is supposed to point to a file with the same name in some other
directory. Since we don't care where the symlink points, we can always replace
an existing symlink.
Another option I considered would be to simply leave an existing symlink in
place. That would work too, but replacing the symlink with the expected value
seems more intuitive.
Of course those considerations only apply to .wants and .requires. Symlinks
created with "link" and "alias" are a separate matter.
Fixes #3056.
|
|
path_kill_slashes was applied to the wrong arg...
|
|
Fixes #1892.
Previously:
Failed to enable unit: Invalid argument
Now:
Failed to enable unit, file /etc/systemd/system/ssh.service already exists.
It would be nice to include the unit name in the message too. I looked into
this, but it would require major surgery on the whole installation logic,
because we first create a list of things to change, and then try to apply them
in a loop. To transfer the knowledge which unit was the source of each change,
the data structures would have to be extended to carry the unit name over into
the second loop. So I'm skipping this for now.
|
|
Kill user session scope by default
|
|
|
|
Another bunch of improvements to the installation code
|
|
The advice string didn't talk about template units at all. Extend
it and print when trying to enable a template unit without install info.
Fixes #2345.
|
|
-1 could be confused with -EPERM. But we still need a negative enum
value to force gcc to use int for the enum type, even though it is
unused. Otherwise we get warnings.
|
|
Fixes #2191:
$ systemctl --root=/ enable sddm
Created symlink /etc/systemd/system/display-manager.service, pointing to /usr/lib/systemd/system/sddm.service.
$ sudo build/systemctl --root=/ enable gdm
Failed to enable unit, file /etc/systemd/system/display-manager.service already exists and is a symlink to /usr/lib/systemd/system/sddm.service.
$ sudo build/systemctl --root= enable sddm
$ sudo build/systemctl --root= enable gdm
Failed to enable unit: File /etc/systemd/system/display-manager.service already exists and is a symlink to /usr/lib/systemd/system/sddm.service.
(I tried a few different approaches to pass the error information back to the
caller. Adding a new parameter to hold the error results in a gigantic patch
and a lot of hassle to pass the args arounds. Adding this information to the
changes array is straightforward and can be more easily extended in the
future.)
In case local installation is performed, the full set of errors can be reported
and we do that. When running over dbus, only the first error is reported.
|
|
This new feature bypasses checking if a swap partition is mounted
or if there is enough swap space available for hibernation to
succeed.
This can be useful when a system with a Solid State Disk (SSD)
has no normal swap partition or file configured, and a custom
systemd unit is used to mount a swap file just before hibernating
and unmount it just after resuming.
Signed-off-by: Vittorio Gambaletta <git-systemd@vittgam.net>
|
|
As suggested in review of #3049.
|
|
|
|
If you reference another unit with an escaped name, the escaped characters
should remain in the extracted word. This used to work correctly prior to
commit 34f253f0.
The problem can be seen when units with escaped names are referenced.
$ cat "/usr/lib/systemd/system/dev-disk-by\x2dlabel-eos\x2dswap.swap"
[Swap]
What=/dev/disk/by-label/eos-swap
[Install]
WantedBy=dev-disk-by\x2dlabel-eos\x2dswap.device
$ systemctl enable "dev-disk-by\x2dlabel-eos\x2dswap.swap"
Created symlink
/etc/systemd/system/dev-disk-byx2dlabel-eosx2dswap.device.wants/dev-disk-by\x2dlabel-eos\x2dswap.swap,
pointing to /usr/lib/systemd/system/dev-disk-by\x2dlabel-eos\x2dswap.swap.
The wants directory should be created with the x2ds escaped with \.
|
|
Fixes #3047.
|
|
With any masked unit that would that would be enabled by presets, we'd get:
test@rawhide $ sudo systemctl preset-all
Failed to execute operation: Unit file is masked.
test@rawhide $ sudo systemctl --root=/ preset-all
Operation failed: Cannot send after transport endpoint shutdown
Simply ignore those units:
test@rawhide $ sudo systemctl preset-all
Unit xxx.service is masked, ignoring.
|
|
If the error code ever leaks (we print the strerror error instead of providing
our own), the message for ESHUTDOWN is "Cannot send after transport endpoint
shutdown", which can be misleading. In particular it suggest that some
mishandling of the dbus connection occured. Let's change that to ERFKILL which
has the advantage that a) it sounds implausible as actual error, b) has the
connotation of disabling something manually.
|
|
CID #1354671: char **l would be leaked.
Also rename l to paths, to make the code easier to read,
and do strv deduplication immediately when extending. No need to allocate
strings to remove them a few lines down.
|
|
The coccinelle patch didn't work in some places, I have no idea why.
|
|
This new command removes all, or all hidden container images that have been
downloaded.
|
|
We don#t really support systems where XDG_RUNTIME_DIR is not supported for
systemd --user. Hence, let's always set our own XDG_RUNTIME_DIR for tests that
involve systemd --user, so that we know it is set, and that it doesn't polute
the user's actual runtime dir.
|
|
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.
|
|
|
|
Exit early, so that we can get rid of the large if block.
|
|
We only use it inside of install.c, hence let's make it static.
|
|
The SysV compat code checks whether there's a native unit file before looking
for a SysV init script. Since the newest rework generated units will show up in
the unit path, and hence the checks ended up assuming that there always was a
native unit file for each init script: the generated one.
With this change the generated unit file directory is suppressed from the
search path when this check is done, to avoid the confusion.
|
|
Let's keep the code that manipulates LookupPaths together, and move
generator_binary_paths() to the end of the .h and .c files, since it is not
strictly related to that.
|
|
Move the search path check from the SysV service compat support into install.c
so that we can reuse the usual algorithm instead of rolling a private loop for
this.
|
|
This patch adds a concept of a "control" unit file directory, which is supposed
to be used as place for unit file drop-ins created by "systemctl set-property"
(note that this directory is not actually hooked up to "systemctl set-property"
yet, that's coming in a later patch).
The rationale for this: previously changes made by the user and by "systemctl
set-property" were done in the same directory, which made semantics very
unclear: the changes made by "systemctl set-property" were applied instantly,
and their drop-ins only written to not lose settings on a later "systemctl
daemon-reload", while drop-ins made by the user would only be in effect after
"systemctl daemon-reload". This is particular problematic as the changes made
by "systemctl set-property" would really apply immediately without any respect
for the unit search path. This meant that using "set-property" could have an
effect that is lsot as soon as "daemon-reload" is issued, in case there was a
"later" drop-in already in place.
With this change the directories are seperated, and the "control" directory
always takes the highest priority of all, to avoid any confusion.
|
|
This is too confusing, as this funciton returns the paths to the generator
binaries, while usually when we refer to the just the "generator path" we mean
the generated unit files. Let's clean this up.
|
|
It's very similar to the mkdir and trim operations for the generator dirs,
hence let's unify this at a single place.
|
|
See: #2864
|
|
a new function
Let's replace repeated code by a single implementation in a single function.
|
|
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.
|
|
Previously, we'd execute some operations with the root prefix applied, while
others without (which was a bug). Clean this up: all paths are now prefixed
properly with the root path, and we strip it off when necessary.
(Of course, an alternative option would be to strictly pass around paths
without the prefix prepended and only prepend it right before hitting the disk,
however, I am came to the conclusion this would result in more code.)
|
|
Let's make the suffix it appends configurable. This way we can reuse it at a second place.
|
|
Let's modernize these calls a bit.
Also, don't call them from user_dirs() anymore, as we already have both dirs in
the list a second time via the persistent_config and runtime_config function
parameters.
|
|
user_runtime_dir() and user_config_home() are not used externally anymore,
hence let's not export them anymore.
|
|
Move this into a function of its own, so that we can run it after we ran the
generators, so that it takes into account removed generator dirs.
|
|
functions
|
|
Previously, transient units were created below the normal runtime directory
/run/systemd/system. With this change they are created in a special transient
directory /run/systemd/transient, which only contains data for transient units.
This clarifies the life-cycle of transient units, and makes clear they are
distinct from user-provided runtime units. In particular, users may now
extend transient units via /run/systemd/system, without systemd interfering
with the life-cycle of these files.
This change also adds code so that when a transient unit exits only the
drop-ins in this new directory are removed, but nothing else.
Fixes: #2139
|
|
After all, for test builds they might differ from /etc/systemd/{user|system},
hence they should be included.
|
|
We use the root directory parameter while putting together the LookupPaths
structure, hence let's also store it in the structure as-is. That way we can
drop a parameter from half of the functions in install.c
Also, let's move the validation of the root paths into lookup_paths_init() so
that we can drop even more code from install.c
|
|
Similar to the other calls that operate on the collected path data.
|
|
This way the funciton name matches nicely our other calls path_is_config() and
path_is_runtime().
|
|
configuration
Let's actually check the runtime config dir, instead of just /run.
|