Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

9
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Commented Aug 25 at 14:07
  • 4
    1. Why are you using sudo all over the place? udev already runs as root, there's no need to use sudo as the shebang line or use sudo within the script. sudo is not intended as a brute-force tool to sprinkle everywhere like magic pixie dust to "fix" (or, more often, break) things you haven't made an effort to understand. 2. did you run udevadm trigger? Commented Aug 25 at 14:20
  • 1. I realized my mistake about sudo. 2. Yes, I run the command udevadm control --reload-rules && udevadm trigger every time. At the moment, the rule and script look like this: ``` SUBSYSTEM=="block", KERNEL=="sd[a-z][0-9]", \ ENV{ID_BUS}=="usb", ENV{ID_TYPE}=="disk", \ ENV{UDISKS_AUTO}="0" ACTION=="add", SUBSYSTEM=="block", KERNEL=="sd[a-z][0-9]", \ ENV{ID_BUS}=="usb", ENV{ID_TYPE}=="disk", \ RUN+="/usr/bin/mount-usb.sh %k" ``` ``` #!/usr/bin/sudo bash NAME_DEV=$1 /usr/bin/pmount --umask=000 -s -w "/dev/$NAME_DEV" ``` Commented Aug 25 at 14:29
  • Comments are designed for us to ask you questions about your Question. Please Edit your question rather than replying in comments. How to Ask a new question if you have a new problem. Commented Aug 25 at 14:42
  • 1
    I see what you're trying to do, but your device isn't made available under /dev until that rule finishes executing ... You can't mount it that way. Please see similar issue discussed here: Different behaviour of bash script in udev Commented Aug 25 at 14:55