Debian:Debian11(Bullseye)へのアップグレードでWiFi接続出来なくなった時の対応
Wicdを利用してネットワーク接続しているDebian10(Buster)を、Debian11(Bullseye)にアップグレード。自然な流れで、apt autoremoveすると、突然WiFi接続できなくなってしまった。Debian11(Bullseye)にはWicdのパッケージが存在しないことから、apt autoremove 時にWicdが削除されてしまった。
今時有線LANなんか無いので、スマホで公式サイト( https://packages.debian.org/ja/ )から必要なパッケージをダウンロードして、USBでPCに移して、dpkg でインストールを繰り返すことになった。
目次
WiFi device を認識しなくなった
色々と出し入れしている間に、wifi device が認識されなくなった。
WiFiドライバーが入っているか確認
$ apt search firmware-brcm
firmware-brcm80211/stable,stable,now 20210315-3 all [インストール済み]
Binary firmware for Broadcom/Cypress 802.11 wireless cards
入っているけど、device 認識しない。なぜ?
公式サイト( https://packages.debian.org/ja/ )からダウンロードして、手動で入れ直してみる。
$ sudo dpkg -i firmware-brcm80211_20210315-3_all.deb
やはり認識されない。バックポートの奴を入れてみよう。
$ sudo dpkg -i firmware-brcm80211_20210818-1~bpo11+1_all.deb
OS再起動。でも認識されない。
カーネルモジュールのロードをし直す
$ sudo modprobe -rv brcm80211
$ sudo modprobe -v brcm80211
そんなモジュール無いと言われる。
lshw を入れて、無線アダプタのハード情報を調べてみる。
$ sudo dpkg -i lshw_02.18.85-0.7_amd64.deb
$ sudo lshw -c network
*-network UNCLAIMED
description: Network controller
product: BCM4313 802.11bgn Wireless Network Adapter
vendor: Broadcom Inc. and subsidiaries
physical id: 0
bus info: pci@0000:02:00.0
version: 01
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list
configuration: latency=0
resources: memory:e0400000-e0403fff
Broadcom の BCM4313 チップセット。UNCLAIMED = 認識されていない
$ ls /lib/modules/5.10.0-21-amd64/kernel/drivers/net/wireless/broadcom/
b43 b43legacy brcm80211
https://wiki.archlinux.org/title/broadcom_wireless によると、この3つは全て broadcom の wifiアダプターのドライバーだが、
/lib/modules/5.10.0-21-amd64/kernel/drivers/net/wireless/broadcom/brcm80211/brcmsmac/brcmsmac.ko
が BCM4313 チップセットに対応したドライバー。
正確なモジュール名でもう一度カーネルモジュールのロード。
$ sudo modprobe -v brcmsmac
insmod /lib/modules/5.10.0-21-amd64/kernel/lib/crypto/libarc4.ko
insmod /lib/modules/5.10.0-21-amd64/kernel/net/mac80211/mac80211.ko
insmod /lib/modules/5.10.0-21-amd64/kernel/drivers/bcma/bcma.ko
insmod /lib/modules/5.10.0-21-amd64/kernel/lib/math/cordic.ko
insmod /lib/modules/5.10.0-21-amd64/kernel/drivers/net/wireless/broadcom/brcm80211/brcmutil/brcmutil.ko
insmod /lib/modules/5.10.0-21-amd64/kernel/drivers/net/wireless/broadcom/brcm80211/brcmsmac/brcmsmac.ko
ロード出来たのか、lshw で調べる
$ sudo lshw -c network
*-network
description: Wireless interface
product: BCM4313 802.11bgn Wireless Network Adapter
vendor: Broadcom Inc. and subsidiaries
physical id: 0
bus info: pci@0000:02:00.0
logical name: wlan0
version: 01
serial: 34:23:87:ce:6f:3c
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=brcmsmac driverversion=5.10.0-21-amd64 firmware=610.812 latency=0 link=no multicast=yes wireless=IEEE 802.11
resources: irq:17 memory:e0400000-e0403fff
device 起き上がった~!
os起動時に自動でロードされるように設定する。
$ sudo emacs /etc/modules-load.d/modules.conf
#以下1行追加。
brcmsmac
$ sudo reboot
wifi接続デーモンに iwd を導入する。
iwd は ConnMan や NetworkManager のバックエンドデーモンとして動くが、単体でもcliのユーティリティで接続出来る。
$ sudo apt show iwd
Package: iwd
Depends: libc6 (>= 2.25), libreadline8 (>= 6.0)
Recommends: dbus | dbus-system-bus, wireless-regdb
Description: wireless daemon for Linux
Minimalistic wireless daemon that uses modern Linux interfaces
like cfg80211 and nl80211 (netlink).
The daemon provides a D-Bus API.
.
The daemon can be controlled from the command line
with the included iwctl client utility.
.
The included iwmon utility can be used
to monitor the 802.11 subsystem generic netlink commands and events.
It uses the nlmon kernel driver from Linux 3.10 and later.
.
Note that the package defaults
to relying on dbus activation to start.
If you want to use iwd standalone without any manager,
then you'll need to manually enable the system service.
先に、インストールを試したデーモンパッケージ network-manager の関連パッケージを削除する。とくに wpasupplicant は競合するので、必ず削除する。apt remove ではなく、apt-get purge で設定ファイルごと削除する。
$ sudo apt-get purge dns-root-data dnsmasq-base libbluetooth3 libndp0 libnm0 libpcap0.8 libteamdctl0 ppp wpasupplicant libteam-utils libteam5 libnl-cli-3-200 libnl-nf-3-200 network-manager
IWD の関連パッケージが入っているか確認。
$ apt search dbus
dbus/stable,stable-security,now 1.12.24-0+deb11u1 amd64 [インストール済み、自動]
dbus-user-session/stable,stable-security,now 1.12.24-0+deb11u1 amd64 [インストール済み、自動]
dbus-x11/stable,stable-security,now 1.12.24-0+deb11u1 amd64 [インストール済み、自動]
$ apt search wireless-regdb
wireless-regdb/stable,stable,now 2022.04.08-2~deb11u1 all [インストール済み、自動]
iwd パッケージをインストール
iwd パッケージを公式サイトからダウンロードして、USB経由でPCに入れる
$ sudo dpkg -i iwd_1.14-3_amd64.deb
念のため wpa_supplicant を止める
$ sudo systemctl --now disable wpa_supplicant
Unit /etc/systemd/system/wpa_supplicant.service is masked, ignoring.
iwd を起動して、自動起動登録する。
$ sudo systemctl --now enable iwd
Created symlink /etc/systemd/system/multi-user.target.wants/iwd.service → /lib/systemd/system/iwd.service.
設定ファイル
この2行だけ書いておくと、iwd が DHCPを取りに行く。
$ sudo emacs /etc/iwd/main.conf
[General]
EnableNetworkConfiguration=true
デバイスを認識出来ているか調べる
$ iwctl device list
wlan0 34:23:87:ce:6f:3c on phy0 station
wifiルーターとの接続設定
wicd の時の設定は、当然無くなっている。ネットワーク毎に接続設定をし直さないといけない。
$ iwctl station wlan0 scan
$ iwctl station wlan0 get-networks
$ iwctl --passphrase "mysecret" station wlan0 connect "SSID"
ルーターに接続したか確認
$ iwctl station wlan0 show
State connected
DNS 設定
ネットワークに接続出来たか確認
$ ping 1.1.1.1
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
$ ping gnu.org
ping: gnu.org: 名前解決に一時的に失敗しました
外部には出れたけど、名前解決が出来ていないので、IWD のための DNS resolution を設定する。
$ sudo systemctl enable --now systemd-resolved
Created symlink /etc/systemd/system/dbus-org.freedesktop.resolve1.service → /lib/systemd/system/systemd-resolved.service.
Created symlink /etc/systemd/system/multi-user.target.wants/systemd-resolved.service → /lib/systemd/system/systemd-resolved.service.
NetworkManager が作った resolv.conf があったら削除する。
$ sudo rm /etc/resolv.conf
systemd/resolve の confファイルを、 /etc/resolv.conf にシンボリックリンクする
$ ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
iwd の再起動
$ sudo systemctl restart iwd
名前解決が出きるか確認
$ ping gnu.org