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 restating 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.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

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

%d bloggers like this: