summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2017-03-01coredump: introduce is_journald_crash() and is_pid1_crash() helpersLennart Poettering
We check these a number of times, hence let's unify these checks here. This also allows us to make the PID 1 check more elaborate as we can check both the PID and the cgroup. Checking the PID has the benefit that we'll also cover cases where PID 1 might still be in the root cgroup, and the cgroup check has the benefit that we also cover crashes in forked off crasher processes (the way we actually do it in systemd)
2017-03-01coredump: normalize generation/parsing of COREDUMP_TRUNCATED=Lennart Poettering
Given that this is a field primarily processed by computers, and not so much by humans, assign "1" instead of "yes". Also, use parse_boolean() as we usually do for parsing it again. This makes things more alike udev options (as one example), such as SYSTEMD_READY where we also spit out "1" and "0", and parse with parse_boolean().
2017-03-01mount-util: accept that name_to_handle_at() might fail with EPERM (#5499)Lennart Poettering
Container managers frequently block name_to_handle_at(), returning EACCES or EPERM when this is issued. Accept that, and simply fall back to to fdinfo-based checks. Note that we accept either EACCES or EPERM here, as container managers can choose the error code and aren't very good on agreeing on just one. (note that this is a non-issue with nspawn, as we permit name_to_handle_at() there, only block open_by_handle_at(), which should be sufficiently safe).
2017-03-01core: when a unit's SourcePath points to API VFS pretend we are never ↵Lennart Poettering
out-of-date (#5487) If the unit's SourcePath is below /proc then it's a unit genreated from a kernel resource (such as a .mount or .swap unit). And those we watch anyway, and hence should never be out-of-date. Fixes: #5461
2017-03-01Merge pull request #5458 from keszybz/coredumpLennart Poettering
Fix for coredump crash
2017-02-28Merge pull request #5494 from poettering/run-fixesZbigniew Jędrzejewski-Szmek
systemd-run --user fixes.
2017-02-28resolved: add the new KSK to the built-in resolved trust anchor (#5486)Lennart Poettering
Fixes: #5482
2017-02-28automount: if an automount unit is masked, don't react to activation anymore ↵Lennart Poettering
(#5445) Otherwise we'll hit an assert sooner or later. This requires us to initialize ->where even if we come back in "masked" mode, as otherwise we don't know how to operate on the automount and detach it. Fixes: #5441
2017-02-28coredumpctl: avoid spurious warning about systemd-coredump@0.serviceZbigniew Jędrzejewski-Szmek
Fixes #5477.
2017-02-28coredumpctl: print a hint when no journal files are foundZbigniew Jędrzejewski-Szmek
[guest@fedora ~]$ coredumpctl No coredumps found. [guest@fedora ~]$ ./coredumpctl Hint: You are currently not seeing messages from other users and the system. Users in groups 'adm', 'systemd-journal', 'wheel' can see all messages. Pass -q to turn off this notice. No coredumps found. Fixes #1733.
2017-02-28journalctl: move access_check() to shared/Zbigniew Jędrzejewski-Szmek
The only functional change is that log_notice("No journal files were found.") is not printed any more with --quiet. log_error("No journal files were opened due to insufficient permissions.") is still printed. I wasn't quite sure where to put this function, but shared/ seems to be the right place and none of the existing files seem to fit too well. v2: rename journal_access_check to journal_access_check_and_warn.
2017-02-28coredumpctl: use a 3s timeout for checking unitsZbigniew Jędrzejewski-Szmek
This is just a hint, so we shouldn't wait too long. A short timeout helps for the case where pid1 of dbus have crashed.
2017-02-28coredump: process special crashes in an (almost) normal wayZbigniew Jędrzejewski-Szmek
We would only log a terse message when pid1 or systemd-journald crashed. It seems better to reuse the normal code paths as much as possible, with the following differences: - if pid1 crashes, we cannot launch the helper, so we don't analyze the coredump, just write it to file directly from the helper invoked by the kernel; - if journald crashes, we can produce the backtrace, but we don't log full structured messages. With comparison to previous code, advantages are: - we go through most of the steps, so for example vacuuming is performed, - we gather and log more data. In particular for journald and pid1 crashes we generate a backtrace, and for pid1 crashes we record the metadata (fdinfo, maps, etc.), - coredumpctl shows pid1 crashes. A disavantage (inefficiency) is that we gather metadata for journald crashes which is then ignored because _TRANSPORT=kernel does not support structued messages. Messages for the systemd-journald "crash" have _TRANSPORT=kernel, and _TRANSPORT=journal for the pid1 "crash". Feb 26 16:27:55 systemd[1]: systemd-journald.service: Main process exited, code=dumped, status=11/SEGV Feb 26 16:27:55 systemd[1]: systemd-journald.service: Unit entered failed state. Feb 26 16:37:54 systemd-coredump[18801]: Process 18729 (systemd-journal) of user 0 dumped core. Feb 26 16:37:54 systemd-coredump[18801]: Coredump diverted to /var/lib/systemd/coredump/core.systemd-journal.0.36c14bf3c6ce4c38914f441038990979.18729.1488145074000000.lz4 Feb 26 16:37:54 systemd-coredump[18801]: Stack trace of thread 18729: Feb 26 16:37:54 systemd-coredump[18801]: #0 0x00007f46d6a06b8d fsync (libpthread.so.0) Feb 26 16:37:54 systemd-coredump[18801]: #1 0x00007f46d71bfc47 journal_file_set_online (libsystemd-shared-233.so) Feb 26 16:37:54 systemd-coredump[18801]: #2 0x00007f46d71c1c31 journal_file_append_object (libsystemd-shared-233.so) Feb 26 16:37:54 systemd-coredump[18801]: #3 0x00007f46d71c3405 journal_file_append_data (libsystemd-shared-233.so) Feb 26 16:37:54 systemd-coredump[18801]: #4 0x00007f46d71c4b7c journal_file_append_entry (libsystemd-shared-233.so) Feb 26 16:37:54 systemd-coredump[18801]: #5 0x00005577688cf056 write_to_journal (systemd-journald) Feb 26 16:37:54 systemd-coredump[18801]: #6 0x00005577688d2e98 dispatch_message_real (systemd-journald) Feb 26 16:37:54 kernel: systemd-coredum: 9 output lines suppressed due to ratelimiting Feb 26 16:37:54 systemd-journald[18810]: Journal started Feb 26 16:50:59 systemd-coredump[19229]: Due to PID 1 having crashed coredump collection will now be turned off. Feb 26 16:51:00 systemd[1]: Caught <SEGV>, dumped core as pid 19228. Feb 26 16:51:00 systemd[1]: Freezing execution. Feb 26 16:51:00 systemd-coredump[19229]: Process 19228 (systemd) of user 0 dumped core. Stack trace of thread 19228: #0 0x00007fab82075c47 kill (libc.so.6) #1 0x000055fdf7c38b6b crash (systemd) #2 0x00007fab824175c0 __restore_rt (libpthread.so.0) #3 0x00007fab82148573 epoll_wait (libc.so.6) #4 0x00007fab8366f84a sd_event_wait (libsystemd-shared-233.so) #5 0x00007fab836701de sd_event_run (libsystemd-shared-233.so) #6 0x000055fdf7c4a380 manager_loop (systemd) #7 0x000055fdf7c402c2 main (systemd) #8 0x00007fab82060401 __libc_start_main (libc.so.6) #9 0x000055fdf7c3818a _start (systemd) Poor machine ;)
2017-02-28Merge pull request #5493 from poettering/service-mini-fixesMartin Pitt
three small mini-fixes for src/core/service.c
2017-02-28hostname: detect detachable dmi chassis type (#5489)David Herrmann
Detect the 'Detachable' dmi chassis type properly. Use the new 'convertible' chassis class of hostnamed, instead of returning the generic 'computer' chassis class.
2017-02-28cryptsetup-generator: run cryptsetup service before swap unit (#5480)Mauricio Faria de Oliveira
If the cryptsetup service unit and swap unit for a swap device are not strictly ordered, it might happen that the swap unit activates/mounts the swap device before its cryptsetup service unit has a chance to run the 'mkswap' command (that it is programmed to). This leads to the following error: Starting Cryptography Setup for sda3_crypt... [ OK ] Found device /dev/mapper/sda3_crypt. Activating swap /dev/mapper/sda3_crypt... [ OK ] Activated swap /dev/mapper/sda3_crypt. [ OK ] Reached target Swap. [FAILED] Failed to start Cryptography Setup for sda3_crypt. See 'systemctl status systemd-cryptsetup@sda3_crypt.service' for details. [DEPEND] Dependency failed for Encrypted Volumes. Which happens because the swap device is already mounted: # systemctl status systemd-cryptsetup@sda3_crypt.service <...> Active: failed (Result: exit-code) since Mon 2017-02-27 14:21:43 CST; 54s ago <...> <...> systemd[1]: Starting Cryptography Setup for sda3_crypt... <...> mkswap[2420]: mkswap: error: /dev/mapper/sda3_crypt is mounted; will not make swapspace <...> So, modify cryptsetup-generator to include a 'Before=' option for the respective 'dev-mapper-%i.swap' device in the cryptsetup service unit. Now, correct ordering is ensured, and the error no longer occurs: Starting Cryptography Setup for sda3_crypt... [ OK ] Found device /dev/mapper/sda3_crypt. [ OK ] Started Cryptography Setup for sda3_crypt. Activating swap /dev/mapper/sda3_crypt... [ OK ] Reached target Encrypted Volumes. [ OK ] Activated swap /dev/mapper/sda3_crypt. [ OK ] Reached target Swap.
2017-02-28run: also pin unit when we we are in --pty modeLennart Poettering
Since 95f1d6bfecde60b245fae1ab0313b550201e7880 we'll subscribe to unit signals to figure out when to disconnect the pty. But that can only work correctly if we actually subscribe to the unit's signals. Hence, explicitly pin (and thus subscribe to) the unit we just created not only in --wait mode but also in --pty mode. Or to say this differently: we need to pin the unit in the same cases as we install the signal match. 95f1d6bfecde60b245fae1ab0313b550201e7880 forgot to do that. This is relevant to make sure systemd-run works correctly in --user mode, and correctly exits when the spawned service dies. To test: systemd-run --user -t /bin/bash And then press ^D. This will hang before this change, but exit cleanly after it.
2017-02-28core: always consider clients that pinned a unit to be subscribersLennart Poettering
If a client pins a unit, then it makes sense to also implicitly make it a subscriber. This is useful for clients that just want to watch one specific unit: they can pin it and receive its messages.
2017-02-28systemctl: fix bad memory access when mangle_names() fails (#5485)Lennart Poettering
Fixes #5483
2017-02-28service: refuse using PID 1 as MAINPID for a serviceLennart Poettering
2017-02-28service: make use of log_unit_warning_errno()'s return valueLennart Poettering
2017-02-28core: use PID_FMT where appropriateLennart Poettering
2017-02-28Merge pull request #5464 from ssahani/labelLennart Poettering
socket-util: introduce address_label_valid
2017-02-28Merge pull request #5484 from dvdhrm/convertibleLennart Poettering
hostname: support 'convertible' chassis
2017-02-28Merge pull request #5438 from ssahani/vxlan-addressLennart Poettering
networkd: add symlinks for Makefile (netdev and wait-online) , vxlan enhancements.
2017-02-28networkd: use address_label_valid for label validationSusant Sahani
2017-02-28socket-util: introduce address_label_validSusant Sahani
2017-02-28hostname: detect convertible dmi chassis typeDavid Herrmann
Detect the 'Convertible' dmi chassis type properly. Use the new 'convertible' chassis class of hostnamed, instead of returning the generic 'computer' chassis class. Based on a patch by Jani Nikula <jani.nikula@intel.com>.
2017-02-28hostname: add 'convertible' chassis typeDavid Herrmann
Add the 'convertible' type to the set of allowed chassis. This applies to all devices that can be transformed by the user from laptop style to tablet style. This does not add any auto-detection, yet. It only makes 'set-chassis' accept 'convertible' as valid input.
2017-02-28Fix MIPS N64 and N32 LIB_ARCH_TUPLE (#5469)YunQiang Su
* Fix MIPS N64 and N32 LIB_ARCH_TUPLE For mips, we have 3 major ABIs, they are N64, N32 and O32. Both N32 and N64 defined __mips64__, and only N64 defined __LP64__.
2017-02-28networkd: fix assertion crash for tunnel, log error instead (#5465)Susant Sahani
GRE6 and IP6TNL address should be a IPv6. fix : ``` Assertion 't->family == AF_INET6' failed at src/network/netdev/tunnel.c:170, function netdev_ip6gre_fill_message_create(). Aborting. ```
2017-02-27build-sys: add LIB_ARCH_TUPLE for tilegx-linux-gnu (#5474)Martin Pitt
Fix build failure on the tilegx architecture. https://bugs.debian.org/856306
2017-02-27sd-boot: stub: check LoadOptions contains data (#5467)Mikko Ylinen
With some UEFI shells LoadOptionsSize is reported being > 0 but the corresponding LoadOptions does not contain any data (the first element has value 0). When that happens, the stub feature that allows .cmdline to be replaced by what's in LoadOptions ends up copying nothing/random data to the kernel cmdline resulting in different kinds of boot problems. To fix this, add a check to see if LoadOptions contains data before replacing the .cmdline. Signed-off-by: Mikko Ylinen <mikko.ylinen@linux.intel.com>
2017-02-26coredumpctl,man: mark truncated messages as such in outputZbigniew Jędrzejewski-Szmek
Unit systemd-coredump@1-3854-0.service is failed/failed, not counting it. TIME PID UID GID SIG COREFILE EXE Fri 2017-02-24 11:11:00 EST 10002 1000 1000 6 none /home/zbyszek/src/systemd-work/.libs/lt-Sat 2017-02-25 00:49:32 EST 26921 0 0 11 error /usr/libexec/fprintd Sat 2017-02-25 11:56:30 EST 30703 1000 1000 - - /usr/bin/python3.5 Sat 2017-02-25 13:16:54 EST 3275 1000 1000 11 present /usr/bin/bash Sat 2017-02-25 17:25:40 EST 4049 1000 1000 11 truncated /usr/bin/bash For info and gdb output, the filename is marked in red and "(truncated)" is appended. (Red is necessary because the annotation is hard to see when running under a pager.) Fixed #3883.
2017-02-26coredumpctl: add debug information which services count towards the warningZbigniew Jędrzejewski-Szmek
A few times I have seen the hint unexpectedly. Add this so debug info so it's easier to see what's happening. ... Unit systemd-coredump@0-3119-0.service is failed/failed, not counting it. Unit systemd-coredump@1-3854-0.service is activating/start-pre, counting it. ... -- Notice: 1 systemd-coredump@.service unit is running, output may be incomplete.
2017-02-26coredump: when storing an incomplete coredump, add COREDUMP_TRUNCATED=yesZbigniew Jędrzejewski-Szmek
We logged about this, but did not attach information directly to the log entry. It *would* be nice to log the full untruncated size, but afaict, to do this, we would have to read the full data from the kernel. Doing this just to log that information seems a bit excessive, in particular when the limit could be set quite low. So for now let's just add a boolean field.
2017-02-26coredump: do not try to access unitialized CONTEXT_COMM fieldZbigniew Jędrzejewski-Szmek
Most of the fields in the context array come from the kernel (passed through argv), but two are special: comm and exe. We allocate them ourselves. We forgot to initialize context[CONTEXT_COMM] with the value we allocated (introduced in 9aa820231414baa28e6bf02a033932cb69ff6b8b). To simplify things, just set context[CONTEXT_COMM] and context[CONTEXT_EXE], and free those two fields at the end. Fixes #5442.
2017-02-26gpt-auto-generator: fix warning when compiling w/o efi (#5456)Zbigniew Jędrzejewski-Szmek
Fixes #5452.
2017-02-25coredump: slight simplificationZbigniew Jędrzejewski-Szmek
2017-02-25Merge pull request #5449 from keszybz/blkd-error-handlingMartin Pitt
blkid error handling
2017-02-24Merge pull request #5429 from GiedriusS/masterZbigniew Jędrzejewski-Szmek
coredumpctl: implement --since/--until (-S/-U) for info/list verbs
2017-02-24Merge pull request #5444 from poettering/cgroups-revert-no-errorZbigniew Jędrzejewski-Szmek
Revert "core: simplify cg_[all_]unified()" and more.
2017-02-24coredumpctl: implement --since/--until (-S/-U) for info/list verbsGiedrius Statkevičius
Implement --since/--until (-S/-U) in the same fashion as journalctl. This lets the user filter the results a bit so it would be easier to find relevant info in case there were many core dumps.
2017-02-25networkd: add symlinks to the Makefile for dir netdev and wait-onlineSusant Sahani
2017-02-25networkd: add support for vxlan Remote and Local.Susant Sahani
This patch add supports to configure IFLA_VXLAN_LOCAL and IFLA_VXLAN_GROUP. The "Group" is renamed to "Remote" which is a multicast address.` ``` Description=vxlan-test Name=vxlan1 Kind=vxlan [VXLAN] Id=33 Local=2001:db8:2f4:4bff:fa71:1a56 Remote=FF02:0:0:0:0:0:1:9 ``` output ``` ip -d link show vxlan1 16: vxlan1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1430 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 link/ether fe:b4:97:03:f8:e5 brd ff:ff:ff:ff:ff:ff promiscuity 0 vxlan id 33 group ff02::1:9 local 2001:db8:02f4:4bff:fa71:1a56 dev enp0s3 srcport 0 0 dstport 8472 ageing 300 noudpcsum noudp6zerocsumtx noudp6zerocsumrx addrgenmode none numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 ```
2017-02-24Fix missing space in comments (#5439)AsciiWolf
2017-02-24cgroup: rework cg_all_unified()Lennart Poettering
Let's just check the unified level, directly. There's really no value in wrapping cg_unified_controllers() with this, i.e. potentially do string comparison when there's no reason to. Also, this makes the clal more alike cg_hybrid_unified().
2017-02-24cgroup: rename cg_update_unified() → cg_unified_update()Lennart Poettering
We usually put the noun first, the verb (i.e. method) secont, for example in cg_unified_flush(), let's follow the logic here...
2017-02-24cgroup: rename cg_unified() → cg_unified_controller()Lennart Poettering
cg_unified() is a bit generic a name, let's make clear that it checks whether a specified controller is in unified mode.
2017-02-24cgroup: change cg_unified() to possibly return errors againLennart Poettering
We use our cgroup APIs in various contexts, including from our libraries sd-login, sd-bus. As we don#t control those environments we can't rely that the unified cgroup setup logic succeeds, and hence really shouldn't assert on it. This more or less reverts 415fc41ceaeada2e32639f24f134b1c248b9e43f.