#udev

Coelacanthus 😶‍🌫️ 🏳️‍⚧️coelacanthus@yuuta.moe
2025-10-11

Recently, when I dealt with some package issues around probe-rs, I found that some developers and packagers may have some misunderstandings about #systemd #udev giving some users access permission. systemd udev rules have two kinds of permission mechanisms: one is like chown, which can set the device file's owner to some user or group (normally #plugdev system group); another is #uaccess, systemd will give the active user session permission via ACL.

2025-09-20

Me and my new #yubikey5 part 2:

Now we get to the nitty-gritty parts. I'm using #mbsync to sync multiple #imap accounts to local #maildir and I am automating this via #systemd : a timer calls a service very 5 minutes, that will call mbsync on all mail accounts if connected to the internet.

Providing the passwords via #pass that is encrypted with #yubikey will need that yubikey to be unlocked (i.e. a pin needs to be provided). When providing this pin (e.g. by manually calling mbsync on one of my mail accounts), it will be stored for at least 12h, and up to 24h (on my home pc; mobile and remote devices will of course hav different settings).

However, if I never manually provide the PIN, the systemd automated scripts will fail. E.g. I just connected the key, but not used it.

First I thought, this was due to me using the `curses` version #pinentry . But that's not the whole truth. Even with `pinentry-gtk` the systemd script will not trigger a PIN entry. I didn't quite understand why, and therefore ran a different direction:

Could I just auto-unlock the yubikey if I connected it? I wrote a #udev rule that would recognize the yubikey. Learning that I need to put scripts for udev in certain dirs, and being unhappy with it, I then wrote a systemd service for the udev to call instead, and with that I maanged to finally get a PIN entry request using the gtk version.

And then it got me thinking. Why did that work, but my mailsync that basically has the same things involved (script instead of udev that triggers systemd that wants to decrypt something using yubikey triggering PIN entry). And then it hit me: My mailsync systemd service was missing the `DISPLAY=:0` environment variable, thus the script can't trigger the GUI. Half a days worth of work, all for nothing :picardfacepalm:

But hey, the weekend is young. Next up: If triggered via CLI i want gpg to trigger `pinentry-curses` instead of `pinentry-gtk`. Sounds easy: have a `pinentry-auto` script figuring out where it has been called from. Well... not really #wip

Screenshot of a terminal in background showing a manual triggering of mbsync with one of my mail addresses, and a GTK window in foreground (pinentry-gtk) prompting me to insert the PIN to unlock my Yubikey to decript the passwords provided by the GPG encrypted password store from pass.Full-screen terminal window showing the output from `journalctl -n0 -f` when I plug in the youbikey and wait while for the automatic mailsync service to trigger.

The output shows that while the Yubikey is inserted and properly recognized, when mbsyncer starts it asks for the PIN, but directly gets a `PIN callback returned error: IPC call has been cancelled` message, which in turn makes the decription fail, which leads to a skipping of the account in mbsync. And this will continue for the next 7 mailboxes I own...Termial showing the bat output from the udev rule I wrote:

`ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="1050", ATTR{idProduct}=="0407", TAG+="systemd", ENV{SYSTEMD_USER_WANTS}="yubikey-unlock.service"`

This file lives under: `/etc/udev/rules.d/99-yubikey-unlock.rules`Console with vim showing the content of the new `systemd` service I wrote, which lives in my home dir under: `.config/systemd/user/yubikey-unlock.service`

Content:

```
[Unit]
Description=Yubikey GPG Unlock
After=graphical-session.target

[Service]
Type=oneshot
ExecStart=/bin/bash -c 'TEMP_FILE=$(/usr/bin/mktemp); echo "unlock test" | /usr/bin/gpg --encrypt -r FEE1636BFD47D3E8 > "$TEMP_FILE"; /usr/bin/gpg --quiet --decrypt "$TEMP_FILE" >/dev/null 2>&1; /usr/bin/rm "$TEMP_FILE"'
Environment="DISPLAY=:0"
```

Last line was missing in my mailsync service, which is why the PIN entry did not trigger for fetching mails... you'll never stop learning :D
GripNewsGripNews
2025-07-31

🌗 在 Linux 中斷電時觸發指令
➤ 筆記型電腦安全加固:自訂 udev 規則,電力中斷時執行指令
dataswamp.org/~solene/2025-05-
本文介紹如何在 Linux 系統中,透過 udev 規則偵測電源供應器的狀態變化,進而在電力中斷時自動執行指定的指令,例如關機。作者 Solène Rapenne 分享了詳細的設定步驟、測試方法以及潛在的指令應用,旨在為使用者提供一個簡單有效的筆記型電腦防護機制,尤其是在公共場所使用時。
+ 這個方法很實用,尤其對於常在外面移動工作的人來說,多一層安全保障。
+ 感謝作者分享,udev 規則的應用確實很廣泛,這是我第一次知道可以用來監控電源狀態。

2025-07-31

#UDEV ゴシックフォント、 #Homebrew からインストール出来たのか。
アップデートが降りてくるからこれでインストールしなおした :tony_smiling:

formulae.brew.sh/cask/font-ude

2025-07-20
this felt super counter-productive:

https://github.com/puavo-org/lsiommu/blob/master/udev.c

does libudev have mechanism to get directly a packed representation?

#linux #udev #pci
Guido Güntheragx@ruhr.social
2025-04-27

In case you're using a @frameworkcomputer 13 Laptop and want to use the power LED as status LED for #feedbackd (to be notified aboutnotifications in #phosh, etc) you can use this #udev rule:

gitlab.freedesktop.org/agx/fee

There's a warning as the LED claims to be multicolor but it's not. That warning will go away with the next #feedbackd release.

2025-03-21

Consistent Device Names for USB Disks and Partitions

blog.hardill.me.uk/2025/03/21/

I’ve been playing with a really small scale ZFS server to host volumes shared via NVMEoF and iSCSI. These are then mounted on Virtual Machines or as Physical Volumes in my Kubernetes cluster.

The test server is a Raspberry Pi 4 and 2 identical 64Gb USB flash drives.

The problem with using USB drives is that their device names are assigned based on the order they are inserted or the order […]

#Linux #udev #usb

2025-03-21

Yay, I have defeated the udev demons to work out how give consistent device names to USB sticks, and their partitions.

I will write up this deep black magic after I've been and got dinner and a beer

#linux #udev #usb

moozermoozer
2025-02-14

Any experts out there?

I try to create symlinks from ttyUSBX to something less generic using udev rules based on the physical port (e.g. 2-3:1.0). This works'ish.

Except when udev decides to switch "bus 01" and "bus 02". PCI does not change, only the sequence of USB busses.

This is on a 12 VM under .

How can I lock the bus sequence?

Screenshot of the udev rules intended to create 4 symlinks.
--
root@ed-glr-vm02: ~# cat /etc/udev/rules.d/10-testsetup. rules

# Fed device with 2 trys

IACTION=="add", SUBSYSTEMS=="usb", KERNELS=="2-1:1.0", SYMLINK+="ttyFTDI0"
IACTION=="add", SUBSYSTEMS=="usb", KERNELS=="2-1:1.1", SYMLINK+="ttyFTDI1"
# nanpy port. test device is on port 2

[ACTION==" add", SUBSYSTEMS=="usb", KERNELS=="2-2:1.0, SYMLINK+="ttyTST0"
# device under test is on port 3

JACTION=="add", SUBSYSTEMS=="usb", KERNELS=="2-3:1.2", SYMLINK+="ttyDUTe"
2025-02-11

I have a script called apps.sh that starts all the applications I need at work if they're not yet running.

And script called windowmanager.sh that moves all my application windows into right positions.

In addition I have udev rules that check if I'm connected to my office keyboard or home keyboard and write that information into a file.

Now, I think I could combine these to have fully automatic application/window setup whenever I connect my laptop into a docking station.

Linux <3
#automation #geek #linux #udev #shell #scripts #GNOME #Wayland

2025-01-30

#deskhop now uses a different serial number for each board. This allows to use the same notebook on two different desks each installed with its own deskhop and different keyboards.

#udev now can distinguish between the two keyboard/mouse combinations connected to deskhop. This allow for different setting/keymappings on the two different keyboards.

I added my solution to the original issue.

2025-01-27

Quand c'est pas #systemd qui me prend la tête, c'est #udev . Mais comment ça a fait pour devenir aussi merdique #Linux ? Ça marchait mieux et plus simplement ya 20 ans :(

Ils ont perdu le #KISS les devs ? Faudrait voir à retomber sur terre hein...

Guido Güntheragx@ruhr.social
2025-01-04

I was poking at a #udev regression and while I had used `udevadm test` from distro packages before I only realized today that it can also be used to easily test arbitrary udev versions by building it on the affected system and doing:

_build/udevadm test /sys/class/input/event3

to test the event run and giving about all the necessary details (if needed even with additional debugging added to the code or with breakpoints set).

No need to install anything.

#systemd

instead of going down this route i used #cyanrip (which is already packaged in nixpkgs and generally seems to be a lot simpler but still perfect for my use-case).
then i wrote a simple udev rule to trigger a systemd to start the ripping.
all in all less than 15 lines of code, even though it took me quite some time to get there.
only downside is that the logs don't play that nice with systemd as cyanrip uses carriage return for progress updates.

learning more about #nixos, #systemd and #udev was so much fun, even though i wish there was better documentation.
as i said already some months ago when i started, nixos is the most interesting new-to-me technology i tried in the past few years! so much new stuff to learn and understand!

2024-10-18

Погружаемся в initrd

Приветствую! Меня зовут Валерий, я инженер операционных систем в секторе клиентской и мобильной ОС. Сегодня хочу затронуть фундаментальные вопросы: - процесс загрузки операционной системы в автоматизированное рабочее место (АРМ), - распаковку начального образа оперативной памяти, - подробный разбор initrd, что это такое и с чем его едят. Этот материал поможет понять как природу загрузки ОС Astra Linux Special Edition в частности, так и загрузку GNU/Linux в целом.

habr.com/ru/companies/astralin

#initrd #grub #скрипт #udev #переменные_окружения #каталог #операционная_система #автоматизированное_рабочее_место #оперативная_память

2024-10-09

Ich wollte mir schon lange einen #kvmswitch zulegen und habe mir aus Geiz nur einen USB-Switch geleistet. Und jetzt lerne ich, dass sich Monitore mit #ddcutils steuern lassen. Das heißt es fehlt nur noch ein bisschen Rumschrauben in den #udev-rules und ich kann mit dem popeligen USB-Switch die Eingänge meiner Monitore mit umschalten. Wie cool ist das denn bitte??? :awesome:

Christian HB9HOXhb9hox@mastodon.radio
2024-10-05

I try to give the audio interface of my radio some human friendly name. Using some udev rules, I managed to do so for ALSA using `ATTR{id}`. Now I want the same for graphical applications (like for example in volume control).

I recall that it was possible to set `ENV{SOUND_DESCRIPTION}` which does not work. I am on Linux mint 22 which uses Pipewire.

Can anybody point me into the right direction?

#fedihelp #pipewire #udev #linux #audio

aetios 🔜 eth0 :blobcatnomwatermelon:aetios@sns.minovsky.space
2024-10-04
I found the solution

You can match for udev property names

[Match]
Property="ID_OUI_FROM_DATABASE=Winstars Technology Ltd"


You can find out the properties for your device by using

$ udevadm monitor --property

Read more here: https://www.freedesktop.org/software/systemd/man/254/systemd.link.html#Property=


#linux #systemd #udev
2024-08-23

Разбираемся со сканерами в Linux: Установка и конфигурирование устройства

Продолжение первой части статьи Разбираемся со сканерами в Linux: получение информации об устройстве и поиск подходящего драйвера . Во второй части начнем работать со сканирующим устройством. Разберем, каким образом файлу символьного устройства назначаются права и загружается драйвер (а иногда и модуль), как выполнять диагностику и отладку в случае возникновения проблем, и сведем все возможные проблемы в один список в порядке очередности их решения. Попробуем установить устройство без драйвера. Попробуем

habr.com/ru/companies/astralin

#sane #astra #сканеры #usb #udev #kernel

Thomas Guyot-Sionnestdermoth@noc.social
2024-07-27

@release_candidate @stefano TBH I don't mind since I can change it. What really pissed me off is when #systemd / #udev started loading interfaces in parallel, and since the base name in the kernel hadn't changed (ethN) I could no longer give my interfaces deterministic eth0/eth1 as it would sometimes bring up eth1 while udev tried to rename eth0 to eth1, and so it failed randomly.

I had to change the name to something like ensN. Anything would work, just not the plain old ethN.

Client Info

Server: https://mastodon.social
Version: 2025.07
Repository: https://github.com/cyevgeniy/lmst