I got internet access to work in the pre-boot initramfs by adding rd.neednet=1 ip=dhcp to the GRUB_CMDLINE_LINUX line in /etc/default/grub but this only works with ethernet. Is it possible to get WiFi working too? Right now, running nmcli radio in the pre-boot emergency shell shows that WIFI is enabled but WIFI-HW is missing (as opposed to the normal booted OS where both are enabled).
So far, I’ve tried creating /etc/dracut.conf.d/00-wifi.conf with a line that causes some extra WiFi-related kernel modules to be added to the initrmfs: add_drivers+=" iwlwifi cfg80211 rfkill iwlmvm mac80211 libarc4 "
But this not only doesn’t work, it causes WiFi to stop working in my normal booted OS as well (it fails to find the WiFi adapter).
This is on Fedora 38 Workstation (11th gen Intel CPU with an AX210 No vPro network card) - any help would be appreciated!
I believe wpasupplicant is responsible for starting wifi, along with NetworkManager.
What I do is enable wifi with the live media – before I do the install
Then the install (and initramfs) has wifi fully functional and no other configs are required.
Hmm, not really practical for me to re-install the OS just for this. But it’s good to know that it’s possible.
Could you share more details on getting wpasupplicant to run in the preboot env? I see networkmanager is already a default dracut module, but nothing about wpasupplicant.
new dracut wifi module (to be fair, its a ‘merge’ of the bluetooth and network-manager module, so there might also be some lines that are not actually needed)
the actual script of the above service, it switches to tty3 and starts nmtui for ‘interactive’ wifi/network setup (basically adapted from here)
/usr/lib/dracut/modules.d/90wifi/wifi.sh
#!/bin/bash
# set try var
try=0
# check for network
while ! ping -c 1 -4 google.de >/dev/null 2>&1; do
# drop to shell if tried for more than 3 times
if [ "$try" == "3" ]; then
echo "starting debug shell"
/bin/bash
fi
# switch to tty3
chvt 3
# print message, and wait 2sec
echo "no network, please try to set up wifi"
sleep 2
# start nmtui to set up wifi/network
/usr/bin/nmtui
# wait a moment
sleep 2
# increment try
try=$((try+1))
done
# switch back to tty1
if [ "$try" != "0" ]; then
chvt 1
fi
install nmtui (only required if you also want to use the above interactive script) dnf -y install NetworkManager-tui
building the new initrd dracut -f --xz --nomdadmconf --nolvmconf --no-hostonly /boot/initramfs.xz.img
(for me) it was neccessary to also adapt the kernel cmdline and remove the splash screen (remove quiet rhgb) to have the tty switch work correctly
hope that helps anyone who want’s to achieve something like that in the in the future