How to avoid installing firmware when updating kernel?

My hardware doesn’t need firmware to boot and work. Firmware is mostly not needed when running fedora virtual machines. So, how can I avoid installing linux-firmware package?

1 Like

the linux-firmware package is required by the kernel-core package, because lots of hardware that is supported by the kernel does require firmware, so it’s just a sane default.

I think you should be able to:

  • remove all the linux-firmware packages: sudo dnf remove linux-firmware\*
  • exclude linux-firmware packages from from future transactions using the excludepkgs option in the dnf configuration file (/etc/dnf/dnf.conf)
3 Likes

The problem is, the kernel-core is held back from updates after adding linux-firmware to dnf conf.

2 Likes

That would be because the kernel depends on the linux-firmware package to support all the available hardware. The size of the package should not be large enough that you need to prevent updates of it. You obviously have a choice of allowing that package to update, or not allowing the kernel to update. It seems an either - or situation – update both or update neither.

I had a look at the kernel spec file, and it seems that linux-firmware is a weak dependency:

https://src.fedoraproject.org/rpms/kernel/blob/rawhide/f/kernel.spec#_888

By default, weak dependencies are also installed in dnf transactions (they’re just treated like Requires). However, this behaviour can be changed by passing the --setopt=install_weak_deps=False option to dnf

So, @arun54321 : try removing the linux-firmware package, and then running the update with this option and see how that goes?

You can permanently disable the installation of weak dependencies by adding install_weak_deps=False to your /etc/dnf/dnf.conf file. More information in man dnf.conf, and here:

1 Like

Thanks. But I have already tried using install_weak_deps=False . It didn’t work. I think I could make a dummy linux-firmware package and fix this.

1 Like

I don’t really understand the reason for getting rid of the package. On one hand, you gain a few mb of space, nothing more. On the other hand, you get rid of a package that is anticipated by the os: I would much more expect unintended behavior from the system when you disable/remove weak dependencies than from keeping that package.

If you want to have an os without blobs for your purpose, you should focus on getting a linux-libre kernel distribution or one that by default removes blobs before compilation. Fedora is not intended for that, and any approach to achieve such a goal on Fedora, is untested (thus, less stable & less secure) and based upon less trustworthy sources (no guarantee for quality, content and maintenance). Keep in mind that linux-firmware is a widely and deeply tested package (deployed and tested not just on Fedora), whereas many linux-libre distributions are niche products, far away from being as well tested as Fedora and its packages.

I know I miss to address your question. But may I ask what exactly you want to achieve?

1 Like

Hrm, maybe the versions of the kernel package we’re currently using haven’t used weak deps. rpm -qa --recommends kernel\* doesn’t return anything on my system.

2 Likes

I came here for solutions or atleast for the workarounds. Not to answer your questions. What I was trying to achieve is in title of topic itself. Do I need to rephrase my question?

If removing firmware is not possible on fedora, that’s fine. I’m not asking why fedora doesn’t support doing it or I’m not going rant and cry about it.

I don’t want to waste 100-200mb of my ssd space for something which just sits there ideally and unnecessary for my hardware. I use fedora mostly on a VM and having a firmware has zero use on my installation. I am still using it without the firmware and I don’t lose anything.

1 Like

My question was not meant offensive. My goal was only to identify the problem you want to solve in order to provide alternative (maybe less unintended) solutions for that problem. And also to ensure that you are aware of potential implications of your solution to avoid that something happens you did not expect. The trade-offs are of course up to you. Obviously, if the goal is releasing space, there is nothing to add to what Ankur and Jeff already mentioned.

1 Like

@arun54321 : it’s perfectly fine for others to ask related queries. We’re not a support forum where we only provide solutions—we also have (and encourage) related chat because we’re a community, and folks having open, free flowing discussions, helps us get to know each other better and build the community. :slight_smile:

Of course, we’re all free to not answer questions here, but whatever we do, we must continue to remain excellent to each other. So please everyone, before posting, re-read the CoC and think whether your post is being excellent to others on the forum or not. If it is not, you probably shouldn’t post it.

1 Like

3 posts were split to a new topic: How can we list firmware that’s in use?

Not sure if it will work, but you could try to use dnf version lock plugin.

# Install dnf version lock plugin
sudo dnf install 'dnf-command(versionlock)'

# Locking version of certain package
sudo dnf sudo dnf versionlock add PACKAGE_NAME

The other thing, you could try to use -x PACKAGE_NAME during the upgrade.

sudo dnf upgrade -x PACKAGE_NAME -x SECOND_PACKAGE_NAME -x THIRD_PACKAGE_NAME

To avoid typing too long, you could make above command as bash script for and use it each time you want to upgrade.

Using dnf version-lock does not prevent installing a package it simply locks the version of that package so it does not update. I think the OP was trying to remove a possibly unnecessary package in the interest of reducing used space on his drive

4 Likes

linux-firmware has only been made a weak dependency in 5.17 and that’s not released yet (at least I only see 5.16 here). @arun54321 once that is out, you should be able to avoid it.

3 Likes

It is my understanding that 5.17 will be the kernel with Fedora 36 as it is currently at 5.17.0 rc5 in the fedora 36 branch.

2 Likes