Lennart Poettering [Thu, 7 Dec 2017 10:27:07 +0000 (11:27 +0100)]
core: make "taint" string logic a bit more generic and output it at boot
The tainting logic existed for a long time, but was hidden inside the
bus interfaces. Let's give it a small bit more coverage, by logging its
value early at boot during initialization.
Zbigniew Jędrzejewski-Szmek [Thu, 7 Dec 2017 10:07:02 +0000 (11:07 +0100)]
Merge pull request #7567 from yuwata/fix-nobody
nobody related fixes
Yu Watanabe [Thu, 7 Dec 2017 08:19:11 +0000 (17:19 +0900)]
meson: warn if nobody-user and nobody-group are set to different name
It may work, but is very strange. So, let's warn about that.
v2:
Debian uses nobody and nogroup. Do not warn such case.
Yu Watanabe [Thu, 7 Dec 2017 06:49:16 +0000 (15:49 +0900)]
sysusers: use NOBODY_USER_NAME
Yu Watanabe [Thu, 7 Dec 2017 06:48:44 +0000 (15:48 +0900)]
test: use NOBODY_USER_NAME instead of hard-coded string "noody"
Lennart Poettering [Thu, 7 Dec 2017 08:07:40 +0000 (09:07 +0100)]
Merge pull request #7554 from keszybz/autodetect-build
Autodetect build directory ignoring mkosi artefacts
Zbigniew Jędrzejewski-Szmek [Thu, 7 Dec 2017 07:51:04 +0000 (08:51 +0100)]
Merge pull request #7560 from poettering/refactor-main
reduce main() size a bit
Zbigniew Jędrzejewski-Szmek [Thu, 7 Dec 2017 07:49:11 +0000 (08:49 +0100)]
Merge pull request #7566 from yuwata/fix-bootspec-default-entry
bootspec: fix debug message about default entry
Lennart Poettering [Thu, 7 Dec 2017 07:48:08 +0000 (08:48 +0100)]
units: delegate only "cpu" and "pids" controllers by default (#7564)
Now that we can configure which controllers to delegate precisely, let's
limit wht we delegate to the user session: only "cpu" and "pids" as a
minimal baseline.
Fixes: #1715
Yu Watanabe [Thu, 7 Dec 2017 05:23:11 +0000 (14:23 +0900)]
bootspec: make boot_entries_select_default() static
The function is used only in bootspec.c.
So, let's make the function static.
Yu Watanabe [Thu, 7 Dec 2017 05:21:13 +0000 (14:21 +0900)]
bootspec: fix debug message about default entry
When no entries matches with entry_oneshot, entry_default and
default_pattern, then log message shows a wrong entry.
Moreover, if none of entry_oneshot, entry_default and default_pattern
are set, then the index `i` is uninitialized.
This fixes such problem.
Christian Hesse [Wed, 6 Dec 2017 22:49:01 +0000 (23:49 +0100)]
NEWS: add missing whitespace (#7561)
Zbigniew Jędrzejewski-Szmek [Wed, 6 Dec 2017 22:30:51 +0000 (23:30 +0100)]
Merge pull request #7551 from poettering/resolved-unknown-scope
downgrade resolved log messages about incoming packets from unknown scopes
Zbigniew Jędrzejewski-Szmek [Wed, 6 Dec 2017 21:56:02 +0000 (22:56 +0100)]
Merge pull request #7559 from evverx/incorrect-spec-memleak
shared: fix a memory leak
Lennart Poettering [Wed, 6 Dec 2017 20:50:18 +0000 (21:50 +0100)]
core: split out execution context logging from main()
Again, no functional changes, let's just shorten main() a bit, by
splitting out more code into a separate functions.
Lennart Poettering [Wed, 6 Dec 2017 20:42:36 +0000 (21:42 +0100)]
core: move write_container_id() invocation into initialize_runtime()
This moves the invocation a bit later, but that shoudln't matter. By
moving it we gain two things: first of all, its closer to other code
where it belongs, secondly its naturally conditioned properly, as we no
longer will rewrite the container ID file on every reexecution again,
and not in test mode either.
Lennart Poettering [Wed, 6 Dec 2017 20:31:35 +0000 (21:31 +0100)]
core: split out various system/process initialization steps into its own function
Again, no changes in behaviour, just some refactoring to make main() a
bit more digestable.
Lennart Poettering [Wed, 6 Dec 2017 20:17:58 +0000 (21:17 +0100)]
core: split out code that frees arg_xyz variables
No change in behaviour, just some refactoring to shorten main() a bit.
Lennart Poettering [Wed, 6 Dec 2017 20:13:10 +0000 (21:13 +0100)]
core: split out code that queues default job from main()
No functional changes really, just some refactoring to shorten main() a
bit
Lennart Poettering [Wed, 6 Dec 2017 19:47:28 +0000 (20:47 +0100)]
core: split out the core loop out of main()
No real functional changes, just some rearranging to shorten the overly
long main() function a bit.
This gets rid of the arm_reboot_watchdog variable, as it can be directly
derived from shutdown_verb, and we need it only one time. By dropping it
we can reduce the number of arguments we need to pass around.
Lennart Poettering [Wed, 6 Dec 2017 19:16:35 +0000 (20:16 +0100)]
core: split out reexecution code of main() into its own function
No functional changes, just an attempt to shorten main() a bit.
Lennart Poettering [Wed, 6 Dec 2017 19:16:30 +0000 (20:16 +0100)]
virt: remove triple spurious newline
Evgeny Vereshchagin [Wed, 6 Dec 2017 19:12:05 +0000 (19:12 +0000)]
shared: fix a memory leak
```
$ ./src/test/test-systemd-tmpfiles.py valgrind --leak-check=full --error-exitcode=1 ./build/systemd-tmpfiles
...
Running valgrind --leak-check=full --error-exitcode=1 ./build/systemd-tmpfiles on 'w /unresolved/argument - - - - "%Y"'
...
[<stdin>:1] Failed to substitute specifiers in argument: Invalid slot
...
==22602== 5 bytes in 1 blocks are definitely lost in loss record 1 of 2
==22602== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==22602== by 0x4ECA7D4: malloc_multiply (alloc-util.h:74)
==22602== by 0x4ECA909: specifier_printf (specifier.c:59)
==22602== by 0x113490: specifier_expansion_from_arg (tmpfiles.c:1923)
==22602== by 0x1144E7: parse_line (tmpfiles.c:2159)
==22602== by 0x11551C: read_config_file (tmpfiles.c:2425)
==22602== by 0x115AB0: main (tmpfiles.c:2529)
```
Evgeny Vereshchagin [Wed, 6 Dec 2017 19:04:45 +0000 (19:04 +0000)]
tests: allow passing more than one argument to test-systemd-tmpfiles.py
This makes it easier to run `systemd-tmpfiles` under valgrind.
Olaf Hering [Wed, 6 Dec 2017 18:59:30 +0000 (19:59 +0100)]
virt: use /proc/xen as indicator for a Xen domain (#6442, #6662) (#7555)
The file /proc/xen/capabilities is only available if xenfs is mounted.
With a classic xenlinux based kernel that file is available
unconditionally. But with a modern pvops based kernel, xenfs must be
mounted before the "capabilities" may appear. xenfs is mounted very late
via .services files provided by the Xen toolstack. Other units may be
scheduled before xenfs is mounted, which will confuse the detection of
VIRTUALIZATION_XEN.
In all Xen enabled kernels, and if that kernel is actually running on
the Xen hypervisor, the "/proc/xen" directory is the reliable indicator
that this instance runs in a "Xen guest".
Adjust the code to check for /proc/xen instead of
/proc/xen/capabilities.
Fixes commit
3f61278b5 ("basic: Bugfix Detect XEN Dom0 as no virtualization")
Lennart Poettering [Wed, 6 Dec 2017 18:50:26 +0000 (19:50 +0100)]
Merge pull request #7419 from keszybz/tmpfiles-fixes
Tmpfiles --user mode and various fixes
Max Resch [Wed, 6 Dec 2017 14:29:52 +0000 (15:29 +0100)]
Set secure_boot flag in Kernel Zero-Page (#7482)
Setting the secure_boot flag, avoids getting the printout
"EFI stub: UEFI Secure Boot is enabled." when booting
a Linux kernel with linuxx64.efi.stub and EFI SecureBoot enabled.
This is mainly a cosmetic fixup, as the "quiet" kernel parameter does
not silence pr_efi printouts in the linux kernel (this only works using
the efi stub from the linux source tree)
Zbigniew Jędrzejewski-Szmek [Wed, 6 Dec 2017 14:28:31 +0000 (15:28 +0100)]
Merge pull request #7530 from poettering/uid-gid-fixes
various uid/gid fixes
Zbigniew Jędrzejewski-Szmek [Wed, 6 Dec 2017 14:13:02 +0000 (15:13 +0100)]
run-integration-test: allow argument to be overriden
This is useful for "sudo test/run-integration-tests.sh clean".
Zbigniew Jędrzejewski-Szmek [Wed, 6 Dec 2017 14:09:54 +0000 (15:09 +0100)]
tests: try to autodetect directory better
Ignore mkosi.builddir. In the future we can also add other patterns
if necessary.
run-intergration-tests.sh is updated to use the new script, and modified
to work from arbitrary directory.
Follow-up for #7494.
Lennart Poettering [Wed, 6 Dec 2017 12:53:39 +0000 (13:53 +0100)]
mkosi.build: add code to determine the right nobody user/group name
hanklank [Wed, 6 Dec 2017 12:52:25 +0000 (13:52 +0100)]
Added some missing Swedish Strings (#7552)
Lennart Poettering [Sat, 2 Dec 2017 12:11:25 +0000 (13:11 +0100)]
update TODO
Lennart Poettering [Tue, 5 Dec 2017 10:00:24 +0000 (11:00 +0100)]
meson: print warnings if the "nobody" user/group name is not compatible with the local system
At least on Fedora and Debian systems this not obvious to get right,
hence warn.
Lennart Poettering [Tue, 5 Dec 2017 09:59:44 +0000 (10:59 +0100)]
test-execute: use the "nogroup" group if it exists for testing
We currently look for "nobody" and "nfsnobody" when testing groups, both
of which do not exist on Ubuntu, our main testing environment. Let's
extend the tests slightly to also use "nogroup" if it exists.
Lennart Poettering [Mon, 4 Dec 2017 16:09:27 +0000 (17:09 +0100)]
journal,coredump: do not do ACL magic for "nobody" user either
The "nobody" user might possibly be seen by the journal or coredumping
code if unmapped userns-using processes are somehow visible to them.
Let's make sure we don't do the ACL magic for this user either, since
this is a special system user that might be backed by different real
users in different contexts.
Lennart Poettering [Mon, 4 Dec 2017 16:07:48 +0000 (17:07 +0100)]
user-util: synthesize user records for "nobody" the same way as for "root"
We already synthesize records for both "root" and "nobody" in
nss-systemd. Let's do the same in our own NSS wrappers that are supposed
to bypass NSS if possible. Previously this was done for "root" only, but
let's clean this up, and do the same for "nobody" too, so that we
synthesize records the same way everywhere, regardless whether in NSS or
internally.
Lennart Poettering [Mon, 4 Dec 2017 16:06:56 +0000 (17:06 +0100)]
user-util: add UID_NOBODY defines that resolve to (uid_t) 65534
We use it all over the place, let's add a #define for it. Makes things
easier greppable, and more explanatory I think.
Lennart Poettering [Sat, 2 Dec 2017 12:07:18 +0000 (13:07 +0100)]
nss-systemd: tweak checks when we consult PID 1 for dynamic UID/GID lookups
Instead of contacting PID 1 for dynamic UID/GID lookups for all
UIDs/GIDs that do not qualify as "system" do the more precise check
instead: check if they actually qualify for the "dynamic" range.
Lennart Poettering [Sat, 2 Dec 2017 12:02:44 +0000 (13:02 +0100)]
coredump,journal: do not do ACL magic for processes of dynamic UIDs
Dynamic UIDs should be treated like system users in this regard.
Lennart Poettering [Sat, 2 Dec 2017 11:59:21 +0000 (12:59 +0100)]
user-util: add new uid_is_system() helper
This adds uid_is_system() and gid_is_system(), similar in style to
uid_is_dynamic(). That a helper like this is useful is illustrated by
the fact that test-condition.c didn't get the check right so far, which
this patch fixes.
Lennart Poettering [Sat, 2 Dec 2017 11:49:22 +0000 (12:49 +0100)]
doc: add a document briefly explaining UID/GID range assumptions we make
Lennart Poettering [Sat, 2 Dec 2017 11:48:31 +0000 (12:48 +0100)]
build-sys: make the dynamic UID range, and the container UID range configurable
Also, export these ranges in our pkg-config files.
Lennart Poettering [Wed, 6 Dec 2017 11:45:39 +0000 (12:45 +0100)]
resolved: ignore our own LLMNR packets, the same way we ignore mDNS packets already
Let's minimize our traffic a bit. And for local names we bypass the
packet generation anyway.
Lennart Poettering [Wed, 6 Dec 2017 11:44:05 +0000 (12:44 +0100)]
resolved: downgrade log messages about incoming LLMNR/mDNS packets on unexpected scopes
This might very well happen due to races between joining multicast
groups and network configuration and such, let's not complain, but just
drop the messages at debug level.
Fixes: #7527
Zbigniew Jędrzejewski-Szmek [Mon, 4 Dec 2017 08:05:05 +0000 (09:05 +0100)]
test-systemd-tmpfiles: respect $HOME in test for %h expansion
%h is a special specifier because we look at $HOME (unless running suid, but
let's say that this case does not apply to tmpfiles, since the code is
completely unready to be run suid). For all other specifiers we query the user
db and use those values directly. I'm not sure if this exception is good, but
let's just "document" status quo for now. If this is changes, it should be in
a separate PR.
Zbigniew Jędrzejewski-Szmek [Sat, 2 Dec 2017 14:40:30 +0000 (15:40 +0100)]
test-systemd-tmpfiles: ignore result of %m test
It's failing on artful s390x and i386:
Running /tmp/autopkgtest.Pexzdu/build.lfO/debian/build-deb/systemd-tmpfiles on 'f /tmp/test-systemd-tmpfiles.c236s1uq/arg - - - - %m'
expect: '
01234567890123456789012345678901'
actual: '
e84bc78d162e472a8ac9759f5f1e4e0e'
--- stderr ---
Traceback (most recent call last):
File "/tmp/autopkgtest.Pexzdu/build.lfO/debian/src/test/test-systemd-tmpfiles.py", line 129, in <module>
test_valid_specifiers(user=False)
File "/tmp/autopkgtest.Pexzdu/build.lfO/debian/src/test/test-systemd-tmpfiles.py", line 89, in test_valid_specifiers
test_content('f {} - - - - %m', '{}'.format(id128.get_machine().hex), user=user)
File "/tmp/autopkgtest.Pexzdu/build.lfO/debian/src/test/test-systemd-tmpfiles.py", line 84, in test_content
assert content == expected
AssertionError
-------
Let's skip the test for now until this is resolved properly on the autopkgtest
side.
Zbigniew Jędrzejewski-Szmek [Sat, 2 Dec 2017 13:00:58 +0000 (14:00 +0100)]
test-systemd-tmpfiles: skip on python3.4
python3.4 is used by our CI.
Let's revert this when we stop supporting python < 3.5.
Zbigniew Jędrzejewski-Szmek [Fri, 1 Dec 2017 20:15:51 +0000 (21:15 +0100)]
test-systemd-tmpfiles: add tests for specifiers
Zbigniew Jędrzejewski-Szmek [Fri, 1 Dec 2017 17:53:24 +0000 (18:53 +0100)]
Fix typo
Zbigniew Jędrzejewski-Szmek [Fri, 1 Dec 2017 17:53:10 +0000 (18:53 +0100)]
man: improve formatting in systemd.unit.xml
Zbigniew Jędrzejewski-Szmek [Thu, 23 Nov 2017 12:56:32 +0000 (13:56 +0100)]
tmpfiles: also add %t/%S/%C/%L specifiers
sd_path_home() returns ENXIO when a variable (such as $XDG_RUNTIME_DIR) is not
defined. Previously we used ENOKEY for unresolvable specifiers. To avoid having
two codes, or translating ENXIO to ENOKEY, I replaced ENOKEY use with ENXIO.
v2:
- use sd_path_home and change to ENXIO everywhere
Zbigniew Jędrzejewski-Szmek [Thu, 23 Nov 2017 09:54:29 +0000 (10:54 +0100)]
Hook up systemd-tmpfiles as user units
An explicit --user switch is necessary because for the user@0.service instance
systemd-tmpfiles is running as root, and we need to distinguish that from
systemd-tmpfiles running in systemd-tmpfiles*.service.
Fixes #2208.
v2:
- restore "systemd-" prefix
- add systemd-tmpfiles-clean.{service,timer}, systemd-setup.service to
systemd-tmpfiles(8)
Zbigniew Jędrzejewski-Szmek [Thu, 23 Nov 2017 10:20:29 +0000 (11:20 +0100)]
tmpfiles: add --user switch
ayekat [Fri, 24 Nov 2017 11:44:08 +0000 (12:44 +0100)]
tmpfiles: Add specifiers to allow running as user instance
This commit adds specifiers %U, %u and %h for the user UID, name and
home directory, respectively.
[zj: drop untrue copy-pasted comments and move the next text
to the new "Specifiers" section.
Now that #7444 has been merged, also drop the specifier functions.]
Zbigniew Jędrzejewski-Szmek [Thu, 23 Nov 2017 12:23:42 +0000 (13:23 +0100)]
Rename "system-preset" source dir to "presets"
I want to add presets/user/ later. This mirrors the layout for units:
we have units/ and units/user. The advantage is that we avoid having yet
another directory at the top level.
Zbigniew Jędrzejewski-Szmek [Thu, 23 Nov 2017 12:02:21 +0000 (13:02 +0100)]
util-lib: kill duplicate slashes in lookup paths
Since we're munging the array anyway, we can make the output a bit
nicer too.
Zbigniew Jędrzejewski-Szmek [Thu, 23 Nov 2017 10:41:28 +0000 (11:41 +0100)]
shared: export xdg_user_dirs() and xdg_user_*_dir()
Zbigniew Jędrzejewski-Szmek [Wed, 22 Nov 2017 14:16:48 +0000 (15:16 +0100)]
tmpfiles: "e" takes globs
Fixes #7369.
Zbigniew Jędrzejewski-Szmek [Wed, 22 Nov 2017 13:55:14 +0000 (14:55 +0100)]
tmpfiles: fix typo in error message
Fixes #4097.
As of current master, systemd-tmpfiles behaves correctly, apart from a trivial
typo. So let's tell github to close the bug.
With current git:
$ sudo SYSTEMD_LOG_LEVEL=debug build/systemd-tmpfiles --create `pwd`/test/tmpfiles.d/link-loop.conf
Successfully loaded SELinux database in 2.385ms, size on heap is 321K.
Reading config file "/home/zbyszek/src/systemd-work/test/tmpfiles.d/link-loop.conf".
Running create action for entry D /run/hello2
Found existing directory "/run/hello2".
"/run/hello2" has right mode 41777
Running create action for entry f /run/hello2/hello2.test
"/run/hello2/hello2.test" has been created.
"/run/hello2/hello2.test" has right mode 101777
chown "/run/hello2/hello2.test" to 0.84
Running create action for entry L /run/hello2/hello2.link
Found existing symlink "/run/hello2/hello2.link".
Running create action for entry z /run/hello2/hello2.test
"/run/hello2/hello2.test" has right mode 101777
chown "/run/hello2/hello2.test" to 0.0
Running create action for entry z /run/hello2/hello2.link
Skipping mode an owner fix for symlink /run/hello2/hello2.link.
and the permissions are:
$ ls -dl /run/hello2/ /run/hello2/*
drwxrwxrwt. 2 foo bar 80 Nov 22 14:40 /run/hello2/
lrwxrwxrwx. 1 root root 23 Nov 22 14:40 /run/hello2/hello2.link -> /run/hello2/hello2.test
-rwxrwxrwt. 1 root root 0 Nov 22 14:40 /run/hello2/hello2.test
Everything seems correct.
Zbigniew Jędrzejewski-Szmek [Wed, 22 Nov 2017 13:19:13 +0000 (14:19 +0100)]
tmpfiles: downgrade warning about duplicate line
This happens occasionally, especially when moving lines between configuration files
in different packages, and usually is not a big deal.
Zbigniew Jędrzejewski-Szmek [Fri, 24 Nov 2017 11:19:40 +0000 (12:19 +0100)]
Fail on unknown (alphanumerical) specifiers
The code intentionally ignored unknown specifiers, treating them as text. This
needs to change because otherwise we can never add a new specifier in a backwards
compatible way. So just treat an unknown (potential) specifier as an error.
In principle this is a break of backwards compatibility, but the previous
behaviour was pretty much useless, since the expanded value could change every
time we add new specifiers, which we do all the time.
As a compromise for backwards compatibility, only fail on alphanumerical
characters. This should cover the most cases where an unescaped percent
character is used, like size=5% and such, which behave the same as before with
this patch. OTOH, this means that we will not be able to use non-alphanumerical
specifiers without breaking backwards compatibility again. I think that's an
acceptable compromise.
v2:
- add NEWS entry
v3:
- only fail on alphanumerical
Yu Watanabe [Wed, 6 Dec 2017 04:32:06 +0000 (13:32 +0900)]
Merge pull request #7497 from yuwata/fix-cpu-set
fixes related to cpu_set
Yu Watanabe [Wed, 6 Dec 2017 04:28:23 +0000 (13:28 +0900)]
Merge pull request #7547 from hvenev/sysctl-no-net-default
Do not set `net.ipv4.conf.default.*`
Lennart Poettering [Wed, 6 Dec 2017 04:19:03 +0000 (05:19 +0100)]
mount-util: shorten the loop a bit (#7545)
The loop preparation and part of the loop contents are actually the
same, let's merge this.
Also, it's so much fun tweaking around in the name_to_handle_at() code,
let's do more of it with this patch!
(This also adds two NULL assignments, that aren't strictly necessary.
However, I figured its safer to place them in there, just in case the
for() condition is changed later. After all the freeing of the handle
and the invalidation of the cleanup-controller pointer to it are
otherwise really far away from each other...)
Yu Watanabe [Wed, 6 Dec 2017 04:16:27 +0000 (13:16 +0900)]
Merge pull request #7549 from poettering/ptyfwd-fixes
pty forwarder fixes
Yu Watanabe [Wed, 6 Dec 2017 01:44:20 +0000 (10:44 +0900)]
test-execute: add tests for CPUAffinity=
Yu Watanabe [Thu, 30 Nov 2017 07:29:48 +0000 (16:29 +0900)]
run: Allows the user to reset CPUAffinity= back to an empty list
Before this CPUAffinity= requires a valid cpu set, and the setting
cannot be reset. Moreover, if CPUAffinity= with empty string is passed,
then message container is closed without no values appended, thus
we get error.
This makes CPUAffinity= accepts empty string to reset the setting
and avoid error.
Yu Watanabe [Thu, 30 Nov 2017 14:16:58 +0000 (23:16 +0900)]
core: merge multiple CPUAffinity= settings
Yu Watanabe [Thu, 30 Nov 2017 14:23:16 +0000 (23:23 +0900)]
tree-wide: use cpu_set_mfree()
Yu Watanabe [Sat, 2 Dec 2017 15:40:38 +0000 (00:40 +0900)]
cpu-set-util: introduce cpu_set_mfree()
Yu Watanabe [Sat, 2 Dec 2017 15:39:36 +0000 (00:39 +0900)]
cpu-set-util: internally merge two functions
Lennart Poettering [Tue, 5 Dec 2017 20:46:58 +0000 (21:46 +0100)]
man: fix binary path in systemd(1) (#7550)
Otherwise people might assume that systemd was installed in the $PATH,
but it is not. Do the same as for systemd-vconsole-setup.service and
friends: let's include the full path in the man page.
Zbigniew Jędrzejewski-Szmek [Tue, 5 Dec 2017 20:43:14 +0000 (21:43 +0100)]
Merge pull request #7532 from yuwata/test-execute
test-execute: add test for that DynamicUser= migrates StateDirectory=
Zbigniew Jędrzejewski-Szmek [Tue, 5 Dec 2017 20:40:21 +0000 (21:40 +0100)]
Merge pull request #7539 from yuwata/man-options
Add missing parsing and documentation for several options
Lennart Poettering [Tue, 5 Dec 2017 17:53:24 +0000 (18:53 +0100)]
Merge pull request #7494 from poettering/nspawn-cgroups
some nspawn cgroup fixes + dissecting and testing love
Lennart Poettering [Tue, 5 Dec 2017 17:31:32 +0000 (18:31 +0100)]
run: run pty forwarder at higher event priority than the bus
We want any tty I/O to happen before we look at service messages, hence
let's set priorities on them, and give tty I/O a higher priority.
Lennart Poettering [Tue, 5 Dec 2017 17:28:56 +0000 (18:28 +0100)]
ptyfwd: before deciding that a pty is fully drained, ask the kernel again
Apparently there's no guarantee that EPOLLIN is immediately propagated
from a pty slave to the master when data is written to it, hence it's
not sufficient to check EPOLLIN to decide whether the pty device is
drained.
Let's fix this by asking the kernel directly through SIOCINQ + SIOCOUTQ,
if there's anything buffered left.
Fixes: #7531
Michal Koutný [Tue, 5 Dec 2017 15:51:19 +0000 (16:51 +0100)]
service: Don't stop unneeded units needed by restarted service (#7526)
An auto-restarted unit B may depend on unit A with StopWhenUnneeded=yes.
If A stops before B's restart timeout expires, it'll be started again as part
of B's dependent jobs. However, if stopping takes longer than the timeout, B's
running stop job collides start job which also cancels B's start job. Result is
that neither A or B are active.
Currently, when a service with automatic restarting fails, it transitions
through following states:
1) SERVICE_FAILED or SERVICE_DEAD to indicate the failure,
2) SERVICE_AUTO_RESTART while restart timer is running.
The StopWhenUnneeded= check takes place in service_enter_dead between the two
state mentioned above. We temporarily store the auto restart flag to query it
during the check. Because we don't return control to the main event loop, this
new service unit flag needn't be serialized.
This patch prevents the pathologic situation when the service with Restart=
won't restart automatically. As a side effect it also avoid restarting the
dependency unit with StopWhenUnneeded=yes.
Fixes: #7377
Lennart Poettering [Tue, 5 Dec 2017 15:42:58 +0000 (16:42 +0100)]
hexdecoct: fix comment typo (#7548)
Yu Watanabe [Sun, 3 Dec 2017 05:27:32 +0000 (14:27 +0900)]
test-execute: add test for that DynamicUser= migrate StateDirectory=
Test for
949befd3f09e8c06a908ec99efd241666c21d944.
Yu Watanabe [Tue, 5 Dec 2017 15:36:55 +0000 (00:36 +0900)]
test-execute: cleanup
This makes rename the test units by a consistent naming scheme,
add several logs, and sort internal functions.
No functional change.
Hristo Venev [Tue, 5 Dec 2017 14:51:23 +0000 (16:51 +0200)]
networkd: fix memory leak in promote_secondaries_enabled
Hristo Venev [Tue, 5 Dec 2017 14:49:00 +0000 (16:49 +0200)]
networkd: fix promote_secondaries logic
The value for `default` has no influence at all.
Hristo Venev [Tue, 5 Dec 2017 14:30:43 +0000 (16:30 +0200)]
Do not set `net.ipv4.conf.default.*`
It is redundant because in these cases the values in
`net.ipv4.conf.all.*` take precedence. Also, setting the `default` does
nothing for devices that already exist.
Yu Watanabe [Mon, 4 Dec 2017 06:42:48 +0000 (15:42 +0900)]
man: journal-remote: add missing options
This adds documents about supported, mainly SSL related, options
in jurnal-remote, journal-upload, and journal-gatewayd.
Yu Watanabe [Mon, 4 Dec 2017 06:25:08 +0000 (15:25 +0900)]
man: fix typo
Yu Watanabe [Mon, 4 Dec 2017 05:20:56 +0000 (14:20 +0900)]
man: include standard-options.xml in systemd-hwdb(8)
Yu Watanabe [Tue, 5 Dec 2017 13:47:18 +0000 (22:47 +0900)]
man: add missing options to and use standard-options.xml in udevadm(8)
Yu Watanabe [Tue, 5 Dec 2017 14:30:10 +0000 (23:30 +0900)]
udevadm: getopt() and help message cleanup
This adds missing options, mainly '--version' in getopt(), removes
an unused option from getopt().
Also, this adds a deprecate message in `udevadm hwdb`, and cleanups
help messages.
Follow-up for
65eb4378c3e1de25383d8cd606909e64c71edc80.
Lennart Poettering [Tue, 28 Nov 2017 19:11:52 +0000 (20:11 +0100)]
fstab-generator: port some code to strextend_with_separator()
Lennart Poettering [Tue, 28 Nov 2017 18:42:15 +0000 (19:42 +0100)]
test: add a simple script that runs all our integration tests one after the other
Lennart Poettering [Tue, 28 Nov 2017 18:37:32 +0000 (19:37 +0100)]
tests: don't use "netcat" for testing TEST-10-ISSUE-2467
Apparently there are a myriad of netcat implementations around, and they
all behave slightly differently. The one I have on my Fedora 27
installation will cause a failure when invoked as "nc -U" on an AF_UNIX
socket whose connections are immediately disconnected, thus causing the
test to fail.
Let's avoid all ambiguities in this regard, and drop usage of netcat
altoegther. Instead let's use a FIFO in the file system, which we can
connect to with only shell commands, and is hence much simpler and
more reliable to test with.
The actual test is supposed to validate that PID 1 doesn't hang when
activation of a socket-activated service fails, hence which transport
mechanism is used ultimately doesn't matter, as long as we activate the
service, and we do here...
Lennart Poettering [Tue, 28 Nov 2017 18:36:52 +0000 (19:36 +0100)]
tests: make TEST-10-ISSUE-2467 also run in nspawn
No reason not to run it in nspawn, and it's easier to debug than the
qemu version.
Lennart Poettering [Tue, 28 Nov 2017 16:58:00 +0000 (17:58 +0100)]
nspawn: when in hybrid mode, chown() both the legacy and the unified hierarchy to the root in the container
If user namespacing is used, let's make sure that the root user in the
container gets access to both /sys/fs/cgroup/systemd and
/sys/fs/cgroup/unified.
This matches similar logic in cg_set_access().
Lennart Poettering [Tue, 28 Nov 2017 15:46:26 +0000 (16:46 +0100)]
nspawn: make sure images containing an ESP are compatible with userns -U mode
In -U mode we might need to re-chown() all files and directories to
match the UID shift we want for the image. That's problematic on fat
partitions, such as the ESP (and which is generated by mkosi's
--bootable switch), because fat of course knows no UID/GID file
ownership natively.
With this change we take benefit of the uid= and gid= mount options FAT
knows: instead of chown()ing all files and directories we can just
specify the right UID/GID to use at mount time.
This beefs up the image dissection logic in two ways:
1. First of all support for mounting relevant file systems with
uid=/gid= is added: when a UID is specified during mount it is used for
all applicable file systems.
2. Secondly, two new mount flags are added:
DISSECT_IMAGE_MOUNT_ROOT_ONLY and DISSECT_IMAGE_MOUNT_NON_ROOT_ONLY.
If one is specified the mount routine will either only mount the root
partition of an image, or all partitions except the root partition.
This is used by nspawn: first the root partition is mounted, so that
we can determine the UID shift in use so far, based on ownership of
the image's root directory. Then, we mount the remaining partitions
in a second go, this time with the right UID/GID information.
Lennart Poettering [Tue, 28 Nov 2017 15:37:53 +0000 (16:37 +0100)]
string-util: rework strextend() to optionally inset separators between each appended string
This adds a new flavour of strextend(), called
strextend_with_separator(), which takes an optional separator string. If
specified, the separator is inserted between each appended string, as
well as before the first one, but only if the original string was
non-empty.
This new call is particularly useful when appending new options to mount
option strings and suchlike, which need to be comma-separated, and
initially start out from an empty string.
Lennart Poettering [Mon, 27 Nov 2017 19:57:17 +0000 (20:57 +0100)]
cgroup: also include "cgroups.threads" in the list of files to chown
Also, add "cgroups.stat". It's read-only anyway, hence its UID/GID
ownership matters little, but it's probably a good idea to keep it
ownership in sync with the other read-only files such as
"cgroups.controllers".
Also, order the list of files alphabetically.
Lennart Poettering [Mon, 27 Nov 2017 19:49:35 +0000 (20:49 +0100)]
nspawn: figure out cgroup mode *after* mounting image
If we operate on a disk image (i.e. --image=) then it's pointless to
look into the mount directory before it is actually mounted to see which
systemd version is running inside...
Unfortunately we only mount the disk image in the child process, but the
parent needs to know the cgroup mode, hence add some IPC for this
purpose and communicate the cgroup mode determined from the image back
to the parent.
Lennart Poettering [Mon, 27 Nov 2017 19:48:46 +0000 (20:48 +0100)]
path-util: when checking systemd versions, check both lib and lib64
We need to check both to be compatible with multilib images.