Re: [systemd-devel] systemd-udevd -any way to list triggered rules with their files etc ?

2022-10-10 Thread Lennart Poettering
On Mo, 03.10.22 02:17, Branko (bran...@avtomatika.com) wrote:

> cat /etc/udev/rules.d/99-zz-network.rules:
> ACTION=="add", DRIVERS=="?*", ATTR{address}=="11:22:33:44:55:66",
> NAME="wlan17", OWNER="chosen_user", GROUP="chosen_group",
> MODE="0666"

ACTION="add" is almost always the wrong expression. Because devices
will be triggered via "change" and similar, and thus your props will
be dropped again once that happens.

You want ACTION!="remove" instead, i.e. match all "positive" events,
i.e. where the device is still there afterwards (which is
systematically different from "remove" where it isn't).

> I know it does get triggered, since after replugging the WIFi stick I
> do get "wlan17" interface.But resulting created device in
> /dev/bus/usb/00x/00y gets created with MODE=0640 and root:usb

As mentioned elsewhere, what's a usbfs file, not a netif. network
interfaces have no ownership concept.

> I'm at a loss here. How is one supposed to get more detailed info on
> what's and WHY is going on with systemd-udevd tree processing ?

if you boot up with "debug" you should get tons of debug output to
wade through.

Lennart

--
Lennart Poettering, Berlin


Re: [systemd-devel] systemd-udevd -any way to list triggered rules with their files etc ?

2022-10-03 Thread Branko
On Mon, 3 Oct 2022 07:20:44 +0200
Greg KH  wrote:

> 
> Network devices do not have a group/owner/mode at all.
> 
> > I know it does get triggered, since after replugging the WIFi stick
> > I do get "wlan17" interface.But resulting created device in
> > /dev/bus/usb/00x/00y gets created with MODE=0640 and root:usb  
> 
> That is the usbfs device node, not the network device.  If this is a
> network device, why do you care about the usbfs connection to the
> device and not the normal network device name?
> 

Thanks, I've figured that one in the meantime myself.
Still, it would be nice if there was a way to see which rules were hit,
when and why.

And if possible, similar tool for .link files. 
As it is now, I had to enter custom udev rules to rename my nics.
Name="xyz" settings in link file wouldn't do it for me and I don't
remember being able to get any clue on the reason from systemd-udevd.

I'm sure there are plenty of cases where this could come very handy.



Re: [systemd-devel] systemd-udevd -any way to list triggered rules with their files etc ?

2022-10-02 Thread Greg KH
On Mon, Oct 03, 2022 at 02:17:04AM +, Branko wrote:
> 
> cat /etc/udev/rules.d/99-zz-network.rules:
> ACTION=="add", DRIVERS=="?*", ATTR{address}=="11:22:33:44:55:66",
> NAME="wlan17", OWNER="chosen_user", GROUP="chosen_group", MODE="0666"

Network devices do not have a group/owner/mode at all.

> I know it does get triggered, since after replugging the WIFi stick I
> do get "wlan17" interface.But resulting created device in
> /dev/bus/usb/00x/00y gets created with MODE=0640 and root:usb

That is the usbfs device node, not the network device.  If this is a
network device, why do you care about the usbfs connection to the device
and not the normal network device name?

thanks,

greg k-h


[systemd-devel] systemd-udevd -any way to list triggered rules with their files etc ?

2022-10-02 Thread Branko
I have heap of problems with udev on systemd.

How is one supposed to troubleshoot rule processing ?

I did do "udevadm control --log-level=debug" and tried to modify
systemd-udevd.service, so that it forks-off just one chiled ( so tha
the log is easier to read), but that still doesn't tell me what was
triggered, where and why.

All I get in the log is that it mentions sime rules files in processing
chain that happened to to contain some rule that had an IMPORT an
that's it

Now I have an USB WiFi dongle that I can persuade udev to rename BUT I
can't set its OWNER, GROUP OR MODE.

That is, within the same rule in my file in /etc/udev/rules.d, NAME gets
applied in the end result, but OWNER,GROUP and MODE do not.

I don't have a clue why. 
"udevadm test /sys/devices/pcie_path_to_my_device_node" shows me pretty 
much just the list of rule files that were read, few
lines about IMPORT buildin calls and resulting attributes.

On that list, my custom rule file in /etc/udev/rules.d IS listed at the
end of the chain as it should be.

Just to be sure, I removed my .link file for WI-Fi USB stick so that
there is no processing outside udev tree chain and I linked
/etc/systemd/network/99-default.link to /dev/null to prevent default
settings just in case.

cat /etc/udev/rules.d/99-zz-network.rules:
ACTION=="add", DRIVERS=="?*", ATTR{address}=="11:22:33:44:55:66",
NAME="wlan17", OWNER="chosen_user", GROUP="chosen_group", MODE="0666"

I know it does get triggered, since after replugging the WIFi stick I
do get "wlan17" interface.But resulting created device in
/dev/bus/usb/00x/00y gets created with MODE=0640 and root:usb

I'm at a loss here. How is one supposed to get more detailed info on
what's and WHY is going on with systemd-udevd tree processing ?