Sample Header Ad - 728x90

"install" modprobe command not firing user script

1 vote
2 answers
168 views
Debian bookworm, kernel 6.8.0-rc5, kmod version 30 I'm working with a constrained system and need to unbind some unused PCIe ports to free up IRQs for downstream devices before they load. I am using an install command in modprobe.d/mpt3sas.conf (then rebuilding with `update-initramfs -u`)
softdep mpt3sas pre: i40e
install mpt3sas /bin/sh /usr/bin/unbind_pcieport.sh; /sbin/modprobe --ignore-install mpt3sas $CMDLINE_OPTS
but unbind_pcieport.sh doesn't fire. I've included `echos` in unbind_pcieport.sh, outputting to a log file, but no log file is ever created, indicating the script is not running at all. The unbinding works as expected if I put everything inside mpt3sas.conf like this:
install mpt3sas echo "0000:02:08.0" > /sys/bus/pci/drivers/pcieport/unbind; echo "0000:02:09.0" > /sys/bus/pci/drivers/pcieport/unbind; echo "0000:02:0a.0" > /sys/bus/pci/drivers/pcieport/unbind; /sbin/modprobe --ignore-install mpt3sas $CMDLINE_OPTS
but I'd like to have some logic in my script and it's just cleaner to not have it all in one line of the .conf This is the script body:
#!/bin/sh
# Space-separated list of PCI devices to unbind
PCI_DEVICES="0000:02:08.0 0000:02:09.0 0000:02:0a.0"
# Unbind each specified device if it exists
for DEVICE in $PCI_DEVICES; do
    if [ -e "/sys/bus/pci/drivers/pcieport/$DEVICE" ]; then
        echo "$DEVICE" > /sys/bus/pci/drivers/pcieport/unbind
        echo "Unbound $DEVICE from pcieport driver"
    else
        echo "$DEVICE not found or already unbound"
    fi
done
I've tried using /bin/bash instead of sh, and omitting /bin/bash in the .conf and just using "unbind_pcieport.sh" (with the script in $PATH) The .sh script is world executable and readable EDIT: Loking through the modprobe manual I haven't found why my script isn't executing, but I did find that you can break lines with `\, so I at least cleaned up the working mpt3sas.conf` for now:
softdep mpt3sas pre: i40e
install mpt3sas \
echo "0000:02:08.0" > /sys/bus/pci/drivers/pcieport/unbind;\
echo "0000:02:09.0" > /sys/bus/pci/drivers/pcieport/unbind;\
echo "0000:02:0a.0" > /sys/bus/pci/drivers/pcieport/unbind;\
/sbin/modprobe --ignore-install mpt3sas $CMDLINE_OPTS
Asked by Usagi (21 rep)
Oct 27, 2024, 05:51 AM
Last activity: Oct 29, 2024, 06:29 PM