Use dnf install <package> on Fedora Workstation Live without repo metadata cache download

Hi all !

I am using Fedora Workstation Live and would need to download packages after boot, since at each reboot the OS is brand new.

is it possible to download the chosen package(s) without having to wait for the (lengthy) process of Fedora downloading cache metadata of several repositories ?

$ sudo dnf install openfortivpn
Fedora 39 - x86_64                                                                        2.5 MB/s |  89 MB     00:35    
Fedora 39 openh264 (From Cisco) - x86_64                               1.2 kB/s | 2.6 kB     00:02    
Fedora 39 - x86_64 - Updates                                                      866 kB/s |  34 MB     00:40    
Last metadata expiration check: 0:00:01 ago on Sun 24 Mar 2024 04:41:33 PM CET.

Setting metadata_expire=90d (or never) in /etc/yum.repos.d/ has no effect…

There is -C option but I am not sure if it will work on Live media:

Run entirely from system cache, don't update the cache and use it even in case it is expired.
1 Like

Alas -C, --cacheonly #Run entirely from system cache, don't update the cache and use it even in case it is expired. is for non-root users only as mentioned in man dnf: For non-root use, see also the --cacheonly switch

And I did not find a way to install packages without sudo root access…

This also applies to sudo dnf. My dnf cache has expired and when I try sudo dnf install -C it doesn’t update the cache. But if I do sudo dnf install without the -C option, it tries to update the cache first. But I am not sure if Live ISO has to update the cache on the first run regardless of the -C option.

If you know exactly what packages you need beforehand, you might be able to use something like wget or curl (or koji) to fetch the rpms that you need and then use rpm -ivh <list-of-rpms> (or rpm -Uvh <list-of-rpms>) to install (or update) those packages.

2 Likes

I’ve tried on Fedora Workstation Live sudo dnf install -C but on a first run after a fresh boot, it seems it still needs to populate for the first time the repo metadata cache.

The live system does not have any cache data yet, and without that data, it doesn’t know which packages and which versions are available and from where to fetch them.

2 Likes

Thanks @glb

I’ll try your workaround, if I understand it correctly I should bypass queries to repos. I might need some help though:

  1. I can list the packages I’d like to install, should I include dependencies ?
    Won’t the “call” for dependencies query the repos and bring me to square one ?

  2. The commands I use in sudo dnf install <package-name> are provided without architecture nor version like sudo dnf install openfortivpnbut in Fedora Package source
    For exemple openfortivpn is detailed therein as openfortivpn-1.21.0-2.fc39
    The link you provided assumes “copy list of builds from sidebar of bodhi update page”, which I do not quite understand…

I must say i’m a bit lost among the purposes and use cases of Pagure, Koji, Bodhi…

  1. Do I need to convert my “generic” package names into architecture/version specific ones ?

If it is a large list of packages that you need to install, it might not be practical to download all of them each time. Can you use dnf download --resolve <packages> once and save all the rpms on something like a thumb drive (or maybe a local file server) so that you can reference them all at once (with a path and a wildcard) without having to enter the full URL to the upstream copies?

Beyond that, it sounds like you might want to look into creating your own LiveCD: Creating and using a live installation image :: Fedora Docs

1 Like

You have to take care of the dependencies yourself. The dependencies are checked by the rpm command, but only dnf can automatically resolve them.

1 Like

Thanks @vekruse : I might achieve your advice with @glb last post, don’t I ?:

That was my go to choice a couple of years ago. But the underlying tools include livecd-tools which have issues with Fedora Live ISO refactoring. I filed an issue I submitted on the matter since Fedora 35+

A pull request has been made and merged by the maintainers :+1: but the latest release is still before that merge and the working release hasn’t made it’s way into a Fedora release. Maybe Fedora 40 or 41 ! :rocket:

1 Like

Admittedly, I haven’t tried to use livecd-tools recently. However, I did succeed in building a live image using the anaconda build tools not more than a month ago. It’s a more complicated way of generating a live image, but it might be an option if you want to go that route.

I have encountered these same problems with livecd-tools over several versions of Fedora, enough so that I’ve given up on using the method using it for creating a Live ISO with some permanent disk space usb drive.

My motive was to have a Secure Boot-aware Live OS suitable for creating disk backups using ddrescue without reinstalling it every boot. I’m resigned to do the reinstall every boot.

My option was to install the OS to a usb device then I could boot from that device and it was able to be updated or have apps installed to be available for later use or reuse. The install ISO is not alterable (iso9660 filesystem) so you would need to use some other form of persistence to install apps and make them applicable for each boot without a reinstall.

2 Likes