Resolving Network Issues During OS Installation

Updated:

The server that hosted this blog and various self-hosted services died. It was a Chatreey T8 Plus model, which turns out to be a model with many reported cases of sudden failure. It was a 4-core CPU, 16GB RAM model, but since it was time for an upgrade anyway, I decided to purchase and set up a new server. Here’s a summary of the challenges I encountered during the process.

Choosing the Server

My previous Mini PC came with RAM and storage pre-installed, but such models often have security concerns. This time, I decided to choose a model where I could purchase RAM and storage separately. Since the server would also be used for development practice and testing, I wanted a model with good performance. To minimize heat issues, I chose the GIGABYTE BRIX GB-BER7-8840 with an AMD CPU. The final configuration ended up being an 8-core, 16-thread, 64GB RAM, 1TB SSD server.

Choosing the OS

My previous server ran Ubuntu 22.04 LTS, but this time I wanted to try Rocky Linux. CentOS-based distributions are more stable and have longer support periods, making them suitable for servers. Additionally, since my work server recently upgraded to Rocky Linux and I’ve been dealing with various SELinux features, I decided on Rocky Linux 10.

Troubleshooting

When I first installed Rocky Linux 10, the server couldn’t detect either Ethernet or WLAN. This was because the network chipsets installed on the server—Realtek RTL8125 and MediaTek MT7921K—were incompatible with the default firmware. When networking doesn’t work, installing new firmware becomes quite tricky. Fortunately, the network worked when booted from the OS installation USB. In such cases, you can boot from the installation USB, connect to the network, and download the necessary firmware.

Rescue Mode

Normally, solving such problems requires booting into a shell from the installation USB, but Rocky Linux includes a rescue mode. To enter it, select Troubleshoot » Rescue mode from the installation USB boot screen. This gives you a shell that can access the installed server OS (while currently using the OS from the installation USB).

Connecting to the Network

First, check if network devices are recognized:

nmcli device status

> lo              loopback  connected (externally)  lo
> enp2s0          ethernet  disconnected            --
> wlp1s0          wifi      disconnected            --

As shown, both Ethernet and WiFi devices are detected. On the actual server, these devices were in an “unmanaged” state rather than “disconnected,” but on the installation USB, the firmware is compatible, so they show as “disconnected.”

For convenience, let’s connect to WiFi first:

nmcli device wifi list

> IN-USE  BSSID              SSID          MODE   CHAN  RATE        SIGNAL  BARS  SECURITY
> *       AA:BB:CC:DD:EE:FF  MyWiFi_5G     Infra  149   270 Mbit/s  98      ▂▄▆█  WPA1 WPA2

Find your home network’s SSID from the list and connect with the password:

nmcli device wifi connect "MyWiFi_5G" password "your_password" ifname wlp1s0
nmcli connection show --active
> NAME             UUID                                  TYPE      DEVICE
> MyWiFi_5G        aaaabbbb-cccc-dddd-eeee-ffffffffffff  wifi      wlp1s0
> lo               11111111-2222-3333-4444-555555555555  loopback  lo
> enp2s0           66666666-7777-8888-9999-aaaaaaaaaaaa  ethernet  --

Updating Firmware on the Installed OS

Now let’s update the firmware on the server OS. First, access the installed OS using chroot. In rescue mode, the installed OS is automatically mounted at /mnt/sysroot:

chroot /mnt/sysroot /bin/bash

From now on, any packages installed will be installed on the actual OS. First, add the ELRepo (not EPEL) repository:

dnf install -y https://www.elrepo.org/elrepo-release-10.0-6.el10.elrepo.noarch.rpm

Now check the detailed model names of each chipset and install the necessary firmware:

lspci | grep -i -E 'ethernet|network'
> 01:00.0 Network controller: MEDIATEK Corp. MT7921K (RZ608) Wi-Fi 6E 80MHz
> 02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 05)

My server has the Realtek RTL8125 and MediaTek MT7921K models installed. For more detailed driver information, use the lshw command:

sudo lshw -C network
>  *-network
>       description: Ethernet interface
>       product: MT7921K (RZ608) Wi-Fi 6E 80MHz
>       vendor: MEDIATEK Corp.
>       ...
>       configuration: broadcast=yes driver=mt7921e ...
>       ...
>  *-network
>       description: Ethernet interface
>       product: RTL8125 2.5GbE Controller
>       vendor: Realtek Semiconductor Co., Ltd.
>       ....
>       configuration: autonegotiation=on broadcast=yes driver=r8125 ...
>       ...

From this, we can see that RTL8125 uses the r8125 driver and MT7921K uses the mt7921e driver.

The simplest way to get RTL8125 working is to install it as follows:

sudo dnf --enablerepo=elrepo install -y kmod-r8125

Then configure the network to auto-connect so it will recognize and connect via Ethernet cable:

sudo nmcli connection modify enp2s0 ipv4.method auto
sudo nmcli connection modify enp2s0 connection.autoconnect yes

Next, install the mt7921e driver. This process is more complex and requires cloning the linux-firmware repository:

git clone https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
cd linux-firmware/mediatek

From this location, copy the following files identified from the MediaTek firmware list:

WIFI_MT7961_patch_mcu_1a_2_hdr.bin
WIFI_RAM_CODE_MT7961_1a.bin
BT_RAM_CODE_MT7961_1a_2_hdr.bin

The /lib/firmware/mediatek location stores firmware only in bin.xz format. Therefore, you need to compress the data before copying:

xz -f -C crc32 *.bin

Now copy the firmware and finalize the installation:

sudo cp *.bin.xz /lib/firmware/mediatek/
dracut -f  # Update kernel
exit  # Exit chroot
reboot

The network should now be functional. In the following posts, I’ll cover additional issues that needed to be resolved.