2

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.

  • It is generally not considered a good practise to cross-post the same question to several Stack Exchange sites. Maybe you could close the other one? – Sami Laine Sep 28 '14 at 13:56
  • 1
    Have you verified that the insmod line actually succeeds when run interactively? Have you tried substituting insmod helloworld.ko with modprobe helloworld (without .ko)? – zagrimsan Sep 29 '14 at 12:42
  • 1
    Try using absolute path for helloworld.ko with insmod – user.dz Oct 11 '14 at 20:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.