# Do not edit this file, it will be overwritten on update. # This file contains *depecrated* rules kept only for backward # compatibility reasons. Indeed upstream has the bad habit to change # symlink naming schemes hence breaking systems using the old schemes. # # If your system uses one of the symlinks generated by these compat # rules (usually in /etc/fstab), we encourage you to replace the # relevant paths with the new ones (symlinks generated by # 60-persistent-storage.rules). # # You might check if your system relies on one of those compat symlinks # by disabling their creation at boot time. To do so, append # "udev.compat_symlink_generation=0" to the kernel command line. If # your system works flawlessly, there's a good chance that your system # doesn't rely on them and they could be disabled permanently. # # Thanks ! # # Note: this rules file can rely on all ID_* variables (set by # 60-persistent-storage.rule) but should not overwrite them, see # bsc#1048679 for details. ACTION=="remove", GOTO="persistent_storage_end" SUBSYSTEM!="block", GOTO="persistent_storage_end" KERNEL!="nvme*|sd*", GOTO="persistent_storage_end" # ignore partitions that span the entire disk TEST=="whole_disk", GOTO="persistent_storage_end" # # The compat symlink generation number can be specified through the kernel # command line and in that case it will take precedence. # # Note: any non-supported values (including "0") will disable all generations # whereas no values specified will be equivalent to a value "1" and therefore # will request the creation of all compat symlinks (whatever their age). # IMPORT{cmdline}="udev.compat_symlink_generation" ENV{COMPAT_SYMLINK_GENERATION}="$env{udev.compat_symlink_generation}" # # Systems without the compat-symlinks-generation file are systems # installed before compat rules were created. They might be using # one of those compat symlinks (can be any generation). # ENV{COMPAT_SYMLINK_GENERATION}!="?*", IMPORT{file}="/usr/lib/udev/compat-symlink-generation" ENV{COMPAT_SYMLINK_GENERATION}!="?*", ENV{COMPAT_SYMLINK_GENERATION}="1" # # Generation #1 # ENV{COMPAT_SYMLINK_GENERATION}!="1", GOTO="generation_2" # NVMe symlinks were introduced by a SUSE specific commit (bsc#944132) which # relied on scsi_id (unfortunately) and hence used the NVMe SCSI translation # layer. Later upstream added (by-id) symlinks for NVMe as well but reads the # device properties from its sysfs attributes instead. The symlinks names # generated in both cases are not identical so we still have to generate the # old ones for backward compatibly reasons. # # The SCSI translation layer for NVMe devices has been removed from the kernel # since 4.13, therefore we had to drop the use of scsi_id and use the sysfs # interface to mimic scsi_id and continue to generate the old compat symlinks. # # The rules below hopefully mimics the main cases only as it's impossible to # re-implement the exact behavior of scsi_id via udev rules. # # scsi_id acted differently depending on the NVMe revision implemented by a # device, which can lead to problems if the device firmware is # updated. Therefore symlinks for all NVMe revisions are generated now. # # Extra care is needed for whitespace handling. For example we can't use # %s{model} to retrieve the model string because udev strips any trailing # whitespaces and some plateforms (QEMU does that) might append such chars. In # those cases scsi_id was replacing them with a single trailing '_'. Therefore # the currently code retrieves the model string manually making sure to # preserve all characters so trailing whitespaces are still converted when the # symlink is created. KERNEL=="nvme*", ENV{DEVTYPE}=="disk", ENV{ID_NVME_EUI_COMPAT}!="?*", ATTRS{eui}=="?*", ATTRS{eui}!="0000000000000000", \ PROGRAM=="/bin/sh -c 'eui=\"%s{eui}\"; echo $${eui// /}", ENV{ID_NVME_EUI_COMPAT}="2%c" KERNEL=="nvme*", ENV{DEVTYPE}=="disk", ENV{ID_NVME_NGUID_COMPAT}!="?*", ATTRS{nguid}=="?*", \ PROGRAM=="/bin/sh -c 'nguid=\"%s{nguid}\"; echo $${nguid//-/}", ENV{ID_NVME_NGUID_COMPAT}="%c" KERNEL=="nvme*", ENV{DEVTYPE}=="disk", ENV{ID_NVME_SERIAL_COMPAT}!="?*", ATTRS{model}=="?*", ATTRS{serial}=="?*", \ PROGRAM=="/bin/sh -c ' \ cd /sys/%p; \ while ! [ -f model ]; do \ cd ..; \ [ $$(pwd) = %S ] && exit 1; \ done; \ cut -c 1-16 model'", ENV{ID_NVME_SERIAL_COMPAT}="SNVMe_%c%s{serial}" KERNEL=="nvme*", ENV{DEVTYPE}=="disk", ENV{ID_NVME_EUI_COMPAT}=="?*", SYMLINK+="disk/by-id/nvme-$env{ID_NVME_EUI_COMPAT}" KERNEL=="nvme*", ENV{DEVTYPE}=="disk", ENV{ID_NVME_NGUID_COMPAT}=="?*", SYMLINK+="disk/by-id/nvme-$env{ID_NVME_NGUID_COMPAT}" KERNEL=="nvme*", ENV{DEVTYPE}=="disk", ENV{ID_NVME_SERIAL_COMPAT}=="?*", SYMLINK+="disk/by-id/nvme-$env{ID_NVME_SERIAL_COMPAT}" KERNEL=="nvme*", ENV{DEVTYPE}=="partition", ENV{ID_NVME_EUI_COMPAT}=="?*", SYMLINK+="disk/by-id/nvme-$env{ID_NVME_EUI_COMPAT}-part%n" KERNEL=="nvme*", ENV{DEVTYPE}=="partition", ENV{ID_NVME_NGUID_COMPAT}=="?*", SYMLINK+="disk/by-id/nvme-$env{ID_NVME_NGUID_COMPAT}-part%n" KERNEL=="nvme*", ENV{DEVTYPE}=="partition", ENV{ID_NVME_SERIAL_COMPAT}=="?*", SYMLINK+="disk/by-id/nvme-$env{ID_NVME_SERIAL_COMPAT}-part%n" # Leap 42.3 ISO has a version of udev which suffers from bsc#1048679 # (ID_SERIAL is set by the upstream rules making ID_BUS empty instead # of "nvme"). This lead to those odd symlinks with the "nvme" prefix # missing (bsc#1063249). # # They are actually only used by systems with Leap 42.3 initially # installed and with NVMe encrypted partitions. KERNEL=="nvme*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/-$env{ID_SERIAL}" KERNEL=="nvme*", ENV{DEVTYPE}=="partition", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/-$env{ID_SERIAL}-part%n" # SCSI compat links for ATA devices, removed by f6ba1a468cea (boo#769002) KERNEL=="sd*[!0-9]", ENV{ID_BUS}=="ata", PROGRAM=="scsi_id --whitelisted --replace-whitespace -p0x80 -d $devnode", RESULT=="?*", ENV{ID_SCSI_COMPAT}="$result", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}" KERNEL=="sd*[0-9]", ENV{ID_SCSI_COMPAT}=="?*", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}-part%n" # by-path (parent device path, compat version, only for ATA/NVMe/SAS bus) (bnc#916420) ENV{DEVTYPE}=="disk", ENV{ID_BUS}=="ata|nvme|scsi", DEVPATH!="*/virtual/*", IMPORT{program}="path_id_compat --compat=1 %p" ENV{DEVTYPE}=="disk", ENV{ID_PATH_COMPAT1}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH_COMPAT1}" ENV{DEVTYPE}=="partition", ENV{ID_PATH_COMPAT1}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH_COMPAT1}-part%n" # This restores the symlinks for SAS disks removed by 66bba0e701b95dc42e (bsc#1040153) ENV{DEVTYPE}=="disk", ENV{ID_BUS}=="ata|nvme|scsi", DEVPATH!="*/virtual/*", IMPORT{program}="path_id_compat --compat=2 %p" ENV{DEVTYPE}=="disk", ENV{ID_PATH_COMPAT2}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH_COMPAT2}" ENV{DEVTYPE}=="partition", ENV{ID_PATH_COMPAT2}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH_COMPAT2}-part%n" # # Generation #2 # LABEL="generation_2" ENV{COMPAT_SYMLINK_GENERATION}!="1|2", GOTO="persistent_storage_end" # Currently no compat links of generation 2 LABEL="persistent_storage_end"