platform/upstream/systemd.git
6 years agoprocess-util: add TAKE_PID(), similar to TAKE_PTR/TAKE_FD, but for child process...
Lennart Poettering [Tue, 27 Mar 2018 13:01:02 +0000 (15:01 +0200)]
process-util: add TAKE_PID(), similar to TAKE_PTR/TAKE_FD, but for child process PIDs

6 years agoutil: introduce typesafe_qsort(), a typesafe version of qsort()/qsort_safe()
Lennart Poettering [Tue, 27 Mar 2018 12:56:29 +0000 (14:56 +0200)]
util: introduce typesafe_qsort(), a typesafe version of qsort()/qsort_safe()

It does two things:

1. It derives the element size from the array argument type

2. It derives the right type for the function from the array argument
   type

Using this macro call should make the invocations of qsort() quite a bit
safer.

6 years agoMerge pull request #8700 from keszybz/hibernation
Lennart Poettering [Wed, 11 Apr 2018 08:26:27 +0000 (10:26 +0200)]
Merge pull request #8700 from keszybz/hibernation

Various improvements related to hibernation

6 years agoshared/sleep-config: rename misnamed function
Zbigniew Jędrzejewski-Szmek [Wed, 11 Apr 2018 07:27:32 +0000 (09:27 +0200)]
shared/sleep-config: rename misnamed function

6 years agoshared/sleep-config: return a custom message when not enough swap for hibernation
Zbigniew Jędrzejewski-Szmek [Wed, 11 Apr 2018 06:51:06 +0000 (08:51 +0200)]
shared/sleep-config: return a custom message when not enough swap for hibernation

$ sudo swapoff -av
swapoff /dev/vda4
$ sudo systemctl hibernate
Failed to hibernate system via logind: Not enough swap space for hibernation

Fixes #6729.

6 years agologind: refuse operations if the target unit is masked or unavailable
Zbigniew Jędrzejewski-Szmek [Tue, 10 Apr 2018 11:15:00 +0000 (13:15 +0200)]
logind: refuse operations if the target unit is masked or unavailable

If hibernate.target is masked, and systemctl hibernate is invoked, havoc ensues.
logind starts the hibernation operation, but then doesn't go through with it;
gnome-shell segfaults. Let's be nice to the user and refuse doing anything in
that case.

$ sudo systemctl mask hibernate.target
$ busctl call org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager CanHibernate
s "no"
$ sudo systemctl hibernate
Failed to hibernate system via logind: Access denied
Failed to start hibernate.target: Unit hibernate.target is masked.

https://bugzilla.redhat.com/show_bug.cgi?id=1468003#c4

6 years agoMove utility function to query unit state from systemctl to shared/
Zbigniew Jędrzejewski-Szmek [Tue, 10 Apr 2018 10:35:36 +0000 (12:35 +0200)]
Move utility function to query unit state from systemctl to shared/

6 years agoshared/sleep-fix: fix check if s-then-h is possible
Zbigniew Jędrzejewski-Szmek [Tue, 10 Apr 2018 09:39:14 +0000 (11:39 +0200)]
shared/sleep-fix: fix check if s-then-h is possible

can_sleep() returns 0 if the operation is impossible, but
the code assumed that negative is returned in that case,
in effect reporting s2h was possible even if hibernation or
suspend were not possible.

6 years agoshared/sleep-config: get rid of explicit allocation size calculation
Zbigniew Jędrzejewski-Szmek [Tue, 10 Apr 2018 09:23:46 +0000 (11:23 +0200)]
shared/sleep-config: get rid of explicit allocation size calculation

6 years agohwdb: drop a space (#8701)
Evgeny Vereshchagin [Tue, 10 Apr 2018 19:10:52 +0000 (22:10 +0300)]
hwdb: drop a space (#8701)

This should make `parse_hwdb.py` and the CI happy again.

6 years agoMerge pull request #8676 from keszybz/drop-license-boilerplate
Lennart Poettering [Tue, 10 Apr 2018 12:53:31 +0000 (14:53 +0200)]
Merge pull request #8676 from keszybz/drop-license-boilerplate

Drop license boilerplate

6 years agoMerge pull request #8406 from dell/hibernate-disk-offset
Zbigniew Jędrzejewski-Szmek [Tue, 10 Apr 2018 07:53:17 +0000 (09:53 +0200)]
Merge pull request #8406 from dell/hibernate-disk-offset

Add support for setting a disk offset when hibernating

6 years agoAdd override axis for Toshiba Satellite R830 (#8694)
emelenas [Mon, 9 Apr 2018 22:15:25 +0000 (00:15 +0200)]
Add override axis for Toshiba Satellite R830 (#8694)

Incorrect range and resolution for the touchpad at a Toshiba Satellite R830 reported by kernel. After running

$ sudo touchpad-edge-detector 85x50 /dev/input/event4

the new axis overrides are as follows

#Toshiba Satellite R830
evdev:name:SynPS/2 Synaptics TouchPad:dmi:svnTOSHIBA:pnSATELLITER830
EVDEV_ABS_00=1238:5785:53
EVDEV_ABS_01=1045:4826:76
EVDEV_ABS_35=1238:5785:53
EVDEV_ABS_36=1045:4826:76

Those overrides have been tested to work.

6 years agohwdb: add support for VMBUS guids (#8677)
Stephen Hemminger [Mon, 9 Apr 2018 20:25:08 +0000 (13:25 -0700)]
hwdb: add support for VMBUS guids (#8677)

This addresses missing feature on #8677

Devices in Hyper-V/Azure exist on vmbus and are identified by
UUID value. This patch adds a hardware table so that udevadm
can report properties. I chose names are based on the values
reported in Window Device Manager (for consistency).
The table includes several devices that are not used by Linux
but are present and ignored.

For example:

$ udevadm info -q property /sys/bus/vmbus/devices/58f75a6d-d949-4320-99e1-a2a2576d581c
DEVPATH=/devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0004:00/VMBUS:00/58f75a6d-d949-4320-99e1-a2a2576d581c
DRIVER=hid_hyperv
ID_MODEL_FROM_DATABASE=Microsoft Hyper-V Mouse
MODALIAS=vmbus:9eb6a8cf4a5bc04cb98b8ba1a1f3f95a
SUBSYSTEM=vmbus
USEC_INITIALIZED=11076966

Or with updated kernel the driverctl script.

$ driverctl -b vmbus -v list-devices
1eccfd72-4b41-45ef-b73a-4a6e44c12924 hv_balloon (Microsoft Hyper-V Dynamic Memory)
242ff919-07db-4180-9c2e-b86cb68c8c55 hv_util (Microsoft Hyper-V Data Exchange)
2450ee40-33bf-4fbd-892e-9fb06e9214cf hv_util (Microsoft Hyper-V Backup/Restore)
2dd1ce17-079e-403c-b352-a1921ee207ee hv_util (Microsoft Hyper-V Time Sync)
4487b255-b88c-403f-bb51-d1f69cf17f87 (none) (Microsoft Hyper-V Virtual Machine Activation)
53557f8e-057d-425b-9265-01c0fd7e273e hv_netvsc (Microsoft Hyper-V Network Adapter)
5620e0c7-8062-4dce-aeb7-520c7ef76171 hyperv_fb (Microsoft Hyper-V Video)
58f75a6d-d949-4320-99e1-a2a2576d581c hid_hyperv (Microsoft Hyper-V Mouse)
849a776e-8120-4e4a-9a36-7e3d95ac75b3 hv_netvsc (Microsoft Hyper-V Network Adapter)
99221fa0-24ad-11e2-be98-001aa01bbf6e (none) (Microsoft Hyper-V Remote Desktop Control)
b2f44faf-2a29-42ba-91b2-f13fd30a2d4b hv_storvsc (Microsoft Hyper-V SCSI Controller)
b6650ff7-33bc-4840-8048-e0676786f393 hv_util (Microsoft Hyper-V Guest Shutdown)
d34b2567-b9b6-42b9-8778-0a4ec0b955bf hyperv_keyboard (Microsoft Hyper-V Keyboard)
f5bee29c-1741-4aad-a4c2-8fdedb46dcc2 (none) (Microsoft Hyper-V Remote Desktop Virtualization)
fd149e91-82e0-4a7d-afa6-2a4166cbd7c0 hv_util (Microsoft Hyper-V Heartbeat)

6 years agosleep: Move the error level debugging for write_mode and write_state
Mario Limonciello [Thu, 29 Mar 2018 13:56:23 +0000 (08:56 -0500)]
sleep: Move the error level debugging for write_mode and write_state

This makes it more consistent with other code used in the file.

Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
6 years agosleep: Add support for setting a disk offset when hibernating
Mario Limonciello [Thu, 8 Mar 2018 08:41:50 +0000 (02:41 -0600)]
sleep: Add support for setting a disk offset when hibernating

The Linux kernel is adding support for configuring the offset
into a disk.  This allows swapfiles to be more usable as users
will no longer need to set the offset on their kernel command
line.

Use this API in systemd when hibernating as well.

Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
6 years agoMerge pull request #8681 from keszybz/assorted-style-fixes
Lennart Poettering [Mon, 9 Apr 2018 09:32:51 +0000 (11:32 +0200)]
Merge pull request #8681 from keszybz/assorted-style-fixes

Assorted style fixes

6 years agosystemctl: pass BUS_MAP_STRDUP when needed (#8682)
Zbigniew Jędrzejewski-Szmek [Sun, 8 Apr 2018 06:12:18 +0000 (08:12 +0200)]
systemctl: pass BUS_MAP_STRDUP when needed (#8682)

This fixes an assert in "systemctl list-dependencies".
Follow-up for a7e4861c7471bfe563078d11acbcecbf2d755462.

6 years agotime-sync-wait: trivial style fixes
Zbigniew Jędrzejewski-Szmek [Sat, 7 Apr 2018 17:19:49 +0000 (19:19 +0200)]
time-sync-wait: trivial style fixes

6 years agosd-event: use _cleanup_ to manage temporary references
Zbigniew Jędrzejewski-Szmek [Sat, 7 Apr 2018 17:14:37 +0000 (19:14 +0200)]
sd-event: use _cleanup_ to manage temporary references

6 years agoanalyze: give a hint what is it means that boot is still active
Zbigniew Jędrzejewski-Szmek [Sat, 7 Apr 2018 16:43:47 +0000 (18:43 +0200)]
analyze: give a hint what is it means that boot is still active

$ build/systemd-analyze time
Bootup is not yet finished (org.freedesktop.systemd1.Manager.FinishTimestampMonotonic=0).
Please try again later.
Hint: Use 'systemctl list-jobs' to see active jobs

6 years agocore: minor comment update
Zbigniew Jędrzejewski-Szmek [Wed, 4 Apr 2018 12:36:56 +0000 (14:36 +0200)]
core: minor comment update

6 years agodissect: drop unnecessary parenthesis
Zbigniew Jędrzejewski-Szmek [Wed, 4 Apr 2018 07:05:56 +0000 (09:05 +0200)]
dissect: drop unnecessary parenthesis

6 years agoanalyze: Do no require a full d-bus bus for the plot command (#8539)
Guillem Jover [Sat, 7 Apr 2018 18:02:20 +0000 (20:02 +0200)]
analyze: Do no require a full d-bus bus for the plot command (#8539)

The plot command requires a full d-bus bus to fetch the host
information, which seems rather optional, and having a running dbus
daemon is not always desirable. So instead, we try to acquire a full
bus, and if that fails we acquire the systemd bus, in which case we
omit the host information from the output.

We refactor acquire_bus() into two new functions which in addition
makes the call sites clearer.

6 years agosystemd-udevd: limit children-max by available memory (#8668)
Martin Wilck [Sat, 7 Apr 2018 15:33:48 +0000 (17:33 +0200)]
systemd-udevd: limit children-max by available memory (#8668)

Udev workers consume typically 50-100MiB virtual memory.
On systems with lots of CPUs and relatively low memory, that may
easily cause workers to be OOM-killed.

This patch limits the number of workers to 8 per GiB memory.
But don't let the limit drop below the smallest value we had
without this patch (8 + 1 * 2 = 10); on small systems, udev's
memory footprint is likely lower.

6 years agoClarify checker/helper in systemd-fsck@.service manpage (#8674)
Brian J. Murrell [Sat, 7 Apr 2018 15:12:26 +0000 (11:12 -0400)]
Clarify checker/helper in systemd-fsck@.service manpage (#8674)

Clarify the helper/checker terminology in the systemd-fsck@.service manpage to
make the description more clear about what is responsible for deciding if a filesystem
needs checking.

6 years agosrc/network: add missing SPDX identifiers
Zbigniew Jędrzejewski-Szmek [Fri, 6 Apr 2018 17:02:13 +0000 (19:02 +0200)]
src/network: add missing SPDX identifiers

6 years agotree-wide: drop license boilerplate
Zbigniew Jędrzejewski-Szmek [Fri, 6 Apr 2018 16:58:55 +0000 (18:58 +0200)]
tree-wide: drop license boilerplate

Files which are installed as-is (any .service and other unit files, .conf
files, .policy files, etc), are left as is. My assumption is that SPDX
identifiers are not yet that well known, so it's better to retain the
extended header to avoid any doubt.

I also kept any copyright lines. We can probably remove them, but it'd nice to
obtain explicit acks from all involved authors before doing that.

6 years agofuzz-unit-file: allow a space between variable name and "=" (#8670)
Zbigniew Jędrzejewski-Szmek [Fri, 6 Apr 2018 09:36:17 +0000 (11:36 +0200)]
fuzz-unit-file: allow a space between variable name and "=" (#8670)

The parser allows that, so the check when to skip needs this too.

https://oss-fuzz.com/v2/issue/5106486364602368/7422

6 years agoMerge pull request #8663 from poettering/dissect-tighten
Zbigniew Jędrzejewski-Szmek [Fri, 6 Apr 2018 08:14:25 +0000 (10:14 +0200)]
Merge pull request #8663 from poettering/dissect-tighten

Small fixes for image dissection code.

6 years agocore/device: remove unnecessary check (#8661)
Yu Watanabe [Fri, 6 Apr 2018 06:45:13 +0000 (15:45 +0900)]
core/device: remove unnecessary check (#8661)

Follow-up for 0dfb0a0abd98f8726a39f26e4d737f47ec0fd53b.

6 years agonspawn: wait for network namespace creation before interface setup (#8633)
Philip Sequeira [Thu, 5 Apr 2018 14:04:27 +0000 (14:04 +0000)]
nspawn: wait for network namespace creation before interface setup (#8633)

Otherwise, network interfaces can be "moved" into the container's
namespace while it's still the same as the host namespace, in which case
e.g. host0 for a veth ends up on the host side instead of inside the
container.

Regression introduced in 0441378080489e4ab6704cd0a2d78cb1ceaca899.

Fixes #8599.

6 years agoMerge pull request #8662 from poettering/rfkill-enxio
Zbigniew Jędrzejewski-Szmek [Thu, 5 Apr 2018 11:20:38 +0000 (13:20 +0200)]
Merge pull request #8662 from poettering/rfkill-enxio

handle ENODEV and ENXIO gracefully in rfkill

6 years agodissect: when pulling metadata from an image, don't bother with /home or ESP
Lennart Poettering [Thu, 5 Apr 2018 11:15:43 +0000 (13:15 +0200)]
dissect: when pulling metadata from an image, don't bother with /home or ESP

When we try to read meta-data from an image, don't bother with mounting
/home or the ESP, as that's not where the metadata is. This not only
speeds things up a bit, but also has the benefit that setups where an
unencrypted root is mixed with an encrypted /home (which I have on one
of my own systems) won't result in errors that the crypto key is needed.

6 years agoupdate TODO
Lennart Poettering [Thu, 5 Apr 2018 11:07:31 +0000 (13:07 +0200)]
update TODO

6 years agojournald: bump rate limits (#8660)
David Tardon [Thu, 5 Apr 2018 11:06:59 +0000 (13:06 +0200)]
journald: bump rate limits (#8660)

Apparently, it is quite common to hit a problem, where systemd-journald
would drop messages because service is logging too fast.

6 years agodissect: tighten block device checks a bit
Lennart Poettering [Thu, 5 Apr 2018 11:03:37 +0000 (13:03 +0200)]
dissect: tighten block device checks a bit

This extends on #8609, and makes two changes:

1. We'll now explicitly check that the child devices of a block device
   we are interested in (i.e. the partitions) are block devices themselves.
   On newer kernels the mmc rpmb stuff is actually exposed as char rather
   than block device as before, and they probably should have been that in
   the first place. By adding this check we'll hence filter out these weird
   devices through a second rule too, that hopefully makes things a bit
   more future-proof, should more devices like this be added eventually,
   or other subsystems do a similar thing.

2. When counting partitions we'll now also check the devnum of the
   device being non-null, which we already do when matching up the devices
   in the second iteration. This should make things more robust, and
   prevent other kinds of miscounting, which after all was the main
   issue #8609 fixed.

6 years agorfkill: treat ENXIO/ENODEV the same way as ENOENT
Lennart Poettering [Thu, 5 Apr 2018 10:43:08 +0000 (12:43 +0200)]
rfkill: treat ENXIO/ENODEV the same way as ENOENT

If an rfkill device disappears between the time we get notified about
the existance and we fully opened it we might get ENXIO or ENODEV (i.e.
the two kinds of "device not found" errors, which are typically
generated when for example a device node has no actual backing device
behind it). let's handle that the same way as ENOENT, and downgrade the
log message to LOG_DEBUG.

Fixes: #8586

6 years agorfkill: use our usual style for writing destructors
Lennart Poettering [Thu, 5 Apr 2018 10:42:47 +0000 (12:42 +0200)]
rfkill: use our usual style for writing destructors

Let's accept NULL values gracefully, and let's return NULL.

6 years agoMerge pull request #8617 from keszybz/tmpfiles-relax
Lennart Poettering [Thu, 5 Apr 2018 09:54:02 +0000 (11:54 +0200)]
Merge pull request #8617 from keszybz/tmpfiles-relax

Do not exit with error when systemd-tmpfiles --boot fails

6 years agoMerge pull request #8656 from yuwata/random-fixes
Lennart Poettering [Thu, 5 Apr 2018 08:19:12 +0000 (10:19 +0200)]
Merge pull request #8656 from yuwata/random-fixes

use TAKE_PTR() and TAKE_FD() macros, and small fixes

6 years agotmpfiles: ignore "operational" errors during setup
Zbigniew Jędrzejewski-Szmek [Thu, 29 Mar 2018 14:37:21 +0000 (16:37 +0200)]
tmpfiles: ignore "operational" errors during setup

We still get the errors logged, but we don't fail the service. This
is better for users because rerunning tmpfiles-setup.service a second
time is dangerous (c.f. cd9f5b68ce08375eb1d68a4ddaa7a24a5092d7ba).
Note that this only touches sd-tmpfiles-setup.service and
sd-tmpfiles-setup-dev.service. sd-tmpfiles-clean.service is as before.

https://bugzilla.redhat.com/show_bug.cgi?id=1539341

6 years agotmpfiles: add a new return code for "operational failure" when processing
Zbigniew Jędrzejewski-Szmek [Thu, 29 Mar 2018 14:19:33 +0000 (16:19 +0200)]
tmpfiles: add a new return code for "operational failure" when processing

Things can fail, and we have no control over it:
- file system issues (immutable bits, file system errors, MAC refusals, etc)
- kernel refusing certain arguments when writing to /proc/sys or /sys
Let's add a new code for the case where we parsed configuration but failed
to execute it because of external errors.

6 years agocore/device: trivial simplification
Yu Watanabe [Thu, 5 Apr 2018 05:24:59 +0000 (14:24 +0900)]
core/device: trivial simplification

6 years agotree-wide: use TAKE_PTR() and TAKE_FD() macros
Yu Watanabe [Thu, 5 Apr 2018 05:26:26 +0000 (14:26 +0900)]
tree-wide: use TAKE_PTR() and TAKE_FD() macros

6 years agonetwork: fix typo in log message
Yu Watanabe [Wed, 4 Apr 2018 15:33:22 +0000 (00:33 +0900)]
network: fix typo in log message

6 years agomeson: sort source files
Yu Watanabe [Tue, 3 Apr 2018 07:19:25 +0000 (16:19 +0900)]
meson: sort source files

6 years agobus-util: fix a meaningless assertion
Yu Watanabe [Thu, 29 Mar 2018 12:20:30 +0000 (21:20 +0900)]
bus-util: fix a meaningless assertion

6 years agoMerge pull request #8605 from poettering/drop-in-name-fix
Zbigniew Jędrzejewski-Szmek [Wed, 4 Apr 2018 09:52:14 +0000 (11:52 +0200)]
Merge pull request #8605 from poettering/drop-in-name-fix

Fix validation of unit file drop-in naming in install.c.

6 years agotest-path: Set umask explicitly (#8616)
Filipe Brandenburger [Wed, 4 Apr 2018 09:17:19 +0000 (02:17 -0700)]
test-path: Set umask explicitly (#8616)

Running `test-path` under an umask such as 027 fails with:

  Assertion '(s.st_mode & S_IRWXO) == 0004' failed at ../src/test/test-path.c:247, function test_path_makedirectory_directorymode(). Aborting.

Looking at directory /tmp/test-path_makedirectory, it was indeed created
with mode 0740, applying the umask to the requested 0744.

Set an explicit umask for this test, to ensure reproducible results.

6 years agounits: use `systemctl exit` to kill the user manager (#8648)
Filipe Brandenburger [Wed, 4 Apr 2018 09:14:37 +0000 (02:14 -0700)]
units: use `systemctl exit` to kill the user manager (#8648)

Use `systemctl --user --force exit` to implement the systemd-exit
user service.

This removes our dependence on an external `kill` binary and the
concerns about whether they recognize SIGRTMIN+n by name or what their
interpretation of SIGRTMIN is.

Tested: `systemctl --user start systemd-exit.service` kills the
  `systemd --user` instance for my user.

6 years agofix missed bracket of exec-personality-ppc64le.service (#8650)
Feng Sun [Wed, 4 Apr 2018 09:10:42 +0000 (17:10 +0800)]
fix missed bracket of exec-personality-ppc64le.service (#8650)

Signed-off-by: Neil Sun <neilsun@yunify.com>
6 years agoMerge pull request #8624 from yuwata/fix-8371
Zbigniew Jędrzejewski-Szmek [Wed, 4 Apr 2018 07:39:10 +0000 (09:39 +0200)]
Merge pull request #8624 from yuwata/fix-8371

bash-completion: fixes for busctl

6 years agooss-fuzz: Fallback to `ninja-build` when available (#8641)
Filipe Brandenburger [Wed, 4 Apr 2018 07:32:59 +0000 (00:32 -0700)]
oss-fuzz: Fallback to `ninja-build` when available (#8641)

The ninja binary is deployed as `ninja-build` in older distros such as
RHEL 7/CentOS 7.  Detect that and use `ninja-build` instead of `ninja`
when it's available.

6 years agoMerge pull request #8643 from poettering/coding-style-fixlets
Evgeny Vereshchagin [Tue, 3 Apr 2018 23:13:05 +0000 (02:13 +0300)]
Merge pull request #8643 from poettering/coding-style-fixlets

Trivial CODING_STYLE additions

6 years agoCODING_STYLE: document suggested suffixes to use in documentation
Lennart Poettering [Thu, 29 Mar 2018 14:28:21 +0000 (16:28 +0200)]
CODING_STYLE: document suggested suffixes to use in documentation

6 years agoCODING_STYLE: two minor additions
Lennart Poettering [Thu, 29 Mar 2018 14:28:00 +0000 (16:28 +0200)]
CODING_STYLE: two minor additions

6 years agoCODING_STYLE: mention that we ship .editconfig/.vimrc/.dir-locals.el in our repo
Lennart Poettering [Thu, 29 Mar 2018 14:27:45 +0000 (16:27 +0200)]
CODING_STYLE: mention that we ship .editconfig/.vimrc/.dir-locals.el in our repo

6 years agoupdate TODO
Lennart Poettering [Thu, 29 Mar 2018 15:47:03 +0000 (17:47 +0200)]
update TODO

6 years agotmpfiles: fix directory removal with force symlink (#8619)
Ricardo Salveti de Araujo [Tue, 3 Apr 2018 13:05:11 +0000 (10:05 -0300)]
tmpfiles: fix directory removal with force symlink (#8619)

symlink_atomic returns -EISDIR when the target symlink path is a
directory.

Fixes #7447

Signed-off-by: Ricardo Salveti <ricardo@opensourcefoundries.com>
6 years agocore: skip the removal of cgroups in the TEST_RUN_MINIMAL mode (#8622)
Evgeny Vereshchagin [Tue, 3 Apr 2018 13:04:22 +0000 (16:04 +0300)]
core: skip the removal of cgroups in the TEST_RUN_MINIMAL mode (#8622)

When `systemd` is run in the TEST_RUN_MINIMAL mode, it doesn't really
set up cgroups, so it shouldn't try to remove anything.

Closes https://github.com/systemd/systemd/issues/8474.

6 years agodissect: Don't count RPMB and boot partitions (#8609)
João Paulo Rechi Vita [Tue, 3 Apr 2018 12:51:18 +0000 (05:51 -0700)]
dissect: Don't count RPMB and boot partitions (#8609)

Filter-out RPMB partitions and boot partitions from MMC devices when
counting partitions enumerated by the kernel. Also factor out the now
duplicated code into a separate function.

This complement the previous fixes to the problem reported in
https://github.com/systemd/systemd/issues/5806

6 years agoMerge pull request #8628 from jwrdegoede/hwdb-sensors2
Lennart Poettering [Tue, 3 Apr 2018 12:49:39 +0000 (14:49 +0200)]
Merge pull request #8628 from jwrdegoede/hwdb-sensors2

Hwdb sensors2

6 years agoman: machinectl: update fedora exmple URL (#8642)
Radostin Stoyanov [Tue, 3 Apr 2018 03:06:53 +0000 (04:06 +0100)]
man: machinectl: update fedora exmple URL (#8642)

6 years agococcinelle: fix typo in file name (#8640)
Alexander Kurtz [Mon, 2 Apr 2018 14:30:26 +0000 (16:30 +0200)]
coccinelle: fix typo in file name (#8640)

6 years agoMerge pull request #8626 from floppym/initctl
Lennart Poettering [Sat, 31 Mar 2018 10:56:58 +0000 (12:56 +0200)]
Merge pull request #8626 from floppym/initctl

sysvinit-2.89 compatibility fixes

6 years agogenerate-af-list.sh: slightly generalize pattern, fix w/musl (#8629)
Will Dietz [Sat, 31 Mar 2018 10:55:45 +0000 (05:55 -0500)]
generate-af-list.sh: slightly generalize pattern, fix w/musl (#8629)

Accept definitions to other AF_ constants, not just PF_ ones,
such as:

  #define AF_LINUX AF_LOCAL

It may not be necessary to impose any restriction on the
definitions of the macros extracted, but for now
keep most of that requirement but match AF_* as well.

6 years agohwdb: Add accelerometer orientation quirk for the Pipo W4 tablet
Hans de Goede [Fri, 30 Mar 2018 21:39:29 +0000 (23:39 +0200)]
hwdb: Add accelerometer orientation quirk for the Pipo W4 tablet

Add an accelerometer orientation quirk for the Pipo W4 tablet.

6 years agosystemctl: try opening /run/initctl before /dev/initctl
Mike Gilbert [Fri, 30 Mar 2018 15:04:57 +0000 (11:04 -0400)]
systemctl: try opening /run/initctl before /dev/initctl

This ensures compatability with old/new sysvinit.

http://git.savannah.nongnu.org/cgit/sysvinit.git/commit/?id=80dbcf3de3c1b83aeaa713a8fe5b8d35d8649af2

6 years agounits: initctl: move the fifo to /run/initctl to match sysvinit
Mike Gilbert [Fri, 30 Mar 2018 15:00:17 +0000 (11:00 -0400)]
units: initctl: move the fifo to /run/initctl to match sysvinit

The fifo location was moved in sysvinit-2.89.

http://git.savannah.nongnu.org/cgit/sysvinit.git/commit/?id=80dbcf3de3c1b83aeaa713a8fe5b8d35d8649af2

6 years agohwdb: Add accelerometer orientation quirk for the Lenovo Ideapad Miix 310
Hans de Goede [Fri, 30 Mar 2018 18:00:27 +0000 (20:00 +0200)]
hwdb: Add accelerometer orientation quirk for the Lenovo Ideapad Miix 310

Add an accelerometer orientation quirk for the Lenovo Ideapad Miix 310.
Note this quirk is limited to the production batches which ship with a
portrait panel, rather then with a landscape panel (recognized by the
different BIOS version these 2 variants use).

6 years agohwdb: Add accelerometer orientation quirk for the MSI S100 2-in-1
Hans de Goede [Fri, 30 Mar 2018 15:10:21 +0000 (17:10 +0200)]
hwdb: Add accelerometer orientation quirk for the MSI S100 2-in-1

Add an accelerometer orientation quirk for the MSI S100 2-in-1.

6 years agohwdb: Add accelerometer orientation quirk for the Yours Y8W81 tablet
Hans de Goede [Fri, 9 Mar 2018 13:55:11 +0000 (14:55 +0100)]
hwdb: Add accelerometer orientation quirk for the Yours Y8W81 tablet

Add an accelerometer orientation quirk for the Yours Y8W81 8" tablet.

For future reference: this tablet has the same case and mostly the same
internals as the Chuwi Vi8. Both seem to be from an ODM called inet-tek.
Both are labelled: "INET-I86M-REVxx" on the PCB, with the Chuwi Vi8 being
REV03 (and having a ALC5640 audio codec) and the Yours Y8W81 being REV21
(and having a ALC5651 audio codec).

6 years agohwdb: Add accelerometer orientation entry for the I.T.Works TW701 tablet
Hans de Goede [Sun, 18 Feb 2018 20:42:43 +0000 (21:42 +0100)]
hwdb: Add accelerometer orientation entry for the I.T.Works TW701 tablet

Add accelerometer orientation entry for the I.T.Works TW701 7"
windows tablet, note this is the same hardware/PCB as the Trekstor
ST70416-6 for which we already have the same quirk.

6 years agohwdb: 60-sensors: Fix alphabetic sorting by vendor name
Hans de Goede [Fri, 9 Mar 2018 13:50:04 +0000 (14:50 +0100)]
hwdb: 60-sensors: Fix alphabetic sorting by vendor name

The Cytrix entry was added at the end instead of sorted alphabetically
by vendor name.

6 years agobash-completion: busctl: make variables local
Yu Watanabe [Fri, 30 Mar 2018 08:13:52 +0000 (17:13 +0900)]
bash-completion: busctl: make variables local

6 years agobash-completion: busctl: do not suggest "-" for signature
Yu Watanabe [Fri, 30 Mar 2018 08:08:11 +0000 (17:08 +0900)]
bash-completion: busctl: do not suggest "-" for signature

Fixes #8371.

6 years agobash-completion: busctl: suggests only writable properties for set-property
Yu Watanabe [Fri, 30 Mar 2018 08:06:50 +0000 (17:06 +0900)]
bash-completion: busctl: suggests only writable properties for set-property

6 years agotimesync: on network event do not establish connection when NTP servers are not chang...
Yu Watanabe [Thu, 29 Mar 2018 14:15:56 +0000 (23:15 +0900)]
timesync: on network event do not establish connection when NTP servers are not changed (#8611)

Fixes #8603.

6 years agosd-bus: allow description to be set for system/user busses (#8594)
Zbigniew Jędrzejewski-Szmek [Thu, 29 Mar 2018 14:14:11 +0000 (16:14 +0200)]
sd-bus: allow description to be set for system/user busses (#8594)

sd_bus_open/sd_bus_open_system/sd_bus_open_user are convenient, but
don't allow the description to be set. After they return, the bus is
is already started, and sd_bus_set_description() fails with -EBUSY.
It would be possible to allow sd_bus_set_description() to update the
description "live", but messages are already emitted from sd_bus_open
functions, so it's better to allow the description to be set in
sd_bus_open/sd_bus_open_system/sd_bus_open_user.

Fixes message like:
Bus n/a: changing state UNSET → OPENING

6 years agobus-unit-util: one less newline
Lennart Poettering [Thu, 29 Mar 2018 13:36:07 +0000 (15:36 +0200)]
bus-unit-util: one less newline

6 years agoinstall: don't enforce that .d/ dropin files (and their symlink chain elements) for...
Lennart Poettering [Wed, 28 Mar 2018 14:44:19 +0000 (16:44 +0200)]
install: don't enforce that .d/ dropin files (and their symlink chain elements) for units must have names that qualify as unit names

The names of drop-in files can be anything as long as they are suffixed
in ".conf", hence don't be stricter than necessary when validating the
names used in symlink chains of such drop-in files.

Also, drop-in files should not be ale to change the type of unit file
itself, i.e. not affect whether it is considered masked or an alias as a
whole.

This adds a flag SEARCH_DROPIN that is passed whenever we load a drop-in
rather the main unit file, and in that case loosen checks and behaviour
we otherwise enforce for the unit file itself. Specifically:

1. If SEARCH_DROPIN is passed we won't change the unit's info->type
   field anymore, as that field (which can be REGULAR, MASKED, SYMLINK)
   should not be affected by drop-ins, but only by the unit file itself.

2. If SEARCH_DROPIN is passed we will shortcut following of symlink
   chains, and not validate the naming of each element in the chain,
   since that's irrelevant for drop-ins, and only matters for the unit
   file itself.

Or in other words, without this:

1. A symlink /etc/systemd/system/foobar.service.d/20-quux.conf →
   /dev/null might have caused the whole of foobar.service to be
   considered "masked".

2. A symlink /etc/systemd/system/foobar.service.d/20-quux.conf →
   /tmp/miepf might have caused the whole loading of foobar.service to
   fail as EINVAL, as "miepf" is not a valid unit name.

6 years agofs-util: add shortcut for chase_symlinks() when it is called like open(O_PATH)
Lennart Poettering [Mon, 26 Mar 2018 14:34:54 +0000 (16:34 +0200)]
fs-util: add shortcut for chase_symlinks() when it is called like open(O_PATH)

Let's optimize things, and let the kernel chase the paths if none of the
features chase_symlinks() offers are actually used.

6 years agodissect: port code to chase_symlinks_and_open()
Lennart Poettering [Mon, 26 Mar 2018 17:22:16 +0000 (19:22 +0200)]
dissect: port code to chase_symlinks_and_open()

6 years agofs-util: add calls that combine chase_symlinks() and open()/opendir() in one
Lennart Poettering [Mon, 26 Mar 2018 12:15:43 +0000 (14:15 +0200)]
fs-util: add calls that combine chase_symlinks() and open()/opendir() in one

This is useful when opening files within disk images, as we'll then take
the relative root directory properly into account.

6 years agofd-util: introduce fd_reopen() helper for reopening an fd
Lennart Poettering [Mon, 26 Mar 2018 11:25:51 +0000 (13:25 +0200)]
fd-util: introduce fd_reopen() helper for reopening an fd

We have the same code for this in place at various locations, let's
unify that. Also, let's repurpose test-fs-util.c as a test for this new
helper cal..

6 years agotree-wide: remove unused variables (#8612)
Yu Watanabe [Thu, 29 Mar 2018 10:50:50 +0000 (19:50 +0900)]
tree-wide: remove unused variables (#8612)

6 years agoMerge pull request #8606 from dell/rename-suspend-to-hibernate
Zbigniew Jędrzejewski-Szmek [Thu, 29 Mar 2018 10:30:18 +0000 (12:30 +0200)]
Merge pull request #8606 from dell/rename-suspend-to-hibernate

Rename suspend-to-hibernate to suspend-then-hibernate

6 years agoMerge pull request #8607 from poettering/trivialities2
Yu Watanabe [Thu, 29 Mar 2018 04:24:11 +0000 (13:24 +0900)]
Merge pull request #8607 from poettering/trivialities2

tiny, trivial, unrelated fixes

6 years agotests: run `udevadm settle` after `sfdisk` (#8610)
Evgeny Vereshchagin [Thu, 29 Mar 2018 04:20:57 +0000 (07:20 +0300)]
tests: run `udevadm settle` after `sfdisk` (#8610)

This makes the script wait for the newly created partition to
show up before trying to put a filesystem on it, which should
prevent the tests from failing with the following error:
```
New situation:
Disklabel type: dos
Disk identifier: 0x3541a0ec

Device       Boot  Start    End Sectors  Size Id Type
/dev/loop6p1        2048 800767  798720  390M 83 Linux
/dev/loop6p2      800768 819199   18432    9M 83 Linux

The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
The file /dev/loop6p1 does not exist and no size was specified.
make: *** [setup] Error 1
F: Failed to mkfs -t ext4
Makefile:4: recipe for target 'setup' failed
```

6 years agoFix description on suspend-then-hibernate units.
Mario Limonciello [Wed, 28 Mar 2018 20:13:49 +0000 (15:13 -0500)]
Fix description on suspend-then-hibernate units.

Suspend; Idle into hibernate didn't make sense.

6 years agoRename suspend-to-hibernate to suspend-then-hibernate
Mario Limonciello [Wed, 28 Mar 2018 16:00:06 +0000 (11:00 -0500)]
Rename suspend-to-hibernate to suspend-then-hibernate

Per some discussion with Gnome folks, they would prefer this name
as it's more descriptive of what's happening.

6 years agomachine-image,mount-setup: minor coding style fixes
Lennart Poettering [Wed, 28 Mar 2018 15:07:42 +0000 (17:07 +0200)]
machine-image,mount-setup: minor coding style fixes

6 years agoman: remove spurious 'system'
Lennart Poettering [Wed, 28 Mar 2018 15:07:11 +0000 (17:07 +0200)]
man: remove spurious 'system'

6 years agoinhibit: make use of EXIT_SUCCESS where appropriate
Lennart Poettering [Tue, 27 Mar 2018 12:58:21 +0000 (14:58 +0200)]
inhibit: make use of EXIT_SUCCESS where appropriate

6 years agoutil: check for overflows in xbsearch_r()
Lennart Poettering [Tue, 27 Mar 2018 12:56:04 +0000 (14:56 +0200)]
util: check for overflows in xbsearch_r()

6 years agojournald: make use of fd_get_path() where appropriate
Lennart Poettering [Mon, 26 Mar 2018 11:27:26 +0000 (13:27 +0200)]
journald: make use of fd_get_path() where appropriate

6 years agoupdate TODO
Lennart Poettering [Tue, 20 Mar 2018 19:26:15 +0000 (20:26 +0100)]
update TODO

6 years agoCODING_STYLE: document why O_NONBLOCK makes sense when opening regular files, too
Lennart Poettering [Fri, 9 Mar 2018 20:35:48 +0000 (21:35 +0100)]
CODING_STYLE: document why O_NONBLOCK makes sense when opening regular files, too

6 years agosystemd-inhibit: ignore signal interrupt from keyboard (#8569)
Christian Hesse [Wed, 28 Mar 2018 19:58:10 +0000 (21:58 +0200)]
systemd-inhibit: ignore signal interrupt from keyboard (#8569)

By default both processes, systemd-inhibit and the forked one, receive
the signals. Pressing Ctrl+C on the keyboard results in SIGINT being
sent to the processes, followed by SIGTERM being sent to the forked
process when systemd-inhibit exits. This can cause trouble when the
forked process does not clean up properly but exit immediately.

Instead make systemd-inhibit ignore SIGINT, leaving it to the forked
process to clean up and exit.