TransWikia.com

Disable Ethernet Hardware Devices at start-up

Unix & Linux Asked by nickaz on December 29, 2021

To startup vm called “sys-net” in Qubes on my laptop need to write “1” in file

echo -n "1" > /sys/bus/pci/devices/0000:04:00.0/remove

also 0000:04:00.0 and 0000:04:00.1 are conflicts and need to be removed first after every startup laptop.

then network start and work fine. there is some input for information

$ lspci | grep -i eth
04:00.1 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev12)

$ find /sys -name *04:00.0
/sys/bus/pci/devices/0000:04:00.0
/sys/bus/pci/drivers/rtsx_pci/0000:04:00.0
/sys/devices/pci0000:00/0000:00:1d.3/0000:04:00.0

$ find /sys -name *04:00.1
/sys/bus/pci/devices/0000:04:00.1
/sys/bus/pci/drivers/pciback/0000:04:00.1
/sys/devices/pci0000:00/0000:001d.3/0000:04:00.1

How can I convert it to systemd script to run it at start-up? It works only temporarily. After reboot the network device is there again.

One Answer

You could try using a udev rule.

For example, you can create a file /etc/udev/rules.d/99-disable-eth.rules with the following content:

ACTION=="add", SUBSYSTEM=="net", SUBSYSTEMS=="pci", RUN+="/bin/sh -c 'echo 1 >/sys/bus/pci/devices/0000:04:00.0/remove'"

Feel free to customize it further to add more specific items, like the vendor attribute, the name of the interface, etc.

Take a look at http://www.reactivated.net/writing_udev_rules.html for more examples and additional information on writing udev rules.

Answered by ILMostro_7 on December 29, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP