Zbigniew Jędrzejewski-Szmek [Fri, 22 Apr 2016 01:11:15 +0000 (21:11 -0400)]
shared/install: always overwrite symlinks in .wants and .requires
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.
Zbigniew Jędrzejewski-Szmek [Fri, 22 Apr 2016 00:04:21 +0000 (20:04 -0400)]
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.)
Zbigniew Jędrzejewski-Szmek [Thu, 21 Apr 2016 13:53:48 +0000 (09:53 -0400)]
shared/install: rewrite unit_file_changes_add()
path_kill_slashes was applied to the wrong arg...
Zbigniew Jędrzejewski-Szmek [Thu, 21 Apr 2016 13:23:18 +0000 (09:23 -0400)]
core/dbus-manager: drop unused param from installation functions
Zbigniew Jędrzejewski-Szmek [Thu, 21 Apr 2016 04:57:50 +0000 (00:57 -0400)]
shared/install: nicer error message is symlinking chokes on an existing file
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.
Susant Sahani [Thu, 21 Apr 2016 00:36:33 +0000 (06:06 +0530)]
networkd: respect DHCP UseRoutes option (#3075)
This fixes #2282.
Susant Sahani [Thu, 21 Apr 2016 00:34:13 +0000 (06:04 +0530)]
networkd: bump MTU to 1280 for interfaces which have IPv6 enabled (#3077)
IPv6 protocol requires a minimum MTU of 1280 bytes on the interface.
This fixes #3046.
Introduce helper link_ipv6_enabled() to figure out whether IPV6 is enabled.
Introduce network_has_static_ipv6_addresses() to find out if any static
ipv6 address configured.
If IPv6 is not configured on any interface that is SLAAC, DHCPv6 and static
IPv6 addresses not configured, then IPv6 will be automatically disabled for that
interface, that is we write "1" to /proc/sys/net/ipv6/conf//disable_ipv6.
Lennart Poettering [Wed, 20 Apr 2016 18:26:34 +0000 (20:26 +0200)]
Merge pull request #3074 from keszybz/tmpfiles
systemd-tmpfiles improvements, nspawn -E, honouring $TERM in pid1
Zbigniew Jędrzejewski-Szmek [Wed, 20 Apr 2016 04:06:25 +0000 (00:06 -0400)]
tmpfiles: add new 'e' action which cleans up a dir without creating it
I wanted to add a config line that would empty a directory
without creating it if doesn't exist. Existing actions don't allow
this.
v2: properly add 'e' to needs_glob() and takes_ownership()
Zbigniew Jędrzejewski-Szmek [Wed, 20 Apr 2016 04:03:47 +0000 (00:03 -0400)]
man: try to explain different actions in tmpfiles a bit better
- do not suggest that vendor configuration files should be in
/etc, use /usr/lib/tmpfiles.d instead
- split the first example, because the text talked about "needing
two directories", but then a smack attribute was also set, and
on a different path, which looked like a typo. Replace that
with the example from original patch [1] which added 't'.
- fix the example for /var/tmp/abrt. The 'x' line was redundant,
because /var/tmp/abrt/* is already filtered because "d /var/tmp/abrt"
overrides "d /var/tmp".
[1] http://permalink.gmane.org/gmane.comp.sysutils.systemd.devel/25051
Zbigniew Jędrzejewski-Szmek [Wed, 20 Apr 2016 02:42:00 +0000 (22:42 -0400)]
tmpfiles: shorten some long error messages
Also don't print %m when the message already contains all the info.
Zbigniew Jędrzejewski-Szmek [Wed, 20 Apr 2016 02:34:04 +0000 (22:34 -0400)]
tmpfiles: interpret "-" as stdin
Zbigniew Jędrzejewski-Szmek [Wed, 20 Apr 2016 01:56:39 +0000 (21:56 -0400)]
pid1: disable color output when TERM=dumb
This changes the behaviour of pid1 in the following ways:
- obviously $TERM is now checked,
- $SYSTEMD_COLORS is now honoured too, before only SYSTEMD_LOG_COLORS was checked,
- isatty() is run on stdout not stderr.
As requested in #3025.
Zbigniew Jędrzejewski-Szmek [Wed, 20 Apr 2016 12:41:25 +0000 (08:41 -0400)]
machinectl: add -E as alias for --setenv
Zbigniew Jędrzejewski-Szmek [Wed, 20 Apr 2016 12:38:01 +0000 (08:38 -0400)]
run: add -E as alias for --setenv
Zbigniew Jędrzejewski-Szmek [Wed, 20 Apr 2016 01:54:55 +0000 (21:54 -0400)]
nspawn: add -E as alias for --setenv
v2:
- "=" is required, so remove the <optional> tags that v1 added
Zbigniew Jędrzejewski-Szmek [Wed, 20 Apr 2016 01:30:14 +0000 (21:30 -0400)]
basic/terminal-util: cache value for colors_enabled
After all it's something that we query over and over.
For example, systemctl calls colors_enabled() four times for each failing
service. The compiler is unable to optimize those calls away because they
(potentially) accesses external and global state through on_tty() and
getenv().
Michał Bartoszkiewicz [Wed, 20 Apr 2016 08:06:26 +0000 (10:06 +0200)]
logind: use type to determine graphical sessions (#3071)
Franck Bui [Wed, 20 Apr 2016 01:18:17 +0000 (03:18 +0200)]
systemctl: hide "following" units if '--all' is not passed (#2967)
No need to dump all the redundant device units on the user, just because he
specified that he wants to see units of a specific state.
This was broken by commit
ebc962656cee33e3e8395f456a8208c3ca41969c.
Lennart Poettering [Tue, 19 Apr 2016 15:21:18 +0000 (17:21 +0200)]
Merge pull request #3055 from keszybz/preset-fixes
Another bunch of improvements to the installation code
Evgeny Vereshchagin [Tue, 19 Apr 2016 14:59:47 +0000 (17:59 +0300)]
coredump: create unnamed temporary files if possible (O_TMPFILE) (#3065)
Don't leave temporary files if the coredump service is aborted during
the operation
Yeah, these are temporary files that systemd-coredump needs while
processing the coredumps. Of course, if the coredump service is aborted
during the operation we better shouldn't leave those files around. This
is hence a bug to fix in our coredumping code.
See https://github.com/systemd/systemd/issues/2804#issuecomment-
210578147
Another option is to simply use O_TMPFILE, and when it is not available
fall back to the current behaviour. After all, the files are cleaned up
eventually, through normal tmpfiles aging, and the offending file
systems are pretty exotic these days, or not in the upstream kernel.
See https://github.com/systemd/systemd/issues/2804#issuecomment-
211496707
Zbigniew Jędrzejewski-Szmek [Mon, 18 Apr 2016 00:46:00 +0000 (20:46 -0400)]
run: change --tty option to --pty as documented
Keep the previous option name as hidden, for compatibility.
Fixes #3054.
Zbigniew Jędrzejewski-Szmek [Mon, 18 Apr 2016 00:37:30 +0000 (20:37 -0400)]
systemctl: warning about missing install info for template units
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.
Zbigniew Jędrzejewski-Szmek [Tue, 19 Apr 2016 04:04:35 +0000 (00:04 -0400)]
shared/install: change value of _UNIT_FILE_CHANGE_TYPE_INVALID
-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.
Zbigniew Jędrzejewski-Szmek [Sun, 17 Apr 2016 14:16:44 +0000 (10:16 -0400)]
shared/install,systemctl,core: report offending file on installation error
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.
Vittorio G (VittGam) [Tue, 19 Apr 2016 09:18:18 +0000 (11:18 +0200)]
sleep: Add debug feature to bypass hibernation memory checks. (#3064)
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>
Felipe Sateler [Tue, 19 Apr 2016 04:23:01 +0000 (01:23 -0300)]
zsh-completion: remove non-portable uses of \s in awk (#3063)
Zbigniew Jędrzejewski-Szmek [Sun, 17 Apr 2016 19:56:46 +0000 (15:56 -0400)]
shared/install: add helper function unit_file_changes_have_modification()
As suggested in review of #3049.
Zbigniew Jędrzejewski-Szmek [Sun, 17 Apr 2016 19:43:16 +0000 (15:43 -0400)]
Various formatting and style fixes
Felipe Sateler [Mon, 18 Apr 2016 21:27:42 +0000 (18:27 -0300)]
Add zsh completion for networkctl (#3062)
mulkieran [Mon, 18 Apr 2016 17:38:58 +0000 (13:38 -0400)]
Master minutes (#3060)
* man: change time unit specifier for minutes to "m", not "min".
To alert the reader to the fact that the ambiguous prefix "m" will be
interpreted as minutes, not months.
* man: change 'journal files' to 'archived journal files'.
So that the user may be reminded why they see log entries in the journal
from a time previous to the one they specified when using --vacuum-time.
Wouter Verhelst [Mon, 18 Apr 2016 14:29:10 +0000 (16:29 +0200)]
Mark nbd as inactive until connected (#2422)
Currently, 99-systemd.rules.in contains a line for network block
devices, which mark them as inactive until the first change event, and
as active from then on forward. This is not correct. A network block
device can be connected or disconnected; this state is signalled by the
presence or absense of a "pid" file, which contains the PID of the
nbd client userspace process that started the connection.
Update the rules file so that it checks for the presence of that file to
decide what to set SYSTEMD_READY to.
Note that current kernels do issue a change event upon connecting the
device, but not yet upon disconnecting. While it's possible to wait
until that's been fixed, the behaviour of the rule with TEST!="pid" in
the absence of a proper uevent is exactly the same as the behaviour of
the old rule; so it should be safe to apply now.
Signed-off-by: Wouter Verhelst <w@uter.be>
michaelolbrich [Mon, 18 Apr 2016 13:28:00 +0000 (15:28 +0200)]
basic: user-utils.c needs missing.h for secure_getenv (#3059)
Otherwise building may fail with:
src/basic/user-util.c: In function 'get_home_dir':
src/basic/user-util.c:343:9: error: implicit declaration of function 'secure_getenv' [-Werror=implicit-function-declaration]
Susant Sahani [Mon, 18 Apr 2016 11:45:52 +0000 (17:15 +0530)]
networkd: allow setting of multicast querier for linux bridge (#3051)
Peter Hutterer [Mon, 18 Apr 2016 06:50:25 +0000 (16:50 +1000)]
hwdb: add touchpad resolutions for the Dell XPS 15 9550 (#3057)
https://bugs.freedesktop.org/show_bug.cgi?id=94773
Dan Nicholson [Mon, 18 Apr 2016 02:52:45 +0000 (19:52 -0700)]
conf-parser: Set EXTRACT_RETAIN_ESCAPE when extracting words (#2917)
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 \.
Lubomir Rintel [Mon, 18 Apr 2016 01:45:42 +0000 (03:45 +0200)]
tree-wide: fall back to now(CLOCK_MONOTONIC) if CLOCK_BOOTTIME unsupported (#3037)
It was added in 2.6.39, and causes an assertion to fail when running in mock
hosted on 2.6.32-based RHEL-6:
Assertion 'clock_gettime(map_clock_id(clock_id), &ts) == 0' failed at systemd/src/basic/time-util.c:70, function now(). Aborting.
Lennart Poettering [Sun, 17 Apr 2016 12:29:41 +0000 (14:29 +0200)]
Merge pull request #3049 from keszybz/preset-fixes
Fixes for preset-all handling and a few related issues
Nicolas Braud-Santoni [Sun, 17 Apr 2016 12:22:17 +0000 (14:22 +0200)]
man: systemd.exec: Clarify InaccessibleDirectories (#3048) (#3048)
Zbigniew Jędrzejewski-Szmek [Sun, 17 Apr 2016 03:08:23 +0000 (23:08 -0400)]
install: allow paths like LookupPath.generator to be NULL
Fixes #3047.
Zbigniew Jędrzejewski-Szmek [Sun, 17 Apr 2016 02:52:06 +0000 (22:52 -0400)]
tree-wide: introduce PATH_IN_SET macro
Zbigniew Jędrzejewski-Szmek [Sat, 16 Apr 2016 23:31:53 +0000 (19:31 -0400)]
systemctl/core: ignore masked units in preset-all
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.
Zbigniew Jędrzejewski-Szmek [Sat, 16 Apr 2016 22:41:34 +0000 (18:41 -0400)]
tree-wide: use ERFKILL instead of ESHUTDOWN for "unit masked"
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.
Zbigniew Jędrzejewski-Szmek [Sat, 16 Apr 2016 22:31:42 +0000 (18:31 -0400)]
journald: rewrite function with switch, fix handling of -ESHUTDOWN
The comments and the log messages are next to one another, so it's easier
to check that the messages match the comments.
The sign was omitted in the check for -ESHUTDOWN, so it was never matched.
Zbigniew Jędrzejewski-Szmek [Sat, 16 Apr 2016 22:21:58 +0000 (18:21 -0400)]
sd-bus: use IN_SET
Zbigniew Jędrzejewski-Szmek [Sat, 16 Apr 2016 21:41:46 +0000 (17:41 -0400)]
systemctl: make --root=/ disable dbus again
Before
0f03c2a4c093 specifying any path would cause the systemctl client
to do the installation itself, instead of going over dbus. Restore that
behaviour.
Harald Hoyer [Thu, 14 Apr 2016 23:14:29 +0000 (01:14 +0200)]
core/mount-setup.c: also relabel /dev/shm for selinux (#3039)
daemons, which wish to transition state from the initramfs to the real
root, might use /dev/shm for their state.
As /dev is not relabeled across mount points, /dev/shm has to be
relabled explicitly.
Daniel Mack [Thu, 14 Apr 2016 16:13:34 +0000 (18:13 +0200)]
Merge pull request #3036 from evverx/add-ldl
build-sys: add missing -ldl
Susant Sahani [Thu, 14 Apr 2016 09:56:57 +0000 (15:26 +0530)]
networkd: Add support to configure proxy arp support to interfaces (#3020)
Fixes: #2889
Daniel Mack [Thu, 14 Apr 2016 08:41:27 +0000 (10:41 +0200)]
Merge pull request #3029 from ipuustin/supplementary-gids
sd-bus: query pid also when requesting supplementary gids information
Martin Pitt [Thu, 14 Apr 2016 08:14:41 +0000 (10:14 +0200)]
Merge pull request #3033 from keszybz/code-cleanups
Code cleanups
Zbigniew Jędrzejewski-Szmek [Thu, 14 Apr 2016 01:11:28 +0000 (21:11 -0400)]
systemctl: fix leak
CID #1354670.
Zbigniew Jędrzejewski-Szmek [Thu, 14 Apr 2016 01:10:33 +0000 (21:10 -0400)]
shared/path-lookup: fix leak
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.
Zbigniew Jędrzejewski-Szmek [Thu, 14 Apr 2016 01:09:32 +0000 (21:09 -0400)]
test-strv: add a test that extending empty strv works as expected
Just making sure :)
Evgeny Vereshchagin [Thu, 14 Apr 2016 00:24:58 +0000 (00:24 +0000)]
build-sys: add missing -ldl
Fixes #3035
Evgeny Vereshchagin [Wed, 13 Apr 2016 13:57:06 +0000 (16:57 +0300)]
tests: don't rely on the host's systemd-nspawn, don't register test machine (#3023)
Fixes:
$ cd test/TEST-07-ISSUE-1981/
$ sudo make clean setup run
...
timeout: failed to run command ‘systemd-nspawn’: No such file or directory
...
TEST RUN: https://github.com/systemd/systemd/issues/1981 [FAILED]
Makefile:10: recipe for target 'run' failed
make: *** [run] Error 1
Ismo Puustinen [Wed, 13 Apr 2016 12:38:03 +0000 (15:38 +0300)]
sd-bus: query pid also when searching for supplementary gids
If the SD_BUS_CREDS_SUPPLEMENTARY_GIDS value is requested, the pid is
queried to find out the supplementary gids value from /proc/pid/status.
Otherwise sd_bus_creds_get_supplementary_gids() won't work unless some
other value in mask triggered fetching the pid information.
Zbigniew Jędrzejewski-Szmek [Sat, 9 Apr 2016 18:04:09 +0000 (14:04 -0400)]
tree-wide: remove useless NULLs from strjoina
The coccinelle patch didn't work in some places, I have no idea why.
Zbigniew Jędrzejewski-Szmek [Sat, 9 Apr 2016 02:20:22 +0000 (22:20 -0400)]
basic/util: silence stupid gcc warnings about unitialized variable
Martin Pitt [Tue, 12 Apr 2016 16:20:13 +0000 (18:20 +0200)]
Merge pull request #2973 from poettering/search-path
Many fixes, in particular to the install logic
Nicolas Braud-Santoni [Tue, 12 Apr 2016 16:00:19 +0000 (18:00 +0200)]
load-fragment: Resolve specifiers in DeviceAllow (#3019)
Closes #1602
Lennart Poettering [Tue, 12 Apr 2016 14:13:28 +0000 (16:13 +0200)]
systemctl: when we want to know whether there's a native unit file, don't choke on ELOOP
ELOOP indicates that there's a symlink in /etc for a native unit file, and
that's completely OK.
Lennart Poettering [Tue, 12 Apr 2016 11:51:28 +0000 (13:51 +0200)]
test-dnssec: drop unused variable
Lennart Poettering [Tue, 12 Apr 2016 11:51:06 +0000 (13:51 +0200)]
core: make sure we always free the list of changes
Lennart Poettering [Mon, 11 Apr 2016 16:48:31 +0000 (18:48 +0200)]
man: shorten the list of unit file paths a bit
Let's make this more digestable to read by making the list of documented unit
file paths a bit shorter.
Specifically, let's drop references to $XDG_CONFIG_HOME and $XDG_DATA_HOME, as
their default values are listed too already. Given that the fact that the XDG
basedir spec makes these paths configurable is probably not a strong point of
the spec, let's drop the reference to the env vars, and keep only the literal,
default paths for them in the list. Of course, we do support the full XDG
basedir spec in this regard, but it's one thing to implement it and another one
to recommend it by documenting it.
Replace "$HOME" by "~", because UNIX.
Lennart Poettering [Mon, 11 Apr 2016 16:20:02 +0000 (18:20 +0200)]
core: keep track of the mtime of the transient unit file we wrote
Otherwise "systemctl status" will immediately report that our unit file is out
of date.
Lennart Poettering [Wed, 24 Feb 2016 16:20:12 +0000 (17:20 +0100)]
update TODO
Lennart Poettering [Mon, 11 Apr 2016 16:07:45 +0000 (18:07 +0200)]
sd-lldp: minor whitespace fixes
Lennart Poettering [Mon, 11 Apr 2016 16:07:04 +0000 (18:07 +0200)]
sd-lldp: drop LLDP ethernet export from sd-lldp.h
We only use it for the Tx code anyway, hence sd-lldp.h shouldn't expose it, as
it only implements Rx.
Lennart Poettering [Mon, 11 Apr 2016 15:57:05 +0000 (17:57 +0200)]
core: make sure we generate a nicer error when a linked unit is attempted to be enabled
We don't allow using config symlinks to enable units, but the error message we
printed was awful. Fix that, and generate a more readable error.
Fixes #3010.
Lennart Poettering [Mon, 11 Apr 2016 15:24:08 +0000 (17:24 +0200)]
machinectl: add new "machinectl clean" command
This new command removes all, or all hidden container images that have been
downloaded.
Lennart Poettering [Fri, 8 Apr 2016 17:13:43 +0000 (19:13 +0200)]
README: document that we only support util-linux built with --enable-libmount-force-mountinfo
Fixes: #2978
Lennart Poettering [Fri, 8 Apr 2016 17:00:00 +0000 (19:00 +0200)]
man: clarify that DefaultDependencies= is in the [Unit] section
This hopefully reduces confusion resulting in issues like #2992.
Lennart Poettering [Fri, 8 Apr 2016 16:54:05 +0000 (18:54 +0200)]
tests: override XDG_RUNTIME_DIR where we use the user runtime dir
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.
Lennart Poettering [Fri, 8 Apr 2016 16:13:02 +0000 (18:13 +0200)]
core: optimize unit_write_drop_in a bit
There's no point in first determining the drop-in file name path, then
forgetting it again, and then determining it again. Instead, just generated it
once, and then write to ti directly.
Lennart Poettering [Fri, 8 Apr 2016 16:10:32 +0000 (18:10 +0200)]
core: when creating a drop-in snippet, add a comment explaining this to it
Lennart Poettering [Fri, 8 Apr 2016 16:00:36 +0000 (18:00 +0200)]
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.
Lennart Poettering [Fri, 8 Apr 2016 15:59:52 +0000 (17:59 +0200)]
install: fix errno handling
Lennart Poettering [Fri, 8 Apr 2016 15:58:53 +0000 (17:58 +0200)]
install: simplify skip_root() a bit
Exit early, so that we can get rid of the large if block.
Lennart Poettering [Fri, 8 Apr 2016 09:30:24 +0000 (11:30 +0200)]
nstall: no need to export unit_file_lookup_state() anymore
We only use it inside of install.c, hence let's make it static.
Lennart Poettering [Fri, 8 Apr 2016 09:27:28 +0000 (11:27 +0200)]
tree-wide: add new SIGNAL_VALID() macro-like function that validates signal numbers
And port all code over to use it.
Lennart Poettering [Thu, 7 Apr 2016 17:22:24 +0000 (19:22 +0200)]
basic: remove rbtree code, it's unused
it's unused, and should we need it one day we can always resurrect it from git
history.
Lennart Poettering [Thu, 7 Apr 2016 17:18:59 +0000 (19:18 +0200)]
sysv-generator: port to use new unit_file_exists() call
The code previously queries the state of a unit file, but was only interested
in the existance of it, hence let's use unit_file_exists() instead, the same
way the SysV compat code in systemctl does it.
Lennart Poettering [Thu, 7 Apr 2016 16:48:01 +0000 (18:48 +0200)]
systemctl: don't confuse sysv code with generated units
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.
Lennart Poettering [Thu, 7 Apr 2016 15:51:26 +0000 (17:51 +0200)]
path-lookup: move generator_binary_paths() to end of file
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.
Lennart Poettering [Thu, 7 Apr 2016 15:41:48 +0000 (17:41 +0200)]
systemctl: add error message when we get unexpected event from waitid()
We should log about everything we don't expect.
Also, add a comment for one case were we do not log, on purpose, and make it
use a separate error code.
Lennart Poettering [Thu, 7 Apr 2016 15:41:35 +0000 (17:41 +0200)]
systemctl: fix incorrect errno for error message
Lennart Poettering [Thu, 7 Apr 2016 15:40:11 +0000 (17:40 +0200)]
systemctl: move check whether a service exists as native unit file to install.c
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.
Lennart Poettering [Thu, 7 Apr 2016 14:53:37 +0000 (16:53 +0200)]
core: rework reboot parameter logic a bit
Always warn if something fails, and clarify that the involved utility functions
do so in their name.
Drop the REBOOT_PARAM_FILE macro. We don't do this for other flag file paths
like this, so don't do this for this one either. The path isn't configurable
anyway, hence let's make this easier to read by avoiding this one indirection.
Lennart Poettering [Thu, 7 Apr 2016 14:15:26 +0000 (16:15 +0200)]
core: be more paranoid when mixing umask and fopen()
Let's be extra careful with the umask when we use simple fopen(), as this
creates files with 0777 by default.
Lennart Poettering [Thu, 7 Apr 2016 13:43:59 +0000 (15:43 +0200)]
core: rework how transient unit files and property drop-ins work
With this change the logic for placing transient unit files and drop-ins
generated via "systemctl set-property" is reworked.
The latter are now placed in the newly introduced "control" unit file
directory. The fomer are now placed in the "transient" unit file directory.
Note that the properties originally set when a transient unit was created will
be written to and stay in the transient unit file directory, while later
changes are done via drop-ins.
This is preparation for a later "systemctl revert" addition, where existing
drop-ins are flushed out, but the original transient definition is restored.
Lennart Poettering [Wed, 6 Apr 2016 19:02:36 +0000 (21:02 +0200)]
core: introduce a "control" unit file directory
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.
Lennart Poettering [Wed, 6 Apr 2016 18:48:58 +0000 (20:48 +0200)]
install: rename generator_paths() → generator_binary_paths()
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.
Lennart Poettering [Wed, 6 Apr 2016 18:47:44 +0000 (20:47 +0200)]
core: move flushing of generated unit files to path-lookup.c
It's very similar to the mkdir and trim operations for the generator dirs,
hence let's unify this at a single place.
Lennart Poettering [Wed, 6 Apr 2016 18:46:52 +0000 (20:46 +0200)]
core: minor coding style fix
Lennart Poettering [Wed, 6 Apr 2016 17:15:12 +0000 (19:15 +0200)]
tests: make sure test-path-lookup can run even when no units are installed on test system
Lennart Poettering [Wed, 6 Apr 2016 16:23:37 +0000 (18:23 +0200)]
localed: downgrade libxkbcommon to an optional runtime dependency
Previously, libxkbcommon was a compile-time option. When enabled the localed
binary would strictly depend on it, thus pulling in libxkbcommon and its
dependencies, which are non-trivial in size.
With this change we dlopen() libxkbcommon when it is available instead. If the
library is available behaviour is as before. However, if it isn't the system is
considered "headless", i.e. without local hardware and all attempts to set the
local keyboard configuration will be refused.
This is useful for general-purpose distributions which want to support
"headless" (such as container systems) and "full" systems with the same build.
Lennart Poettering [Wed, 6 Apr 2016 15:49:27 +0000 (17:49 +0200)]
test: bump up log level for install root test
Lennart Poettering [Tue, 5 Apr 2016 17:30:31 +0000 (19:30 +0200)]
shared: add a temporary work-around for kernel header inclusion fuck-up
See: #2864
Lennart Poettering [Mon, 7 Mar 2016 18:15:51 +0000 (19:15 +0100)]
install: unify checking whether operations may be applied to a unit file in a new function
Let's replace repeated code by a single implementation in a single function.