当我将 USB 设备插入服务器时遇到问题。看起来像USB设备重复插入或重新分配设备字母sdb1: sdb1
问题是,每次插入 USB 设备时,我都会执行 udev 规则。现在,每次显示设备字母时,都会执行 udev 规则多次。我已停用自定义 udev 规则以将其排除为错误源。因此,所有这些效果和日志都是在没有任何自定义 udev 规则的情况下创建的。
这种效果只会持续到我安装该设备为止。安装设备后,此消息将停止。
这是日志,当我连接aRDX-Device via USB
但效果是一样的USB-Sticks
/var/日志/消息
2018-08-06T09:23:29.139628+02:00 SLES12RDX kernel: [241820.600269] sd 4:0:0:0: [sdb] 976764976 512-byte logical blocks: (500 GB/466 GiB)
2018-08-06T09:23:29.171622+02:00 SLES12RDX kernel: [241820.632581] sdb: sdb1
2018-08-06T09:23:44.979634+02:00 SLES12RDX kernel: [241836.437561] sdb: sdb1
2018-08-06T09:24:15.199624+02:00 SLES12RDX kernel: [241866.657525] sdb: sdb1
2018-08-06T09:24:45.415636+02:00 SLES12RDX kernel: [241896.874298] sdb: sdb1
2018-08-06T09:25:15.631630+02:00 SLES12RDX kernel: [241927.093221] sdb: sdb1
2018-08-06T09:25:45.851637+02:00 SLES12RDX kernel: [241957.311295] sdb: sdb1
2018-08-06T09:26:16.067646+02:00 SLES12RDX kernel: [241987.530071] sdb: sdb1
消息
[241262.363311] usb 2-1.6: new high-speed USB device number 5 using ehci-pci
[241262.457475] usb 2-1.6: New USB device found, idVendor=1a5a, idProduct=0006
[241262.457487] usb 2-1.6: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[241262.457488] usb 2-1.6: Product: RDX
[241262.457490] usb 2-1.6: Manufacturer: TANDBERG
[241262.457491] usb 2-1.6: SerialNumber: 032613566487
[241262.457917] usb-storage 2-1.6:1.0: USB Mass Storage device detected
[241262.458197] scsi host4: usb-storage 2-1.6:1.0
[241263.456000] scsi 4:0:0:0: Direct-Access RDX 0227 PQ: 0 ANSI: 6
[241263.456240] sd 4:0:0:0: Attached scsi generic sg2 type 0
[241263.459249] sd 4:0:0:0: [sdb] Attached SCSI removable disk
[241288.618894] sd 4:0:0:0: [sdb] 976764976 512-byte logical blocks: (500 GB/466 GiB)
[241288.657955] sdb: sdb1
[241294.065836] sdb: sdb1
[241324.282380] sdb: sdb1
[241766.323096] sd 4:0:0:0: [sdb] 976764976 512-byte logical blocks: (500 GB/466 GiB)
[241766.360054] sdb: sdb1
[241776.112351] sdb: sdb1
[241820.600269] sd 4:0:0:0: [sdb] 976764976 512-byte logical blocks: (500 GB/466 GiB)
[241820.632581] sdb: sdb1
[241836.437561] sdb: sdb1
[241866.657525] sdb: sdb1
[241896.874298] sdb: sdb1
[241927.093221] sdb: sdb1
[241957.311295] sdb: sdb1
[241987.530071] sdb: sdb1
答案1
部分答案:
我仍然不知道是什么原因导致这种情况,但我可以向您指出 udevd 调试日志中发生这种情况的位置。
/dev/sda
也就是说,您会收到和 的“inotify close”事件/dev/sdb
:
2018-08-06T16:20:28.414845+02:00 SLES12RDX systemd-udevd[429]: inotify event: 8 for /dev/sda
2018-08-06T16:20:28.416130+02:00 SLES12RDX systemd-udevd[429]: device /dev/sda closed, synthesising 'change'
2018-08-06T16:20:28.556561+02:00 SLES12RDX systemd-udevd[429]: inotify event: 8 for /dev/sdb
...
2018-08-06T16:20:28.566988+02:00 SLES12RDX systemd-udevd[429]: seq 2123 queued, 'remove' 'block'
2018-08-06T16:20:58.630120+02:00 SLES12RDX systemd-udevd[429]: inotify event: 8 for /dev/sda
...
2018-08-06T16:20:58.631408+02:00 SLES12RDX systemd-udevd[429]: device /dev/sda closed, synthesising 'change'
等等,udev综合了“change”事件,导致整个块设备和所有分区的多次重新扫描。
我从来没有见过这样的事情。inotify
用于监视文件系统事件,因此看起来这些事件来自用户空间。
我不知道如何找出导致此问题的应用程序。也许在 udev 错误跟踪网站上提交一个错误,看看他们是否有任何想法如何进一步追踪它?
答案2
插入 USB 设备后,收到许多 udev 事件。 15 - 20 秒循环后,事件看起来像是设备再次插入。输出来自udevadm monitor
KERNEL[249779.569894] change /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda (block)
KERNEL[249779.569949] change /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/sda1 (block)
KERNEL[249779.570075] change /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/sda2 (block)
KERNEL[249779.570123] change /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/sda5 (block)
KERNEL[249779.570245] change /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/sda6 (block)
KERNEL[249779.570296] change /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/sda7 (block)
UDEV [249779.643535] change /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda (block)
UDEV [249779.646294] change /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/sda1 (block)
UDEV [249779.647536] change /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/sda5 (block)
UDEV [249779.647693] change /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/sda7 (block)
UDEV [249779.649616] change /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/sda2 (block)
UDEV [249779.651444] change /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/sda6 (block)
KERNEL[249781.213738] change /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/host4/target4:0:0/4:0:0:0/block/sdb (block)
KERNEL[249781.233201] change /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/host4/target4:0:0/4:0:0:0/block/sdb (block)
KERNEL[249781.233309] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/host4/target4:0:0/4:0:0:0/block/sdb/sdb1 (block)
UDEV [249781.495520] change /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/host4/target4:0:0/4:0:0:0/block/sdb (block)
UDEV [249781.604649] change /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/host4/target4:0:0/4:0:0:0/block/sdb (block)
UDEV [249781.712323] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/host4/target4:0:0/4:0:0:0/block/sdb/sdb1 (block)
KERNEL[249809.678044] change /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda (block)
KERNEL[249809.678154] change /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/sda1 (block)
KERNEL[249809.678211] change /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/sda2 (block)
KERNEL[249809.678292] change /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/sda5 (block)
KERNEL[249809.678410] change /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/sda6 (block)
KERNEL[249809.678455] change /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/sda7 (block)
UDEV [249809.750877] change /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda (block)
UDEV [249809.754139] change /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/sda1 (block)
UDEV [249809.754325] change /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/sda5 (block)
UDEV [249809.756127] change /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/sda2 (block)
UDEV [249809.756270] change /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/sda7 (block)
UDEV [249809.756438] change /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/sda6 (block)
KERNEL[249809.788887] remove /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/host4/target4:0:0/4:0:0:0/block/sdb/sdb1 (block)
KERNEL[249809.793174] change /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/host4/target4:0:0/4:0:0:0/block/sdb (block)
KERNEL[249809.793338] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/host4/target4:0:0/4:0:0:0/block/sdb/sdb1 (block)
UDEV [249809.795254] remove /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/host4/target4:0:0/4:0:0:0/block/sdb/sdb1 (block)
UDEV [249810.274418] change /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/host4/target4:0:0/4:0:0:0/block/sdb (block)
UDEV [249810.391165] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/host4/target4:0:0/4:0:0:0/block/sdb/sdb1 (block)
我激活了 udev conf 中的调试选项。 /var/log/messages 中 udev 的输出现在太大了,需要将其发布到此处或认真调试。
但是这个 udev 规则被“解雇”了几次:
/usr/lib/udev/rules.d/60-persistent-storage.rules
并且此错误出现在sda
和 上sdb
。sda is not a USB device
,这是我的 HHD。我不是 udev 方面的专家,所以我不知道这是否是“正常”:
2018-08-06T12:14:51.303326+02:00 SLES12RDX systemd-udevd[2977]: PROGRAM '/sbin/multipath -u -i sda' /usr/lib/udev/rules.d/56-multipath.rules:25
2018-08-06T12:14:51.303516+02:00 SLES12RDX systemd-udevd[2978]: starting '/sbin/multipath -u -i sda'
2018-08-06T12:14:51.365860+02:00 SLES12RDX systemd-udevd[2977]: '/sbin/multipath -u -i sda'(out) 'sda is not a valid multipath device path'
2018-08-06T12:14:51.366082+02:00 SLES12RDX systemd-udevd[2977]: Process '/sbin/multipath -u -i sda' failed with exit code 1.
2018-08-06T12:14:51.441033+02:00 SLES12RDX systemd-udevd[2989]: PROGRAM '/sbin/multipath -u -i sdb' /usr/lib/udev/rules.d/56-multipath.rules:25
2018-08-06T12:14:51.441168+02:00 SLES12RDX systemd-udevd[2990]: starting '/sbin/multipath -u -i sdb'
2018-08-06T12:14:51.468823+02:00 SLES12RDX systemd-udevd[2989]: '/sbin/multipath -u -i sdb'(out) 'sdb is not a valid multipath device path'
2018-08-06T12:14:51.469024+02:00 SLES12RDX systemd-udevd[2989]: Process '/sbin/multipath -u -i sdb' failed with exit code 1.