Arch-Linux

掛載無法辨識的 U 盤

  • April 23, 2017

使用 Arch Linux / XFCE,我經常遇到未正確安裝的 USB 驅動器的問題。有時它們會自動出現在 Thunar 中,我可以一鍵安裝它們。但是,在其他時候(大約是 50/50),驅動器無法辨識。我在使用 USB 外置硬碟驅動器、USB 記憶棒和相機時遇到過這個問題。如果無法辨識外部驅動器,則情況如下:

  • 驅動器根本不顯示fdisk -l(它只顯示我的硬碟驅動器)
  • 驅動器沒有出現在/dev/disk
  • 驅動器執行時出現lsusb

所以有某種認識,但我不明白為什麼,也不知道發生這種情況時如何安裝驅動器。我只是重新啟動並希望它下次可以工作,這顯然不方便……

更新

當我監控/var/log/everything.log(系統日誌中沒有資訊)時,我看到插入 USB 時會發生這種情況:

Dec 14 15:36:32 localhost kernel: [ 6591.042911] usb 1-3: new high speed USB device number 9 using ehci_hcd
Dec 14 15:36:32 localhost mtp-probe: checking bus 1, device 9: "/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-3"
Dec 14 15:36:32 localhost mtp-probe: bus: 1, device: 9 was not an MTP device

這是另一個請求的輸出:

$udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

KERNEL[6809.192268] add      /devices/pci0000:00/0000:00:1d.7/usb1/1-3 (usb)
KERNEL[6809.193421] add      /devices/pci0000:00/0000:00:1d.7/usb1/1-3/1-3:1.0 (usb)
UDEV  [6809.299246] add      /devices/pci0000:00/0000:00:1d.7/usb1/1-3 (usb)
UDEV  [6809.306074] add      /devices/pci0000:00/0000:00:1d.7/usb1/1-3/1-3:1.0 (usb)

這個問題似乎是一個包羅萬象的規則/lib/udev/rules.d/69-libmtp.rules

# Autoprobe vendor-specific, communication and PTP devices
ENV{ID_MTP_DEVICE}!="1", ENV{MTP_NO_PROBE}!="1", ENV{COLOR_MEASUREMENT_DEVICE}!="1", ENV{libsane_matched}!="yes", ATTR{bDeviceClass}=="00|02|06|ef|ff", PROGRAM="/usr/lib/udev/mtp-probe /sys$env{DEVPATH} $attr{busnum} $attr{devnum}", RESULT=="1", SYMLINK+="libmtp-%k", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1"

註釋掉該行,如下所示,解決了問題:

# Autoprobe vendor-specific, communication and PTP devices
ENV{ID_MTP_DEVICE}!="1", ENV{MTP_NO_PROBE}!="1", ENV{COLOR_MEASUREMENT_DEVICE}!="1", ENV{libsane_matched}!="yes", ATTR{bDeviceClass}=="00|02|06|ef|ff", PROGRAM="/usr/lib/udev/mtp-probe /sys$env{DEVPATH} $attr{busnum} $attr{devnum}", RESULT=="1", SYMLINK+="libmtp-%k", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1"

就我而言,我必須重新啟動,但可能有一項服務可以重新啟動。

引用自:https://unix.stackexchange.com/questions/26842