Header Shadow Image


LINUX: Persistent naming of SATA devices through UDEV rules.

Here we'll look at obtaining persistent naming rules for SATA devices so we can reference these hardware devices through a constant name.  This is particularly useful when one needs a persistent name to a device through unique serial and model numbers that remains the same throughout reboots / restarts and shutdowns. 

In this post, we'll create six unique naming rules to uniquely identify those HDD we'll need for our RAID6 HTPC+B configuration.  Amongst other things, the rules would help to uniquely identify those devices that belong to the RAID6 array and those that don't to help prevent human error and remove confusion.

The first order of business is, of course, to plug in your hardware that you're going to create the rules for.  In this case, we'll be giving six Seagate HDD drives a unique name to help identify those that belong in a RAID6 array.  A summary of steps follows.  CAUTION: Before reading the below steps, do have a look at the various issues / problems encountered at the end of this article to get a general idea of what to expect:

Item #: Description: Command:
1 Choose the disk you'll need the UDEV rules for.

A handy one liner in my case to use was (Copy and paste the three lines below):

# fdisk -sl 2>&1|awk 'BEGIN { pflg=0; } { if ( ( $0 ~ /sd[abcdefghijkl]/ || \
$0 ~ /Device/ ) ) pflg=1; if ( pflg == 1 && $0 !~ /mapper/ && $0 !~ /valid \
partition table/ ) print; if ( $0 ~ /^[ \r\t\n]*$/ ) pflg=0; }'

This would list all the disks up to sdl including sizes.  For a more brief look, the ls command is handy:

# ls -al /dev/sd*
brw-rw—-. 1 root disk 8,  0 Mar 31 23:29 /dev/sda
brw-rw—-. 1 root disk 8, 16 Mar 31 23:29 /dev/sdb
brw-rw—-. 1 root disk 8, 32 Mar 31 23:29 /dev/sdc
brw-rw—-. 1 root disk 8, 48 Mar 31 23:29 /dev/sdd
brw-rw—-. 1 root disk 8, 64 Mar 31 23:29 /dev/sde
brw-rw—-. 1 root disk 8, 80 Mar 31 23:29 /dev/sdf
brw-rw—-. 1 root disk 8, 96 Mar 31 23:29 /dev/sdg
brw-rw—-. 1 root disk 8, 97 Mar 31 23:29 /dev/sdg1
brw-rw—-. 1 root disk 8, 98 Mar 31 23:29 /dev/sdg2
brw-rw—-. 1 root disk 8, 99 Mar 31 23:29 /dev/sdg3
#

2 Start with the first disk you'll want to create a persistent name for.  Issue the commands to the right to get unique identifiers for the HDD.

Our SDD details:

# udevadm info -a -p /sys/block/sda
# udevadm info –attribute-walk –path /block/sda  # (Same as above)
# hdparm -i /dev/sda
# hdparm -I /dev/sda
# udevadm info –query all -n /dev/sda

Sample output with the unique identifiers that can be used highlighted in bold green:

# udevadm info -a -p /sys/block/sda

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/pci0000:00/0000:00:11.0/host0/target0:0:0/0:0:0:0/block/sda':
    KERNEL=="sda"
    SUBSYSTEM=="block"
    DRIVER==""
    ATTR{range}=="16"
    ATTR{ext_range}=="256"
    ATTR{removable}=="0"
    ATTR{ro}=="0"
    ATTR{size}=="2930277168"
    ATTR{alignment_offset}=="0"
    ATTR{discard_alignment}=="0"
    ATTR{capability}=="52"
    ATTR{stat}==" 3665783 240524730 1953525026 323734815     4346      140    16355   708391
>         0  9095724 324441439"
    ATTR{inflight}=="       0        0"

  looking at parent device '/devices/pci0000:00/0000:00:11.0/host0/target0:0:0/0:0:0:0':
    KERNELS=="0:0:0:0"
    SUBSYSTEMS=="scsi"
    DRIVERS=="sd"
    ATTRS{device_blocked}=="0"
    ATTRS{type}=="0"
    ATTRS{scsi_level}=="6"
    ATTRS{vendor}=="ATA     "
    ATTRS{model}=="ST1500DL003-9VT1"
    ATTRS{rev}=="CC3C"
    ATTRS{state}=="running"
    ATTRS{timeout}=="30"
    ATTRS{iocounterbits}=="32"
    ATTRS{iorequest_cnt}=="0x3803ba"
    ATTRS{iodone_cnt}=="0x3801e7"
    ATTRS{ioerr_cnt}=="0xf8"
    ATTRS{modalias}=="scsi:t-0×00"
    ATTRS{evt_media_change}=="0"
    ATTRS{dh_state}=="detached"
    ATTRS{queue_depth}=="31"
    ATTRS{queue_ramp_up_period}=="120000"
    ATTRS{queue_type}=="simple"

  looking at parent device '/devices/pci0000:00/0000:00:11.0/host0/target0:0:0':
    KERNELS=="target0:0:0"
    SUBSYSTEMS=="scsi"
    DRIVERS==""

  looking at parent device '/devices/pci0000:00/0000:00:11.0/host0':
    KERNELS=="host0"
    SUBSYSTEMS=="scsi"
    DRIVERS==""

  looking at parent device '/devices/pci0000:00/0000:00:11.0':
    KERNELS=="0000:00:11.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="ahci"
    ATTRS{vendor}=="0×1002"
    ATTRS{device}=="0×4391"
    ATTRS{subsystem_vendor}=="0×1458"
    ATTRS{subsystem_device}=="0xb002"
    ATTRS{class}=="0×010601"
    ATTRS{irq}=="28"
    ATTRS{local_cpus}=="03"
    ATTRS{local_cpulist}=="0-1"
ATTRS{modalias}=="pci:v00001002d00004391sv00001458sd0000B002bc01sc06i01"
    ATTRS{numa_node}=="0"
    ATTRS{enable}=="1"
    ATTRS{broken_parity_status}=="0"
    ATTRS{msi_bus}==""

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""

# udevadm info –attribute-walk –path /block/sda

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/pci0000:00/0000:00:11.0/host0/target0:0:0/0:0:0:0/block/sda':
    KERNEL=="sda"
    SUBSYSTEM=="block"
    DRIVER==""
    ATTR{range}=="16"
    ATTR{ext_range}=="256"
    ATTR{removable}=="0"
    ATTR{ro}=="0"
    ATTR{size}=="2930277168"
    ATTR{alignment_offset}=="0"
    ATTR{discard_alignment}=="0"
    ATTR{capability}=="52"
    ATTR{stat}==" 3665783 240524730 1953525026 323734815     4346      140    16355   708391
>        0  9095724 324441439"
    ATTR{inflight}=="       0        0"

  looking at parent device '/devices/pci0000:00/0000:00:11.0/host0/target0:0:0/0:0:0:0':
    KERNELS=="0:0:0:0"
    SUBSYSTEMS=="scsi"
    DRIVERS=="sd"
    ATTRS{device_blocked}=="0"
    ATTRS{type}=="0"
    ATTRS{scsi_level}=="6"
    ATTRS{vendor}=="ATA     "
    ATTRS{model}=="ST1500DL003-9VT1"
    ATTRS{rev}=="CC3C"
    ATTRS{state}=="running"
    ATTRS{timeout}=="30"
    ATTRS{iocounterbits}=="32"
    ATTRS{iorequest_cnt}=="0x3803c3"
    ATTRS{iodone_cnt}=="0x3801f0"
    ATTRS{ioerr_cnt}=="0×100"
    ATTRS{modalias}=="scsi:t-0×00"
    ATTRS{evt_media_change}=="0"
    ATTRS{dh_state}=="detached"
    ATTRS{queue_depth}=="31"
    ATTRS{queue_ramp_up_period}=="120000"
    ATTRS{queue_type}=="simple"

  looking at parent device '/devices/pci0000:00/0000:00:11.0/host0/target0:0:0':
    KERNELS=="target0:0:0"
    SUBSYSTEMS=="scsi"
    DRIVERS==""

  looking at parent device '/devices/pci0000:00/0000:00:11.0/host0':
    KERNELS=="host0"
    SUBSYSTEMS=="scsi"
    DRIVERS==""

  looking at parent device '/devices/pci0000:00/0000:00:11.0':
    KERNELS=="0000:00:11.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="ahci"
    ATTRS{vendor}=="0×1002"
    ATTRS{device}=="0×4391"
    ATTRS{subsystem_vendor}=="0×1458"
    ATTRS{subsystem_device}=="0xb002"
    ATTRS{class}=="0×010601"
    ATTRS{irq}=="28"
    ATTRS{local_cpus}=="03"
    ATTRS{local_cpulist}=="0-1"
    ATTRS{modalias}=="pci:v00001002d00004391sv00001458sd0000B002bc01sc06i01"
    ATTRS{numa_node}=="0"
    ATTRS{enable}=="1"
    ATTRS{broken_parity_status}=="0"
    ATTRS{msi_bus}==""

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""
#


# hdparm -i /dev/sda

/dev/sda:

 Model=ST1500DL003-9VT16L, FwRev=CC3C, SerialNo=5YD6GDZQ
 Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4
 BuffType=unknown, BuffSize=unknown, MaxMultSect=16, MultSect=off
 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=2930277168
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio1 pio2 pio3 pio4
 DMA modes:  mdma0 mdma1 mdma2
 UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6
 AdvancedPM=no WriteCache=disabled
 Drive conforms to: unknown:  ATA/ATAPI-4,5,6,7

 * signifies the current active mode

# hdparm -I /dev/sda

/dev/sda:

ATA device, with non-removable media
    Model Number:       ST1500DL003-9VT16L                     
    Serial Number:      5YD6GDZQ
    Firmware Revision:  CC3C   
    Transport:          Serial, SATA Rev 3.0
Standards:
    Used: unknown (minor revision code 0×0029)
    Supported: 8 7 6 5
    Likely used: 8
Configuration:
    Logical        max    current
    cylinders    16383    16383
    heads        16    16
    sectors/track    63    63
    –
    CHS current addressable sectors:   16514064
    LBA    user addressable sectors:  268435455
    LBA48  user addressable sectors: 2930277168
    Logical  Sector size:                   512 bytes
    Physical Sector size:                  4096 bytes
    Logical Sector-0 offset:                  0 bytes
    device size with M = 1024*1024:     1430799 MBytes
    device size with M = 1000*1000:     1500301 MBytes (1500 GB)
    cache/buffer size  = unknown
    Nominal Media Rotation Rate: 5900
Capabilities:
    LBA, IORDY(can be disabled)
    Queue depth: 32
    Standby timer values: spec'd by Standard, no device specific minimum
    R/W multiple sector transfer: Max = 16    Current = ?
    Recommended acoustic management value: 254, current value: 0
    DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6
         Cycle time: min=120ns recommended=120ns
    PIO: pio0 pio1 pio2 pio3 pio4
         Cycle time: no flow control=120ns  IORDY flow control=120ns
Commands/features:
    Enabled    Supported:
       *    SMART feature set
            Security Mode feature set
       *    Power Management feature set
            Write cache
       *    Look-ahead
       *    Host Protected Area feature set
       *    WRITE_BUFFER command
       *    READ_BUFFER command
       *    DOWNLOAD_MICROCODE
            SET_MAX security extension
       *    Automatic Acoustic Management feature set
       *    48-bit Address feature set
       *    Device Configuration Overlay feature set
       *    Mandatory FLUSH_CACHE
       *    FLUSH_CACHE_EXT
       *    SMART error logging
       *    SMART self-test
       *    General Purpose Logging feature set
       *    WRITE_{DMA|MULTIPLE}_FUA_EXT
       *    64-bit World wide name
            Write-Read-Verify feature set
       *    WRITE_UNCORRECTABLE_EXT command
       *    {READ,WRITE}_DMA_EXT_GPL commands
       *    Segmented DOWNLOAD_MICROCODE
       *    Gen1 signaling speed (1.5Gb/s)
       *    Gen2 signaling speed (3.0Gb/s)
       *    unknown 76[3]
       *    Native Command Queueing (NCQ)
       *    Phy event counters
       *    unknown 76[15]
            Device-initiated interface power management
       *    Software settings preservation
       *    SMART Command Transport (SCT) feature set
       *    SCT Long Sector Access (AC1)
       *    SCT LBA Segment Access (AC2)
       *    SCT Features Control (AC4)
       *    SCT Data Tables (AC5)
            unknown 206[7]
            unknown 206[12] (vendor specific)
            unknown 206[13] (vendor specific)
Security:
    Master password revision code = 65534
        supported
    not    enabled
    not    locked
    not    frozen
    not    expired: security count
        supported: enhanced erase
    270min for SECURITY ERASE UNIT. 270min for ENHANCED SECURITY ERASE UNIT.
Logical Unit WWN Device Identifier: 5000c500463a5d9d
    NAA        : 5
    IEEE OUI    : 000c50
    Unique ID    : 0463a5d9d
Checksum: correct
#

# udevadm info –query all -n /dev/sda
P: /devices/pci0000:00/0000:00:11.0/host0/target0:0:0/0:0:0:0/block/sda
N: sda
W: 44
S: block/8:0
S: disk/by-id/ata-ST1500DL003-9VT16L_5YD6GDZQ
S: disk/by-id/scsi-SATA_ST1500DL003-9VT_5YD6GDZQ
S: rsdf
S: disk/by-path/pci-0000:00:11.0-scsi-0:0:0:0
S: disk/by-id/wwn-0x5000c500463a5d9d
E: UDEV_LOG=0
E: DEVPATH=/devices/pci0000:00/0000:00:11.0/host0/target0:0:0/0:0:0:0/block/sda
E: MAJOR=8
E: MINOR=0
E: DEVNAME=/dev/sda
E: DEVTYPE=disk
E: SUBSYSTEM=block
E: ID_ATA=1
E: ID_TYPE=disk
E: ID_BUS=ata
E: ID_MODEL=ST1500DL003-9VT16L
E: ID_MODEL_ENC=ST1500DL003-9VT16L\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
E: ID_REVISION=CC3C
E: ID_SERIAL=ST1500DL003-9VT16L_5YD6GDZQ
E: ID_SERIAL_SHORT=5YD6GDZQ
E: ID_ATA_WRITE_CACHE=1
E: ID_ATA_WRITE_CACHE_ENABLED=1
E: ID_ATA_FEATURE_SET_HPA=1
E: ID_ATA_FEATURE_SET_HPA_ENABLED=1
E: ID_ATA_FEATURE_SET_PM=1
E: ID_ATA_FEATURE_SET_PM_ENABLED=1
E: ID_ATA_FEATURE_SET_SECURITY=1
E: ID_ATA_FEATURE_SET_SECURITY_ENABLED=0
E: ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=270
E: ID_ATA_FEATURE_SET_SECURITY_ENHANCED_ERASE_UNIT_MIN=270
E: ID_ATA_FEATURE_SET_SMART=1
E: ID_ATA_FEATURE_SET_SMART_ENABLED=1
E: ID_ATA_FEATURE_SET_AAM=1
E: ID_ATA_FEATURE_SET_AAM_ENABLED=1
E: ID_ATA_FEATURE_SET_AAM_VENDOR_RECOMMENDED_VALUE=254
E: ID_ATA_FEATURE_SET_AAM_CURRENT_VALUE=0
E: ID_ATA_DOWNLOAD_MICROCODE=1
E: ID_ATA_SATA=1
E: ID_ATA_SATA_SIGNAL_RATE_GEN2=1
E: ID_ATA_SATA_SIGNAL_RATE_GEN1=1
E: ID_ATA_ROTATION_RATE_RPM=5900
E: ID_WWN=0x5000c500463a5d9d
E: ID_WWN_WITH_EXTENSION=0x5000c500463a5d9d
E: ID_SCSI_COMPAT=SATA_ST1500DL003-9VT_5YD6GDZQ
E: ID_PATH=pci-0000:00:11.0-scsi-0:0:0:0
E: ID_FS_UUID=2f36ac48-5e3e-4c54-7217-7c53bea3e41e
E: ID_FS_UUID_ENC=2f36ac48-5e3e-4c54-7217-7c53bea3e41e
E: ID_FS_UUID_SUB=136eb8af-87a2-641f-be6c-5a482024b9ca
E: ID_FS_UUID_SUB_ENC=136eb8af-87a2-641f-be6c-5a482024b9ca
E: ID_FS_LABEL=mbpc:0
E: ID_FS_LABEL_ENC=mbpc:0
E: ID_FS_VERSION=1.2
E: ID_FS_TYPE=linux_raid_member
E: ID_FS_USAGE=raid
E: UDISKS_PRESENTATION_NOPOLICY=0
E: MD_LEVEL=raid6
E: MD_DEVICES=6
E: MD_NAME=mbpc:0
E: MD_UUID=2f36ac48:5e3e4c54:72177c53:bea3e41e
E: MD_UPDATE_TIME=1332826317
E: MD_DEV_UUID=136eb8af:87a2641f:be6c5a48:2024b9ca
E: MD_EVENTS=3210
E: UDISKS_ATA_SMART_IS_AVAILABLE=1
E: DEVLINKS=/dev/block/8:0 /dev/disk/by-id/ata-ST1500DL003-9VT16L_5YD6GDZQ
> /dev/disk/by-id/scsi-SATA_ST1500DL003-9VT_5YD6GDZQ /dev/rsdf
> /dev/disk/by-path/pci-0000:00:11.0-scsi-0:0:0:0 /dev/disk/by-id/wwn-0x5000c500463a5d9d

#

3 Write the UDEV rules.

The UDEV rules are relatively self intuitive and for the purpose of this article, one was simply copied and modified for our
purpose from the /lib/udev/rules.d/60-persistent-storage.rules file (The entries, ie SUBSYSTEM…, should be all unbroken
one line entries):

# cat /lib/udev/rules.d/60-persistent-storage.rules
# MY RULES
SUBSYSTEM=="block",ACTION=="add",ENV{DEVTYPE}=="disk",PROGRAM="scsi_id –whitelisted –replace-whitespace -p0x80 -d$tempnode",RESULT=="?*",ENV{ID_SCSI_COMPAT}="$result",ENV{ID_SCSI_COMPAT}=="SATA_ST31000520AS_9VX0X9TA",SYMLINK+="rsda"
SUBSYSTEM=="block",ACTION=="add",ENV{DEVTYPE}=="disk",PROGRAM="scsi_id –whitelisted –replace-whitespace -p0x80 -d$tempnode",RESULT=="?*",ENV{ID_SCSI_COMPAT}="$result",ENV{ID_SCSI_COMPAT}=="SATA_ST31000520AS_9VX0X5KC",SYMLINK+="rsdb"
SUBSYSTEM=="block",ACTION=="add",ENV{DEVTYPE}=="disk",PROGRAM="scsi_id –whitelisted –replace-whitespace -p0x80 -d$tempnode",RESULT=="?*",ENV{ID_SCSI_COMPAT}="$result",ENV{ID_SCSI_COMPAT}=="SATA_ST31000520AS_9VX0XQ2M",SYMLINK+="rsdc"
SUBSYSTEM=="block",ACTION=="add",ENV{DEVTYPE}=="disk",PROGRAM="scsi_id –whitelisted –replace-whitespace -p0x80 -d$tempnode",RESULT=="?*",ENV{ID_SCSI_COMPAT}="$result",ENV{ID_SCSI_COMPAT}=="SATA_ST31000520AS_9VX0WJKA",SYMLINK+="rsdd"
SUBSYSTEM=="block",ACTION=="add",ENV{DEVTYPE}=="disk",PROGRAM="scsi_id –whitelisted –replace-whitespace -p0x80 -d$tempnode",RESULT=="?*",ENV{ID_SCSI_COMPAT}="$result",ENV{ID_SCSI_COMPAT}=="SATA_ST31000520AS_9VX0WK55",SYMLINK+="rsde"
# BAD DISK: SUBSYSTEM=="block",ACTION=="add",ENV{DEVTYPE}=="disk",PROGRAM="scsi_id –whitelisted –replace-whitespace -p0x80 -d$tempnode",RESULT=="?*",ENV{ID_SCSI_COMPAT}="$result",ENV{ID_SCSI_COMPAT}=="SATA_ST31000520AS_9VX0X994",SYMLINK+="rsdf"
SUBSYSTEM=="block",ACTION=="add",ENV{DEVTYPE}=="disk",PROGRAM="scsi_id –whitelisted –replace-whitespace -p0x80 -d$tempnode",RESULT=="?*",ENV{ID_SCSI_COMPAT}="$result",ENV{ID_SCSI_COMPAT}=="SATA_ST1500DL003-9VT_5YD6GDZQ",SYMLINK+="rsdf"
# OS
SUBSYSTEM=="block",ACTION=="add",ENV{DEVTYPE}=="disk",PROGRAM="scsi_id –whitelisted –replace-whitespace -p0x80 -d$tempnode",RESULT=="?*",ENV{ID_SCSI_COMPAT}="$result",ENV{ID_SCSI_COMPAT}=="SATA_WDC_WD15EADS-32_WD-WCAVY1065435",SYMLINK+="ossda"
#

Notice how the devices correspond to the actual output of the udevadm commands above.  Similarly, we can use the MD_UUID
to uniquely add a name for our RAID6 array like this:

# cat /lib/udev/rules.d/64-md-raid.rules
ENV{DEVTYPE}=="disk", ENV{MD_NAME}=="mbpc:0", ENV{MD_UUID}=="2f36ac48:5e3e4c54:72177c53:bea3e41e", SYMLINK+="raidmd0", OPTIONS+="string_escape=replace"
#

NOTE: The UUID for Multi Disk (mdXX) devices can be obtained using:

# mdadm –detail /dev/md0 |grep -i UUID
           UUID : 2f36ac48:5e3e4c54:72177c53:bea3e41e
#

4 Adjust the UDEV rules files accordingly to add new entries. NOTE: Do not remove any, just add and backup first.  It is easy to make the system unbootable so be ware.

UDEV rule files are typically added to the /etc/udev/rules.d/ and the /lib/udev/rules.d/ folders.  The rules in the /etc/udev/rules.d/ folder would overwrite the rules in the /lib/udev/rules.d/ folder. 

NOTE: For the excercise here, the rules under /etc/udev/rules.d/ failed to work since variables such as $tempnode were undefined by the time the system processed rules under /etc/udev/rules.d/.  For the next step, the rules were added to

/lib/udev/rules.d/60-persistent-storage.rules
/lib/udev/rules.d/64-md-raid.rules

instead.  However the typical practice would be to add them to the /etc/udev/rules.d however this did NOT work for this example using the current rule configuration.

5 Check that logging on /etc/udev/udev.conf is set to 0 or at most err.

WARNING: If this is set to anything higher then 0 or err, the system may log so much that it would never boot up.

# cat /etc/udev/udev.conf
# The initial syslog(3) priority: "err", "info", "debug" or its
# numerical equivalent. For runtime debugging, the daemons internal
# state can be changed with: "udevadm control –log-priority=<value>".
udev_log=0
#

A safer way to set the logging higher temporarily until on next reboot udev.conf is read again, is to issue this command:

# udevadm control –log-priority=3

for example. 

6 Reload the UDEV rules.

Issue the command.  Typically, it will return no results unless a log option is set to non 0 (see step 5 above):

# udevadm trigger 2>&1
#

Check the /var/log/messages files for messages from UDEV:

# tail -f /var/log/messages
Apr  1 21:54:45 mbpc kernel: AMD64 EDAC driver v3.4.0
Apr  1 21:54:45 mbpc kernel: EDAC amd64: DRAM ECC disabled.
Apr  1 21:54:45 mbpc kernel: EDAC amd64: ECC disabled in the BIOS or no ECC capability, module will not load.
Apr  1 21:54:45 mbpc kernel: Either enable ECC checking or force module loading by setting 'ecc_enable_override'.
Apr  1 21:54:45 mbpc kernel: (Note that use of the override may cause unknown side effects.)
Apr  1 21:54:45 mbpc kernel: microcode: AMD microcode update via /dev/cpu/microcode not supported

 

A more verbose output when using the –log-priority flag would look like this (filtered):

# tail -f /var/log/messages|egrep -i "error|warning|fatal|fail"
Apr  1 21:58:28 mbpc udevd-work[27757]: '/sbin/modprobe' (stderr) 'FATAL: Module acpi:LNXSYSTM: not found.'
Apr  1 21:58:28 mbpc udevd-work[28342]: '/sbin/modprobe' (stderr) 'FATAL: Module pci:v00001002d00005958sv00001002sd00005958bc06sc00i00 not found.'
Apr  1 21:58:28 mbpc udevd-work[28353]: '/sbin/modprobe' (stderr) 'FATAL: Module input:b0019v0000p0001e0000_e0,1,k74,ramlsfw not found.'
Apr  1 21:58:28 mbpc udevd-work[28354]: '/sbin/modprobe' (stderr) 'FATAL: Module acpi:LNXSYBUS: not found.'
Apr  1 21:58:28 mbpc udevd-work[28355]: '/sbin/modprobe' (stderr) 'FATAL: Module acpi:LNXSYBUS: not found.'
Apr  1 21:58:28 mbpc udevd-work[28356]: '/sbin/modprobe' (stderr) 'FATAL: Module acpi:LNXTHERM: not found.'
Apr  1 21:58:28 mbpc udevd-work[28370]: '/sbin/modprobe' (stderr) 'FATAL: Module pci:v00001002d00004384sv00000000sd00000000bc06sc04i01 not found.'
Apr  1 21:58:28 mbpc udevd-work[28368]: '/sbin/modprobe' (stderr) 'FATAL: Module pci:v00001002d0000439Dsv00001002sd0000439Dbc06sc01i00 not found.'
Apr  1 21:58:28 mbpc udevd-work[27758]: '/sbin/modprobe' (stderr) 'FATAL: Module acpi:PNP0C01: not found.'
Apr  1 21:58:28 mbpc udevd-work[27757]: '/sbin/modprobe' (stderr) 'FATAL: Module acpi:PNP0501: not found.'
Apr  1 21:58:28 mbpc udevd-work[28342]: '/sbin/modprobe' (stderr) 'FATAL: Module acpi:PNP0700: not found.'
Apr  1 21:58:28 mbpc udevd-work[28344]: '/sbin/modprobe' (stderr) 'FATAL: Module acpi:PNP0C02: not found.'
Apr  1 21:58:28 mbpc udevd-work[28345]: '/sbin/modprobe' (stderr) 'FATAL: Module acpi:PNP0C02: not found.'
Apr  1 21:58:28 mbpc udevd-work[28347]: '/sbin/modprobe' (stderr) 'FATAL: Module acpi:device: not found.'
Apr  1 21:58:28 mbpc udevd-work[28348]: '/sbin/modprobe' (stderr) 'FATAL: Module acpi:device: not found.'
Apr  1 21:58:28 mbpc udevd-work[28349]: '/sbin/modprobe' (stderr) 'FATAL: Module acpi:device: not found.'
Apr  1 21:58:29 mbpc udevd-work[28420]: '/sbin/modprobe' (stderr) 'FATAL: Module input:b0019v0000p0001e0000_e0,1,k74,ramlsfw not found.'
Apr  1 21:58:29 mbpc udevd-work[28423]: '/sbin/modprobe' (stderr) 'FATAL: Module input:b0000v0000p0000e0000_e0,5,kramlsfw8, not found.'
Apr  1 21:58:29 mbpc udevd-work[28455]: '/sbin/modprobe' (stderr) 'FATAL: Module input:b0000v0000p0000e0000_e0,5,kramlsfw2, not found.'
Apr  1 21:58:29 mbpc udevd-work[28343]: '/sbin/modprobe' (stderr) 'FATAL: Module acpi:device: not found.'
Apr  1 21:58:29 mbpc udevd-work[28347]: '/sbin/modprobe' (stderr) 'FATAL: Module acpi:PNP0000: not found.'
Apr  1 21:58:29 mbpc udevd-work[28345]: '/sbin/modprobe' (stderr) 'FATAL: Module acpi:device: not found.'
Apr  1 21:58:29 mbpc udevd-work[28349]: '/sbin/modprobe' (stderr) 'FATAL: Module acpi:PNP0100: not found.'
Apr  1 21:58:29 mbpc udevd-work[28351]: '/sbin/modprobe' (stderr) 'FATAL: Module acpi:PNP0200: not found.'
Apr  1 21:58:29 mbpc udevd-work[28352]: '/sbin/modprobe' (stderr) 'FATAL: Module acpi:PNP0800: not found.'
Apr  1 21:58:29 mbpc udevd-work[28353]: '/sbin/modprobe' (stderr) 'FATAL: Module acpi:PNP0B00: not found.'
Apr  1 21:58:29 mbpc udevd-work[28355]: '/sbin/modprobe' (stderr) 'FATAL: Module acpi:PNP0C04: not found.'
Apr  1 21:58:29 mbpc udevd-work[28354]: '/sbin/modprobe' (stderr) 'FATAL: Module acpi:PNP0C02: not found.'
Apr  1 21:58:29 mbpc udevd-work[28367]: '/sbin/modprobe' (stderr) 'FATAL: Module acpi:device: not found.'
Apr  1 21:58:29 mbpc udevd-work[28365]: '/sbin/modprobe' (stderr) 'FATAL: Module pci:v00001102d00007003sv00001102sd00000040bc09sc80i00 not found.'
Apr  1 21:58:29 mbpc udevd-work[28342]: '/sbin/modprobe' (stderr) 'FATAL: Module acpi:device: not found.'
Apr  1 21:58:29 mbpc udevd-work[28348]: '/sbin/modprobe' (stderr) 'FATAL: Module pci:v00001022d00001200sv00000000sd00000000bc06sc00i00 not found.'
Apr  1 21:58:29 mbpc udevd-work[28349]: '/sbin/modprobe' (stderr) 'FATAL: Module pci:v00001022d00001201sv00000000sd00000000bc06sc00i00 not found.'
Apr  1 21:58:29 mbpc udevd-work[28352]: '/sbin/modprobe' (stderr) 'FATAL: Error inserting amd64_edac_mod (/lib/modules/2.6.32-220.4.1.el6.x86_64/kernel/drivers/edac/amd64_edac_mod.ko): No such device'
Apr  1 21:58:29 mbpc udevd-work[27758]: '/sbin/modprobe' (stderr) 'FATAL: Module pci:v00001022d00001204sv00000000sd00000000bc06sc00i00 not found.'
Apr  1 21:58:29 mbpc udevd-work[28353]: '/sbin/modprobe' (stderr) 'FATAL: Module platform:Fixed not found.'
Apr  1 21:58:29 mbpc udevd-work[28344]: '/sbin/modprobe' (stderr) 'FATAL: Module platform:microcode not found.'
Apr  1 21:58:29 mbpc udevd-work[28366]: error changing netif name 'wlan0' to 'eth0': Device or resource busy
Apr  1 21:58:29 mbpc udevd-work[28356]: '/sbin/modprobe' (stderr) 'FATAL: Module platform:pcspkr not found.'
Apr  1 21:58:29 mbpc udevd-work[28359]: '/sbin/modprobe' (stderr) 'FAT+AL: Module platform:regulatory not found.'
Apr  1 21:58:29 mbpc udevd-work[28362]: '/sbin/modprobe' (stderr) 'FATAL: Module platform:vesafb not found.'
Apr  1 21:58:29 mbpc udevd-work[28351]: '/sbin/modprobe' (stderr) 'FATAL: Module acpi:device: not found.'
Apr  1 21:58:29 mbpc udevd-work[28343]: '/lib/udev/udisks-part-id' (stderr) 'read failed (No such file or directory)'
Apr  1 21:58:29 mbpc udevd-work[28342]: '/sbin/modprobe' (stderr) 'FATAL: Module input:b0003v046DpC00Ee0110_e0,1,2,4,k110,111,112,r0,1,8,am4,lsfw not found.'
Apr  1 21:58:29 mbpc udevd-work[27758]: '/lib/udev/udisks-part-id' (stderr) 'read failed (No such file or directory)'
Apr  1 21:58:29 mbpc udevd-work[28365]: '/sbin/modprobe' (stderr) 'FATAL: Module input:b0003v03F0p0024e0110_e0,1,4,11,14,k71,72,73,74,75,77,79,7A,7B,7C,7D,7E,7F,80,81,82,83,84,85,86,87,88,89,8A,8C,8E,96,98,9E,9F,A1,A3,A4,A5,A6,AD,B0,B1,
B2,B3,B4,B7,B8,B9,BA,BB,BC,BD,BE,BF,C0,C1,C2,F0,ram4,l0,1,2,sfw not found.'
Apr  1 21:58:29 mbpc udevd-work[28344]: '/lib/udev/udisks-part-id' (stderr) 'read failed (No such file or directory)'
Apr  1 21:58:29 mbpc udevd-work[28351]: '/lib/udev/udisks-part-id' (stderr) 'read failed (No such file or directory)'
Apr  1 21:58:29 mbpc udevd-work[28349]: '/sbin/modprobe' (stderr) 'FATAL: Module dmi:bvnAwardSoftwareInternational,Inc.:bvrFC:bd08/02/2010:svnGigabyteTechnologyCo.,Ltd.:pnGA_890XA_UD3:pvr:rvnGigabyteTechnologyCo.,Ltd.:rnGA_890XA_UD3:rvrx.x:cvnGigabyteTechnologyCo.,Ltd.:ct3:cvr: not found.'
Apr  1 21:58:29 mbpc udevd-work[28352]: '/sbin/modprobe' (stderr) 'FATAL: Module input:b0017v0001p0001e0100_e0,1,2,k110,111,112,r0,1,amlsfw not found.'
Apr  1 21:58:29 mbpc udevd-work[27758]: '/bin/bash' (stderr) '/bin/bash: line 0: echo: write error: Invalid argument'
Apr  1 22:28:40 mbpc udevd-work[30117]: '/sbin/modprobe' (stderr) 'FATAL: Module input:b0003v046DpC00Ee0110_e0,1,2,4,k110,111,112,r0,1,8,am4,lsfw not found.'
Apr  1 22:28:41 mbpc udevd-work[30117]: '/sbin/modprobe' (stderr) 'FATAL: Module input:b0003v03F0p0024e0110_e0,1,4,11,14,k71,72,73,74,75,77,79,7A,7B,7C,7D,7E,7F,80,81,82,83,84,85,86,87,88,89,8A,8C,8E,96,98,9E,9F,A1,A3,A4,A5,A6,AD,B0,B1,
B2,B3,B4,B7,B8,B9,BA,BB,BC,BD,BE,BF,C0,C1,C2,F0,ram4,l0,1,2,sfw not found.'

7 Check that the new rules are generating the expected links.

Repeat the same for any other disks you wish to create custom rules for.  Issue the following commands to check that the new links are present:

# ls -al /dev/rsd*
lrwxrwxrwx. 1 root root 3 Apr  1 21:40 /dev/rsda -> sdc
lrwxrwxrwx. 1 root root 3 Apr  1 21:40 /dev/rsdb -> sde
lrwxrwxrwx. 1 root root 3 Apr  1 21:40 /dev/rsdc -> sdd
lrwxrwxrwx. 1 root root 3 Apr  1 21:40 /dev/rsdd -> sdf
lrwxrwxrwx. 1 root root 3 Apr  1 21:40 /dev/rsde -> sdb
lrwxrwxrwx. 1 root root 3 Apr  1 21:40 /dev/rsdf -> sda
#

# ls -al /dev/oss*
lrwxrwxrwx. 1 root root 3 Apr  1 21:40 /dev/ossda -> sdg
# ls -al /dev/raid*
lrwxrwxrwx. 1 root root 3 Apr  1 21:40 /dev/raidmd0 -> md0
#

This gave numerous UDEV rules with which we could customize our naming.

PROBLEMS

UDEV tweaking comes with it's own set of risks.  For this, you may wish to either have a backup CD or a live Linux CD ready running the OS type you're modifying.  Alternately, a good PXE installation off of another server is a good way to go too where you can simply plug an ethernet cable to the secondary server and boot off the network.

PROBLEM SYMPTOMS SOLUTION
OS isn't booting up.  The system is printing thousands if not hundreds of messages to the terminal windows as confirmed with SHIFT-F2 keys.

 

 

 

Log file messages are filled with entries such as the below and logging for UDEV is set to 7 automatically:

# tail -f /var/log/messages

Feb 26 10:51:23 mbpc udevd[629]: seq 2192 queued, 'add' 'usb'
Feb 26 10:51:23 mbpc udevd[629]: passed 282 bytes to monitor 0x7f7e4823b7e0
Feb 26 10:51:23 mbpc udevd-work[18633]: seq 2192 running
Feb 26 10:51:23 mbpc udevd-work[18633]: device 0x7f7e48224aa0 has devpath '/devices/pci0000:00/0000:00:16.2/usb3/3-4'
Feb 26 10:51:23 mbpc udevd[629]: seq 2193 queued, 'add' 'usb'
Feb 26 10:51:23 mbpc udevd-work[18633]: device 0x7f7e48224cf0 has devpath '/devices/pci0000:00/0000:00:16.2/usb3'
Feb 26 10:51:23 mbpc udevd-work[18633]: device 0x7f7e48224e00 has devpath '/devices/pci0000:00/0000:00:16.2'
Feb 26 10:51:23 mbpc udevd-work[18633]: device 0x7f7e48224f30 has devpath '/devices/pci0000:00'
Feb 26 10:51:23 mbpc udevd-work[18633]: IMPORT 'usb_id –export /devices/pci0000:00/0000:00:16.2/usb3/3-4' /lib/udev/rules.d/40-libgphoto2.rules:11
Feb 26 10:51:23 mbpc udevd-work[18633]: 'usb_id –export /devices/pci0000:00/0000:00:16.2/usb3/3-4' started
Feb 26 10:51:23 mbpc udevd-work[18633]: '/lib/udev/usb_id' (stderr) 'libudev: udev_list_entry_add: 'UDEV_LOG=7' added'
Feb 26 10:51:23 mbpc udevd-work[18633]: '/lib/udev/usb_id' (stderr) 'libudev: udev_list_entry_add: 'UDEV_LOG' is already in the list'
Feb 26 10:51:23 mbpc udevd-work[18633]: '/lib/udev/usb_id' (stderr) 'libudev: udev_list_entry_add: 'UDEV_LOG' value replaced with '7''
Feb 26 10:51:23 mbpc udevd-work[18633]: '/lib/udev/usb_id' (stderr) 'libudev: udev_new: context 0x7fd21bf87010 created'
Feb 26 10:51:23 mbpc udevd-work[18633]: '/lib/udev/usb_id' (stderr) 'libudev: udev_new: log_priority=7'
Feb 26 10:51:23 mbpc udevd-work[18633]: '/lib/udev/usb_id' (stderr) 'libudev: udev_new: config_file='/etc/udev/udev.conf''
Feb 26 10:51:23 mbpc udevd-work[18633]: '/lib/udev/usb_id' (stderr) 'libudev: udev_new: dev_path='/dev''
Feb 26 10:51:23 mbpc udevd-work[18633]: '/lib/udev/usb_id' (stderr) 'libudev: udev_new: sys_path='/sys''

After several days of debugging, it turned out that apparently, I had kernel-debug-devel installed which overwrote my /boot/grub/grub.conf and had .debug for any kernel level to boot.  This resulted in a huge amount of UDEV rule messages being printed at boot to the point that the system simply wouldn't boot.  LESSONS LEARNED: Always check your /boot/grub/grub.conf after kernel installs.  Modifying values in /etc/udev/udev.conf to stop the logging had, obviously, no effect as the flag was reset at boot time by the .debug kernel:

 

 

[ GOOD ]
        kernel /vmlinuz-2.6.32-220.4.1.el6.x86_64 ro root=/dev/mapper/mbpcvg-rootlv rd_LVM_LV=mbpcvg/rootlv rd_LVM_LV=VGEntertain/olv_swap rd_LVM_LV=mbpcvg/swaplv rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=128M rhgb quiet

[ BAD ]
        kernel /vmlinuz-2.6.32-220.4.1.el6.x86_64.debug ro root=/dev/mapper/mbpcvg-rootlv rd_LVM_LV=mbpcvg/rootlv rd_LVM_LV=VGEntertain/olv_swap rd_LVM_LV=mbpcvg/swaplv rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=128M rhgb quiet

The extra debugging looks like also had UDEV_LOG=7 causing the above.

Cheers!
TK

Leave a Reply

 


     
  Copyright © 2003 - 2013 Tom Kacperski (microdevsys.com). All rights reserved.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License