Commit graph

14469 commits

Author SHA1 Message Date
Lennart Poettering 54b7f38fe8 Merge pull request #2525 from chaloulo/journal-remote-microhttp-max-memory-usage
journal-remote: decrease microhttpd memory limit
2016-02-06 14:40:32 +01:00
Lennart Poettering b1f047d6ba Merge pull request #2540 from 0xAX/use-dual-timestamp-get-in-timeutil
time-util: use dual_timestamp_get()
2016-02-06 14:38:16 +01:00
Alexander Kuleshov 0345d25293 time-util: use dual_timestamp_get()
The time-util.c provides dual_timestamp_get() function for getting
realtime and monotonic timestamps. Let's use it instead of direct
realtime/monotonic calculation.
2016-02-06 18:26:05 +06:00
Lennart Poettering 421180379f Merge pull request #2138 from stefwalter/journal-combine
Combine journal catalog entries with the same id
2016-02-06 11:30:05 +01:00
Stef Walter c059b62fe6 journal: Add test for merging journal entries 2016-02-05 17:07:01 +01:00
Stef Walter 9d85882aa8 journal: Refactor test-catalog importing tests
One function per test. Remove shared state between tests.
2016-02-05 17:07:01 +01:00
Stef Walter dbae138dc1 journal: Combine journal catalog entries with the same id
Instead of discarding duplicate catalog entries, we now combine
them. This allows software or admins to add or override catalog
headers, or add additional text to the catalog message.
2016-02-05 17:06:59 +01:00
Klearchos Chaloulos 8c6bcbf892 journal-remote: decrease microhttpd memory limit
Set the MHD_OPTION_CONNECTION_MEMORY_LIMIT to 128KB. The precious value was DATA_SIZE_MAX, which was defined as 1024*1024*768. This caused journal-remote to allocate 756MB for each journal-upload connection, thus exhausting the available memory.
2016-02-04 17:35:24 +02:00
Lennart Poettering 06d1275435 resolved: correctly store interface index of RRs in cache
Fixes: #2361
2016-02-04 01:10:36 +01:00
Lennart Poettering 658f7f026e resolved: properly turn off DNSSEC for LLMNR/mDNS scopes 2016-02-04 01:10:12 +01:00
Lennart Poettering 7a7821c878 core: rework job_get_timeout() to use usec_t and handle USEC_INFINITY time events correctly 2016-02-04 00:35:43 +01:00
Lennart Poettering 8e5de09f44 resolved: don't follow CNAMEs originating from DNS on LLMNR
Fixes: #2514
2016-02-04 00:14:25 +01:00
Lennart Poettering 089b64d5f8 core: move service_unwatch_control_pid() call into service_enter_running()
When we enter the running state we should forget about any control processes, in all cases, and not just when hit a
reload timeout...
2016-02-03 23:58:53 +01:00
Lennart Poettering 739731cdac journal: fix boolean handling in MMapCache
Let's use bitfields for our booleans, and don't try to apply binary OR or addition on them, because that's weird and we
should instead use logical OR only.
2016-02-03 23:58:53 +01:00
Lennart Poettering 1411b09467 core: log about path_is_mount_point() errors
We really shouldn't fail silently, but print a log message about these errors. Also make sure to attach error codes to
all log messages where that makes sense.

(While we are at it, add a couple of (void) casts to functions where we knowingly ignore return values.)
2016-02-03 23:58:53 +01:00
Lennart Poettering ce359e98f8 core: when a service's ExecStartPre= times out, skip ExecStop=
This makes sure we never run two control processes at the same time, we cannot keep track off.

This introduces a slight change of behaviour but cleans up the definition of ExecStop= and ExecStopPost=. The former is
now invoked only if the service managed to start-up correctly. The latter is called even if start-up failed half-way.
Thus, ExecStopPost= may be used as clean-up step for both successful and failed start-up attempts, but ExecStop='s
purpose is clearly defined as being responsible for shutting down the service and nothing else.

The precise behaviour of this was not documented yet. This commit adds the necessary docs.

Fixes: #1254
2016-02-03 23:58:47 +01:00
Lennart Poettering 2d60169dd6 util: add check that makes sure time_t and TIME_T_MAX work the way we assume they do 2016-02-03 23:58:25 +01:00
Lennart Poettering 59e73c5b10 gpt-auto: handle errors from blkid more correctly
Let's make sure we don't choke if blkid_probe_lookup_value() returns a NULL string.

Also, make sur we propagate the correct error when blkid_probe_lookup_value() fails.
2016-02-03 23:58:25 +01:00
Lennart Poettering 2b26a72816 nspawn: make sure --help fits it 79ch 2016-02-03 23:58:25 +01:00
Lennart Poettering 7732f92bad nspawn: optionally run a stub init process as PID 1
This adds a new switch --as-pid2, which allows running commands as PID 2, while a stub init process is run as PID 1.
This is useful in order to run arbitrary commands in a container, as PID1's semantics are different from all other
processes regarding reaping of unknown children or signal handling.
2016-02-03 23:58:24 +01:00
Lennart Poettering 021dd87bc0 resolved: apply epoch to system time from PID 1
For use in timesyncd we already defined a compile-time "epoch" value, which is based on the mtime of the NEWS file, and
specifies a point in time we know lies in the past at runtime. timesyncd uses this to filter out nonsensical timestamp
file data, and bump the system clock to a time that is after the build time of systemd. This patch adds similar bumping
code to earliest PID 1 initialization, so that the system never continues operation with a clock that is in the 1970ies
or even 1930s.
2016-02-03 23:58:24 +01:00
Lennart Poettering 5f932eb9af nspawn: add new --chdir= switch
Fixes: #2192
2016-02-03 23:58:24 +01:00
Tom Gundersen 145c990fc9 Merge pull request #2509 from bengal/dhcp-nak-delay-v4
dhcp: delay restarts after NAKs (v4)
2016-02-03 21:19:07 +01:00
Lennart Poettering 34172476c8 Merge pull request #2508 from fishilico/selinux-logind
Load SELinux labelling systemd in systemd-logind
2016-02-03 21:13:30 +01:00
Lennart Poettering d58669f08a Merge pull request #2512 from 0xAX/mount-setup
mount-setup: introduce mount_points_setup
2016-02-03 21:12:06 +01:00
Lennart Poettering 37723f806e Merge pull request #2522 from 0xAX/check-early-mount
manager: print fatal error if early mount failed
2016-02-03 21:10:56 +01:00
Lennart Poettering a92ff4003f Merge pull request #2519 from msekletar/journalctl-device-log-current-boot-v2
journalctl: add match for the current boot when called with devpath (v2)
2016-02-03 16:26:21 +01:00
Tom Gundersen 5508e4f218 Merge pull request #2453 from poettering/journalctl-f
journalctl --fields logic
2016-02-03 15:36:06 +01:00
Michal Sekletar 485fd9a7b9 journalctl: add match for the current boot when called with devpath 2016-02-03 13:54:24 +01:00
Lennart Poettering 264a58110e Merge pull request #2507 from evverx/fix-q-on-tmpfs
tmpfiles: don't skip path_set_perms on error
2016-02-03 13:14:06 +01:00
Alexander Kuleshov d723cd6554 manager: print fatal error if early mount failed
The mount_setup_early() can fail and if it will occur, there is
no sense to make selinux setup and etc.
2016-02-03 01:45:41 +06:00
Nicolas Iooss 4b51966cf6 logind: load SELinux labelling system
systemd-logind uses mkdir_label and label_fix functions without calling
first mac_selinux_init.  This makes /run/user/$UID/ directories not
labelled correctly on an Arch Linux system using SELinux.

Fix this by calling mac_selinux_init("/run") early in systemd-logind.
This makes files created in /etc/udev/rules.d and /var/lib/systemd to be
labelled through transitions in the SELinux policy instead of using
setfscreatecon (with mac_selinux_create_file_prepare).
2016-02-02 20:07:46 +01:00
Alexander Kuleshov 400fac0609 mount-setup: introduce mount_points_setup
The mount_setup_early() and mount_setup() contain almost the same
pieces of code which calls mount_one() for a certain mount point
from the mount_table. This patch introduces mount_points_setup()
helper to prevent code duplication.
2016-02-03 01:03:12 +06:00
Lennart Poettering c5c41f1e57 Merge pull request #2510 from msekletar/journalctl-dev-sda-v4
journalctl: make "journalctl /dev/sda" work
2016-02-02 19:34:39 +01:00
Michal Sekletar 795ab08f78 journalctl: make "journalctl /dev/sda" work
Currently when journalctl is called with path to block device node we
add following match _KERNEL_DEVICE=b$MAJOR:$MINOR.

That is not sufficient to actually obtain logs about the disk because
dev_printk() kernel helper puts to /dev/kmsg information about the
device in following format, +$SUBSYSTEM:$ADDRESS,
e.g. "+pci:pci:0000:00:14.0".

Now we will walk upward the syspath and add match for every device in
format produced by dev_printk() as well as match for its device node if
it exists.
2016-02-02 16:46:28 +01:00
Beniamino Galvani 1d1a3e0afb dhcp: delay restarts after NAKs
The server might answer to a DHCPREQUEST with a NAK and currently the
client restarts the configuration process immediately.  It was
observed that this can easily generate loops in which the network is
flooded with DISCOVER,OFFER,REQUEST,NAK sequences.

RFC 2131 only states that "if the client receives a DHCPNAK message,
the client restarts the configuration process" without further
details.

Add a delay with exponential backoff between retries after NAKs to
limit the number of requests and cap the delay to 30 minutes.
2016-02-02 15:23:34 +01:00
Lennart Poettering 9a07f779bb sd-journal: properly export has_{persistent|runtime}_files()
This was missing in 39fd5b08a7.
2016-02-01 23:15:54 +01:00
Lennart Poettering ed71f95662 sd-journal: minor optimization
No need to store the object and offset data if we don't actually need it ever.
2016-02-01 22:42:33 +01:00
Lennart Poettering 69e714f3d8 journalctl: add new --fields switch to dump all currently used field names
Fixes #2176
2016-02-01 22:42:33 +01:00
Lennart Poettering eb86030ec0 sd-journal: add an API to enumerate known field names of the journal
This adds two new calls to get the list of all journal fields names currently in use.

This is the low-level support to implement the feature requested in #2176 in a more optimized way.
2016-02-01 22:42:33 +01:00
Lennart Poettering d6c16624bf sd-netlink: since whe acquire the netlink socket's sockaddr anyway, let's actually verify it 2016-02-01 22:18:16 +01:00
Lennart Poettering 5c60db874d sd-netlink: don't take possesion of netlink fd from caller on failure
Fixes: #2338
2016-02-01 22:18:16 +01:00
Lennart Poettering fabab19068 core: no need to use unlink_noerrno() 2016-02-01 22:18:16 +01:00
Lennart Poettering 36c16a7cdd core: rework unit timeout handling, and add new setting RuntimeMaxSec=
This clean-ups timeout handling in PID 1. Specifically, instead of storing 0 in internal timeout variables as
indication for a disabled timeout, use USEC_INFINITY which is in-line with how we do this in the rest of our code
(following the logic that 0 means "no", and USEC_INFINITY means "never").

This also replace all usec_t additions with invocations to usec_add(), so that USEC_INFINITY is properly propagated,
and sd-event considers it has indication for turning off the event source.

This also alters the deserialization of the units to restart timeouts from the time they were originally started from.
Before this patch timeouts would be restarted beginning with the time of the deserialization, which could lead to
artificially prolonged timeouts if a daemon reload took place.

Finally, a new RuntimeMaxSec= setting is introduced for service units, that specifies a maximum runtime after which a
specific service is forcibly terminated. This is useful to put time limits on time-intensive processing jobs.

This also simplifies the various xyz_spawn() calls of the various types in that explicit distruction of the timers is
removed, as that is done anyway by the state change handlers, and a state change is always done when the xyz_spawn()
calls fail.

Fixes: #2249
2016-02-01 22:18:16 +01:00
Lennart Poettering cab2aca3e7 core: fix support for transient resource limit properties
Make sure we can properly process resource limit properties. Specifically, allow transient configuration of both the
soft and hard limit, the same way from the unit files. Previously, only the the hard rlimits could be configured but
they'd implicitly spill into the soft hard rlimits.

This also updates the client-side code to be able to parse hard/soft resource limit specifications. Since we need to
serialize two properties in bus_append_unit_property_assignment() now, the marshalling of the container around it is
now moved into the function itself. This has the benefit of shortening the calling code.

As a side effect this now beefs up the rlimit parser of "systemctl set-property" to understand time and disk sizes
where that's appropriate.
2016-02-01 22:18:16 +01:00
Lennart Poettering fb8a9fc9b5 resolve: work around clang limitation
clang is apparently not smart enough to detect when a switch statement contains case statements for all possible values
of the used type. Work around that.

(And while we are at it, normalize indentation a bit)

Fixes: #2504
2016-02-01 22:18:16 +01:00
Lennart Poettering 1e5b6b4f28 shared: simplify parsing of bus properties a bit
Let's write the property name and value in one call, when that's possible, shorthing our code a bit.
2016-02-01 22:18:16 +01:00
Lennart Poettering 5c1f0be1ef core: when saving timer unit time values, store them in raw µs
Let's simplify things a bit, and make sure we don't lose accuracy.
2016-02-01 22:18:16 +01:00
Lennart Poettering b93ea5d368 core: fix handling of AccuracyUSec and RandomDelayUSec bus properties
Clear up some confusion regarding the USec and Sec suffixes we use. In configuration files we usually use the Sec
suffix, to indicate the implied time unit if none is specified. The respective bus properties however use the USec
property, since they expose 64bit unsigned integers containing time in µs.

Before this patch timer units exposed a bus property AccuracyUSec (which hence is the correct name) but when parsing
transient property data would look for AccuracySec instead (which is incorrect). This patch ensures we look for
AccuracySec correctly, but keeps the code for AccuracyUSec in place for compatibility, but adds a warning to ensure
that apps are updated to use the right property.
2016-02-01 22:18:16 +01:00
Lennart Poettering 99d4f5e5c0 basic: add new rlimit_format() call
This formats a struct rlimit the way rlimit_parse() expects it.
2016-02-01 22:18:16 +01:00