Arch linux usb devices

DESCRIPTION

usb-devices is a shell script that can be used to display details of USB buses in the system and the devices connected to them.

The output of the script is similar to the usb/devices file available either under /proc/bus (if usbfs is mounted), or under /sys/kernel/debug (if debugfs is mounted there). The script is primarily intended to be used if the file is not available.

In contrast to the usb/devices file, this script only lists active interfaces (those marked with a «*» in the usb/devices file) and their endpoints.

Be advised that there can be differences in the way information is sorted, as well as in the format of the output.

RETURN VALUE

If sysfs is not mounted, a non-zero exit code is returned.

FILES

/sys/bus/usb/devices/usb* The part of the sysfs tree the script walks through to assemble the printed information. /proc/bus/usb/devices Location where the usb/devices file can normally be found for Linux kernels before 2.6.31, if usbfs is mounted. /sys/kernel/debug/usb/devices Location where the usb/devices file can normally be found for Linux kernel 2.6.31 and later, if debugfs is mounted.

SEE ALSO

AUTHORS

Powered by archmanweb, using mandoc for the conversion of manual pages.

The website is available under the terms of the GPL-3.0 license, except for the contents of the manual pages, which have their own license specified in the corresponding Arch Linux package.

Источник

USB storage devices

This document describes how to use the popular USB memory sticks with Linux. However, it is also valid for other devices such as digital cameras that act as if they were just a USB storage device.

If you have an up-to-date system with the standard Arch kernel and a modern desktop environment, your device should just show up on your desktop, with no need to open a console.

Auto-mounting with udisks

This is the easiest and most frequently used method. It is used by many desktop environments, but can be used separately too.

See Udisks for detailed information, including list of mount helpers.

Manual mounting

Note: Before you decide that Arch Linux does not mount your USB device, be sure to check all available ports. Some ports might not share the same controller, preventing you from mounting the device.

Читайте также:  Hp m725 драйвер linux

Getting a kernel that supports usb_storage

If you do not use a custom-made kernel, you are ready to go, for all Arch Linux stock kernels are properly configured. If you do use a custom-made kernel, ensure it is compiled with SCSI-Support, SCSI-Disk-Support and usb_storage. If you use the latest udev, you may just plug your device in and the system will automatically load all necessary kernel modules.

Identifying device

The first thing one needs to access a storage device is its identifier assigned by kernel. See File systems#Identify existing file systems for details.

Newly plugged-in devices are usually shown in the journal.

Mounting USB memory

If mount does not recognize the file system of the device you can try to use the -t argument, see mount(8) for details. If mounting does not work, you can try to recreate the file system or even repartition the disk.

Allow writing by regular users

If you want non-root users to be able to write to the USB stick, you can issue the following command:

# mount -o gid=users,fmask=113,dmask=002 /dev/sda1 /mnt/usbstick

If it does not work, make sure that the file system is mountable and writable as root, see the previous section for details.

As normal user with fstab

See FAT#Writing to FAT32 as normal user if you want normal user to do the mount/unmount action.

Mount tools

Multiple mount tools facilitate mounting as a regular user.

Troubleshooting

No USB storage devices are detected

If you have connected your USB storage device and it is not listed by lsblk but appears in the journal without being assigned a block device, see General troubleshooting#Cannot use some peripherals after kernel upgrade.

Also ensure that your BIOS has both XHCI Handoff and EHCI Handoff enabled, but this is usually not an issue with most modern devices.

Device not shutting down after unmounting all partitions

This article or section needs expansion.

Reason: Please advise how to automatically shut down devices after unmounting (Discuss in Talk:USB storage devices)

Failure to power off a device might result in:

  • a hard disk drive not parking its head, making a faint scratching sound while spinning out and degrading the device [2], or
  • a solid-state drive (especially older) not flushing its cache buffers or updating its mapping tables, and losing data [3].

When you unmount the partitions, the device is still powered on. You should ask the system to turn it off first in order to safely remove it: [4]

# echo 1 > /sys/block/disk_name/device/delete

If you use udisks, you can use these commands: [5]

$ udisksctl unmount -b /dev/sdXY $ udisksctl power-off -b /dev/sdX 

Device is detected but does not register as mountable

udev is shipped with a default set of rules, found in /usr/lib/udev/rules.d/ , including one for ignoring some specific devices for various reasons. Some hardware devices, such as digital cameras, portable recorders, etc., may format usb storage in a way that results in the ignore rules to be triggered. You can check if one of these rules was applied with the following command and then find the corresponding conditions in the defaults:

$ udevadm info --attribute-walk --name=device_name | grep UDISKS_IGNORE

If this is the case and your device has this property set to «1», you can override it with a custom rule, following the udev page.

Читайте также:  Red hat enterprise linux upgrade

Источник

USB storage devices (Русский)

Состояние перевода: На этой странице представлен перевод статьи USB storage devices. Дата последней синхронизации: 10 февраля 2022. Вы можете помочь синхронизировать перевод, если в английской версии произошли изменения.

В этом документе описываются способы использования различных USB накопителей в Linux. Это также касается и других устройств, таких как цифровые камеры или телефоны, которые распознаются как обычные USB накопители.

Если у вас свежая система со стандартным ядром Arch и современная среда рабочего стола, USB устройство должно автоматически появляться на рабочем столе при подключении, и лезть в консоль не потребуется.

Автоматическое монтирование с помощью udisks

Это самый простой и самый часто используемый метод. Он используется во многих средах рабочего стола, но может применяться и отдельно.

Подробности и вспомогательные программы описаны в статье udisks (Русский).

Монтирование вручную

Примечание: Перед тем, как обвинить Arch Linux в том, что он не монтирует USB устройства, стоит проверить все доступные порты. Часть разъёмов могут не обслуживаться контроллером (или не подключены к контроллеру вообще, в случае портов на передней панели), и устройства физически не смогут монтироваться. Теоретически контроллер портов может оказаться выключенным; для того, чтобы это проверить, нужно зайти в BIOS и отыскать параметр с названием вроде «Onboard USB Controller» — должен быть «Enabled».

Где взять ядро, поддерживающее usb_storage

Если не используется самодельное (самосборное) ядро, то делать ничего не требуется, все официальные ядра Arch Linux настроены как нужно. В случае самосборного ядра следует убедиться, что при компиляции была включена поддержка SCSI, SCSI-Disk и usb_storage. Если установлена последняя версия udev, то можно просто подключить носитель, и система автоматически подгрузит все необходимые модули ядра.

Опознавание устройств

Самое первое, что нужно знать об устройстве, так это его идентификатор, присвоенный ядром. Смотрите fstab (Русский)#Определение файловой системы для подробностей.

Совет: Чтобы узнать, какое именно устройство является нужным вам USB-устройством, можно сравнить вывод lsblk -f (описанный в статье по ссылке) до и после подключения устройства.

Монтирование USB флэш-памяти

Для этого нужно создать папку, в которую в дальнейшем будет монтироваться флэшка:

От имени суперпользователя (root)

Монтировать устройство рутом при помощи команды (только нужно заменить device_node найденным устройством, как было показано выше):

# mount device_node /mnt/usbstick
# mount -U UUID /mnt/usbstick

Если mount не распознаёт формат устройства (файловой системы), то можно попробовать с ключом -t , а также глянуть в mount(8) для просвещения. Если монтирование не работает и на устройстве нет важных данных, можно попробовать отформатировать его или даже пересоздать таблицу разделов.

Разрешить запись обычным пользователям

Чтобы непривилегированные пользователи могли записывать данные на USB носитель, нужно прописать следующую команду:

# mount -o gid=users,fmask=113,dmask=002 /dev/sda1 /mnt/usbstick

Если это не сработало, убедитесь, что файловая система монтируема и доступна для записи суперпользователю (смотрите предыдущий раздел).

Читайте также:  Get process cpu usage linux

От имени обычного пользователя посредством fstab

Если вы хотите, чтобы обычный пользователь имел право монтировать и размонтировать устройство, смотрите FAT (Русский)#Запись на FAT32 в качестве обычного пользователя.

Инструменты монтирования

Есть множество инструментов, облегчающих монтирование от имени обычного пользователя.

Решение проблем

Никакие устройства хранения USB не распознаются системой

Если вы подключили USB-накопитель к компьютеру, но он не отображается в списке lsblk или dmesg, убедитесь, что в BIOS включена функция XHCI Handoff и EHCI Handoff.

Устройство USB определилось, но его не получается примонтировать

Если вы недавно обновили ядро, модули для USB-накопителя для вашего текущего ядра были удалены и заменены модулями для свежеустановленного ядра. Эти модули не смогут загрузиться, пока вы не перезагрузитесь и не запустите новое ядро или не выполните откат пакета ядра до версии, соответствующей текущей версии ядра.

Устройство не выключается после размонтирования всех разделов

Невыключение питания устройства может привести к тому, что:

  • жёсткий диск не припаркует свою головку, издаст слабый царапающий звук при раскручивании и может деградировать [2], или
  • твердотельный диск (особенно старый) не сбросит буферы кэша или не обновит таблицы отображения, что может привести к потере данных [3].

После размонтирования разделов устройство всё ещё включено. Чтобы безопасно извлечь его, необходимо сначала попросить систему выключить его: [4]

# echo 1 > /sys/block/имя_диска/device/delete

Если вы используете udisks, можно использовать следующие команды: [5]

$ udisksctl unmount -b /dev/sdXY $ udisksctl power-off -b /dev/sdX 

Источник

DESCRIPTION

lsusb is a utility for displaying information about USB buses in the system and the devices connected to them. It uses udev’s hardware database to associate a full human-readable name to the vendor ID and the product ID.

OPTIONS

-v, —verbose Tells lsusb to be verbose and display detailed information about the devices shown. This includes configuration descriptors for the device’s current speed. Class descriptors will be shown, when available, for USB device classes including hub, audio, HID, communications, and chipcard. Can be used with the t option. -s [[bus]:][devnum] Show only devices in specified bus and/or devnum. Both IDs are given in decimal and may be omitted. -d [vendor]:[product] Show only devices with the specified vendor and product ID. Both IDs are given in hexadecimal. -D device Do not scan the /dev/bus/usb directory, instead display only information about the device whose device file is given. The device file should be something like /dev/bus/usb/001/001. This option displays detailed information like the v option; you must be root to do this. -t, —tree Tells lsusb to dump the physical USB device hierarchy as a tree. Verbosity can be increased twice with the v option. -V, —version Print version information on standard output, then exit successfully.

RETURN VALUE

If the specified device is not found, a non-zero exit code is returned.

SEE ALSO

AUTHOR

Powered by archmanweb, using mandoc for the conversion of manual pages.

The website is available under the terms of the GPL-3.0 license, except for the contents of the manual pages, which have their own license specified in the corresponding Arch Linux package.

Источник

Оцените статью
Adblock
detector