Michal Sekletar [Thu, 25 Aug 2016 22:07:58 +0000 (00:07 +0200)]
units: remove udev control socket when systemd stops the socket unit (#4039)
Mere presence of the socket in the filesystem makes
udev_queue_get_udev_is_active() return that udev is running. Note that,
udev on exit doesn't unlink control socket nor does systemd. Thus socket
stays around even when both daemon and socket are stopped. This causes
problems for cryptsetup because when it detects running udev it launches
synchronous operations that *really* require udev. This in turn may
cause blocking and subsequent timeout in systemd-cryptsetup on reboot
while machine is in a state that udev and its control socket units are
stopped, e.g. emergency mode.
Fixes #2477
Vito Caputo [Thu, 25 Aug 2016 15:37:57 +0000 (08:37 -0700)]
journal: implicitly flush to var on recovery (#4028)
When the system journal becomes re-opened post-flush with the runtime
journal open, it implies we've recovered from something like an ENOSPC
situation where the system journal rotate had failed, leaving the system
journal closed, causing the runtime journal to be opened post-flush.
For the duration of the unavailable system journal, we log to the
runtime journal. But when the system journal gets opened (space made
available, for example), we need to close the runtime journal before new
journal writes will go to the system journal. Calling
server_flush_to_var() after opening the system journal with a runtime
journal present, post-flush, achieves this while preserving the runtime
journal's contents in the system journal.
The combination of the present flushed flag file and the runtime journal
being open is a state where we should be logging to the system journal,
so it's appropriate to resume doing so once we've successfully opened
the system journal.
Michal Sekletar [Thu, 25 Aug 2016 06:18:42 +0000 (08:18 +0200)]
udev: inform systemd how many workers we can potentially spawn (#4036)
Stefan [Wed, 24 Aug 2016 18:49:53 +0000 (20:49 +0200)]
docs: add --with-support-url= to distribution porting guide. (#4035)
Nick Owens [Wed, 24 Aug 2016 10:12:18 +0000 (03:12 -0700)]
run: respect quiet when starting timer (#4029)
Peter Hutterer [Wed, 24 Aug 2016 10:11:48 +0000 (20:11 +1000)]
hwdb: add axis ranges for the MacBook 4,1 (#4030)
https://bugzilla.redhat.com/show_bug.cgi?id=1357990
Balázs Úr [Tue, 23 Aug 2016 18:08:35 +0000 (20:08 +0200)]
Updated Hungarian translation (#4026)
Felipe Sateler [Tue, 23 Aug 2016 09:29:30 +0000 (06:29 -0300)]
core,network: Use const qualifiers for block-local variables in macro functions (#4019)
Prevents discard-qualifiers warnings when the passed variable was const
Felipe Sateler [Mon, 22 Aug 2016 19:40:58 +0000 (16:40 -0300)]
core: do not fail at step SECCOMP if there is no kernel support (#4004)
Fixes #3882
0xAX [Mon, 22 Aug 2016 06:14:23 +0000 (09:14 +0300)]
mount-tool: return 0 instead of NULL in the acquire_description() (#4009)
to prevent:
src/mount/mount-tool.c: In function ‘acquire_description’:
src/mount/mount-tool.c:728:24: warning: return makes integer from pointer without a cast [-Wint-conversion]
return NULL;
^~~~
warning.
Additionally we don't set Description property in a case when
arg_description is NULL.
Peter Hutterer [Sun, 21 Aug 2016 23:31:25 +0000 (09:31 +1000)]
hwdb: provide axis ranges for the Dell XPS M1530 (#4016)
https://bugs.freedesktop.org/show_bug.cgi?id=97433
Zbigniew Jędrzejewski-Szmek [Sun, 21 Aug 2016 17:15:26 +0000 (13:15 -0400)]
networkd: fix typo (#4013)
Zbigniew Jędrzejewski-Szmek [Sun, 21 Aug 2016 13:10:51 +0000 (09:10 -0400)]
shared/install: do not enable masked instances (#4005)
When told to enable a template unit, and the DefaultInstance specified in that
unit was masked, we would do this. Such a unit cannot be started or loaded, so
reporting successful enabling is misleading and unexpected.
$ systemctl mask getty@tty1
Created symlink /etc/systemd/system/getty@tty1.service → /dev/null.
$ systemctl --root=/ enable getty@tty1
(unchanged)
Failed to enable unit, unit /etc/systemd/system/getty@tty1.service is masked.
$ systemctl --root=/ enable getty@
(before)
Created symlink /etc/systemd/system/getty.target.wants/getty@tty1.service → /usr/lib/systemd/system/getty@.service.
(now)
Failed to enable unit, unit /etc/systemd/system/getty@tty1.service is masked.
The same error is emitted for enable and preset. And an error is emmited, not a
warning, so the failure to enable DefaultInstance is treated the same as if the
instance was specified on the command line. I think that this makes most sense,
for most template units.
Fixes #2513.
Zbigniew Jędrzejewski-Szmek [Sun, 21 Aug 2016 13:06:28 +0000 (09:06 -0400)]
networkd: limit the number of routes to the kernel limit (#4007)
Fixes #3922.
Seraphime [Sun, 21 Aug 2016 03:39:07 +0000 (05:39 +0200)]
machinectl: print OS release in `machinectl list` (#3975)
Ronny Chevalier [Sat, 20 Aug 2016 09:42:24 +0000 (11:42 +0200)]
Merge pull request #4001 from clintonroy/master
systemctl: kill all units specified on the command line, not just the…
Zbigniew Jędrzejewski-Szmek [Fri, 19 Aug 2016 23:00:25 +0000 (19:00 -0400)]
Merge pull request #3965 from htejun/systemd-controller-on-unified
Clinton Roy [Fri, 19 Aug 2016 22:59:02 +0000 (08:59 +1000)]
systemctl: kill all units specified on the command line, not just the first one.
0xAX [Fri, 19 Aug 2016 22:51:54 +0000 (01:51 +0300)]
terminal-util: remove unnecessary check of result of isatty() (#4000)
After the call of the isatty() we check its result twice in the
open_terminal(). There are no sense to check result of isatty() that
it is less than zero and return -errno, because as described in
documentation:
isatty() returns 1 if fd is an open file descriptor referring to a
terminal; otherwise 0 is returned, and errno is set to indicate the
error.
So it can't be less than zero.
Evgeny Vereshchagin [Fri, 19 Aug 2016 20:33:49 +0000 (23:33 +0300)]
Merge pull request #3909 from poettering/mount-tool
add a new tool for creating transient mount and automount units
Lennart Poettering [Fri, 19 Aug 2016 17:36:09 +0000 (19:36 +0200)]
Merge pull request #3987 from keszybz/console-color-setup
Rework console color setup
Lennart Poettering [Fri, 19 Aug 2016 17:10:30 +0000 (19:10 +0200)]
Merge pull request #3955 from keszybz/fix-preset-all
Fix preset-all
Lennart Poettering [Fri, 19 Aug 2016 17:08:41 +0000 (19:08 +0200)]
Merge pull request #3961 from keszybz/pr/3924
Add documentation to #3924
Lennart Poettering [Fri, 19 Aug 2016 16:16:28 +0000 (18:16 +0200)]
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.
Zbigniew Jędrzejewski-Szmek [Fri, 19 Aug 2016 16:13:44 +0000 (12:13 -0400)]
Merge pull request #3997 from poettering/codition-udev-fix
Trivial fixes to udev and condition tests
Zbigniew Jędrzejewski-Szmek [Fri, 19 Aug 2016 14:26:27 +0000 (10:26 -0400)]
terminal-util: use getenv_bool for $SYSTEMD_COLORS
This changes the semantics a bit: before, SYSTEMD_COLORS= would be treated as
"yes", same as SYSTEMD_COLORS=xxx and SYSTEMD_COLORS=1, and only
SYSTEMD_COLORS=0 would be treated as "no". Now, only valid booleans are treated
as "yes". This actually matches how $SYSTEMD_COLORS was announced in NEWS.
Zbigniew Jędrzejewski-Szmek [Fri, 19 Aug 2016 02:03:56 +0000 (22:03 -0400)]
systemd: ignore lack of tty when checking whether colors should be enabled
When started by the kernel, we are connected to the console, and we'll set TERM
properly to some value in fixup_environment(). We'll then enable or disable
colors based on the value of $SYSTEMD_COLORS and $TERM.
When reexecuting, TERM should be already set, so we can use this value.
Effectively, behaviour is the same as before
affd7ed1a was reverted, but instead
of reopening the console before configuring color output, we just ignore what
stdout is connected to and decide based on the variables only.
Ronny Chevalier [Fri, 19 Aug 2016 14:46:49 +0000 (16:46 +0200)]
Merge pull request #3992 from poettering/hostname-fix2
some hostname fixes, triggered by #3979
Lennart Poettering [Fri, 19 Aug 2016 14:01:17 +0000 (16:01 +0200)]
tests: let's stick to 8ch indenting, in perl code too
Lennart Poettering [Fri, 19 Aug 2016 14:00:51 +0000 (16:00 +0200)]
test: always check whether condition allocation worked
Our tests should test for OOM too explicitly, hence fix the test accordingly
Zbigniew Jędrzejewski-Szmek [Thu, 18 Aug 2016 02:15:54 +0000 (22:15 -0400)]
shared/install: properly report masked units listed in Also=
A masked unit is listed in Also=:
$ systemctl cat test1 test2
→# /etc/systemd/system/test1.service
[Unit]
Description=test service 1
[Service]
Type=oneshot
ExecStart=/usr/bin/true
[Install]
WantedBy=multi-user.target
Also=test2.service
Alias=alias1.service
→# /dev/null
$ systemctl --root=/ enable test1
(before)
Created symlink /etc/systemd/system/alias1.service → /etc/systemd/system/test1.service.
Created symlink /etc/systemd/system/multi-user.target.wants/test1.service → /etc/systemd/system/test1.service.
The unit files have no installation config (WantedBy, RequiredBy, Also, Alias
settings in the [Install] section, and DefaultInstance for template units).
This means they are not meant to be enabled using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
.wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
D-Bus, udev, scripted systemctl call, ...).
4) In case of template units, the unit is meant to be enabled with some
instance name specified.
(after)
Created symlink /etc/systemd/system/alias1.service → /etc/systemd/system/test1.service.
Created symlink /etc/systemd/system/multi-user.target.wants/test1.service → /etc/systemd/system/test1.service.
Unit /etc/systemd/system/test2.service is masked, ignoring.
Zbigniew Jędrzejewski-Szmek [Sat, 13 Aug 2016 14:09:11 +0000 (10:09 -0400)]
units: install user units as real files, not symlinks to ../system/
This was causing preset-all --global to create symlinks:
$ systemctl preset-all --global --root=/var/tmp/inst1
Created symlink /var/tmp/inst1/etc/systemd/user/shutdown.target → /usr/lib/systemd/user/../system/shutdown.target.
Created symlink /var/tmp/inst1/etc/systemd/user/sockets.target → /usr/lib/systemd/user/../system/sockets.target.
Created symlink /var/tmp/inst1/etc/systemd/user/timers.target → /usr/lib/systemd/user/../system/timers.target.
Created symlink /var/tmp/inst1/etc/systemd/user/paths.target → /usr/lib/systemd/user/../system/paths.target.
Created symlink /var/tmp/inst1/etc/systemd/user/bluetooth.target → /usr/lib/systemd/user/../system/bluetooth.target.
Created symlink /var/tmp/inst1/etc/systemd/user/printer.target → /usr/lib/systemd/user/../system/printer.target.
Created symlink /var/tmp/inst1/etc/systemd/user/sound.target → /usr/lib/systemd/user/../system/sound.target.
Created symlink /var/tmp/inst1/etc/systemd/user/smartcard.target → /usr/lib/systemd/user/../system/smartcard.target.
Created symlink /var/tmp/inst1/etc/systemd/user/busnames.target → /usr/lib/systemd/user/../system/busnames.target.
It is better to create units in a state that completely matches the presets, i.e.
preset-all should do nothing when invoked immediately after installation.
I'm sure it was confusing to users too, suggesting that system and user units
may somehow alias each other.
Zbigniew Jędrzejewski-Szmek [Sat, 13 Aug 2016 05:55:16 +0000 (01:55 -0400)]
units: synchronize Makefile and presets settings
Enable reboot.target and disable exit.target: the first is used on normal
machines, the second only in containers, and the more general one
should be enabled by default.
Also fix the Makefile to match what preset-all does.
With this and the previous commits, doing "make instal DESTDIR=…" followed
by "systemctl preset-all --root=…" doesn't result in any changes.
Zbigniew Jędrzejewski-Szmek [Sat, 13 Aug 2016 05:52:12 +0000 (01:52 -0400)]
units: enable systemd-networkd-wait-online.service, disable all journal-remote stuff
The preset for systemd-networkd-wait-online.service should match
whatever we do for systemd-networkd.service. s-n-wait-online.service
is only pulled in when some other unit pulls in network-online.target,
otherwise it's not used. But if something pulls in network-online.target,
they should expect s-n-wait-online.service to be active iff
systemd-networkd.service is active.
OTOH, the journal-remote and journal-upload services should be disabled
by default, since they don't do anything without additional configuration.
Zbigniew Jędrzejewski-Szmek [Sat, 13 Aug 2016 05:27:21 +0000 (01:27 -0400)]
shared/install: when creating symlinks, keep existing relative symlinks
Running preset-all on a system installed from rpms or even created
using make install would remove and recreate a lot of symlinks, changing
relative to absolute symlinks. In general relative symlinks are nicer,
so there is no reason to change them, and those spurious changes were
obscuring more interesting stuff.
$ make install DESTDIR=/var/tmp/inst1
$ systemctl preset-all --root=/var/tmp/inst1
(before)
Removed /var/tmp/inst1/etc/systemd/system/network-online.target.wants/systemd-networkd-wait-online.service.
Created symlink /var/tmp/inst1/etc/systemd/system/ctrl-alt-del.target → /usr/lib/systemd/system/exit.target.
Removed /var/tmp/inst1/etc/systemd/system/multi-user.target.wants/remote-fs.target.
Created symlink /var/tmp/inst1/etc/systemd/system/multi-user.target.wants/remote-fs.target → /usr/lib/systemd/system/remote-fs.target.
Created symlink /var/tmp/inst1/etc/systemd/system/multi-user.target.wants/machines.target → /usr/lib/systemd/system/machines.target.
Created symlink /var/tmp/inst1/etc/systemd/system/sockets.target.wants/systemd-journal-remote.socket → /usr/lib/systemd/system/systemd-journal-remote.socket.
Removed /var/tmp/inst1/etc/systemd/system/sockets.target.wants/systemd-networkd.socket.
Created symlink /var/tmp/inst1/etc/systemd/system/sockets.target.wants/systemd-networkd.socket → /usr/lib/systemd/system/systemd-networkd.socket.
Removed /var/tmp/inst1/etc/systemd/system/getty.target.wants/getty@tty1.service.
Created symlink /var/tmp/inst1/etc/systemd/system/getty.target.wants/getty@tty1.service → /usr/lib/systemd/system/getty@.service.
Created symlink /var/tmp/inst1/etc/systemd/system/multi-user.target.wants/systemd-journal-upload.service → /usr/lib/systemd/system/systemd-journal-upload.service.
Removed /var/tmp/inst1/etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service.
Created symlink /var/tmp/inst1/etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service → /usr/lib/systemd/system/systemd-timesyncd.service.
Removed /var/tmp/inst1/etc/systemd/system/multi-user.target.wants/systemd-resolved.service.
Created symlink /var/tmp/inst1/etc/systemd/system/multi-user.target.wants/systemd-resolved.service → /usr/lib/systemd/system/systemd-resolved.service.
Removed /var/tmp/inst1/etc/systemd/system/multi-user.target.wants/systemd-networkd.service.
Created symlink /var/tmp/inst1/etc/systemd/system/multi-user.target.wants/systemd-networkd.service → /usr/lib/systemd/system/systemd-networkd.service.
(after)
Removed /var/tmp/inst1/etc/systemd/system/network-online.target.wants/systemd-networkd-wait-online.service.
Created symlink /var/tmp/inst1/etc/systemd/system/ctrl-alt-del.target → /usr/lib/systemd/system/exit.target.
Created symlink /var/tmp/inst1/etc/systemd/system/multi-user.target.wants/machines.target → /usr/lib/systemd/system/machines.target.
Created symlink /var/tmp/inst1/etc/systemd/system/sockets.target.wants/systemd-journal-remote.socket → /usr/lib/systemd/system/systemd-journal-remote.socket.
Created symlink /var/tmp/inst1/etc/systemd/system/multi-user.target.wants/systemd-journal-upload.service → /usr/lib/systemd/system/systemd-journal-upload.service.
Zbigniew Jędrzejewski-Szmek [Sat, 13 Aug 2016 05:21:57 +0000 (01:21 -0400)]
shared/install: move root skipping into create_symlink()
No functional change intended.
Zbigniew Jędrzejewski-Szmek [Sat, 13 Aug 2016 13:38:12 +0000 (09:38 -0400)]
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.
Zbigniew Jędrzejewski-Szmek [Sat, 13 Aug 2016 05:20:29 +0000 (01:20 -0400)]
shared/install: ignore unit symlinks when doing preset-all
Before, when interating over unit files during preset-all, behaviour was the
following:
- if we hit the real unit name first, presets were queried for that name, and
that unit was enabled or disabled accordingly,
- if we hit an alias first (one of the symlinks chaining to the real unit), we
checked the presets using the symlink name, and then proceeded to enable or
disable the real unit.
E.g. for systemd-networkd.service we have the alias dbus-org.freedesktop.network1.service
(/usr/lib/systemd/system/dbus-org.freedesktop.network1.service), but the preset
is only for the systemd-networkd.service name. The service would be enabled or
disabled pseudorandomly depending on the order of iteration.
For "preset", behaviour was analogous: preset on the alias name disabled the
service (following the default disable policy), preset on the "real" name
applied the presets.
With the patch, for "preset" and "preset-all" we silently skip symlinks. This
gives mostly the right behaviour, with the limitation that presets on aliases
are ignored. I think that presets on aliases are not that common (at least my
preset files on Fedora don't exhibit any such usage), and should not be
necessary, since whoever installs the preset can just refer to the real unit
file. It would be possible to overcome this limitation by gathering a list of
names of a unit first, and then checking whether *any* of the names matches the
presets list. That would require a significant redesign of the code, and be
a lot slower (since we would have to fully read all unit directories to preset
one unit) to so I'm not doing that for now.
With this patch, two properties are satisfied:
- preset-all and preset are idempotent, and the second and subsequent invocations
do not produce any changes,
- preset-all and preset for a specific name produce the same state for that unit.
Fixes #3616.
Zbigniew Jędrzejewski-Szmek [Sat, 13 Aug 2016 03:50:58 +0000 (23:50 -0400)]
shared/install: remove unused paramater and add more comments
Zbigniew Jędrzejewski-Szmek [Fri, 12 Aug 2016 01:53:32 +0000 (21:53 -0400)]
systemctl: fix preset-all with missing /etc/systemd/system
If the directory is missing, we can assume that those pesky symlinks are gone too.
Lennart Poettering [Fri, 19 Aug 2016 13:31:36 +0000 (15:31 +0200)]
hwdb: let's no abbreivate HORIZONTAL as HORIZ (#3994)
I think I am developing OCD... Let's fix this before this actually gets used in
the wild.
A follow-up for #3986 (
5fc9e4abb41e7f58f6c308f54881c596713fba75).
Lennart Poettering [Fri, 19 Aug 2016 09:04:13 +0000 (11:04 +0200)]
man: minor wording fixes
Lennart Poettering [Fri, 19 Aug 2016 09:02:55 +0000 (11:02 +0200)]
man: don't claim we replace spaces by dashes when cleaning up hostnames
Let's make sure the man page actually documents what is implemented, i.e.
"Lennart's PC" turns into "LennartsPC" when we clean up the name.
Lennart Poettering [Fri, 19 Aug 2016 09:02:24 +0000 (11:02 +0200)]
man: document that static/transient hostnames may be 64 chars at max
Lennart Poettering [Fri, 19 Aug 2016 09:01:21 +0000 (11:01 +0200)]
tests: add test from #3979
Let's add one more test that came up during the discussion of an issue.
The selected name with 69 chars is above the Linux hostname limit of 64.
Lennart Poettering [Fri, 19 Aug 2016 08:43:58 +0000 (10:43 +0200)]
Merge pull request #3990 from AnchorCat/networkd-fixes
networkd: various fixes for route configuration
Lennart Poettering [Fri, 19 Aug 2016 08:41:26 +0000 (10:41 +0200)]
Merge pull request #3988 from keszybz/journald-dynamic-users
Journald dynamic users
Peter Hutterer [Fri, 19 Aug 2016 08:25:53 +0000 (18:25 +1000)]
hwdb: add resolution for the Dell Precision 5510 (#3989)
https://bugs.freedesktop.org/show_bug.cgi?id=97347
Zbigniew Jędrzejewski-Szmek [Fri, 19 Aug 2016 03:19:10 +0000 (23:19 -0400)]
journald: do not create split journals for dynamic users
Dynamic users should be treated like system users, and their logs
should end up in the main system journal.
Zbigniew Jędrzejewski-Szmek [Fri, 19 Aug 2016 03:09:29 +0000 (23:09 -0400)]
core/dynamic-users: warn when creation of symlinks for dynamic users fails
Also return the first error, since it's most likely to be interesting.
If unlink fails, symlink will usually return EEXIST.
Tejun Heo [Fri, 19 Aug 2016 02:57:53 +0000 (22:57 -0400)]
logind: update empty and "infinity" handling for [User]TasksMax (#3835)
The parsing functions for [User]TasksMax were inconsistent. Empty string and
"infinity" were interpreted as no limit for TasksMax but not accepted for
UserTasksMax. Update them so that they're consistent with other knobs.
* Empty string indicates the default value.
* "infinity" indicates no limit.
While at it, replace opencoded (uint64_t) -1 with CGROUP_LIMIT_MAX in TasksMax
handling.
v2: Update empty string to indicate the default value as suggested by Zbigniew
Jędrzejewski-Szmek.
v3: Fixed empty UserTasksMax handling.
Zbigniew Jędrzejewski-Szmek [Fri, 19 Aug 2016 02:53:12 +0000 (22:53 -0400)]
Merge pull request #3986 from whot/wip/click-wheel-angle-horiz
Add udev property for horizontal wheel click angles
Zbigniew Jędrzejewski-Szmek [Fri, 19 Aug 2016 02:52:13 +0000 (22:52 -0400)]
Merge pull request #3865 from poettering/remove-ipc
add RemoveIPC= service file setting
Zbigniew Jędrzejewski-Szmek [Fri, 19 Aug 2016 01:39:39 +0000 (21:39 -0400)]
Revert "pid1: reconnect to the console before being re-executed"
This reverts commit
affd7ed1a923b0df8479cff1bd9eafb625fdaa66.
> So it looks like make_console_stdio() has bad side effect. More specifically it
> does a TIOCSCTTY ioctl (via acquire_terminal()) which sees to disturb the
> process which was using/owning the console.
Fixes #3842.
https://bugs.debian.org/834367
https://bugzilla.redhat.com/show_bug.cgi?id=1367766
Zbigniew Jędrzejewski-Szmek [Wed, 17 Aug 2016 16:06:07 +0000 (12:06 -0400)]
systemd: warn when setrlimit fails
This should make it easier to figure things out.
Peter Hutterer [Tue, 16 Aug 2016 05:23:42 +0000 (15:23 +1000)]
hwdb: add a udev property for a wheel click angle on horiz wheels
The Logitech MX Master has a horizontal scroll wheel with a different click
angle than the vertical one. Add a new property for this case, we can't add
values to the normal one without risking upsetting existing parsers.
Fixes #3947
Peter Hutterer [Mon, 15 Aug 2016 03:22:12 +0000 (13:22 +1000)]
libudev: fix typo in comment
Lennart Poettering [Fri, 19 Aug 2016 01:16:16 +0000 (03:16 +0200)]
hostnamectl: rework pretty hostname validation (#3985)
Rework
17eb9a9ddba3f03fcba33445c1c1eedeb948da04 a bit.
Let's make sure we don't clobber the input parameter args[1], following our
coding style to not clobber parameters unless explicitly indicated. (in
particular, as we don't want to have our changes appear in the command line
shown in "ps"...)
No functional change.
Lennart Poettering [Thu, 18 Aug 2016 22:35:05 +0000 (00:35 +0200)]
nss-mymachines: avoid connecting to dbus from inside dbus-daemon
Inspired from the new logic in nss-systemd let's make sure we don't end up
deadlocking in nss-mymachines either in case dbus-daemon tries to a look up a
name and we want to connect to the bus.
This case is much simpler though, as there's no point in resolving virtual
machine UIDs by dbus-daemon as those should never be able to connect to the
host's busses.
Lennart Poettering [Tue, 2 Aug 2016 10:28:51 +0000 (12:28 +0200)]
core: bypass dynamic user lookups from dbus-daemon
dbus-daemon does NSS name look-ups in order to enforce its bus policy. This
might dead-lock if an NSS module use wants to use D-Bus for the look-up itself,
like our nss-systemd does. Let's work around this by bypassing bus
communication in the NSS module if we run inside of dbus-daemon. To make this
work we keep a bit of extra state in /run/systemd/dynamic-uid/ so that we don't
have to consult the bus, but can still resolve the names.
Note that the normal codepath continues to be via the bus, so that resolving
works from all mount namespaces and is subject to authentication, as before.
This is a bit dirty, but not too dirty, as dbus daemon is kinda special anyway
for PID 1.
Lennart Poettering [Tue, 2 Aug 2016 09:14:56 +0000 (11:14 +0200)]
clean-ipc: debug log about all remove IPC objects
Lennart Poettering [Mon, 1 Aug 2016 17:24:40 +0000 (19:24 +0200)]
core: add RemoveIPC= setting
This adds the boolean RemoveIPC= setting to service, socket, mount and swap
units (i.e. all unit types that may invoke processes). if turned on, and the
unit's user/group is not root, all IPC objects of the user/group are removed
when the service is shut down. The life-cycle of the IPC objects is hence bound
to the unit life-cycle.
This is particularly relevant for units with dynamic users, as it is essential
that no objects owned by the dynamic users survive the service exiting. In
fact, this patch adds code to imply RemoveIPC= if DynamicUser= is set.
In order to communicate the UID/GID of an executed process back to PID 1 this
adds a new "user lookup" socket pair, that is inherited into the forked
processes, and closed before the exec(). This is needed since we cannot do NSS
from PID 1 due to deadlock risks, However need to know the used UID/GID in
order to clean up IPC owned by it if the unit shuts down.
Lennart Poettering [Mon, 1 Aug 2016 15:40:37 +0000 (17:40 +0200)]
core: move obsolete properties to the end of vtables
This makes it easier to discern the relevant and obsolete parts of the vtables,
and in particular helps when comparing introspection data with the actual
vtable definitions.
Lennart Poettering [Fri, 29 Jul 2016 14:22:30 +0000 (16:22 +0200)]
core: make use of uid_is_valid() when checking for UID validity
Lennart Poettering [Thu, 28 Jul 2016 07:51:47 +0000 (09:51 +0200)]
clean-ipc: shorten code a bit
Lennart Poettering [Thu, 28 Jul 2016 07:51:25 +0000 (09:51 +0200)]
clean-ipc: don't filter out '.' and '..' twice
Lennart Poettering [Thu, 28 Jul 2016 07:50:28 +0000 (09:50 +0200)]
unit: remove orphaned cgroup_netclass_id field
Lennart Poettering [Fri, 5 Aug 2016 22:32:46 +0000 (00:32 +0200)]
add a new tool for creating transient mount and automount units
This adds "systemd-mount" which is for transient mount and automount units what
"systemd-run" is for transient service, scope and timer units.
The tool allows establishing mounts and automounts during runtime. It is very
similar to the usual /bin/mount commands, but can pull in additional
dependenices on access (for example, it pulls in fsck automatically), an take
benefit of the automount logic.
This tool is particularly useful for mount removable file systems (such as USB
sticks), as the automount logic (together with automatic unmount-on-idle), as
well as automatic fsck on first access ensure that the removable file system
has a high chance to remain in a fully clean state even when it is unplugged
abruptly, and returns to a clean state on the next re-plug.
This is a follow-up for #2471, as it adds a simple client-side for the
transient automount logic added in that PR.
In later work it might make sense to invoke this tool automatically from udev
rules in order to implement a simpler and safer version of removable media
management á la udisks.
Lennart Poettering [Fri, 5 Aug 2016 22:30:12 +0000 (00:30 +0200)]
run: various minor improvements
Let's improve the --help text a bit, and other changes.
Lennart Poettering [Fri, 5 Aug 2016 16:32:42 +0000 (18:32 +0200)]
bus-util: unify loop around bus_append_unit_property_assignment()
This is done exactly the same way a couple of times at various places, let's
unify this into one version.
Michael Chapman [Thu, 18 Aug 2016 07:54:12 +0000 (17:54 +1000)]
networkd: use RT_TABLE_MAIN by default
The default route table used by sd-netlink (and iproute2) is
RT_TABLE_MAIN, not RT_TABLE_DEFAULT. Ensure networkd has the same idea.
Michael Chapman [Thu, 18 Aug 2016 07:46:21 +0000 (17:46 +1000)]
networkd: do not touch link_messages when expiring routes
link_messages is used during link configuration to advance the link
state machine through SETTING_ADDRESSES -> SETTING_ROUTES -> CONFIGURED.
If a route expires in the middle of this, it is possible for
link_messages to hit zero inside route_expire_callback, rather than in
route_handler or address_handler where it would trigger the next step in
configuration. Should this happen, the link will not complete
configuration, and it may not have its static routes configured.
Since route_expire_callback does not need to do anything once the
expired route has been removed from the kernel, it is safe to simply not
account for the netlink request.
Tejun Heo [Mon, 15 Aug 2016 22:13:36 +0000 (18:13 -0400)]
core: use the unified hierarchy for the systemd cgroup controller hierarchy
Currently, systemd uses either the legacy hierarchies or the unified hierarchy.
When the legacy hierarchies are used, systemd uses a named legacy hierarchy
mounted on /sys/fs/cgroup/systemd without any kernel controllers for process
management. Due to the shortcomings in the legacy hierarchy, this involves a
lot of workarounds and complexities.
Because the unified hierarchy can be mounted and used in parallel to legacy
hierarchies, there's no reason for systemd to use a legacy hierarchy for
management even if the kernel resource controllers need to be mounted on legacy
hierarchies. It can simply mount the unified hierarchy under
/sys/fs/cgroup/systemd and use it without affecting other legacy hierarchies.
This disables a significant amount of fragile workaround logics and would allow
using features which depend on the unified hierarchy membership such bpf cgroup
v2 membership test. In time, this would also allow deleting the said
complexities.
This patch updates systemd so that it prefers the unified hierarchy for the
systemd cgroup controller hierarchy when legacy hierarchies are used for kernel
resource controllers.
* cg_unified(@controller) is introduced which tests whether the specific
controller in on unified hierarchy and used to choose the unified hierarchy
code path for process and service management when available. Kernel
controller specific operations remain gated by cg_all_unified().
* "systemd.legacy_systemd_cgroup_controller" kernel argument can be used to
force the use of legacy hierarchy for systemd cgroup controller.
* nspawn: By default nspawn uses the same hierarchies as the host. If
UNIFIED_CGROUP_HIERARCHY is set to 1, unified hierarchy is used for all. If
0, legacy for all.
* nspawn: arg_unified_cgroup_hierarchy is made an enum and now encodes one of
three options - legacy, only systemd controller on unified, and unified. The
value is passed into mount setup functions and controls cgroup configuration.
* nspawn: Interpretation of SYSTEMD_CGROUP_CONTROLLER to the actual mount
option is moved to mount_legacy_cgroup_hierarchy() so that it can take an
appropriate action depending on the configuration of the host.
v2: - CGroupUnified enum replaces open coded integer values to indicate the
cgroup operation mode.
- Various style updates.
v3: Fixed a bug in detect_unified_cgroup_hierarchy() introduced during v2.
v4: Restored legacy container on unified host support and fixed another bug in
detect_unified_cgroup_hierarchy().
Lennart Poettering [Wed, 17 Aug 2016 18:28:45 +0000 (20:28 +0200)]
Merge pull request #3946 from keszybz/open-journal-root
Make journalctl more flexible
Felipe Sateler [Wed, 17 Aug 2016 18:11:27 +0000 (15:11 -0300)]
sysv-generator: better error reporting (#3977)
Currently in the journal you get messages without context like:
systemd-sysv-generator[$pid]: Failed to build name: Invalid argument
When parsing the init script, show the file and line number where the
error was found. At the same time, add more context information if
available.
Thus turning the message into something like:
systemd-sysv-generator[$pid]: [/etc/init.d/root-system-proofd:13] Could not build name for facility $network,: Invalid argument
Vito Caputo [Wed, 17 Aug 2016 12:51:07 +0000 (05:51 -0700)]
journal: ensure open journals from find_journal() (#3973)
If journals get into a closed state like when rotate fails due to
ENOSPC, when space is made available it currently goes unnoticed leaving
the journals in a closed state indefinitely.
By calling system_journal_open() on entry to find_journal() we ensure
the journal has been opened/created if possible.
Also moved system_journal_open() up to after open_journal(), before
find_journal().
Fixes https://github.com/systemd/systemd/issues/3968
Michal Sekletar [Wed, 17 Aug 2016 12:10:28 +0000 (14:10 +0200)]
rules: introduce disk/by-id (model_serial) symlinks for NVMe drives (#3974)
$ ls -l /dev/disk/by-id/nvme*
lrwxrwxrwx. 1 root root 13 Aug 17 04:25 /dev/disk/by-id/nvme-HUSPR3216AHP301_STM0001B6780 -> ../../nvme0n1
lrwxrwxrwx. 1 root root 15 Aug 17 04:25 /dev/disk/by-id/nvme-HUSPR3216AHP301_STM0001B6780-part1 -> ../../nvme0n1p1
https://github.com/systemd/systemd/issues/1453
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=
779ff75617099f4defe14e20443b95019a4c5ae8
Ronny Chevalier [Tue, 16 Aug 2016 19:22:50 +0000 (21:22 +0200)]
Merge pull request #3960 from keszybz/efi-option-description
build-sys: clarify that --disable-efi is about sd-boot and bootctl
Daniel Hahler [Tue, 16 Aug 2016 16:47:39 +0000 (18:47 +0200)]
zsh: _journalctl: also handle --root arg and --key=value style (#3956)
This will now also handle `journalctl --directory=/var/log/journal`
properly.
Daniel Hahler [Tue, 16 Aug 2016 16:42:41 +0000 (18:42 +0200)]
zsh: _journalctl: do not complete exclusive modes (#3957)
After `journalctl -D /var/log/journal` "--directory", "--file",
"--machine" and "--root" should not be available for completion, because
they are exclusive. But multiple `--file` arguments are allowed.
Michael Chapman [Tue, 16 Aug 2016 09:07:42 +0000 (19:07 +1000)]
networkd: avoid NULL pointer dereference in route_add
If no result parameter is provided, do not attempt to write the
found/newly-created route to it. This is presently not an issue as all
callers currently provide a non-NULL result parameter, however we should
do this for symmetry with address_add and future code robustness.
Tejun Heo [Mon, 15 Aug 2016 22:13:36 +0000 (18:13 -0400)]
core: rename cg_unified() to cg_all_unified()
A following patch will update cgroup handling so that the systemd controller
(/sys/fs/cgroup/systemd) can use the unified hierarchy even if the kernel
resource controllers are on the legacy hierarchies. This would require
distinguishing whether all controllers are on cgroup v2 or only the systemd
controller is. In preparation, this patch renames cg_unified() to
cg_all_unified().
This patch doesn't cause any functional changes.
Zbigniew Jędrzejewski-Szmek [Sun, 14 Aug 2016 22:03:35 +0000 (18:03 -0400)]
Merge pull request #3905 from htejun/cgroup-v2-cpu
core: add cgroup CPU controller support on the unified hierarchy
(zj: merging not squashing to make it clear against which upstream this patch was developed.)
Zbigniew Jędrzejewski-Szmek [Sun, 14 Aug 2016 20:27:59 +0000 (16:27 -0400)]
man: explain that *KeyIgnoreInhibited only apply to a subset of locks
Follow-up for #3924.
Zbigniew Jędrzejewski-Szmek [Sun, 14 Aug 2016 19:24:33 +0000 (15:24 -0400)]
build-sys: clarify that --disable-efi is about sd-boot and bootctl
If wasn't obvious what the effect of --disable-efi was without
going through Makefile.am.
Fixes #3959.
Zbigniew Jędrzejewski-Szmek [Sat, 13 Aug 2016 15:15:19 +0000 (11:15 -0400)]
units: do not start load-random-seed in containers (#3941)
Random numbers are provided by the host kernel, we don't need to do anything.
https://bugzilla.redhat.com/show_bug.cgi?id=1329124
Zbigniew Jędrzejewski-Szmek [Sat, 13 Aug 2016 15:14:58 +0000 (11:14 -0400)]
hwdb: normalize spacing in 60-keyboard.hwdb (#3954)
Daniel Hahler [Sat, 13 Aug 2016 14:42:55 +0000 (16:42 +0200)]
zsh: _systemctl: do not attempt to use "--system" by default (#3951)
In 68c4f6d the following was added:
local -a _modes; _modes=("--user" "--system")
local _sys_service_mgr=${${words:*_modes}[(R)(${(j.|.)_modes})]:---system}
With the following comment:
> If neither are on the line, --system is set; for system services to be
> completed.
But it does not work as documented:
% _modes=(--user --system)
% words=()
% echo ${${words:*_modes}[(R)(${(j.|.)_modes})]:---system}
However, it should not use `--system` in that case anyway, so this patch
removes the part that should cause a default to be used and adds some
comments.
Daniel Hahler [Sat, 13 Aug 2016 14:41:22 +0000 (16:41 +0200)]
zsh: _journalctl: improve support for handling mode args (#3952)
This only completes fields from `journalctl --user` in _journal_fields when `--user`
is used.
It also changes $_sys_service_mgr to include both `--system` and `--user`,
because `journalctl` behaves different from `systemctl` in this regard.
No attempt is made to filter out invalid combinations, e.g. when using both
`--directory` and `--system` (see https://github.com/systemd/systemd/issues/3949).
Zbigniew Jędrzejewski-Szmek [Fri, 12 Aug 2016 04:34:45 +0000 (00:34 -0400)]
journalctl: allow --root argument for journal watching
It is useful to look at a (possibly inactive) container or other os tree
with --root=/path/to/container. This is similar to specifying
--directory=/path/to/container/var/log/journal --directory=/path/to/container/run/systemd/journal
(if using --directory multiple times was allowed), but doesn't require
as much typing.
Zbigniew Jędrzejewski-Szmek [Fri, 12 Aug 2016 04:32:10 +0000 (00:32 -0400)]
sd-journal: fix sd_journal_open_directory with SD_JOURNAL_OS_ROOT
The directory argument that is given to sd_j_o_d was ignored when
SD_JOURNAL_OS_ROOT was given, and directories relative to the root of the host
file system were used. With that flag, sd_j_o_d should do the same as
sd_j_open_container: use the path as "prefix", i.e. the directory relative to
which everything happens.
Instead of touching sd_j_o_d, journal_new is fixed to do what sd_j_o_c
was doing, and treat the specified path as prefix when SD_JOURNAL_OS_ROOT is
specified.
Zbigniew Jędrzejewski-Szmek [Fri, 12 Aug 2016 02:48:58 +0000 (22:48 -0400)]
sd-journal: allow SYSTEM and CURRENT_USER flags with sd_j_open_directory[_fd]
There is no reason not to. This makes journalctl -D ... --system work,
useful for example when viewing files from a deactivated container.
Zbigniew Jędrzejewski-Szmek [Fri, 12 Aug 2016 02:43:07 +0000 (22:43 -0400)]
sd-journal: split out flags into separate defines for legibility
… in preparation for future changes.
Zbigniew Jędrzejewski-Szmek [Thu, 11 Aug 2016 19:39:15 +0000 (15:39 -0400)]
Merge pull request #3942 from blueyed/zsh-respect-user-more
zsh completion: handle --user mode when filtering by state and in journalctl commands
Daniel Hahler [Thu, 11 Aug 2016 16:52:13 +0000 (18:52 +0200)]
zsh: _journalctl: handle --user in _journal_none
This uses the same mechanism from _systemctl to inject `--user` into the
`journalctrl -F _EXE` call to list executables.
Before this patch the "commands" section would list executables from
system units always.
Daniel Hahler [Thu, 11 Aug 2016 16:46:31 +0000 (18:46 +0200)]
zsh: _filter_units_by_property: respect --user
Use `$_sys_service_mgr` to handle `--user`, so that `systemctl --user
stop` will correctly filter the active (user) units. Before this patch,
only user units that also exist as system units and are stoppable there
would be listed.
Zbigniew Jędrzejewski-Szmek [Thu, 11 Aug 2016 08:51:49 +0000 (04:51 -0400)]
man: add "timeout" to status table (#3919)
Zbigniew Jędrzejewski-Szmek [Thu, 11 Aug 2016 08:51:00 +0000 (04:51 -0400)]
coredump: treat RLIMIT_CORE below page size as disabling coredumps (#3932)
The kernel treats values below a certain threshold (minfmt->min_coredump
which is initialized do ELF_EXEC_PAGESIZE, which varies between architectures,
but is usually the same as PAGE_SIZE) as disabling coredumps [1].
Any core image below ELF_EXEC_PAGESIZE will yield an invalid backtrace anyway [2],
so follow the kernel and not try to parse or store such images.
[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/fs/coredump.c#n660
[2] systemd-coredump[16260]: Process 16258 (sleep) of user 1002 dumped core.
Stack trace of thread 16258:
#0 0x00007f1d8b3d3810 n/a (n/a)
https://bugzilla.redhat.com/show_bug.cgi?id=1309172#c19
Lennart Poettering [Thu, 11 Aug 2016 08:49:57 +0000 (10:49 +0200)]
Merge pull request #3933 from keszybz/hwdb-parser
Add hwdb parser to check for inconsistencies
Rhys [Tue, 9 Aug 2016 13:33:46 +0000 (23:33 +1000)]
install: follow config_path symlink (#3362)
Under NixOS, the config_path /etc/systemd/system is a symlink to
/etc/static/systemd/system. Commands such as `systemctl list-unit-files`
and `systemctl is-enabled` did not work as the symlink was not followed.
This does not affect how symlinks are treated within the config_path
directory.