Occasionally I need to search for packages in dom0. To do this, I currently use qubes-dom0-update --action=search multiple times with different keywords. The first search takes around 30 seconds, while subsequent ones take about 10 seconds. This makes the process quite time-consuming.
I’m looking for a more efficient way to search for packages. I’ve considered using dnf in dom0, using dnf in a domU and searching on a web interface, but these options are not feasible for various reasons:
dnf in dom0 only shows installed packages, not available ones.
dnf in a domU uses a different Fedora version and likely wouldn’t have dom0-specific packages anyway.
There’s no known web interface for Qubes OS package repositories.
Are there any alternative approaches or ways to speed up the search process?
You havent said what sort of packages you are looking for.
In general you should be wary of installing extra packages in to dom0.
If you feel you must, you can easily use a standard template and search
there with the Software tool, or use packages.fedoraproject.org to
identify package names.
I never presume to speak for the Qubes team.
When I comment in the Forum I speak for myself.
I hoped I could avoid that. qubes-dom0-update --action=search works without any Fedora 37 domU.
Is the location of the dom0 repos documented somewhere?
I think this is what qubes-dom0-update is doing but with the “update VM” instead of a disposable. I was hoping I could issue dnf searches in the default template VM after qubes-dom0-update patched the repos but it either reverts them back or puts the custom repos in a different location. In any case, I do not understand this mechanism deeply enough to be able to reuse the package cache that was downloaded by qubes-dom0-update .
Yes, searching directly in a template takes less than 1 sec.
I generally prioritize installing packages in domU environments, as recommended. However, there are specific instances where dom0 installations are necessary.
These options don’t search in the version of Fedora that dom0 uses and they don’t include qubes-specific packages either.
It should be possible. Open a root terminal in your update vm, default is sys-firewall. Then run bash /usr/lib/qubes/qubes-download-dom0-updates.sh --action=search emacs
It will download the cach every time. But you could alter the qubes-download-dom0-updates.sh with options to use the old cache == -C. I think, the script also delete old caches, so delete this part.
The dom0 repos on my system are in /etc/yum.repos.d/qubes-dom0.repo
With my script I got down from 9s to 4s per search.
time bash /usr/lib/qubes/qubes-download-dom0-updates.sh --action=search qubes
real 0m9.244s
time bash /usr/lib/qubes/qubes-download-dom0-updatess.sh --action=search qubes
real 0m3.915s
#!/bin/bash
DOM0_UPDATES_DIR=/var/lib/qubes/dom0-updates
CLEAN=0
CHECK_ONLY=0
OPTS=(--installroot "$DOM0_UPDATES_DIR")
if [ -f "$DOM0_UPDATES_DIR/etc/dnf/dnf.conf" ]; then
OPTS+=("--config=$DOM0_UPDATES_DIR/etc/dnf/dnf.conf")
elif [ -f "$DOM0_UPDATES_DIR/etc/yum.conf" ]; then
OPTS+=("--config=$DOM0_UPDATES_DIR/etc/yum.conf")
fi
# DNF uses /etc/yum.repos.d, even when --installroot is specified
OPTS+=("--setopt=reposdir=$DOM0_UPDATES_DIR/etc/yum.repos.d")
CLEAN_OPTS=("${OPTS[@]}")
# DNF verifies signatures implicitly, but yumdownloader does not.
PKGLIST=()
YUM_ACTION=
export LC_ALL=C
while [ -n "$1" ]; do
case "$1" in
--action=*)
YUM_ACTION=${1#--action=}
;;
*)
PKGLIST+=( "${1}" )
;;
esac
shift
done
if type dnf >/dev/null 2>&1; then
YUM=(dnf --releasever=37 --setopt=metadata_expire=-1 -C)
fi
# now, we will download something
YUM_COMMAND=(fakeroot "${YUM[@]}" "$YUM_ACTION" )
# check for --downloadonly option - if not supported (Debian), fallback to
# yumdownloader
if ! "${YUM[@]}" --help | grep -q downloadonly; then
# setup environment for yumdownloader to be happy
if [ ! -e "$DOM0_UPDATES_DIR/etc/yum.conf" ]; then
ln -nsf dnf/dnf.conf "$DOM0_UPDATES_DIR/etc/yum.conf"
fi
if [ "$YUM_ACTION" == "list" ] || [ "$YUM_ACTION" == "search" ]; then
# those actions do not download any package, so lack of --downloadonly is irrelevant
YUM_COMMAND=("${YUM[@]}" -- "$YUM_ACTION")
fi
fi
set -e
"${YUM_COMMAND[@]}" "${OPTS[@]}" "${PKGLIST[@]}"
I found that this was not necessary, because it did not try to refresh the cache if it was recent enough. Running dnf with vs. without this flag resulted in no difference in the execution time on my system.
I found that I only needed a single command from the entire script:
This takes less than 2 seconds to run and can easly be turned into a script or alias. It seems best to run it directly from the update VM because execution through qvm-run adds another half to one second. However, a single regular qubes-dom0-update --action=search invocation from dom0 is necessary to initialize the cache beforehand.