You're installing a new Linux kernel or drivers or some other package
that needs to update your
initramfs,
and you see a message like this:
update-initramfs: Generating /boot/initrd.img-5.4.0-53-generic
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8125a-3.fw for module r8169
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168fp-3.fw for module r8169
What does this mean?
TL;DR — mkinitramfs
copies kernel modules into the initramfs, and also tries to copy all
referenced firmware files, so that the module can load them at startup
if required. In this case, the r8169 module was copied, but it refers to
two firmware files that were not found on the system.
Is this a problem? It depends on the module, firmware, and device. Some
devices won't work at all without a certain firmware, which is the case
for many Intel and Broadcom wifi adapters. But other firmware files may
just be updates, and the device will work without them, unless you
happen to be affected by some bug that the firmware update fixes.
You can install the missing firmware and rebuild the initramfs, or you
can ignore the warning. In any case, the new initramfs will be used only
when you restart the machine.
What's an initramfs?
The
initramfs
is a compressed archive of a minimal root filesystem. The
kernel starts up, decompresses this archive into a RAM disk, mounts it
as the initial root filesystem, and executes /sbin/init, which does
whatever is needed to find and mount the real root filesystem and
execute init. (The idea is to move complex startup actions into
userspace.)
The initramfs must therefore contain everything that is needed to mount
the real root filesystem, including userspace code and kernel modules
or firmware needed to operate the relevant devices (which may be a local
disk, or a block device accessed over the network).
When you install a package that contains anything that might belong in
the initramfs, hook scripts run
update-initramfs,
which runs
mkinitramfs,
which builds the initramfs according to
/etc/initramfs.conf,
which defines exactly which modules and binaries should be included.
What's firmware?
The
Debian installation guide
explains:
Besides the availability of a device driver, some hardware also requires so-called firmware or microcode to be loaded into the device before it can become operational. This is most common for network interface cards (especially wireless NICs), but for example some USB devices and even some hard disk controllers also require firmware. With many graphics cards, basic functionality is available without additional firmware, but the use of advanced features requires an appropriate firmware file to be installed in the system.
The Ubuntu wiki explains in some detail
how the kernel loads firmware.
The Debian “non-free” package repository contains various firmware-*
packages:
$ apt-cache search -n \^firmware-
firmware-linux - Binary firmware for various drivers in the Linux kernel (metapackage)
firmware-linux-free - Binary firmware for various drivers in the Linux kernel
firmware-linux-nonfree - Binary firmware for various drivers in the Linux kernel (meta-package)
firmware-brcm80211 - Binary firmware for Broadcom/Cypress 802.11 wireless cards
firmware-realtek - Binary firmware for Realtek wired/wifi/BT adapters
…
You can download a tarball of all available non-free firmware packages
from the
Debian web site
if you need to
provide additional firmware to the Debian installer.
(Here's how to
copy the firmware to a USB stick.)
(In this case, the firmware-realtek package did not contain the missing
files mentioned in the warning, but fortunately, the RTL8168 adapter
worked fine without them.)
What do I do now?
If you see the warning while installing a package on a working system,
don't panic. If the device already works without the missing firmware,
you can hope it will keep working after a reboot.
If you saw the warning, ignored it, rebooted, and now something doesn't
work, try booting into an older kernel. If that doesn't help, you may
have to dig up a USB stick to copy files or boot into a rescue system.
You can always try to find and install the missing firmware and rebuild
the initramfs by running "update-initramfs -u".
Why exactly do I get this warning?
From /usr/share/initramfs-tools/hook-functions on my Debian system (with
minor editorial changes for clarity):
# Add dependent modules + eventual firmware
manual_add_modules()
{
# …
{ modprobe --all --set-version="${version?}" \
--ignore-install --quiet --show-depends "$@";
modprobe --all --set-version="${version}" \
--quiet --show-depends "$@"; } |
while read -r prefix kmod options ; do
# …
copy_file module "${kmod}" || continue
# Add required firmware
for firmware in \
$(modinfo -k "${version}" -F firmware "${kmod}");
do
# …
# Only print warning for missing fw of loaded
# module or forced loaded module
F="/lib/firmware"
if [ ! -e "${F}/${firmware}" ] \
&& [ ! -e "${F}/${version}/${firmware}" ] ; then
# …
kmod_modname="${kmod##*/}"
kmod_modname="${kmod_modname%%.*}"
if grep -q "^$kmod_modname\\>" /proc/modules "${CONFDIR}/modules"; then
echo "W: Possible missing firmware /lib/firmware/${firmware} for module ${kmod_modname}" >&2
fi
continue
fi
So what happens is that mkinitramfs decides to install r8169.ko into the
initramfs (for example, because initramfs.conf sets MODULES=most), and
that results in a call to "manual_add_modules" for r8169. We use
modprobe to translate that into a list of .ko files to copy:
# modprobe --show-depends --ignore-install r8169
insmod /lib/modules/…/drivers/net/phy/libphy.ko
insmod /lib/modules/…/drivers/net/ethernet/realtek/r8169.ko
Next, we loop over this list and copy each .ko file into the initramfs.
Then we loop over the list of firmware files referenced by this module:
# modinfo -F firmware /lib/modules/…/realtek/r8169.ko
rtl_nic/rtl8125a-3.fw
…
rtl_nic/rtl8168d-1.fw
If /proc/modules shows that the module is currently in use on the
system, but the firmware file does not exist in /lib/firmware, you get
the warning. You won't be warned about missing firmware for any modules
that are not currently loaded while building the initramfs.