Ubuntu安装网卡驱动
给自己装了双系统后,发现没有无线网络。
没有无线网
给自己装了双系统后,发现没有无线网络
下载驱动文件
打开终端,输入
lspci -k
能看到,虽然我是RTL8125BG,但use的是r8169:
08:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 05)
DeviceName: Realtek RTL8125BG LAN
Subsystem: ASUSTeK Computer Inc. RTL8125 2.5GbE Controller
Kernel driver in use: r8169
Kernel modules: r8169
我们可以从官网下载驱动文件: https://www.realtek.com/Download/List?cate_id=584
根据我们的网卡,我下载2.5G那个。
编译安装
接下来我们安装编译环境
sudo apt update
sudo apt -f install
sudo apt install -y --reinstall linux-headers-$(uname -r) linux-headers-generic build-essential dkms
然后解压刚才下载的文件:
tsudo tar -xvf r8125-9.013.02.tar.bz2 -C /usr/src/
然后添加配置文件:
cd /usr/src/r8125-9.013.02
sudo nano ./dkms.conf
文件内容如下,对应的版本号即可:
PACKAGE_NAME=“r8125”
PACKAGE_VERSION=“9.013.02”
BUILT_MODULE_NAME[0]=“$PACKAGE_NAME”
DEST_MODULE_LOCATION[0]=“/updates/dkms”
AUTOINSTALL=“YES”
REMAKE_INITRD=“YES”
CLEAN=“rm src/@PKGNAME@.ko src/*.o || true”
然后编译:
sudo bash ./autorun.sh
出现 arch/x86/Makefile:142: CONFIG_X86_X32 enabled but no binutils support ,安装一下binutils:
wget http://ftp.gnu.org/gnu/binutils/binutils-2.32.tar.gz
tar -xzvf binutils-2.32.tar.gz
cd binutils-2.32
./configure
sudo make -j8
sudo make install
ld --version
as --version
然后针对这个报错:
At main.c:167:
- SSL error:02001002:system library:fopen:No such file or directory: …/crypto/bio/bss_file.c:69
- SSL error:2006D080:BIO routines:BIO_new_file:no such file: …/crypto/bio/bss_file.c:76
sign-file: certs/signing_key.pem: No such file or directory
Warning: modules_install: missing ‘System.map’ file. Skipping depmod.
DEPMOD 5.15.0-67-generic
解决办法输入如下:
cd /lib/modules/$(uname -r)/build/certs
sudo tee x509.genkey > /dev/null << ‘EOF’
[ req ]
default_bits = 4096
distinguished_name = req_distinguished_name
prompt = no
string_mask = utf8only
x509_extensions = myexts
[ req_distinguished_name ]
CN = Modules
[ myexts ]
basicConstraints=critical,CA:FALSE
keyUsage=digitalSignature
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid
EOF
sudo openssl req -new -nodes -utf8 -sha512 -days 36500 -batch -x509 -config x509.genkey -outform DER -out signing_key.x509 -keyout signing_key.pem
重新编译
出现System.map的问题:
ls -l /boot/System.map*
然后把出现的所有System.map_xxxxx软链接到/lib/modules/xxxx/build/System.map,如:
sudo ln -s /boot/System.map-5.15.0-124-generic /lib/modules/5.15.0-124-generic/build/System.map
sudo ln -s /boot/System.map-5.15.0-119-generic /lib/modules/5.15.0-119-generic/build/System.map
sudo ln -s /boot/System.map-5.15.0-121-generic /lib/modules/5.15.0-121-generic/build/System.map
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)