Commit graph

30743 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 53e1b68390 Add SPDX license identifiers to source files under the LGPL
This follows what the kernel is doing, c.f.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
2017-11-19 19:08:15 +01:00
Lennart Poettering 5c856d1e6c
Merge pull request #7388 from keszybz/doc-tweak
Add link to kernel docs about no_new_privs and drop note about CPU controller
2017-11-19 17:50:35 +01:00
Lennart Poettering d3590acede machined: support "machinectl bind" on non-directories (#7349)
Fixes: #7195
2017-11-19 14:23:29 +01:00
Zbigniew Jędrzejewski-Szmek c12ad58c41 man: remove note about CPU controller being unmerged
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0d5936344f30aba0f6ddb92b030cb6a05168efe6

In principle we shouldn't merge this until after 4.15 is released, but the
chances of a revert upstream are low, and in that unlikely scenario we can just
revert this patch, it's a trivial documentation update after all.
2017-11-19 14:15:42 +01:00
Zbigniew Jędrzejewski-Szmek 34b3f471f8
Merge pull request #7365 from poettering/nspawn-bind-userns
nspawn: document --bind= and --private-users relationship, and make recursive chown()ing safe
2017-11-19 14:01:39 +01:00
Zbigniew Jędrzejewski-Szmek 906bbac474 test: do not hardcode location of EFI partition 2017-11-19 12:36:20 +01:00
Zbigniew Jędrzejewski-Szmek 30b5047762 bootctl: add a convenient way to print the path to EFI 2017-11-19 12:36:20 +01:00
Zbigniew Jędrzejewski-Szmek 46fb255b0d bootctl: rename r2 and r to r and k
r2 was assigned first despite the name. This scheme is different than
what is used elsewhere in the code. Rename to make it easier to read.
2017-11-19 12:35:50 +01:00
Zbigniew Jędrzejewski-Szmek 4bb2e9d466 systemctl: make sure the kernel is loaded before kexec'ing
We just load the same kernel that would be loaded by default by sd-boot, with
the same options. Changing the kernel or initramfs or options is left for
later.

Now we will refuse to continue if loading fails. This makes 'systemctl kexec'
more predictable: it will not fall back to normal reboot if the kernel is
not loaded.
2017-11-19 12:33:35 +01:00
Zbigniew Jędrzejewski-Szmek a6fabe384d man: add link to kernel docs about no_new_privs 2017-11-19 11:58:45 +01:00
Yu Watanabe 7b872092d9 networkd: fix indentation 2017-11-18 01:24:41 +09:00
Yu Watanabe 4a3b54fd3c networkd: remove debug message and unref when error
Follow-up for 8006aa32ee.
2017-11-18 01:22:38 +09:00
Lennart Poettering f56e7bfe2b core: be more defensive if we can't determine per-connection socket peer (#7329)
Let's handle gracefully if a client disconnects very early on.

This builds on #4120, but relaxes the condition checks further, since we
getpeername() might already fail during ExecStartPre= and friends.

Fixes: #7172
2017-11-17 15:22:11 +01:00
John Lin c37b4f3f9f man: rescue.target could be seen as single-user.target (#7323) 2017-11-17 15:20:48 +01:00
Lennart Poettering b94f4313e8 man: document that start limiting of GC'ed units doesn't work (#7337)
Fixes: #7139
2017-11-17 15:18:30 +01:00
Zbigniew Jędrzejewski-Szmek a53dbb34ff
Merge pull request #7360 from poettering/preset-fix
Some fixes for preset-all logic at boot, plus main.c reworking
2017-11-17 15:00:22 +01:00
Zbigniew Jędrzejewski-Szmek f04c052025
Merge pull request #7338 from poettering/doc-restart-fix
improve unit restart documentation a bit
2017-11-17 14:51:51 +01:00
Zbigniew Jędrzejewski-Szmek 0c6e2702b6 meson: use absolute path for rpmmacrosdir
This only matter for the status display at the end of configure step.
Now it looks like:
         RPM macros dir:                    /usr/lib/rpm/macros.d
2017-11-17 13:22:13 +01:00
Zbigniew Jędrzejewski-Szmek ee4bfa21f6 meson: drop rootprefix option
rootprefixdir is now always set to /usr or /, based on the split-usr setting.
Anything else does not work anyway.

C.f. #7375.
2017-11-17 13:08:00 +01:00
Lennart Poettering 2642122898 install: when we encounter a transient/generated unit while presetting all, skip over it silently
Fixes: #7100
2017-11-17 11:28:17 +01:00
Lennart Poettering a68aef7a95 main: uid_to_name() might theoretically fail, handle that 2017-11-17 11:28:17 +01:00
Lennart Poettering 1e41242e11 core: shorten main() a bit, split out coredump initialization
No functional changes.
2017-11-17 11:28:17 +01:00
Lennart Poettering e839bafdf4 main: let's make main() shorter, let's split out clock initialization
no functional changes
2017-11-17 11:28:17 +01:00
Lennart Poettering 4a36297c41 main: let's make main() shorter, let's split out invocation of shutdown binary
No functional changes
2017-11-17 11:28:17 +01:00
Lennart Poettering 6808a0bc80 core: let's shorten main() a bit, let's split out telinit redirection into a separate function 2017-11-17 11:28:17 +01:00
Lennart Poettering 7b46fc6adc main: add set_manager_settings(), similar in style to set_manager_defaults() 2017-11-17 11:28:17 +01:00
Lennart Poettering fd1306121d core: never apply first boot presets in the initrd
Presets are useful to initialize uninitialized /etc, but that doesn't
apply to the initrd.

Also, let's rename etc_empty → first_boot. After all, the variable
doesn't actually reflect whether /etc is really empty, it just reflects
whether /etc/machine-id existed originally or not. Moreover, we later on
directly initialize manager_set_first_boot() from it, hence let's just
name it the same way all through the codepath, to make this all less
confusing.

See: #7100
2017-11-17 11:28:17 +01:00
Lennart Poettering 85cb415124 main: rename manager_set_defaults() → set_manager_defaults()
This function is really not a method of the Manager object (implemented
in manager.c), but just a helper in main.c. Hence let's not confusingly
name it the way methods are called.
2017-11-17 11:28:17 +01:00
Lennart Poettering 3d80d4541b update TODO 2017-11-17 11:25:02 +01:00
Lennart Poettering 8adf53582c man: document that ExecStop= is executed during restarts
Fixes: #7126
2017-11-17 11:25:02 +01:00
Lennart Poettering 78a263f432 man: add missing suffixing "=" for setting name 2017-11-17 11:25:02 +01:00
Lennart Poettering ff946d8243 man: write "stop and start" instead of "restart" when explaining the reload fallback operations
We already made a similar change when talking about the "restart"
command, let's also do this for "systemctl reload" and friends.

Follow-up for: 6539dd7c42

See: #7126
2017-11-17 11:25:02 +01:00
Lennart Poettering c4f2aaa45b man: document the interaction of "systemctl restart" and the FD store
See: #7126
2017-11-17 11:25:02 +01:00
Lennart Poettering 370f9c21b9 update TODO 2017-11-17 11:13:44 +01:00
Lennart Poettering fc8d038130 man: document all the new options we acquired 2017-11-17 11:13:44 +01:00
Lennart Poettering 99be45a46f fs-util: rename path_is_safe() → path_is_normalized()
Already, path_is_safe() refused paths container the "." dir. Doing that
isn't strictly necessary to be "safe" by most definitions of the word.
But it is necessary in order to consider a path "normalized". Hence,
"path_is_safe()" is slightly misleading a name, but
"path_is_normalize()" is more descriptive, hence let's rename things
accordingly.

No functional changes.
2017-11-17 11:13:44 +01:00
Lennart Poettering 5db9818772 core: don't allow DefaultStandardOutput= be set to socket/fd:/file:
These three settings only make sense within the context of actual unit
files, hence filter this out when applied to the per-manager default,
and generate a log message about it.
2017-11-17 11:13:44 +01:00
Lennart Poettering 666d787787 test: add basic test for StandardInput=file: 2017-11-17 11:13:44 +01:00
Lennart Poettering befc4a800e core: add exec_context_dump() support for fd: and file: stdio settings
This was missing for using fdnames as stdio, let's add support for
fdnames as well as file paths in one go.
2017-11-17 11:13:44 +01:00
Lennart Poettering 2038c3f584 core: add support for StandardInputFile= and friends
These new settings permit specifiying arbitrary paths as
stdin/stdout/stderr locations. We try to open/create them as necessary.
Some special magic is applied:

1) if the same path is specified for both input and output/stderr, we'll
   open it only once O_RDWR, and duplicate them fd instead.

2) If we an AF_UNIX socket path is specified, we'll connect() to it,
   rather than open() it. This allows invoking systemd services with
   stdin/stdout/stderr connected to arbitrary foreign service sockets.

Fixes: #3991
2017-11-17 11:13:44 +01:00
Lennart Poettering 0664775c84 core: fix handling of transient StandardOutputFileDescriptorName= and friends
Let's make sure to process the fdname first, before changing the actual
input/output setting, since the fdname part can fail due to OOM.

This way we don't leave half-initialized bits around.
2017-11-17 11:13:44 +01:00
Lennart Poettering e75a9ed176 execute: some extra asserts
In some cases we checked for fd validity already explicitly, let's do
this for all our fds.
2017-11-17 11:13:44 +01:00
Lennart Poettering 5073ff6bec core: fold property_get_input_fdname() and property_get_output_fdname() into one
property_get_output_fdname() already had two different control flows for
stdout and stderr, it might as well handle stdin too, thus shortening
our code a bit.
2017-11-17 11:13:44 +01:00
Lennart Poettering 3a274a218d execute: fix type of open_terminal_as() flags parameter
It's the flags parameter we propagate here, not the mode parameter,
hence let's name it properly, and use the right type.
2017-11-17 11:13:44 +01:00
Lennart Poettering 9f617cd09f bus-unit-util: drop #ifdef HAVE_SECCOMP from bus client side
Whether seccomp is supported or not is a server implementation detail,
the client should not be altered by that, and clients should be able to talk
to servers configured differently than the client, hence drop the
HAVE_SECCOMP ifdeffery here.

(This would be different if we'd need libseccomp or so to implement the
client, but we don't)
2017-11-17 11:13:44 +01:00
Lennart Poettering da543f6a77 test: add tests for StandardInputText= and StandardInputData= 2017-11-17 11:13:44 +01:00
Lennart Poettering 08f3be7a38 core: add two new unit file settings: StandardInputData= + StandardInputText=
Both permit configuring data to pass through STDIN to an invoked
process. StandardInputText= accepts a line of text (possibly with
embedded C-style escapes as well as unit specifiers), which is appended
to the buffer to pass as stdin, followed by a single newline.
StandardInputData= is similar, but accepts arbitrary base64 encoded
data, and will not resolve specifiers or C-style escapes, nor append
newlines.

This may be used to pass input/configuration data to services, directly
in-line from unit files, either in a cooked or in a more raw format.
2017-11-17 11:13:44 +01:00
Lennart Poettering 11f5d82507 proc-cmdline: minor runlevel_to_target() coding style fixes
Let's not mix function calls and variable declarations, as well as
assignments and comparison in one expression.
2017-11-17 11:13:44 +01:00
Lennart Poettering a3ab8f2a99 hexdcoct: dump to stdout if FILE* is specified as NULL
We do a logic like that at various other places, let's do it here too,
to make this as little surprising as possible.
2017-11-17 11:13:44 +01:00
Lennart Poettering ae6e414a61 hexdecoct: slightly extend the unbase64mem() API and related
If the string length is specified as (size_t) -1, let's use that as
indicator for determining the length on our own. This makes it
slightlier shorter to invoke these APIs for a very common case.

Also, do some minor other coding style updates, and add assert()s here
and there.
2017-11-17 11:13:44 +01:00