Searching for packages with ‘rpm-ostree search’

Photo by Markus Winkler on Unsplash

This article descibes how to find an application to add to your ostree based system (such as Silverblue and Kinoite) using rpm-ostree.

One of the main benefits of the Fedora ostree-based systems is the immutability of the system. Not only is the image read-only, it’s also pre-built on the Fedora servers. Thus, updating a running system downloads the update deltas (that is, only the differences) and patches the system. This makes the many installations identical by default.

A pre-built image will be good enough for most people, since users are normally encouraged to use both flatpaks for applications and toolbox for development tasks. But what if the specific application doesn’t fit this and the user requires installing applications on the host system?

Well, in this case the option is to overlay the packages on the system, creating a new image locally with the added package on top of the standard image.

But, how do I know what package I want to install? What about search functionality?

The old way (toolbox + dnf search)

While it has always been possible to search for packages via the PackageKit-enabled Software Center (such as GNOME Software or KDE Discover), it has been a bit harder to do so via CLI.

Since rpm-ostree didn’t use to offer a search command, the common way to search has been to enter a toolbox with toolbox enter and search using dnf search <search term>. This has the downside of requiring the same repositories be enabled in the toolbox in order to get proper search results.

Example for searching for neofetch:

$ toolbox enter
<Note that at this point the toolbox command might request creating a toolbox, which might involve downloading a container image>
⬢[fedora@toolbox ~]$ dnf search neofetch
<snip> 
=== Name Exactly Matched: neofetch ===
neofetch.noarch : CLI system information tool written in Bash
=== Summary Matched: neofetch ===
fastfetch.x86_64 : Like neofetch, but much faster because written in c

The new way (rpm-ostree search)

Since version 2023.6, rpm-ostree supports the “search” verb allowing users to use rpm-ostree to search for available packages. An example command for this is:

 rpm-ostree search *kernel

To use the search verb, first make certain you are using rpm-ostree version 2023.6 or later:

$ rpm-ostree --version
rpm-ostree:
 Version: '2023.8'
 Git: 9a99d0af32640b234318815a256a2d11e35fa64c
 Features:
  - rust
  - compose
  - container
  - fedora-integration

If the version requirement is satisfied, you should be able to run rpm-ostree search <search terms>.

Here is an example, searching for neofetch with rpm-ostree search:

$ rpm-ostree search neofetch

===== Name Matched =====
neofetch : CLI system information tool written in Bash

===== Summary Matched =====
fastfetch : Like neofetch, but much faster because written in c

Fedora Project community

2 Comments

  1. That are great news. This functionality was really missing in rpm-ostree.

  2. James

    That is really cool. It would be extra special nice if some functionality could be included to allow importing of repos and associated gpg keys. Right now we have to copy them manually.

Comments are Closed

The opinions expressed on this website are those of each author, not of the author's employer or of Red Hat. Fedora Magazine aspires to publish all content under a Creative Commons license but may not be able to do so in all cases. You are responsible for ensuring that you have the necessary permission to reuse any work on this site. The Fedora logo is a trademark of Red Hat, Inc. Terms and Conditions