How to install a local rpm package file in dom0?

I just built a rpm package (i3ipc-glib.rpm) in a fedora-37-xfce DispVM. I copied it to dom0. I tried to install the package several different ways and they all failed:

qubes-dom0-update

$ sudo qubes-dom0-update ./i3ipc-glib.rpm
Using sys-vpn as UpdateVM to download updates for Dom0; this may take some time...
Copr repo for xfce4-i3 owned by fepitre         6.4 kB/s | 1.8 kB     00:00
Fedora 37 - x86_64                               20 kB/s | 5.5 kB     00:00
Fedora 37 - x86_64 - Updates                     24 kB/s | 5.4 kB     00:00
Qubes Host Repository (updates)                 2.6 kB/s | 2.7 kB     00:01
Can not load RPM file: ./i3ipc-glib.rpm.
Could not open: ./i3ipc-glib.rpm

dnf

$ sudo dnf install ./i3ipc-glib.rpm
Qubes OS Repository for Dom0                                             0.0  B/s |   0  B     00:00
Errors during downloading metadata for repository 'qubes-dom0-cached':
  - Curl error (37): Couldn't read a file:// file for file:///var/lib/qubes/updates/repodata/repomd.xml [Couldn't open file /var/lib/qubes/updates/repodata/repomd.xml]
Error: Failed to download metadata for repo 'qubes-dom0-cached': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
Ignoring repositories: qubes-dom0-cached
Error:
 Problem: conflicting requests
  - nothing provides pkgconfig(gio-2.0) needed by i3ipc-glib-1.0.1-1.fc37.x86_64 from @commandline
  - nothing provides pkgconfig(gobject-2.0) needed by i3ipc-glib-1.0.1-1.fc37.x86_64 from @commandline
  - nothing provides pkgconfig(json-glib-1.0) needed by i3ipc-glib-1.0.1-1.fc37.x86_64 from @commandline
(try to add '--skip-broken' to skip uninstallable packages)

rpm

$ sudo rpm -i ./i3ipc-glib.rpm
error: Failed dependencies:
        pkgconfig(gio-2.0) is needed by i3ipc-glib-1.0.1-1.fc37.x86_64
        pkgconfig(gobject-2.0) is needed by i3ipc-glib-1.0.1-1.fc37.x86_64
        pkgconfig(json-glib-1.0) is needed by i3ipc-glib-1.0.1-1.fc37.x86_64

To check for dependencies, I did this:

$ rpm -qRp ./i3ipc-glib.rpm
/usr/bin/pkg-config
glib2
gobject-introspection
json-glib
libc.so.6()(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.4)(64bit)
libgio-2.0.so.0()(64bit)
libglib-2.0.so.0()(64bit)
libgobject-2.0.so.0()(64bit)
libi3ipc-glib-1.0.so.0()(64bit)
libjson-glib-1.0.so.0()(64bit)
libjson-glib-1.0.so.0(libjson-glib-1.0.so.0)(64bit)
libxcb
libxcb.so.1()(64bit)
pkgconfig(gio-2.0)
pkgconfig(gobject-2.0)
pkgconfig(json-glib-1.0)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsZstd) <= 5.4.18-1
rtld(GNU_HASH)

This does not directly translate to a proper list of package to install, so I am unable to install the dependencies in a straightforward way, let alone any way yet.

salt

  • Create the user environment and directories
$ sudo qubesctl state.sls qubes.user_dirs
  • Create a files directory to store the rpm file
$ sudo mkdir -p /srv/user_salt/files
$ sudo cp <path_to_rpm_file> /srv/user_salt/files
  • Create an sls file to instruct salt to install the package (/srv/user_salt/test_dom0.sls):
{% set files_dir = 'salt://' + tpldir + '/files' %}

{{ sls }}--install-local-package:
  pkg.installed:
    - sources:
        - i3ipc-glib: {{ files_dir }}/i3ipc-glib.rpm
  • Execute salt throught qubesctl:
$ sudo qubesctl --show-output state.sls test_dom0 saltenv=user
[WARNING ] 'version' argument will be ignored for multiple package targets
[ERROR   ] Command 'systemd-run' failed with return code: 1
[ERROR   ] stdout: Running scope as unit: run-r2ff5a6a56ad5410b924b83f4fbfb754c.scope
Using sys-vpn as UpdateVM to download updates for Dom0; this may take some time...
0 files removed
Copr repo for xfce4-i3 owned by fepitre         6.3 kB/s | 3.5 kB     00:00
Fedora 37 - x86_64                              2.3 MB/s |  82 MB     00:35
Fedora 37 - x86_64 - Updates                    1.8 MB/s |  41 MB     00:22
Qubes Host Repository (updates)                 480 kB/s | 2.5 MB     00:05
Can not load RPM file: /var/cache/salt/minion/files/user/files/i3ipc-glib.rpm.
Could not open: /var/cache/salt/minion/files/user/files/i3ipc-glib.rpm

[ERROR   ] retcode: 1
[ERROR   ] Error occurred installing package(s). Additional info follows:

errors:
    - Running scope as unit: run-r2ff5a6a56ad5410b924b83f4fbfb754c.scope
      Using sys-vpn as UpdateVM to download updates for Dom0; this may take some time...
      _[0;31m0 files removed
      Copr repo for xfce4-i3 owned by fepitre         6.3 kB/s | 3.5 kB     00:00
      Fedora 37 - x86_64                              2.3 MB/s |  82 MB     00:35
      Fedora 37 - x86_64 - Updates                    1.8 MB/s |  41 MB     00:22
      Qubes Host Repository (updates)                 480 kB/s | 2.5 MB     00:05
      Can not load RPM file: /var/cache/salt/minion/files/user/files/i3ipc-glib.rpm.
      Could not open: /var/cache/salt/minion/files/user/files/i3ipc-glib.rpm
local:
----------
          ID: test_dom0--install-local-package
    Function: pkg.installed
      Result: False
     Comment: Error occurred installing package(s). Additional info follows:

              errors:
                  - Running scope as unit: run-r2ff5a6a56ad5410b924b83f4fbfb754c.scope
                    Using sys-vpn as UpdateVM to download updates for Dom0; this may take some time...
                    _[0;31m0 files removed
                    Copr repo for xfce4-i3 owned by fepitre         6.3 kB/s | 3.5 kB     00:00
                    Fedora 37 - x86_64                              2.3 MB/s |  82 MB     00:35
                    Fedora 37 - x86_64 - Updates                    1.8 MB/s |  41 MB     00:22
                    Qubes Host Repository (updates)                 480 kB/s | 2.5 MB     00:05
                    Can not load RPM file: /var/cache/salt/minion/files/user/files/i3ipc-glib.rpm.
                    Could not open: /var/cache/salt/minion/files/user/files/i3ipc-glib.rpm
     Started: 20:32:23.573327
    Duration: 196701.886 ms
     Changes:

Summary for local
------------
Succeeded: 0
Failed:    1
------------
Total states run:     1
Total run time: 196.702 s
DOM0 configuration failed, not continuing

qubes-dom0-update seems to search for ./i3ipc-glib.rpm in the update vm (in my case sys-vpn).

Questions:

  • How can I install a local rpm package file in dom0 while automatically installing its dependencies as well?

I’m not sure how to do this automatically, but it seems to me that you just need to install the failed deps and then install the rpm. I.e.:
sudo qubes-dom0-update gio gobject json-glib && rpm -i ./i3ipc-glib.rpm

I have found a hack to make the local rpm package file install work in dom0.

If the rpm file is located at the same file path in both dom0 and the updatevm, qubes-dom0-update will install the rpm file. It will also resolve correctly the dependencies.