PackageKit: offline updates not working on openSUSE MicroOS. Online updates (that are not really online though) necessary
On openSUSE MicroOS, all updates are offline already and always, because they happen in a new BTRFS snapshot that will be activated at next reboot (we call the mechanism "Transactional Updates"). I guess it can be considered similar to rpm-ostree, but implemented with BTRFS snapshots instead than with ostree.
On MicroOS Desktop, this is handled by PackageKit already. Basically, the user perform the update/install/removal of an RPM, say with pkcon
, and the PackageKit backend that we use takes care of doing that properly, in the right snapshot, etc.
This, therefore, means that we are fine with online updates, because they are not really online. And for have GNOME Software work well on MicroOS Desktop, we need it to deal with online updates too.
Basically, we need that, on MicroOS, GNOME Software allows the user to just click on 'Update', and then "ask" PackageKit to deal with the operation, without any need to download the packages in advance, prepare the systemd update stub and then asking for a reboot. And that's why we are saying that this "looks like" an online update from GNOME Software point of view, while in reality it isn't, considering the platform we are on and the backend we're using.
There is some discussion about the topic here: https://discourse.gnome.org/t/having-a-way-to-disable-offline-updates-in-gnome-software-for-immutable-oses/6366/14
I have done a DRAFT and HACKISH proof-of-concept implementation of the above, mostly for figuring out whether it was at all possible and how it would look like. Anyway, it is available here: dfaggioli/gnome-software@40bfa071
I have a very limited experience and understanding of GNOME Software codebase (I've played with this not more than a few hours, spread around a couple of weeks), so maybe bear it in mind when you look at it. It's more than just possible that I have done the wrong thing in the wrong places, and I accept any kind of feedback and advice to turn this into something plausible.
Digging around, I realized that online updates was removed from the PackageKit backend in 46eca30b, “Remove online-update functionality”, so what this patch does is putting it back there.
We definitely want that to only happen for openSUSE MicroOS though, and I'm checking that that is the case in a couple of places, but I am not sure I am doing it in the best possible way.
The other issue is that, if we are in MicroOS, all packages need to be considered as UPDATABLE_LIVE. And therefore I do switch them to such a state, but probably not in the best possible place/way, as I see in the logs that the transition is considered "not ok" (although, I tested this, and it works! :-P).
I tested this by building a GNOME Software package with the patch applied and, yeah, it works. Visualization is not perfect (e.g., I don't see the nice progress bar embedded in the "Update" button), but: (1) packages are updated online --from GNOME Software's perspective-- by handing them to PackageKit, which then does what's right with them and (2) that only happens on MicroOS, i.e., if I install that same package on openSUSE MicroOS, packages are not being switched to UPDATABLE_LIVE and I still see the "Restart & Update" button, as it should be.
The package is available here: https://build.opensuse.org/package/show/home:dfaggioli:microos-desktop/gnome-software https://build.opensuse.org/package/binaries/home:dfaggioli:microos-desktop/gnome-software/openSUSE_Tumbleweed
Thanks and Regards