X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=man%2Fsystemd.offline-updates.xml;h=89c12b598bdacc2b6e2565c72f9c2bc5070706a0;hb=5650ec7a11beb18390f4db081128eb3756abf064;hp=946234ad90461b2eeb0e48e36df1e6cf3257295d;hpb=382b56622add2aff81bdcc8af5fa0b40c3cb64ef;p=thirdparty%2Fsystemd.git diff --git a/man/systemd.offline-updates.xml b/man/systemd.offline-updates.xml index 946234ad904..89c12b598bd 100644 --- a/man/systemd.offline-updates.xml +++ b/man/systemd.offline-updates.xml @@ -1,40 +1,12 @@ - - - + systemd.offline-updates systemd - - - - Developer - Lennart - Poettering - lennart@poettering.net - - @@ -63,13 +35,13 @@ The package manager prepares system updates by downloading all (RPM or DEB or whatever) packages to update off-line in a special directory - /var/lib/system-update (or + /var/lib/system-update (or another directory of the package/upgrade manager's choice). When the user OK'ed the update, the symlink /system-update is - created that points to /var/lib/system-update (or + created that points to /var/lib/system-update (or wherever the directory with the upgrade files is located) and the system is rebooted. This symlink is in the root directory, since we need to check for it very early at boot, at a time where /var is not available yet. @@ -77,43 +49,53 @@ Very early in the new boot - systemd-update-generator8 + systemd-system-update-generator8 checks whether /system-update exists. If so, it (temporarily and for this boot only) redirects (i.e. symlinks) default.target to - system-update.target, a special target that is pulls in the base system + system-update.target, a special target that pulls in the base system (i.e. sysinit.target, so that all file systems are mounted but little else) and the system update units. - The system now continues to boot into default.target, and thus - into system-update.target. This target pulls in the system update unit, - which starts the system update script after all file systems have been mounted. + The system now continues to boot into default.target, and + thus into system-update.target. This target pulls in all system + update units. Only one service should perform an update (see the next point), and all + the other ones should exit cleanly with a "success" return code and without doing + anything. Update services should be ordered after sysinit.target + so that the update starts after all file systems have been mounted. - As the first step, the update script should check if the - /system-update symlink points to the the location used by that update - script. In case it does not exists or points to a different location, the script must exit + As the first step, an update service should check if the + /system-update symlink points to the location used by that update + service. In case it does not exist or points to a different location, the service must exit without error. It is possible for multiple update services to be installed, and for multiple - update scripts to be launched in parallel, and only the one that corresponds to the tool + update services to be launched in parallel, and only the one that corresponds to the tool that created the symlink before reboot should perform any actions. It is unsafe to run multiple updates in parallel. - The update script should now do its job. If applicable and possible, it should - create a file system snapshot, then install all packages. - After completion (regardless whether the update succeeded or failed) the machine - must be rebooted, for example by calling systemctl reboot. - In addition, on failure the script should revert to the old file system snapshot - (without the symlink). + The update service should now do its job. If applicable and possible, it should + create a file system snapshot, then install all packages. After completion (regardless + whether the update succeeded or failed) the machine must be rebooted, for example by + calling systemctl reboot. In addition, on failure the script should + revert to the old file system snapshot (without the symlink). - The system is rebooted. Since the /system-update symlink is gone, - the generator won't redirect default.target after reboot and the - system now boots into the default target again. + The upgrade scripts should exit only after the update is finished. It is expected + that the service which performs the upgrade will cause the machine to reboot after it + is done. If the system-update.target is successfully reached, i.e. + all update services have run, and the /system-update symlink still + exists, it will be removed and the machine rebooted as a safety measure. + + + + After a reboot, now that the /system-update symlink is gone, + the generator won't redirect default.target anymore and the system + now boots into the default target again. @@ -124,12 +106,12 @@ To make things a bit more robust we recommend hooking the update script into - system-update.target via a .wants/ + system-update.target via a .wants/ symlink in the distribution package, rather than depending on systemctl enable in the postinst scriptlets of your package. More specifically, for your update script create a .service file, without [Install] section, and then add a symlink like - /usr/lib/systemd/system-update.target.wants/foobar.service - → ../foobar.service to your package. + /usr/lib/systemd/system-update.target.wants/foobar.service + → ../foobar.service to your package. @@ -143,14 +125,27 @@ FailureAction= makes sure that the specified unit is activated if your script exits uncleanly (by non-zero error code, or signal/coredump). If your script succeeds you should trigger the reboot in your own code, for example by invoking logind's - Reboot() call or calling systemct reboot. See - logind dbus API + Reboot() call or calling systemctl reboot. See + logind dbus API for details. - The update service should declare DefaultDependencies=false, - and pull in any services it requires explicitly. + The update service should declare DefaultDependencies=no, + Requires=sysinit.target, After=sysinit.target, + After=system-update-pre.target, Before=system-update.target + and explicitly pull in any other services it requires. + + + + It may be desirable to always run an auxiliary unit when booting + into offline-updates mode, which itself does not install updates. To + do this create a .service file with + Wants=system-update-pre.target and + Before=system-update-pre.target and add a symlink + to that file under + /usr/lib/systemd/system-update.target.wants + . @@ -159,11 +154,10 @@ See also - Implementing Offline System Updates, systemd1, systemd.generator7, - systemd-update-generator8, - dnf.plugin.system-upgrade8 + systemd-system-update-generator8, + dnf.plugin.system-upgrade8