Compare commits

..

3 commits

Author SHA1 Message Date
Jan Synacek
f1095c6021 fix systemd-shutdown: Failed to parse /proc/self/moutinfo (#1554943)
Resolves: #1554943
2018-05-04 10:35:42 +02:00
Zbigniew Jędrzejewski-Szmek
20c4049c83 Moar patches 2018-02-21 12:37:32 +01:00
Zbigniew Jędrzejewski-Szmek
44a72b9a54 Backport a bunch of patches from v234..v235+ 2017-10-26 12:24:45 +02:00
45 changed files with 2663 additions and 5920 deletions

View file

@ -1,11 +0,0 @@
root = true
[*]
charset = utf-8
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.{yml,yaml}]
indent_size = 2

View file

@ -1 +0,0 @@
1

6
.gitignore vendored
View file

@ -1,5 +1,3 @@
*~
/.mail.list
/systemd-*/
/.build-*.log
/x86_64/
@ -7,7 +5,3 @@
/systemd-*.tar.xz
/systemd-*.tar.gz
/*.rpm
/mkosi.output/
/mkosi.cache/
/mkosi.builddir/
/mkosi.local.conf

View file

@ -1,7 +0,0 @@
- project:
vars:
install_repo_exclude:
- systemd-standalone-repart
- systemd-standalone-shutdown
- systemd-standalone-sysusers
- systemd-standalone-tmpfiles

View file

@ -1,88 +0,0 @@
From 61750e265ce3f7783a8dba831e91140f84ad89f2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 5 Nov 2025 17:52:16 +0100
Subject: [PATCH 1/3] Revert "units: drop runlevel[0-6].target"
This partially reverts commit e58ba80a40fb6e96543d56774a5bc5aa9cdadbf3.
The unit are still needed for compat.
---
units/meson.build | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/units/meson.build b/units/meson.build
index 2e04c4aa2b..46eaac4073 100644
--- a/units/meson.build
+++ b/units/meson.build
@@ -1,5 +1,7 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
+with_runlevels = conf.get('HAVE_SYSV_COMPAT') == 1
+
units = [
{ 'file' : 'basic.target' },
{ 'file' : 'blockdev@.target' },
@@ -49,7 +51,7 @@ units = [
},
{
'file' : 'graphical.target',
- 'symlinks' : ['default.target'],
+ 'symlinks' : ['default.target'] + (with_runlevels ? ['runlevel5.target'] : []),
},
{ 'file' : 'halt.target' },
{
@@ -142,7 +144,10 @@ units = [
'conditions' : ['ENABLE_MACHINED'],
},
{ 'file' : 'modprobe@.service' },
- { 'file' : 'multi-user.target' },
+ {
+ 'file' : 'multi-user.target',
+ 'symlinks' : with_runlevels ? ['runlevel2.target', 'runlevel3.target', 'runlevel4.target'] : [],
+ },
{
'file' : 'systemd-mute-console.socket',
'symlinks' : ['sockets.target.wants/']
@@ -155,7 +160,10 @@ units = [
{ 'file' : 'nss-lookup.target' },
{ 'file' : 'nss-user-lookup.target' },
{ 'file' : 'paths.target' },
- { 'file' : 'poweroff.target' },
+ {
+ 'file' : 'poweroff.target',
+ 'symlinks' : with_runlevels ? ['runlevel0.target'] : [],
+ },
{ 'file' : 'printer.target' },
{
'file' : 'proc-sys-fs-binfmt_misc.automount',
@@ -180,7 +188,7 @@ units = [
},
{
'file' : 'reboot.target',
- 'symlinks' : ['ctrl-alt-del.target'],
+ 'symlinks' : ['ctrl-alt-del.target'] + (with_runlevels ? ['runlevel6.target'] : []),
},
{
'file' : 'remote-cryptsetup.target',
@@ -200,7 +208,10 @@ units = [
'symlinks' : ['initrd-root-device.target.wants/'],
},
{ 'file' : 'rescue.service.in' },
- { 'file' : 'rescue.target' },
+ {
+ 'file' : 'rescue.target',
+ 'symlinks' : with_runlevels ? ['runlevel1.target'] : [],
+ },
{ 'file' : 'rpcbind.target' },
{ 'file' : 'serial-getty@.service.in' },
{ 'file' : 'shutdown.target' },
@@ -1001,4 +1012,10 @@ else
dbussessionservicedir / 'org.freedesktop.systemd1.service'))
endif
+if conf.get('HAVE_SYSV_COMPAT') == 1
+ foreach i : [1, 2, 3, 4, 5]
+ install_emptydir(systemunitdir / 'runlevel@0@.target.wants'.format(i))
+ endforeach
+endif
+
subdir('user')

View file

@ -0,0 +1,28 @@
From 63edce22867a8d2029842e3d8ba277547e628006 Mon Sep 17 00:00:00 2001
From: Fedora systemd team <systemd-maint@redhat.com>
Date: Fri, 4 May 2018 10:02:20 +0200
Subject: [PATCH] shutdown: fix incorrect fscanf() result check
(cherry picked from commit 3d4ec01269244c2d35a781abf748ea9ba57666e2)
Resolves: #1554943
---
src/core/umount.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/umount.c b/src/core/umount.c
index 87c5aa9..7e9ea20 100644
--- a/src/core/umount.c
+++ b/src/core/umount.c
@@ -97,7 +97,7 @@ static int mount_points_list_get(MountPoint **head) {
"%ms" /* (11) mount options */
"%*[^\n]", /* some rubbish at the end */
&path, &type, &options);
- if (k != 2) {
+ if (k != 3) {
if (k == EOF)
break;
--
2.14.3

View file

@ -1,32 +0,0 @@
From 8d6d86d1d7e45eeae921e88adde55d6524027c96 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 26 Nov 2025 22:29:53 +0100
Subject: [PATCH 3/3] machined: continue without resolve.hook socket
---
src/machine/machined-varlink.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/machine/machined-varlink.c b/src/machine/machined-varlink.c
index f83cbb8562..0b30cd0531 100644
--- a/src/machine/machined-varlink.c
+++ b/src/machine/machined-varlink.c
@@ -894,9 +894,15 @@ static int manager_varlink_init_resolve_hook(Manager *m) {
r = sd_varlink_server_listen_address(s, VARLINK_PATH_MACHINED_RESOLVE_HOOK,
0666 | SD_VARLINK_SERVER_MODE_MKDIR_0755);
- if (r < 0)
- return log_error_errno(r, "Failed to bind to varlink socket %s: %m",
- VARLINK_PATH_MACHINED_RESOLVE_HOOK);
+ if (r < 0) {
+ bool ignore = ERRNO_IS_NEG_PRIVILEGE(r);
+ log_full_errno(ignore ? LOG_WARNING : LOG_ERR,
+ r,
+ "Failed to bind to varlink socket %s%s: %m",
+ VARLINK_PATH_MACHINED_RESOLVE_HOOK,
+ ignore ? ", ignoring" : "");
+ return ignore ? 0 : r;
+ }
r = sd_varlink_server_attach_event(s, m->event, SD_EVENT_PRIORITY_NORMAL);
if (r < 0)

View file

@ -1,112 +0,0 @@
From 75890d949f92c412c0936b8536b2e0dc8f7dfb40 Mon Sep 17 00:00:00 2001
From: Nick Rosbrook <enr0n@ubuntu.com>
Date: Fri, 19 Dec 2025 11:01:49 -0500
Subject: [PATCH] ukify: omit .osrel section when --os-release= is empty
The primary motivation for this is to allow users of ukify to build
UKI-like objects, without having them later be detected as a UKI by
tools like kernel-install and bootctl.
The common code used by these tools to determine if a PE binary is a UKI
checks that both .osrel and .linux sections are present. Hence, adding
a mechansim to skip .osrel provides a way to avoid being labeled a UKI.
---
man/ukify.xml | 5 ++++-
src/ukify/test/test_ukify.py | 15 +++++++++++----
src/ukify/ukify.py | 10 +++++++++-
3 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/man/ukify.xml b/man/ukify.xml
index 829761642d..7462c5c92f 100644
--- a/man/ukify.xml
+++ b/man/ukify.xml
@@ -365,7 +365,10 @@
<listitem><para>The os-release description (the <literal>.osrel</literal> section). The argument
may be a literal string, or <literal>@</literal> followed by a path name. If not specified, the
<citerefentry><refentrytitle>os-release</refentrytitle><manvolnum>5</manvolnum></citerefentry> file
- will be picked up from the host system.</para>
+ will be picked up from the host system. If explicitly set to an empty string, the ".osrel" section
+ is omitted from the UKI (this is not recommended in most cases, and causes the resulting artifact
+ to not be recognized as a UKI by other tools like <command>kernel-install</command>
+ and <command>bootctl</command>).</para>
<xi:include href="version-info.xml" xpointer="v253"/></listitem>
</varlistentry>
diff --git a/src/ukify/test/test_ukify.py b/src/ukify/test/test_ukify.py
index f75ef0c891..224a38569f 100755
--- a/src/ukify/test/test_ukify.py
+++ b/src/ukify/test/test_ukify.py
@@ -641,7 +641,7 @@ def test_efi_signing_pesign(kernel_initrd, tmp_path):
shutil.rmtree(tmp_path)
-def test_inspect(kernel_initrd, tmp_path, capsys):
+def test_inspect(kernel_initrd, tmp_path, capsys, osrel=True):
if kernel_initrd is None:
pytest.skip('linux+initrd not found')
if not shutil.which('sbsign'):
@@ -653,7 +653,7 @@ def test_inspect(kernel_initrd, tmp_path, capsys):
output = f'{tmp_path}/signed2.efi'
uname_arg='1.2.3'
- osrel_arg='Linux'
+ osrel_arg='Linux' if osrel else ''
cmdline_arg='ARG1 ARG2 ARG3'
args = [
@@ -680,8 +680,12 @@ def test_inspect(kernel_initrd, tmp_path, capsys):
text = capsys.readouterr().out
- expected_osrel = f'.osrel:\n size: {len(osrel_arg)}'
- assert expected_osrel in text
+ if osrel:
+ expected_osrel = f'.osrel:\n size: {len(osrel_arg)}'
+ assert expected_osrel in text
+ else:
+ assert '.osrel:' not in text
+
expected_cmdline = f'.cmdline:\n size: {len(cmdline_arg)}'
assert expected_cmdline in text
expected_uname = f'.uname:\n size: {len(uname_arg)}'
@@ -694,6 +698,9 @@ def test_inspect(kernel_initrd, tmp_path, capsys):
shutil.rmtree(tmp_path)
+def test_inspect_no_osrel(kernel_initrd, tmp_path, capsys):
+ test_inspect(kernel_initrd, tmp_path, capsys, osrel=False)
+
@pytest.mark.skipif(not slow_tests, reason='slow')
def test_pcr_signing(kernel_initrd, tmp_path):
if kernel_initrd is None:
diff --git a/src/ukify/ukify.py b/src/ukify/ukify.py
index c98f8e2a5d..b7542c7eca 100755
--- a/src/ukify/ukify.py
+++ b/src/ukify/ukify.py
@@ -1477,6 +1477,9 @@ def make_uki(opts: UkifyConfig) -> None:
'.profile',
}
+ if not opts.os_release:
+ to_import.remove('.osrel')
+
for profile in opts.join_profiles:
pe = pefile.PE(profile, fast_load=True)
prev_len = len(uki.sections)
@@ -2412,7 +2415,12 @@ def finalize_options(opts: argparse.Namespace) -> None:
opts.os_release = resolve_at_path(opts.os_release)
- if not opts.os_release and opts.linux:
+ if opts.os_release == '':
+ # If --os-release= with an empty string was passed, treat that as
+ # explicitly disabling the .osrel section, and do not fallback to the
+ # system's os-release files.
+ pass
+ elif opts.os_release is None and opts.linux:
p = Path('/etc/os-release')
if not p.exists():
p = Path('/usr/lib/os-release')
--
2.52.0

View file

@ -1,51 +0,0 @@
From e57e599e6b11039ab6484e5622b3deae20bfd678 Mon Sep 17 00:00:00 2001
From: Hans de Goede <johannes.goede@oss.qualcomm.com>
Date: Mon, 12 Jan 2026 14:56:36 +0100
Subject: [PATCH] stub: Fix NULL pointer deref when there are no initrds
When n_all_initrds == 0, then all_initrds is unmodified from its initial
value of:
_cleanup_free_ struct iovec *all_initrds = NULL;
and in the else block of the "if (n_all_initrds > 1)" the NULL is
dereferenced:
final_initrd = all_initrds[0];
Leading to the stub crashing due to a NULL pointer deref.
Fix this by initializing final_initrd to all 0s and only
running the else block if (n_all_initrds == 1).
---
src/boot/stub.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/boot/stub.c b/src/boot/stub.c
index 06ecbc7d18..65950262c6 100644
--- a/src/boot/stub.c
+++ b/src/boot/stub.c
@@ -1302,9 +1302,9 @@ static EFI_STATUS run(EFI_HANDLE image) {
/* Combine the initrds into one */
_cleanup_pages_ Pages initrd_pages = {};
- struct iovec final_initrd;
+ struct iovec final_initrd = {};
if (n_all_initrds > 1) {
- /* There will always be a base initrd, if this counter is higher, we need to combine them */
+ /* If there is more then 1 initrd we need to combine them */
err = combine_initrds(all_initrds, n_all_initrds, &initrd_pages, &final_initrd.iov_len);
if (err != EFI_SUCCESS)
return err;
@@ -1313,7 +1313,7 @@ static EFI_STATUS run(EFI_HANDLE image) {
/* Given these might be large let's free them explicitly before we pass control to Linux */
initrds_free(&initrds);
- } else
+ } else if (n_all_initrds == 1)
final_initrd = all_initrds[0];
struct iovec kernel = IOVEC_MAKE(
--
2.52.0

View file

@ -0,0 +1,51 @@
From 108c060c5521309b9448e3a7905b50dd505f36a8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 11 Mar 2016 17:06:17 -0500
Subject: [PATCH] resolved: create /etc/resolv.conf symlink at runtime
If the symlink doesn't exists, and we are being started, let's
create it to provie name resolution.
If it exists, do nothing. In particular, if it is a broken symlink,
we cannot really know if the administator configured it to point to
a location used by some service that hasn't started yet, so we
don't touch it in that case either.
https://bugzilla.redhat.com/show_bug.cgi?id=1313085
---
src/resolve/resolved.c | 4 ++++
tmpfiles.d/etc.conf.m4 | 3 ---
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/resolve/resolved.c b/src/resolve/resolved.c
index deb75f9ae5..914d3b8a2d 100644
--- a/src/resolve/resolved.c
+++ b/src/resolve/resolved.c
@@ -67,6 +67,10 @@ int main(int argc, char *argv[]) {
goto finish;
}
+ r = symlink("../run/systemd/resolve/resolv.conf", "/etc/resolv.conf");
+ if (r < 0 && errno != EEXIST)
+ log_warning_errno(errno, "Could not create /etc/resolv.conf symlink: %m");
+
/* Drop privileges, but keep three caps. Note that we drop those too, later on (see below) */
r = drop_privileges(uid, gid,
(UINT64_C(1) << CAP_NET_RAW)| /* needed for SO_BINDTODEVICE */
diff --git a/tmpfiles.d/etc.conf.m4 b/tmpfiles.d/etc.conf.m4
index 064eae94f1..928105ea8d 100644
--- a/tmpfiles.d/etc.conf.m4
+++ b/tmpfiles.d/etc.conf.m4
@@ -13,9 +13,6 @@ L+ /etc/mtab - - - - ../proc/self/mounts
m4_ifdef(`HAVE_SMACK_RUN_LABEL',
t /etc/mtab - - - - security.SMACK64=_
)m4_dnl
-m4_ifdef(`ENABLE_RESOLVED',
-L! /etc/resolv.conf - - - - ../usr/lib/systemd/resolv.conf
-)m4_dnl
C /etc/nsswitch.conf - - - -
m4_ifdef(`HAVE_PAM',
C /etc/pam.d - - - -
--
2.9.2

View file

@ -1,3 +0,0 @@
# Increase the number of virtual memory areas that one process may request
# https://fedoraproject.org/wiki/Changes/IncreaseVmMaxMapCount
vm.max_map_count=1048576

View file

@ -1,2 +0,0 @@
[OOM]
DefaultMemoryPressureDurationSec=20s

View file

@ -1,3 +0,0 @@
[Slice]
ManagedOOMMemoryPressure=kill
ManagedOOMMemoryPressureLimit=80%

View file

@ -1,14 +0,0 @@
# This file is part of the systemd package.
# See https://fedoraproject.org/wiki/Changes/Shorter_Shutdown_Timer.
#
# To facilitate debugging when a service fails to stop cleanly,
# TimeoutStopFailureMode=abort is set to "crash" services that fail to stop in
# the time allotted. This will cause the service to be terminated with SIGABRT
# and a coredump to be generated.
#
# To undo this configuration change, create a mask file:
# sudo mkdir -p /etc/systemd/system/service.d
# sudo ln -sv /dev/null /etc/systemd/system/service.d/10-timeout-abort.conf
[Service]
TimeoutStopFailureMode=abort

51
20-grubby.install Executable file
View file

@ -0,0 +1,51 @@
#!/bin/bash
if [[ ! -x /sbin/new-kernel-pkg ]]; then
exit 0
fi
COMMAND="$1"
KERNEL_VERSION="$2"
BOOT_DIR_ABS="$3"
KERNEL_IMAGE="$4"
KERNEL_DIR="${KERNEL_IMAGE%/*}"
[[ "$KERNEL_VERSION" == *\+* ]] && flavor=-"${KERNEL_VERSION##*+}"
case "$COMMAND" in
add)
if [[ "${KERNEL_DIR}" != "/boot" ]]; then
for i in \
"$KERNEL_IMAGE" \
"$KERNEL_DIR"/System.map \
"$KERNEL_DIR"/config \
"$KERNEL_DIR"/zImage.stub \
"$KERNEL_DIR"/dtb \
; do
[[ -e "$i" ]] || continue
cp -aT "$i" "/boot/${i##*/}-${KERNEL_VERSION}"
command -v restorecon &>/dev/null && \
restorecon -R "/boot/${i##*/}-${KERNEL_VERSION}"
done
# hmac is .vmlinuz-<version>.hmac so needs a special treatment
i="$KERNEL_DIR/.${KERNEL_IMAGE##*/}.hmac"
if [[ -e "$i" ]]; then
cp -a "$i" "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac"
command -v restorecon &>/dev/null && \
restorecon "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac"
fi
fi
/sbin/new-kernel-pkg --package "kernel${flavor}" --install "$KERNEL_VERSION" || exit $?
/sbin/new-kernel-pkg --package "kernel${flavor}" --mkinitrd --dracut --depmod --update "$KERNEL_VERSION" || exit $?
/sbin/new-kernel-pkg --package "kernel${flavor}" --rpmposttrans "$KERNEL_VERSION" || exit $?
;;
remove)
/sbin/new-kernel-pkg --package "kernel${flavor+-$flavor}" --rminitrd --rmmoddep --remove "$KERNEL_VERSION" || exit $?
;;
*)
;;
esac
# skip other installation plugins, if we can't find a boot loader spec conforming setup
if ! [[ -d /boot/loader/entries || -L /boot/loader/entries ]]; then
exit 77
fi

View file

@ -1,30 +0,0 @@
From 6b25470ee28843a49c50442e9d8a98edc842ceca Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Mon, 20 Feb 2023 12:00:30 +0900
Subject: [PATCH] core/manager: run generators directly when we are in initrd
Some initrd system write files at ourside of /run, /etc, or other
allowed places. This is a kind of workaround, but in most cases, such
sandboxing is not necessary as the filesystem is on ramfs when we are in
initrd.
Fixes #26488.
---
src/core/manager.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/core/manager.c b/src/core/manager.c
index 7b394794b0d4..306477c6e6c2 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -3822,8 +3822,8 @@ static int manager_run_generators(Manager *m) {
/* If we are the system manager, we fork and invoke the generators in a sanitized mount namespace. If
* we are the user manager, let's just execute the generators directly. We might not have the
* necessary privileges, and the system manager has already mounted /tmp/ and everything else for us.
- */
- if (MANAGER_IS_USER(m)) {
+ * If we are in initrd, let's also execute the generators directly, as we are in ramfs. */
+ if (MANAGER_IS_USER(m) || in_initrd()) {
r = manager_execute_generators(m, paths, /* remount_ro= */ false);
goto finish;
}

View file

@ -1,56 +0,0 @@
From 07bedc8f93277f705622625f440a1f56ccff1cd0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 9 Jan 2024 11:28:04 +0100
Subject: [PATCH] journal: again create user journals for users with high uids
This effectively reverts a change in 115d5145a257c1a27330acf9f063b5f4d910ca4d
'journald: move uid_for_system_journal() to uid-alloc-range.h', which slipped
in an additional check of uid_is_container(uid). The problem is that that change
is not backwards-compatible at all and very hard for users to handle.
There is no common agreement on mappings of high-range uids. Systemd declares
ownership of a large range for container uids in https://systemd.io/UIDS-GIDS/,
but this is only a recent change and various sites allocated those ranges
in a different way, in particular FreeIPA uses (used?) uids from this range
for human users. On big sites with lots of users changing uids is obviously a
hard problem. We generally assume that uids cannot be "freed" and/or changed
and/or reused safely, so we shouldn't demand the same from others.
This is somewhat similar to the situation with SYSTEM_ALLOC_UID_MIN /
SYSTEM_UID_MAX, which we tried to define to a fixed value in our code, causing
huge problems for existing systems with were created with a different
definition and couldn't be easily updated. For that case, we added a
configuration time switch and we now parse /etc/login.defs to actually use the
value that is appropriate for the local system.
Unfortunately, login.defs doesn't have a concept of container allocation ranges
(and we don't have code to parse and use those nonexistent names either), so we
can't tell users to adjust logind.defs to work around the changed definition.
login.defs has SUB_UID_{MIN,MAX}, but those aren't really the same thing,
because they are used to define where the add allocations for subuids, which is
generally a much smaller range. Maybe we should talk with other folks about
the appropriate allocation ranges and define some new settings in login.defs.
But this would require discussion and coordination with other projects first.
Actualy, it seems that this change was needed at all. The code in the container
does not log to the outside journal. It talks to its own journald, which does
journal splitting using its internal logic based on shifted uids. So let's
revert the change to fix user systems.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2251843.
---
src/basic/uid-classification.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/basic/uid-classification.c b/src/basic/uid-classification.c
index 203ce2c68a..2eb384395d 100644
--- a/src/basic/uid-classification.c
+++ b/src/basic/uid-classification.c
@@ -129,5 +129,6 @@ bool uid_for_system_journal(uid_t uid) {
/* Returns true if the specified UID shall get its data stored in the system journal. */
- return uid_is_system(uid) || uid_is_dynamic(uid) || uid_is_greeter(uid) || uid == UID_NOBODY || uid_is_container(uid) || uid_is_foreign(uid);
+ return uid_is_system(uid) || uid_is_dynamic(uid) || uid_is_greeter(uid) || uid == UID_NOBODY || uid_is_foreign(uid);
+
}

View file

@ -1,42 +0,0 @@
From 00d70f36a0866660693347009446b7f872a05bf4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
Date: Sat, 30 Aug 2025 13:55:56 +0200
Subject: [PATCH] core: create userdb root directory with correct label
Set up the /run/systemd/userdb directory with the default SELinux context
on creation.
With version 257.7-1 on Debian the directory was automatically created with the
correct label. Starting with version 258 (only tested with 258~rc3-1) it no
longer is. Regression introduced in 736349958efe34089131ca88950e2e5bb391d36a.
[zjs: edited the patch to apply comments from review and update the description.]
---
src/core/varlink.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/core/varlink.c b/src/core/varlink.c
index 99f12c59e5..71a8ffd0e5 100644
--- a/src/core/varlink.c
+++ b/src/core/varlink.c
@@ -5,6 +5,7 @@
#include "constants.h"
#include "errno-util.h"
#include "manager.h"
+#include "mkdir-label.h"
#include "path-util.h"
#include "pidref.h"
#include "string-util.h"
@@ -441,7 +442,11 @@ static int manager_varlink_init_system(Manager *m) {
if (!fresh && varlink_server_contains_socket(m->varlink_server, address))
continue;
- r = sd_varlink_server_listen_address(m->varlink_server, address, 0666 | SD_VARLINK_SERVER_MODE_MKDIR_0755);
+ r = mkdir_parents_label(address, 0755);
+ if (r < 0)
+ log_warning_errno(r, "Failed to create parent directory of '%s', ignoring: %m", address);
+
+ r = sd_varlink_server_listen_address(m->varlink_server, address, 0666);
if (r < 0)
return log_error_errno(r, "Failed to bind to varlink socket '%s': %m", address);
}

View file

@ -1,5 +0,0 @@
# do not edit this file, it will be overwritten on update
ACTION=="add", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", \
KERNEL=="mmcblk*[0-9]|msblk*[0-9]|mspblk*[0-9]|sd*[!0-9]|sr*", \
ATTR{queue/scheduler}="bfq"

11
85-display-manager.preset Normal file
View file

@ -0,0 +1,11 @@
# We enable all display managers by default. Since only one can
# actually be enabled at the same time the one which is installed
# first wins
enable gdm.service
enable lightdm.service
enable slim.service
enable lxdm.service
enable sddm.service
enable kdm.service
enable xdm.service

126
90-default.preset Normal file
View file

@ -0,0 +1,126 @@
# Also see:
# https://fedoraproject.org/wiki/Starting_services_by_default
# On Fedora we deviate from some upstream defaults
disable systemd-timesyncd.service
disable systemd-networkd.service
disable systemd-resolved.service
# System stuff
enable sshd.service
enable atd.*
enable crond.*
enable chronyd.service
enable NetworkManager.service
enable NetworkManager-dispatcher.service
enable ModemManager.service
enable auditd.service
enable restorecond.service
enable bluetooth.*
enable avahi-daemon.*
enable cups.*
# The various syslog implementations
enable rsyslog.*
enable syslog-ng.*
enable sysklogd.*
# Network facing
enable firewalld.service
enable libvirtd.service
enable xinetd.service
enable ladvd.service
# Storage
enable multipathd.service
enable libstoragemgmt.service
enable lvm2-monitor.*
enable lvm2-lvmetad.*
enable dm-event.*
enable dmraid-activation.service
# https://bugzilla.redhat.com/show_bug.cgi?id=855372
enable mdmonitor.service
enable mdmonitor-takeover.service
# https://bugzilla.redhat.com/show_bug.cgi?id=876237
enable spice-vdagentd.service
# https://bugzilla.redhat.com/show_bug.cgi?id=885406
enable qemu-guest-agent.service
# https://bugzilla.redhat.com/show_bug.cgi?id=928726
enable dnf-makecache.timer
# https://bugzilla.redhat.com/show_bug.cgi?id=929403
enable initial-setup-graphical.service
enable initial-setup-text.service
# https://bugzilla.redhat.com/show_bug.cgi?id=957135
enable vmtoolsd.service
# https://bugzilla.redhat.com/show_bug.cgi?id=976315
enable dkms.service
# https://bugzilla.redhat.com/show_bug.cgi?id=961878
enable ipmi.service
enable ipmievd.service
# https://bugzilla.redhat.com/show_bug.cgi?id=1039351
enable x509watch.timer
# https://bugzilla.redhat.com/show_bug.cgi?id=1060754
enable dnssec-triggerd.service
# https://bugzilla.redhat.com/show_bug.cgi?id=1095353
enable uuidd.socket
# Hardware
enable gpm.*
# https://bugzilla.redhat.com/show_bug.cgi?id=1066421
enable gpsd.socket
# https://bugzilla.redhat.com/show_bug.cgi?id=1141607
enable x2gocleansessions.service
# https://fedoraproject.org/wiki/Changes/UEFISecureBootBlacklistUpdates
#
enable dbxtool.service
enable irqbalance.service
enable lm_sensors.service
enable mcelog.*
enable acpid.*
enable smartd.service
enable pcscd.socket
enable rngd.service
# Other stuff
enable abrtd.service
enable abrt-ccpp.service
enable abrt-oops.service
enable abrt-xorg.service
enable abrt-vmcore.service
enable lttng-sessiond.service
enable ksm.service
enable ksmtuned.service
enable rootfs-resize.service
enable sysstat.service
enable sysstat-collect.timer
enable sysstat-summary.timer
enable uuidd.service
enable xendomains.service
enable xenstored.service
enable xenconsoled.service
# Desktop stuff
enable accounts-daemon.service
enable rtkit-daemon.service
enable upower.service
enable udisks2.service
enable polkit.service
enable packagekit-offline-update.service
# https://bugzilla.redhat.com/show_bug.cgi?id=1187072
enable timedatex.service

View file

@ -1,20 +0,0 @@
# SPDX-License-Identifier: MIT-0
#
# This config file is installed as part of systemd.
# It may be freely copied and edited (following the MIT No Attribution license).
#
# To make local modifications, one of the following methods may be used:
# 1. add a drop-in file that extends this file by creating the
# /etc/systemd/network/98-default-mac-none.link.d/ directory and creating a
# new .conf file there.
# 2. copy this file into /etc/systemd/network or one of the other paths checked
# by systemd-udevd and edit it there.
# This file should not be edited in place, because it'll be overwritten on upgrades.
[Match]
Kind=bridge bond team
[Link]
NamePolicy=keep kernel database onboard slot path
AlternativeNamesPolicy=database onboard slot path
MACAddressPolicy=none

View file

@ -0,0 +1 @@
disable *

View file

@ -1,14 +0,0 @@
# Building systemd rpms for local development using rpmbuild --build-in-place
This approach is based on filbranden's [git-rpmbuild](https://github.com/filbranden/git-rpmbuild)
and his [talk during ASG2019](https://www.youtube.com/watch?v=fVM1kJrymRM).
```
git clone https://github.com/systemd/systemd
fedpkg clone systemd fedora-systemd
cd systemd
rpmbuild -bb --build-in-place --noprep --define "_sourcedir $PWD/../fedora-systemd" --define "_rpmdir $PWD/rpms" --with upstream ../fedora-systemd/systemd.spec
sudo dnf upgrade --setopt install_weak_deps=False rpms/*/*.rpm
```
`--without lto` and `--without tests` may be useful to speed up the build.

3221
changelog

File diff suppressed because it is too large Load diff

View file

@ -1,3 +0,0 @@
[suppress_file]
# Those shared objects are private to systemd
file_name_regexp=libsystemd-(shared|core)-.*.so

View file

@ -1,10 +0,0 @@
# RPM macros for packages creating system accounts
#
# Turn a sysusers.d file into macros specified by
# https://docs.fedoraproject.org/en-US/packaging-guidelines/UsersAndGroups/#_dynamic_allocation
#
# After https://fedoraproject.org/wiki/Changes/RPMSuportForSystemdSysusers,
# those macros are not needed anymore.
%sysusers_requires_compat %nil
%sysusers_create_compat() %nil

View file

@ -1,10 +0,0 @@
# RPM macros for packages creating system accounts
#
# Turn a sysusers.d file into macros specified by
# https://docs.fedoraproject.org/en-US/packaging-guidelines/UsersAndGroups/#_dynamic_allocation
%sysusers_requires_compat Requires(pre): shadow-utils
%sysusers_create_compat() \
%(%{_rpmconfigdir}/sysusers.generate-pre.sh %{?*}) \
%{nil}

View file

@ -1,53 +0,0 @@
#!/bin/bash
set -e
verb="$1"
[ "$verb" = "-s" ] && do_send=1 || do_send=
[ -n "$do_send" ] && [ -z "$server" -o -z "login" ] && { echo '$server and $login need to be set'; exit 1; }
header=
from=systemd-maint@fedoraproject.org
time='2 years ago'
# time='1 day ago'
port=587
for user in "$@"; do
echo "checking $user"
p=$(git log -1 --all --author "$user")
if [ -z "$p" ]; then
echo "No commits from $user, check spelling"
exit 1
fi
t=$(git shortlog --all --author "$user" --since "@{$time}" | wc -l)
if [ $t != 0 ]; then
echo "$t commits in the last two years, OK"
echo
continue
fi
echo "$p" | head -n6
echo ".. adding to list"
if [ -z "$header" ]; then
echo '$USER$;$EMAIL$' >.mail.list
header=done
fi
echo "$user;$user@fedoraproject.org" >>.mail.list
echo
done
[ -z "$header" ] && exit 0
[ -n "$do_send" ] || exit 0
echo "Sending mails…"
set -x
massmail -F "$from" \
-C "$from" \
-S 'write access to the fedora systemd package' \
-z "$server" -u "$login" -P "$port" \
.mail.list <owner-check.template

View file

@ -1,20 +0,0 @@
Dear $USER$,
the automation to check activity in the systemd dist-git repo [1]
determined that you haven't done any commits in the last two years.
To decrease the potential for unauthorized access, such checks will be
executed periodically. Not-used accounts with write access to the repo
will be downgraded to "ticket" (no write privileges).
If you want to retain access, please reply to this mail.
Otherwise, in two weeks, your access mode will be changed to "ticket".
Even without write access, anyone can open a pull request in pagure,
so write access is not necessary to contribute to the package.
Obviously such changes not permanent, so even if your access mode is
downgraded, it can easily be restored later on.
Yours friendly,
./owner-check.sh
[1] https://src.fedoraproject.org/rpms/systemd

View file

@ -1,127 +0,0 @@
#!/bin/bash
set -eux
set -o pipefail
# Switch SELinux to permissive if possible, since the tests don't set proper contexts
setenforce 0 || true
echo "CPU and Memory information:"
lscpu
lsmem
echo "Clock source: $(cat /sys/devices/system/clocksource/clocksource0/current_clocksource)"
# Bump inotify limits if we can so nspawn containers don't run out of inotify file descriptors.
sysctl fs.inotify.max_user_watches=65536 || true
sysctl fs.inotify.max_user_instances=1024 || true
if [[ -n "${KOJI_TASK_ID:-}" ]]; then
koji download-task --noprogress --arch="noarch,$(rpm --eval '%{_arch}')" "$KOJI_TASK_ID"
elif [[ -n "${CBS_TASK_ID:-}" ]]; then
cbs download-task --noprogress --arch="noarch,$(rpm --eval '%{_arch}')" "$CBS_TASK_ID"
elif [[ -n "${PACKIT_SRPM_URL:-}" ]]; then
COPR_BUILD_ID="$(basename "$(dirname "$PACKIT_SRPM_URL")")"
COPR_CHROOT="$(basename "$(dirname "$(dirname "$PACKIT_BUILD_LOG_URL")")")"
copr download-build --rpms --chroot "$COPR_CHROOT" "$COPR_BUILD_ID"
mv "$COPR_CHROOT"/* .
else
echo "Not running within packit and no CBS/koji task ID provided"
exit 1
fi
PACKAGEDIR="$PWD"
# This will match both the regular and the debuginfo rpm so make sure we select only the
# non-debuginfo rpm.
RPMS=(systemd-tests-*.rpm)
rpm2cpio "${RPMS[0]}" | cpio --make-directories --extract
pushd usr/lib/systemd/tests
mkosi_hash="$(grep "MinimumVersion=commit:" mkosi/mkosi.conf | sed "s|MinimumVersion=commit:||g")"
# Now prepare mkosi at the same version required by the systemd repo.
git clone https://github.com/systemd/mkosi /var/tmp/systemd-integration-tests-mkosi
git -C /var/tmp/systemd-integration-tests-mkosi checkout "$mkosi_hash"
export PATH="/var/tmp/systemd-integration-tests-mkosi/bin:$PATH"
# shellcheck source=/dev/null
. /etc/os-release || . /usr/lib/os-release
tee mkosi/mkosi.local.conf <<EOF
[Distribution]
Distribution=${MKOSI_DISTRIBUTION:-$ID}
Release=${MKOSI_RELEASE:-${VERSION_ID:-rawhide}}
[Content]
PackageDirectories=$PACKAGEDIR
SELinuxRelabel=yes
[Build]
ToolsTreeDistribution=${MKOSI_DISTRIBUTION:-$ID}
ToolsTreeRelease=${MKOSI_RELEASE:-${VERSION_ID:-rawhide}}
ToolsTreePackageDirectories=$PACKAGEDIR
Environment=NO_BUILD=1
WithTests=yes
EOF
if [[ -n "${MKOSI_REPOSITORIES:-}" ]]; then
tee --append mkosi/mkosi.local.conf <<EOF
[Distribution]
Repositories=$MKOSI_REPOSITORIES
[Build]
ToolsTreeRepositories=$MKOSI_REPOSITORIES
EOF
fi
if [[ -n "${TEST_SELINUX_CHECK_AVCS:-}" ]]; then
tee --append mkosi/mkosi.local.conf <<EOF
[Runtime]
KernelCommandLineExtra=systemd.setenv=TEST_SELINUX_CHECK_AVCS=$TEST_SELINUX_CHECK_AVCS
EOF
fi
# If we don't have KVM, skip running in qemu, as it's too slow. But try to load the module first.
modprobe kvm || true
if [[ ! -e /dev/kvm ]]; then
export TEST_NO_QEMU=1
fi
NPROC="$(nproc)"
if [[ "$NPROC" -ge 10 ]]; then
export TEST_JOURNAL_USE_TMP=1
NPROC="$((NPROC / 3))"
else
NPROC="$((NPROC - 1))"
fi
# This test is only really useful if we're building with sanitizers and takes a long time, so let's skip it
# for now.
export TEST_SKIP="TEST-21-DFUZZER ${TEST_SKIP:-}"
mkosi genkey
mkosi summary
mkosi -f box -- true
mkosi box -- meson setup build integration-tests/standalone
mkosi -f
if [[ "$(mkosi box -- meson test --help)" == *"--max-lines"* ]]; then
MAX_LINES=(--max-lines 300)
else
MAX_LINES=()
fi
mkosi box -- \
meson test \
-C build \
--setup=integration \
--print-errorlogs \
--no-stdsplit \
--num-processes "$NPROC" \
"${MAX_LINES[@]}" && EC=0 || EC=$?
[[ -d build/meson-logs ]] && find build/meson-logs -type f -exec mv {} "$TMT_TEST_DATA" \;
[[ -d build/test/journal ]] && find build/test/journal -type f -exec mv {} "$TMT_TEST_DATA" \;
popd
exit "$EC"

View file

@ -1,22 +0,0 @@
summary: systemd upstream test suite
provision:
hardware:
virtualization:
is-supported: true
prepare:
- name: install-dependencies
how: install
package:
- coreutils
- distribution-gpg-keys
- dnf
- git-core
- koji
- centos-packager
- copr-cli
exclude:
- systemd-standalone-.*
execute:
how: tmt
script: exec plans/run-integration-tests.sh
duration: 2h

View file

@ -1,24 +0,0 @@
# Disable badfuncs check that has tons of false positives.
badfuncs:
allowed:
/usr/lib/systemd/tests/unit-tests/*:
- inet_addr
- inet_aton
/usr/bin/networkctl:
- inet_addr
- inet_aton
# don't report changed content of compiled files
# that is expected with every update
changedfiles:
exclude_path: .*
# completely disable inspections:
inspections:
# we know about our patches, no need to report anything
patches: off
# this inspection uses `udevadm` which comes from this package
# disable so we do not check udev rules with a possibly outdated version
# of the command
udevrules: off

View file

@ -1 +1 @@
SHA512 (systemd-259.tar.gz) = ef46b13661df43e3cfbeee1bc22f0b1eb902e8ebe39c19868c465efd08b35a199c2a2cd9d8021a6bc4d692fa0c6e0eab3f13eecd6ce24dde81d3945464a25b50
SHA512 (systemd-5f8984e.tar.gz) = 56da8d13d3ba2d51d41d7268912e798cf35e579c204f3ecf949ff383f392e83fbc6a92352b4ca5b0789e2d018f5dcf3af9c934f10d20e17db80e604c67628c4b

View file

@ -1,298 +0,0 @@
import re, sys, os, collections
buildroot = sys.argv[1]
no_bootloader = '--no-bootloader' in sys.argv
known_files = '''
%ghost %config(noreplace) /etc/crypttab
%ghost %attr(0444,root,root) /etc/udev/hwdb.bin
/etc/inittab
# This directory is owned by openssh-server, but we don't want to introduce
# a dependency. So let's copy the config and co-own the directory.
%dir %attr(0700,root,root) /etc/ssh/sshd_config.d
%ghost %config(noreplace) /etc/vconsole.conf
%ghost %config(noreplace) /etc/X11/xorg.conf.d/00-keyboard.conf
%ghost %attr(0664,root,root) %verify(not group) /run/utmp
%ghost %attr(0664,root,root) %verify(not group) /var/log/wtmp
%ghost %attr(0660,root,root) %verify(not group) /var/log/btmp
%ghost %attr(0664,root,root) %verify(not md5 size mtime group) /var/log/lastlog
%ghost %config(noreplace) /etc/hostname
%ghost %config(noreplace) /etc/localtime
%ghost %config(noreplace) /etc/locale.conf
%ghost %attr(0444,root,root) %config(noreplace) /etc/machine-id
%ghost %config(noreplace) /etc/machine-info
%ghost %attr(0700,root,root) %dir /var/cache/private
%ghost %attr(0700,root,root) %dir /var/lib/private
%ghost %dir /var/lib/private/systemd
%ghost %dir /var/lib/private/systemd/journal-upload
%ghost /var/lib/private/systemd/journal-upload/state
%ghost %dir /var/lib/systemd/timesync
%ghost /var/lib/systemd/timesync/clock
%ghost %dir /var/lib/systemd/backlight
%ghost /var/lib/systemd/catalog/database
%ghost %dir /var/lib/systemd/coredump
%ghost /var/lib/systemd/journal-upload
%ghost %dir /var/lib/systemd/linger
%ghost %attr(0600,root,root) /var/lib/systemd/random-seed
%ghost %dir /var/lib/systemd/rfkill
%ghost %dir %verify(not mode group) /var/log/journal
%ghost %dir /var/log/journal/remote
%ghost %attr(0700,root,root) %dir /var/log/private
'''
known_files = {line.split()[-1]:line for line in known_files.splitlines()
if line and not line.startswith('#')}
def files(root):
os.chdir(root)
todo = collections.deque(['.'])
while todo:
n = todo.pop()
files = os.scandir(n)
for file in files:
yield file
if file.is_dir() and not file.is_symlink():
todo.append(file)
outputs = {suffix: open(f'.file-list-{suffix}', 'w')
for suffix in (
'shared',
'libs',
'udev',
'ukify',
'boot',
'pam',
'rpm-macros',
'sysusers',
'devel',
'container',
'networkd',
'networkd-defaults',
'oomd-defaults',
'remote',
'resolve',
'tests',
'standalone-repart',
'standalone-tmpfiles',
'standalone-sysusers',
'standalone-shutdown',
'main',
)}
for file in files(buildroot):
n = file.path[1:]
if re.match(r'''/usr/(share|include)$|
/usr/share/man(/man.|)$|
/usr/share/zsh(/site-functions|)$|
/usr/share/dbus-1$|
/usr/share/dbus-1/system.d$|
/usr/share/dbus-1/(system-|)services$|
/usr/share/polkit-1(/actions|/rules.d|)$|
/usr/share/pkgconfig$|
/usr/share/bash-completion(/completions|)$|
/usr(/lib|/lib64|/bin|/sbin|)$|
/usr/lib.*/(security|pkgconfig)$|
/usr/lib/rpm(/macros.d|)$|
/usr/lib/firewalld(/services|)$|
/usr/share/(locale|licenses|doc)| # no $
/etc(/pam\.d|/xdg|/X11|/X11/xinit|/X11.*\.d|)$|
/etc/(dnf|dnf/protected.d)$|
/usr/(src|lib/debug)| # no $
/run$|
/var(/cache|/log|/lib|/run|)$
''', n, re.X):
continue
if n.endswith('.standalone'):
if 'repart' in n:
o = outputs['standalone-repart']
elif 'tmpfiles' in n:
o = outputs['standalone-tmpfiles']
elif 'sysusers' in n:
o = outputs['standalone-sysusers']
elif 'shutdown' in n:
o = outputs['standalone-shutdown']
else:
assert False, 'Found .standalone not belonging to known packages'
elif '/security/pam_' in n or '/man8/pam_' in n:
o = outputs['pam']
elif '/rpm/' in n:
o = outputs['rpm-macros']
elif '/usr/lib/systemd/tests' in n:
o = outputs['tests']
elif 'ukify' in n and '/man/' not in n:
o = outputs['ukify']
elif re.search(r'/libsystemd-core-.*\.so$', n):
o = outputs['main']
elif re.search(r'/libsystemd-shared-.*\.so$', n):
o = outputs['shared']
elif re.search(r'/libcryptsetup-token-systemd-.*\.so$', n):
o = outputs['udev']
elif re.search(r'/lib.*\.pc$|/man3/|/usr/include|\.so$', n):
o = outputs['devel']
elif re.search(r'''journal-(remote|gateway|upload)|
systemd-remote\.conf|
/usr/share/systemd/gatewayd|
/var/log/journal/remote
''', n, re.X):
o = outputs['remote']
# Just the binary, the dir, and the man page.
elif re.search(r'''systemd-sysusers$|
sysusers\.d$|
man/.*sysusers\.d\.5|
man/.*systemd-sysusers\.8
''', n, re.X):
o = outputs['sysusers']
elif re.search(r'''mymachines|
machinectl|
mount.ddi|
importctl|
portablectl|
systemd-nspawn|
systemd\.nspawn|
systemd-vmspawn|
systemd-dissect|
import-pubring|
systemd-machined|
systemd-import|
systemd-export|
systemd-pull|
systemd-mountfsd|
systemd-mountwork|
systemd-nsresource|
/machine.slice|
/machines.target|
var-lib-machines.mount|
org.freedesktop.(import|machine)1
''', n, re.X):
o = outputs['container']
# .network.example files go into systemd-networkd, and the matching files
# without .example go into systemd-networkd-defaults
elif (re.search(r'''/usr/lib/systemd/network/.*\.network$''', n)
and os.path.exists(f'./{n}.example')):
o = outputs['networkd-defaults']
# Files that are "consumed" by systemd-networkd go into the -networkd
# subpackage. As a special case, network-generator is co-owned also by
# the -udev subpackage because systemd-udevd reads .link files.
elif re.search(r'''/usr/lib/systemd/network/.*\.network|
networkd|
networkctl|
org.freedesktop.network1|
sysusers\.d/systemd-network.conf|
tmpfiles\.d/systemd-network.conf|
systemd\.network|
systemd\.netdev
''', n, re.X):
o = outputs['networkd']
elif 'network-generator' in n:
o = (outputs['networkd'], outputs['udev'])
elif '.so.' in n:
o = outputs['libs']
elif re.search(r'10-oomd-.*defaults.conf|lib/systemd/oomd.conf.d', n, re.X):
o = outputs['oomd-defaults']
elif re.search(r'''udev(?!\.pc)|
hwdb|
ac-power|
bootctl|
boot-update|
bless-boot|
boot-system-token|
bsod|
kernel-install|
installkernel|
vconsole|
backlight|
rfkill|
random-seed|
modules-load|
timesync|
crypttab|
cryptenroll|
cryptsetup|
kmod|
quota|
pstore|
sleep|suspend|hibernate|
systemd-tmpfiles-setup-dev|
network/98-default-mac-none.link|
network/99-default.link|
growfs|makefs|makeswap|mkswap|
fsck|
repart|
gpt-auto|
volatile-root|
veritysetup|
integritysetup|
integritytab|
remount-fs|
/initrd|
systemd[.-]pcr|
/pcrlock\.d|
systemd-measure|
/boot$|
/kernel/|
/kernel$|
/modprobe.d|
binfmt|
sysctl|
coredump|
homed|home1|
sysupdate|updatctl|
oomd|
portabled|portable1
''', n, re.X): # coredumpctl, homectl, portablectl are included in the main package because
# they can be used to interact with remote daemons. Also, the user could be
# confused if those user-facing binaries are not available.
o = outputs['udev']
elif re.search(r'''/boot/efi|
/usr/lib/systemd/boot|
sd-boot|systemd-boot\.|loader.conf
''', n, re.X):
o = outputs['boot']
elif re.search(r'''resolved|resolve1|
systemd-resolve|
resolvconf|
systemd\.(positive|negative)
''', n, re.X): # resolvectl and nss-resolve are in the main package.
o = outputs['resolve']
else:
o = outputs['main']
if n in known_files:
prefix = known_files[n].split()[:-1]
elif file.is_dir(follow_symlinks=False):
prefix = ['%dir']
elif 'README' in n:
prefix = ['%doc']
elif n.startswith('/etc'):
prefix = ['%config(noreplace)']
if not file.is_symlink() and file.stat().st_size == 0:
prefix += ['%ghost']
else:
prefix = []
prefix = ' '.join(prefix + ['']) if prefix else ''
suffix = '*' if '/man/' in n else ''
if not isinstance(o, tuple):
o = (o,)
for file in o:
print(f'{prefix}{n}{suffix}', file=file)
if [print(f'ERROR: no file names were written to {o.name}')
for name, o in outputs.items()
if (o.tell() == 0 and
not (no_bootloader and name == 'boot'))
]:
sys.exit(1)

View file

@ -1,14 +0,0 @@
# Used by systemd --user instances.
-account sufficient pam_systemd_home.so
account sufficient pam_unix.so no_pass_expiry
account include system-auth
session required pam_selinux.so close
session required pam_selinux.so nottys open
session required pam_loginuid.so
session optional pam_keyinit.so force revoke
session required pam_namespace.so
-session optional pam_systemd_home.so
session optional pam_umask.so silent
session include system-auth

12
systemd-user.m4 Normal file
View file

@ -0,0 +1,12 @@
# This file is part of systemd.
#
# Used by systemd --user instances.
account include system-auth
m4_ifdef(`HAVE_SELINUX',
session required pam_selinux.so close
session required pam_selinux.so nottys open
)m4_dnl
session required pam_loginuid.so
session include system-auth

View file

@ -1,50 +0,0 @@
# Just kill all warnings about README being wrong in every possible way
addFilter(r'README')
addFilter(r'missing-call-to-(chdir-with-chroot|setgroups-before-setuid)')
addFilter(r'executable-marked-as-config-file /etc/X11/xinit/xinitrc.d/50-systemd-user.sh')
addFilter(r'non-readable /etc/crypttab')
addFilter(r'non-conffile-in-etc /etc/inittab')
addFilter(r'systemd-unit-in-etc /etc/systemd/.*\.wants')
addFilter(r'dangling-relative-symlink /usr/lib/environment.d/99-environment.conf ../../../etc/environment')
addFilter(r'devel-file-in-non-devel-package /usr/share/pkgconfig/(systemd|udev).pc')
addFilter(r'non-standard-dir-perm /var/cache/private 700')
addFilter(r'non-root-group-log-file /var/log/btmp utmp')
addFilter(r'non-standard-dir-perm /var/log/private 700')
addFilter(r'non-root-group-log-file /var/log/wtmp utmp')
addFilter(r'dangerous-command-in-')
addFilter(r'summary-not-capitalized C systemd')
addFilter(r'obsolete-not-provided')
addFilter(r'postin-without-ldconfig')
addFilter(r'systemd-rpm-macros.noarch: W: only-non-binary-in-usr-lib')
addFilter(r'systemd-rpm-macros.noarch: W: no-documentation')
addFilter(r'systemd-tests\..*: W: no-documentation')
addFilter(r'systemd-tests.*: E: zero-length /usr/lib/systemd/tests/testdata/test-umount/empty.mountinfo')
addFilter(r'hardcoded-library-path in.*(firewalld|install.d|lib/systemd)')
# everybody does it this way: systemd, syslog-ng, rsyslog
addFilter(r'unversioned-explicit-provides syslog')
# systemd-machine-id-setup requires libssl
addFilter(r'explicit-lib-dependency openssl-libs')
addFilter(r'systemd.src:.*strange-permission')

File diff suppressed because it is too large Load diff

View file

@ -1,2 +0,0 @@
%__sysusers_provides %{_rpmconfigdir}/sysusers.prov
%__sysusers_path ^%{_sysusersdir}/.*\\.conf$

View file

@ -1,96 +0,0 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: true; tab-width: 4; -*-
# This script turns sysuser.d files into scriptlets mandated by Fedora
# packaging guidelines. The general idea is to define users using the
# declarative syntax but to turn this into traditional scriptlets.
user() {
user="$1"
uid="$2"
desc="$3"
group="$4"
home="$5"
shell="$6"
[ "$desc" = '-' ] && desc=
{ [ "$home" = '-' ] || [ "$home" = '' ]; } && home=/
{ [ "$shell" = '-' ] || [ "$shell" = '' ]; } && shell=/usr/sbin/nologin
if [ "$uid" = '-' ] || [ "$uid" = '' ]; then
cat <<-EOF
getent passwd '$user' >/dev/null || \\
useradd -r -g ${group@Q} -d ${home@Q} -s ${shell@Q} -c ${desc@Q} ${user@Q} || :
EOF
else
cat <<-EOF
if ! getent passwd ${user@Q} >/dev/null; then
if ! getent passwd ${uid@Q} >/dev/null; then
useradd -r -u ${uid@Q} -g ${group@Q} -d ${home@Q} -s ${shell@Q} -c ${desc@Q} ${user@Q} || :
else
useradd -r -g ${group@Q} -d ${home@Q} -s ${shell@Q} -c ${desc@Q} ${user@Q} || :
fi
fi
EOF
fi
}
group() {
group="$1"
gid="$2"
if [ "$gid" = '-' ]; then
cat <<-EOF
getent group ${group@Q} >/dev/null || groupadd -r ${group@Q} || :
EOF
else
cat <<-EOF
getent group ${group@Q} >/dev/null || groupadd -f -g ${gid@Q} -r ${group@Q} || :
EOF
fi
}
usermod() {
user="$1"
group="$2"
cat <<-EOF
if getent group ${group@Q} >/dev/null; then
usermod -a -G ${group@Q} '$user' || :
fi
EOF
}
parse() {
while read -r line || [ -n "$line" ] ; do
{ [ "${line:0:1}" = '#' ] || [ "${line:0:1}" = ';' ]; } && continue
line="${line## *}"
[ -z "$line" ] && continue
eval "arr=( $line )"
case "${arr[0]}" in
('u'|'u!')
if [[ "${arr[2]}" == *":"* ]]; then
user "${arr[1]}" "${arr[2]%:*}" "${arr[3]}" "${arr[2]#*:}" "${arr[4]}" "${arr[5]}"
else
group "${arr[1]}" "${arr[2]}"
user "${arr[1]}" "${arr[2]}" "${arr[3]}" "${arr[1]}" "${arr[4]}" "${arr[5]}"
fi
;;
('g')
group "${arr[1]}" "${arr[2]}"
;;
('m')
group "${arr[2]}" "-"
user "${arr[1]}" "-" "" "${arr[1]}" "" ""
usermod "${arr[1]}" "${arr[2]}"
;;
esac
done
}
for fn in "$@"; do
[ -e "$fn" ] || continue
echo "# generated from $(basename "$fn")"
parse <"$fn"
done

View file

@ -1,61 +0,0 @@
#!/bin/bash
process_u() {
if [ ! -z "${2##*[!0-9]*}" ]; then
# Single shared static ID.
echo "user($1) = $2"
echo "group($1) = $2"
elif [[ $2 == *:* ]]; then
# UID:<group>.
uid=$(echo $2 | cut -d':' -f1 -)
group=$(echo $2 | cut -d':' -f2 -)
if [ ! -z "${group##*[!0-9]*}" ]; then
# UID:GID.
echo "user($1) = ${uid}"
echo "group($1) = ${group}"
else
# UID:<groupname>.
echo "user($1) = ${uid}"
echo "group(${group})"
fi
else
# Dynamic (or something else uninteresting).
echo "user($1)"
echo "group($1)"
fi
}
process_g() {
if [ ! -z "${2##*[!0-9]*}" ]; then
# Static GID.
echo "group($1) = $2"
else
# Dynamic (or something else uninteresting).
echo "group($1)"
fi
}
parse() {
while read line; do
[ "${line:0:1}" = '#' -o "${line:0:1}" = ';' ] && continue
line="${line## *}"
[ -z "$line" ] && continue
set -- $line
case "$1" in
('u'|'u!')
process_u "$2" "$3"
;;
('g')
process_g "$2" "$3"
;;
('m')
echo "user($2)"
echo "group($3)"
;;
esac
done
}
while read fn; do
parse < "$fn"
done

View file

@ -1,39 +0,0 @@
#!/usr/bin/python
import os
import sys
def parse_sysusers_file(filename):
users, groups = set(), set()
for line in open(filename):
line = line.strip()
if not line or line.startswith('#'):
continue
words = line.split()
match words[0]:
case 'u'|'u!':
users.add(words[1])
case 'g':
groups.add(words[1])
case 'm'|'r':
continue
case _:
assert False
return users, groups
setup_users, setup_groups = set(), set()
for arg in sys.argv[1:-1]:
users, groups = parse_sysusers_file(arg)
setup_users |= users
setup_groups |= groups
basic_users, basic_groups = parse_sysusers_file(sys.argv[-1])
ignored = set(os.getenv('IGNORED', '').split())
if d := basic_users - setup_users - ignored:
exit(f'We have new users: {d}')
if d := basic_groups - setup_groups - ignored:
exit(f'We have new groups: {d}')

View file

@ -1,85 +1,64 @@
# -*- Mode: rpm-spec; indent-tabs-mode: nil -*- */
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# This file is part of systemd.
#
# Copyright 2018 Neal Gompa
# Copyright 2015 Zbigniew Jędrzejewski-Szmek
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# systemd is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
# The contents of this are an example to be copied into systemd.spec.
#
# Minimum rpm version supported: 4.14.0
%transfiletriggerin -P 900900 -- /usr/lib/systemd/system/ /etc/systemd/system/
# This script will run after any package is initially installed or
# upgraded. We care about the case where a package is initially
# installed, because other cases are covered by the *un scriptlets,
# so sometimes we will reload needlessly.
/usr/lib/systemd/systemd-update-helper system-reload-restart || :
%transfiletriggerin -P 900900 -p <lua> -- /usr/lib/systemd/system /etc/systemd/system
-- This script will run after any package is initially installed or
-- upgraded. We care about the case where a package is initially
-- installed, because other cases are covered by the *un scriptlets,
-- so sometimes we will reload needlessly.
%transfiletriggerin -P 900899 -- /usr/lib/systemd/user/ /etc/systemd/user/
/usr/lib/systemd/systemd-update-helper user-reload-restart || :
pid = posix.fork()
if pid == 0 then
assert(posix.exec("%{_bindir}/systemctl", "daemon-reload"))
elseif pid > 0 then
posix.wait(pid)
end
%transfiletriggerpostun -P 1000100 -- /usr/lib/systemd/system/ /etc/systemd/system/
# On removal, we need to run daemon-reload after any units have been
# removed.
# On upgrade, we need to run daemon-reload after any new unit files
# have been installed, but before %postun scripts in packages get
# executed.
/usr/lib/systemd/systemd-update-helper system-reload || :
%transfiletriggerun -p <lua> -- /usr/lib/systemd/system /etc/systemd/system
-- On removal, we need to run daemon-reload after any units have been
-- removed. %transfiletriggerpostun would be ideal, but it does not get
-- executed for some reason.
-- On upgrade, we need to run daemon-reload after any new unit files
-- have been installed, but before %postun scripts in packages get
-- executed. %transfiletriggerun gets the right list of files
-- but it is invoked too early (before changes happen).
-- %filetriggerpostun happens at the right time, but it fires for
-- every package.
-- To execute the reload at the right time, we create a state
-- file in %transfiletriggerun and execute the daemon-reload in
-- the first %filetriggerpostun.
%transfiletriggerpostun -P 1000099 -- /usr/lib/systemd/user/ /etc/systemd/user/
# Execute daemon-reload in user managers.
/usr/lib/systemd/systemd-update-helper user-reload || :
posix.mkdir("%{_localstatedir}/lib")
posix.mkdir("%{_localstatedir}/lib/rpm-state")
posix.mkdir("%{_localstatedir}/lib/rpm-state/systemd")
io.open("%{_localstatedir}/lib/rpm-state/systemd/needs-reload", "w")
%transfiletriggerpostun -P 10000 -- /usr/lib/systemd/system/ /etc/systemd/system/
# We restart remaining system services that should be restarted here.
/usr/lib/systemd/systemd-update-helper system-restart || :
%transfiletriggerpostun -P 9999 -- /usr/lib/systemd/user/ /etc/systemd/user/
# We restart remaining user services that should be restarted here.
/usr/lib/systemd/systemd-update-helper user-restart || :
%transfiletriggerin -P 1000700 -- /usr/lib/sysusers.d/
# This script will process files installed in /usr/lib/sysusers.d to create
# specified users automatically. The priority is set such that it
# will run before the tmpfiles file trigger.
systemd-sysusers || :
%transfiletriggerin -P 1000700 udev -- /usr/lib/udev/hwdb.d/
# This script will automatically invoke hwdb update if files have been
# installed or updated in /usr/lib/udev/hwdb.d.
systemd-hwdb update || :
%transfiletriggerin -P 1000700 -- /usr/lib/systemd/catalog/
# This script will automatically invoke journal catalog update if files
# have been installed or updated in /usr/lib/systemd/catalog.
journalctl --update-catalog || :
%transfiletriggerin -P 1000700 -- /usr/lib/binfmt.d/
# This script will automatically apply binfmt rules if files have been
# installed or updated in /usr/lib/binfmt.d.
if test -d "/run/systemd/system"; then
# systemd-binfmt might fail if binfmt_misc kernel module is not loaded
# during install
/usr/lib/systemd/systemd-binfmt || :
fi
%transfiletriggerin -P 1000600 -- /usr/lib/tmpfiles.d/
# This script will process files installed in /usr/lib/tmpfiles.d to create
# tmpfiles automatically. The priority is set such that it will run
# after the sysusers file trigger, but before any other triggers.
if test -d "/run/systemd/system"; then
systemd-tmpfiles --create || :
fi
%transfiletriggerin -P 1000600 udev -- /usr/lib/udev/rules.d/
# This script will automatically update udev with new rules if files
# have been installed or updated in /usr/lib/udev/rules.d.
/usr/lib/systemd/systemd-update-helper mark-reload-system-units systemd-udevd.service || :
%transfiletriggerin -P 1000500 -- /usr/lib/sysctl.d/
# This script will automatically apply sysctl rules if files have been
# installed or updated in /usr/lib/sysctl.d.
if test -d "/run/systemd/system"; then
/usr/lib/systemd/systemd-sysctl || :
fi
%filetriggerpostun -P 1000100 -p <lua> -- /usr/lib/systemd/system /etc/systemd/system
if posix.access("%{_localstatedir}/lib/rpm-state/systemd/needs-reload") then
posix.unlink("%{_localstatedir}/lib/rpm-state/systemd/needs-reload")
posix.rmdir("%{_localstatedir}/lib/rpm-state/systemd")
pid = posix.fork()
if pid == 0 then
assert(posix.exec("%{_bindir}/systemctl", "daemon-reload"))
elseif pid > 0 then
posix.wait(pid)
end
end

2
yum-protect-systemd.conf Normal file
View file

@ -0,0 +1,2 @@
systemd
systemd-udev