I was required to auto map a USB DoK to a KVM VM (specific VM, mind you!), as a result of connecting this device to the host. I’ve looked it up on the Internet, and the closest I could get there was this link. It was almost a complete solution, but it had a few bugs, so I will re-describe the whole process, with the fixes I’ve added to the process and udev rules file. While this guide is rather old, it did solve my requirement, which was to map a specific set of devices (“known USB devices”) to the VM, and not any and every USB device (or even – USB DoK) connected to the system.
In my example, I’ve used SanDisk Corp. Ultra Fit, which its USB identifier is 0781:5583, as can be seen using ‘lsusb’ command:
[root@localhost ~]# lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 020: ID 0781:5583 SanDisk Corp. Ultra Fit
My VM is called “centos7.0” in this example. I am using integrated KVM+QEMU+LIBVIRT on a generic CentOS 7.5 system.
Preparation
You will need to prepare two files:
USB definitions file (for easier config of libvirt)
UDEV rules file (which will be triggered by add/remove operation, and will call the USB definitions file)
USB Definitions file
I’ve placed it in /opt/autousb/hostdev-0781:5583.xml , and it holds the following (mind the USB device identifiers!)
I’ve created a file /etc/udev/rules.d/90-libvirt-usb.rules with the content below. Note that the device identifiers are there, but in the “remove” section they appear differently. Remove leading zero(s) and change the string. This is caused because on removal, the device does not report all its properties to the OS. Also – you cannot connect more than three (3) such devices to a VM, so when you fail to detach three devices (following a consecutive insert/remove operations, for example), you will not be able to attach a fourth time.
My brother is a computer illiterate. He can use a computer for the purpose of e-mail messaging and for editing documents, spreadsheets, etc. I have decided to “abuse” his older laptop, an IBM X31 and install Ubuntu on it. This is some sort of an experiment. I wonder how he, a simple user, can cope…
For some reason, my home Internet connection stopped receiving large packets. This could be something with PMTU discovery blocks on the ISP side, or it could be something that I changed. An automated job which uploaded files using SSH (to be exact: scp) to my home stopped working. The failure was a time-out after the…
After upgrading my laptop to 2.6.15.1 kernel, hibernation worked flawlessly. Running my previous version of kernel – 2.6.14.2, I have had some hibernation instabilities. I’ve had some memory corruptions here and there, which would have required I reboot the machine. So far, and it’s been a while, I’m glad to say I had no reason…
Not too long ago I have purchased a brand new Hitachi HW100 Workgroup Storage. 14+1 400GB SATA disks, dual-interface, each holding two fiber ports (2Gb/s LC). A nice machine. However, two limitations I have discovered are clouding my day: 1. It supports only Raid0 and Raid5. It will not allow me no-parity Raid, aka, Raid1….
Well, my Orinoco 802.11b mini-pci card had this weird thing – sometimes it failed to start up after suspend. Why? I don’t know. I wasn’t able to understand the cause of it, and not being a coder, I had some hard time tracking kernel driver problems. The error message was the following one: orinoco_lock() called…
Kernel version 2.6.16.9, so I will supply its config file here config-2.6.16.9.txt. Same procedure as before. Good luck. Related posts: Kernel update – 2.6.14.2 Kernel update – 2.6.15.1 Laptop Kernel update. Seems like a success Powered by YARPP.
One Comment