Offline Updates using PackageKit and systemd
This functionality adds the offline updates feature to PackageKit as described in the following URL:
https://www.freedesktop.org/software/systemd/man/systemd.offline-updates.html
What to do if you're a backend
- If the
transaction_flagscontainPREPAREthen download all the metadata and packages for the transaction, but don’t actually apply the transaction.
What to do if you're a frontend
- If the
/var/lib/PackageKit/prepared-updatefile exists then offer the user to:- Restart & Install Updates
- Suspend
rather than just:
- Suspend
- If the user clicks “Restart & Install Updates” then execute
pkcon offline-trigger and then restart the computer the usual way.
On the next reboot, the updates will be installed, and the computer will be restarted again.
The /var/lib/PackageKit/prepared-update file will be automatically
removed if the offline update succeeded, but the offline update will
only be attempted once.
The /var/lib/PackageKit/offline-update-competed file will be created
once the /usr/libexec/pk-offline-update program has been run by
systemd. For failure, the file will contain the following:
[PackageKit Offline Update Results]
Success=false
ErrorCode=missing-gpg-signature
ErrorDetails="The GPG signature 0xDEADBEEF is not installed"
For success, the file will contain the following:
[PackageKit Offline Update Results]
Success=true
Role=update-packages
Packages=gimp;2.10.34-1.fc38;x86_64;updates,bash;5.2.15-3.fc38;x86_64;updates
Testing offline updates
- Ensure powertop and colorhug-client are installed and the system is othewise up to date. Ensure PackageKit-1.0.0 or later is installed.
- Downgrade the powertop and colorhug-client packages on your system so
that you have exactly two updates when you do
pkcon get-updates - Download the new powertop update with:
pkcon --only-download update powertop - Observe there are no PolicyKit “Authentication Required” dialogs shown as the command completes.
- Ensure
/var/lib/PackageKit/prepared-updatecontains just the powertop package in “prepared_ids” variable. [You can also usepkcon offline-get-preparedto do the same thing] - Download the new colorhug-client update with:
pkcon --only-download update colorhug-client - Ensure
/var/lib/PackageKit/prepared-updatecontains both powertop and colorhug-client packages in “prepared_ids” variable. - Run
pkcon offline-triggerand confirm that the/system-updatesymlink exists. - Check that
/var/lib/PackageKit/offline-update-actionis “reboot” - Run
sudo PK_OFFLINE_UPDATE_TEST=1 /usr/libexec/pk-offline-updateand observe that the two updates are applied - Confirm that
/var/lib/PackageKit/prepared-updatehas been deleted - Confirm that
/var/lib/PackageKit/offline-update-competedexists, contains the 2 updated packages in “Packages” variable, and no error messages have been logged. [You can also usepkcon offline-statusto do the same thing] - Downgrade powertop and colorhug-client again, and do:
pkcon --only-download update powertop colorhug-client - Run
pkcon offline-trigger - Reboot, and observe that the updates are applied in the special
packagekit-offline-update.servicewith plymouth going from 0% to 100% - Confirm that the system is rebooted into a running system that has has the updates applied.