I have a Raspberry Pi 3 model B.

I installed Raspbian using NOOBS, and it worked great. I had a project that needed to execute certain actions when a USB device was connected. I learned about udev, and implemented some actions which worked neatly.

However, I had to change the SD card because the first one got corrupted. I repeated all the steps, and installed NOOBS again in my new SD card. Then, when I started working on udev rules, they didn't work anymore. Yep, using a completely fresh install.

No matter if the rule is calling a script in a file, or it's inlined, it always throws this error: Process 'x' failed with exit code 2., when I look at the udev service log, using systemctl status udev

enter image description here

I already tried to purge and install udev via apt-get. I also updated the packages.

My commands are as simple as this one:

ACTION=="add", SUBSYSTEM=="usb", RUN+="mkdir /home/pi/kamsdkamsdkasmd"

But even this one inlined throws the same error. Already tried using RUN= instead of RUN+= and using sudo, but it's the same.

Could anyone please help me? I already googled a lot, and couldn't find anything similar to my actual problem.

EDIT: tlhIngan, I downloaded NOOBS v2.4.4 in September. I used it for installing Raspbian the first time back in mid-September, and used exactly the same file (still downloaded to my PC, not downloaded again) to install it again yesterday after my first SD card got corrupted.

Right now I'm installing the lite version to a new SD Card, just to see if the problem persists. Thanks for asking.

EDIT 2: I installed Raspbian in two more SD cards, and both have exactly the same problem I described when starting using udev (fresh install, straight to adding my simple rule for testing the creation of a directory when plugging a USB device). No matter what I put in "RUN+=" or "RUN=", I get "Process 'command' failed with exit code 2.". I googled about udev and about its exit codes, and there's nothing to guide me from just that.

I checked the /var/log/messages file for reading the logs made by devices being connected, and there's my device being recognized as it should. I also tested with 4 more USB cables (2 brand new), incase there was something wrong with the USB connection. I get the same error every single time.

So, I understand the problem occurs when running the script, and not when recognizing the device. I'm already losing my mind, because I don't know what could possibly be wrong. Please, help...

  • Which version of Raspbian (or which date) did you have before and which version (or installation date) do you have now? It may not be the same Raspbian at all. There's been a major change in August. – tlhIngan Nov 15 '17 at 2:43

I solved the issue after following this:

https://www.raspberrypi.org/documentation/raspbian/updating.md

First, update your system's package list by entering the following command:

sudo apt-get update

Next, upgrade all your installed packages to their latest versions with the command:

sudo apt-get dist-upgrade

After entering those commands and rebooting, udev started working as expected.

Lesson learned: always make sure to update your fresh installs before starting working.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.