Questions tagged [udev]

Udev manages the Linux /dev directory, and hooks userspace into kernel device events.

udev (userspace /dev) is a device manager for the Linux kernel. As the successor of devfsd and hotplug, udev primarily manages device nodes in the /dev directory. At the same time, udev also handles all user space events raised when hardware devices are added into the system or removed from it, including firmware loading as required by certain devices.

https://en.wikipedia.org/wiki/Udev

https://wiki.debian.org/udev

http://reactivated.net/writing_udev_rules.html

518 questions
3
votes
2 answers

Bash script doesn't wait until commands have been properly executed

I am working on a very simple script but for some reason parts of it seem to run asynchronously. singlePartDevice() { # http://www.linuxquestions.org/questions/linux-software-2/removing-all-partition-from-disk-690256/ #…
Philip
  • 151
  • 2
  • 9
3
votes
1 answer

How to use symlinked cdc-wdm device with ModemManager?

We have created udev rules to make the device naming consistent for the cdc-wdm devices, no matter in what order our lte usb devices are registered at the usb bus. We had the issue that we could not rename the cdc-wdm devices, which I understand is…
Florian Berndl
  • 1,136
  • 8
  • 27
3
votes
2 answers

libudev advice needed

I am embarking on a programming project that will need to confirm device identity of removable media (e.g. usb thumb drives) before it will go on to do a bunch of other cool stuff. Some friends of mine pointed me towards using the Serial Number,…
user946954
  • 49
  • 1
  • 3
3
votes
0 answers

Docker bullseye image and udevadm command failing

I am trying to build a custom docker image using the image python:3.7-slim-bullseye. Inside this image I run the command: RUN udevadm control --reload-rules || echo "done" which produces the error: Failed to send reload request: No such file or…
rider45
  • 83
  • 4
3
votes
1 answer

let systemd service launch after the udev symlink is created

I have a systemd service mounting a partition of a UFS LU to /mnt ## bt_mount.service ## [Unit] Description=Mount bt_firmware_a/b to /mnt [Service] Type=oneshot PassEnvironment="SLOT" ## "_a" or "_b", depends on the boot slot ExecStart=/bin/mount…
xiao
  • 63
  • 1
  • 5
3
votes
1 answer

How to change specific file permissions using udev rule?

I'm trying to let my user bob the permissions to change the screen brightness, which means: let bob read, write permissions for /sys/class/backlight/intel_backlight/brightness using: udevadm info -a -p /sys/class/backlight/intel_backlight/ shows…
Guy
  • 491
  • 4
  • 13
3
votes
1 answer

Copy file to USB automatically on mount Raspberry Pi

I'm currently doing a project which requires a file to be automatically copied to USB-stick on mount. Based on my research in internet, I believe it is doable using udev rule. So, when an USB is inserted into my RPi2, the udev rule will then execute…
dboy
  • 73
  • 4
  • 9
3
votes
1 answer

Ubuntu run script as user when usb inserted

I want to automatically attach any inserted usb drive to a virtual machine that is run inside ubuntu under particular user login. To do that, I've set up the following udev rule(from [1], [2]): KERNEL=="sd?", ENV{ID_BUS}=="usb", SUBSYSTEM=="block",…
Dimitry
  • 2,204
  • 1
  • 16
  • 24
3
votes
0 answers

uinput and setting file permissions by chmod or rules

I'm writing a pseudo-chorded keyboard remapper here using evdev and uinput. I don't want to give my regular user the permission to read and write to /dev/input/event* and /dev/uinput so I have created a new user (hopr) with the sole purpose of…
athoren
  • 443
  • 4
  • 12
3
votes
2 answers

Linux execute script based on usb port

Hello I am working on debian system installed on embedded system. The PC has 3 ports usb let's call it A, B, C. I want to execute different script based on the usb port. How can I achieve this? I found a lot of articles about the udev rules and I…
user1521944
  • 317
  • 1
  • 2
  • 14
3
votes
2 answers

How to set up a udev rule for ETH "link down"/"link up"?

I like to switch on a green LED(connected through GPIOs), when eth0 is connected. When disconnected I like to switch the green LED of and a red one on. Thought that udev is maybe the right place for it. I created the simple demo…
Stefan Jaritz
  • 1,999
  • 7
  • 36
  • 60
3
votes
3 answers

libusb calls without sudo using udev-rules

Tested on Kubuntu 16.04 64 bit only. I have an application which source is not under my control. It uses some libusb calls which ends up in e.g.: libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/001/031: Permission…
Joe
  • 3,090
  • 6
  • 37
  • 55
3
votes
1 answer

udev won't execute rule properly

udev does not run my bash script properly. Heres my rule: ACTION=="add", KERNEL=="sd*1", SUBSYSTEM=="block", ATTRS{idVendor}=="0930", ATTRS{idProduct}=="6544", RUN="/usr/local/bin/usb-bmw-in" ACTION=="remove", KERNEL=="sd*1", SUBSYSTEM=="block",…
Unkn0wn
  • 97
  • 1
  • 6
3
votes
2 answers

SD card: how to force the kernel to read the WP pin again without removing the sdcard

I have the following udev rules to mount the first partition of the sd card to /mnt/sdcard. KERNEL=="mmcblk0p1", SUBSYSTEMS=="mmc", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}",…
leszek.hanusz
  • 5,152
  • 2
  • 38
  • 56
3
votes
0 answers

How to find a device node in /dev from physical USB port?

Given two identical USB devices with the exact same USB descriptors and thus with absolutely no way to differentiate them only using the leaf information of the device information view (the USB device descriptor) as usually done (yes, this device is…
Julio Guerra
  • 5,523
  • 9
  • 51
  • 75