1
0
mirror of https://github.com/systemd/systemd synced 2025-11-21 09:44:44 +01:00

Compare commits

...

9 Commits

Author SHA1 Message Date
Mike Yuan
606a08b1b5
mute-console: several follow-ups (#39229) 2025-10-08 20:35:10 +02:00
Frantisek Sumsal
67111e1bd9 man: fix a missing word
Follow-up for 6d48c7cf736ced70c1c2fef1e1f03618911d04bc.
2025-10-08 18:56:36 +01:00
Antonio Alvarez Feijoo
575087d68b man/factory-reset: fix typo in EFI variable name 2025-10-08 17:02:21 +02:00
Mike Yuan
01c6565548
mute-console: don't unmute twice when not running as varlink service
This also avoids the spurious "not restoring" logs if we fail
to dispatch varlink call.
2025-10-07 13:38:21 +02:00
Mike Yuan
39305cf974
mute-console: if muting is disabled, suppress "not restoring" messages 2025-10-07 13:38:21 +02:00
Mike Yuan
a5592a2e00
mute-console: honor Context rather than arg_* 2025-10-07 13:38:21 +02:00
Mike Yuan
5f7e04dd35
mute-console: fix typo 2025-10-07 13:38:21 +02:00
Mike Yuan
3dbb2fa239
system-systemd\x2dmute\x2dconsole.slice: do not disable default deps
The only default dep for slice units is exactly what's outlined
here: Conflicts= + Before=shutdown.target. Hence just drop
custom deps.
2025-10-07 13:38:21 +02:00
Mike Yuan
60e1c11dc8
units: enable MaxConnectionsPerSource= for all our Accept=yes units (-ng)
Apply 5d1e8cd3e057261c6db3fb3d7de39b7ca48efd3b on newly-added sockets.
2025-10-07 13:38:11 +02:00
8 changed files with 24 additions and 35 deletions

View File

@ -81,7 +81,7 @@
factory reset operation is by starting the <filename>factory-reset.target</filename> factory reset operation is by starting the <filename>factory-reset.target</filename>
unit.</para> unit.</para>
<para>This sets the <varname>FactoryResetRequested</varname> EFI variable, see below.</para> <para>This sets the <varname>FactoryResetRequest</varname> EFI variable, see below.</para>
<para>This operation is executed when the <filename>systemd-factory-reset-request.service</filename> <para>This operation is executed when the <filename>systemd-factory-reset-request.service</filename>
unit is started (which is typically one of the services hooked into unit is started (which is typically one of the services hooked into

View File

@ -563,7 +563,7 @@ CPUWeight=20 DisableControllers=cpu / \
an absolute number of tasks or a percentage value that is taken relative to the configured maximum an absolute number of tasks or a percentage value that is taken relative to the configured maximum
number of tasks on the system. If assigned the special value <literal>infinity</literal>, no tasks number of tasks on the system. If assigned the special value <literal>infinity</literal>, no tasks
limit is applied. This controls the <literal>pids.max</literal> control group attribute. For limit is applied. This controls the <literal>pids.max</literal> control group attribute. For
details about this control group attribute, the details about this control group attribute, see the
<ulink url="https://docs.kernel.org/admin-guide/cgroup-v2.html#pid">pids controller <ulink url="https://docs.kernel.org/admin-guide/cgroup-v2.html#pid">pids controller
</ulink>. </ulink>.
The effective configuration is reported as <varname>EffectiveTasksMax=</varname>.</para> The effective configuration is reported as <varname>EffectiveTasksMax=</varname>.</para>

View File

@ -167,7 +167,8 @@ static int unmute_pid1(Context *c) {
assert(c); assert(c);
if (!c->muted_pid1) { if (!c->muted_pid1) {
log_debug("Not restoring PID 1 status console output level."); if (c->mute_pid1)
log_debug("Not restoring PID 1 status console output level.");
return 0; return 0;
} }
@ -185,14 +186,16 @@ static int mute_kernel(Context *c) {
assert(c); assert(c);
if (!arg_mute_kernel) { if (!c->mute_kernel) {
log_debug("Muting of kernel printk() console output disabled."); log_debug("Muting of kernel printk() console output disabled.");
c->saved_kernel = -1; c->saved_kernel = -1;
return 0; return 0;
} }
if (detect_container() > 0) { if (detect_container() > 0) {
log_debug("Skipping muting of print() console output, because running in a container."); log_debug("Skipping muting of printk() console output, because running in a container.");
c->mute_kernel = false;
c->saved_kernel = -1; c->saved_kernel = -1;
return 0; return 0;
} }
@ -222,7 +225,8 @@ static int unmute_kernel(Context *c) {
assert(c); assert(c);
if (c->saved_kernel < 0) { if (c->saved_kernel < 0) {
log_debug("Not restoring kernel printk() console output level."); if (c->mute_kernel)
log_debug("Not restoring kernel printk() console output level.");
return 0; return 0;
} }
@ -244,28 +248,6 @@ static int unmute_kernel(Context *c) {
return 0; return 0;
} }
static void context_done(Context *c) {
assert(c);
(void) unmute_pid1(c);
(void) unmute_kernel(c);
if (c->link) {
(void) sd_varlink_set_userdata(c->link, NULL);
c->link = sd_varlink_flush_close_unref(c->link);
}
}
static Context* context_free(Context *c) {
if (!c)
return NULL;
context_done(c);
return mfree(c);
}
DEFINE_TRIVIAL_CLEANUP_FUNC(Context*, context_free);
static void vl_on_disconnect(sd_varlink_server *server, sd_varlink *link, void *userdata) { static void vl_on_disconnect(sd_varlink_server *server, sd_varlink *link, void *userdata) {
assert(link); assert(link);
@ -273,7 +255,13 @@ static void vl_on_disconnect(sd_varlink_server *server, sd_varlink *link, void *
if (!c) if (!c)
return; return;
context_free(c); (void) unmute_pid1(c);
(void) unmute_kernel(c);
(void) sd_varlink_set_userdata(c->link, NULL);
sd_varlink_flush_close_unref(c->link);
free(c);
} }
static int vl_method_mute( static int vl_method_mute(
@ -286,7 +274,7 @@ static int vl_method_mute(
assert(link); assert(link);
_cleanup_(context_freep) Context *nc = new(Context, 1); _cleanup_free_ Context *nc = new(Context, 1);
if (!nc) if (!nc)
return -ENOMEM; return -ENOMEM;
@ -380,7 +368,7 @@ static int run(int argc, char* argv[]) {
if (!arg_mute_pid1 && !arg_mute_kernel) if (!arg_mute_pid1 && !arg_mute_kernel)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Not asked to mute anything, refusing."); return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Not asked to mute anything, refusing.");
_cleanup_(context_done) Context c = { Context c = {
.mute_pid1 = arg_mute_pid1, .mute_pid1 = arg_mute_pid1,
.mute_kernel = arg_mute_kernel, .mute_kernel = arg_mute_kernel,
.saved_kernel = -1, .saved_kernel = -1,
@ -398,7 +386,7 @@ static int run(int argc, char* argv[]) {
RET_GATHER(ret, mute_pid1(&c)); RET_GATHER(ret, mute_pid1(&c));
RET_GATHER(ret, mute_kernel(&c)); RET_GATHER(ret, mute_kernel(&c));
/* Now tell service manager we area ready to go */ /* Now tell service manager we are ready to go */
_unused_ _cleanup_(notify_on_cleanup) const char *notify_message = _unused_ _cleanup_(notify_on_cleanup) const char *notify_message =
notify_start("READY=1\n" notify_start("READY=1\n"
"STATUS=Console status output muted temporarily.", "STATUS=Console status output muted temporarily.",

View File

@ -10,9 +10,6 @@
[Unit] [Unit]
Description=Console Output Muting Service Slice Description=Console Output Muting Service Slice
Documentation=man:systemd-mute-console(8) Documentation=man:systemd-mute-console(8)
DefaultDependencies=no
Conflicts=shutdown.target
Before=shutdown.target
[Slice] [Slice]
# Serialize requests to mute the console. # Serialize requests to mute the console.

View File

@ -19,3 +19,4 @@ ListenStream=/run/systemd/io.systemd.BootControl
FileDescriptorName=varlink FileDescriptorName=varlink
SocketMode=0600 SocketMode=0600
Accept=yes Accept=yes
MaxConnectionsPerSource=16

View File

@ -20,3 +20,4 @@ ListenStream=/run/systemd/io.systemd.MuteConsole
FileDescriptorName=varlink FileDescriptorName=varlink
SocketMode=0600 SocketMode=0600
Accept=yes Accept=yes
MaxConnectionsPerSource=16

View File

@ -20,6 +20,7 @@ ListenStream=/run/systemd/io.systemd.PCRLock
FileDescriptorName=varlink FileDescriptorName=varlink
SocketMode=0600 SocketMode=0600
Accept=yes Accept=yes
MaxConnectionsPerSource=16
[Install] [Install]
WantedBy=sockets.target WantedBy=sockets.target

View File

@ -20,3 +20,4 @@ ListenStream=/run/systemd/io.systemd.Repart
FileDescriptorName=varlink FileDescriptorName=varlink
SocketMode=0600 SocketMode=0600
Accept=yes Accept=yes
MaxConnectionsPerSource=16