How to hot-plug a wireless network card in Ubuntu

Toxix
3 min readJul 5, 2021

On my Lenovo x220 laptop, that I am still using as private laptop, because of it’s amazing keyboard and durability. Didn’t find anything similar yet. The Laptop has survived even an ‘attack‘ with melted butter, going through the laptop a couple of years ago. Happened on a hot summer day, during transportation. I needed to change the keyboard. A lot of cleaning work in the rest of the components, but think it was worth it.

Now a week ago the wireless connection stopped working. Putting it to sleep or enable/disable the wireless kill switch didn’t help. Removing the wireless module from the kernel ( modprobe ) and bring it back in, didn’t help either. Rebooting helped the last time, but I am not a big fan of rebooting systems, so I checked what was going on. dmesage gave me a hint:

[159990.111599] WARNING: CPU: 3 PID: 66631 at /home/kernel/COD/linux/net/mac80211/driver-ops.h:18 drv_remove_interface+0x121/0x130 [mac80211]
[159990.111600] Modules linked in: snd_usb_audio snd_usbmidi_lib hid_generic usbhid hid acpi_call(OE) tp_smapi(OE) thinkpad_ec(OE) msr ccm devlink xt_CHECKSUM ipt_MASQUERADE nf_nat_masquerade_ipv4 xt_conntrack ipt_REJECT nf_reject_ipv4 xt_tcpudp ip6table_mangle ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 iptable_mangle iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack libcrc32c ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter bridge stp llc overlay binfmt_misc intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm irqbypass intel_cstate intel_rapl_perf snd_hda_codec_hdmi snd_hda_codec_conexant snd_hda_codec_generic snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep input_leds snd_pcm arc4 wmi_bmof iwldvm serio_raw mac80211 snd_seq_midi
[159990.111639] snd_seq_midi_event thinkpad_acpi nvram snd_rawmidi iwlwifi snd_seq cfg80211 snd_seq_device snd_timer shpchp snd mei_me mei soundcore mac_hid sch_fq_codel cuse parport_pc ppdev lp parport sunrpc ip_tables x_tables autofs4 dm_crypt i915 crct10dif_pclmul crc32_pclmul ghash_clmulni_intel pcbc aesni_intel i2c_algo_bit aes_x86_64 drm_kms_helper crypto_simd glue_helper cryptd syscopyarea sysfillrect sysimgblt fb_sys_fops psmouse sdhci_pci ahci e1000e drm libahci i2c_i801 sdhci lpc_ich ptp pps_core wmi video
[159990.111674] CPU: 3 PID: 66631 Comm: kworker/3:0 Tainted: G W OE 4.14.215-0414215-lowlatency #202101122110
[159990.111675] Hardware name: LENOVO 42912XG/42912XG, BIOS 8DET61WW (1.31 ) 04/25/2012
[159990.111691] Workqueue: events_freezable ieee80211_restart_work [mac80211]
[159990.111693] task: ffff99bcc5348000 task.stack: ffffc06282cd4000
[159990.111709] RIP: 0010:drv_remove_interface+0x121/0x130 [mac80211]
[159990.111710] RSP: 0018:ffffc06282cd7cd0 EFLAGS: 00010286
[159990.111712] RAX: 0000000000000036 RBX: ffff99bcc621ece0 RCX: 0000000000000006
[159990.111713] RDX: 0000000000000000 RSI: 0000000000000092 RDI: ffff99bcde2d65d0
[159990.111715] RBP: ffff99bcd2389020 R08: 00000000000005af R09: 0000000000000004
[159990.111716] R10: ffffc06282cd7b00 R11: 0000000000000001 R12: 0000000000000000
[159990.111717] R13: ffff99bcd2388780 R14: ffff99bcc621f3c0 R15: ffff99bcd2388f18
[159990.111719] FS: 0000000000000000(0000) GS:ffff99bcde2c0000(0000) knlGS:0000000000000000
[159990.111720] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[159990.111721] CR2: 0000559a2707d4fe CR3: 000000011fc0a006 CR4: 00000000000606e0
[159990.111722] Call Trace:
[159990.111744] ieee80211_do_stop+0x52d/0x860 [mac80211]
[159990.111751] ? qdisc_reset+0x27/0x70
[159990.111771] ieee80211_stop+0x16/0x20 [mac80211]
[159990.111774] __dev_close_many+0x92/0xf0
[159990.111777] dev_close_many+0x88/0x130
[159990.111780] dev_close.part.86+0x44/0x70
[159990.111802] cfg80211_shutdown_all_interfaces+0x6d/0xb0 [cfg80211]
[159990.111826] ieee80211_reconfig+0x270/0x1160 [mac80211]
[159990.111830] ? try_to_del_timer_sync+0x4d/0x80
[159990.111847] ieee80211_restart_work+0xb2/0xe0 [mac80211]
[159990.111850] process_one_work+0x1d1/0x410
[159990.111853] worker_thread+0x2b/0x3d0
[159990.111855] ? process_one_work+0x410/0x410
[159990.111858] kthread+0x11a/0x130
[159990.111862] ? kthread_create_on_node+0x70/0x70
[159990.111864] ret_from_fork+0x35/0x40
[159990.111867] Code: e8 7a c1 aa c8 e9 49 ff ff ff 48 8b b6 00 04 00 00 48 81 c3 20 04 00 00 48 c7 c7 b8 dd 9c c0 48 85 f6 48 0f 44 f3 e8 9a 2c b9 c8 <0f> 0b 5b 5d 41 5c c3 0f 1f 84 00 00 00 00 00 66 66 66 66 90 41

It looks like I am not the first person having this issue for example https://bugzilla.redhat.com/show_bug.cgi?id=1409703

They blame some hardware failure. Suggestion is to disconnect and rescan for the wireless card. So let’s first check what the address of my wireless card is:

lspci -nn | grep Centrino

03:00.0 Network controller [0280]: Intel Corporation Centrino Advanced-N 6205 [Taylor Peak] [8086:0085] (rev 34)

And let’s get the job done

echo 1 > /sys/bus/pci/devices/0000\:03\:00.0/remove
echo 1 > /sys/bus/pci/rescan

And wireless card starts to be operational again. Happy Linux user. :)

--

--