{
    "mode": "man",
    "parameter": "systemd.offline-updates",
    "section": "7",
    "url": "https://www.chedong.com/phpMan.php/man/systemd.offline-updates/7/json",
    "generated": "2026-08-08T10:29:37Z",
    "sections": {
        "NAME": {
            "content": "systemd.offline-updates - Implementation of offline updates in systemd\n",
            "subsections": []
        },
        "IMPLEMENTING OFFLINE SYSTEM UPDATES": {
            "content": "This man page describes how to implement \"offline\" system updates with systemd. By \"offline\"\nOS updates we mean package installations and updates that are run with the system booted into\na special system update mode, in order to avoid problems related to conflicts of libraries\nand services that are currently running with those on disk. This document is inspired by this\n\u001b[34mGNOME design whiteboard[1].\n\nThe logic:\n\n1. The package manager prepares system updates by downloading all (.rpm or .deb or whatever)\npackages to update off-line in a special directory /var/lib/system-update (or another\ndirectory of the package/upgrade manager's choice).\n\n2. When the user OK'ed the update, the symlink /system-update or /etc/system-update is\ncreated that points to /var/lib/system-update (or wherever the directory with the upgrade\nfiles is located) and the system is rebooted. This symlink is in the root directory,\nsince we need to check for it very early at boot, at a time where /var/ is not available\nyet.\n\n3. Very early in the new boot systemd-system-update-generator(8) checks whether\n/system-update or /etc/system-update exists. If so, it (temporarily and for this boot\nonly) redirects (i.e. symlinks) default.target to system-update.target, a special target\nthat pulls in the base system (i.e.  sysinit.target, so that all file systems are mounted\nbut little else) and the system update units.\n\n4. The system now continues to boot into default.target, and thus into system-update.target.\nThis target pulls in all system update units. Only one service should perform an update\n(see the next point), and all the other ones should exit cleanly with a \"success\" return\ncode and without doing anything. Update services should be ordered after sysinit.target\nso that the update starts after all file systems have been mounted.\n\n5. As the first step, an update service should check if the /system-update or\n/etc/system-update symlink points to the location used by that update service. In case it\ndoes not exist or points to a different location, the service must exit without error. It\nis possible for multiple update services to be installed, and for multiple update\nservices to be launched in parallel, and only the one that corresponds to the tool that\ncreated the symlink before reboot should perform any actions. It is unsafe to run\nmultiple updates in parallel.\n\n6. The update service should now do its job. If applicable and possible, it should create a\nfile system snapshot, then install all packages. After completion (regardless whether the\nupdate succeeded or failed) the machine must be rebooted, for example by calling\nsystemctl reboot. In addition, on failure the script should revert to the old file system\nsnapshot (without the symlink).\n\n7. The update scripts should exit only after the update is finished. It is expected that the\nservice which performs the update will cause the machine to reboot after it is done. If\nthe system-update.target is successfully reached, i.e. all update services have run, and\nthe /system-update or /etc/system-update symlink still exists, it will be removed and the\nmachine rebooted as a safety measure.\n\n8. After a reboot, now that the /system-update and /etc/system-update symlink is gone, the\ngenerator won't redirect default.target anymore and the system now boots into the default\ntarget again.\n",
            "subsections": []
        },
        "RECOMMENDATIONS": {
            "content": "1. To make things a bit more robust we recommend hooking the update script into\nsystem-update.target via a .wants/ symlink in the distribution package, rather than\ndepending on systemctl enable in the postinst scriptlets of your package. More\nspecifically, for your update script create a .service file, without [Install] section,\nand then add a symlink like\n/usr/lib/systemd/system/system-update.target.wants/foobar.service → ../foobar.service to\nyour package.\n\n2. Make sure to remove the /system-update and /etc/system-update symlinks as early as\npossible in the update script to avoid reboot loops in case the update fails.\n\n3. Use FailureAction=reboot in the service file for your update script to ensure that a\nreboot is automatically triggered if the update fails.  FailureAction= makes sure that\nthe specified unit is activated if your script exits uncleanly (by non-zero error code,\nor signal/coredump). If your script succeeds you should trigger the reboot in your own\ncode, for example by invoking logind's Reboot() call or calling systemctl reboot. See\norg.freedesktop.login1(5) for details about the logind D-Bus API.\n\n4. The update service should declare DefaultDependencies=no, Requires=sysinit.target,\nAfter=sysinit.target, After=system-update-pre.target, Before=system-update.target and\nexplicitly pull in any other services it requires.\n\n5. It may be desirable to always run an auxiliary unit when booting into offline-updates\nmode, which itself does not install updates. To do this create a .service file with\nWants=system-update-pre.target and Before=system-update-pre.target and add a symlink to\nthat file under /usr/lib/systemd/system-update.target.wants .\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "systemd(1), systemd.generator(7), systemd-system-update-generator(8), dnf.plugin.system-\nupgrade(8)\n",
            "subsections": []
        },
        "NOTES": {
            "content": "1. GNOME design whiteboard\nhttps://wiki.gnome.org/Design/OS/SoftwareUpdates\n\nsystemd 255                                                               SYSTEMD.OFFLINE-UPDATES(7)",
            "subsections": []
        }
    },
    "summary": "systemd.offline-updates - Implementation of offline updates in systemd",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "systemd",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/systemd/1/json"
        },
        {
            "name": "systemd.generator",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/systemd.generator/7/json"
        },
        {
            "name": "systemd-system-update-generator",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/systemd-system-update-generator/8/json"
        },
        {
            "name": "upgrade",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/upgrade/8/json"
        }
    ]
}