1

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...

2
  • 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, 2017 at 2:43
  • Abandoned post by Unregistered user.
    – Milliways
    Aug 11 at 3:32

1 Answer 1

0

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.

2
  • 1
    Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year.
    – Ingo
    Jan 1, 2020 at 19:13
  • Note that "always make sure to update your fresh installs before starting working" is actually not a requirement. You most likely have started an update which didn't finish properly, and forcing a dist-upgrade brought your system back to a stable state. Dec 14, 2022 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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