飞行的蜗牛

一个正在觉醒的无名氏修行者,略懂编程,略懂音乐。

Ubuntu WIFI hardware-disable 解决办法

::: motto 和菜头
大多数时候,人不能被举起来摔在地上,人都是被自己的重量所绊倒的。
:::

最近由于工作需要,拿出妻子在 2011 年买的那款古老的 GateWay(acer) 笔记本来使用。这台 10 年前的笔记本今天来用确实是比较卡,但是把机械硬盘换成 SSD, 加了一根内存之后发现速度也还勉强能用。

拿到机器第一件事情就是把 Window7 格式化,装了 Ubuntu20.04,系统装完之后发现无线网卡没法启用,报错是 wifi hardware disabled

排查尝试

遇到这个问题,我首先瞪大眼睛巡视了电脑一圈,没有发现有小的硬件开关,然后又在键盘的 FN 键上找了一圈,没有发现类似关闭 WIFI 的键,最后又不甘心的每个 FN 组合件都试了一下,发现依然无效。

直觉高速我,应该不是网卡硬件故障,否则应该无法识别硬件,而我使用 ifconfig -a 命令查询的时候明显能够列出那张无线网卡。

1
2
3
4
5
6
7
8
ifconfig -a 
wlp3s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 20:6a:8a:54:a4:5e txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 19

但是此时有点病急乱投医了,想进一步确定到底是硬件原因还是软件原因,于是去京东商城买了一张支持 Linux 的 USB 无线网卡,我首先在我的台式机上编译了驱动装上之后,WIFI 能够正常工作。
然后再到笔记本上装一下,发现 USB WIFI 也提示 wifi hardware disabled。此时我已经能基本肯定是系统而并非硬件问题了。

应该是系统内核禁用了 WIFI 的功能,使用 rfkill 检查一下:

1
2
3
4
5
6
7
8
9
0: acer-wireless: Wireless LAN
Soft blocked: no
Hard blocked: no
1: acer-bluetooth: Bluetooth
Soft blocked: yes
Hard blocked: no
2: phy0: Wireless LAN
Soft blocked: no
Hard blocked: yes

显然当前 Wireless 设备是被 Hard blocked 了。

解决方案

网上一顿搜索,看到有网友提醒说可能是硬件冲突了。回想一下我运行 rfkill list 的时候显示了两个无线模块: acer-wirelessphy0,所以猜测这两个模块可能有冲突。

lsmod | grep acer 发现系统启动了 acer_wmi 模块:

1
2
3
4
5
root@YSS:~# lsmod | grep acer
acer_wmi 24576 0
sparse_keymap 16384 1 acer_wmi
wmi 32768 2 acer_wmi,wmi_bmof
video 53248 2 acer_wmi,i915

于是果断禁用 acer_wmi 模块:

1
2
vim /etc/modprobe.d/blacklist.conf
# 在文件末尾增加 `blacklist acer_wmi`,保存并退出。

其实发现系统默认还禁用了很多过时或者弃用的模块,blacklist.conf 完整配置如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# This file lists those modules which we don't want to be loaded by
# alias expansion, usually so some other driver will be loaded for the
# device instead.

# evbug is a debug tool that should be loaded explicitly
blacklist evbug

# these drivers are very simple, the HID drivers are usually preferred
blacklist usbmouse
blacklist usbkbd

# replaced by e100
blacklist eepro100

# replaced by tulip
blacklist de4x5

# causes no end of confusion by creating unexpected network interfaces
blacklist eth1394

# snd_intel8x0m can interfere with snd_intel8x0, doesn't seem to support much
# hardware on its own (Ubuntu bug #2011, #6810)
blacklist snd_intel8x0m

# Conflicts with dvb driver (which is better for handling this device)
blacklist snd_aw2

# replaced by p54pci
blacklist prism54

# replaced by b43 and ssb.
blacklist bcm43xx

# most apps now use garmin usb driver directly (Ubuntu: #114565)
blacklist garmin_gps

# replaced by asus-laptop (Ubuntu: #184721)
blacklist asus_acpi

# low-quality, just noise when being used for sound playback, causes
# hangs at desktop session start (Ubuntu: #246969)
blacklist snd_pcsp

# ugly and loud noise, getting on everyone's nerves; this should be done by a
# nice pulseaudio bing (Ubuntu: #77010)
blacklist pcspkr

# EDAC driver for amd76x clashes with the agp driver preventing the aperture
# from being initialised (Ubuntu: #297750). Blacklist so that the driver
# continues to build and is installable for the few cases where its
# really needed.
blacklist amd76x_edac

# added by rock 2021-11-26 for WIFI hardware-disable bug
blacklist acer_wmi

重启之后发现 WIFI 已经能够自动开启了,rfkill 结果也正常了。

1
2
3
4
root@YSS:~# rfkill list all
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no

参考链接