KVM USB pass Centos6 doesn't work, worked in Centos 5.6

Issues related to software problems.

KVM USB pass Centos6 doesn't work, worked in Centos 5.6

Postby brudny_henry » 2011/08/22 06:01:16

Hello I have very annoying problem with USB passthrough in Centos 6.
My XLM guest file to forward USB ( I checked this manually and using virt manager) :









In Centos 5.6 everything worked ok, but now I get errors in my /var/log/libvirt/VM.log:
husb: open device 4.4
/dev/bus/usb/004/004: Operation not permitted
husb: open device 4.4
/dev/bus/usb/004/004: Operation not permitted

I checked my /dev/bus/usb/004/002 permissions and they were like:

crw-rw-rw- 1 qemu qemu 189, 384 08-22 01:21 002

It is strange because I have changed in /etc/libvirt/qemu.conf options:
# The user ID for QEMU processes run by the system instance
user = "root"

# The group ID for QEMU processes run by the system instance
group = "root"

# Whether libvirt should dynamically change file ownership
# to match the configured user/group above. Defaults to 1.
# Set to 0 to disable file ownership changes.
dynamic_ownership = 0


Can you please help me?
brudny_henry
 
Posts: 4
Joined: 2010/11/04 11:15:04

Re: KVM USB pass Centos6 doesn't work, worked in Centos 5.6

Postby fmpdfs » 2011/08/23 09:04:33

Confirm. On the 2 servers stopped working.
1) hp proliant ml350 g5
2) AMD Phenom 2 X4 Based

Which packages should be installed for this feature to work?

Thank you very much
fmpdfs
 
Posts: 2
Joined: 2011/08/23 08:46:18

Re: KVM USB pass Centos6 doesn't work, worked in Centos 5.6

Postby fmpdfs » 2011/08/25 12:21:39

Scientific Linux 6.1 kvm

USB Pass worked fine.
fmpdfs
 
Posts: 2
Joined: 2011/08/23 08:46:18

Re: KVM USB pass Centos6 doesn't work, worked in Centos 5.6

Postby amtowsbnp » 2011/09/30 12:27:00

I added my USB device path to the whitelist in /etc/libvirt/qemu.conf.

BEFORE

#cgroup_device_acl = [
# "/dev/null", "/dev/full", "/dev/zero",
# "/dev/random", "/dev/urandom",
# "/dev/ptmx", "/dev/kvm", "/dev/kqemu",
# "/dev/rtc", "/dev/hpet", "/dev/net/tun",
#]


AFTER

cgroup_device_acl = [
"/dev/null", "/dev/full", "/dev/zero",
"/dev/random", "/dev/urandom",
"/dev/ptmx", "/dev/kvm", "/dev/kqemu",
"/dev/rtc", "/dev/hpet", "/dev/net/tun",
"/dev/bus/usb/008/001",
]

Then restart libvirtd.

service libvirtd restart

Note, I did not change the user, group, and dynamic values from the defaults in the qemu.conf file.
amtowsbnp
 
Posts: 5
Joined: 2011/09/30 12:17:44

Re: KVM USB pass Centos6 doesn't work, worked in Centos 5.6

Postby amtowsbnp » 2011/10/03 21:38:13

I am running a CentOS 6.0 x86_64 system as a KVM host. I wanted to run a USB 2.0 smart card reader as pass-through device to a Microsoft Windows 7 (32-bit) guest.

Under CentOS 5.6, all I had to do was blacklist the ehci_hcd module and configure the USB device as a pass-through to the guest. I blacklisted the ehci_hcd module because the USB smart card reader would not work properly under the guest OS unless I removed USB 2.0 functionality from the host system. The BIOS didn't provide a way to force a specific USB version on a particular outlet or globally. I removed USB 2.0 functionality, but that was not an issue considering I only had this one USB device that I wanted to use. In the end, I could always modprobe ehci_hcd if I needed USB 2.0 functionality again for some other reason.

In CentOS 6.0, it appears that ehci_hcd is compiled into the kernel. What I did for CentOS 5.6 was a no-go for CentOS 6.0.

Following are the steps I completed to workaround the problem.

# as root user
chkconfig openct off
chkconfig pcscd off
yum install screen rpm-build rpmdevtools yum-utils
wget http://ftp.osuosl.org/pub/centos/6.0/up ... l6.src.rpm \
-O /var/tmp/kernel-2.6.32-71.29.1.el6.src.rpm
yum-builddep /var/tmp/kernel-2.6.32-71.29.1.el6.src.rpm
useradd rpmbuild
screen
su - rpmbuild

# as rpmbuild user
rpmdev-setuptree
cd ~/rpmbuild/SOURCES/
rpm -ivh /var/tmp/kernel-2.6.32-71.29.1.el6.src.rpm
sed -r -i 's|^(CONFIG_USB_EHCI_HCD)=(y)$|\1=m|' config-generic
cd ../SPECS
sed -r -i 's|^(#) (%) (define buildid) (.local)$|\2\3 .no_echi_hcd|' kernel.spec
nice -n +19 rpmbuild -ba kernel.spec --with firmware

# after the build completes, which takes awhile
exit # logout rpmbuild
exit # leave root's screen session

# as root user
echo 'blacklist ehci_hcd' > /etc/modprobe.d/blacklist-ehci_hcd.conf
yum install ~rpmbuild/rpmbuild/RPMS/x86_64/kernel-2.6.32-71.29.1.el6.no_echi_hcd.x86_64.rpm \
~rpmbuild/rpmbuild/RPMS/x86_64/kernel-firmware-2.6.32-71.29.1.el6.no_echi_hcd.x86_64.rpm
sed -r -i 's|^(\s+kernel /vmlinuz-2.6.32-71.29.1.el6.no_echi_hcd.x86_64 ro .+)$|\1 rd.blacklist=ehci_hcd|' /boot/grub/grub.conf

# edit the /etc/libvirt/qemu.conf file as indicated in my previous post.

# Don't forget to clean up your /var/tmp directory.
shutdown -ry now

# Upon reboot of the KVM host, use virt-manager to add the
# USB device to the guest as a passthrough device, then boot the guest.
amtowsbnp
 
Posts: 5
Joined: 2011/09/30 12:17:44

Re: KVM USB pass Centos6 doesn't work, worked in Centos 5.6

Postby cac2s » 2011/10/12 10:55:44

confirm
same problem.
is any chance to rosolve it without kernel patching?
cac2s
 
Posts: 7
Joined: 2011/10/11 13:50:06

KVM USB pass Centos6 doesn't work, worked in Centos 5.6

Postby toracat » 2011/10/12 15:25:21

cac2s wrote:
confirm
same problem.
is any chance to rosolve it without kernel patching?

The patch can be included in the centosplus kernel if a request is made. This way, you would not need to rebuild the kernel yourself.
User avatar
toracat
Forum Moderator
 
Posts: 6688
Joined: 2006/09/03 16:37:24
Location: California, US

Re: KVM USB pass Centos6 doesn't work, worked in Centos 5.6

Postby amtowsbnp » 2011/10/13 18:33:07

Don't want to build a new kernel? How about trying out the latest QEMU which appears to have USB 2.0 support. Review the changelogs.

http://wiki.qemu.org/ChangeLog/0.14
http://wiki.qemu.org/ChangeLog/0.15

# as rpmbuild user
git clone git://git.qemu.org/qemu.git
cd qemu
git branch -r
git checkout -t origin/stable-0.15
./configure --target-list=x86_64-softmmu
make

# as root user
cd /usr
tar --xattrs -czf local.$(date "+%d-%b-%Y").tar.gz local
cd ~rpmbuild/qemu
make install
chcon -t qemu_exec_t /usr/local/bin/qemu-*
sed -i 's|/usr/libexec/qemu-kvm|/usr/local/bin/qemu-system-x86_64|' /etc/libvirt/qemu/test-pc.xml
virsh define /etc/libvirt/qemu/test-pc.xml

# at this point, you can use virt-manager to configure the usb passthrough, or edit the xml manually.
# review the doc in ~rpmbuild/qemu/docs/usb2.txt for ehci details.

# can't figure it out or just want to ditch after you compiled and installed it
cd /usr
rm -rf local
tar -xzf local.$(date "+%d-%b-%Y").tar.gz
restorecon -v -R local
amtowsbnp
 
Posts: 5
Joined: 2011/09/30 12:17:44

Re: KVM USB pass Centos6 doesn't work, worked in Centos 5.6

Postby cac2s » 2011/10/17 06:22:49

the problem will be resolved in 6.1, because updating from CR repo (continuous release) resolves problem with pass-thru

sorry for my English :-(
cac2s
 
Posts: 7
Joined: 2011/10/11 13:50:06

Re: KVM USB pass Centos6 doesn't work, worked in Centos 5.6

Postby majun » 2011/11/22 16:31:01

Didn't work for me, see here.

What did you do to get it working?
majun
 
Posts: 129
Joined: 2010/03/11 11:33:59

Next

Return to CentOS 5 - Software Support

Who is online

Users browsing this forum: No registered users and 0 guests