1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-27 01:57:35 +03:00

69164 Commits

Author SHA1 Message Date
Lennart Poettering
bf4ffc43c5 analyze: teach "exit-status" verb json output too 2023-12-06 22:18:14 +01:00
Lennart Poettering
81373a0e28 analyze: teach "capability" verb JSON output too 2023-12-06 22:18:14 +01:00
Lennart Poettering
fb8cc599ed analyze: add "architectures" verb that lists all known architectures 2023-12-06 22:18:14 +01:00
Mike Yuan
fb45185d98 systemctl-whoami: use pidfd to refer to processes
While at it, rephrase the output a bit. Before this commit, if
the pid doesn't exist, we output something hard to interpret -
"Failed to get unit for ourselves".
2023-12-06 21:15:38 +00:00
Lennart Poettering
cbc51d0cf4
Merge pull request #30101 from poettering/underline-rework
systemctl: "list-units" table tweaks
2023-12-06 22:13:12 +01:00
Lennart Poettering
4d56442755 recurse-dir: add new readdir_all_at() helper
This new helper combines open() with readdir_all() to simplify a few
callers.
2023-12-06 22:12:48 +01:00
Luca Boccassi
f08d1fea30
Merge pull request #30295 from yuwata/hostnamectl-machine-id
hostnamectl: read machine ID and boot ID through DBus
2023-12-06 21:12:36 +00:00
Lennart Poettering
dc7a49ed25
Merge pull request #30183 from poettering/nlcr
NL → CRNL conversion fixes when logging at the same time as ptyfwd runs
2023-12-06 22:12:17 +01:00
Lennart Poettering
936fcc4668 show-status: suffix output ith CRNL rather than just NL
This is similar to #30183 but focusses on the status output rather than
the log output.

Since the status output always goes to a TTY we don't have to
conditionalize things on isatty().

Fixes: #30184
2023-12-06 22:11:54 +01:00
Lennart Poettering
6498a0c2cc user-util: add new helper fully_set_uid_gid()
Usually when we do setresuid() we also do setesgid() and setgroups().
Let's add a common helper that does all three, and use it everywhere.
2023-12-06 22:11:38 +01:00
Lennart Poettering
eb981a5b9b mime: register confext/sysext images in shared-mime-info
This make them recognized by file managers and stuff. Maybe one day we
should properly register mime types in the "vnd." namespace with IANA,
but I am too lazy to deal with the bureaucracy for that, hence let's
stick with the x. namespace for now.

This defines confext/sysext DDIs as subtype of:

https://www.iana.org/assignments/media-types/application/vnd.efi.img

Which is what everyone appears to use for raw disk images, in particular
if they contain a GPT partition table.
2023-12-06 22:11:21 +01:00
Lennart Poettering
7e3607996a userdbctl: enable ssh-authorized-keys logic by default
sshd now supports config file drop-ins, hence let's install one to hook
up "userdb ssh-authorized-keys", so that things just work.

We put the drop-in relatively early, so that other drop-ins generally
will override this.

Ideally sshd would support such drop-ins in /usr/ rather than /etc/, but
let's take what we can get. It's not that sshd's upstream was
particularly open to weird ideas from Linux people.
2023-12-06 22:11:04 +01:00
Lennart Poettering
ffc1ec73b3 pid1: add ProtectSystem= as system-wide configuration, and default it to true in the initrd
This adds a new ProtectSystem= setting that mirrors the option of the
same of services, but in a more restrictive way. If enabled will remount
/usr/ to read-only, very early at boot. Takes a special value "auto"
(which is the default) which is equivalent to true in the initrd, and
false otherwise.

Unlike the per-service option we don't support full/strict modes, but
the door is open to eventually support that too if it makes sense. It's
not entirely trivial though as we have very little mounted this early,
and hence the mechanism might not apply 1:1. Hence in this PR is a
conservative first step.

My primary goal with this is to lock down initrds a bit, since they
conceptually are mostly immutable, but they are unpacked into a mutable
tmpfs. let's tighten the screws a bit on that, and at least make /usr/
immutable.

This is particularly nice on USIs (i.e. Unified System Images, that pack
a whole OS into a UKI without transitioning out of it), such as
diskomator.
2023-12-06 22:10:20 +01:00
Daan De Meyer
8e3dc737b2
Merge pull request #30241 from poettering/journalctl-short-file-switch
journalctl: add short option "-i" for "--file="
2023-12-06 22:07:41 +01:00
Zbigniew Jędrzejewski-Szmek
f8d67130b8 coredump: keep core files for two weeks
We have two mechanisms that remove old coredumps: systemd-coredump has
parameters based on disk use / remaining disk free, and systemd-tmpfiles does
cleanup based on time. The first mechanism should prevent us from using too much
disk space in case something is crashing continuously or there are very large
core files.

The limit of 3 days makes it likely that the core file will be gone by the time
the admin looks at the issue. E.g. if something crashes on Friday, the coredump
would likely be gone before people are back on Monday to look at it.
2023-12-06 22:05:20 +01:00
Alan Liang
67001c2534 core: add specifier expansion to AllowedCPUs= and friends 2023-12-06 22:04:28 +01:00
Topi Miettinen
58c6e75f26 network/networkd-address: don't set up firewall rules here
Don't set up firewall rules when we're just initializing the firewall context
for NFT sets.

Fixes: #30257
2023-12-06 22:04:00 +01:00
Mike Yuan
374c29fc88 shared/killall: correctly warn about rootfs daemon's root
Follow-up for 9e615117dab5ede72eec22bf6369e0138f9dace5

We'll typically send signals to all remaining processes in the following
cases:

1. pid1 (in initrd) when transitioning from initrd to sysroot: SIGTERM
2. pid1 (in sysroot) before transitioning back to initrd (exitrd): SIGTERM + SIGKILL
3. systemd-shutdown (in exitrd): SIGTERM + SIGKILL

'warn_rootfs' is set to true only when we're not in initrd and we're
sending SIGKILL, which means the second case. So, we want to emit the
warning when the root of the storage daemon IS the same as that of pid1,
rather than the other way around.

The condition is spuriously reversed in the offending commit.
2023-12-06 22:03:35 +01:00
Frantisek Sumsal
b28940ca10 loginctl: show a nicer error message when no session/seat is available
When calling loginctl {seat,session}-status without arguments, show a nicer
error message in case there's no suitable session/seat attached to the calling
tty.

Before:
~# loginctl seat-status
Could not get properties: Unknown object '/org/freedesktop/login1/seat/auto'.
~# systemd-run -q -t loginctl seat-status
Could not get properties: Unknown object '/org/freedesktop/login1/seat/auto'.
~# systemd-run -q -t loginctl session-status
Could not get properties: Unknown object '/org/freedesktop/login1/session/auto'.

After:
~# build/loginctl seat-status
Failed to get path for seat 'auto': Session '1' has no seat.
~# systemd-run -q -t build/loginctl seat-status
Failed to get path for seat 'auto': Caller does not belong to any known session and doesn't own any suitable session.
~# systemd-run -q -t build/loginctl session-status
Failed to get path for session 'auto': Caller does not belong to any known session and doesn't own any suitable session.

Resolves: #25199
2023-12-06 22:02:44 +01:00
Daan De Meyer
3ed6f7a57e
Merge pull request #30340 from yuwata/repart-error-handling-ftruncate
repart: fix coding style of error handling
2023-12-06 22:02:01 +01:00
Daan De Meyer
96675f5c14
Merge pull request #30343 from keszybz/ukify-genkey
Raise error if 'ukify genkey' is called with no output arguments
2023-12-06 22:01:41 +01:00
Luca Boccassi
d5401e36dc
Merge pull request #30332 from bluca/softreboot_pivot_in_place
switch-root: also check that mount IDs are the same, not just inodes
2023-12-06 21:01:13 +00:00
Luca Boccassi
f9a284f02d
Merge pull request #30214 from bluca/wants_mounts_for
Add WantsMountsFor= and use it in the cryptsetup generator
2023-12-06 21:00:37 +00:00
Luca Boccassi
db11bab38c NEWS: finalize for v255 v255 2023-12-06 20:32:40 +00:00
Luca Boccassi
fa8e6bb3b2
Merge pull request #30334 from DaanDeMeyer/repart-fixes
repart: Add Minimize=best to --make-ddi= partition definitions
2023-12-06 20:29:04 +00:00
Lennart Poettering
261ee3d539 README: mention Matrix channel 2023-12-06 18:27:16 +00:00
Luca Boccassi
5c1557888f
Merge pull request #30341 from bluca/news
Update hwdb and NEWS
2023-12-06 16:57:29 +00:00
Yu Watanabe
5db7eb21f9 hostname: expose machine ID and boot ID through DBus
Fixes #30293.
2023-12-06 20:51:13 +09:00
Yu Watanabe
01e554e2e7 hostnamectl: do not show local machine ID and boot ID when requested to show information about remote host
Prompted by #30293.
2023-12-06 20:51:13 +09:00
Daan De Meyer
1500fe38b2 test: Add test case for --make-ddi=sysext
Also make sure that the sysext is big enough to not fit in the
minimum partition size so we know Minimize= is being used.
2023-12-06 12:18:32 +01:00
Daan De Meyer
ebd6606515 repart: Add Minimize=best to --make-ddi= partition definitions
Otherwise, repart won't calculate the minimal size of the partition
automatically and things will fail once the partitions exceed the
minimal partition size (10M).
2023-12-06 11:54:48 +01:00
Zbigniew Jędrzejewski-Szmek
f3d50fb2c6 ukify: raise error if genkey is called with no output arguments
The idea is that genkey is called with either
--secureboot-private-key= + --secureboot-certificate=, and then it
writes those, or with --pcr-private-key + optionally --pcr-public-key
and then it writes those, or both. But when called with no arguments
whatsover, it did nothing.

There is no implicit value for any of those parameters as input (unlike in
mkosi), so we also don't want to have implicit values when used as output.
But we shouldn't return success if no work was done, this is quite confusing.
2023-12-06 11:46:04 +01:00
Zbigniew Jędrzejewski-Szmek
7b0760ca9c ukify: remove stray line
As requested in review.
2023-12-06 11:44:40 +01:00
Zbigniew Jędrzejewski-Szmek
b6ecab8541 ukify: add test for --secureboot-certificate-validity=
Follow-up for bf35f9c83541785726dce41e54496a07f4841621.
2023-12-06 11:44:40 +01:00
Luca Boccassi
a7418691e4 hwdb: update
ninja -C build update-hwdb
2023-12-06 10:06:50 +00:00
Luca Boccassi
48696c2d37 NEWS: note that newly introduced tools are experimental
So that we can change interfaces for at least one release if needed
2023-12-06 10:00:25 +00:00
Luca Boccassi
e6e335b5d4 NEWS: update contributors list 2023-12-06 09:57:38 +00:00
Roland Singer
bf35f9c835
ukify: fix handling of --secureboot-certificate-validity= (#30315)
Before:
$ python src/ukify/ukify.py genkey --secureboot-private-key=sb2.key --secureboot-certificate=sb2.cert --secureboot-certificate-validity=111
Traceback (most recent call last):
  File "/home/zbyszek/src/systemd-work/src/ukify/ukify.py", line 1660, in <module>
    main()
  File "/home/zbyszek/src/systemd-work/src/ukify/ukify.py", line 1652, in main
    generate_keys(opts)
  File "/home/zbyszek/src/systemd-work/src/ukify/ukify.py", line 943, in generate_keys
    key_pem, cert_pem = generate_key_cert_pair(
                        ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/zbyszek/src/systemd-work/src/ukify/ukify.py", line 891, in generate_key_cert_pair
    now + ONE_DAY * valid_days
          ~~~~~~~~^~~~~~~~~~~~
TypeError: can't multiply sequence by non-int of type 'datetime.timedelta'

Now:
$ python src/ukify/ukify.py genkey --secureboot-private-key=sb2.key --secureboot-certificate=sb2.cert --secureboot-certificate-validity=111
Writing SecureBoot private key to sb2.key
Writing SecureBoot certificate to sb2.cert

The new code is also clearer.
2023-12-06 10:49:47 +01:00
Mike Yuan
9f08d7f777 repart: use correct errno 2023-12-06 10:03:21 +01:00
Yu Watanabe
6c7f4badea repart: fix coding style of error handling
Follow-up for c4a87b76c3e5f74f62d4431b85e7c5f71add3916.
2023-12-06 11:35:10 +09:00
Frantisek Sumsal
1ea27bd79e test: load the io controller before checking if io.latency exists
Otherwise the following test gets always skipped.
2023-12-05 19:58:48 +00:00
Daan De Meyer
0689d46a75 repart: Fix sysext definitions for --make-ddi=
CopyFiles= does not support multiple directories separated by
whitespace. Instead the setting has to be specified multiple times.
2023-12-05 19:26:58 +00:00
Luca Boccassi
a14b75e218 selinux: downgrade log about state to trace
It is printed on every invocation of sd-executor, which is noisy and not useful

Follow-up for: bb5232b6a3b8a
2023-12-05 19:25:50 +00:00
Luca Boccassi
f83a74dfb8 switch-root: also check that mount IDs are the same, not just inodes
If /run/nextroot/ has been set up, use it, even if the inodes are
the same. It could be a verity device that is reused, but with
different sub-mounts or other differences. Or the same / tmpfs with
different /usr/ mounts. If it was explicitly set up we should use it.

Use the new helper to check that the mount IDs are also the same,
not just the inodes.
2023-12-05 17:20:27 +00:00
Luca Boccassi
5134e54625 basic: add fds_are_same_mount() helper 2023-12-05 17:20:27 +00:00
Yu Watanabe
829732d40a basic: fix typo 2023-12-05 23:50:25 +09:00
huyubiao
3769ba7570 fix: The example2 in hwdb.xml is unreasonable
use evdev:atkbd:dmi:bvnAcer:bvr:bdXXXXX:bd08/05/2010:svnAcer:pnX123: instead of evdev:atkbd:dmi:bvnAcer:bdXXXXX:bd08/05/2010:svnAcer:pnX123
2023-12-05 14:09:18 +01:00
Luca Boccassi
26522a66a3
Merge pull request #30313 from mrc0mmand/ubuntu-ci
Reduce the number of deny-list files for Ubuntu CI
2023-12-04 18:23:34 +00:00
Yu Watanabe
67bc3c1a8c tools/meson-vcs-tag: the third argument is optional
Follow-up for 1a71ac07adafebe7e0074f92d049f72968ca2d47.
2023-12-04 10:29:52 +00:00
Luca Boccassi
a483c75822
Merge pull request #30314 from DaanDeMeyer/dmi
Document kernel configs required for reading credentials from SMBIOS
2023-12-04 10:29:06 +00:00