You are not logged in.

#1 2020-10-24 10:07:53

mkkot
Member
From: Poland
Registered: 2009-12-20
Posts: 288

ACLs not applied on device by udev on user login

Hi all,
so there is a usb scanner:

Bus 001 Device 003: ID 055f:021e Mustek Systems, Inc. BearPaw 1200 TA/CS

and a logged in user, registered in loginctl:

[mk@linux ~]$ loginctl session-status
1 - mk (1000)
           Since: Sat 2020-10-24 09:57:45 CEST; 8s ago
          Leader: 530 (lxdm-session)
            Seat: seat0; vc1
             TTY: tty1
         Service: lxdm; type x11; class user
           State: active
            Unit: session-1.scope
                  ├─530 /usr/lib/lxdm/lxdm-session
                  ├─539 xfce4-session
                  ├─625 /usr/bin/ssh-agent -s
                  ├─630 xfwm4
[...]

The scanner device file should have ACLs enabled for my user, so I can use the scanner:

getfacl  /dev/bus/usb/001/003
getfacl: Removing leading '/' from absolute path names
# file: dev/bus/usb/001/003
# owner: root
# group: scanner
user::rw-
user:mk:rw- <<<<<<<< HERE
group::rw-
mask::rw-
other::r--

It comes from the fact that udev runs following rules on this device:

udevadm info --query=path --name=/dev/bus/usb/001/003
/devices/pci0000:00/0000:00:02.1/0000:01:00.0/usb1/1-6

udevadm test  /devices/pci0000:00/0000:00:02.1/0000:01:00.0/usb1/1-6
[...]
Reading rules file: /usr/lib/udev/rules.d/49-sane.rules
# Mustek BearPaw 1200 CS | Mustek BearPaw 1200 TA
ATTRS{idVendor}=="055f", ATTRS{idProduct}=="021e", MODE="0664", GROUP="scanner", ENV{libsane_matched}="yes"
[...]
Reading rules file: /usr/lib/udev/rules.d/70-uaccess.rules
# SCSI and USB scanners
ENV{libsane_matched}=="yes", TAG+="uaccess"

Reading rules file: /usr/lib/udev/rules.d/73-seat-late.rules
TAG=="uaccess", ENV{MAJOR}!="", RUN{builtin}+="uaccess"
[...]

DEVPATH=/devices/pci0000:00/0000:00:02.1/0000:01:00.0/usb1/1-6
DEVNAME=/dev/bus/usb/001/003
DEVTYPE=usb_device
DRIVER=usb
PRODUCT=55f/21e/100
[...]
ACTION=add
[...]
ID_MODEL_FROM_DATABASE=BearPaw 1200 TA/CS
[...]
run: '/bin/sh -c 'if test -e /sys//devices/pci0000:00/0000:00:02.1/0000:01:00.0/usb1/1-6/power/control; then echo on > /sys//devices/pci0000:00/0000:00:02.1/0000:01:00.0/usb1/1-6/power/control; elif test -e /sys//devices/pci0000:00/0000:00:02.1/0000:01:00.0/usb1/1-6/power/level; then echo on > /sys//devices/pci0000:00/0000:00:02.1/0000:01:00.0/usb1/1-6/power/level; fi''
run: 'uaccess' <<< HERE ACLs should be applied
Unload module index
Unloaded link configuration context.

The problem is that after the boot and login the permissions look like that:

getfacl  /dev/bus/usb/001/003
getfacl: Removing leading '/' from absolute path names
# file: dev/bus/usb/001/003
# owner: root
# group: scanner
user::rw-
group::rw-
other::r--

There is no user mk with write access and the scanner is not detected.

If I run:

sudo udevadm trigger -c add /dev/bus/usb/001/003

Then the permissions are set correctly:

getfacl  /dev/bus/usb/001/003
getfacl: Removing leading '/' from absolute path names
# file: dev/bus/usb/001/003
# owner: root
# group: scanner
user::rw-
user:mk:rw- << IT IS HERE AS IT'S SUPPOSED TO BE
group::rw-
mask::rw-
other::r--

The same happens if I physically replug the device.

The question is why it doesn't happen automatically on user login?

Offline

#2 2020-12-06 09:45:31

DeletedUser210826
Banned
Registered: 2020-02-01
Posts: 70

Re: ACLs not applied on device by udev on user login

Hello,

I am not sure if it's related to this, but I have an udev rule to disable mouse wakeup:

ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c534", ATTR{power/wakeup}="disabled"

It doesn't work when the system boots, but it does if I replug the device. Is there any solution to this ?

Offline

#3 2020-12-06 09:47:29

mkkot
Member
From: Poland
Registered: 2009-12-20
Posts: 288

Re: ACLs not applied on device by udev on user login

Offline

#4 2020-12-06 09:57:11

DeletedUser210826
Banned
Registered: 2020-02-01
Posts: 70

Re: ACLs not applied on device by udev on user login

Thanks for the quick reply.

I tried to use ACTION!="remove" but it doesn't work anyway. Is there something else I should do ?

Offline

#5 2020-12-06 09:59:40

mkkot
Member
From: Poland
Registered: 2009-12-20
Posts: 288

Re: ACLs not applied on device by udev on user login

ACTION=="remove":
https://gitlab.com/marcin2006/backends/ … 20a70a3185

Last edited by mkkot (2020-12-06 10:19:56)

Offline

#6 2020-12-06 11:06:23

DeletedUser210826
Banned
Registered: 2020-02-01
Posts: 70

Re: ACLs not applied on device by udev on user login

In that case it does not work, and obviously it stops working in case of replug.

Thanks for the help anyway.

Offline

#7 2020-12-06 11:16:36

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,231

Re: ACLs not applied on device by udev on user login

davc0n you seem to have a different issue, which is why the confusion arises.

I'd say try ACTION=="add|change" if that doesn't help, I suggest you open a new thread for your issue.

Offline

#8 2020-12-06 12:23:04

mkkot
Member
From: Poland
Registered: 2009-12-20
Posts: 288

Re: ACLs not applied on device by udev on user login

Yes, I was living in a conviction that davc0n is having a problem with a scanner.
@V1del the ACTION!="remove" is recommended because ACTION=="add|change" does not include "bind" action (and I think few others).

About the mouse rule, just guessing but I would try:

ACTION!="remove", SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c534"

Offline

#9 2020-12-06 14:32:03

DeletedUser210826
Banned
Registered: 2020-02-01
Posts: 70

Re: ACLs not applied on device by udev on user login

V1del wrote:

davc0n you seem to have a different issue, which is why the confusion arises.

I'd say try ACTION=="add|change" if that doesn't help, I suggest you open a new thread for your issue.

Agree, we are definately off topic. I guess ACTION!="remove" includes this, and didn't work.

Thanks for the help though.

Offline

Board footer

Powered by FluxBB