{
    "mode": "man",
    "parameter": "systemd-soft-reboot.service",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/systemd-soft-reboot.service/8/json",
    "generated": "2026-09-06T14:43:08Z",
    "synopsis": "systemd-soft-reboot.service",
    "sections": {
        "NAME": {
            "content": "systemd-soft-reboot.service - Userspace reboot operation\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "systemd-soft-reboot.service\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "systemd-soft-reboot.service is a system service that is pulled in by soft-reboot.target and\nis responsible for performing a userspace-only reboot operation. When invoked, it will send\nthe SIGTERM signal to any processes left running (but does not wait for the processes to\nexit), and follow up with SIGKILL. If the /run/nextroot/ directory exists (which may be a\nregular directory, a directory mount point or a symlink to either) then it will switch the\nfile system root to it. It then reexecutes the service manager off the (possibly now new)\nroot file system, which will enqueue a new boot transaction as in a normal reboot.\n\nSuch a userspace-only reboot operation permits updating or resetting the entirety of\nuserspace with minimal downtime, as the reboot operation does not transition through:\n\n•   The second phase of regular shutdown, as implemented by systemd-shutdown(8).\n\n•   The third phase of regular shutdown, i.e. the return to the initrd context.\n\n•   The hardware reboot operation.\n\n•   The firmware initialization.\n\n•   The boot loader initialization.\n\n•   The kernel initialization.\n\n•   The initrd initialization.\n\nHowever this form of reboot comes with drawbacks as well:\n\n•   The OS update remains incomplete, as the kernel is not reset and continues running.\n\n•   Kernel settings (such as /proc/sys/ settings, a.k.a. \"sysctl\", or /sys/ settings) are not\nreset.\n\nThese limitations may be addressed by various means, which are outside of the scope of this\ndocumentation, such as kernel live-patching and sufficiently comprehensive /etc/sysctl.d/\nfiles.\n",
            "subsections": []
        },
        "RESOURCE PASS-THROUGH": {
            "content": "Various runtime OS resources can passed from a system runtime to the next, through the\nuserspace reboot operation. Specifically:\n\n•   File descriptors placed in the file descriptor store of services that remain active until\nthe very end are passed to the next boot, where they are placed in the file descriptor\nstore of the same unit. For this to work, units must declare DefaultDependencies=no (and\navoid a manual Conflicts=shutdown.target or similar) to ensure they are not terminated as\nusual during the system shutdown operation. Alternatively, use\nFileDescriptorStorePreserve= to allow the file descriptor store to remain pinned even\nwhen the unit is down. See systemd.service(5) for details about the file descriptor\nstore.\n\n•   Similar to this, file descriptors associated with .socket units remain open (and\nconnectible) if the units are not stopped during the transition. (Achieved by\nDefaultDependencies=no.)\n\n•   The /run/ file system remains mounted and populated and may be used to pass state\ninformation between such userspace reboot cycles.\n\n•   Service processes may continue to run over the transition, past soft-reboot and into the\nnext session, if they are placed in services that remain active until the very end of\nshutdown (which again is achieved via DefaultDependencies=no). They must also be set up\nto avoid being killed by the aforementioned SIGTERM and SIGKILL via\nSurviveFinalKillSignal=yes, and also be configured to avoid being stopped on isolate via\nIgnoreOnIsolate=yes. They also have to be configured to be stopped on normal shutdown,\nreboot and maintenance mode. Finally, they have to be ordered after basic.target to\nensure correct ordeering on boot. Note that in case any new or custom units are used to\nisolate to, or that implement an equivalent shutdown functionality, they will also have\nto be configured manually for correct ordering and conflicting. For example:\n\n[Unit]\nDescription=My surviving service\nSurviveFinalKillSignal=yes\nIgnoreOnIsolate=yes\nDefaultDependencies=no\nAfter=basic.target\nConflicts=reboot.target\nBefore=reboot.target\nConflicts=kexec.target\nBefore=kexec.target\nConflicts=poweroff.target\nBefore=poweroff.target\nConflicts=halt.target\nBefore=halt.target\nConflicts=rescue.target\nBefore=rescue.target\nConflicts=emergency.target\nBefore=emergency.target\n\n[Service]\nType=oneshot\nExecStart=sleep infinity\n\n\n•   File system mounts may remain mounted during the transition, and complex storage\nattached, if configured to remain until the very end of the shutdown process. (Also\nachieved via DefaultDependencies=no, and by avoiding Conflicts=umount.target)\n\n•   If the unit publishes a service over D-Bus, the connection needs to be re-established\nafter soft-reboot as the D-Bus broker will be stopped and then started again. When using\nthe sd-bus library this can be achieved by adapting the following example.\n\n/* SPDX-License-Identifier: MIT-0 */\n\n/* Implements a D-Bus service that automatically reconnects when the system bus is restarted.\n*\n* Compile with 'cc sdbusservicereconnect.c $(pkg-config --libs --cflags libsystemd)'\n*\n* To allow the program to take ownership of the name 'org.freedesktop.ReconnectExample',\n* add the following as /etc/dbus-1/system.d/org.freedesktop.ReconnectExample.conf\n* and then reload the broker with 'systemctl reload dbus':\n\n<?xml version=\"1.0\"?> <!--*-nxml-*-->\n<!DOCTYPE busconfig PUBLIC \"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN\"\n\"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd\">\n<busconfig>\n<policy user=\"root\">\n<allow own=\"org.freedesktop.ReconnectExample\"/>\n<allow senddestination=\"org.freedesktop.ReconnectExample\"/>\n<allow receivesender=\"org.freedesktop.ReconnectExample\"/>\n</policy>\n\n<policy context=\"default\">\n<allow senddestination=\"org.freedesktop.ReconnectExample\"/>\n<allow receivesender=\"org.freedesktop.ReconnectExample\"/>\n</policy>\n</busconfig>\n\n*\n* To get the property via busctl:\n*\n* $ busctl --user get-property org.freedesktop.ReconnectExample \\\n*                              /org/freedesktop/ReconnectExample \\\n*                              org.freedesktop.ReconnectExample \\\n*                              Example\n*   s \"example\"\n*/\n\n#include <errno.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <systemd/sd-bus.h>\n\n#define cleanup(f) attribute((cleanup(f)))\n\n#define check(x) ({                             \\\nint r = (x);                                 \\\nerrno = r < 0 ? -r : 0;                     \\\nprintf(#x \": %m\\n\");                          \\\nif (r < 0)                                   \\\nreturn EXITFAILURE;                        \\\n})\n\ntypedef struct object {\nconst char *example;\nsdbus bus;\nsdevent event;\n} object;\n\nstatic int propertyget(\nsdbus *bus,\nconst char *path,\nconst char *interface,\nconst char *property,\nsdbusmessage *reply,\nvoid *userdata,\nsdbuserror *error) {\n\nobject *o = userdata;\n\nif (strcmp(property, \"Example\") == 0)\nreturn sdbusmessageappend(reply, \"s\", o->example);\n\nreturn sdbuserrorsetf(error,\nSDBUSERRORUNKNOWNPROPERTY,\n\"Unknown property '%s'\",\nproperty);\n}\n\n/* https://www.freedesktop.org/software/systemd/man/sdbusaddobject.html */\nstatic const sdbusvtable vtable[] = {\nSDBUSVTABLESTART(0),\nSDBUSPROPERTY(\n\"Example\", \"s\",\npropertyget,\n0,\nSDBUSVTABLEPROPERTYCONST),\nSDBUSVTABLEEND\n};\n\nstatic int setup(object *o);\n\nstatic int ondisconnect(sdbusmessage *message, void *userdata, sdbuserror *reterror) {\ncheck(setup((object *)userdata));\nreturn 0;\n}\n\n/* Ensure the event loop exits with a clear error if acquiring the well-known service name fails */\nstatic int requestnamecallback(sdbusmessage *m, void *userdata, sdbuserror *reterror) {\nif (!sdbusmessageismethoderror(m, NULL))\nreturn 1;\n\nconst sdbuserror *error = sdbusmessagegeterror(m);\n\nif (sdbuserrorhasnames(error, SDBUSERRORTIMEOUT, SDBUSERRORNOREPLY))\nreturn 1; /* The bus is not available, try again later */\n\nprintf(\"Failed to request name: %s\\n\", error->message);\nobject *o = userdata;\ncheck(sdeventexit(*o->event, -sdbuserrorgeterrno(error)));\n\nreturn 1;\n}\n\nstatic 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/sdbusdetachevent.html\n* https://www.freedesktop.org/software/systemd/man/sdbuscloseunref.html\n*/\nif (*o->bus) {\ncheck(sdbusdetachevent(*o->bus));\n*o->bus = sdbuscloseunref(*o->bus);\n}\n\n/* 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/sdbusnew.html\n* https://www.freedesktop.org/software/systemd/man/sdbussetaddress.html\n* https://www.freedesktop.org/software/systemd/man/sdbussetbusclient.html\n* https://www.freedesktop.org/software/systemd/man/sdbusnegotiatecreds.html\n* https://www.freedesktop.org/software/systemd/man/sdbussetwatchbind.html\n* https://www.freedesktop.org/software/systemd/man/sdbussetconnectedsignal.html\n* https://www.freedesktop.org/software/systemd/man/sdbusstart.html\n*/\ncheck(sdbusnew(o->bus));\ncheck(sdbussetaddress(*o->bus, \"unix:path=/run/dbus/systembussocket\"));\ncheck(sdbussetbusclient(*o->bus, 1));\ncheck(sdbusnegotiatecreds(*o->bus, 1, SDBUSCREDSUID|SDBUSCREDSEUID|SDBUSCREDSEFFECTIVECAPS));\ncheck(sdbussetwatchbind(*o->bus, 1));\ncheck(sdbusstart(*o->bus));\n\n/* 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/sdbusaddobject.html\n* https://dbus.freedesktop.org/doc/dbus-tutorial.html\n*/\ncheck(sdbusaddobjectvtable(*o->bus,\nNULL,\n\"/org/freedesktop/ReconnectExample\",\n\"org.freedesktop.ReconnectExample\",\nvtable,\no));\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/sdbusrequestname.html\n*/\ncheck(sdbusrequestnameasync(*o->bus,\nNULL,\n\"org.freedesktop.ReconnectExample\",\n0,\nrequestnamecallback,\no));\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/sdbusmatchsignalasync.html\n*/\ncheck(sdbusmatchsignalasync(*o->bus,\nNULL,\n\"org.freedesktop.DBus.Local\",\nNULL,\n\"org.freedesktop.DBus.Local\",\n\"Disconnected\",\nondisconnect,\nNULL,\no));\n/* Attach the bus object to the event loop so that calls and signals are processed.\n* https://www.freedesktop.org/software/systemd/man/sdbusattachevent.html\n*/\ncheck(sdbusattachevent(*o->bus, *o->event, 0));\n\nreturn 0;\n}\n\nint 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*/\ncleanup(sdbusflushcloseunrefp) sdbus *bus = NULL;\ncleanup(sdeventunrefp) sdevent *event = NULL;\nobject o = {\n.example = \"example\",\n.bus = &bus,\n.event = &event,\n};\n\n/* Create an event loop data structure, with default parameters.\n* https://www.freedesktop.org/software/systemd/man/sdeventdefault.html\n*/\ncheck(sdeventdefault(&event));\n\n/* By default the event loop will terminate when all sources have disappeared, so\n* we have to keep it 'occupied'. Register signal handling to do so.\n* https://www.freedesktop.org/software/systemd/man/sdeventaddsignal.html\n*/\ncheck(sdeventaddsignal(event, NULL, SIGINT|SDEVENTSIGNALPROCMASK, NULL, NULL));\ncheck(sdeventaddsignal(event, NULL, SIGTERM|SDEVENTSIGNALPROCMASK, NULL, NULL));\n\ncheck(setup(&o));\n\n/* Enter the main loop, it will exit only on sigint/sigterm.\n* https://www.freedesktop.org/software/systemd/man/sdeventloop.html\n*/\ncheck(sdeventloop(event));\n\n/* https://www.freedesktop.org/software/systemd/man/sdbusreleasename.html */\ncheck(sdbusreleasename(bus, \"org.freedesktop.ReconnectExample\"));\n\nreturn 0;\n}\n\n\nEven though passing resources from one soft reboot cycle to the next is possible this way, we\nstrongly suggest to use this functionality sparingly only, as it creates a more fragile\nsystem as resources from different versions of the OS and applications might be mixed with\nunforeseen consequences. In particular it's recommended to avoid allowing processes to\nsurvive the soft reboot operation, as this means code updates will necessarily be incomplete,\nand processes typically pin various other resources (such as the file system they are backed\nby), thus increasing memory usage (as two versions of the OS/application/file system might be\nkept in memory). Leaving processes running during a soft-reboot operation requires\ndisconnecting the service comprehensively from the rest of the OS, i.e. minimizing IPC and\nreducing sharing of resources with the rest of the OS. A possible mechanism to achieve this\nis the concept of \u001b[34mPortable Services[1], but make sure no resource from the host's OS\nfilesystems is pinned via BindPaths= or similar unit settings, otherwise the old, originating\nfilesystem will remain mounted as long as the unit is running.\n",
            "subsections": []
        },
        "NOTES": {
            "content": "1. Portable Services\nhttps://systemd.io/PORTABLESERVICES\n\nsystemd 255                                                           SYSTEMD-SOFT-REBOOT.SERVICE(8)",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "systemd(1), systemctl(1), systemd.special(7), systemd-poweroff.service(8), systemd-\nsuspend.service(8), bootup(7)\n",
            "subsections": []
        }
    },
    "summary": "systemd-soft-reboot.service - Userspace reboot operation",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "systemd",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/systemd/1/json"
        },
        {
            "name": "systemctl",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/systemctl/1/json"
        },
        {
            "name": "systemd.special",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/systemd.special/7/json"
        },
        {
            "name": "systemd-poweroff.service",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/systemd-poweroff.service/8/json"
        },
        {
            "name": "suspend.service",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/suspend.service/8/json"
        },
        {
            "name": "bootup",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/bootup/7/json"
        }
    ]
}