1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-25 23:21:33 +03:00
Commit Graph

50808 Commits

Author SHA1 Message Date
Lennart Poettering
122860f102 generator: exit early when asked to generate fsck unit for / and /usr in initrd
Let's exit early if we are invoked to generate an fsck unit for the
rootfs or /usr of the initrd itself. The "systemd-root-fsck.service" and
"systemd-usr-fsck.service" units are after all for the host file
systems, and the initrd file hierarchy is from an unpacked cpio anyway.
Hence, this semantically doesn't really make sense, so quickly exit if
we detect this case. This allows us to remove some checks further down
the codepath.
2021-04-21 15:18:07 +02:00
Yu Watanabe
28f9667d05 network: dhcp: constify link_get_duid() 2021-04-21 21:00:45 +09:00
Yu Watanabe
8c72f5c077 network: dhcp: introduce duid_needs_product_uuid() helper function 2021-04-21 21:00:45 +09:00
Yu Watanabe
294f129b0d network: configure non-dhcp configs earlier even DUID-UUID is used by DHCP clients
Previously, if DUID-UUID is used, all configurations are configured
after networkd gets product uuid of machine.

This makes only DHCP clients are delayed, and other configs are
configured earlier.
2021-04-21 21:00:45 +09:00
Yu Watanabe
4e26a5baa0 network: make IAID and DUID for DHCPv6 configurable explicitly
Closes #18996.
2021-04-21 21:00:11 +09:00
Yu Watanabe
cde74a65c1 network: move dhcp related conf parsers to networkd-dhcp-common.c 2021-04-21 20:56:58 +09:00
Yu Watanabe
b67bbfef14
Merge pull request #19344 from yuwata/network-route-metric-19028
network: add RouteMetric= setting in [Address] and more
2021-04-21 20:51:31 +09:00
Lennart Poettering
2671fbefce units: fix repart conditions to run if definitions exist in /sysroot + /sysusr
The systemd-repart code was already smart enough to look for definitions
there, but the unit file conditions made that pointless. Let's fix that.
2021-04-21 12:23:31 +01:00
Yu Watanabe
ea846e45c1 doc: fix typo 2021-04-21 09:57:30 +02:00
Zbigniew Jędrzejewski-Szmek
78aa5b6f59 man: mention sd_id128_is_allf(), SD_ID128_ALLF
It was added in 670814387b, but not
mentioned in the man pages.
2021-04-21 08:45:05 +02:00
Zbigniew Jędrzejewski-Szmek
e0a41aa4c6 man: dedent examples in sd-id128 to 2 columns
In man pages, horizontal space it at premium, and everything should
generally be indented with 2 spaces to make it more likely that the
examples fit on a user's screen.

C.f. 798d3a524e.
2021-04-21 08:45:05 +02:00
Yu Watanabe
baad6421b1 network: dhcp6: logs about generated addresses in delegated prefix 2021-04-21 14:04:39 +09:00
Yu Watanabe
4b409e855b network: dhcp6: logs about delegated prefixes
Closes #19354.
2021-04-21 14:04:33 +09:00
Yu Watanabe
eccdc68771 in-addr-util: introduce 'struct in_addr_prefix' and hash ops for it 2021-04-21 13:57:47 +09:00
Yu Watanabe
93e44aa92f in-addr-util: add assertions 2021-04-21 13:57:47 +09:00
Yu Watanabe
3e726c156b test-network: update test for RouteMetric= 2021-04-21 13:55:02 +09:00
Yu Watanabe
4c0aae015f man: update explanation about route metric 2021-04-21 13:55:02 +09:00
Yu Watanabe
b3cde1c3f5 network: set metric for prefix route of IPv4 link-local address 2021-04-21 13:55:02 +09:00
Yu Watanabe
0e1fb1d09a network: radv: add RouteMetric= setting in [IPv6Prefix] 2021-04-21 13:55:02 +09:00
Yu Watanabe
9fe0b7b493 network: dhcp6-pd: add RouteMetric= setting in [DHCPv6PrefixDelegation] 2021-04-21 13:55:02 +09:00
Yu Watanabe
8ebafba9f9 network: move RouteMetric= from [DHCPv6] to [IPv6AcceptRA]
As the value is used in the routes in RA.
2021-04-21 13:55:02 +09:00
Yu Watanabe
415deef9c3 network: dhcp4: also apply RouteMetric= setting in [DHCPv4] to prefix route 2021-04-21 13:55:02 +09:00
Yu Watanabe
c4ff0629dd network: add RouteMetric= setting in [Address] section 2021-04-21 13:54:59 +09:00
Yu Watanabe
a8d21c91f9 network: show route metric in debug log 2021-04-21 13:42:45 +09:00
Yu Watanabe
0e7bb99ff9 sd-netlink: add missing address types 2021-04-21 13:42:08 +09:00
Lennart Poettering
5efbd0bf89
Merge pull request #19371 from poettering/repart-initrd-usr-only
two /sysusr/ changes for repart, split out of #19234
2021-04-20 23:46:17 +02:00
Lennart Poettering
0aa714778a
Merge pull request #19372 from poettering/repart-initrd-usr-begin
fstab-generator: mount.usr= handling changes, split out of #19234
2021-04-20 23:44:49 +02:00
Lennart Poettering
ac02dccabc
Merge pull request #19368 from poettering/loop-seqnum
loop-util: let's try harder to avoid loopback block device recycle issues
2021-04-20 23:43:57 +02:00
Frantisek Sumsal
3b6fd3c1de tools: shellcheck-ify most of the tool scripts 2021-04-20 20:11:13 +02:00
Lennart Poettering
3464514457 man: document new initrd-usr-fs.target 2021-04-20 19:11:07 +02:00
Lennart Poettering
632b551ca2 units: change order of settings to match order in other similar unit 2021-04-20 19:11:07 +02:00
Lennart Poettering
8f47e32a3e repart: use /sysusr/ as --root= default in initrd, if mounted 2021-04-20 18:53:15 +02:00
Lennart Poettering
a73b2ad041 repart: try harder to find OS prefix
This teaches repart to look for the root block device both as the
backing for /sysroot and for /sysusr/usr.

The latter is a new addition, and starts making more sense with the next
commit. It's about supporting systems that are shipped with only a /usr/
fs, but where a root fs is allocated and formatted on first boot via
systemd-repart (or a similar tool). In this case it's useful to be able
to mount the ultimate /usr/ early on without mounting the root fs
right-away (simple because the rootfs might not exist yet, and we need
the repart data encoded in /usr/ to actually format it). Hence, instead
of requiring that we mount /sysroot/ first and /sysroot/usr/ second as
we did so far, let's rearrange things slightly:

1. We mount the /usr/ file system we discover to /sysusr/usr/
2. We mount the root file system we discover to /sysroot/
3. Once both are established we bind mount /sysusr/usr/ to /sysroot/usr/

And that' it. The first two steps can happen in either order, and we can
access /usr/ with or without a rootfs being around.

This commit implements nothing of the above. Instead, it teaches
systemd-repart to check both /sysroot/ and /sysusr/ for repart drop-ins,
and use the first of these hierarchies it finds populated. This way
systemd-repart can be spawned once /usr is mounted and it will work
correctly without root fs having to exist, or we can invoke it when the
root fs is already mounted, where it also will work correctly.
2021-04-20 18:53:15 +02:00
Frantisek Sumsal
437e889b18 src: shellcheck-ify shell scripts 2021-04-20 18:39:36 +02:00
Lennart Poettering
fa138f5e26 fstab-generator: properly order generated mount units before "post" target units
Let's make sure, that our mount unit are properly ordered before the
"post" target unit even if DefaultDependencies= is used on the target
unit.
2021-04-20 18:26:17 +02:00
Lennart Poettering
e19ae92af6 fstab-generator: extend logging a bit 2021-04-20 18:26:17 +02:00
Lennart Poettering
29a24ab28e fstab-generator: if usr= is specified, mount it to /sysusr/usr/ first
This changes the fstab-generator to handle mounting of /usr/ a bit
differently than before. Instead of immediately mounting the fs to
/sysroot/usr/ we'll first mount it to /sysusr/usr/ and then add a
separate bind mount that mounts it from /sysusr/usr/ to /sysroot/usr/.

This way we can access /usr independently of the root fs, without for
waiting to be mounted via the /sysusr/ hierarchy. This is useful for
invoking systemd-repart while a root fs doesn't exist yet and for
creating it, with partition data read from the /usr/ hierarchy.

This introduces a new generic target initrd-usr-fs.target that may be
used to generically order services against /sysusr/ to become available.
2021-04-20 18:26:17 +02:00
Lennart Poettering
6e1454b4b9 ci: drop test/TEST-50-DISSECT/deny-list-ubuntu-ci
Let's see if this makes the test stable on the CI.
2021-04-20 17:21:22 +02:00
Lennart Poettering
4a62257d68 dissect: ignore udev database entries from before the loopback attachment
This tries to shorten the race of device reuse a bit more: let's ignore
udev database entries that are older than the time where we started to
use a loopback device.

This doesn't fix the whole loopback device raciness mess, but it makes
the race window a bit shorter.
2021-04-20 17:20:38 +02:00
Lennart Poettering
8ede1e86b2 loop-util: track CLOCK_MONOTONIC timestamp immediately before attaching a loopback device
This is similar to the preceding work to store the uevent seqnum, but
this stores the CLOCK_MONOTONIC timestamp.

Why? This allows to validate udev database entries, to determine if they
were created *after* we attached the device.

The uevent seqnum logic allows us to validate uevent, and the timestamp
database entries, hence together we should be able to validate both
sources of truth for us.

(note that this is all racy, just a bit less racy, since we cannot
atomically attach loopback devices and get the timestamp for it, the
same way we can't get the uevent seqnum. Thus is shortens the race
window, but doesn#t close it).
2021-04-20 17:20:38 +02:00
Lennart Poettering
8626b43be4 sd-device: add API to query from when a udev database entry is
We already store a CLOCK_MONOTONIC timestamp for each device appearance,
let' make this queriable.

This is useful to determine whether a udev device database entry is from
a current appearance of the device or a previous one, by comparing it
with appropriately taken timestamps.
2021-04-20 17:14:10 +02:00
Lennart Poettering
75dc190d39 dissect: ignore old uevents when waiting for loopback partition scan
Let's drop all monitor uevent that were enqueued before we actually
started setting up the device.

This doesn't fix the race, but it makes the race window smaller: since
we cannot determine the uevent seqnum and the loopback attachment
atomically, there's a tiny window where uevents might be generated by
the device which we mistake for being associated with out use of the
loopback device.
2021-04-20 17:14:10 +02:00
Lennart Poettering
31c75fcc41 loop-util: read kernel's uevent seqnum right before attaching a loopback device
Later, this will allow us to ignore uevents from earlier attachments a
bit better, as we can compare uevent seqnums with this boundary. It's
not a full fix for the race though, since we cannot atomically determine
the uevent and attach the device, but it at least shortens the window a
bit.
2021-04-20 17:13:56 +02:00
Lennart Poettering
79e8393a6a loop-util: initialize .devno in loop_device_open() too 2021-04-20 17:12:39 +02:00
Lennart Poettering
b0dbffd868 loop-util: port to random_u64_range()
Doesn't matter, but it's a bit easier to read I'd claim.
2021-04-20 17:12:39 +02:00
Lennart Poettering
38bd449f96 loop-util: make loop_device_make() return fd in all code paths
Previously, loop_device_make() would return the device fd in one success
code path, but not the other (where' we'd just return 0).
loop_device_open() returns it in all cases.

Hence, let's clean this up, and make sure in all success code paths of
both functions we return it (even though it strictly speaking is
redundant, since we return it in LoopDevice anyway, and currently noone
actually relies on this).
2021-04-20 17:12:39 +02:00
Lennart Poettering
02ef01ade3 sd-device: use right clock when comparing initialization usec
we actually use CLOCK_MONOTONIC for the timestamp, hence when
comparing/subtracting it from the current time, also use
CLOCK_MONOTONIC.
2021-04-20 17:12:39 +02:00
Lennart Poettering
a156eb89c8 sd-device: use right type for usec_initialized 2021-04-20 17:11:21 +02:00
Lennart Poettering
ee7561d014 update TODO 2021-04-20 16:32:24 +02:00
Yegor Alexeyev
c95df5879e relay role implementation 2021-04-20 15:11:53 +02:00