Joined: 05 Jan 2015
|Posted: Fri Jan 09, 2015 10:19 am Post subject: /sys/bus/pci/rescan can only be enabled manually
My gentoo box didn't detect "hot-plugged" SD-Cards, so I found out, that I have to "echo 1 > /sys/bus/pci/rescan" to enable this feature.
I have to execute that command manually in a gnome-terminal otherwise it doesn't work, even it doesn't report any errors.
Since I didn't want to do this every time after inserting a card into the card reader, I wrote a script which should do that job for me on every boot. Easy - I thought.
DATE=`date +"%y-%m-%d %H:%M:%S"`
echo 1 > /sys/bus/pci/rescan
if [ $ERROR -gt 0 ]
echo "$DATE Error $ERROR while enabling PCI Rescan" >> $LOG
echo "$DATE PCI Rescan enabled" >> $LOG
If I execute that script manually (sudo script.sh) it works as expected.
Now, I wanted systemd to execute it on every start, so I added a new service and regarding to the log, the command got executed successfully BUT the feature seems not to be enabled.
Description=Enables PCI Rescanning (for SD-Card detection)
Okay, I thought. Maybe I have to run that script after everything has loaded. So I created a gnome3 autorun entry, which executes the script exactly the same way as I would do it manually in the gnome-terminal (yes, with sudo ). Same thing. Successful log entry but the feature is still not activated until I run the same script manually (from gnome-terminal)
I even tried to "sleep 10" before execution so I can see the script running after autostart - no errors, but the feature is still not activated.
Whats wrong? Where's the difference? Any suggestions?