Failing to load a module on udev event

1

I have a pretty simple udev rule which is executed when a USB is plugged into my Debian machine:

SUBSYSTEMS=="usb", KERNEL=="sd?", ACTION=="add", RUN+="/usr/local/bin/USB/t.sh \
%k"

My t.sh is also pretty simple and it does two things:

  • Prints helloworld in udev.out to Desktop
  • Loads foo.ko module into kernel with simple insmod foo.ko

Or concretely, t.sh is:

#!/bin/bash

echo 'Hello World!' >>"/home/salman/Desktop/udev.out"

insmod helloworld.ko

exit

When I plug in my USB, udev.out is correctly printed on Desktop but the following line insmod helloworld.ko fails to load the module in the kernel.

I checked with lsmod | grep helloworld but it doesn't show helloworld loaded into kernel.

I am running a Debian machine inside Virtual Box.

user1343318

Posted 2014-09-28T10:24:11.393

Reputation: 111

Answers

1

Have you tried using the full path /sbin/insmod and the full path to helloworld.ko?

rphv

Posted 2014-09-28T10:24:11.393

Reputation: 121