Commit Graph

42763 Commits

Author SHA1 Message Date
Lennart Poettering 31ca5166b6 man: document /var/tmp/ and /var/ handling in systemd-gpt-auto-generator man page
And some other fixes and additions.
2019-12-23 14:44:48 +01:00
Lennart Poettering 19ac32cdd6 docs: import discoverable partitions spec
This was previously available here:

https://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/

Let's pull it into our repository.
2019-12-23 14:44:33 +01:00
Lennart Poettering d4dffb8533 dissect: introduce new recognizable partition types for /var and /var/tmp
This has been requested many times before. Let's add it finally.

GPT auto-discovery for /var is a bit more complex than for other
partition types: the other partitions can to some degree be shared
between multiple OS installations on the same disk (think: swap, /home,
/srv). However, /var is inherently something bound to an installation,
i.e. specific to its identity, or actually *is* its identity, and hence
something that cannot be shared.

To deal with this this new code is particularly careful when it comes to
/var: it will not mount things blindly, but insist that the UUID of the
partition matches a hashed version of the machine-id of the
installation, so that each installation has a very specific /var
associated with it, and would never use any other. (We actually use
HMAC-SHA256 on the GPT partition type for /var, keyed by the machine-id,
since machine-id is something we want to keep somewhat private).

Setting the right UUID for installations takes extra care. To make
things a bit simpler to set up, we avoid this safety check for nspawn
and RootImage= in unit files, under the assumption that such container
and service images unlikely will have multiple installations on them.
The check is hence only required when booting full machines, i.e. in
in systemd-gpt-auto-generator.

To help with putting together images for full machines, PR #14368
introduces a repartition tool that can automatically fill in correctly
calculated UUIDs on first boot if images have the var partition UUID
initialized to all zeroes. With that in place systems can be put
together in a way that on first boot the machine ID is determined and
the partition table automatically adjusted to have the /var partition
with the right UUID.
2019-12-23 14:43:59 +01:00
Yu Watanabe 4171837be6 bash-completion: move shell-completion for log-level or friends to systemctl 2019-12-21 19:23:02 +01:00
Zbigniew Jędrzejewski-Szmek 1234d0f63e
Merge pull request #14409 from poettering/shutdown-modernization
some smaller modernizations to the shutdown loop
2019-12-21 19:21:10 +01:00
Yu Watanabe 3c4ddf5db5
Merge pull request #14407 from ssahani/dhcp-decline
network: DHCP4 introduce send decline
2019-12-21 08:40:22 +09:00
Lennart Poettering 4ca8072fd6 umount: when we fail to detach a loopback device, set the auto-clear flag
We might get lucky and this cleans up things later on automatically for
us.
2019-12-20 18:37:24 +01:00
Lennart Poettering b877c3b06f umount: check LO_FLAGS_AUTOCLEAR after LOOP_CLR_FD claimed success
Fixes: #14410
Replaces: #14386
2019-12-20 18:16:05 +01:00
Lennart Poettering 63135a2d8d umount: detect root loopback device the same way as we detect root DM devices
get_block_device() is just the nicer way to do it (since it also odes
btrfs). Also, let's already collect the dev_t of the loopback device
when we enumerate things, that allows us to do the checks simpler
without constantly stat()ing things over and over again.
2019-12-20 18:16:02 +01:00
Lennart Poettering 88287615e6 umount: show correct error message
We fucked up errno vs. r two times, let's correct that.

While we are at it, let's handle the error first, like we usually do,
and the clean case without indentation.
2019-12-20 18:15:59 +01:00
Lennart Poettering 610f9a42c4 umount: remove unneeded variable 2019-12-20 18:15:56 +01:00
Lennart Poettering 49f80dcec8 umount: line break comments again
break them like we usually do, taking our intended line width into
account.
2019-12-20 18:15:47 +01:00
Lennart Poettering b895fa08e6 Revert "Drop dbus activation stub service"
This reverts commit 07125d24ee.

In contrast to what is claimed in #13396 dbus-broker apparently does
care for the service file to be around, and otherwise will claim
"Service Not Activatable" in the time between systemd starting up the
broker and connecting to it, which the stub service file is supposed to
make go away.

Reverting this makes the integration test suite pass again on host with
dbus-broker (i.e. current Fedora desktop).

Tested with dbus-broker-21-6.fc31.x86_64.
2019-12-20 17:28:12 +01:00
Yu Watanabe 0fd8b71809 test-network: add a test case for DHCPv4.SendDecline= 2019-12-21 00:26:44 +09:00
Yu Watanabe c1d3fa29ca network: link should not become configured state during ACD probing 2019-12-21 00:26:44 +09:00
Susant Sahani 0f3ff4eae2 network: DHCP4 introduce send decline 2019-12-21 00:26:44 +09:00
Lennart Poettering 1cb342447d
Merge pull request #14329 from anitazha/user_invocation_id
export user units' InvocationID and use as _SYSTEMD_INVOCATION_ID
2019-12-20 10:20:21 +01:00
Yu Watanabe 7c6d95ea5a network: fix typo 2019-12-20 18:00:49 +09:00
Anita Zhang 2f8c48b605 core,journal: export user units' InvocationID and use as _SYSTEMD_INVOCATION_ID
Write a user unit's invocation ID to /run/user/<uid>/systemd/units/ similar
to how a system unit's invocation ID is written to /run/systemd/units/.

This lets the journal read and add a user unit's invocation ID to the
_SYSTEMD_INVOCATION_ID field of logs instead of the user manager's
invocation ID.

Fixes #12474
2019-12-19 17:42:17 -08:00
Lennart Poettering 10ad50d38c
Merge pull request #14378 from keszybz/unit-docs
Unit documentation and build-system tweaks
2019-12-19 19:00:14 +01:00
Yu Watanabe 509b06ffdd network: update log message in message_rtnl_process_xyz()
Also lower the log level when the family is not supported.
2019-12-19 18:58:45 +01:00
Zbigniew Jędrzejewski-Szmek 277519db51 man: add section about user manager units 2019-12-19 13:32:31 +01:00
Zbigniew Jędrzejewski-Szmek f71502c49f man: add remote-*.targets to the bootup sequence
I think this makes it easier to see the difference between local and remote
mounts.

Make the graph a bit narrower while at it.
2019-12-19 13:32:31 +01:00
Lennart Poettering 9e7c8f64cf time-util: also use 32bit hack on EOVERFLOW
As per
https://github.com/systemd/systemd/issues/14362#issuecomment-566722686
let's also prepare for EOVERFLOW.
2019-12-19 12:46:24 +01:00
Lennart Poettering 17ef83b231
Merge pull request #14388 from anitazha/man_uid_updates
man: document uids for user journals
2019-12-19 12:45:59 +01:00
Lennart Poettering 222633b646
Merge pull request #13823 from anitazha/unpriv_privateusers
core: PrivateUsers=true for (unprivileged) user managers
2019-12-19 12:03:06 +01:00
Zbigniew Jędrzejewski-Szmek 4186441bbd Revert "cryptsetup: umount encrypted devices before detaching it during shutdown"
This reverts commit 362c378291.

This commit introduced an ordering loop: remote-cryptsetup.target was both
before and after remote-fs-pre.target. It also globally ordered all cryptsetup
volumes before all mounts. Such global ordering is problematic if people have
stacked storage. Let's look for a different solution.

See https://github.com/systemd/systemd/pull/14378#discussion_r359460109.
2019-12-19 10:42:14 +01:00
Anita Zhang 9a1b3902ad
Merge pull request #14382 from topimiettinen/fix-analyze-security-rootimage
analyze: badness if neither of RootImage and RootDirectory exists
2019-12-18 16:21:36 -08:00
Anita Zhang a1533ad73f [man] note which UID ranges will get user journals
Fixes #13926
2019-12-18 16:12:43 -08:00
Anita Zhang d59fc29bb7 [man] fix URL 2019-12-18 16:08:53 -08:00
Anita Zhang b6657e2c53 test: add test case for PrivateDevices=y and Group=daemon
For root, group enforcement needs to come after PrivateDevices=y set up
according to 096424d123. Add a test to
verify this is the case.
2019-12-18 11:09:30 -08:00
Anita Zhang e5f10cafe0 core: create inaccessible nodes for users when making runtime dirs
To support ProtectHome=y in a user namespace (which mounts the inaccessible
nodes), the nodes need to be accessible by the user. Create these paths and
devices in the user runtime directory so they can be used later if needed.
2019-12-18 11:09:30 -08:00
Filipe Brandenburger a49ad4c482 core: add test case for PrivateUsers=true in user manager
The test exercises that PrivateTmp=yes and ProtectHome={read-only,tmpfs}
directives work as expected when PrivateUsers=yes in a user manager.

Some code is also added to test-functions to help set up test cases that
exercise the user manager.
2019-12-18 11:09:30 -08:00
Anita Zhang 5749f855a7 core: PrivateUsers=true for (unprivileged) user managers
Let per-user service managers have user namespaces too.

For unprivileged users, user namespaces are set up much earlier
(before the mount, network, and UTS namespaces vs after) in
order to obtain capbilities in the new user namespace and enable use of
the other listed namespaces. However for privileged users (root), the
set up for the user namspace is still done at the end to avoid any
restrictions with combining namespaces inside a user namespace (see
inline comments).

Closes #10576
2019-12-18 11:09:30 -08:00
Topi Miettinen d909b40fda
analyze: badness if neither of RootImage and RootDirectory exists
Instead of requiring both RootImage and RootDirectory directives, give badness
points if neither is present. Fixes conversion in d737b451f.
2019-12-18 20:38:04 +02:00
Lennart Poettering ecb040643d
Merge pull request #14376 from poettering/sd-event-no-stack
sd-event: don't use stack for event queue array
2019-12-18 17:18:07 +01:00
Yu Watanabe de697db05b network: introduce AddPrefixRoute= and deprecate PrefixRoute=
PrefixRoute= was added by e63be0847c,
but unfortunately, the meaning of PrefixRoute= is inverted; when true
IFA_F_NOPREFIXROUTE flag is added. This introduces AddPrefixRoute=
setting.
2019-12-18 16:32:31 +01:00
Lennart Poettering 0c8e33b6e9
Merge pull request #14377 from keszybz/fixups
Fixups
2019-12-18 16:21:20 +01:00
Zbigniew Jędrzejewski-Szmek 9667e10b1a
Merge pull request #14365 from yuwata/networkctl-altname
network, udev: further alternative name support
2019-12-18 12:44:34 +01:00
Zbigniew Jędrzejewski-Szmek b012a1f455 Make openssl dependency optional again 2019-12-18 11:24:44 +01:00
Lennart Poettering 27b4b3cc92 update TODO 2019-12-18 11:02:21 +01:00
Lennart Poettering 5cddd924aa sd-event: don't allocate event queue array on stack
We might have quite a number of event sources, hence allocate this in a
buffer we can reuse on the heap, rather than on the stack.
2019-12-18 10:59:27 +01:00
Lennart Poettering ac6431dad9 man: add man page for sd_bus_message_sensitive() 2019-12-18 09:10:34 +01:00
Zbigniew Jędrzejewski-Szmek 4023637a8a Restore silent handling of BUS_ERROR_SPEED_METER_INACTIVE
This only matters for the case where new networkctl is running against older
networkd. We should still handle the old error to avoid unnecessary warning
about speedmeeter being disabled.

This partially reverts commit e813de549b.
2019-12-18 08:48:33 +01:00
Zbigniew Jędrzejewski-Szmek 1b49e3e3c4 shared/loop-util: rename function
As suggested in https://github.com/systemd/systemd/pull/14261#pullrequestreview-332398625.
2019-12-18 08:48:33 +01:00
Topi Miettinen 7a670b1dd9 shared/dropin: fix assert for invalid drop-in
Don't try to show top level drop-in for non-existent units or when trying to
instantiate non-instantiated units:

$ systemctl cat nonexistent@.service
Assertion 'name' failed at src/shared/dropin.c:143, function unit_file_find_dirs(). Aborting.
$ systemctl cat systemd-journald@.service
Assertion 'name' failed at src/shared/dropin.c:143, function unit_file_find_dirs(). Aborting.
2019-12-18 08:43:40 +01:00
Yu Watanabe 51692fab56
Merge pull request #14370 from poettering/homed-preparation-misc
four smaller preparation patches from the homed PR
2019-12-18 11:17:59 +09:00
Yu Watanabe 12742abe07
Merge pull request #14369 from poettering/pkcs11-cryptsetup-followup
PKCS#11 cryptsetup support followup
2019-12-18 11:16:17 +09:00
Dimitri John Ledkov f27bb6abd3 initrd: make udev cleanup service confict trigger and settle too
Otherwise, systemd-udev-trigger|settle.service that ran in the initrd may
ramain active, and never re-run again from the system root.

This is observed by forexample examining ESP with udevadm info, which in the
initrd has all the ID_* variables, and none of them in fully booted system.
2019-12-17 21:38:11 +01:00
Lennart Poettering 9652d74092 varlink: add varlink_close_unref() helper 2019-12-17 20:05:46 +01:00