# SOME DESCRIPTIVE TITLE # Copyright (C) YEAR Free Software Foundation, Inc. # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "POT-Creation-Date: 2024-06-01 06:29+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. type: TH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "SYSTEMD-SOFT-REBOOT\\&.SERVICE" msgstr "" #. type: TH #: archlinux fedora-40 mageia-cauldron opensuse-tumbleweed #, no-wrap msgid "systemd 255" msgstr "" #. type: TH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "systemd-soft-reboot.service" msgstr "" #. ----------------------------------------------------------------- #. * MAIN CONTENT STARTS HERE * #. ----------------------------------------------------------------- #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "NAME" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "systemd-soft-reboot.service - Userspace reboot operation" msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "SYNOPSIS" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "systemd-soft-reboot\\&.service" msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "DESCRIPTION" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed msgid "" "systemd-soft-reboot\\&.service is a system service that is pulled in by soft-" "reboot\\&.target and is responsible for performing a userspace-only reboot " "operation\\&. When invoked, it will send the B signal to any " "processes left running (but does not wait for the processes to exit), and " "follow up with B\\&. If the /run/nextroot/ directory exists (which " "may be a regular directory, a directory mount point or a symlink to either) " "then it will switch the file system root to it\\&. It then reexecutes the " "service manager off the (possibly now new) root file system, which will " "enqueue a new boot transaction as in a normal reboot\\&." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Such a userspace-only reboot operation permits updating or resetting the " "entirety of userspace with minimal downtime, as the reboot operation does " "I transition through:" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The second phase of regular shutdown, as implemented by B(8)\\&." msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed msgid "" "The third phase of regular shutdown, i\\&.e\\&. the return to the initrd " "context\\&." msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed msgid "The hardware reboot operation\\&." msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed msgid "The firmware initialization\\&." msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed msgid "The boot loader initialization\\&." msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed msgid "The kernel initialization\\&." msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed msgid "The initrd initialization\\&." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "However this form of reboot comes with drawbacks as well:" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The OS update remains incomplete, as the kernel is not reset and continues " "running\\&." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Kernel settings (such as /proc/sys/ settings, a\\&.k\\&.a\\&. \"sysctl\", " "or /sys/ settings) are not reset\\&." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "These limitations may be addressed by various means, which are outside of " "the scope of this documentation, such as kernel live-patching and " "sufficiently comprehensive /etc/sysctl\\&.d/ files\\&." msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "RESOURCE PASS-THROUGH" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Various runtime OS resources can passed from a system runtime to the next, " "through the userspace reboot operation\\&. Specifically:" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "File descriptors placed in the file descriptor store of services that remain " "active until the very end are passed to the next boot, where they are placed " "in the file descriptor store of the same unit\\&. For this to work, units " "must declare I (and avoid a manual " "I or similar) to ensure they are not " "terminated as usual during the system shutdown operation\\&. Alternatively, " "use I to allow the file descriptor store to " "remain pinned even when the unit is down\\&. See B(5) for " "details about the file descriptor store\\&." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Similar to this, file descriptors associated with \\&.socket units remain " "open (and connectible) if the units are not stopped during the " "transition\\&. (Achieved by I\\&.)" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The /run/ file system remains mounted and populated and may be used to pass " "state information between such userspace reboot cycles\\&." msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-rawhide mageia-cauldron opensuse-tumbleweed msgid "" "Service processes may continue to run over the transition, past soft-reboot " "and into the next session, if they are placed in services that remain active " "until the very end of shutdown (which again is achieved via " "I)\\&. They must also be set up to avoid being " "killed by the aforementioned B and B via " "I, and also be configured to avoid being stopped " "on isolate via I\\&. They also have to be configured to " "be stopped on normal shutdown, reboot and maintenance mode\\&. Finally, they " "have to be ordered after B to ensure correct ordering on " "boot\\&. Note that in case any new or custom units are used to isolate to, " "or that implement an equivalent shutdown functionality, they will also have " "to be configured manually for correct ordering and conflicting\\&. For " "example:" msgstr "" #. type: Plain text #: archlinux fedora-40 mageia-cauldron opensuse-tumbleweed #, no-wrap msgid "" "[Unit]\n" "Description=My surviving service\n" "SurviveFinalKillSignal=yes\n" "IgnoreOnIsolate=yes\n" "DefaultDependencies=no\n" "After=basic\\&.target\n" "Conflicts=reboot\\&.target\n" "Before=reboot\\&.target\n" "Conflicts=kexec\\&.target\n" "Before=kexec\\&.target\n" "Conflicts=poweroff\\&.target\n" "Before=poweroff\\&.target\n" "Conflicts=halt\\&.target\n" "Before=halt\\&.target\n" "Conflicts=rescue\\&.target\n" "Before=rescue\\&.target\n" "Conflicts=emergency\\&.target\n" "Before=emergency\\&.target\n" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, no-wrap msgid "" "[Service]\n" "Type=oneshot\n" "ExecStart=sleep infinity\n" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "File system mounts may remain mounted during the transition, and complex " "storage attached, if configured to remain until the very end of the shutdown " "process\\&. (Also achieved via I, and by avoiding " "I)" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed msgid "" "If the unit publishes a service over D-Bus, the connection needs to be re-" "established after soft-reboot as the D-Bus broker will be stopped and then " "started again\\&. When using the sd-bus library this can be achieved by " "adapting the following example\\&." msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, no-wrap msgid "/* SPDX-License-Identifier: MIT-0 */\n" msgstr "" #. type: Plain text #: archlinux fedora-40 mageia-cauldron opensuse-tumbleweed #, no-wrap msgid "" "/* Implements a D-Bus service that automatically reconnects when the system bus is restarted\\&.\n" " *\n" " * Compile with \\*(Aqcc sd_bus_service_reconnect\\&.c $(pkg-config --libs --cflags libsystemd)\\*(Aq\n" " *\n" " * To allow the program to take ownership of the name \\*(Aqorg\\&.freedesktop\\&.ReconnectExample\\*(Aq,\n" " * add the following as /etc/dbus-1/system\\&.d/org\\&.freedesktop\\&.ReconnectExample\\&.conf\n" " * and then reload the broker with \\*(Aqsystemctl reload dbus\\*(Aq:\n" msgstr "" #. type: Plain text #: archlinux fedora-40 mageia-cauldron opensuse-tumbleweed #, no-wrap msgid "" "E?xml version=\"1\\&.0\"?E E!--*-nxml-*--E\n" "E!DOCTYPE busconfig PUBLIC \"-//freedesktop//DTD D-BUS Bus Configuration 1\\&.0//EN\"\n" " \"http://www\\&.freedesktop\\&.org/standards/dbus/1\\&.0/busconfig\\&.dtd\"E\n" "EbusconfigE\n" " Epolicy user=\"root\"E\n" " Eallow own=\"org\\&.freedesktop\\&.ReconnectExample\"/E\n" " Eallow send_destination=\"org\\&.freedesktop\\&.ReconnectExample\"/E\n" " Eallow receive_sender=\"org\\&.freedesktop\\&.ReconnectExample\"/E\n" " E/policyE\n" msgstr "" #. type: Plain text #: archlinux fedora-40 mageia-cauldron opensuse-tumbleweed #, no-wrap msgid "" " Epolicy context=\"default\"E\n" " Eallow send_destination=\"org\\&.freedesktop\\&.ReconnectExample\"/E\n" " Eallow receive_sender=\"org\\&.freedesktop\\&.ReconnectExample\"/E\n" " E/policyE\n" "E/busconfigE\n" msgstr "" #. type: Plain text #: archlinux fedora-40 mageia-cauldron opensuse-tumbleweed #, no-wrap msgid "" " *\n" " * To get the property via busctl:\n" " *\n" " * $ busctl --user get-property org\\&.freedesktop\\&.ReconnectExample \\e\n" " * /org/freedesktop/ReconnectExample \\e\n" " * org\\&.freedesktop\\&.ReconnectExample \\e\n" " * Example\n" " * s \"example\"\n" " */\n" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, no-wrap msgid "" "#include Eerrno\\&.hE\n" "#include Estdio\\&.hE\n" "#include Estdlib\\&.hE\n" "#include Esystemd/sd-bus\\&.hE\n" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, no-wrap msgid "#define _cleanup_(f) __attribute__((cleanup(f)))\n" msgstr "" #. type: Plain text #: archlinux fedora-40 mageia-cauldron opensuse-tumbleweed #, no-wrap msgid "" "#define check(x) ({ \\e\n" " int _r = (x); \\e\n" " errno = _r E 0 ? -_r : 0; \\e\n" " printf(#x \": %m\\en\"); \\e\n" " if (_r E 0) \\e\n" " return EXIT_FAILURE; \\e\n" " })\n" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, no-wrap msgid "" "typedef struct object {\n" " const char *example;\n" " sd_bus **bus;\n" " sd_event **event;\n" "} object;\n" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, no-wrap msgid "" "static int property_get(\n" " sd_bus *bus,\n" " const char *path,\n" " const char *interface,\n" " const char *property,\n" " sd_bus_message *reply,\n" " void *userdata,\n" " sd_bus_error *error) {\n" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, no-wrap msgid " object *o = userdata;\n" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, no-wrap msgid "" " if (strcmp(property, \"Example\") == 0)\n" " return sd_bus_message_append(reply, \"s\", o-Eexample);\n" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, no-wrap msgid "" " return sd_bus_error_setf(error,\n" " SD_BUS_ERROR_UNKNOWN_PROPERTY,\n" " \"Unknown property \\*(Aq%s\\*(Aq\",\n" " property);\n" "}\n" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, no-wrap msgid "" "/* https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_add_object\\&.html */\n" "static const sd_bus_vtable vtable[] = {\n" " SD_BUS_VTABLE_START(0),\n" " SD_BUS_PROPERTY(\n" " \"Example\", \"s\",\n" " property_get,\n" " 0,\n" " SD_BUS_VTABLE_PROPERTY_CONST),\n" " SD_BUS_VTABLE_END\n" "};\n" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, no-wrap msgid "static int setup(object *o);\n" msgstr "" #. type: Plain text #: archlinux fedora-40 mageia-cauldron opensuse-tumbleweed #, no-wrap msgid "" "static int on_disconnect(sd_bus_message *message, void *userdata, sd_bus_error *ret_error) {\n" " check(setup((object *)userdata));\n" " return 0;\n" "}\n" msgstr "" #. type: Plain text #: archlinux fedora-40 mageia-cauldron opensuse-tumbleweed #, no-wrap msgid "" "/* Ensure the event loop exits with a clear error if acquiring the well-known service name fails */\n" "static int request_name_callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {\n" " if (!sd_bus_message_is_method_error(m, NULL))\n" " return 1;\n" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, no-wrap msgid " const sd_bus_error *error = sd_bus_message_get_error(m);\n" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, no-wrap msgid "" " if (sd_bus_error_has_names(error, SD_BUS_ERROR_TIMEOUT, SD_BUS_ERROR_NO_REPLY))\n" " return 1; /* The bus is not available, try again later */\n" msgstr "" #. type: Plain text #: archlinux fedora-40 mageia-cauldron opensuse-tumbleweed #, no-wrap msgid "" " printf(\"Failed to request name: %s\\en\", error-Emessage);\n" " object *o = userdata;\n" " check(sd_event_exit(*o-Eevent, -sd_bus_error_get_errno(error)));\n" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, no-wrap msgid "" " return 1;\n" "}\n" msgstr "" #. type: Plain text #: archlinux fedora-40 mageia-cauldron opensuse-tumbleweed #, no-wrap msgid "" "static int setup(object *o) {\n" " /* If we are reconnecting, then the bus object needs to be closed, detached from\n" " * the event loop and recreated\\&.\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_detach_event\\&.html\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_close_unref\\&.html\n" " */\n" " if (*o-Ebus) {\n" " check(sd_bus_detach_event(*o-Ebus));\n" " *o-Ebus = sd_bus_close_unref(*o-Ebus);\n" " }\n" msgstr "" #. type: Plain text #: archlinux fedora-40 mageia-cauldron opensuse-tumbleweed #, no-wrap msgid "" " /* Set up a new bus object for the system bus, configure it to wait for D-Bus to be available\n" " * instead of failing if it is not, and start it\\&. All the following operations are asyncronous\n" " * and will not block waiting for D-Bus to be available\\&.\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_new\\&.html\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_set_address\\&.html\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_set_bus_client\\&.html\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_negotiate_creds\\&.html\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_set_watch_bind\\&.html\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_set_connected_signal\\&.html\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_start\\&.html\n" " */\n" " check(sd_bus_new(o-Ebus));\n" " check(sd_bus_set_address(*o-Ebus, \"unix:path=/run/dbus/system_bus_socket\"));\n" " check(sd_bus_set_bus_client(*o-Ebus, 1));\n" " check(sd_bus_negotiate_creds(*o-Ebus, 1, SD_BUS_CREDS_UID|SD_BUS_CREDS_EUID|SD_BUS_CREDS_EFFECTIVE_CAPS));\n" " check(sd_bus_set_watch_bind(*o-Ebus, 1));\n" " check(sd_bus_start(*o-Ebus));\n" msgstr "" #. type: Plain text #: archlinux fedora-40 mageia-cauldron opensuse-tumbleweed #, no-wrap msgid "" " /* Publish an interface on the bus, specifying our well-known object access\n" " * path and public interface name\\&.\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_add_object\\&.html\n" " * https://dbus\\&.freedesktop\\&.org/doc/dbus-tutorial\\&.html\n" " */\n" " check(sd_bus_add_object_vtable(*o-Ebus,\n" " NULL,\n" " \"/org/freedesktop/ReconnectExample\",\n" " \"org\\&.freedesktop\\&.ReconnectExample\",\n" " vtable,\n" " o));\n" " /* By default the service is only assigned an ephemeral name\\&. Also add a well-known\n" " * one, so that clients know whom to call\\&. This needs to be asynchronous, as\n" " * D-Bus might not be yet available\\&. The callback will check whether the error is\n" " * expected or not, in case it fails\\&.\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_request_name\\&.html\n" " */\n" " check(sd_bus_request_name_async(*o-Ebus,\n" " NULL,\n" " \"org\\&.freedesktop\\&.ReconnectExample\",\n" " 0,\n" " request_name_callback,\n" " o));\n" " /* When D-Bus is disconnected this callback will be invoked, which will\n" " * set up the connection again\\&. This needs to be asynchronous, as D-Bus might not\n" " * yet be available\\&.\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_match_signal_async\\&.html\n" " */\n" " check(sd_bus_match_signal_async(*o-Ebus,\n" " NULL,\n" " \"org\\&.freedesktop\\&.DBus\\&.Local\",\n" " NULL,\n" " \"org\\&.freedesktop\\&.DBus\\&.Local\",\n" " \"Disconnected\",\n" " on_disconnect,\n" " NULL,\n" " o));\n" " /* Attach the bus object to the event loop so that calls and signals are processed\\&.\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_attach_event\\&.html\n" " */\n" " check(sd_bus_attach_event(*o-Ebus, *o-Eevent, 0));\n" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, no-wrap msgid "" " return 0;\n" "}\n" msgstr "" #. type: Plain text #: archlinux fedora-40 mageia-cauldron opensuse-tumbleweed #, no-wrap msgid "" "int main(int argc, char **argv) {\n" " /* The bus should be relinquished before the program terminates\\&. The cleanup\n" " * attribute allows us to do it nicely and cleanly whenever we exit the\n" " * block\\&.\n" " */\n" " _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;\n" " _cleanup_(sd_event_unrefp) sd_event *event = NULL;\n" " object o = {\n" " \\&.example = \"example\",\n" " \\&.bus = &bus,\n" " \\&.event = &event,\n" " };\n" msgstr "" #. type: Plain text #: archlinux fedora-40 mageia-cauldron opensuse-tumbleweed #, no-wrap msgid "" " /* Create an event loop data structure, with default parameters\\&.\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_event_default\\&.html\n" " */\n" " check(sd_event_default(&event));\n" msgstr "" #. type: Plain text #: archlinux fedora-40 mageia-cauldron opensuse-tumbleweed #, no-wrap msgid "" " /* By default the event loop will terminate when all sources have disappeared, so\n" " * we have to keep it \\*(Aqoccupied\\*(Aq\\&. Register signal handling to do so\\&.\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_event_add_signal\\&.html\n" " */\n" " check(sd_event_add_signal(event, NULL, SIGINT|SD_EVENT_SIGNAL_PROCMASK, NULL, NULL));\n" " check(sd_event_add_signal(event, NULL, SIGTERM|SD_EVENT_SIGNAL_PROCMASK, NULL, NULL));\n" msgstr "" #. type: Plain text #: archlinux fedora-40 mageia-cauldron opensuse-tumbleweed #, no-wrap msgid " check(setup(&o));\n" msgstr "" #. type: Plain text #: archlinux fedora-40 mageia-cauldron opensuse-tumbleweed #, no-wrap msgid "" " /* Enter the main loop, it will exit only on sigint/sigterm\\&.\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_event_loop\\&.html\n" " */\n" " check(sd_event_loop(event));\n" msgstr "" #. type: Plain text #: archlinux fedora-40 mageia-cauldron opensuse-tumbleweed #, no-wrap msgid "" " /* https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_release_name\\&.html */\n" " check(sd_bus_release_name(bus, \"org\\&.freedesktop\\&.ReconnectExample\"));\n" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed msgid "" "Even though passing resources from one soft reboot cycle to the next is " "possible this way, we strongly suggest to use this functionality sparingly " "only, as it creates a more fragile system as resources from different " "versions of the OS and applications might be mixed with unforeseen " "consequences\\&. In particular it\\*(Aqs recommended to I allowing " "processes to survive the soft reboot operation, as this means code updates " "will necessarily be incomplete, and processes typically pin various other " "resources (such as the file system they are backed by), thus increasing " "memory usage (as two versions of the OS/application/file system might be " "kept in memory)\\&. Leaving processes running during a soft-reboot operation " "requires disconnecting the service comprehensively from the rest of the OS, " "i\\&.e\\&. minimizing IPC and reducing sharing of resources with the rest of " "the OS\\&. A possible mechanism to achieve this is the concept of " "\\m[blue]B\\m[]\\&\\s-2\\u[1]\\d\\s+2, but make sure no " "resource from the host\\*(Aqs OS filesystems is pinned via I or " "similar unit settings, otherwise the old, originating filesystem will remain " "mounted as long as the unit is running\\&." msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "NOTES" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Note that because B(8) is not executed, the executables " "in /usr/lib/systemd/system-shutdown/ are not executed either\\&." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Note that systemd-soft-reboot\\&.service (and related units) should never be " "executed directly\\&. Instead, trigger system shutdown with a command such " "as \"systemctl soft-reboot\"\\&." msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed msgid "" "Note that if a new root file system has been set up on \"/run/nextroot/\", a " "B will be performed when the B command is invoked\\&." msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "SEE ALSO" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "B(1), B(1), B(7), B(8), B(8), B(7)" msgstr "" #. type: IP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid " 1." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "Portable Services" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "\\%https://systemd.io/PORTABLE_SERVICES" msgstr "" #. type: TH #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "systemd 254" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 msgid "" "systemd-soft-reboot\\&.service is a system service that is pulled in by soft-" "reboot\\&.target and is responsible for performing a userspace-only reboot " "operation\\&. When invoked, it will send the B signal to any " "processes left running (but does not follow up with B, and does not " "wait for the processes to exit)\\&. If the /run/nextroot/ directory exists " "(which may be a regular directory, a directory mount point or a symlink to " "either) then it will switch the file system root to it\\&. It then " "reexecutes the service manager off the (possibly now new) root file system, " "which will enqueue a new boot transaction as in a normal reboot\\&." msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 msgid "" "The third phase of regular shutdown, i\\&.e\\&. the return to the initrd " "context" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 msgid "The hardware reboot operation" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 msgid "The firmware initialization" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 msgid "The boot loader initialization" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 msgid "The kernel initialization" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 msgid "The initrd initialization" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 msgid "" "Service processes may continue to run over the transition, if they are " "placed in services that remain active until the very end of shutdown (which " "again is achieved via I)\\&. They must also be set " "up to avoid being killed by the aforementioned B spree (as per " "\\m[blue]B\\m[]\\&\\s-2\\u[1]\\d\\s+2)\\&." msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 msgid "" "Even though passing resources from one soft reboot cycle to the next is " "possible this way, we strongly suggest to use this functionality sparingly " "only, as it creates a more fragile system as resources from different " "versions of the OS and applications might be mixed with unforeseen " "consequences\\&. In particular it\\*(Aqs recommended to I allowing " "processes to survive the soft reboot operation, as this means code updates " "will necessarily be incomplete, and processes typically pin various other " "resources (such as the file system they are backed by), thus increasing " "memory usage (as two versions of the OS/application/file system might be " "kept in memory)\\&. Leaving processes running during a soft-reboot operation " "requires disconnecting the service comprehensively from the rest of the OS, " "i\\&.e\\&. minimizing IPC and reducing sharing of resources with the rest of " "the OS\\&. A possible mechanism to achieve this is the concept of " "\\m[blue]B\\m[]\\&\\s-2\\u[2]\\d\\s+2, but make sure no " "resource from the host\\*(Aqs OS filesystems is pinned via I or " "similar unit settings, otherwise the old, originating filesystem will remain " "mounted as long as the unit is running\\&." msgstr "" #. type: Plain text #: debian-bookworm msgid "" "Note that because B(8) is not executed, the executables " "in /lib/systemd/system-shutdown/ are not executed either\\&." msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 msgid "systemd and Storage Daemons for the Root File System" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 msgid "\\%https://systemd.io/ROOT_STORAGE_DAEMONS" msgstr "" #. type: IP #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " 2." msgstr "" #. type: TH #: debian-unstable fedora-rawhide #, no-wrap msgid "systemd 256~rc3" msgstr "" #. type: Plain text #: debian-unstable fedora-rawhide #, no-wrap msgid "" "[Unit]\n" "Description=My Surviving Service\n" "SurviveFinalKillSignal=yes\n" "IgnoreOnIsolate=yes\n" "DefaultDependencies=no\n" "After=basic\\&.target\n" "Conflicts=reboot\\&.target kexec\\&.target poweroff\\&.target halt\\&.target rescue\\&.target emergency\\&.target\n" "Before=shutdown\\&.target rescue\\&.target emergency\\&.target\n" msgstr "" #. type: Plain text #: debian-unstable fedora-rawhide #, no-wrap msgid "" "/* A D-Bus service that automatically reconnects when the system bus is\n" " * restarted\\&.\n" " *\n" " * Compile with \\*(Aqcc sd_bus_service_reconnect\\&.c $(pkg-config --libs --cflags libsystemd)\\*(Aq\n" " *\n" " * To allow the program to take ownership of the name \\*(Aqorg\\&.freedesktop\\&.ReconnectExample\\*(Aq,\n" " * add the following as /etc/dbus-1/system\\&.d/org\\&.freedesktop\\&.ReconnectExample\\&.conf\n" " * and then reload the broker with \\*(Aqsystemctl reload dbus\\*(Aq:\n" msgstr "" #. type: Plain text #: debian-unstable fedora-rawhide #, no-wrap msgid "" "E?xml version=\"1\\&.0\"?E E!--*-nxml-*--E\n" "E!DOCTYPE busconfig PUBLIC \"-//freedesktop//DTD D-BUS Bus Configuration 1\\&.0//EN\"\n" " \"http://www\\&.freedesktop\\&.org/standards/dbus/1\\&.0/busconfig\\&.dtd\"E\n" "EbusconfigE\n" " Epolicy user=\"root\"E\n" " Eallow own=\"org\\&.freedesktop\\&.ReconnectExample\"/E\n" " Eallow send_destination=\"org\\&.freedesktop\\&.ReconnectExample\"/E\n" " Eallow receive_sender=\"org\\&.freedesktop\\&.ReconnectExample\"/E\n" " E/policyE\n" msgstr "" #. type: Plain text #: debian-unstable fedora-rawhide #, no-wrap msgid "" " Epolicy context=\"default\"E\n" " Eallow send_destination=\"org\\&.freedesktop\\&.ReconnectExample\"/E\n" " Eallow receive_sender=\"org\\&.freedesktop\\&.ReconnectExample\"/E\n" " E/policyE\n" "E/busconfigE\n" msgstr "" #. type: Plain text #: debian-unstable fedora-rawhide #, no-wrap msgid "" " *\n" " * To get the property via busctl:\n" " *\n" " * $ busctl --user get-property org\\&.freedesktop\\&.ReconnectExample \\e\n" " * /org/freedesktop/ReconnectExample \\e\n" " * org\\&.freedesktop\\&.ReconnectExample \\e\n" " * Example\n" " * s \"example\"\n" " */\n" msgstr "" #. type: Plain text #: debian-unstable fedora-rawhide #, no-wrap msgid "" "static int log_error(int r, const char *str) {\n" " fprintf(stderr, \"%s failed: %s\\en\", str, strerror(-r));\n" " return r;\n" "}\n" msgstr "" #. type: Plain text #: debian-unstable fedora-rawhide #, no-wrap msgid "" "static int on_disconnect(sd_bus_message *message, void *userdata, sd_bus_error *ret_error) {\n" " int r;\n" msgstr "" #. type: Plain text #: debian-unstable fedora-rawhide #, no-wrap msgid "" " r = setup((object *)userdata);\n" " if (r E 0) {\n" " object *o = userdata;\n" " r = sd_event_exit(*o-Eevent, r);\n" " if (r E 0)\n" " return log_error(r, \"sd_event_exit()\");\n" " }\n" msgstr "" #. type: Plain text #: debian-unstable fedora-rawhide #, no-wrap msgid "" "/* Ensure the event loop exits with a clear error if acquiring the well-known\n" " * service name fails */\n" "static int request_name_callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {\n" " int r;\n" msgstr "" #. type: Plain text #: debian-unstable fedora-rawhide #, no-wrap msgid "" " if (!sd_bus_message_is_method_error(m, NULL))\n" " return 1;\n" msgstr "" #. type: Plain text #: debian-unstable fedora-rawhide #, no-wrap msgid "" " fprintf(stderr, \"Failed to request name: %s\\en\", error-Emessage);\n" " object *o = userdata;\n" " r = sd_event_exit(*o-Eevent, -sd_bus_error_get_errno(error));\n" " if (r E 0)\n" " return log_error(r, \"sd_event_exit()\");\n" msgstr "" #. type: Plain text #: debian-unstable fedora-rawhide #, no-wrap msgid "" "static int setup(object *o) {\n" " int r;\n" msgstr "" #. type: Plain text #: debian-unstable fedora-rawhide #, no-wrap msgid "" " /* If we are reconnecting, then the bus object needs to be closed, detached\n" " * from the event loop and recreated\\&.\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_detach_event\\&.html\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_close_unref\\&.html\n" " */\n" " if (*o-Ebus) {\n" " r = sd_bus_detach_event(*o-Ebus);\n" " if (r E 0)\n" " return log_error(r, \"sd_bus_detach_event()\");\n" " *o-Ebus = sd_bus_close_unref(*o-Ebus);\n" " }\n" msgstr "" #. type: Plain text #: debian-unstable fedora-rawhide #, no-wrap msgid "" " /* Set up a new bus object for the system bus, configure it to wait for D-Bus\n" " * to be available instead of failing if it is not, and start it\\&. All the\n" " * following operations are asynchronous and will not block waiting for D-Bus\n" " * to be available\\&.\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_new\\&.html\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_set_address\\&.html\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_set_bus_client\\&.html\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_negotiate_creds\\&.html\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_set_watch_bind\\&.html\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_set_connected_signal\\&.html\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_start\\&.html\n" " */\n" " r = sd_bus_new(o-Ebus);\n" " if (r E 0)\n" " return log_error(r, \"sd_bus_new()\");\n" " r = sd_bus_set_address(*o-Ebus, \"unix:path=/run/dbus/system_bus_socket\");\n" " if (r E 0)\n" " return log_error(r, \"sd_bus_set_address()\");\n" " r = sd_bus_set_bus_client(*o-Ebus, 1);\n" " if (r E 0)\n" " return log_error(r, \"sd_bus_set_bus_client()\");\n" " r = sd_bus_negotiate_creds(*o-Ebus, 1, SD_BUS_CREDS_UID|SD_BUS_CREDS_EUID|SD_BUS_CREDS_EFFECTIVE_CAPS);\n" " if (r E 0)\n" " return log_error(r, \"sd_bus_negotiate_creds()\");\n" " r = sd_bus_set_watch_bind(*o-Ebus, 1);\n" " if (r E 0)\n" " return log_error(r, \"sd_bus_set_watch_bind()\");\n" " r = sd_bus_start(*o-Ebus);\n" " if (r E 0)\n" " return log_error(r, \"sd_bus_start()\");\n" msgstr "" #. type: Plain text #: debian-unstable fedora-rawhide #, no-wrap msgid "" " /* Publish an interface on the bus, specifying our well-known object access\n" " * path and public interface name\\&.\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_add_object\\&.html\n" " * https://dbus\\&.freedesktop\\&.org/doc/dbus-tutorial\\&.html\n" " */\n" " r = sd_bus_add_object_vtable(*o-Ebus,\n" " NULL,\n" " \"/org/freedesktop/ReconnectExample\",\n" " \"org\\&.freedesktop\\&.ReconnectExample\",\n" " vtable,\n" " o);\n" " if (r E 0)\n" " return log_error(r, \"sd_bus_add_object_vtable()\");\n" " /* By default the service is only assigned an ephemeral name\\&. Also add a\n" " * well-known one, so that clients know whom to call\\&. This needs to be\n" " * asynchronous, as D-Bus might not be yet available\\&. The callback will check\n" " * whether the error is expected or not, in case it fails\\&.\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_request_name\\&.html\n" " */\n" " r = sd_bus_request_name_async(*o-Ebus,\n" " NULL,\n" " \"org\\&.freedesktop\\&.ReconnectExample\",\n" " 0,\n" " request_name_callback,\n" " o);\n" " if (r E 0)\n" " return log_error(r, \"sd_bus_request_name_async()\");\n" " /* When D-Bus is disconnected this callback will be invoked, which will set up\n" " * the connection again\\&. This needs to be asynchronous, as D-Bus might not yet\n" " * be available\\&.\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_match_signal_async\\&.html\n" " */\n" " r = sd_bus_match_signal_async(*o-Ebus,\n" " NULL,\n" " \"org\\&.freedesktop\\&.DBus\\&.Local\",\n" " NULL,\n" " \"org\\&.freedesktop\\&.DBus\\&.Local\",\n" " \"Disconnected\",\n" " on_disconnect,\n" " NULL,\n" " o);\n" " if (r E 0)\n" " return log_error(r, \"sd_bus_match_signal_async()\");\n" " /* Attach the bus object to the event loop so that calls and signals are\n" " * processed\\&.\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_attach_event\\&.html\n" " */\n" " r = sd_bus_attach_event(*o-Ebus, *o-Eevent, 0);\n" " if (r E 0)\n" " return log_error(r, \"sd_bus_attach_event()\");\n" msgstr "" #. type: Plain text #: debian-unstable fedora-rawhide #, no-wrap msgid "" "int main(int argc, char **argv) {\n" " /* The bus should be relinquished before the program terminates\\&. The cleanup\n" " * attribute allows us to do it nicely and cleanly whenever we exit the block\\&.\n" " */\n" " _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;\n" " _cleanup_(sd_event_unrefp) sd_event *event = NULL;\n" " object o = {\n" " \\&.example = \"example\",\n" " \\&.bus = &bus,\n" " \\&.event = &event,\n" " };\n" " int r;\n" msgstr "" #. type: Plain text #: debian-unstable fedora-rawhide #, no-wrap msgid "" " /* Create an event loop data structure, with default parameters\\&.\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_event_default\\&.html\n" " */\n" " r = sd_event_default(&event);\n" " if (r E 0)\n" " return log_error(r, \"sd_event_default()\");\n" msgstr "" #. type: Plain text #: debian-unstable fedora-rawhide #, no-wrap msgid "" " /* By default the event loop will terminate when all sources have disappeared,\n" " * so we have to keep it \\*(Aqoccupied\\*(Aq\\&. Register signal handling to do so\\&.\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_event_add_signal\\&.html\n" " */\n" " r = sd_event_add_signal(event, NULL, SIGINT|SD_EVENT_SIGNAL_PROCMASK, NULL, NULL);\n" " if (r E 0)\n" " return log_error(r, \"sd_event_add_signal(SIGINT)\");\n" msgstr "" #. type: Plain text #: debian-unstable fedora-rawhide #, no-wrap msgid "" " r = sd_event_add_signal(event, NULL, SIGTERM|SD_EVENT_SIGNAL_PROCMASK, NULL, NULL);\n" " if (r E 0)\n" " return log_error(r, \"sd_event_add_signal(SIGTERM)\");\n" msgstr "" #. type: Plain text #: debian-unstable fedora-rawhide #, no-wrap msgid "" " r = setup(&o);\n" " if (r E 0)\n" " return EXIT_FAILURE;\n" msgstr "" #. type: Plain text #: debian-unstable fedora-rawhide #, no-wrap msgid "" " /* Enter the main loop, it will exit only on sigint/sigterm\\&.\n" " * https://www\\&.freedesktop\\&.org/software/systemd/man/sd_event_loop\\&.html\n" " */\n" " r = sd_event_loop(event);\n" " if (r E 0)\n" " return log_error(r, \"sd_event_loop()\");\n" msgstr "" #. type: Plain text #: debian-unstable fedora-rawhide #, no-wrap msgid "" " /* https://www\\&.freedesktop\\&.org/software/systemd/man/sd_bus_release_name\\&.html */\n" " r = sd_bus_release_name(bus, \"org\\&.freedesktop\\&.ReconnectExample\");\n" " if (r E 0)\n" " return log_error(r, \"sd_bus_release_name()\");\n" msgstr "" #. type: Plain text #: fedora-40 msgid "" "Service processes may continue to run over the transition, past soft-reboot " "and into the next session, if they are placed in services that remain active " "until the very end of shutdown (which again is achieved via " "I)\\&. They must also be set up to avoid being " "killed by the aforementioned B and B via " "I, and also be configured to avoid being stopped " "on isolate via I\\&. They also have to be configured to " "be stopped on normal shutdown, reboot and maintenance mode\\&. Finally, they " "have to be ordered after B to ensure correct ordeering on " "boot\\&. Note that in case any new or custom units are used to isolate to, " "or that implement an equivalent shutdown functionality, they will also have " "to be configured manually for correct ordering and conflicting\\&. For " "example:" msgstr ""