Skip to content
These features should be available in Qubes OS 4.4! 🎉

Fixing PackageKit

PackageKit is called by Gnome Software (and KDE Discover) for managing DEB and RPM repos. However, it was not working correctly in Qubes.

Problems found

Internet connection

PackageKit checks for internet connection using glib’s default network monitor (NetworkManager) and was reporting that the network was offline in both Debian and Fedora templates.

Fedora vs. Debian

On Fedora, PackageKit was working despite that, as it has a code path to work when it is offline. However, as it was always working offline, it was not getting the latest updates and it was impossible to use every feature.

On Debian it was not working, getting the error message “Cannot download packages whilst offline”.

Previous work

Some workarounds were created to make NetworkManager believe there is a network to manage (example 1 , example 2). However, these solutions could also affect other system components.

Fix: In theory, it would be possible to select a different network monitor using the environment variable GIO_USE_NETWORK_MONITOR and setting it to base, which would report it as being online in templates. This is exactly what was done for Gnome Software in Qubes. However, in practice it seems that PackageKit is ignoring those environment variables, leading to the next problem.

Keep environment

On one hand, PackageKit clears the environment. On the other hand, pkcon can’t inform PackageKit about environment variables inserted in the terminal, so the prior solution wouldn’t work.

Fix: However, packagekitd has a –-keep-environment argument to “Don’t clear environment on startup”. In the past this could also be set in PackageKit.conf, but it is not possible anymore.

Final solution

Set the file /usr/lib/systemd/system/packagekit.service.d/30_qubes.conf with:

[Service]
Environment='GIO_USE_NETWORK_MONITOR=base'
ExecStart=
ExecStart=/usr/libexec/packagekitd --keep-environment

This way, the environment variable GIO_USE_NETWORK_MONITOR=base is set when starting the packagekit systemd service, reporting it as online and the packagekitd --keep-environment argument ensures the environment is not cleaned.

With these fixes, it is possible to…

  • ✅ Install software using PackageKit in Debian
  • ✅ Correctly install software using PackageKit in Fedora
  • ✅ Install software from DEB or RPM repos in Gnome Software
  • ✅ Install software from DEB or RPM repos in KDE Discover