summaryrefslogtreecommitdiffstats
path: root/rules.d (follow)
Commit message (Collapse)AuthorAgeFilesLines
* udev: revert workarounds for issues caused by the devlink creation optimizationYu Watanabe2023-11-011-11/+0
| | | | | | | | | | | | | | This reverts the following two commits: - "udev: decrease devlink priority for encrypted partitions" c4521fc17bb33d10bf5aca3f87f6a394dfecf423. - "udev: decrease devlink priority for iso disks" df1dccd25547b430258bd42ec60428fc9aff1370. These commits are workarounds for issues caused by 331aa7aa15ee5dd12b369b276f575d521435eb52. With the previous commit, these workarounds are not necessary anymore, as partitions are always processed later than their whole disk, and a decrypted volume is also processed later than its backing volume.
* hwdb,rules: mark host-to-host network devices as only requiring link local ↵Lennart Poettering2023-10-301-0/+15
| | | | | | | | | | | | | | addressing This is a generalization of this logic: https://github.com/NetworkManager/NetworkManager/blob/main/data/90-nm-thunderbolt.rules It applies not just to thunderbolt, but to any kind of device, even matched by vendor/product, via hwdb. I added two entries for Prolific PC-to-PC devices (of which I have one lying around).
* rules: add mtd/by-name symlinksMatthias Schiffer2023-10-172-0/+13
| | | | | | | | Add persistent symlinks for MTD devices like SPI-NOR flash, based on the partition names specified on the cmdline, in a Device Tree, or by other MTD partitioning parser drivers. Using the persistent name can be preferable to using the numbered /dev/mtdX device, as the latter can change depending on probe order or when partitioning has changed.
* 99-systemd.rules.in: tag PTP devices with systemdChris Patterson2023-08-281-0/+2
| | | | | | | | | Chronyd and similar time services, when using PTP devices, may need the BindsTo/After directives to ensure the devices are available before starting. Tag PTP devices with systemd to allow for wider adoption. Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
* udev: re-introduce symlinks for loopback block deviceYu Watanabe2023-08-101-0/+9
| | | | | | | | | | | But the directories are changed from /dev/loop/by-ref/ -> /dev/disk/by-loop-ref/ and /dev/loop/by-inode/ -> /dev/disk/by-loop-inode/. As /dev/loop/ is used by losetup command for other purpose. See issue #28475. This effectively reverts commits 9915cc60868c77e7e8cecb669ddb90516dffc7df, 5022fab15fc16204d163883ca818fd6092dc919c, and c0d998248e10e1dcf18108fdbb70f259acd452eb.
* udev: set ID_NAME and ID_SERIAL to MMC/memstick devices againYu Watanabe2023-08-081-4/+6
| | | | | | Fixes a bug introduced by 998db5871fea331ec00b26a3a3f5271df040a905. Fixes #28671.
* meson: introduce HAVE_DMI flagYu Watanabe2023-08-031-1/+1
| | | | | The condition is used at several places. Let's introduce a simple flag for that.
* udev: decrease devlink priority for encrypted partitionsYu Watanabe2023-08-021-0/+5
| | | | | | Decrease devlink priority for encrypted partitions, and make the priority for decrypted DM devices relatively higher. This is for the case that an encrypted partition and its decrypted DM device have the same label.
* Drop split-usr and unmerged-usr supportLuca Boccassi2023-07-283-4/+4
| | | | | | | | | | As previously announced, execute order 66: https://lists.freedesktop.org/archives/systemd-devel/2022-September/048352.html The meson options split-usr, rootlibdir and rootprefix become no-ops that print a warning if they are set to anything other than the default values. We can remove them in a future release.
* udev: set ID_PATH properties for all pci, usb, and platform devicesYu Watanabe2023-07-251-0/+9
| | | | | | | | | | | | Before c43ff248f94266cfc93e300a2d3d163ed805e55b, the following line in 60-drm.rules also sets ID_PATH for all pci, usb, and platform devices: === ACTION!="remove", SUBSYSTEM=="drm", SUBSYSTEMS=="pci|usb|platform", IMPORT{builtin}="path_id" === Unfortunately, some existing rules rely on the unexpected behavior. To keep the backward compatibility, let's set ID_PATH for them. Fixes #28411.
* udev: decrease devlink priority for iso disksYu Watanabe2023-07-211-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, if the priority is same, devlinks are always replaced by newer events. The commit 331aa7aa15ee5dd12b369b276f575d521435eb52 changes that to keep the existing devlink. That should not change any behavior when the devices that request the same symlink do not have any dependency, e.g. when /dev/sda1 and /dev/adb1 request the same /dev/disk/by-label symlink, as there are no guarantee that which device is processed first. However, when devices has dependency, e.g. /dev/sda and /dev/sda1 request the same /dev/disk/by-label symlink, previously the symlink always pointed to the partition, as the partition is always processed later. But, 331aa7aa15ee5dd12b369b276f575d521435eb52 makes the symlink point to the whole disk. The change by 331aa7aa15ee5dd12b369b276f575d521435eb52 is crucial to improve performance of devlink handling, especially when a system has large number of disks with same label or so. Hence, cannot and should not be reverted. So, let's workaround the case, as such situation should happen only when the disk is a hybrind ISO image, I guess. Fixes #28468.
* Revert "udev: add /dev/loop/ symlinks"Luca Boccassi2023-07-201-9/+0
| | | | | | | | | Turns out this causes a regression and breaks losetup. It will need to be reworked in conjunction with util-linux changes. Fixes https://github.com/systemd/systemd/issues/28475 This reverts commit 5ac52d1f7b7cd11cad8b5c2e9812d7ee7560a517.
* rules: drop weird spacesLennart Poettering2023-06-201-3/+2
|
* rules: split out DMI related rules from udev-default.rulesLennart Poettering2023-06-203-10/+15
| | | | | | | | | | | | The DMI rules where so far guarded by an ACTION=="add" rule, but that doesn't really make sense for setting properties (only for setting access modes/ownership of nodes). Hence let's move this into its own file, that guards properly on ACTION!="remove". Before this change the hardware vendor/model info would be dropped whenever the device was retriggered.
* 99-systemd.rules.in: guard systemd-backlight udev rules by ENABLE_BACKLIGHTSimon Braunschmidt2023-06-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | Linux kernel will, as documented in drivers/video/backlight/backlight.c, report changes to a backlights brightness as a uevent (ACTION=change). systemd-udev will consume the uevent, match on this rule and try to activate the systemd-backlight service for the backlight. BUT when systemd is not compiled with backlight support, this will lead to failure that is reported in the journal. Since the failure to activate systemd-backlight and subsequent failure log entry happens on every backlight brightness change, we found the resulting logspam during regular operation excessive and came up with this patch to mitigate it. The conditional is also extended to "*kbd_backlight" match, since even though we did not investigate to see if the logspam would be similar, the unconditional match to activate systemd-backlight here would also not make sense when the feature is not compiled in. Signed-off-by: Simon Braunschmidt <simon.braunschmidt@iba-group.com>
* udev: introduce .PART_SUFFIX internal propertyYu Watanabe2023-05-261-63/+48
| | | | To make unify rules for disk and partition.
* rules: add rule for accel devicesStanislaw Gruszka2023-05-251-0/+1
| | | | | | | | | | | | Accel (Compute Acceleration) are new devices for AI/ML computation: https://docs.kernel.org/accel/introduction.html They are part of DRM subsystem. Add them to 'render' group since no other appropriate group in standard linux systems exist. This can be changed when proper common user-space components will emerge, and new group for acceleration devices access will be established. Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
* Merge pull request #27483 from yuwata/udev-id-path-usb-revisionZbigniew Jędrzejewski-Szmek2023-05-257-27/+52
|\ | | | | udev: include USB revision in ID_PATH
| * udev: add USB revision in ID_PATHYu Watanabe2023-05-207-22/+41
| | | | | | | | | | | | | | | | | | xHCI host controller may register two (or more?) USB root hubs for USB 2.0 and USB 3.0, and devices under the hubs may have same ID_PATH. So, to avoid the conflict, let's introduce ID_PATH_WITH_USB_REVISION that includes the USB revision. Closes #19406.
| * udev: check existence of property before useYu Watanabe2023-05-201-6/+12
| |
* | rules: start systemd-vconsole-setup via unitZbigniew Jędrzejewski-Szmek2023-05-191-1/+1
|/ | | | | | | | | | | We started systemd-vconsole-setup in two ways: via a dbus call from localed to do systemd-vconsole-setup.service/restart, and from udev, calling the binary directly. This patch makes udev call systemctl restart systemd-vconsole-setup.service effectively implementing the same method as localed. Ordering is implemented at the unit level, so we can use --no-block to not block here.
* udev/iocost: invert DEVTYPE matchYu Watanabe2023-04-261-3/+1
| | | | | No functional change, just refactoring. Addresses https://github.com/systemd/systemd/pull/23325#discussion_r1171006967.
* udev/iocost: use ID_MODEL_FROM_DATABASE if existsYu Watanabe2023-04-261-1/+5
| | | | To make the rule consistent with 'iocost query'.
* Merge pull request #27349 from mrc0mmand/codespellLuca Boccassi2023-04-201-2/+2
|\ | | | | tree-wide: code spelling fixes
| * tree-wide: code spelling fixesFrantisek Sumsal2023-04-201-2/+2
| | | | | | | | As reported by Fossies.
* | Apply known iocost solutions to block devicesGustavo Noronha Silva2023-04-202-0/+21
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Meta's resource control demo project[0] includes a benchmark tool that can be used to calculate the best iocost solutions for a given SSD. [0]: https://github.com/facebookexperimental/resctl-demo A project[1] has now been started to create a publicly available database of results that can be used to apply them automatically. [1]: https://github.com/iocost-benchmark/iocost-benchmarks This change adds a new tool that gets triggered by a udev rule for any block device and queries the hwdb for known solutions. The format for the hwdb file that is currently generated by the github action looks like this: # This file was auto-generated on Tue, 23 Aug 2022 13:03:57 +0000. # From the following commit: # https://github.com/iocost-benchmark/iocost-benchmarks/commit/ca82acfe93c40f21d3b513c055779f43f1126f88 # # Match key format: # block:<devpath>:name:<model name>: # 12 points, MOF=[1.346,1.346], aMOF=[1.249,1.249] block:*:name:HFS256GD9TNG-62A0A:fwver:*: IOCOST_SOLUTIONS=isolation isolated-bandwidth bandwidth naive IOCOST_MODEL_ISOLATION=rbps=1091439492 rseqiops=52286 rrandiops=63784 wbps=192329466 wseqiops=12309 wrandiops=16119 IOCOST_QOS_ISOLATION=rpct=0.00 rlat=8807 wpct=0.00 wlat=59023 min=100.00 max=100.00 IOCOST_MODEL_ISOLATED_BANDWIDTH=rbps=1091439492 rseqiops=52286 rrandiops=63784 wbps=192329466 wseqiops=12309 wrandiops=16119 IOCOST_QOS_ISOLATED_BANDWIDTH=rpct=0.00 rlat=8807 wpct=0.00 wlat=59023 min=100.00 max=100.00 IOCOST_MODEL_BANDWIDTH=rbps=1091439492 rseqiops=52286 rrandiops=63784 wbps=192329466 wseqiops=12309 wrandiops=16119 IOCOST_QOS_BANDWIDTH=rpct=0.00 rlat=8807 wpct=0.00 wlat=59023 min=100.00 max=100.00 IOCOST_MODEL_NAIVE=rbps=1091439492 rseqiops=52286 rrandiops=63784 wbps=192329466 wseqiops=12309 wrandiops=16119 IOCOST_QOS_NAIVE=rpct=99.00 rlat=8807 wpct=99.00 wlat=59023 min=75.00 max=100.00 The IOCOST_SOLUTIONS key lists the solutions available for that device in the preferred order for higher isolation, which is a reasonable default for most client systems. This can be overriden to choose better defaults for custom use cases, like the various data center workloads. The tool can also be used to query the known solutions for a specific device or to apply a non-default solution (say, isolation or bandwidth). Co-authored-by: Santosh Mahto <santosh.mahto@collabora.com>
* Merge pull request #27169 from yuwata/udev-rule-refuse-unsafe-pathZbigniew Jędrzejewski-Szmek2023-04-111-1/+9
|\ | | | | sd-device,udev: refuse unsafe path in SYMLINK= and TAG=
| * rules: drop doubled spaceYu Watanabe2023-04-071-1/+1
| |
| * udev: restore compat symlink for nvme devicesZbigniew Jędrzejewski-Szmek2023-04-071-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 5118e8e71dda211d20e34ec8d3012186ba27d3d3, the rules were changed to add OPTIONS="string_escape=replace" to creation of ENV{ID_SERIAL}="$env{ID_MODEL}_$env{ID_SERIAL_SHORT}", so that "/" would be escaped. But this also changes how the symlink looks for devices that do not have "/". This adds back the old symlink for compat, except when a slash is present. In the meantime, we changed the symlink format to include ${ND_NSID}. Since the symlink with unescaped characters are older than that, for compat we only need to cover the older type. (Symlinks without escaping and with ${ND_NSID} were never created.) This makes it slightly easier on users: the non-deprecated symlinks are with "_${ND_NSID}", so they are easier to distinguish. Fixes #27155. Mostly untested :( I only have a boring nvme device with no special characters in the id, and the symlinks are unchanged for it by this patch.
* | udev/scsi_id: rename positional argumentsYu Watanabe2023-04-102-4/+4
|/
* rules: add whitespace after comma before the line continuationDmitry V. Levin2023-03-271-2/+2
|
* rules: remove stray whitespace before comma between tokensDmitry V. Levin2023-03-271-1/+1
|
* udev-rules: fix nvme symlink creation on namespace changesThomas Blume2023-03-211-0/+8
| | | | | | | | | | The nvme by-id symlink changes to the latest namespace when a new namespace gets added, for example by connecting multiple NVMe/TCP host controllers via nvme connect-all. That is incorrect for persistent device links. The persistent symbolic device link should continue to point to the same NVMe namespace throughout the lifetime of the current boot. Therefore the namespace id needs to be added to the link name.
* udev: add /dev/loop/ symlinksLennart Poettering2023-03-091-0/+11
| | | | | | | | | | | | | | | | | | | | This adds symlinks that allow accessing loopback block devices via stable names that reference their backing block devices, make the unpredictable naming of loopback devices less of an issue. Example: 1. Create a loopback block device for a file $F losetup --find $F 2. Reference the backing block device via its inode: L="$(stat -c '/dev/loop/by-inode/%Hd:%Ld-%i' $F)" fdisk $L In the above the loop device name (which might be /dev/loop47 or any other name) is not used at all.
* rules: do not use blkid builtin if built without blkid supportDmitry V. Levin2023-03-082-1/+3
| | | | | | | | | | When built without blkid, then udev-builtin-blkid is not built, and the verifier warns about the unknown builtin: 60-persistent-storage.rules:114 Unknown builtin command: blkid --hint=session_offset=$env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} 60-persistent-storage.rules:117 Unknown builtin command: blkid --noraid 60-persistent-storage.rules:120 Unknown builtin command: blkid 60-persistent-storage.rules: udev rules check failed
* rules: remove redundant duplicate comparisonsDmitry V. Levin2023-02-251-2/+2
| | | | | | | | | | | | $ grep -F -n -o 'ENV{DISKSEQ}=="?*", ' rules.d/60-persistent-storage.rules 139:ENV{DISKSEQ}=="?*", 139:ENV{DISKSEQ}=="?*", 140:ENV{DISKSEQ}=="?*", 140:ENV{DISKSEQ}=="?*", Reported-by: Alexey Gladkov <legion@kernel.org> Fixes: 17d97d4c90f8 ("udev: create disk/by-diskseq symlink only when the device has diskseq") Fixes: 583dc6d933d8 ("udev: also create partition /dev/disk/by-diskseq/ symlinks")
* meson: Install missing udev ruleJan Janssen2023-01-271-0/+1
|
* udev: also create partition /dev/disk/by-diskseq/ symlinksLennart Poettering2022-12-231-0/+1
|
* rules: add missing line continuationYu Watanabe2022-12-211-1/+1
| | | | | | Fixes a bug introduced by 953c928c24455744d5534679998d129b947a5e04. Fixes #25811.
* udev: rework 60-evdev.rules to be "additive"Zbigniew Jędrzejewski-Szmek2022-12-121-10/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We would execute up to four hwdb match patterns (+ the keyboard builtin): After the first hit, we would skip the other patterns, because of the GOTO="evdev_end" action. 57bb707d48131f4daad2b1b746eab586eb66b4f3 (rules: Add extended evdev/input match rules for event nodes with the same name), added an additional match with ":phys:<phys>:ev:<ev>" inserted. This breaks backwards compatibility for user hwdb patterns, because we quit after the first match. In general hwdb properties are "additive". We often have a general rule that matches a wider class and then some specific overrides. E.g. in this particular case, we have a match for all trackpoints, and then a bunch of model-specific settings. So let's change the rules to try all the match patterns and combine the received properties. We execute builtin-keyboard once at the end, if there was at least one match. Fixes #25698. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2152226. This also impacts other cases which I think would be very confusing for users. Since we quit after a first successful match, if we had e.g. a match for 'evdev:input:b*v*p*' in out database, and the user added a match using 'evdev:name:*', which is the approach we document in the .hwdb files and which users quite often use, it would be silently ignored. What's worse, if we added our 'evdev:input:b*v*p*' match at a later point, user's match would stop working. If we combine all the properties, we get more stable behaviour.
* udev: add safe guard for setting by-id symlinkYu Watanabe2022-11-031-0/+1
| | | | The ID_BUS property is necessary for creating by-id symlinks.
* udev: drop redundant call of usb_id and assignment of ID_USB_INTERFACE_NUMYu Watanabe2022-11-031-2/+0
| | | | | The usb_id builtin command is already called in the above, and the command sets the ID_USB_INTERFACE_NUM property.
* udev: first set properties based on usb subsystemYu Watanabe2022-11-031-2/+3
| | | | | | | | | | After 479da1107a0d4e2f7ef5cd938512b87a0e45f180, the usb_id builtin command does not set ID_SERIAL if ID_BUS is already set. Before the commit, all properties set based on pci bus were overwritten by the usb_id, hence now it is sufficient setting them only when ID_BUS is not set yet. Fixes #25238.
* udev: always create device symlinks for USB disksYu Watanabe2022-10-301-2/+8
| | | | | | | | | Previously, ata_id might not be able to retrieve attributes correctly, and properties from usb_id were used as a fallback. See issue #24921 and PR #24923. To keep backward compatibility, still we need to create symlinks based on USB serial. Fixes #25179.
* udev-builtin-kmod: support to run without argumentsYu Watanabe2022-10-141-1/+1
| | | | | | | | | | | If no module name is provided, then try to load modules based on the device modealias. Previously, MODALIAS property is passed as an argument, but it may contain quotation. Hence, unfortunately the modalias may be modified and cannot load expected modules. Fixes #24715.
* udev/rules: add by-path and by-ibdev links to infiniband verbsLubomir Rintel2022-10-141-0/+12
| | | | | | | | | | The uverbs devices are sequentially numbered and are not guarranteed to stay stable across reboot. At least one good person was disappointed by this, because they couldn't find their device: https://bugzilla.redhat.com/show_bug.cgi?id=2036515 Let's add a few helpful links.
* udev: support by-path devlink for multipath nvme block devicesYu Watanabe2022-09-231-0/+1
| | | | | | | | | | | | | | | If multipath feature is enabled, nvme block devices may belong to the "nvme-subsystem" subsystem, instead of "nvme" subsystem. (What a confusing name...) Then, the syspath is something like the following, /sys/devices/virtual/nvme-subsystem/nvme-subsys0/nvme0n1 Hence, we need to find the 'real parent' device, such as /sys/devices/pci0000:00/0000:00:1c.4/0000:3c:00.0/nvme/nvme0 Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2031810. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2124964. Replaces #24748.
* udev/rules,hwdb: filter out mostly meaningless default stringsYu Watanabe2022-09-051-2/+3
| | | | | | | | | | | | The filter is generated based on the following results: --- git clone git@github.com:linuxhw/DMI.git cd DMI git grep -h -A2 '^System Information$' | grep 'Manufacturer' | sort | uniq -c | sort -nr | less git grep -h -A2 '^System Information$' | grep 'Product Name' | sort | uniq -c | sort -nr | less --- Closes #24446.
* rules: import previous SYSTEMD_READY state for suspended DM devices and skip ↵Michal Sekletar2022-08-191-0/+6
| | | | | | | | | | | other rules We can't get any FS meta-data from a suspended device. Hence defer making any plugged/unplugged decisions, i.e. we just import whatever was previous state and skip processing all other rules. Thanks Lennart Poettering <lennart@poettering.net> for suggesting this solution.
* udev: hwdb: Add rules to match cros-ec-accel by 'location' sysfs fileAlper Nebi Yasak2022-08-181-0/+11
| | | | | | | | | | | | | The cros-ec-accel devices report their mounting location by the 'label' sysfs file only since Linux v6.0. With earlier kernels, a nonstandard 'location' file reports this, but slightly differently (lid instead of display) [1]. Add udev rules to import the correct hwdb entries based on this 'location' file for cros-ec-accel devices, so that the base-mounted accel matrix has the correct value for older kernels as well. [1] https://kernel.org/doc/Documentation/ABI/testing/sysfs-bus-iio-cros-ec