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

50805 Commits

Author SHA1 Message Date
Lennart Poettering
ee8e497d24 dissect: show growfs flag in systemd-dissect table output 2021-04-23 17:56:19 +02:00
Lennart Poettering
de98f63140 dissect: look for new GPT partition flag marking partitions for growing
systemd-repart can grow partitions dynamically at boot, but it won't
grow the file systems inside them. In /etc/fstab you can request that
via x-systemd.growfs. So far we didn't have a nice scheme for images
with GPT auto-discovery however, and that meant in particular in tools
such as systemd-nspawn the file systems couldn't be grown automatically.

Let's address this: let's define a new GPT partition flag that can be
set for our partition types. If set it indicates that the file system
should be grown to the partition size on mount.

This commit adds the flag and adds code to discover it when dissecting
images. There's no code yet to actually do something about it.
2021-04-23 17:55:45 +02:00
Luca Boccassi
778139c6e4
Merge pull request #19156 from dtardon/enable-warn
install: warn if WantedBy targets don't exist
2021-04-23 16:43:45 +01:00
Lennart Poettering
d2194e15db fstab-generator: clean up mount point flags handling
Let's rename MountpointsFlags → MountPointFlags. In most of our codebase
we name things mount_point/MountPoint rather than mountpoint/Mountpoint,
do so here too.

Also, prefix the enum values with "MOUNT_". The fact the enum values
weren#t prefixed was pretty unique in our codebase, and pretty
surprising. Let's fix that.

This is just refactoring, no actual change in behaviour
2021-04-23 16:55:29 +02:00
Frantisek Sumsal
6f47e45c67 test: configure swap for TEST-55-OOMD
oomd works way better with swap, so let's make the test less flaky by
configuring a swap device for it. This also allows us to drop the ugly
`cat`s from the load-generating script.
2021-04-23 14:36:14 +02:00
jiangchuangang
3a1e9d8083 logind:add missing equal sign 2021-04-23 11:56:16 +01:00
Lennart Poettering
ce0cedacc4
Merge pull request #19124 from takaswie/topic/fw-audio-entries
hwdb/rule: add database and rules for known audio  and music unit in IEEE 1394 bus
2021-04-23 11:31:34 +02:00
Flos Lonicerae
c44a285c41
Add D-Bus property exposing Ctrl-Alt-Delete action (#19217) 2021-04-23 09:57:14 +02:00
David Tardon
8adbad370f test-install-root: add test for unknown WantedBy= target 2021-04-23 07:28:37 +02:00
Jan Synacek
8ae27441c2 install: warn if WantedBy targets don't exist
Currently, if [Install] section contains WantedBy=target that doesn't exist,
systemd creates the symlinks anyway. That is just user-unfriendly.
Let's be nice and warn about installing non-existent targets.

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

Replaces: #15834
2021-04-23 07:28:37 +02:00
David Tardon
cd228002cc test-install-root: create referenced targets 2021-04-23 07:28:37 +02:00
Yu Watanabe
ec39af3249
Merge pull request #19392 from yuwata/network-dhcp-split-link_set_dhcp_routes
network: split link_set_dhcp_routes() into smaller functions
2021-04-23 08:32:46 +09:00
Lennart Poettering
4990780ed0
Merge pull request #19336 from pdmorrow/reloading_restart
core,test: services in reloading state should exit without waiting TimeoutStartSec
2021-04-22 16:39:06 +02:00
Dimitri John Ledkov
a25100488b
Merge pull request #19346 from mihajlov/dhcp_broadcast_l3
network: enable DHCP broadcast flag if required by interface
2021-04-22 14:22:50 +01:00
Luca Boccassi
f1db009d0e
Merge pull request #19390 from poettering/repart-copy-fixes
repart: fix CopyFiles= corner case when copying into root dir of newly formatted fs
2021-04-22 14:06:10 +01:00
Lennart Poettering
7d25c2463f dissect: fix two minor typos in comments 2021-04-22 13:39:01 +01:00
Emil Renner Berthing
a00ff2e1b5 boot/efi: compile on riscv64
This makes systemd-boot compile against the latest gnu-efi which
just added support for riscv64.
2021-04-22 14:37:25 +02:00
Lennart Poettering
c1737506f3 dissect-image: prefer PARTN= uevent property over "partition" sysfs attr
The kernel will send us a PARTN= uevent proprty with partition add
events, let's use it instead of going for the "partition" sysfs attr.
It's less racy that way and there are reports the sysfs attr shows up
after the device, which makes it evern worse.
2021-04-22 14:31:27 +02:00
Peter Morrow
f209d8f50c test: add a test to cover restarting services in reloading state
Cover the case where a service is recovered out of reloading state via
a restart Restart= configuration.

Signed-off-by: Peter Morrow <pemorrow@linux.microsoft.com>
2021-04-22 09:33:37 +01:00
Peter Morrow
bbe19f6884 core: allow services stuck in reloading state to exit
If a service is in reloading state but has exited do not delay
the final exit until the service reload timer expires. Instead allow
the service to exit immediately since we can't expect the service to
ever transition out of reloading state.

For example if a service sent RELOADING=1 but crashed before it could
send READY=1 then it should be restarted if the service had
Restart= configured.

Signed-off-by: Peter Morrow <pemorrow@linux.microsoft.com>
2021-04-22 09:28:50 +01:00
Jóhann B. Guðmundsson
eb34cce178 fix: point to the correct drop-ins subdirectory for confs 2021-04-22 09:36:14 +02:00
Lennart Poettering
5a44565cb7 gpt: we actually honour the ReadOnly= flag on XBOOTLDR partitions too
The partition type is defined in our Discoverable Partition Spec, and we
honour the flag for it, hence allow setting it too.
2021-04-22 09:34:41 +02:00
Yu Watanabe
e1c08a3d0a network: dhcp4: simplify link_set_dns_routes() 2021-04-22 12:49:56 +09:00
Yu Watanabe
ff2cf67740 network: dhcp4: introduce link_set_dhcp_gateway() and link_set_dhcp_route_to_gateway() 2021-04-22 12:49:56 +09:00
Yu Watanabe
7872d0f7b6 network: dhcp4: introduce link_set_dhcp_static_routes() 2021-04-22 12:49:56 +09:00
Yu Watanabe
c0fef8f349 network: dhcp4: introduce link_set_dhcp_prefix_route() 2021-04-22 12:49:56 +09:00
Lennart Poettering
f21a3a82fb repart: don't try to extract directory of root dir when copying directories
It's OK to specify the root dir as target directory when copying
directories. However, in that case path_extract_filename() is going to
fail, because the root dir simply has not filename.

Let's address that by moving the call further down into the loop, when
we made sure that the target dir doesn't exist yet (the root dir always
exists, hence this check is sufficient).

Moreover, in the branch for copying regular files, also move the calls
down, and generate friendly error messages in case people try to
overwrite dirs with regular files (and the root dir is just a special
case of a dir).

Altogether this makes CopyFiles=/some/place:/ work, i.e. copying some
dir on the host into the root dir of the newly created fs. Previously
this would fail with an error about the inability to extract a filename
from "/", needlessly.
2021-04-21 23:30:49 +02:00
Lennart Poettering
e28190673c repart: don't use basename() when we called path_extract_filename() anyway already
We already have the string, use it.
2021-04-21 23:30:46 +02:00
Lennart Poettering
554a2b6493 repart: prefix the correct path with root dir in log output
When we copy files into the freshly formatted file system, the mount
point prefix must be prepended to the *target* path, not the *source*
path. Not just in code but in the log message about it, too.
2021-04-21 23:30:00 +02:00
Zbigniew Jędrzejewski-Szmek
7feb1dd654
Merge pull request #19387 from poettering/discoverable-part-fix
minor doc fixes
2021-04-21 23:10:48 +02:00
Igor Zhbanov
4c54768c97 journald: Retry if posix_fallocate returned -1 (EINTR)
On some conditions (particularly when mobile CPUs are going to sleep),
the posix_fallocate(), which is called when a new journal file is allocated,
can return -1 (EINTR). This is counted as a fatal error. So the journald
closes both old and journals, and simply throwing away further incoming
events, because of no log files open.

Introduce posix_fallocate_loop() that restarts the function in the case
of EINTR. Also let's make code base more uniform by returning negative
values on error.

Fix assert in test-sigbus.c that incorrectly counted positive values as
success. After changing the function return values, that will actually work.

Fixes: #19041

Signed-off-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
2021-04-21 23:08:35 +02:00
Lennart Poettering
eb3c3a89c9 doc: slightly reorder/improve partition type table
Let's put swap and generic linux data partitions next to each other, and
clarify they predated this spec.
2021-04-21 22:25:10 +02:00
Lennart Poettering
1d6ca0a219 doc: verity partitions may only contain Verity data (fix copypasta) 2021-04-21 22:25:08 +02:00
Lennart Poettering
60c6c2101c man: --add was renamed --copy-to when it was merged, fix man page reference to it 2021-04-21 22:24:38 +02:00
Lennart Poettering
6f4a5f25fc
Merge pull request #19271 from yuwata/dhcp-duid-uuid
network: fix issues arround DHCP DUID-UUID
2021-04-21 21:59:35 +02:00
Lennart Poettering
e19479aa7d
Merge pull request #19365 from keszybz/sd_id128_equals
Add sd_id128_in_set()
2021-04-21 21:45:14 +02:00
Lennart Poettering
192b31f28f update TODO 2021-04-21 21:44:02 +02:00
Lennart Poettering
347d8a2889
Merge pull request #19381 from poettering/generator-tweaks
generator: two minor tweaks
2021-04-21 18:33:05 +02:00
Lennart Poettering
2b66f48e4e generator: write out special systemd-fsck-usr.service
So far all file systems where checked by instances of
systemd-fsck@.service, with the exception of the root fs which was
covered by systemd-fsck-root.service. The special handling is necessary
to deal with ordering issues: we typically want the root fs to be
checked before all others, and — weirdly — allow mounting it before the
fsck done (for compat with initrd-less boots).

This adds similar special handling for /usr: if the hierarchy is placed
on a separate file system check it with a special
systemd-fsck-usr.service instead of a regular sysemd-fsck@.service
instance. Reason is again ordering: we want to allow mounting of /usr
without the root fs already being around in the initrd, to cover for
cases where the root fs is created on first boot and thus cannot be
mounted/checked before /usr.
2021-04-21 18:32:29 +02:00
Zbigniew Jędrzejewski-Szmek
1f2a7ca7ac
Merge pull request #19362 from yuwata/network-dhcp6-pd-log-19354
network: dhcp6: add logs about delegated prefix
2021-04-21 18:20:49 +02:00
Zbigniew Jędrzejewski-Szmek
59ab650fc5
Merge pull request #19370 from mrc0mmand/shellcheck-pt4
More shellcheck shenanigans
2021-04-21 18:14:32 +02:00
Viktor Mihajlovski
e70eca9b48 network: enable DHCP broadcast flag if required by interface
Some interfaces require that the DHCPOFFER message is sent via broadcast
if they can't receive unicast messages before they've been configured
with an IP address.

E.g., s390 ccwgroup network interfaces operating in layer3 mode face
this limitation. This can prevent the interfaces from receiving an
IP address via DHCP, if the have been configured for layer3.

To allow DHCP over such interfaces, we're introducing a new device
property ID_NET_DHCP_BROADCAST which can be set for those.
The networkd DHCP client will check whether this property is set
for an interface, and if so will set the broadcast flag, unless
the network configuration for the interface has an explicit
RequestBroadcast setting.

Besides that, we're adding a udev rule to set this device property
for ccwgroup devices operating in layer3 mode, which is the case
if the ID_NET_DRIVER property is qeth_l3.

Supercedes #18829
2021-04-21 18:11:18 +02:00
Zbigniew Jędrzejewski-Szmek
da1af43dc1 repart: reword log message
The UUID does not exist, a partion with the UUID exists. So let's
say that the UUID is "already used" for clarity.
2021-04-21 17:51:24 +02:00
Zbigniew Jędrzejewski-Szmek
580f48cc02 partition,shared/gpt: use sd_id128_in_set()
I was worried that the text size will grow, but apparently that's not the
case:
With --optimization=2:
$ size build/src/shared/libsystemd-shared-248.a.p/gpt.c.o*
   text	   data	    bss	    dec	    hex	filename
   3674	   1104	      0	   4778	   12aa	build/src/shared/libsystemd-shared-248.a.p/gpt.c.o.old
   3085	   1104	      0	   4189	   105d	build/src/shared/libsystemd-shared-248.a.p/gpt.c.o

(I don't understand the generated assembly, even though it seems to work:

Disassembly of section .text.gpt_partition_type_is_usr_verity:

0000000000000000 <gpt_partition_type_is_usr_verity>:

bool gpt_partition_type_is_usr_verity(sd_id128_t id) {
   0:   48 83 ec 08             sub    $0x8,%rsp
        return sd_id128_in_set(id,
   4:   4c 8b 05 00 00 00 00    mov    0x0(%rip),%r8        # b <gpt_partition_type_is_usr_verity+0xb>
   b:   31 c0                   xor    %eax,%eax
   d:   4c 8b 0d 00 00 00 00    mov    0x0(%rip),%r9        # 14 <gpt_partition_type_is_usr_verity+0x14>
  14:   48 8b 15 00 00 00 00    mov    0x0(%rip),%rdx        # 1b <gpt_partition_type_is_usr_verity+0x1b>
  1b:   48 8b 0d 00 00 00 00    mov    0x0(%rip),%rcx        # 22 <gpt_partition_type_is_usr_verity+0x22>
  22:   6a 00                   pushq  $0x0
  24:   6a 00                   pushq  $0x0
  26:   ff 35 00 00 00 00       pushq  0x0(%rip)        # 2c <gpt_partition_type_is_usr_verity+0x2c>
  2c:   ff 35 00 00 00 00       pushq  0x0(%rip)        # 32 <gpt_partition_type_is_usr_verity+0x32>
  32:   ff 35 00 00 00 00       pushq  0x0(%rip)        # 38 <gpt_partition_type_is_usr_verity+0x38>
  38:   ff 35 00 00 00 00       pushq  0x0(%rip)        # 3e <gpt_partition_type_is_usr_verity+0x3e>
  3e:   ff 35 00 00 00 00       pushq  0x0(%rip)        # 44 <gpt_partition_type_is_usr_verity+0x44>
  44:   ff 35 00 00 00 00       pushq  0x0(%rip)        # 4a <gpt_partition_type_is_usr_verity+0x4a>
  4a:   ff 35 00 00 00 00       pushq  0x0(%rip)        # 50 <gpt_partition_type_is_usr_verity+0x50>
  50:   ff 35 00 00 00 00       pushq  0x0(%rip)        # 56 <gpt_partition_type_is_usr_verity+0x56>
  56:   ff 35 00 00 00 00       pushq  0x0(%rip)        # 5c <gpt_partition_type_is_usr_verity+0x5c>
  5c:   ff 35 00 00 00 00       pushq  0x0(%rip)        # 62 <gpt_partition_type_is_usr_verity+0x62>
  62:   e8 00 00 00 00          callq  67 <gpt_partition_type_is_usr_verity+0x67>
  67:   85 c0                   test   %eax,%eax
  69:   0f 95 c0                setne  %al
                               GPT_USR_ARM_VERITY,
                               GPT_USR_ARM_64_VERITY,
                               GPT_USR_IA64_VERITY,
                               GPT_USR_RISCV32_VERITY,
                               GPT_USR_RISCV64_VERITY);
}
  6c:   48 83 c4 68             add    $0x68,%rsp
  70:   c3                      retq
)
2021-04-21 17:51:24 +02:00
Zbigniew Jędrzejewski-Szmek
64b21afc72 sd-id128: add convenience functions to compare multiple sd_id128_t
Similar to sd_bus_error_has_names() that was added in
2b07ec316a.

It is made inline in the hope that the compiler will be able to optimize
all the va_args boilerplate away, and do an efficient comparison when
the arguments are all constants.
2021-04-21 17:51:24 +02:00
Yangyang Shen
80e9720616 journald: enforce longer line length limit during "setup" phase of stream protocol
This PR made modification on Lennart Poettering's basis. Fix the LineMax's function failure problem.

Signed-off-by: Yangyang Shen <shenyangyang4@huawei.com>
2021-04-21 17:22:24 +02:00
Lennart Poettering
599aee40a3 generator: explain why systemd-root-fsck.service exists in a comment 2021-04-21 15:18:07 +02:00
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