1
0
mirror of https://github.com/systemd/systemd synced 2025-11-22 10:14:45 +01:00

Compare commits

...

7 Commits

Author SHA1 Message Date
Markus Boehme
346b7b6b49 pkgconf: expose variables for system-alloc-{uid,gid}-min
Expose variables for system-alloc-uid-min and system-alloc-gid-min
similar to the UID/GID ranges already exposed for the respective
maximums, and other UID/GID ranges.
2025-09-22 12:02:28 +01:00
Aleksandr Mezin
c3d5f5f165
nspawn: don't try to connect to D-Bus when it's not necessary (#39045)
`runtime_bus` is only used if `!arg_keep_unit`.

`system_bus` is additionally used if `arg_register`.

So for `!arg_register && arg_keep_unit`, none of them should be
necessary, and nspawn should be able to work without any D-Bus
connections.

Fixes https://github.com/systemd/systemd/issues/39044

Follow-up for f2f26f1527529b1ea7dcb0dba85456ac98800627
2025-09-22 11:59:38 +01:00
雪叶
c4d708c3aa zsh-completion: add completion for freeze, thaw, condstop 2025-09-22 11:55:29 +01:00
Christian Hesse
9f8c4bc65a man/systemd-notify: add a note on return value
The options `--booted` is compared with the command `systemctl
is-system-running`, but the return values have differnt meanings and it
is not a drop-in.
2025-09-22 08:47:57 +02:00
Lennart Poettering
3d97db8f3c ptyfwd: reset tty when exiting
Let's do a "soft" reset of the TTY when a ptyfwd session ends. This is a
good idea, in order to reset changes to the scrolling window that code
inside the session might have made. A "soft" reset will undo this.

While we are at it, make sure to output the ansi sequences for this
*after* terminating any half-written line, as that is still somewhat
contents of the session, even if it's augmented.
2025-09-22 14:39:05 +09:00
Lennart Poettering
e6a05af50b glyph-util: add missing ascii represenations of some emojis 2025-09-22 14:38:43 +09:00
Lennart Poettering
341bccdf1e dissect-image: simplification 2025-09-22 14:38:31 +09:00
9 changed files with 40 additions and 34 deletions

View File

@ -179,8 +179,8 @@
<citerefentry><refentrytitle>sd_booted</refentrytitle><manvolnum>3</manvolnum></citerefentry>. An
alternate way to check for this state is to call
<citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> with
the <command>is-system-running</command> command. It will return <literal>offline</literal> if the
system was not booted with systemd. </para></listitem>
the <command>is-system-running</command> command. It will output <literal>offline</literal> if the
system was not booted with systemd, though the return value has a different meaning.</para></listitem>
</varlistentry>
<varlistentry>

View File

@ -35,6 +35,8 @@
"reset-failed:Reset failed state for all, one, or more units"
"list-dependencies:Show unit dependency tree"
"clean:Remove configuration, state, cache, logs or runtime data of units"
"freeze:Freeze one or more units specified on the command line using cgroup freezer"
"thaw:Thaw (unfreeze) one or more units specified on the command line."
"bind:Bind mount a path from the host into a unit's namespace"
"mount-image:Mount an image from the host into a unit's namespace"
"whoami:Determines as part of which unit the command is being invoked"
@ -315,7 +317,7 @@ done
}
# Completion functions for STOPPABLE_UNITS
for fun in stop kill try-restart condrestart ; do
for fun in stop condstop kill try-restart condrestart freeze thaw; do
(( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
{
local _sys_active_units; _systemctl_active_units

View File

@ -79,6 +79,8 @@ const char* glyph_full(Glyph code, bool force_utf) {
[GLYPH_SPARKLES] = "*",
[GLYPH_LOW_BATTERY] = "!",
[GLYPH_WARNING_SIGN] = "!",
[GLYPH_COMPUTER_DISK] = "o",
[GLYPH_WORLD] = "W",
[GLYPH_RED_CIRCLE] = "o",
[GLYPH_YELLOW_CIRCLE] = "o",
[GLYPH_BLUE_CIRCLE] = "o",

View File

@ -955,7 +955,7 @@ finish:
return r;
}
static int terminal_reset_ansi_seq(int fd) {
int terminal_reset_ansi_seq(int fd) {
int r, k;
assert(fd >= 0);

View File

@ -34,6 +34,8 @@
bool isatty_safe(int fd);
int terminal_reset_ansi_seq(int fd);
typedef enum TerminalResetFlags {
TERMINAL_RESET_SWITCH_TO_TEXT = 1 << 0,
TERMINAL_RESET_AVOID_ANSI_SEQ = 1 << 1,

View File

@ -90,8 +90,12 @@ modulesloaddir=${modules_load_dir}
catalog_dir=${prefix}/lib/systemd/catalog
catalogdir=${catalog_dir}
system_alloc_uid_min={{SYSTEM_ALLOC_UID_MIN}}
systemallocuidmin=${system_alloc_uid_min}
system_uid_max={{SYSTEM_UID_MAX}}
systemuidmax=${system_uid_max}
system_alloc_gid_min={{SYSTEM_ALLOC_GID_MIN}}
systemallocgidmin=${system_alloc_gid_min}
system_gid_max={{SYSTEM_GID_MAX}}
systemgidmax=${system_gid_max}

View File

@ -5384,7 +5384,7 @@ static int run_container(
/* Registration always happens on the system bus */
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *system_bus = NULL;
if (arg_register || arg_privileged) {
if (arg_register || (arg_privileged && !arg_keep_unit)) {
r = sd_bus_default_system(&system_bus);
if (r < 0)
return log_error_errno(r, "Failed to open system bus: %m");
@ -5399,6 +5399,7 @@ static int run_container(
/* Scope allocation happens on the user bus if we are unpriv, otherwise system bus. */
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *user_bus = NULL;
_cleanup_(sd_bus_unrefp) sd_bus *runtime_bus = NULL;
if (!arg_keep_unit) {
if (arg_privileged)
runtime_bus = sd_bus_ref(system_bus);
else {
@ -5413,7 +5414,6 @@ static int run_container(
runtime_bus = sd_bus_ref(user_bus);
}
if (!arg_keep_unit) {
/* When a new scope is created for this container, then we'll be registered as its controller, in which
* case PID 1 will send us a friendly RequestStop signal, when it is asked to terminate the
* scope. Let's hook into that, and cleanly shut down the container, and print a friendly message. */

View File

@ -81,11 +81,9 @@ static int allowed_fstypes(char ***ret_strv) {
assert(ret_strv);
e = secure_getenv("SYSTEMD_DISSECT_FILE_SYSTEMS");
if (e) {
if (e)
l = strv_split(e, ":");
if (!l)
return -ENOMEM;
} else {
else
l = strv_new("btrfs",
"erofs",
"ext4",
@ -95,10 +93,8 @@ static int allowed_fstypes(char ***ret_strv) {
"xfs");
if (!l)
return -ENOMEM;
}
*ret_strv = TAKE_PTR(l);
return 0;
}

View File

@ -133,13 +133,6 @@ static void pty_forward_disconnect(PTYForward *f) {
/* STDIN/STDOUT should not be non-blocking normally, so let's reset it */
(void) fd_nonblock(f->output_fd, false);
if (colors_enabled()) {
(void) loop_write(f->output_fd, ANSI_NORMAL ANSI_ERASE_TO_END_OF_SCREEN, SIZE_MAX);
if (f->title)
(void) loop_write(f->output_fd, ANSI_WINDOW_TITLE_POP, SIZE_MAX);
}
if (f->last_char_set && f->last_char != '\n') {
const char *s;
@ -153,6 +146,13 @@ static void pty_forward_disconnect(PTYForward *f) {
f->last_char = '\n';
}
if (colors_enabled()) {
if (f->title)
(void) loop_write(f->output_fd, ANSI_WINDOW_TITLE_POP, SIZE_MAX);
terminal_reset_ansi_seq(f->output_fd);
}
if (f->close_output_fd)
f->output_fd = safe_close(f->output_fd);
}