Score:1

Is it possible to disable and re-enable on-board PCI devices in Linux?

sk flag

So as the title suggests, Is there a way I can disable and re-enable PCI devices or on-board devices on Linux using Terminal like the disable and enable device functions in Windows' Device Manager. I want to do that everytime my PC boots up because there is an issue with the on-board ethernet controller causing it to stop working until I disable and re-enable it using Device Manager (that's on Windows), but for linux I have to boot into Recovery Mode and enable Networking for the on-board ethernet controller to work.
Here are some basic technical information about my PC in case they might be useful:
PC model: Dell Optiplex 7010 Mini-tower 3rd gen
Linux distro: ubuntu linux 20.04 lts booted in uefi boot mode.
ethernet controller name: Intel(R) 82579LM Gigabit Network Connection (as reported by Windows' Device Manager)

Dmesg command returns "e1000e: device probe failed with error -3"

I have tried disabling and re-enabling the e1000e module with no luck, have also tried going to /sys/dev/pci/network/enabled (where network is the ID of the on-board ethernet controller) and echoing 0 and 1 but still no success.
I also have tried reinstalling Linux distribution and building drivers from source (The e1000e drivers from Intel website) but still with no luck. I also have tried many solutions written on Google but with no luck too.

lspci -vv command outputs the device information like this:

00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (Lewisville) (rev 04)
    DeviceName:  Onboard LAN
    Subsystem: Dell 82579LM Gigabit Network Connection (Lewisville)
    Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
    Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
    Latency: 0
    Interrupt: pin A routed to IRQ 27
    Region 0: Memory at f7c00000 (32-bit, non-prefetchable) [size=128K]
    Region 1: Memory at f7c38000 (32-bit, non-prefetchable) [size=4K]
    Region 2: I/O ports at f060 [size=32]
    Capabilities: [c8] Power Management version 2
        Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
        Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=1 PME-
    Capabilities: [d0] MSI: Enable+ Count=1/1 Maskable- 64bit+
        Address: 00000000fee00298  Data: 0000
    Capabilities: [e0] PCI Advanced Features
        AFCap: TP+ FLR+
        AFCtrl: FLR-
        AFStatus: TP-
    Kernel driver in use: e1000e
    Kernel modules: e1000e
Nikita Kipriyanov avatar
za flag
If you are saying about Linux, better list how it is reported there, than in Windows: `lspci`; also `lspci -k` to see which driver it is using (though it is very likely that it is really `e1000e`). Also, I suspect the problem is with its *power saving* modes, so try to explore that. Do you see any settings related to this this in BIOS Setup? Does anything change in files inside `/sys/bus/pci/drivers/e1000e/PCI_BUS_ADDRESS/power/` before and after "disabling and re-enabling" the device?
Insertx2k_Dev avatar
sk flag
@NikitaKipriyanov No, Nothing actually changes in the `power` file after disabling and re-enabling the `e1000e` module, and I don't know how to disable and re-enable the device because that's why I am asking this question.
Grant Curell avatar
mx flag
(legally obligatory note: I work for Dell): Yes, this is done through udev. If I get a chance to go write up a proper answer I will, but just Google "Disable device through udev" and that will put you on the track you want.
Insertx2k_Dev avatar
sk flag
@GrantCurell I tried searching on google for "disabling pci devices through udev" and ended up finding [this question on stackoverflow](https://superuser.com/questions/541854/disable-specific-pci-device-at-boot) but the selected answer doesn't seem to work as echoing the device PCI ID to the file `/sys/bus/pci/drivers/e1000e/unbind` just returns an **Access is denied** error. Here's the command I tried: `sudo echo 0000:00:19.0 > /sys/bus/pci/drivers/e1000e/unbind`
Grant Curell avatar
mx flag
You need to create the udev rule that is going to match. I suggest asking chatgpt about it - I just tried it and it gives a pretty comprehensive answer. Right now what you're doing isn't going to trigger anything from udev because you don't have any udev rules set up for the device. I used prompt "How do you disable a PCIe device through udev"
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.