Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a PCIe device that only works correctly when the computer is fully powered off then on again. Issuing a simple reboot or reboot -p command does not appear to cycle the power to the PCIe card, which causes it not to work after the reboot.

Is there a way to, from the OS, cycle power to a device in a PCIe slot? I can find it in /sys/bus/pci/devices/0000*/, but I can't figure out how to properly reset the board. Toggling power seems to be the only way.

Barring that, can I change a setting somewhere that will cause a full power cycle on a reboot command?

I'm running Ubuntu 12.10 by the way.

share|improve this question
Did you try reboot -f? This is similar to pressing the power button of the CPU. – ktan Apr 23 '15 at 7:59
Two years ago the OP pointed out that a soft reboot didn't work. Your reboot -f is still a soft reboot. – roaima Apr 23 '15 at 10:18

Potential Method #1

I think you can do it with these commands:


echo 0 > /sys/bus/pci/slots/$N/power


echo 1 > /sys/bus/pci/slots/$N/power

Where $N is the number of the PCI slot.

lspci -vv may help to identify the device. This is not very well documented...

Potential Method #2

I came across this thread on U&L, similar issue: there are some answers to that question that say you can reset with this command:

echo "1" > /sys/bus/pci/devices/$NUMBER/reset. 

However, I'd read the answers there! There are conditions around doing it this way! Specifically I'd read this answer!

Potential Method #3

There is a unix command, setpci that may give you a method for resetting a device in the PCI bus.

I did not see any specific examples with this command so you'll have to google for examples and look through the man page. I would tread lightly with this command until you're confident in it's use. From what I've read about it, it's manipulating the hardware directly and so there are always risks in doing it yourself vs. using a tool that is exposing this type of functionality!

share|improve this answer
Nothing shows up in slots, even though I have multiple cards plugged in. I do have a power directory in /sys/bus/pci/devices/$NUMBER/. But nothing seems to warrant setting 0 or 1 – zachd1_618 Apr 27 '13 at 23:30
I came across this thread on U&L, similar issue: there are some answers to that Q that say you can reset with this: echo "1" > /sys/bus/pci/devices/$NUMBER/reset. Read that Q though, there are conditions around doing it that way! – slm Apr 27 '13 at 23:42
Thanks for the link. I've tried that however and it doesn't seem to do anything. Specifically, the device doesn't power cycle and the system still knows it is there. (When the card is on and plugged in, there are devices in /dev that I can watch). They don't disappear when I echo "1" > .... – zachd1_618 Apr 28 '13 at 0:06
Are you unloading the kernel modules for that card prior to the power cycling? I think you have to do that as well. – slm Apr 28 '13 at 0:33
Good thought, but unfortunately that has no effect. Thanks for all the ideas! – zachd1_618 Apr 28 '13 at 1:27

remove and rescan will allow the kernel to cycler-power the PCI device without reboot:

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

where DDDD.BB.DD.F = Domain:Bus:Device.Function

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.