1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 09:21:26 +03:00
Commit Graph

50895 Commits

Author SHA1 Message Date
Lennart Poettering
e81acfd251 gpt: add some simple helpers for categorizing GPT partition types 2021-04-19 23:16:02 +02:00
Lennart Poettering
f3859d5f55 loop-util: store device major/minor in LoopDevice object
Let's store this away. It's useful when matching up mounts (i.e.  struct
stat's .st_dev field) with loopback devices.
2021-04-19 23:16:02 +02:00
Lennart Poettering
d83d804863 repart: add high-level setting for creating dirs in formatted file systems
So far we already had the CopyFiles= option in systemd-repart drop-in
files, as a mechanism for populating freshly formatted file systems with
files and directories. This adds MakeDirectories= in similar style, and
creates simple directories as listed. The option is of course entirely
redundant, since the same can be done with CopyFiles= simply by copying
in a directory. It's kinda nice to encode the dirs to create directly in
the drop-in files however, instead of providing a directory subtree to
copy in somehere, to make the files more self-contained — since often
just creating dirs is entirely sufficient.

The main usecase for this are GPT OS images that carry only a /usr/
tree, and for which a root file system is only formatted on first boot
via repart.  Without any additional CopyFiles=/MakeDirectories=
configuration these root file systems are entirely empty of course
initially. To mount in the /usr/ tree, a directory inode for /usr/ to
mount over needs to be created.  systemd-nspawn will do so automatically
when booting up the image, as will the initrd during boot. However, this
requires the image to be writable – which is OK for npawn and
initrd-based boots, but there are plenty tools where read-only operation
is desirable after repart ran, before the image was booted for the first
time. Specifically, "systemd-dissect" opens the image in read-only to
inspect its contents, and this will only work of /usr/ can be properly
mounted. Moreover systemd-dissect --mount --read-only won't succeed
either if the fs is read-only.

Via MakeDirectories= we now provide a way that ensures that the image
can be mounted/inspected in a fully read-only way immediately after
systemd-repart completed. Specifically, let's consider a GPT disk image
shipping with a file usr/lib/repart.d/50-root.conf:

       [Partition]
       Type=root
       Format=btrfs
       MakeDirectories=/usr
       MakeDirectories=/efi

With this in place systemd-repart will create a root partition when run,
and add /usr and /efi into it as directory inods. This ensures that the
whole image can then be mounted truly read-only anf /usr and /efi can be
overmounted by the /usr partition and the ESP.
2021-04-19 23:16:02 +02:00
Lennart Poettering
78eee6ce4d repart: use free_and_strdup_warn() where appropriate 2021-04-19 23:16:02 +02:00
Lennart Poettering
be9ce0188e repart: deal with empty partition label sensibly
libfdisk appears to return NULL when encountering an empty partition
label, let's handle this sanely, and treat NULL and "" for the current
label as the same, but for the new label as distinct: there NULL means
nothing is set, and "" means an actual empty label.
2021-04-19 23:16:02 +02:00
Lennart Poettering
22163eb51b repart: handle DISCARD failing with EBUSY gracefully 2021-04-19 23:16:02 +02:00
Lennart Poettering
55d380144a repart: add one more overflow check 2021-04-19 23:16:02 +02:00
Lennart Poettering
d17db7b2bf repart: when we can't fit in all partitions explain how large the image would have to be 2021-04-19 23:16:02 +02:00
Lennart Poettering
252d626711 repart: add --image= switch
This is similar to the --image= switch in the other tools, like
systemd-sysusers or systemd-tmpfiles, i.e. it apply the configuration
from the image to the image.

This is particularly useful for downloading minimized GPT image, and
then extending it to the desired size via:

   # systemd-repart --image=foo.image --size=5G
2021-04-19 23:16:02 +02:00
Lennart Poettering
8e5f3cecdf repart: slightly improve error message if partition is not on dm-crypt/dm-verity 2021-04-19 23:16:02 +02:00
Lennart Poettering
0efb3f83da repart: move NOP destructors into shared code 2021-04-19 23:16:02 +02:00
Lennart Poettering
ef9c184d3d dissect: split read-only flag into two
Let's have one flag to request that when dissecting an image the
loopback device is made read-only, and another one to request that when
it is mounted to make it read-only. Previously both concepts were always
done read-only together.

(Of course, making the loopback device read-only but mounting it
read-write doesn't make too much sense, but the kernel should catch that
for us, no need to make restrictions from our side there)

Use-case for this: in systemd-repart we'd like to operate on images for
adding partitions. Thus we'd like to have the loopback device writable,
but if we read repart.d/ snippets from it, we want to do that read-only.
2021-04-19 23:16:02 +02:00
Lennart Poettering
0ade2213e6 repart: port more code to generic path_simplify_and_warn()
We have this nice helper, hence use it when parsing paths and logging
about it.
2021-04-19 23:16:02 +02:00
Lennart Poettering
a0ff997180 repart: fix incorrect error code propagation 2021-04-19 23:16:02 +02:00
Zbigniew Jędrzejewski-Szmek
05e13b3558 udev/cdrom_id: add forgotten return and fix typo
Fixup for 092c05717c.
2021-04-19 18:25:17 +01:00
Jason Francis
941c5275ea
sd-login: fix wrong constructor used in sd_login_monitor manpage example 2021-04-19 12:20:29 -04:00
Jason Francis
a8310e39e9
sd-login: correct prototype of sd_peer_get_cgroup 2021-04-19 12:13:03 -04:00
Yu Watanabe
4e6c50a5d4 core: add RestrictAddressFamilies=none to deny all address families
Closes #15753.
2021-04-19 11:47:08 +01:00
Luca Boccassi
8441993621
Merge pull request #19351 from keszybz/log-message-tweaks
Log message tweaks
2021-04-19 11:44:35 +01:00
Hans de Goede
189bde4a03 hwdb: Add accel orientation quirk for the Teclast Tbook 11 tablet
Add a quirk to fix the accelerometer orientation on the
Teclast Tbook 11 tablet.
2021-04-19 11:44:16 +01:00
Hans de Goede
e15c079010 60-autosuspend.hwdb: Add Sierra Wireless EM7345-LTE modem to autosuspend list
Add the Sierra Wireless EM7345-LTE modem to the list of USB devices which
can safely autosuspend. This helps the processor reach deaper PC# states
when idle.

This was tested on a ThinkPad8 tablet with such a modem builtin.
2021-04-19 11:43:38 +01:00
Zbigniew Jędrzejewski-Szmek
5c7466b492
Merge pull request #19330 from mrc0mmand/shellcheck-pt2
test: make test-functions shellcheck-compliant
2021-04-19 09:04:19 +02:00
Zbigniew Jędrzejewski-Szmek
59e8042ecd basic/log: change error for unset errno to ESTRPIPE
EIO is used in other contexts, so change ot something otherwise unused.
ENOTRECOVERABLE was also suggested, but it's used in various other places
in the code.

https://github.com/systemd/systemd/pull/19317#discussion_r614887661
2021-04-19 08:46:19 +02:00
Zbigniew Jędrzejewski-Szmek
19cdcd5dca logind: tweak log message
https://github.com/systemd/systemd/pull/19317#pullrequestreview-637765222
2021-04-19 08:37:57 +02:00
Zbigniew Jędrzejewski-Szmek
092c05717c udev/cdrom_id: use random_u64_range() and tweak log messages
https://github.com/systemd/systemd/pull/19317#pullrequestreview-637765222
2021-04-19 08:37:39 +02:00
sverdlin
3181521f92
systemd-networkd.socket: Add conflict with shutdown.target (#19348)
systemd-networkd.socket can re-start systemd-networkd.service in
shutdown and by doing this even stop shutdown.target leaving the
system in halfway-down state.

Fixes #4955.
2021-04-19 11:25:33 +09:00
Frantisek Sumsal
94009c27f4 test: rewrite kernel module handling
This code was partially broken, since the firmware directory was
undefined. Also, some of the parts were a dead code, since they relied
on code from the original dracut test suite.
2021-04-16 19:05:59 +02:00
Frantisek Sumsal
0f1947059b test: use arrays when applicable 2021-04-16 19:05:55 +02:00
Frantisek Sumsal
a33e2692e1 test: avoid using pipes in certain cases
`command -v <bin> | grep ...` can under certain conditions cause the
`command` to exit with SIGPIPE, which in combination with `set -o
pipefail` means that the tests sometimes randomly die during setup.
Let's avoid using pipes in such cases.
2021-04-16 19:05:42 +02:00
Frantisek Sumsal
96af59aabb test: use set -o pipefail
This breaks some existing loops which previously ignored if the piped
program exited with EC >0. Rewrite them to mitigate this (and also make
them more robust in some cases).
2021-04-16 19:05:37 +02:00
Frantisek Sumsal
1b8fcd9c63 test: shell code cleanup
Just some basic stuff, like double quotes around strings, using
predictable values for possibly unset variables, formatting, etc.
2021-04-16 18:49:37 +02:00
Yu Watanabe
6604fb0207 fileio: use take_fdopen_unlocked()
This fixes maybe-uninitialized warning:
```
../src/basic/fileio.c: In function ‘chase_symlinks_and_fopen_unlocked’:
../src/basic/fileio.c:1026:19: warning: ‘f’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 1026 |         *ret_file = f;
      |         ~~~~~~~~~~^~~

```
2021-04-17 00:22:12 +09:00
Yu Watanabe
b4bc798f87
Merge pull request #19332 from yuwata/log_xxx_yyy_errno-follow-ups-19317
core,timedate,network: make log_unit_error_errno() or friends refuse zero errno
2021-04-16 23:44:32 +09:00
Yu Watanabe
4ab334472c
Merge pull request #19325 from sainAk/patch-1
hwdb: 60-keyboard:: merge Micro Star in MSI and  merge MSI Prestige And MSI Modern FnKeys and Special keys definitions
2021-04-16 20:01:10 +09:00
Yu Watanabe
74bd6ad016 network: update log message
In some optimization level with gcc, including netdev->ifname in log
message causes error.
2021-04-16 19:48:54 +09:00
Zbigniew Jędrzejewski-Szmek
b990afe152
Merge pull request #19290 from yuwata/network-dhcp-do-not-configure-twice
network: refuse to configure DHCP client more than once
2021-04-16 12:36:23 +02:00
Zbigniew Jędrzejewski-Szmek
b7c3447a2f
Merge pull request #19310 from yuwata/network-dhcp-anonymize
network: dhcp4: several fixes and cleanups for Anonymize=
2021-04-16 11:12:22 +02:00
Anita Zhang
169be51f94 man: correct requirements for systemd-oomd.service
Fixes: #19331
2021-04-16 09:50:44 +01:00
Aakash Singh
afb095e296 hwdb: merge MSI Prestige And MSI Modern FnKeys and Special keys definitions
'A10' was the model name for prestige series with 10th gen intel processors and 'SC' was the gpu config for a specific model
but now msi has refreshed these series with 11th gen intel processors so the model name becomes 'A11X' where x is gpu config name more info [here](https://www.msi.com/Business-Productivity/Prestige-14-A11X/Specification) and [here](https://www.msi.com/Business-Productivity/Prestige-15-A11X/Specification)
[this was the link for model comparison of 10th gen cpus](https://www.msi.com/Business-Productivity/Prestige-15-A10X/Specification) (Dead link now)
complete list of Prestige series laptops [here](https://www.msi.com/Business-Productivity/Products#?tag=Prestige-Series)

And modern series follows the same naming convention, full list of laptops [here](https://www.msi.com/Business-Productivity/Products#?tag=Modern-Series).

examples

Prestige series
Prestige 14 A10x ( 14inch Intel 10th gen )
Prestige 15 A11x ( 15inch Intel 11th gen )

First gen Modern Series
Modern 15 A10x  ( 15inch Intel 10th gen)
Modern 15 A4x ( 15inch AMD 4000 series)

Second gen Modern Series
Modern 15 B10x  ( 15inch Intel first gen modern laptop)
Modern 14 B4x ( 14inch AMD second gen modern laptop)

all these laptops have the same keyboard layouts with same functionality on windows (can be reviewed from their support manuals).
2021-04-16 12:49:45 +05:30
Aakash Singh
dcad324eea hwdb: merge Micro Star in MSI 2021-04-16 12:47:36 +05:30
Yu Watanabe
6064344894 network: make log_netdev_xxx_errno() refuse zero errno 2021-04-16 09:17:28 +09:00
Yu Watanabe
5b098203fd timedate: make log_unit_xxx_errno() refuse zero errno 2021-04-16 08:46:51 +09:00
Yu Watanabe
ac51363496 core: make log_unit_xxx_errno() refuse zero errno 2021-04-16 08:46:11 +09:00
Lennart Poettering
bc32241e6a core: use UNIT_TRIGGER at more places
Just some minor simplification.
2021-04-15 20:38:20 +01:00
Luca Boccassi
672e9aec1b
Merge pull request #19326 from keszybz/reorder-meson-status-output
Reorder meson status output
2021-04-15 20:37:29 +01:00
Luca Boccassi
2969369130
Merge pull request #19318 from yuwata/udev-ignore-additional-newline-on-verify-19314
udev: ignore additional newline at the end on verify
2021-04-15 20:36:55 +01:00
Luca Boccassi
2d8c8549ab
Merge pull request #19317 from keszybz/check-return-values-from-log_errno-functions
Check return values from log_errno functions
2021-04-15 20:33:54 +01:00
simmon
5c17a470a7 po: Translated using Weblate (Korean)
Currently translated at 100.0% (189 of 189 strings)

Co-authored-by: simmon <simmon@nplob.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/ko/
Translation: systemd/main
2021-04-15 20:16:19 +09:00
Zbigniew Jędrzejewski-Szmek
8d1c9489ef Assert zero is not passed to log_{device,rule,token}_*_errno() 2021-04-15 11:56:22 +02:00
Zbigniew Jędrzejewski-Szmek
9d9fed9ef4 Voidify log_{device,token,rule}_debug()
See analogous change for log_debug() for discussion.
2021-04-15 11:45:44 +02:00