Commit Graph

70537 Commits

Author SHA1 Message Date
Yu Watanabe
330c080eeb core/exec-invoke: drop unused pam_pid 2024-01-24 14:43:18 +09:00
Yu Watanabe
c917a80701 core/service: declare 'int r' at the beginning 2024-01-24 14:43:18 +09:00
Yu Watanabe
ae6a9e650c unit: modernize unit_pid_set() 2024-01-24 14:43:18 +09:00
Yu Watanabe
b826e31754 core: use helper functions like unit_main_pid() in unit_kill_context()
No functional changes. Just refactoring.
2024-01-24 14:43:18 +09:00
Yu Watanabe
3e22239da7 core: introduce unit_main_pid_full() which optionally provides if the PID is alien or not 2024-01-24 14:43:18 +09:00
Yu Watanabe
d70dfe1b27 core: constify PidRef arguments 2024-01-24 14:43:18 +09:00
Lennart Poettering
269f70de78 nspawn: fix separating empty lines in --help text
When I added the --background= switch I placed the empty line that was
supposed to separate the options from the next section before the switch
rather than after. Fix that.

To make issues like this harder to run into next time, let's move the \n
from the end of the preceeding line to the beginning of the section
title, since that's pretty much where they belong to.

Follow-up for: 3d8ba7b83f
2024-01-23 23:24:19 +00:00
Ivan Shapovalov
a97476c8ac hostname-setup: read hostname from system.hostname credential
`system.hostname` credential is treated similarly to the pre-existing
`system.machine_id` credential. It is considered after /etc/hostname,
but prior to the kernel defaults or os-release defaults.

Fixes #30667.

Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name>
2024-01-23 22:03:06 +00:00
Luca Boccassi
f70daee8f2 Merge pull request #30130 from poettering/pcrlock-root
pcrlock: add support for unlocking a root fs with a pcrlock file
2024-01-23 21:41:02 +00:00
Lennart Poettering
e944d3ab92 Merge pull request #31026 from poettering/nspawn-tint
nspawn: allow tinting the background of interactive tty sessions
2024-01-23 22:32:00 +01:00
Lennart Poettering
a575f2148f repart: don't try to determine sector size from a disk image we should consider empty
If we are told to start from scratch we shouldn't look into the old
image to determine sector size. Looking there is confusing at best, but
plain wrong in many other cases.
2024-01-23 19:58:08 +00:00
Lennart Poettering
ab36d7c975 preset: add some alphabetical sorting
I think the existing sections in the preset file make sense, but
alphabetical ordering is kinda cool too.

try to find a middle ground, and at least sort within each section.

No actual change of behaviour, just some reordering of lines.
2024-01-23 19:57:23 +00:00
Lennart Poettering
9603fd29f8 dissect: show image name separately from filename
If the image name is different from the filename then show it in the
output, since it's relevant for finding sysext/confext release files.

(Image name is typically the filename without the ".raw" suffix and
similar).
2024-01-24 01:33:48 +08:00
Lennart Poettering
a609b3eab7 unit: systemd-creds.socket is statically enabled, hence drop [Install]
This is statically enabled, hence needs to [Install] section.
2024-01-24 01:31:13 +08:00
Frantisek Sumsal
5ed55a9bad packit: use the closest matching tag for the checked out revision
Packit otherwise tries to get the latest tag by creation date, which
doesn't work well in the systemd-stable repo:

2024-01-23 13:40:47.858 upstream.py       DEBUG  No ref given or is not glob pattern
2024-01-23 13:40:47.859 upstream.py       DEBUG  We're about to get latest matching tag in the upstream repository /tmp/tmp07g2beo8.
2024-01-23 13:40:47.859 commands.py       DEBUG  Command: git tag --list --sort=-creatordate
2024-01-23 13:40:47.866 logging.py        DEBUG  v248.13
2024-01-23 13:40:47.866 logging.py        DEBUG  v249.17
2024-01-23 13:40:47.866 logging.py        DEBUG  v250.14
2024-01-23 13:40:47.866 logging.py        DEBUG  v251.20
2024-01-23 13:40:47.867 logging.py        DEBUG  v252.21
2024-01-23 13:40:47.867 logging.py        DEBUG  v253.15
2024-01-23 13:40:47.867 logging.py        DEBUG  v254.8
2024-01-23 13:40:47.867 logging.py        DEBUG  v255.2
2024-01-23 13:40:47.868 logging.py        DEBUG  v255.1
2024-01-23 13:40:47.868 logging.py        DEBUG  v255
...
2024-01-23 18:15:13 +01:00
Lennart Poettering
8bf3891e8e nspawn: tint the terminal bg blue if we are in a container
Let's give people a hint that they are not operating on the host.
2024-01-23 16:45:37 +01:00
Lennart Poettering
3ef072ee26 pretty-print: split out color tinting into a helper of its own 2024-01-23 16:45:37 +01:00
Lennart Poettering
f9bc96f657 color-util: make return values of rgb_to_hsv() optional
When we want to tint the bg color we don't care about the hue, we want
to set it ourself after all, hence make the arguments optional, so that
we don't even have to ask for it.
2024-01-23 16:45:37 +01:00
Lennart Poettering
3d8ba7b83f nspawn: optionally tint the background color of a container 2024-01-23 16:45:37 +01:00
Lennart Poettering
9ebd1153ef Merge pull request #31061 from yuwata/pidref_copy
pidref: add basic tests for PidRef, and split out pidref_copy() from pidref_dup()
2024-01-23 16:28:01 +01:00
Frantisek Sumsal
43b238f1c1 man: suffix signals with ()
Since signals can take arguments, let's suffix them with () as we
already do with functions. To make sure we remain consistent, make the
`update-dbus-docs.py` script check & fix any occurrences where this is
not the case.

Resolves: #31002
2024-01-23 16:27:50 +01:00
Lennart Poettering
3bda8bc58c Merge pull request #31057 from aafeijoo-suse/bootctl-print-fix
bootctl: return earlier with `--print-esp-path`
2024-01-23 14:26:25 +01:00
Yu Watanabe
232e66217d pidref: split out pidref_copy() from pidref_dup() 2024-01-23 22:21:44 +09:00
Lennart Poettering
03a83186be varlink: make sure varlink_server_detach_event() doesn't leave invalid pointer around 2024-01-23 14:17:43 +01:00
Yu Watanabe
d203659a13 test: add basic tests for PidRef 2024-01-23 22:09:32 +09:00
Lennart Poettering
0db917f759 Merge pull request #31019 from poettering/hostnamed-full-os-release
hostnamed: expose full /etc/os-release data in hostnamectl's --json= output
2024-01-23 12:28:41 +01:00
Martin Trigaux
3af9d86eb7 Remove duplicated command in help message
"systemctl reboot" was present twice in the message, should be halt instead
2024-01-23 10:44:36 +00:00
Luca Boccassi
75283b6e3c Merge pull request #31053 from intelfx/work/machinectl-zsh
shell-completion: improve and expand zsh machinectl completion
2024-01-23 10:16:51 +00:00
Antonio Alvarez Feijoo
597a3cfd52 man/bootctl: typo in --print-boot-path description 2024-01-23 10:33:26 +01:00
Antonio Alvarez Feijoo
285ae04040 bootctl: return earlier with --print-esp-path
`--print-esp-path` and `--print-boot-path` cannot be combined, so it's not
necessary to acquire the XBOOTLDR partition with `--print-esp-path`.
2024-01-23 10:24:44 +01:00
Ivan Shapovalov
9a887b1421 shell-completion/zsh: complete hidden images when word starts with "."
Show hidden images in the completion results, but only if the current
word starts with ".", such that
- `machinectl clone <Tab>` will only offer non-hidden images, but
- `machinectl clone .<Tab>` will offer both hidden and non-hidden images
2024-01-23 04:01:11 +01:00
Yu Watanabe
fc5edc91cb Merge pull request #31015 from yuwata/local-addresses
local-addresses: several cleanups and fixes, add test cases
2024-01-23 10:25:35 +09:00
Ivan Shapovalov
57d389c3fb shell-completion/zsh: improve and expand machinectl completion 2024-01-23 01:55:05 +01:00
Werner Sembach
7ebbaaa7f4 Fix systemd-backlight ignoring numbered kbd_backlight entries
If there are name collisions in the leds subsystem, the 2nd device node with the
colliding name gets automatically renamed by appending _1, the third by
appending _2 and so on.

This wildcard change makes sure that systemd-backlight also catches these
renamed nodes for kbd_backlight entries.
2024-01-22 22:03:35 +00:00
Luca Boccassi
ad12e4be6d Merge pull request #31044 from keszybz/uhttpd-alloca-print
Use macro wrapper instead of alloca in µhttp-utils
2024-01-22 22:03:08 +00:00
Michal Koutný
8ad614890b cgroup: Rename effective limits internal table
Post-merge fixup of commit 4fb0d2dc14 ("cgroup: Add EffectiveMemoryMax=,
EffectiveMemoryHigh= and EffectiveTasksMax= properties"), no functional
change intended.
2024-01-22 22:02:37 +00:00
Frantisek Sumsal
6c7fc5d5f2 meson: correctly handle "no" value for sshd?confdir options 2024-01-22 22:01:39 +00:00
Sam Leonard
22ce047394 vmspawn: document -q/--quiet 2024-01-22 22:01:01 +00:00
Frantisek Sumsal
00fafa1a17 core: raise the log priority if sd-executor is missing
Log about missing executor at the emergency level, so the message always
makes it to the console - otherwise it won't get anywhere, since we
can't even start systemd-journald in that case.

Before:

Welcome to Arch Linux!

[    5.202479] systemd[1]: Failed to allocate manager object: No such file or directory
[!!!!!!] Failed to allocate manager object.
[    5.207741] systemd[1]: Freezing execution.

After:

Welcome to Arch Linux!

[    5.279408] systemd[1]: Failed to open executor binary '/usr/lib/systemd/systemd-executor': No such file or directory
[    5.290756] systemd[1]: Failed to allocate manager object: No such file or directory
[!!!!!!] Failed to allocate manager object.
[    5.295919] systemd[1]: Freezing execution.
2024-01-22 21:58:41 +00:00
Lennart Poettering
4b1a02d866 Merge pull request #31011 from poettering/getpwnam-tweaks
clean up getpwnam() calls and related interfaces
2024-01-22 20:58:33 +01:00
Matt Muggeridge
d4c8de21a0 IPv6 RA: Support the Retrans Timer field (IPv6 Conformance Test: v6LC.2.1.5)
The RA's Retransmission Timer field was being ignored. This resolves the IPv6
Core Conformance test, v6LC.2.1.5 [1].

Retransmission Timer is a 32-bit unsigned integer. The time, in milliseconds,
between retransmitted Neighbor Solicitation messages. Used by the Address
Resolution and Neighbor Unreachability Detection (NUD) algorithm.

Support setting a default value for the neighbour retransmission timer value with:

    [Network]
    IPv6RetransmissionTimeSec=<int>

By default, upon receiving a Router Advertisement with the Retransmission Timer
field set to a non-zero value, it will update the kernel's retransmit timer value.
To disable this behaviour, configure the UseIPv6RetransmissionTime= under the
[IPv6AcceptRA] section.

    [IPv6AcceptRA]
    UseIPv6RetransmissionTime=<bool>

RFC4861: Neighbor Discovery in IPv6
  * Section 4.2 RA Message Format.
  * Section 6.3.4 Processing Received Router Advertisements

A Router Advertisement field (e.g., Cur Hop Limit, Reachable Time,
and Retrans Timer) may contain a value denoting that it is
unspecified. In such cases, the parameter should be ignored and the
host should continue using whatever value it is already using. In
particular, a host MUST NOT interpret the unspecified value as
meaning change back to the default value that was in use before the
first Router Advertisement was received.

The RetransTimer variable SHOULD be copied from the Retrans Timer
field, if the received value is non-zero.

References
[1] IPv6 Core Conformance Spec (PDF)
2024-01-23 03:18:01 +09:00
Lennart Poettering
75673cd8ae user-util: add get{pw,gr}{uid,gid,name}_malloc() helpers
These are wrappers around getpwuid_r() and friends, and will allocate the
right-sized buffer for this call.

We so far had multiple implementations of a buffer allocation loop
around getpwuid_r() and friends, and they all suck in some way. Let's
clean this up and add a common implementation, and use it everywhere.

Also, be more careful with error numbers, in particular systematically
turn ENOENT into ENOSRCH (the former is what is returned if /etc/passwd
is absent, which we want to consider identical to user not existing,
which is ENOSRCH). We so far did this at some invocations, but not all.

There are some invocations of getpwuid() left in the codebase. We really
should fix those too, and have a single unified implementation of the
logic, but those are not as trivial to convert, so left for another
time.
2024-01-22 17:55:07 +01:00
Lennart Poettering
829854afa5 user-util: validate the right field 2024-01-22 17:55:07 +01:00
Lennart Poettering
afd08d7740 Merge pull request #31023 from poettering/vmspawn-work
vmspawn: make it work on current fedora
2024-01-22 17:54:43 +01:00
Lennart Poettering
1807baa931 nspawn,vmspawn: let's add some terminal magic to the welcome text
Let's grey the text out, and prefix it with a vertical grey bar, to make
clear this is output from the host, not the payload, and make it clearly
distinguishable from what follows.

Let's also make the image name clickable (with new enough
shared-mime-info this should allow you to look into the image with
gnome-disk-utility or a similar tool.
2024-01-22 16:24:00 +01:00
Lennart Poettering
3df61bf00c vmspawn: make "-m" value formatting independent of locale
We cannot format the memory string via printf() %f format strings, since
that's locale dependent and qemu doesn't like that. hence format this as
an integer. We'll lose sub-MiB accuracy, but systems with less than 1
MiB memory don't really make much sense anyway.
2024-01-22 16:24:00 +01:00
Lennart Poettering
dbb2718f92 vmspawn: print a helpful message when we start the VM
Let people know how they can exit the VM, it's not obvious after all.
2024-01-22 16:24:00 +01:00
Lennart Poettering
71e42c36d0 vmspawn: make sure to pass the right firmware image type to qemu
The JSON data reports whether firmware types are qcow or raw. Let's pass
that into the qemu cmdline.
2024-01-22 16:24:00 +01:00
Lennart Poettering
e8ce204d86 vmspawn: rework firmware selection logic
Let's make the firmware file to choose configurable, and enumeratable.

This adds --firmware= to select the formare, and in particular
--firmware=list to show available options.
2024-01-22 16:24:00 +01:00
Lennart Poettering
452486cdf6 man: document new rootfs support for pcrlock policies 2024-01-22 15:56:32 +01:00