Development/Tutorials/PackageKit Session Interface

Jump to: navigation, search

What is PackageKit

PackageKit is an abstraction layer for basic package managing. Whether by basic it means providing what non technical users really need (searching/installing/removing/updating...). I is not intended to replace your package management, but to provide a single way of doing things. It's API is exported through a DBus interface, having glib, qt and python bindings. PolicyKit is also used so that you have a fine grained policy for your users.

This project is held by the free desktop umbrella, and has backends for several package managers ( But although this API is abstracts enough the package manager it is still too complex for applications that just want fonts, drivers, plugins etc.

What is PackageKit Session Interface

PackageKit Session Interface is the interface to be used by applications that don't want to know how package managing is done. They will care only about on checking if a package is installed or installing packages.

This topic raised a lot of discussions on KDE mailing lists, because random applications can ask users to install softwares. In the end this interface does not allow you to install random software, since it can only install things from your repositories. I will not enter in the merit of this discussion, since it's pointless as some like this approach and others do not.

If you don't like you can just disable it on your distribution, if you like use it :D

And it is available from the two GUI KPackageKit (Apper) and GNOME-PackageKit.

What this Tutorial is about then

Well as the title says PackageKit Session Interface, I'll cover the API details so that you can make your application use it.

DBus has basically two connections types the Session and the System. System interfaces normally run as root (otherwise they need rights to use it), on the other hand the session connections runs on the user session. These two connections do not talk to each other.

As your application will be running as user (otherwise you could just install it yourself :P), then we export this interface on the user session. Also there is no binding to this API, it's just exposed on the bus in the examples I will be using QtDBus but you can use perl, python...


There are two DBus interfaces exposed on the session. Query and Modify, as their names suggests query is used for querying packages and modify used to modify packages (i.e install)


Used to query if an specific package is installed
Used to find out if an specific file is inside some package be it installed or available.


Installs local package files or service packs.
Installs packages that provide the files.
Installs specified package catalogs.
Installs packages from a configured software source.
Installs mimetype handlers from a configured software source.
Installs fontconfig resources (usually fonts) from a configured software source.
Installs GStreamer fontconfig resources (usually codecs) from a configured software source.
Removes packages that provide the given local files.
Installs printer drivers from a configured software source.

This page was last modified on 23 November 2010, at 04:43. Content is available under Creative Commons License SA 4.0 unless otherwise noted.