]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
6 years agosystemctl: show capabilities in human readable format
Yu Watanabe [Thu, 31 Aug 2017 08:07:16 +0000 (17:07 +0900)] 
systemctl: show capabilities in human readable format

Follow-up for 21771f338d268e06dc9a10b9b08b14ff8217d4be.

6 years agocryptsetup-generator: do not bind to the decrypted device unit (#6538)
Ivan Shapovalov [Wed, 30 Aug 2017 16:49:07 +0000 (19:49 +0300)] 
cryptsetup-generator: do not bind to the decrypted device unit (#6538)

This breaks things when the decrypted device is not immediately
`SYSTEMD_READY=1` (e. g. when a multi-device btrfs system is placed on
multiple cryptsetup devices).

Fixes #6537.

6 years agoshutdown: don't remount,ro network filesystems. (#6588)
NeilBrown [Wed, 30 Aug 2017 16:48:25 +0000 (02:48 +1000)] 
shutdown: don't remount,ro network filesystems. (#6588)

systemd-shutdown is run after the network is stopped,
so remounting a network filesystem read-only can hang.
A simple umount is the most useful thing that can
be done for a network filesystem once the network is down.

6 years agoman: fix note for `systemctl enable --global` (#6592)
Alan Jenkins [Wed, 30 Aug 2017 16:47:40 +0000 (17:47 +0100)] 
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.

6 years agounits: starting suspend.target should not fail when suspend is successful (#6678)
Alan Jenkins [Wed, 30 Aug 2017 16:20:23 +0000 (17:20 +0100)] 
units: starting suspend.target should not fail when suspend is successful (#6678)

and the same for hibernate.target and hybrid-sleep.target.

Tested with both sucessful and unsuccessful suspends.  The result of the
start job was correct in both cases.  Closes #6419 (a regression in v233
and v234).

> suspend is unsual for a target, because it has to stop itself once it's
> started. Otherwise you couldn't start it again, so you could only suspend
> once! Currently that's implemented using BindsTo=systemd-sleep.service.
> Meaning it pulls in systemd-sleep.service to do the actual suspend, and
> then de-activates afterwards. But the behaviour of BindsTo was changed
> recently (not without some issues during development) - maybe this bug
> is caused by poettering/systemd@631b676 which I think was added in
> release v233.
>
> sleep.target (see man systemd.special) has the same need, but it
> implements it differently. It simply has StopWhenUnneeded=yes.

This commit switches suspend.target etc. to the approach used by
sleep.target.

6 years agosulogin-shell: remove ineffective job mode option from `systemctl isolate` (#6627)
Alan Jenkins [Wed, 30 Aug 2017 16:11:31 +0000 (17:11 +0100)] 
sulogin-shell: remove ineffective job mode option from `systemctl isolate` (#6627)

`systemctl default` uses job mode `isolate` (see `action_table`).
The job mode option is ignored.

Note that exiting the emergency shell service by using e.g.
`systemctl isolate multi-user` or `systemctl start multi-user.target`
already kills `emergency.service`.  There's only a potential conflict
between your command and the command in systemd-sulogin-shell if you run
something like `systemctl start --no-block multi-user.target; exit`.
Which is nothing like what we told them to do :).

6 years agomeson: add . to include_directories (#6634)
Davide Cavalca [Wed, 30 Aug 2017 15:34:44 +0000 (08:34 -0700)] 
meson: add . to include_directories (#6634)

6 years agoMerge pull request #6617 from sourcejedi/udev-unit-deps
Lennart Poettering [Wed, 30 Aug 2017 15:33:07 +0000 (17:33 +0200)] 
Merge pull request #6617 from sourcejedi/udev-unit-deps

udev service dependency nitpicks

6 years agodevice: make sure to remove all device units sharing the same sysfs path (#6679)
Franck Bui [Wed, 30 Aug 2017 15:16:16 +0000 (17:16 +0200)] 
device: make sure to remove all device units sharing the same sysfs path (#6679)

When a device is unplugged all device units sharing the same sysfs path
pointing to that device are supposed to be removed.

However it didn't work since while iterating the device unit list containing
all the relevant units, each unit was removed during each iteration of
LIST_FOREACH. However LIST_FOREACH doesn't support this use case and
LIST_FOREACH_SAFE must be use instead.

6 years agologind: VT_GETSTATE "cannot return state for more than 16 VTs" (#6625)
Alan Jenkins [Wed, 30 Aug 2017 15:06:12 +0000 (16:06 +0100)] 
logind: VT_GETSTATE "cannot return state for more than 16 VTs" (#6625)

`vt_is_busy(16)` would always return FALSE.  So we could have started
autovt@16.service even when VT 16 was already being used for something.

6 years agomeson: use current_source_dir() to scope git invocations (#6635)
Davide Cavalca [Wed, 30 Aug 2017 15:04:53 +0000 (08:04 -0700)] 
meson: use current_source_dir() to scope git invocations (#6635)

6 years agosd-bus: socket - only transmit auxillary FDs once (#6603)
Tom Gundersen [Wed, 30 Aug 2017 11:09:03 +0000 (13:09 +0200)] 
sd-bus: socket - only transmit auxillary FDs once (#6603)

If a message is too large to fit into the output buffer, it will be
transmitted to the kernel in several chunks. However, the FDs must
only ever be transmitted once or they will bereceived by the remote
end repeatedly.

The D-Bus specification disallows several sets of FDs attached to
one message, however, the reference implementation of D-Bus will
not reject such a message, rather it will reassign the duplicate
FDs to subsequent FD-carrying messages.

This attaches the FD array only to the first byte of the message.

6 years agoREADME: note that installing valgrind-devel maybe useful to developers (#6502)
Michal Sekletar [Wed, 30 Aug 2017 11:07:43 +0000 (13:07 +0200)] 
README: note that installing valgrind-devel maybe useful to developers (#6502)

Commit also mentions that when running under valgrind we actually don't
execve() systemd-shutdown. We have a comment about this in the code, but
being upfront about this change in behavior doesn't hurt.

6 years agoupdate TODO
Lennart Poettering [Wed, 30 Aug 2017 10:21:37 +0000 (12:21 +0200)] 
update TODO

6 years agoMerge pull request #6659 from yuwata/econnrefused
Lennart Poettering [Wed, 30 Aug 2017 10:17:53 +0000 (12:17 +0200)] 
Merge pull request #6659 from yuwata/econnrefused

networkd: do not fail manager_connect_bus() if dbus is not active yet

6 years agonetworkd: Honor configured DHCP ClientIdentifier on link_update (#6622)
Jon Ringle [Wed, 30 Aug 2017 09:38:00 +0000 (05:38 -0400)] 
networkd: Honor configured DHCP ClientIdentifier on link_update (#6622)

We have an embedded board with a couple of ethernet ports. From the kernel
log, I can see that the ethernet drivers are obtaining their correct MAC
address, but for some reason, at first systemd-networkd doesn't see the
mac address for the ethernet port at the time that it looks at
dhcp_client_identifier configuration (it has 00:00:00:00:00:00 for mac).

Later on, systemd-networkd gets a link_update() call, and at this time, it
has the correct mac address for the ethernet port. However, in link_update()
the dhcp_client_identifier configuration is not being considered, and a call
to sd_dhcp_client_set_iaid_duid() is being done always

6 years agoMerge pull request #6691 from yuwata/man-journal-remote2
Lennart Poettering [Wed, 30 Aug 2017 09:31:37 +0000 (11:31 +0200)] 
Merge pull request #6691 from yuwata/man-journal-remote2

journal-remote: small fixes

6 years agoupdate TODO
Lennart Poettering [Wed, 30 Aug 2017 08:50:01 +0000 (10:50 +0200)] 
update TODO

6 years agoMerge pull request #6672 from yuwata/drop-priv
Lennart Poettering [Wed, 30 Aug 2017 08:45:24 +0000 (10:45 +0200)] 
Merge pull request #6672 from yuwata/drop-priv

use !! prefix in networkd and timesyncd

6 years agoman: journal-remote: add detailed condition when SplitMode=none must be used 6691/head
Yu Watanabe [Wed, 30 Aug 2017 08:03:37 +0000 (17:03 +0900)] 
man: journal-remote: add detailed condition when SplitMode=none must be used

6 years agoterminal reset should honour default_utf8 kernel setting (#6606)
g0tar [Wed, 30 Aug 2017 08:00:44 +0000 (10:00 +0200)] 
terminal reset should honour default_utf8 kernel setting (#6606)

terminal reset should honour default_utf8 kernel setting

6 years agojournal-remote: show error if SplitMode=host with 'active' source is specified
Yu Watanabe [Wed, 30 Aug 2017 07:56:41 +0000 (16:56 +0900)] 
journal-remote: show error if SplitMode=host with 'active' source is specified

6 years agotest: drop Exec* prefixes to obtain paths of executables 6672/head
Yu Watanabe [Sat, 26 Aug 2017 16:48:23 +0000 (01:48 +0900)] 
test: drop Exec* prefixes to obtain paths of executables

6 years agotimesync: move stamp file to /var/lib/systemd/timesync/clock
Yu Watanabe [Wed, 30 Aug 2017 06:59:57 +0000 (15:59 +0900)] 
timesync: move stamp file to /var/lib/systemd/timesync/clock

6 years agoMerge pull request #6585 from poettering/seccomp-lock-personality
Lennart Poettering [Tue, 29 Aug 2017 16:58:56 +0000 (18:58 +0200)] 
Merge pull request #6585 from poettering/seccomp-lock-personality

Seccomp lock personality

6 years agoMerge pull request #6677 from yuwata/man-journal-remote
Lennart Poettering [Tue, 29 Aug 2017 16:04:50 +0000 (18:04 +0200)] 
Merge pull request #6677 from yuwata/man-journal-remote

journal-remote: improve man page and error message

6 years agonamespace: avoid assertion failure (#6649)
Topi Miettinen [Tue, 29 Aug 2017 15:31:24 +0000 (15:31 +0000)] 
namespace: avoid assertion failure (#6649)

If the root image is not decrypted, it must not be relinquished.

6 years agoMerge pull request #6670 from fsateler/disable-networkd
Lennart Poettering [Tue, 29 Aug 2017 15:28:06 +0000 (17:28 +0200)] 
Merge pull request #6670 from fsateler/disable-networkd

build-sys: don't build networkctl if networkd is disabled

6 years agocore: open up LockPersonality= for transient units 6585/head
Lennart Poettering [Wed, 9 Aug 2017 18:52:54 +0000 (20:52 +0200)] 
core: open up LockPersonality= for transient units

Let's make "systemd-run -p LockPersonality=1 -t /bin/sh" work.

6 years agoseccomp: rework seccomp_lock_personality() to apply filter to all archs
Lennart Poettering [Wed, 9 Aug 2017 18:43:35 +0000 (20:43 +0200)] 
seccomp: rework seccomp_lock_personality() to apply filter to all archs

6 years agoseccomp: default to something resembling the current personality when locking it
Lennart Poettering [Wed, 9 Aug 2017 18:40:26 +0000 (20:40 +0200)] 
seccomp: default to something resembling the current personality when locking it

Let's lock the personality to the currently set one, if nothing is
specifically specified. But do so with a grain of salt, and never
default to any exotic personality here, but only PER_LINUX or
PER_LINUX32.

6 years agoseccomp: LockPersonality boolean (#6193)
Topi Miettinen [Tue, 4 Jul 2017 12:48:18 +0000 (15:48 +0300)] 
seccomp: LockPersonality boolean (#6193)

Add LockPersonality boolean to allow locking down personality(2)
system call so that the execution domain can't be changed.
This may be useful to improve security because odd emulations
may be poorly tested and source of vulnerabilities, while
system services shouldn't need any weird personalities.

6 years agoMerge pull request #6636 from sourcejedi/fsync
Lennart Poettering [Tue, 29 Aug 2017 13:19:44 +0000 (15:19 +0200)] 
Merge pull request #6636 from sourcejedi/fsync

"Don't fear the fsync()"

6 years agofileio: rename function parameter to avoid masking global symbol 6636/head
Alan Jenkins [Tue, 29 Aug 2017 09:56:32 +0000 (10:56 +0100)] 
fileio: rename function parameter to avoid masking global symbol

> glibc exports a function called sync(), we should probably avoid
> overloading that as a variable here locally (gcc even used to warn about
> that, not sure why it doesn't anymore), to avoid confusion around what
> "if (sync)" actually means

6 years agohwdb: Add various USB mice (#6676)
Jonathan Teh [Mon, 28 Aug 2017 22:32:59 +0000 (23:32 +0100)] 
hwdb: Add various USB mice (#6676)

6 years agoMerge pull request #6653 from yuwata/man-link
Lennart Poettering [Mon, 28 Aug 2017 17:12:35 +0000 (19:12 +0200)] 
Merge pull request #6653 from yuwata/man-link

Small fixes

6 years agoshared: Add a linker script so that all functions are tagget @SD_SHARED instead of...
Felipe Sateler [Mon, 28 Aug 2017 16:49:03 +0000 (13:49 -0300)] 
shared: Add a linker script so that all functions are tagget @SD_SHARED instead of @Base (#6669)

This helps prevent symbol collisions with other programs and libraries. In particular,
because PAM modules are loaded into the process that is creating the session, and
systemd creates PAM sessions, the potential for collisions is high.

Disambiguate all systemd calls by tagging a 'version' SD_SHARED.

Fixes #6624

6 years agoRevert "mount-setup: mount xenfs filesystem (#6491)" (#6662)
vliaskov [Mon, 28 Aug 2017 16:46:01 +0000 (18:46 +0200)] 
Revert "mount-setup: mount xenfs filesystem (#6491)" (#6662)

This reverts commit b305bd3aab0446095bf28ffc28b3d908a7ace6b9.

6 years agoFix typo in man/systemd.exec.xml (#6683)
Diogo Pereira [Mon, 28 Aug 2017 16:38:29 +0000 (17:38 +0100)] 
Fix typo in man/systemd.exec.xml (#6683)

6 years agoAdded Romanian Translation (#6674)
dasj19 [Mon, 28 Aug 2017 16:24:09 +0000 (18:24 +0200)] 
Added Romanian Translation (#6674)

6 years agoSupport 'rdma' as a ListenNetlink= argument (#6626)
Jason Gunthorpe [Mon, 28 Aug 2017 15:22:10 +0000 (09:22 -0600)] 
Support 'rdma' as a ListenNetlink= argument (#6626)

NETLINK_RDMA has been in the kernel since v3.0.

6 years agoeditorconfig: add rule for meson.build files (#6671)
Felipe Sateler [Mon, 28 Aug 2017 14:37:23 +0000 (11:37 -0300)] 
editorconfig: add rule for meson.build files (#6671)

6 years agonetworkd: do not install the socket when networkd is not enabled 6670/head
Felipe Sateler [Sun, 27 Aug 2017 13:49:10 +0000 (10:49 -0300)] 
networkd: do not install the socket when networkd is not enabled

6 years agojournal-remote: show error message if output file name does not end with .journal 6677/head
Yu Watanabe [Sun, 27 Aug 2017 07:34:53 +0000 (16:34 +0900)] 
journal-remote: show error message if output file name does not end with .journal

`journalctl -o export | systemd-journal-remote -o /tmp/dir -`
gives the following error messages.
```
Failed to open output journal /tmp/dir: Invalid argument
Failed to get writer for source stdin: Invalid argument
Failed to create source for fd:0 (stdin): Invalid argument
```
And these are hard to understand what is the problem.
This commit makes journal-remote check whether the output file name
ends with .journal suffix or not, and if not, output error message.

6 years agoman: journal-remote: active mode without --url option requires output filename
Yu Watanabe [Sun, 27 Aug 2017 07:20:12 +0000 (16:20 +0900)] 
man: journal-remote: active mode without --url option requires output filename

Closes #6675.

6 years agounits: make use of !! ExecStart= prefix in systemd-timesyncd.service
Yu Watanabe [Thu, 10 Aug 2017 07:07:08 +0000 (16:07 +0900)] 
units: make use of !! ExecStart= prefix in systemd-timesyncd.service

Let's make use of !! to run timesyncd with ambient capabilities on
systems supporting them.

6 years agounits: make use of !! ExecStart= prefix in systemd-networkd.service
Yu Watanabe [Sat, 26 Aug 2017 16:40:47 +0000 (01:40 +0900)] 
units: make use of !! ExecStart= prefix in systemd-networkd.service

Let's make use of !! to run networkd with ambient capabilities on
systems supporting them.

6 years agobuild-sys: fix the script used for generating load_fragment_gperf_nulstr (#6646)
Evgeny Vereshchagin [Sat, 26 Aug 2017 14:21:23 +0000 (17:21 +0300)] 
build-sys: fix the script used for generating load_fragment_gperf_nulstr (#6646)

This prevents `systemd --dump-configuration-items` from crashing.
Closes #6596.

6 years agoNetworkd Bond DOC: Move ActiveSlave and PrimarySlave to [Network] (#6610)
Susant Sahani [Sat, 26 Aug 2017 13:37:46 +0000 (19:07 +0530)] 
Networkd Bond DOC: Move ActiveSlave and PrimarySlave to [Network] (#6610)

Fixes #6545

6 years agologind: make sure we don't process the same method call twice (#6583)
Lennart Poettering [Sat, 26 Aug 2017 13:19:26 +0000 (15:19 +0200)] 
logind: make sure we don't process the same method call twice (#6583)

Tiny mistake, big effect.

Fixes: #6375
6 years agoMerge pull request #6582 from poettering/logind-tty
Yu Watanabe [Sat, 26 Aug 2017 13:12:48 +0000 (22:12 +0900)] 
Merge pull request #6582 from poettering/logind-tty

various tty path parsing fixes

6 years agocore: disable the effect of Restart= if there's a stop job pending for a service...
Lennart Poettering [Sat, 26 Aug 2017 13:07:23 +0000 (15:07 +0200)] 
core: disable the effect of Restart= if there's a stop job pending for a service (#6581)

We shouldn't undo the job already enqueued, under any circumstances.

Fixes: #6504
6 years agoman: fix example indentation in tmpfiles.d(5) (#6578)
Lennart Poettering [Sat, 26 Aug 2017 12:59:21 +0000 (14:59 +0200)] 
man: fix example indentation in tmpfiles.d(5) (#6578)

docboc actually copies the indentation 1:1 into the final man page and
that makes the example really weirdly aligned. Let's fix that.

6 years agoMerge pull request #6577 from poettering/more-exec-flags
Yu Watanabe [Sat, 26 Aug 2017 12:49:05 +0000 (21:49 +0900)] 
Merge pull request #6577 from poettering/more-exec-flags

add ! and !! ExecStart= flags to make ambient caps useful

6 years agoservice: attempt to execute next main command only for oneshot services (#6619)
Michal Sekletar [Fri, 25 Aug 2017 13:36:10 +0000 (15:36 +0200)] 
service: attempt to execute next main command only for oneshot services (#6619)

This commit fixes crash described in
https://github.com/systemd/systemd/issues/6533

Multiple ExecStart lines are allowed only for oneshot services
anyway so it doesn't make sense to call service_run_next_main() with
services of type other than SERVICE_ONESHOT.

Referring back to reproducer from the issue, previously we didn't observe
this problem because s->main_command was reset after daemon-reload hence
we never reached the assert statement in service_run_next_main().

Fixes #6533

6 years agobuild-sys: don't build networkctl if networkd is disabled
Felipe Sateler [Mon, 21 Aug 2017 12:48:41 +0000 (09:48 -0300)] 
build-sys: don't build networkctl if networkd is disabled

6 years agonetwork,resolve: remove comments related to kdbus 6659/head
Yu Watanabe [Wed, 23 Aug 2017 03:38:56 +0000 (12:38 +0900)] 
network,resolve: remove comments related to kdbus

6 years agonetworkd: do not fail manager_connect_bus() if dbus is not active yet
Yu Watanabe [Wed, 23 Aug 2017 03:36:36 +0000 (12:36 +0900)] 
networkd: do not fail manager_connect_bus() if dbus is not active yet

Fixes #6618.

6 years agoman: mention configuration directories to sysusers.d 6653/head
Yu Watanabe [Tue, 22 Aug 2017 04:27:21 +0000 (13:27 +0900)] 
man: mention configuration directories to sysusers.d

6 years agoMerge pull request #6615 from ssahani/client-id
Yu Watanabe [Tue, 22 Aug 2017 11:19:19 +0000 (20:19 +0900)] 
Merge pull request #6615 from ssahani/client-id

networkd: fix spell DCHPClientIdentifier (DCHP => DHCP)

6 years agoman: fix wrong citation in systemd-sysctl.service.xml
Yu Watanabe [Tue, 22 Aug 2017 04:26:09 +0000 (13:26 +0900)] 
man: fix wrong citation in systemd-sysctl.service.xml

6 years agoCONTRIBUTING: stop mentioning "make check"
Michael Biebl [Mon, 21 Aug 2017 07:47:07 +0000 (09:47 +0200)] 
CONTRIBUTING: stop mentioning "make check"

Since the switch to meson this information is no longer valid. HACKING already documents how to run the test suite.

See #6642

6 years agohwdb: Add Logitech G100s Optical Gaming Mouse (#6570) 6640/head
Charles Huber [Thu, 17 Aug 2017 19:53:25 +0000 (14:53 -0500)] 
hwdb: Add Logitech G100s Optical Gaming Mouse (#6570)

6 years ago"Don't fear the fsync()"
Alan Jenkins [Thu, 17 Aug 2017 16:09:44 +0000 (17:09 +0100)] 
"Don't fear the fsync()"

For files which are vital to boot

1. Avoid opening any window where power loss will zero them out or worse.
   I know app developers all coded to the ext3 implementation, but
   the only formal documentation we have says we're broken if we actually
   rely on it.  E.g.

   * `man mount`, search for `auto_da_alloc`.
   * http://www.linux-mtd.infradead.org/faq/ubifs.html#L_atomic_change
   * https://thunk.org/tytso/blog/2009/03/15/dont-fear-the-fsync/

2. If we tell the kernel we're interested in writing them to disk, it will
   tell us if that fails.  So at minimum, this means we play our part in
   notifying the user about errors.

I refactored error-handling in `udevadm-hwdb` a little.  It turns out I did
exactly the same as had already been done in the `systemd-hwdb` version,
i.e. commit d702dcd.

6 years agolocaled: don't remove xorg.conf.d/00-keyboard.conf on failures
Alan Jenkins [Thu, 17 Aug 2017 16:21:34 +0000 (17:21 +0100)] 
localed: don't remove xorg.conf.d/00-keyboard.conf on failures

One of the benefits of updating a file "atomically", is to avoid losing the
old version.  For example, if we run out of disk space half-way through.

Fix localed to enjoy this benefit.

6 years agounits: order service(s) before udevd, not udev-trigger (coldplug) 6617/head
Alan Jenkins [Tue, 15 Aug 2017 13:22:44 +0000 (14:22 +0100)] 
units: order service(s) before udevd, not udev-trigger (coldplug)

Since hotplugs happen as soon as udevd is started, there is not much sense
in giving udev-trigger an After= dependency on any service.  The device
could be hotplugged before coldplug starts.

This is intended to avoid the race window where we create the hwdb with
the wrong selinux context (then fix it up afterwards).
https://github.com/systemd/systemd/issues/3458#issuecomment-322444107

6 years agounits: Sockets= already implies Wants= and After= (systemd-udevd.service)
Alan Jenkins [Tue, 15 Aug 2017 13:11:23 +0000 (14:11 +0100)] 
units: Sockets= already implies Wants= and After= (systemd-udevd.service)

I grepped for other `After=` on a socket unit as well.  This was the only
instance.

6 years agonetworkd: fix spell DCHPClientIdentifier (DCHP => DHCP) 6615/head
Susant Sahani [Tue, 15 Aug 2017 04:50:25 +0000 (10:20 +0530)] 
networkd: fix spell DCHPClientIdentifier (DCHP => DHCP)

6 years agoMerge pull request #6475 from martinpitt/test-set-e
Evgeny Vereshchagin [Fri, 11 Aug 2017 04:02:02 +0000 (07:02 +0300)] 
Merge pull request #6475 from martinpitt/test-set-e

test: Run qemu/nspawn tests with "set -e"

6 years agounits: make use of the new !! ExecStart= prefix in systemd-resolved.service 6577/head
Lennart Poettering [Wed, 9 Aug 2017 14:15:07 +0000 (16:15 +0200)] 
units: make use of the new !! ExecStart= prefix in systemd-resolved.service

Let's make use of !! to run resolved with ambient capabilities on
systems supporting them.

6 years agocore: add two new special ExecStart= character prefixes
Lennart Poettering [Wed, 9 Aug 2017 14:09:04 +0000 (16:09 +0200)] 
core: add two new special ExecStart= character prefixes

This patch adds two new special character prefixes to ExecStart= and
friends, in addition to the existing "-", "@" and "+":

"!"  → much like "+", except with a much reduced effect as it only
       disables the actual setresuid()/setresgid()/setgroups() calls, but
       leaves all other security features on, including namespace
       options. This is very useful in combination with
       RuntimeDirectory= or DynamicUser= and similar option, as a user
       is still allocated and used for the runtime directory, but the
       actual UID/GID dropping is left to the daemon process itself.
       This should make RuntimeDirectory= a lot more useful for daemons
       which insist on doing their own privilege dropping.

"!!" → Similar to "!", but on systems supporting ambient caps this
       becomes a NOP. This makes it relatively straightforward to write
       unit files that make use of ambient capabilities to let systemd
       drop all privs while retaining compatibility with systems that
       lack ambient caps, where priv dropping is the left to the daemon
       codes themselves.

This is an alternative approach to #6564 and related PRs.

6 years agocapability: add new ambient_capabilities_supported() helper
Lennart Poettering [Wed, 9 Aug 2017 13:07:15 +0000 (15:07 +0200)] 
capability: add new ambient_capabilities_supported() helper

This new function reports whether ambient caps are available, and should
be quick because the result is cached.

6 years agocapability: change capability_bounding_set_drop() to be work without privileges when...
Lennart Poettering [Wed, 9 Aug 2017 13:05:36 +0000 (15:05 +0200)] 
capability: change capability_bounding_set_drop() to be work without privileges when executing a NOP

This way daemons which already dropped all caps may use the call to
drop priviliges again, which becomes a non-failing NOP.

6 years agoseccomp: add new @setuid seccomp group
Lennart Poettering [Wed, 9 Aug 2017 13:04:05 +0000 (15:04 +0200)] 
seccomp: add new @setuid seccomp group

This new group lists all UID/GID credential changing syscalls (which are
quite a number these days). This will become particularly useful in a
later commit, which uses this group to optionally permit user credential
changing to daemons in case ambient capabilities are not available.

6 years agomkdir: chmod_and_chown() returns errors as "return -errno", not in errno itself
Lennart Poettering [Wed, 9 Aug 2017 10:46:09 +0000 (12:46 +0200)] 
mkdir: chmod_and_chown() returns errors as "return -errno", not in errno itself

6 years agoexecute: needs_{selinux,apparmor,smack} → use_{selinux,apparmor,smack}
Lennart Poettering [Tue, 8 Aug 2017 17:49:04 +0000 (19:49 +0200)] 
execute: needs_{selinux,apparmor,smack} → use_{selinux,apparmor,smack}

These booleans simply store whether selinux/apparmor/smack are supposed
ot be used, and chache the various mac_xyz_use() calls before we
transition into the namespace, hence let's use the same verb for the
variables and the functions: "use"

6 years agoexecute: make use of IN_SET() where we can
Lennart Poettering [Tue, 1 Aug 2017 09:52:36 +0000 (11:52 +0200)] 
execute: make use of IN_SET() where we can

6 years agoexecute: simplify needs_sandboxing checking
Lennart Poettering [Tue, 1 Aug 2017 09:44:37 +0000 (11:44 +0200)] 
execute: simplify needs_sandboxing checking

Let's merge three if blocks that shall only run when sandboxing is applied
into one.

Note that this changes behaviour in one corner case: PrivateUsers=1 is
now honours both PermissionsStartOnly= and the "+" modifier in
ExecStart=, and not just the former, as before. This was an oversight,
so let's fix this now, at a point in time the option isn't used much
yet.

6 years agocore: rename EXEC_APPLY_PERMISSIONS → EXEC_APPLY_SANDBOXING
Lennart Poettering [Tue, 1 Aug 2017 09:30:44 +0000 (11:30 +0200)] 
core: rename EXEC_APPLY_PERMISSIONS → EXEC_APPLY_SANDBOXING

"Permissions" was a bit of a misnomer, as it suggests that UNIX file
permission bits are adjusted, which aren't really changed here. Instead,
this is about UNIX credentials such as users or groups, as well as
namespacing, hence let's use a more generic term here, without any
misleading reference to UNIX file permissions: "sandboxing", which shall
refer to all kinds of sandboxing technologies, including UID/GID
dropping, selinux relabelling, namespacing, seccomp, and so on.

6 years agocore: introduce unit_set_exec_params()
Lennart Poettering [Tue, 1 Aug 2017 09:02:30 +0000 (11:02 +0200)] 
core: introduce unit_set_exec_params()

The new unit_set_exec_params() call is to units what
manager_set_exec_params() is to the manager object: it initializes the
various fields from the relevant generic properties set.

6 years agocore: manager_set_exec_params() cannot fail, hence make it void
Lennart Poettering [Tue, 1 Aug 2017 08:53:46 +0000 (10:53 +0200)] 
core: manager_set_exec_params() cannot fail, hence make it void

Let's simplify things a bit.

6 years agoexecute: also fold the cgroup delegate bit into ExecFlags
Lennart Poettering [Tue, 1 Aug 2017 08:51:18 +0000 (10:51 +0200)] 
execute: also fold the cgroup delegate bit into ExecFlags

6 years agoexecute: also control the SYSTEMD_NSS_BYPASS_BUS through an ExecFlags field
Lennart Poettering [Tue, 1 Aug 2017 08:43:04 +0000 (10:43 +0200)] 
execute: also control the SYSTEMD_NSS_BYPASS_BUS through an ExecFlags field

Also, correct the logic while we are at it: the variable is only
required for system services, not user services.

6 years agoservice: let's set EXEC_NEW_KEYRING through SET_FLAG()
Lennart Poettering [Tue, 1 Aug 2017 08:37:17 +0000 (10:37 +0200)] 
service: let's set EXEC_NEW_KEYRING through SET_FLAG()

Not that it really matters, but it matches how we set the flags in
manager_set_exec_params() too.

6 years agocore: don't chown() the configuration directory
Lennart Poettering [Tue, 1 Aug 2017 08:36:33 +0000 (10:36 +0200)] 
core: don't chown() the configuration directory

The configuration directory is commonly not owned by a service, but
remains root-owned, hence don't change the owner automatically for it.

6 years agoexecute: add one more ExecFlags flag, for controlling unconditional directory chowning
Lennart Poettering [Tue, 1 Aug 2017 08:35:10 +0000 (10:35 +0200)] 
execute: add one more ExecFlags flag, for controlling unconditional directory chowning

Let's decouple the Manager object from the execution logic a bit more
here too, and simply pass along the fact whether we should
unconditionally chown the runtime/... directories via the ExecFlags
field too.

6 years agoexecute: let's decouple execute.c a bit from the unit logic
Lennart Poettering [Tue, 1 Aug 2017 08:28:20 +0000 (10:28 +0200)] 
execute: let's decouple execute.c a bit from the unit logic

Let's try to decouple the execution engine a bit from the Unit/Manager
concept, and hence pass one more flag as part of the ExecParameters flags
field.

6 years agoexecute: replace command flag bools by a flags field
Lennart Poettering [Tue, 1 Aug 2017 08:16:42 +0000 (10:16 +0200)] 
execute: replace command flag bools by a flags field

This way, we can extend it later on in an easier way, and can pass it
along nicely.

6 years agoAdd hwdb fix for Lenovo Flex 3 15 inch touchpad resolution (#6558)
Justin Michaud [Thu, 10 Aug 2017 10:24:34 +0000 (06:24 -0400)] 
Add hwdb fix for Lenovo Flex 3 15 inch touchpad resolution (#6558)

add hwdb fix for Lenovo Flex 3 1580

6 years agoMerge pull request #6579 from sourcejedi/getty
Lennart Poettering [Thu, 10 Aug 2017 10:05:21 +0000 (12:05 +0200)] 
Merge pull request #6579 from sourcejedi/getty

getty nitpicks

6 years agotest: Run qemu/nspawn tests with "set -e" 6475/head
Martin Pitt [Mon, 7 Aug 2017 19:09:21 +0000 (21:09 +0200)] 
test: Run qemu/nspawn tests with "set -e"

This catches errors like "ninja not found", missing programs etc. early,
instead of silently ignoring them and trying to boot a broken VM.

In install_config_files(), allow some distro specific files to be absent
(such as /etc/sysconfig/init).

6 years agotest: Write state and log files into $BUILD_DIR
Martin Pitt [Mon, 7 Aug 2017 15:30:11 +0000 (17:30 +0200)] 
test: Write state and log files into $BUILD_DIR

This avoids clobbering the source tree with .testdir/test.log files and
makes the tests work in situations where the source tree is read-only.

6 years agocore: introduce a restart counter (#6495)
Lennart Poettering [Wed, 9 Aug 2017 19:12:55 +0000 (21:12 +0200)] 
core: introduce a restart counter (#6495)

This adds a per-service restart counter. Each time an automatic
restart is scheduled (due to Restart=) it is increased by one. Its
current value is exposed over the bus as NRestarts=. It is also logged
(in a structured, recognizable way) on each restart.

Note that this really only counts automatic starts triggered by Restart=
(which it nicely complements). Manual restarts will reset the counter,
as will explicit calls to "systemctl reset-failed". It's supposed to be
a tool for measure the automatic restart feature, and nothing else.

Fixes: #4126
6 years agoMerge pull request #6467 from yuwata/journal-remote-units
Lennart Poettering [Wed, 9 Aug 2017 19:09:13 +0000 (21:09 +0200)] 
Merge pull request #6467 from yuwata/journal-remote-units

units: use {State,Logs}Directory= if they are applicable

6 years agounits: console-getty.service: use the default RestartSec 6579/head
Alan Jenkins [Wed, 9 Aug 2017 17:56:26 +0000 (18:56 +0100)] 
units: console-getty.service: use the default RestartSec

> Note that console-getty.service as more uses than just containers. The
> idea is that it may be used as alternative to the whole VC/logind stuff,
> if all you need is a console on /dev/console, even on physical devices.

This means we want to remove RestartSec=0, for serial systems.
See 4bf0432 "units/serial-getty@.service: use the default RestartSec".

6 years agounits: add Conflicts=rescue.service to container-getty@.service
Alan Jenkins [Mon, 7 Aug 2017 18:24:32 +0000 (19:24 +0100)] 
units: add Conflicts=rescue.service to container-getty@.service

The traditional runlevel 1 is "single user mode", and shuts down all but
the main console.  In systemd, rescue.target provides runlevel1.target.
But it did not shut down logins on secondary consoles... if systemd was
running in a container.

I don't think we strictly need to change this.  But when you look at both
container-getty@.service and getty@.service, you see that both have
IgnoreOnIsolate, but only the latter has Conflicts=rescue.service.

This also makes rescue.target in a container consistent with
emergency.target.  In the latter case, the gettys were already stopped,
because they have a Requires dependency on sysinit.target.

6 years agounits/console-getty.service: comment reason for ConditionPathExists
Alan Jenkins [Wed, 9 Aug 2017 13:43:41 +0000 (14:43 +0100)] 
units/console-getty.service: comment reason for ConditionPathExists

Currently we have 4 getty services.  1 has a BindsTo dependency on a
device unit.  3 have ConditionPathExists, but the reason is different in
every single one.

* Add comment to console-getty@.service (see commit 1b41981d)
* getty@.service is already commented
* container-getty.service is not strictly correct, as I realized while
  trying to compose a comment.  Reported as #6584.

6 years agopam_logind: skip leading /dev/ from PAM_TTY field before passing it on 6582/head
Lennart Poettering [Wed, 9 Aug 2017 17:04:36 +0000 (19:04 +0200)] 
pam_logind: skip leading /dev/ from PAM_TTY field before passing it on

Apparently, PAM documents that the PAM_TTY should come with a /dev
prefix, but we don't expect it so far, except that Wayland ends up
setting it after all, the way the docs suggest. Hence, let's simply drop
the /dev prefix if it is there.

Fixes: #6516
6 years agotree-wide: use path_startswith() rather than startswith() where ever that's appropriate
Lennart Poettering [Wed, 9 Aug 2017 17:03:39 +0000 (19:03 +0200)] 
tree-wide: use path_startswith() rather than startswith() where ever that's appropriate

When checking path prefixes we really should use the right APIs, just in
case people add multiple slashes to their paths...

6 years agoutil-lib: add a new skip_dev_prefix() helper
Lennart Poettering [Wed, 9 Aug 2017 17:01:18 +0000 (19:01 +0200)] 
util-lib: add a new skip_dev_prefix() helper

This new helper removes a leading /dev if there is one. We have code
doing this all over the place, let's unify this, and correct it while
we are at it, by using path_startswith() rather than startswith() to
drop the prefix.