You are not logged in.

#1 2020-02-16 22:09:04

freefreeno
Member
Registered: 2019-03-07
Posts: 35

Udev rules errors in boot logs "No such file or directory"

I have three udev rules I need to run properly. One is to blacklist a Broadcom smartcard that doesn't have a driver anyways. One is to change IO scheduler to bfq and one is to write "unmap" to external uas nvme drive enclosure so that trim will work on it. In my logs I am seeing these errors.

Feb 16 13:05:46 archlinux systemd-udevd[373]: nvme0n1p1: /etc/udev/rules.d/60-ioschedulers.rules:2 Failed to write ATTR{/sys/devices/pci0000:00/0000:00:1b.0/0000:02:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/queue/scheduler}, ignoring: No such file or directory
Feb 16 13:05:46 archlinux systemd-udevd[364]: nvme0n1p2: /etc/udev/rules.d/60-ioschedulers.rules:2 Failed to write ATTR{/sys/devices/pci0000:00/0000:00:1b.0/0000:02:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/queue/scheduler}, ignoring: No such file or directory
Feb 16 13:05:46 archlinux systemd-udevd[364]: nvme0n1p3: /etc/udev/rules.d/60-ioschedulers.rules:2 Failed to write ATTR{/sys/devices/pci0000:00/0000:00:1b.0/0000:02:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/queue/scheduler}, ignoring: No such file or directory

/etc/udev/rules.d/60-ioschedulers.rules
# set scheduler for NVMe
ACTION=="add|change", KERNEL=="nvme[0-9]*", ATTR{queue/scheduler}="bfq"
# set scheduler for SSD and eMMC
ACTION=="add|change", KERNEL=="sd[a-z]|mmcblk[0-9]*", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="bfq"

# UAS rules and I used instructions from arch wiki
https://wiki.archlinux.org/index.php/Solid_state_drive

[josh@archlinux ~]$ lsusb
Bus 004 Device 002: ID 14b0:0203 StarTech.com Ltd. USB to NVMe Enclosure
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 0a5c:5842 Broadcom Corp. 58200
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

/etc/udev/rules.d/10-uas-discard.rules
ACTION=="add|change", ATTRS{idVendor}=="14b0", ATTRS{idProduct}=="0203", SUBSYSTEM=="scsi_disk", ATTR{provisioning_mode}="unmap"

This does not work but I can use :
su
echo "unmap" >/sys/block/sda/device/scsi_disk/*/provisioning_mode

then I can trim disk

Also in journal I see
/etc/udev/rules.d/10-uas-discard.rules:1 Invalid key/value pair, ignoring

# A rule I wrote to block my smartcard because there isnt a driver for it so I figured just block it

/etc/udev/rules.d/62-smartcard-block.rules

If you look at the output of lsusb above it is the broadcom Corp 58200

# Dell Broadcom based HCI should be disabled
SUBSYSTEM=="usb", ATTRS{idVendor}=="0a5c", ATTRS{idProduct}=="5842", ATTR{authorized}="0"

Errors I see in logs

Feb 16 16:31:36 archlinux systemd-udevd[393]: 1-10:1.0: /etc/udev/rules.d/62-smartcard-block.rules:2 Failed to write ATTR{/sys/devices/pci0000:00/0000:00:14.0/usb1/1-10/1-10:1.0/authorized}, ignoring: No such file or directory
Feb 16 16:31:36 archlinux systemd-udevd[398]: 1-10:1.1: /etc/udev/rules.d/62-smartcard-block.rules:2 Failed to write ATTR{/sys/devices/pci0000:00/0000:00:14.0/usb1/1-10/1-10:1.1/authorized}, ignoring: No such file or directory

Any more info needed then I am happy to give it. Thanks for any help

Last edited by freefreeno (2020-02-17 20:40:24)

Offline

#2 2020-02-16 22:13:16

loqs
Member
Registered: 2014-03-06
Posts: 18,928

Re: Udev rules errors in boot logs "No such file or directory"

You have not included the contents of /etc/udev/rules.d/60-ioschedulers.rules or where you obtained it from.  It is incorrectly matching partitions.
Please also use code tags for commands,  their outputs,  file contents e.t.c.

Offline

#3 2020-02-16 22:29:12

freefreeno
Member
Registered: 2019-03-07
Posts: 35

Re: Udev rules errors in boot logs "No such file or directory"

Sorry also I am gonna reboot and get the other errors also.

Offline

#4 2020-02-16 23:35:10

loqs
Member
Registered: 2014-03-06
Posts: 18,928

Re: Udev rules errors in boot logs "No such file or directory"

Is the NVME devices scheduler changed correctly with the rule as is?
Is the * in the NVME rule matching any amount of anything?  What if you remove it?  Not ideal the rule then applies to only the first ten NVME devices.

ACTION=="add|change", KERNEL=="nvme[0-9]", ATTR{queue/scheduler}="bfq"

Last edited by loqs (2020-02-16 23:35:31)

Offline

#5 2020-02-17 06:09:41

freefreeno
Member
Registered: 2019-03-07
Posts: 35

Re: Udev rules errors in boot logs "No such file or directory"

[josh@archlinux ~]$ cat /sys/block/*/queue/scheduler
mq-deadline kyber [bfq] none
mq-deadline kyber [bfq] none


Yes the scheduler has been changed for both the USB UAS drive and the nvme inside the laptop even though I get this error every boot. I just followed the wiki on this and I also checked this on several different articles and they also list the same rule. If it is wrong I cannot find where.

Last edited by freefreeno (2020-02-17 06:11:59)

Offline

#6 2020-02-17 09:27:56

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

Re: Udev rules errors in boot logs "No such file or directory"

It tries to change the schedulers on a partition level, which doesn't work. So "proper" would be

ACTION=="add|change", KERNEL=="nvme[0-9]n[0-9]", ATTR{queue/scheduler}="bfq"

(not on my system so can't actively verify, would adjust the wiki otherwise)

Offline

#7 2020-02-17 17:15:08

freefreeno
Member
Registered: 2019-03-07
Posts: 35

Re: Udev rules errors in boot logs "No such file or directory"

Is this also wrong in the wiki ???
ACTION=="add|change", KERNEL=="sd[a-z]|mmcblk[0-9]*", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="bfq"

Also any help with the other two rules would be greatly appreciated.

This rule is supposed to mark my external nvme drive with unmap but it doesn't.
ACTION=="add|change", ATTRS{idVendor}=="14b0", ATTRS{idProduct}=="0203", SUBSYSTEM=="scsi_disk", ATTR{provisioning_mode}="unmap"

This rule gives this error.
/etc/udev/rules.d/10-uas-discard.rules:1 Invalid key/value pair, ignoring

###############################################################

This rule should disable the smartcard but it does not and it recives errors.

# Dell Broadcom based HCI should be disabled
SUBSYSTEM=="usb", ATTRS{idVendor}=="0a5c", ATTRS{idProduct}=="5842", ATTR{authorized}="0"

This rule also:
1-10:1.0: /etc/udev/rules.d/62-smartcard-block.rules:2 Failed to write ATTR{/sys/devices/pci0000:00/0000:00:14.0/usb1/1-10/1-10:1.0/authorized}, ignoring: No such file or directory

You can see the output of lsusb above in first post.
I thought from my reading that all these rules should have worked.

Last edited by freefreeno (2020-02-17 18:15:34)

Offline

#8 2020-02-17 17:21:58

loqs
Member
Registered: 2014-03-06
Posts: 18,928

Re: Udev rules errors in boot logs "No such file or directory"

Did the rule suggested by V1del work?
Another possible alternative would be to also require the match has a queue/scheduler attribute could also use queue/rotational.

ACTION=="add|change", KERNEL=="nvme[0-9]*", ATTR{queue/scheduler}=="bfq|kyber|mq-deadline|none", ATTR{queue/scheduler}="bfq

Offline

#9 2020-02-17 18:06:52

freefreeno
Member
Registered: 2019-03-07
Posts: 35

Re: Udev rules errors in boot logs "No such file or directory"

I haven't rebooted yet. I was wanting to try to make all the changes first but I am getting errors for this also. I have an external nvme that shows up as sda so that is the need for this one too. I like all my disk set to bfq.

# set scheduler for SSD and eMMC
ACTION=="add|change", KERNEL=="sd[a-z]|mmcblk[0-9]*", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="bfq"

Last edited by freefreeno (2020-02-17 18:09:09)

Offline

#10 2020-02-17 18:16:38

loqs
Member
Registered: 2014-03-06
Posts: 18,928

Re: Udev rules errors in boot logs "No such file or directory"

I mentioned in post #8 matching against queue/rotational which the SSD/eMMC rules uses and you did not report any errors from that rule.

Offline

#11 2020-02-17 18:35:14

freefreeno
Member
Registered: 2019-03-07
Posts: 35

Re: Udev rules errors in boot logs "No such file or directory"

You are correct no errors for this rule although I was wondering if there needs to be anything changed on it since I also took it from the wiki but all the errors I am showing for these rules are three errors. The rule to disable the smartcard reader and the nvme rule and the rule to make external nvme enclosure trimmable.

Offline

#12 2020-02-17 20:19:51

loqs
Member
Registered: 2014-03-06
Posts: 18,928

Re: Udev rules errors in boot logs "No such file or directory"

For the second issue

echo 'ACTION=="add|change", ATTRS{idVendor}=="14b0", ATTRS{idProduct}=="0203", SUBSYSTEM=="scsi_disk", ATTR{provisioning_mode}="unmap"

Why does the rule start

echo '

For the third issue try changing

SUBSYSTEM=="usb", ATTRS{idVendor}=="0a5c", ATTRS{idProduct}=="5842", ATTR{authorized}="0"

to

ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0a5c", ATTRS{idProduct}=="5842",  RUN="/bin/sh -c 'echo 0 >/sys/\$devpath/authorized'"

reference https://unix.stackexchange.com/question … nvironment

Offline

#13 2020-02-17 20:40:39

freefreeno
Member
Registered: 2019-03-07
Posts: 35

Re: Udev rules errors in boot logs "No such file or directory"

This is not what I have in the actual file.
echo 'ACTION=="add|change", ATTRS{idVendor}=="14b0", ATTRS{idProduct}=="0203", SUBSYSTEM=="scsi_disk", ATTR{provisioning_mode}="unmap"
The actual rule:
ACTION=="add|change", ATTRS{idVendor}=="14b0", ATTRS{idProduct}=="0203", SUBSYSTEM=="scsi_disk", ATTR{provisioning_mode}="unmap"

Offline

#14 2020-02-17 20:50:58

loqs
Member
Registered: 2014-03-06
Posts: 18,928

Re: Udev rules errors in boot logs "No such file or directory"

What is the output from testing the rule for the second issue.

Offline

#15 2020-02-17 21:12:08

freefreeno
Member
Registered: 2019-03-07
Posts: 35

Re: Udev rules errors in boot logs "No such file or directory"

I rebooted and all errors are gone as far as the rules go but now I see:
1-10:1.0: Process '/bin/sh -c 'echo 0 >/sys/\/devices/pci0000:00/0000:00:14.0/usb1/1-10/1-10:1.0/authorized'' failed with exit code 1.

and I don't believe I had this before. Let me see how to test with your link but the errors I had before are gone.

This is working and it may have been my fault on this one. It was not being automatically mounted at boot so I would think that would cause a problem. For people who need this info this is trim a external nvme drive that reports to kernel it is not supported but it is supported.
/etc/udev/rules.d/10-uas-discard.rules

ACTION=="add|change", ATTRS{idVendor}=="14b0", ATTRS{idProduct}=="0203", SUBSYSTEM=="scsi_disk", ATTR{provisioning_mode}="unmap"

This is working for sure because I can run manual trim and it now trims all my partitions.

##
This is properly setting the IO scheduler on both the external and the internal.

# set scheduler for NVMe
ACTION=="add|change", KERNEL=="nvme[0-9]n[0-9]", ATTR{queue/scheduler}="bfq"
# set scheduler for SSD and eMMC
ACTION=="add|change", KERNEL=="sd[a-z]|mmcblk[0-9]*", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="bfq"

I can not figure out the smart card rule yet but I am still trying but the other two are now correct I believe so thanks. The new error I am geting is from this rule I am pretty sure. As far as testing the second rule it works because I can trim device.

Last edited by freefreeno (2020-02-17 22:00:33)

Offline

Board footer

Powered by FluxBB