飞牛编译安装USB无线网卡RTL8822BU驱动

艺帆风顺 发布于 2025-04-04 22 次阅读


一、先用lsusb查看usb设备:

#lsusbBus 003 Device 003: ID 0bda:b82c Realtek Semiconductor Corp. 802.11ac NIC

二、根据usb id “0bda:b82c”搜索

https://linux-hardware.org/?id=usb:0bda-b82c

三、搜索Ubuntu(Debian) 8822BU 驱动安装

[Linux]Ubuntu22.04下8822BU、8812BU无线网卡驱动安装教程 - 知乎

https://zhuanlan.zhihu.com/p/636513768

参考来源:https://github.com/morrownr/88x2bu-20210702

四、下载驱动源码

sudo apt update && sudo apt upgradesudo apt install -y linux-headers-$(uname -r) build-essential bc dkms git libelf-dev rfkill iwgit clone https://github.com/morrownr/88x2bu-20210702cd 88x2bu-20210702sudo ./install-driver.shSign command: /lib/modules/6.6.38-trim/build/scripts/sign-fileBinary /lib/modules/6.6.38-trim/build/scripts/sign-file not found, modules won't be signedError! Your kernel headers for kernel 6.6.38-trim cannot be found at /lib/modules/6.6.38-trim/build or /lib/modules/6.6.38-trim/source.Please install the linux-headers-6.6.38-trim package or use the --kernelsourcedir option to tell DKMS where it's located.An error occurred. dkms build error:  1Please report this error.Please copy all screen output and paste it into the problem report.Run the following before reattempting installation.sudo ./remove-driver.sh

五、解决/lib/modules/6.6.38-trim/build软链接错误

这个问题可能不一定会遇到,根据飞牛论坛 螃蟹8852be 驱动安装成功 - 硬件讨论 飞牛私有云论坛 fnOS

https://club.fnnas.com/forum.php?mod=viewthread&tid=7266

提到重新安装系统可以解决。但重装系统有成本,这里列出另外一种方案。

  • 下载kernel 6.6.38 source

    wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.6.38.tar.xztar -xf linux-6.6.38.tar.xzcd linux-6.6.38
  • 拷贝系统kernel config

cp /boot/config-$(uname -r) .configsudo apt install libncurses-devmake olddefconfig 
  • 编译kernel module

    make modules_preparemake modules -j4 (可能不是必须的,编译所有module,比较耗时,可以跳过,如果后面编译网卡驱动报错再来执行)
  • 建立软连接

    rm /lib/modules/6.6.38-trim/buildsudo ln -s  ~/linux-6.6.38 /lib/modules/6.6.38-trim/build

编译驱动

cd 88x2bu-20210702sudo ./install-driver.sh---------------------------: install-driver.sh v20241003: x86_64 (kernel architecture): x86_64 (architecture to send to gcc)4/4 (in-use/total processing units)8016856 (total system memory)6.6.38-trim (kernel version): gcc (version of gcc used to compile the kernel): gcc (Debian 12.2.0-14) 12.2.0: dkms-3.0.10SecureBoot disabled---------------------------Checking for previously installed drivers...Removing a driver that was added to dkms.Deleting module rtl88x2bu-5.13.1 completely from the DKMS tree.Removing 88x2bu.conf from /etc/modprobe.dRemoving source files from /usr/src/rtl88x2bu-5.13.1Finished checking for and uninstalling previously installed drivers.---------------------------Starting installation.Copying 88x2bu.conf to /etc/modprobe.dThe dkms installation routines are in use.Copying source files to /usr/src/rtl88x2bu-5.13.1Creating symlink /var/lib/dkms/rtl88x2bu/5.13.1/source -> /usr/src/rtl88x2bu-5.13.1The driver was added to dkms successfully.---------------------------Sign command: /lib/modules/6.6.38-trim/build/scripts/sign-fileSigning key: /var/lib/dkms/mok.keyPublic certificate (MOK): /var/lib/dkms/mok.pubBuilding module:Cleaning build area...kernelver=6.6.38-trim ./dkms-make.sh.................Signing module /var/lib/dkms/rtl88x2bu/5.13.1/build/88x2bu.koCleaning build area...The driver was built by dkms successfully.---------------------------88x2bu.ko:Running module version sanity check. Original module   No original module exists within this kernel Installation   Installing to /lib/modules/6.6.38-trim/updates/dkms/depmod...The driver was installed by dkms successfully.---------------------------Info: Update this driver with the following commands as needed:git pullsudo sh install-driver.shNote: Updates to this driver SHOULD be performed before distro      upgrades such as Ubuntu 23.10 to 24.04.Note: Updates to this driver SHOULD be performed before major      upgrades such as kernel 6.5 to 6.6.Note: Updates can be performed as often as you like. It is      recommended to update at least every 3 months.Note: Work on this driver, like the Linux kernel, is continuous.Enjoy!Unable to run $ rfkill unblock wlanDo you want to edit the driver options file now? (recommended) [Y/n] nDo you want to apply the new options by rebooting now? (recommended) [Y/n] y

参考文章:

https://zhuanlan.zhihu.com/p/636513768

[Linux]Ubuntu22.04下8822BU、8812BU无线网卡驱动安装教程 - 知乎

https://github.com/morrownr/88x2bu-20210702

morrownr/88x2bu-20210702: Linux Driver for USB WiFi Adapters that are based on the RTL8812BU and RTL8822BU

https://club.fnnas.com/forum.php?mod=viewthread&tid=7266

螃蟹8852be 驱动安装成功 - 硬件讨论 飞牛私有云论坛 fnOS

https://1023.org.cn/p/aa899d5fb8

飞牛系统FNOS添加NTFS3模块并挂载NTFS分区 | 遇见时光-1023.org.cn