1
0
mirror of https://github.com/systemd/systemd synced 2024-07-08 20:15:55 +00:00
Commit Graph

70485 Commits

Author SHA1 Message Date
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
fdc7d50ba4 vmspawn: ENODEV is not the only error the kernel returns if a device is not there
Let's use ERRNO_IS_DEVICE_ABSENT() to cover all cases.

(And while we are at it also use ERRNO_IS_PRIVILEGE() where appropriate)
2024-01-22 14:03:09 +01:00
Lennart Poettering
c7c6b6f28c vmspawn: close host vsock fd once we passed it to the child
Without this I qemu simply froze in a weird state for me if I kill it:
it was supposedly a zombie, but we'd get the pidfd POLLIN event for it
only once the fd is closed. Hence let's close it right-away.

(Smells like a kernel issue actually, but too lazy to bother with this).
2024-01-22 14:03:09 +01:00
Lennart Poettering
02aacdcf96 vmspawn: use execv() rather than execve() if we just want to pass 'environ' as env block 2024-01-22 14:03:09 +01:00
Lennart Poettering
400da3e424 vmspawn: modernize setup_notify_parent() a bit 2024-01-22 14:03:09 +01:00
Lennart Poettering
6cff1854f9 vmspawn: rework how we spawn qemu off
Let's swicth to PidRef for tracking the qemu child.

let's also set a bunch of flags that ensure the child inherits less of
of context.
2024-01-22 14:03:09 +01:00
Lennart Poettering
6ce868a0da event-util: add helper for adding pidref child to event loop 2024-01-22 14:03:09 +01:00
Daan De Meyer
166bcaf95f mkosi: Use authselect local profile if it exists
authselect 1.5.0 removed the "minimal" profile and added the "local"
profile instead. Let's modify our post-installation script to take
these changes into account.
2024-01-22 11:42:52 +00:00
nl6720
934288757c tree-wide: link to docs.kernel.org for kernel documentation
https://www.kernel.org/ links to https://docs.kernel.org/ for the documentation.
These URLs are shorter and nicer looking.
2024-01-22 10:50:33 +00:00
Andika Triwidada
0c27049007 po: Translated using Weblate (Indonesian)
Currently translated at 100.0% (227 of 227 strings)

Co-authored-by: Andika Triwidada <andika@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/id/
Translation: systemd/main
2024-01-22 10:15:22 +01:00
Adrian Vovk
720c618397 core: path: Re-enter waiting if target is deactivating
Previously, path units would remain in the running state while their
target unit is deactivating. This left a window of time where the target
unit is no longer operational (i.e. it is busy deactivating/cleaning
up/etc) but the path unit would continue to ignore inotify events. In
short: any inotify event that occurs while the target unit deactivates
would be completely lost.

With this commit, the path will go back into a waiting state when the
target unit starts deactivating. This means that any inotify event that
occurs while the target unit deactivates will queue a start job.
2024-01-21 10:34:45 +00:00
Yu Watanabe
1c62c4fe0b network/route: update MTU of IPv6 route even if the kernel returns -EEXIST 2024-01-20 22:17:26 +09:00
Mike Yuan
696f5da420
Merge pull request #31004 from AdrianVovk/misc-cleanups
Misc cleanups
2024-01-20 16:43:20 +08:00
Lennart Poettering
e4924fb0d1 ptyfwd: when leaving a session with tinted background, clear to end of screen
So if we tint the background of a ptyfwd session with a color and the
session ends, then so far we reset the bg color and clear till the end
of line.

Let's instead clear till the end of the screen. This is nicer since it
means that any follow-up output will not be affected by the changed
background color anymore.
2024-01-20 01:11:48 +00:00
Lennart Poettering
87da1af78f run: the --background= switch expects an argument
We got this right when running as "uid0", but wrong when invoked under
"systemd-run". Let's fix that.
2024-01-20 01:10:46 +00:00
Lennart Poettering
3cdfd6acf1
Merge pull request #31016 from poettering/pid1-priority-rework
pid1 event source priorities rework
2024-01-20 00:13:39 +01:00
Mike Yuan
017f53e192 loginctl: add --json= and -j to help text
Follow-up for ea54517476
2024-01-19 18:01:17 +00:00
Luca Boccassi
204d52c4b7 cgtop: fix sscanf return code checks
sscanf can return EOF on error, so check that we get a result instead.

CodeQL#2386 and CodeQL#2387
2024-01-19 18:00:23 +00:00
Luca Boccassi
201f6241ae
Merge pull request #31022 from aafeijoo-suse/bash-completion-cryptenroll-2
fix typo and add some missing options to bash-completion
2024-01-19 18:00:10 +00:00
Adrian Vovk
a15b9768ec
docs: Fix typo in USER_RECORD 2024-01-19 12:27:06 -05:00
Adrian Vovk
a1bdae3645
fd-util: Close function for FD_TO_PTR
Just a function to be used as a destructor (i.e. in a _cleanup_
attribute, hash table operations, etc.) that closes an fd wrapped in
FD_TO_PTR

It just retrieves the fd via PTR_TO_FD and closes it
2024-01-19 12:27:05 -05:00
Luca Boccassi
a0cca4d1b0 portable: log structured message when attach/detach succeeds
Currently portabled is completely silent (when not using debug level). But
when the system state is changed (ie: a portable is attached or detached)
there are no traces left in the journal. Log at info level when either of
those operations succeed, as they are effectively changing the state of
the system.

Create new MESSAGE_IDs for these logs, and also append PORTABLE_ROOT=
(and PORTABLE_EXTENSION= if any), like the units themselves are
configured to do via LogExtraFields=, so that the same metadata can
be found in the attach/detach messages and in logs from the units
themselves.
2024-01-19 17:03:04 +01:00
Luca Boccassi
c03a321ef6 man: clarify description of Attach/Detach flags 2024-01-19 15:56:18 +00:00
Lennart Poettering
9d2a292246 test: add integration test for Type=exec robustness
This tests for #30799, so that it does not return.
2024-01-19 16:51:55 +01:00
Lennart Poettering
8a69bf0c57 manager: order idle jobs
Let's put the run queue really the last spot, as we should only start
doing more work if we really have nothing else to do anymore.

Let's move the service watchdog after the rewatch PID logic for similar
logic: it will possibly result in new jobs being enqueued to stop
things, and we should really have done all other work first.
2024-01-19 16:46:28 +01:00
Lennart Poettering
90c40ea4bf manager: renumber priorities
no actual change, let's just make sure the priorities are densely
defined without "holes". Just to make this prettier and less surprising.
2024-01-19 16:46:28 +01:00
Lennart Poettering
f3a269a935 manager: process exec_fd (i.e. Type=exec) events before SIGCHLD events
We want to make sure we don't confuse the case "process started
successfully but then failed quickly" from the case "process failed to
start". Hence we need to make sure we take notice of Type=exec before we
bother with SIGCHLD.

Hence move EVENT_PRIORITY_EXEC_FD to the front. In fact, let's move it
even further up than SIGCHLD, i.e. before sd_notify() handling, so that
we don't end up processing service state change notifications before we
even considered that the service is properly started.

This also gives the cgroup OOM handling and the exec_fd handling
different priorities, to improve robustness of the system, we should act
quickly on OOM, and it doesn't matter if a service started succcessfully
if we have to act on OOM anyway.

This is based on Andrew Onyshchuk <andryk.rv@gmail.com> work here:

See: #30799
Fixes: #28304
2024-01-19 16:46:28 +01:00
Lennart Poettering
d42b61d279 core: maintain a single table with event source priorities
It's hard to oversee the assigned processing priorities of the various
event sources we have. Let's unify them in a table (an enum), where we
can have a single consisten look at them, and then reference the table
entries by expressive symbols.

This doesn#t change behaviour in any way, it just gives each priority a
nice label, but doesn't change any of the priorities.

Prompted by: #30799
2024-01-19 16:46:28 +01:00
Antonio Alvarez Feijoo
08c0b6efd8
dissect: fix typo 2024-01-19 16:01:13 +01:00
Antonio Alvarez Feijoo
43aaa1b3d3
bash-completion: add missing options to systemd-dissect 2024-01-19 15:50:15 +01:00
Antonio Alvarez Feijoo
c13d9199d6
bash-completion: add missing options to systemd-cryptenroll 2024-01-19 15:49:52 +01:00
Yu Watanabe
fe0c684b34 network: fix typo
Follow-up for 406fde1a4d.
2024-01-19 23:28:03 +09:00
Lennart Poettering
eb47cb6986
Merge pull request #31012 from YHNdnzj/pam-systemd-session-busy
pam_systemd: always check if session is busy
2024-01-19 15:08:37 +01:00
Lennart Poettering
f145216005
Merge pull request #31013 from YHNdnzj/logind-modernization-split
logind: minor modernizations
2024-01-19 15:06:17 +01:00
Luca Boccassi
b26be60efc
Merge pull request #31009 from yuwata/network-route-convert-before-requesting
network/route: convert routes before requesting
2024-01-19 13:20:32 +00:00