Skip to main content
19 votes

How can I check if a udev rule fired?

With udev / systemd version 241 and similar, as root: udevadm control --log-priority=debug journalctl -f Or to make it permanent, again as root: vi /etc/udev/udev.conf # edit the log level as ...
MarcH's user avatar
  • 431
11 votes
Accepted

Writing to a file from a udev RUN command

Operators like |, >> etc. mean something while inside a shell, but when sole /bin/echo 1 | … is run, there is no shell and | is just another argument to echo itself. To use these operators you ...
Kamil Maciorowski's user avatar
8 votes

How can I check if a udev rule fired?

udevadm test $(udevadm info --query=path --name=device_name) should tell you which commands would be executed on a device plug in, citing the udev rules involved. For instance: # udevadm test /block/...
Dmitry Grigoryev's user avatar
8 votes
Accepted

disable MTP udev rules for specific device so it can be mount as a USB Mass Storage device

After much reading and testing. I found out that this is related to a recent change in the default Udev rules to set a catch-all rule for devices to be handled by MTP if they don't match any other ...
nelaaro's user avatar
  • 13.7k
7 votes

udev rule to auto load keyboard layout when usb keyboard plugged in

Depending on your distro, you may already have a udev rule for keyboards in /lib/udev/rules.d/64-xorg-xkb.rules. On Ubuntu, this imports /etc/default/keyboard, which has options roughly like this: ...
jsha's user avatar
  • 211
7 votes

Automounting USB drives on a headless systemd linux box

it is not clear which is the current 'officially' supported approach. Officially supported by whom? If e.g. GNOME includes automount functionality based on udisks, you can be sure it's officially ...
grawity_u1686's user avatar
6 votes

Where can I find the command "udevinfo" on Debian?

udevadm info is the new command. that replaces udevinfo The arguments are same as udevinfo.
Sandeep's user avatar
  • 653
5 votes

How can I check if a udev rule fired?

I'm running kernel 3.0.35, but the following works for me. To get the path for the device you can do something like this: udevadm info --name /dev/sda1 --query all You will get more information than ...
JSunderland's user avatar
5 votes

disable MTP udev rules for specific device so it can be mount as a USB Mass Storage device

First copy the file /lib/udev/rules.d/69-libmtp.rules to /etc/udev/rules.d/69-libmtp.rules: $ sudo cp /lib/udev/rules.d/69-libmtp.rules /etc/udev/rules.d/69-libmtp.rules At the top of this file you ...
Eugen Konkov's user avatar
4 votes
Accepted

why does `udev` consume full memory in ubuntu?

In short, you have a script or program that keeps blindly writing to some device, but that device doesn't exist – so the program ends up creating a regular file and writing to it until the filesystem ...
grawity_u1686's user avatar
4 votes

Reduce timeout value for "A start job is running for dev-disk-by" linux

The answer, provided by user grawity and paraphrased here, is: For each entry in /etc/fstab, decide whether the disk device is one that is not always present at boot time, and add x-systemd.device-...
reikred's user avatar
  • 522
4 votes

Automounting USB drives on a headless systemd linux box

Entries in /etc/fstab should still be honored on a systemd-based system. A .mount unit can be used instead, and should be considered equivalent to an entry in fstab. A .automount unit can be used if ...
Ignacio Vazquez-Abrams's user avatar
4 votes
Accepted

How to set the ethernet interface name in a Linux distribution?

If all you want is to revert all interfaces to their original kernel names, the easiest way to do so is to boot with the net.ifnames=0 kernel option – this tells udev to disable renaming entirely. ...
grawity_u1686's user avatar
3 votes
Accepted

Why udev USB port fixing rules are not working?

First, udev will no longer rename the kernel-assigned device names. (Among other reasons, how should it cope with being asked to rename to something that's already taken by another device?) Instead, ...
grawity_u1686's user avatar
3 votes

Reduce timeout value for "A start job is running for dev-disk-by" linux

Use the nofail fstab option for those disks. Alternatively, you could specify the x-systemd.device-timeout=10s option, but what's the point? systemd already supports hotplugging without the need for ...
grawity_u1686's user avatar
3 votes

What creates the default ifcfg-eth? file?

A. You have to put NM_UNMANAGED to TRUE in a file in /etc/udev/rules.d in order to ensure "No default connection will be created and automatic activation will not be attempted". That's a great ...
BloodyEl's user avatar
  • 1,058
3 votes

udev rule script "xinput --list" differs in terminal versus log

The problem is, that xinput list is refreshed after udev rules processing and no timeout in background process can overcome it. The solution is in triggering your script via inotify. Original solution ...
Pavel Bazika's user avatar
3 votes

How can I check if a udev rule fired?

One thing I ended up doing, on a system where I had somewhat limited ability to change stuff (enable debug, change logging, etc - I could do it but I would have to override some configuration ...
Thomas Guyot-Sionnest's user avatar
3 votes
Accepted

Udev rules failing to pass parameters

It is somewhat complicated, because the rules are evaluated for each node in the device tree and because some informations are available in some parts of the tree but cannot be referenced from another ...
Tylla's user avatar
  • 46
3 votes

udev rule to auto load keyboard layout when usb keyboard plugged in

Since I couldn't get the hacks to make udev rules work, I wrote a small Python script using pyudev to monitor for input events. #! /usr/bin/env python3 import pyudev import time import subprocess ...
Ryan Marcus's user avatar
3 votes

udev rule to start a command on AC/Battery plug/unplug event

TL;DR: Make a udev rule execute a script to kill your application (compton) on AC disconnect. Starting it again is not straightforward - Make a systemd service to start your app, then use a udev ...
user2551102's user avatar
3 votes
Accepted

Network interface names via udev for USB NICs

Do you mean "shuffled" as in "keeps changing", or do you mean it as in "looks like garbage"? Name stability The current naming scheme your logs show is based on the MAC address of the network ...
grawity_u1686's user avatar
2 votes

restore /dev after `rm`ing it

Here's an expansion to Alex Martian's answer: I also found out that udevadm won't restore all files. I fell down the rabbit hole with mknod, and wrote a script to do a more complete restore of /dev. ...
user2150119's user avatar
2 votes

restore /dev after `rm`ing it

As seems to be no way to autorestore all files in /dev expect via rebooting, still: # mknod -m 666 /dev/null c 1 3 # mknod -m 666 /dev/ptmx c 5 2 The above two commands restored working terminal (...
Alex Martian's user avatar
2 votes

Can UDEV somehow trigger zenity for a logged in user in a session?

For anybody else reading this, the only way I was able to get my script in Kali Linux 2016 to work, was like this: #!/bin/bash set -x xhost local:root export DISPLAY=:0.0 su root -c 'zenity --...
sMyles's user avatar
  • 121
2 votes

Where can I find the command "udevinfo" on Debian?

udevadm info -a Does what udevinfo -a -p used to do
sanmai's user avatar
  • 1,162
2 votes

System doesn't detect hot-plugged display port(through thunderbolt connector)

I found your code and persisted in trying to make it work. Under NO conditions could i make it work with an "if then" paradigm. the "xrandr|grep" ALWAYS failed to be true when run as udev trigger, ...
nd34567s32e's user avatar
2 votes
Accepted

simple udev rule not recognizing my drive by uuid

You need to have your rule run after the built-in rule which learns the UUID in the first place. i.e. Mine was /etc/udev.rules/30-foo.rules, but changing it to "zz-foo.rules" worked like a charm ...
fermulator's user avatar
2 votes
Accepted

How does Ethernet interface appear in IP link command

There's no command. It isn't done by userspace in the first place – it's done entirely by the card's Ethernet driver, which uses register_netdev() from the kernel's "net" subsystem to make a new ...
grawity_u1686's user avatar
2 votes

How do I use ENV{SYSTEMD_USER_WANTS}= in udev rule?

You can try replacing SYSTEMD_USER_WANTS with MANAGER_USER_WANTS. I'm not 100% sure about this name change, but at least in systemd-226 there is no mention of SYSTEMD_USER_WANTS in the sources any ...
Pavel Procopiuc's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible