Use sysfs to restart failed PCI devices (WiFi cards, sound cards, etc.)

Photo by Malachi Brooks on Unsplash

This article describes one method of restarting PCI devices. It demonstrates restarting a wireless device. But the concept should work on any device whose device driver has adequate hotplug support.[1]

Computers typically consist of several interconnected devices. Some devices can be physically disconnected and reconnected with ease (for example, most USB devices). Others might require a specific interaction with the operating system or specific software. And others will require a full reboot.

Built-in laptop wireless cards are PCI devices that could fail at runtime but might not be easy to physically disconnect and reconnect without a full reboot. In many cases these devices can be restarted through Linux’s sysfs interface without having to do a full reboot of the computer.

This article will specifically demo how to restart an Atheros wireless card which has locked up.

How to restart PCI devices

Depending on your particular desktop environment and hardware, it may be possible to switch the PCI card off and back on using a GUI or hardware switch or button. But if none of those options exist or work, the following CLI method of restarting the PCI card might prove useful.

To restart a wireless card you will need its PCI domain, bus, device and function address. Run the lspci command, as shown below, and search its output to find your wireless card’s PCI address.

$ lspci
3d:00.0 Network controller: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter (rev 32)

In the above example, the PCI address of the Atheros card is 3d:00.0. If the address shown does not include a domain part (that is, the number at the start of the line contains only one colon character), then the computer has only one PCI domain and it is 0000.

The following commands, with the capital letters substituted with the device’s PCI address, can be used to restart a PCI device on a running system.[2]

# echo "1" > /sys/bus/pci/devices/DDDD\:BB\:DD.F/remove  
# sleep 1  
# echo "1" > /sys/bus/pci/rescan

In the above example, the placeholders DDDD, BB, DD, and F are for the PCI device domain, bus, device, and function respectively.

Substituting the values from the example output of the lspci command shown above gives the command that would need to be run to restart the Atheros wireless card on this example system.

$ sudo /bin/sh -c "echo '1' > /sys/bus/pci/devices/0000\:3d\:00.0/remove"
$ sleep 1
$ sudo /bin/sh -c "echo '1' > /sys/bus/pci/rescan"

If required, the above commands could be automated by putting them in a script.

$ nano
echo "1" > /sys/bus/pci/devices/0000\:3d\:00.0/remove  
sleep 1  
echo "1" > /sys/bus/pci/rescan

Enable executable permissions with, for example, chmod +x and run sudo ./ whenever you need to restart your PCI device.

Final notes

Not all PCI devices can be restarted using this method. But the real-life example demonstrated above does work to get the WiFi card running again without requiring a full reboot of the PC.


  1. Does PCIe hotplug actually work in practice?
  2. How to Reset/Cycle Power to a PCIe Device?
FAQs and Guides


  1. dbruneau

    Very useful! My laptop has a MEDIATEK Corp. MT7922 802.11ax PCI Express Wireless Network Adapter and once in a while it will be missing after resuming from sleep. I was having to close all programs and reboot.

    I will try this next time!

    • Link-State_Down

      Yes, this is very useful! I recently got a laptop that had a MEDIATEK WiFi interface in it as well. I had so many issues with it, I eventually replaced it with an Intel WiFi interface, but i wish i had known about this issue when I still had the MEDIATEK one installed.

      • Yeah, the Atheros Wifi card has been causing problems even since I got this laptop in 2020 and it’s the second most problematic device on it (the first one is the Nvidia GPU, but I knew what I was getting into because it’s a gaming laptop).

        I am also very close to replacing it with an Intel card, I plan on taking the opportunity and getting one that supports Wifi 6 (but not necessarily 6E), since my router is already Wifi 6.

    • Actually, it was usually resuming from suspend which triggered it, usually on S3 sleep. I guess it might be that S3 sleep has some bugs, and the Wifi card is the one that doesn’t wake up?

      Although to be fair, it also crashes randomly sometimes.

      I figured that it should be possible to restart the device without rebooting after spending some time on Windows, on Windows the Network troubleshooter managed to restart the borked Wifi (yes, the same crash happens there), so I started looking for a way to restart under Linux and then wrote this.

  2. Ben

    This is a lifesaver, when those devices go in a corrupt state (where force reloading the kernel module doesn’t help), all that’s left is to do a hard reboot. This workaround saves me from doing that (reboot is unpleasant to say the least with plenty of remote sessions open etc).
    Much appreciated !

  3. Julio Cezar

    Very Useful. Thanks for help.

  4. Walt

    Watch out for overheating! Nvidia chips run hot! have seen several laptops with burnt motherboards caused by Nvidia chips. Fedora is very different from Slackware.

  5. Mark Chandler

    This is a great tip. Thanks so much for writing it up.
    One minor issue: there’s a typo at the beginning. I think it should be “restarting” not “restating”.

  6. Useful information. Appreciate!

  7. tom-aviv

    [root@fedora shayf]# uname -a
    Linux fedora 6.2.9-200.fc37.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Mar 30 22:31:57 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
    [root@fedora shayf]#

    That’s the only command I know.

  8. steve

    that’s not simple? Isn’t there a simple sudo dnf restart blah blab blah

  9. Yiorgos

    Fresh F37 install, tried it on my RTL8125 that is unstable.

    Removed OK, but the subsequent

    pci rescan

    does not seem to do anything.

    Also, worth mentioning that a

    lspci -D

    will also show the PCI device domain, which can be useful in case there are more than one.

  10. Very helpful When I wake up my laptop from sleep, the MEDIATEK Corp. MT7922 802.11ax PCI Express Wireless Network Adapter is occasionally missing. I had to restart and close all open programmes.

    Next time, I’ll give this a go!

  11. red1

    I’m using Fedora 38 on the raspberry B 4GB with IQAUDIO and after adding dtoverlay=iqaudio- dacplus,auto_mute_amp in /boot/config-6.2.10-300.fc38.aarch64.card 0: vc4hdmi0 [vc4-hdmi-0], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
    Subdevices: 1/1
    Subdevice #0: subdevice #0
    card 1: vc4hdmi1 [vc4-hdmi-1], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
    Subdevices: 1/1
    Subdevice #0: subdevice #0

    the command aplay -l

Comments are Closed

The opinions expressed on this website are those of each author, not of the author's employer or of Red Hat. Fedora Magazine aspires to publish all content under a Creative Commons license but may not be able to do so in all cases. You are responsible for ensuring that you have the necessary permission to reuse any work on this site. The Fedora logo is a trademark of Red Hat, Inc. Terms and Conditions