Retain/copy/backup/transfer a toolbox?

Hi there good folks,

I’ve been using Silverblue as my main driver for about two months now, lovin’ it.

I’ve also used Toolbox to setup some apps and packages that I couldn’t/didn’t want to with rpm-ostree. But I read somewhere that if I do an upgrade of my system I will lose the Toolbox container.

Is there a way to somehow retain/copy/transfer/backup my current toolbox? I read Toolbox’s documentation, but it has nothing on this.

Thanks,

  • A

The toolbox container should persist through upgrades; if that doesn’t happen it is a bug that needs to be investigated.

You may find yourself wanting to upgrade your toolbox container from F36 to F37 when the new Fedora release happens, in which case the state of your F36 toolbox container cannot be migrated automatically. (Hmm…maybe you could do something like dnf --releasever=37 upgrade, but that seems hacky)

I worked on a script to do some of the migration of toolbox containers between major Fedora releases, but there is still a lot of use cases that weren’t considered - GitHub - miabbott/toolbox-migrate: Simple script to migrate settings from one toolbox container to another

Ultimately, I followed @jlebon and made my own pet container that gets automatically updated via GitHub actions. See the original source material here - GitHub - jlebon/pet: Pet container for hacking on CoreOS

I use toolbox for development and have a script that I update when I change the packages I care about inside my development container, so rebuilding is painless. I do dnf upgrade inside the container from time to time, but I rebuild it from scratch every few weeks.

Also, I periodically bump the Fedora version when there’s a new version available and just run the script again (and wait a few minutes). build-devtoolbox · master · Garrett LeSage / silverblue · GitLab — a coworker has a similar script @ piware.de Git - bin.git/blob - build-cockpit-toolbox (we shared parts of our scripts with each other).

(…However, I forgot to push my recent modifications. Whoops! :smile: I’ll have to do that when I’m back in working mode. But it hasn’t changed much, really, aside from the version bump.)

My script is quite a bit more complex than what you’re looking; most of it can be ripped out for a much simpler script.

Another colleague of mine builds her developer container in a different way (I should probably migrate to something like this):

You can go wild and have all sorts of scripts to build various toolbox containers too (more than just Fedora):

If you want to get a list of packages you currently have manually installed within a toolbox, run:

dnf repoquery --userinstalled --qf "%{name}"

It errors on the side of showing a few too many, so you might want to remove a few packages you don’t recognize or ones you know you didn’t install manually.


You can use the command like this:

  1. In your old container:

    dnf repoquery --userinstalled --qf "%{name}" > packages.txt
    
  2. Edit packages.txt
    (This step is optional; if you don’t edit it, it’ll still include packages that were installed and might be installed by default… you’ll wind up with a very similar package set to your old container.)

  3. In your new container:

    sudo dnf install $(cat packages.txt)
    

This method will let you skip using scripts and effectively build a new container with the same packages with just 2 commands (one in each container).