How does Discover/pkcon work?

Hi so I’m bit curious to know how exactly the Discover update process works across various distros.

Does Discover use pkcon? How does it work? How are offline updates done differently to “normal” updates?

For example on Fedora, does Discover just run dnf behind the scenes so that user doesnt have to write a password?

Just would like to know out of plain curiosity, no more no less :smiley:

For updating distro packages, Discover generally uses the PackageKit library which abstracts the difference between different package management tools. This library uses distro-specific plugins to provide a consistent interface to Discover.

pkcon is the command-line interface to PackageKit. It will do the same things Discover does (roughly).

On immutable OS distros, Discover generally has a dedicated distro-specific backend instead, since PackageKit. I’m aware of two: one for SteamOS and one for Fedora Kinoite.

2 Likes

Isn’t PackageKit deprecated?

Depends on your particular distribution. On Arch-based distributions, for example, PackageKit doesn’t work properly at all, and that’s why most Arch-based distributions ship without Discover.

3 Likes

No, PackageKit is not deprecated.

In which case, do you mind telling me what

and

https://blogs.gnome.org/hughsie/2019/02/14/packagekit-is-dead-long-live-well-something-else/

(which it links to) as corroborated by

and PackageKit is dead, long live, well, something else · Issue #14722 · cockpit-project/cockpit · GitHub

mean?

It means PackageKit’s author and former maintainer stopped working on it very regularly and decided unfortunately to publicly communicate this in a FUD-generating matter. The software still generally works. The trends that Richard points out are real, but it’s also premature to declare the library useless because we definitely haven’t moved into a world where it no longer has any value.

You can see this in the fact that other people have since taken over the work; if you look at Commits · PackageKit/PackageKit · GitHub, you’ll see tons of commits, so the project looks healthy to me.

3 Likes

Thanks for the answers.

I’m still wondering how the offline-update works. Does it basically do the following:

- At systemd startup, see there’s packages to be updated
- Boot just enough to be able to update the system
- Update them using whaetever packagemanager the system uses.
- If there are failures, rollback.
- If there are no failures, restart system after installation and boot as normal.

Or am I way off? :smiley:

Edit: Seems I wasn’t too far off. Read the link in the post below for explanation :slight_smile:

If you’re interested in the exact details, the mechanism is documented here: systemd.offline-updates and here: PackageKit/offline-updates.txt at main · PackageKit/PackageKit · GitHub

2 Likes

Ah thank you, will give it a read.