Commit Graph

46348 Commits

Author SHA1 Message Date
Lennart Poettering 61f403a14f man: document systemd-dissect 2020-08-11 22:29:50 +02:00
Lennart Poettering 5a151082d7 meson: move systemd-dissect to /usr/bin 2020-08-11 22:29:50 +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 c53da7ed02
Merge pull request #16678 from poettering/loop-configure
loop-util: use new LOOP_CONFIGURE ioctl added in kernel 5.8
2020-08-11 22:22:27 +02:00
Lennart Poettering 6b49257f6b man: fix incorrectly placed full stop 2020-08-11 19:36:04 +01:00
Lennart Poettering d8857af4d0 update TODO 2020-08-11 15:24:18 +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
Lennart Poettering 7e31e90e58 units: order volatile-root after repart
Let's make sure systemd-repart can still see the real device before we
replace its mount with an overlay mount, and thus order repart before
volatile-root.

See: https://lists.freedesktop.org/archives/systemd-devel/2020-July/044896.html
2020-08-11 09:12:56 +02: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
Nicholas Narsing a2af7e5c7e hwdb: Add ACCEL_MOUNT_MATRIX quirk for Asus M80TA 2020-08-10 17:31:58 +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
Lennart Poettering a8c9824d2a
Merge pull request #16682 from poettering/userdb-gecos-fix
userdb: mangle GECOS field if necessary
2020-08-07 22:57:41 +02:00
Lennart Poettering 5cd12abaa0 user-record: deal with invalid GECOS fields gracefully
Let's fix up invalid GECOS fields both when we convert from NSS to JSON
and the other way round.

Kinda sucks we have to do that, but NSS does it when writing data to
/etc/passwd, so let's do the same.

Fixes: #16668
2020-08-07 17:36:27 +02:00
Lennart Poettering b10fd796f5 user-util: add mangle_gecos() call for turning strings into fields suitable as GECOS fields 2020-08-07 17:36:11 +02:00
Matt Fenwick c1c28fe2f7 fix typo in systemctl help 2020-08-07 16:57:28 +02:00
Zbigniew Jędrzejewski-Szmek 992aa67231
Merge pull request #16604 from poettering/tmpfiles-image
add --image= switch to tmpfiles, sysusers, journalctl
2020-08-07 10:08:42 +02:00
Lennart Poettering e3eec1fd10 journalctl: in "-o cat" mode show color
Let's provide a modicum of niceness, even in this barebones mode.

Fixes: #16232
2020-08-07 10:05:13 +02:00
Lennart Poettering bbac7da2b3 units: order systemd-user-sessions.service after home.mount
This should make /home as automount work reasonably well.

If /home is an automount this has little effect at boot, because if the
automount is not triggered it doesn't matter how the associated mount is
ordered.

It does matter at shutdown however, where home.mount is likely active
now. There the ordering means we'll end sessions first, and only then
deactivate home.mount.

Fixes: #16291
2020-08-07 10:02:05 +02:00
Lennart Poettering dcb9007162 update TODO 2020-08-07 08:40:00 +02:00
Lennart Poettering 072779f0bf docs: document new description field
Also, explain GECOS syntax requirements.
2020-08-07 08:39:56 +02:00
Lennart Poettering 0a388dfcc5 core,home,machined: generate description fields for all groups we synthesize 2020-08-07 08:39:52 +02:00
Lennart Poettering 0bb4308014 userdb: add "description" field to group records
User records have the realname/gecos fields, groups never had that, but
it would really be useful to have it, hence let's add it with similar
semantics.

We enforce the same syntax as for GECOS, since it's better to start with
strict rules and losen them later instead of the opposite.
2020-08-07 08:39:18 +02:00
Lennart Poettering fdc6c4f49c update TODO 2020-08-07 00:02:29 +02:00
Lennart Poettering a6991726f8 man: clarify that LogNamespace= is for system services only
Fixes: #16638
2020-08-06 18:24:11 +02:00
Zbigniew Jędrzejewski-Szmek f1cc283a5a
Merge pull request #16321 from bluca/mount_images
core: new feature MountImages
2020-08-06 18:23:03 +02:00
Kamil Dudka 4191b3282a _sd-common.h: avoid parsing errors with Coverity
The commit 1070d271fa which was supposed
too fix this does not seem to take effect any more.  We get again 34%
compilation success rate while scanning systemd itself.  Moreover, the
installed header file breaks compilation of programs that include it:

"/usr/include/systemd/_sd-common.h", line 23: error #35: #error directive: "Do
          not include _sd-common.h directly; it is a private header."
  #  error "Do not include _sd-common.h directly; it is a private header."
     ^
2020-08-06 16:26:57 +02:00
Lennart Poettering fc733bed3b update TODO 2020-08-06 14:08:59 +02:00
Luca Boccassi b3d133148e core: new feature MountImages
Follows the same pattern and features as RootImage, but allows an
arbitrary mount point under / to be specified by the user, and
multiple values - like BindPaths.

Original implementation by @topimiettinen at:
https://github.com/systemd/systemd/pull/14451
Reworked to use dissect's logic instead of bare libmount() calls
and other review comments.
Thanks Topi for the initial work to come up with and implement
this useful feature.
2020-08-05 21:34:55 +01:00
Luca Boccassi a082edd53a strv: add strv_split_colon_pairs function
Given a string in the format 'one:two three four:five', returns a string
vector with each word. If the second element of the tuple is not
present, an empty string is returned in its place, so that the vector
can be processed in pairs.

[zjs: use EXTRACT_UNESCAPE_SEPARATORS instead of EXTRACT_CUNESCAPE_RELAX.
This way we do escaping exactly once and in normal strict mode.]
2020-08-05 21:29:13 +01:00