Udev On CentOS7 – Can’t Get A Match, Looking For Tips…

Home » CentOS » Udev On CentOS7 – Can’t Get A Match, Looking For Tips…
CentOS 6 Comments

The mtx binary requires my tape library to be assigned a sg# driver, but the kernel periodically renumbers the sg devices. Normally, we would write a udev rule to manually assign a persistent name, but it looks like things have changed as I can’t seem to get a match on CentOS7. I’d appreciate any feedback or pointers to help me get my rule working. My two attempts are below.

cat /etc/udev/rules.d/90-local.rules

KERNEL==”sg[0-9]*”, SUBSYSTEM==”scsi_generic”, \
ENV{ID_SERIAL}==”1QUANTUM_D0H0112430_LLA”, SYMLINK+=”sg8″

SUBSYSTEM==”scsi”, SUBSYSTEMS==”scsi_genric”, \
ATTRS{model}==”Scalar i40-i80 “, SYMLINK:=”sg8”

Neither rule above generates a match with udev, so I still have something wrong. Right now the assignment is sg7 (but it’s had other names in the past.

udevadm info –query=all –name=/dev/sg7
P:
/devices/pci0000:00/0000:00:07.0/0000:04:00.0/0000:05:00.0/0000:06:00.1/host8/rport-8:0-0/target8:0:0/8:0:0:1/scsi_generic/sg7
N: sg7
S: tape/by-id/scsi-1QUANTUM_D0H0112430_LLA
E: DEVLINKS=/dev/tape/by-id/scsi-1QUANTUM_D0H0112430_LLA
E: DEVNAME=/dev/sg7
E:
DEVPATH=/devices/pci0000:00/0000:00:07.0/0000:04:00.0/0000:05:00.0/0000:06:00.1/host8/rport-8:0-0/target8:0:0/8:0:0:1/scsi_generic/sg7
E: ID_MODEL=Scalar_i40-i80
E: ID_MODEL_ENC=Scalar\x20i40-i80\x20\x20
E: ID_REVISION0G
E: ID_SCSI=1
E: ID_SCSI_SERIAL=QUANTUMD0H0112430_LLA
E: ID_SERIAL=1QUANTUM_D0H0112430_LLA
E: ID_SERIAL_SHORT=QUANTUM_D0H0112430_LLA
E: ID_TYPE=generic E: ID_VENDOR=QUANTUM
E: ID_VENDOR_ENC=QUANTUM\x20
E: MAJOR!
E: MINOR=7
E: SUBSYSTEM=scsi_generic E: USEC_INITIALIZED(815292891

Assigned and parent device listed below:
udevadm info -a -p `udevadm info -q path -n /dev/sg7`

looking at device
‘/devices/pci0000:00/0000:00:07.0/0000:04:00.0/0000:05:00.0/0000:06:00.1/host8/rport-8:0-0/target8:0:0/8:0:0:1/scsi_generic/sg7’:
KERNEL==”sg7″
SUBSYSTEM==”scsi_generic”
DRIVER==””

looking at parent device
‘/devices/pci0000:00/0000:00:07.0/0000:04:00.0/0000:05:00.0/0000:06:00.1/host8/rport-8:0-0/target8:0:0/8:0:0:1’:
KERNELS==”8:0:0:1″
SUBSYSTEMS==”scsi”
DRIVERS==”ch”
ATTRS{rev}==”190G”
ATTRS{type}==”8″
ATTRS{scsi_level}==”4″
ATTRS{model}==”Scalar i40-i80 ”
ATTRS{state}==”running”
ATTRS{unpriv_sgio}==”0″
ATTRS{queue_type}==”none”
ATTRS{iodone_cnt}==”0xe2″
ATTRS{iorequest_cnt}==”0xe2″
ATTRS{queue_ramp_up_period}==”120000″
ATTRS{device_busy}==”0″
ATTRS{evt_capacity_change_reported}==”0″
ATTRS{timeout}==”0″
ATTRS{evt_media_change}==”0″
ATTRS{ioerr_cnt}==”0x7″
ATTRS{queue_depth}==”30″
ATTRS{vendor}==”QUANTUM ”
ATTRS{evt_soft_threshold_reached}==”0″
ATTRS{device_blocked}==”0″
ATTRS{evt_mode_parameter_change_reported}==”0″
ATTRS{evt_lun_change_reported}==”0″
ATTRS{evt_inquiry_change_reported}==”0″
ATTRS{dh_state}==”detached”
ATTRS{iocounterbits}==”32″
ATTRS{eh_timeout}==”10″

Would anyone mind pointing out the error in my udev rule or proposing a better way of getting a persistent sg device name?

6 thoughts on - Udev On CentOS7 – Can’t Get A Match, Looking For Tips…

  • In article <7025a0a8-1471-530d-dad0-3770e902ca31@uw.edu>, John H Nyhuis wrote:

    You have a typo: scsi_genric instead of scsi_generic.

    Don’t know if that is the reason.

    Cheers Tony

  • Thanks, I did catch the mistype (after IU posted). Still no match with the typo fixed… :-(

    Thanks,

    John H. Nyhuis Desk: (206)-685-8334
    jnyhuis@uw.edu Box 359461, 15th floor, 106

  • hmmm, I thought := assigned a key just like +=, except := locked it so it could not be changed later. Am I misunderstanding the man page for udev?

    Thanks,

    John H. Nyhuis Desk: (206)-685-8334
    jnyhuis@uw.edu Box 359461, 15th floor, 106

  • Am 30.10.19 um 00:37 schrieb John H Nyhuis:

    Could you try putting the link aside via SYMLINK+=”mytape/mydevice”. Is this feasible for you having it in a sub directory?


    Leon