Commit Graph

29902 Commits

Author SHA1 Message Date
Lennart Poettering 5f10408044 mountpoint-util: use new kernel 5.8 statx() API for determining mount points
We finally have an explicit API for this in the kernel. It's great and
simple. Let's use it!
2020-08-19 10:08:29 +02:00
Lennart Poettering 69b3fa14cd mountpoint-util: use new kernel 5.8 statx() API for determining mnt_id
The kernel finally has a proper API to determine the mnt_id of a file.
Let's use it.

This adds support for the STATX_MNT_ID field of statx(), added in
kernel 5.8.
2020-08-19 10:08:24 +02:00
Lennart Poettering ffaf45e4f3 mountpoint-util: minor modernizations 2020-08-19 10:07:49 +02:00
Alyssa Ross 556a7bbed6
load-fragment: fix grammar in error messages 2020-08-18 20:56:59 +00:00
Yu Watanabe 46b875fb80 network: do not fail if UseMTU=yes on DHCP lease lost
This fixes a bug introduced by 6906794dd1.

Fixes #16768.
2020-08-18 20:33:58 +02:00
Zbigniew Jędrzejewski-Szmek f9536e6793
Merge pull request #16687 from DaanDeMeyer/bootloader-machine-id
Allow bootctl and kernel-install to be called without /etc/machine-id present
2020-08-18 15:05:26 +02:00
Franck Bui 21fd6bc263 log: don't explicitly re-open log for failed assertions
This was needed before commit 16e4fd87c5 added a
mode that opens the log fds for every single log message. This mode is used in
execute.c since then making the explicit call to log_open unnecessary.

This basically reverts ea89a119cd.
2020-08-18 10:31:25 +02:00
Dimitri John Ledkov 1c7466aa2e resolve: lift limits on search domains count or length
glibc 2.26 lifted restrictions on search domains count or length to
unlimited. This has also been backported to 2.17 in some distributions (RHEL 7
and derivatives). Other softwares may have their own limits for search domains,
but we should not restrict what is written out any more.

https://sourceware.org/legacy-ml/libc-announce/2017/msg00001.html
2020-08-18 10:06:25 +02:00
Zbigniew Jędrzejewski-Szmek 170a8c365b
Merge pull request #16761 from keszybz/missing-syscall-cleanup
Missing syscall cleanup
2020-08-18 10:01:19 +02:00
Zbigniew Jędrzejewski-Szmek faeae444ea missing_syscall: do not use function name that may conflict with glibc
This was done for all replacements back in 5187dd2c40,
but some newer stuff didn't do this.
2020-08-17 19:56:55 +02:00
Zbigniew Jędrzejewski-Szmek 23654cee13 missing_syscall: fix pidfd_{send_signal,open} numbers for alpha
Also order the syscalls by syscall number for easier comparisons with the
kernel headers.

Fixup for 5f152f43d0.
2020-08-17 19:56:55 +02:00
Zbigniew Jędrzejewski-Szmek 0e68241138 missing_syscall: add forgotten check for __NR_get_mempolicy nonnegativity
We do it in other cases, we should here too.

Fixup for b070c7c0e1.
2020-08-17 19:56:25 +02:00
Lennart Poettering 5b5ce6298e test: accept that char device 0/0 can now be created witout privileges
Fixes: #16721
2020-08-17 19:28:32 +02:00
Lennart Poettering ceffbc584d socket-netlink: make address argument const 2020-08-17 18:56:42 +02:00
Topi Miettinen 209650b720 test-fs-util: skip encrypted path test if we get EACCES
Unprivileged test-fs-util fails on my system since /sys/dev/block is
inaccessible for unprivileged users, so let's skip encrypted path test if we
get EACCES or similar.
2020-08-17 18:30:24 +02:00
Michael Scherer bcf08acbff Newer Glibc use faccessat2 to implement faccessat
cf https://repo.or.cz/glibc.git/commit/3d3ab573a5f3071992cbc4f57d50d1d29d55bde2

This cause breakage on Fedora Rawhide: https://bugzilla.redhat.com/show_bug.cgi?id=1869030
2020-08-16 15:10:13 +02:00
Luca Boccassi ce5eef6530 shared/udev-util: fix sd_device leak in device_wait_for_initialization
If the caller doesn't pass a return pointer, or if sd_event_loop fails
after the device was found and referenced, it never gets dereferenced.
2020-08-14 15:26:04 +01:00
Luca Boccassi efc3b12fdb tree-wide: enable/disable libcrypsetup debug output depending on our level
Avoid always setting to debug, as it will incur in many more callbacks from
libcrypsetup that then get discarded, wasting resources.
2020-08-14 15:26:04 +01:00
Luca Boccassi ecab4c470c dissect: yield for 2ms when a verity device cannot be opened before retrying
If we don't succeed on the first try it's because another process is
opening the same device. Do a microsleep for 2ms to increase the
chances it has completed the next time around the loop.
2020-08-14 15:26:04 +01:00
Luca Boccassi 9ecb5c10fd dissect: account for EBUSY when verity device already exists
In some cases, libdevmapper/libcrypsetup might return EBUSY instead of
EEXIST when opening a shared device. Treat it in the same way.
2020-08-14 15:26:04 +01:00
Luca Boccassi c419b6f0cf dissect: wait for udev event if verity device not yet available
The symlink /dev/mapper/dm_name is created by udev after a mapper
device is set up. So libdevmapper/libcrypsetup might tell us that
a verity device exists, but the symlink we use as the source for
the mount operation might not be there yet.
Instead of falling back to a new unique device set up, wait for
the udev event matching on the expected devlink for at least 100ms
(after which the benefits of sharing a device in terms of setup
time start to disappear - on my production machines, opening a new
verity device seems to take between 150ms and 300ms)
2020-08-14 15:26:04 +01:00
Luca Boccassi 030a0d79ff udev-util: add device_wait_for_devlink
Allows to wait for an event by matching on the devlink that gets
created.
2020-08-14 15:26:04 +01:00
Lennart Poettering 3f181262f4 namespace: fix minor memory leak 2020-08-14 15:33:04 +02:00
Lennart Poettering de8231b007 dissect: add support for outputting JSON 2020-08-12 22:39:43 +02:00
Lennart Poettering 0b9481cf2e json: add helpers for dealing with id128 + strv 2020-08-12 22:39:43 +02:00
Lennart Poettering af8219d562 dissect: show proper error strings for more errors
Also, make inability to decrypt and EBUSY a non-fatal issue, since we
still are able to display the mount table then.
2020-08-11 22:29:50 +02:00
Lennart Poettering af187ab237 dissect: introduce new helper dissected_image_mount_and_warn() and use it everywhere 2020-08-11 22:26:48 +02:00
Lennart Poettering fa45d12c1c dissect: use recognizable error if we are supposed to mount an encrypted fs
Also, document EBUSY
2020-08-11 22:26:48 +02:00
Lennart Poettering 37e44c3f95 dissect: immediately close pipes when we determined we have no data for them
This effectively makes little difference because we exit soon later
anyway, which will close the fds, too. However, it's still useful since
it means the parent will get EOF events on them in the order we process
things and isn't delayed to process the data from the pipes until the
child dies.
2020-08-11 22:26:48 +02:00
Lennart Poettering f5ea63a5e1 dissect: properly propagate some relevant dissection errors
Let's send some specific error codes from helper process to parent via
the return value, and convert them back there.
2020-08-11 22:26:48 +02:00
Lennart Poettering 89d00f2e3f dissect: beef up dissection output
Let's use a proper table for outputting partition information. Let's
also put the general information about the image first, and the table
after that.

Moreover, dissect the image before showing any output, so that we can
early on return an error if the image is not valid.
2020-08-11 22:26:48 +02:00
Lennart Poettering e3659eb236 dissect: load verity metadata earlier
That way we can turn off kernel partition scanning if verity data is
available (as we don't support verity for full GPT images, only for
simple file system images).
2020-08-11 22:26:48 +02:00
Lennart Poettering 16b7459280 dissect: show more information in output
Let's show size and image filename.
2020-08-11 22:26:48 +02:00
Lennart Poettering 33973b841d dissect: add support for copying files in/out of image 2020-08-11 22:26:48 +02:00
Lennart Poettering bacf21e9e9 copy: add copy_access() helper for copying access mode 2020-08-11 22:26:48 +02:00
Lennart Poettering 5c05f06264 dissect: optionally mkdir directory to overmount 2020-08-11 22:26:48 +02:00
Lennart Poettering 1ffd93683b mkdir: handle mkdir_p() of simple filename gracefully 2020-08-11 22:26:48 +02:00
Lennart Poettering 140788f75f dissect: support --discard=list 2020-08-11 22:26:48 +02:00
Lennart Poettering ee72df1c7b firstboot: move --image= logic into common code
That way we can reuse it in tmpfiles/sysusers/journalctl and so on.
2020-08-11 22:26:48 +02:00
Lennart Poettering 86c1c1f345 loop-util: use new LOOP_CONFIGURE ioctl
LOOP_CONFIGURE allows us to configure a loopback device in one ioctl
instead of two, which is not just faster but also removes the race that
udev might start probing the device before we adjusted things properly.

Unfortunately LOOP_CONFIGURE is broken in regards to LO_FLAGS_PARTSCAN
as of kernel 5.8.0. This patch contains a work-around for that, to
fallback to old behaviour if partition scanning is requested but does
not work. Sucks a bit.

Proposed upstream fix for that issue:

https://lkml.org/lkml/2020/8/6/97
2020-08-11 15:24:18 +02:00
Lennart Poettering 834c15ec38 dissect: use new blockdev_partscan_enabled() API where appropriate 2020-08-11 10:30:19 +02:00
Lennart Poettering e8467cd31c blockdev-util: add correct API for detecting if block device has partition scanning enabled
Instead of checking the loopback ioctls, let's check sysfs, so that we
catch all kinds of block devices, not just loopback block devices.
2020-08-11 10:29:43 +02:00
Anita Zhang 96a4ce9f1d
Merge pull request #16690 from poettering/userdb-group-desc
description field for group records
2020-08-11 00:27:54 -07:00
Daan De Meyer 6f77906ad3 kernel-install: Add fallback to "Linux" if no machine-id is found
This allows kernel-install to be used by image builders such as mkosi
which don't have a machine-id available when they call kernel-install.
2020-08-10 19:56:32 +01:00
Daan De Meyer 31e57550b5 bootctl: Remove dependency on machine-id.
The machine-id is used to create a few directories and setup a default
loader entry in loader.conf. Having bootctl create the directories
itself is not particularly useful as it does not put anything in them
and bootctl install is not guaranteed to be called before an initramfs
tool like kernel-install so other programs will always need to have
logic to create the directories themselves if they happen to be called
before bootctl install is called.

On top of this, when using unified kernel images, these are installed to
$BOOT/EFI/Linux which removes the need to have the directories created
by bootctl at all. This further indicates that these directories should
be created by the program that puts something in them rather than by
bootctl.

Removing the machine-id dependency allows bootctl install to be called
even when there's no machine-id in the image. This is useful for image
builders such as mkosi which don't have a machine-id when
installing systemd-boot (via bootctl) because it should only be
generated by systemd when the final image is booted.

The default entry in loader.conf based on the machine-id in loader.conf
is also removed which shouldn't be a massive loss in usability overall.

This commit reverts commit 341890d.
2020-08-10 19:55:57 +01:00
Lennart Poettering 3f64046cda
Merge pull request #16697 from yuwata/network-fix-suspend-issue
network: fix suspend issue
2020-08-10 20:09:36 +02:00
Lennart Poettering 721bb6ed08
Merge pull request #16684 from keszybz/assorted-cleanups
Assorted cleanups
2020-08-10 19:28:05 +02:00
Yu Watanabe 9b966cee43 network: wait for previous address removal before configuring static addresses
Fixes #16696.
2020-08-08 12:41:03 +09:00
Yu Watanabe b6766fb114 network: drop unnecessary bracket 2020-08-08 12:31:59 +09:00
Yu Watanabe fb282d4e25 network: only process non-error message 2020-08-08 12:31:12 +09:00