I am trying to write a service file that unbinds a PCI device like this, after I run systemctl stop servicefile-name
:
ExecStop=/bin/echo 1 > "/sys/bus/pci/devices/0000\:03\:00.0/remove"
However the unbinding never occurs and the device is still active and running. Executing the echo command from the bash command line has no problems and removes the device just fine: echo 1 > /sys/bus/pci/devices/0000:03:00.0/remove
Running systemctl status servicefile-name
shows that the echo command ran without any errors: (code=exited, status=0/SUCCESS)
. I am clearly not using the correct echo command syntax within the service file. I also tried to remove the escape characters but it still did not work
ExecStop=/bin/echo 1 > "/sys/bus/pci/devices/0000:03:00.0/remove"
Does anyone know how to remove/unbind devices at runtime from a systemd service file, give the special characters ":"?