Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
Virt-Manager Qemu/KVM USB problem
- PsySc0rpi0n
- Posts: 322
- Joined: 2012-10-24 13:54
- Location: Bitcoin World
- Has thanked: 8 times
- Been thanked: 1 time
Virt-Manager Qemu/KVM USB problem
Hello.
I'm having an issue when trying to add an external USB hard disk to my Virt-Manager. I'm trying some new stuff in a Debian environment inside Virt-Manager.
These are the steps I take.
On VM settings I set USBController to USB3.0
Then, click on "Add hardware" button
Then, I choose "USB Host Device" and click on my "Western Digital" external USB drive and "Finish".
The hardware is added and visible:
When I try to run my VM I get this error:
This drive is not mounted in my laptop (host) so it's not being used (I guess).
'lsusb' shows the drive there and it's ok.
Anyone knows what is wrong?
I'm having an issue when trying to add an external USB hard disk to my Virt-Manager. I'm trying some new stuff in a Debian environment inside Virt-Manager.
These are the steps I take.
On VM settings I set USBController to USB3.0
Then, click on "Add hardware" button
Then, I choose "USB Host Device" and click on my "Western Digital" external USB drive and "Finish".
The hardware is added and visible:
When I try to run my VM I get this error:
This drive is not mounted in my laptop (host) so it's not being used (I guess).
'lsusb' shows the drive there and it's ok.
Anyone knows what is wrong?
-
- Global Moderator
- Posts: 2709
- Joined: 2018-06-20 15:16
- Location: Colorado
- Has thanked: 41 times
- Been thanked: 201 times
Re: Virt-Manager Qemu/KVM USB problem
Don't pre-attach it.
AFTER the vm is up and running use the menu on the viewer window to attach usb devices dynamically. The alternate virt-viewer has a nicer menu to do so. The cli option to do so is stupid complex.
Option 2, vfio pass a real port to total usb control withing the vm. Then you could boot from it.
AFTER the vm is up and running use the menu on the viewer window to attach usb devices dynamically. The alternate virt-viewer has a nicer menu to do so. The cli option to do so is stupid complex.
Option 2, vfio pass a real port to total usb control withing the vm. Then you could boot from it.
- PsySc0rpi0n
- Posts: 322
- Joined: 2012-10-24 13:54
- Location: Bitcoin World
- Has thanked: 8 times
- Been thanked: 1 time
Re: Virt-Manager Qemu/KVM USB problem
I think I tried that and I got a message saying that I had "no free USB ports".
I have no idea what to do to fix this. I searched Google/DuckDuckGo but no relevant results came up!
I have no idea what to do to fix this. I searched Google/DuckDuckGo but no relevant results came up!
-
- Global Moderator
- Posts: 2709
- Joined: 2018-06-20 15:16
- Location: Colorado
- Has thanked: 41 times
- Been thanked: 201 times
Re: Virt-Manager Qemu/KVM USB problem
Assuming your vm has usb ports...
You do NOT use virt-manager!
repeat, once the vm is running, that window has a menu, the tab is 'Virtual Machine' and the last menu entry is 'Redirect USB Device'.
part 1a, if you are using virt-viewer the menu is 'File'> 'USB Device Selection'
The device shows up on the host, then you do either the above and onto the vm it goes.
Note both viewers have a drop down while in full screen (hover top edge center) and virt-viewer has a usb icon right there..
Totally different is using vfio to pass the usb PORT, using the manager to attach the PCI HOST DEVICE.
I recommend not using virt-managers 'Add Hardware'> 'USB Host Device' prior to starting the vm, because...
You do NOT use virt-manager!
repeat, once the vm is running, that window has a menu, the tab is 'Virtual Machine' and the last menu entry is 'Redirect USB Device'.
part 1a, if you are using virt-viewer the menu is 'File'> 'USB Device Selection'
The device shows up on the host, then you do either the above and onto the vm it goes.
Note both viewers have a drop down while in full screen (hover top edge center) and virt-viewer has a usb icon right there..
Totally different is using vfio to pass the usb PORT, using the manager to attach the PCI HOST DEVICE.
I recommend not using virt-managers 'Add Hardware'> 'USB Host Device' prior to starting the vm, because...
- PsySc0rpi0n
- Posts: 322
- Joined: 2012-10-24 13:54
- Location: Bitcoin World
- Has thanked: 8 times
- Been thanked: 1 time
Re: Virt-Manager Qemu/KVM USB problem
Where do I check if my VM has USB ports?CwF wrote:Assuming your vm has usb ports...
You do NOT use virt-manager!
repeat, once the vm is running, that window has a menu, the tab is 'Virtual Machine' and the last menu entry is 'Redirect USB Device'.
part 1a, if you are using virt-viewer the menu is 'File'> 'USB Device Selection'
The device shows up on the host, then you do either the above and onto the vm it goes.
Note both viewers have a drop down while in full screen (hover top edge center) and virt-viewer has a usb icon right there..
Totally different is using vfio to pass the usb PORT, using the manager to attach the PCI HOST DEVICE.
I recommend not using virt-managers 'Add Hardware'> 'USB Host Device' prior to starting the vm, because...
I don't understand what you mean by "You do NOT use vit-manager". That's what I'm using. Virt-Manager and Qemu/KVM...
-
- Global Moderator
- Posts: 2709
- Joined: 2018-06-20 15:16
- Location: Colorado
- Has thanked: 41 times
- Been thanked: 201 times
Re: Virt-Manager Qemu/KVM USB problem
Once you have a vm running, in a window, a window that is not the virt-manager window, but the particular vm window, that has the menu.
The window title will be "buster on Qemu/KVM", or whatever on Qemu/KVM. That window does NOT have a title of "Virtual Machine Manager"
So if no vm is not running, you have no window! Get the vm running, then start poking around its menu choices...You are not probing hard enough.
The window title will be "buster on Qemu/KVM", or whatever on Qemu/KVM. That window does NOT have a title of "Virtual Machine Manager"
So if no vm is not running, you have no window! Get the vm running, then start poking around its menu choices...You are not probing hard enough.
- PsySc0rpi0n
- Posts: 322
- Joined: 2012-10-24 13:54
- Location: Bitcoin World
- Has thanked: 8 times
- Been thanked: 1 time
Re: Virt-Manager Qemu/KVM USB problem
CwF wrote:Once you have a vm running, in a window, a window that is not the virt-manager window, but the particular vm window, that has the menu.
The window title will be "buster on Qemu/KVM", or whatever on Qemu/KVM. That window does NOT have a title of "Virtual Machine Manager"
So if no vm is not running, you have no window! Get the vm running, then start poking around its menu choices...You are not probing hard enough.
Ah ok, I completely misunderstood your sentence. Ok, I'll try that!
-
- Global Moderator
- Posts: 2709
- Joined: 2018-06-20 15:16
- Location: Colorado
- Has thanked: 41 times
- Been thanked: 201 times
Re: Virt-Manager Qemu/KVM USB problem
Sorry, my focus is distracted, let me start over. I'm mixing in my use of a different viewer...
In your first screen shot this is the vm window, the right one!
The menu is 'File' 'Virtual Machine' 'View' 'Send Key'.
Click on 'Virtual Machine' and tell me what is the bottom menu entry.
Should be 'Redirect USB Device'.
Click on that while the icon 'Show the Graphical Console' is active, the one to the left of the active 'Show Virtual Hardware Details' in your screen shot.
The option 'Redirect USB Device' is greyed out unless the vm is running.
In your first screen shot this is the vm window, the right one!
The menu is 'File' 'Virtual Machine' 'View' 'Send Key'.
Click on 'Virtual Machine' and tell me what is the bottom menu entry.
Should be 'Redirect USB Device'.
Click on that while the icon 'Show the Graphical Console' is active, the one to the left of the active 'Show Virtual Hardware Details' in your screen shot.
The option 'Redirect USB Device' is greyed out unless the vm is running.
- PsySc0rpi0n
- Posts: 322
- Joined: 2012-10-24 13:54
- Location: Bitcoin World
- Has thanked: 8 times
- Been thanked: 1 time
Re: Virt-Manager Qemu/KVM USB problem
No, you were right. It's just that the sentence was like duplicate meaning... And I caught the one I shouldn't. (I mean when you said "I do NOT use Vit-Manager"). I understood all the rest and managed to do what you said and it worked...CwF wrote:Sorry, my focus is distracted, let me start over. I'm mixing in my use of a different viewer...
In your first screen shot this is the vm window, the right one!
The menu is 'File' 'Virtual Machine' 'View' 'Send Key'.
Click on 'Virtual Machine' and tell me what is the bottom menu entry.
Should be 'Redirect USB Device'.
Click on that while the icon 'Show the Graphical Console' is active, the one to the left of the active 'Show Virtual Hardware Details' in your screen shot.
The option 'Redirect USB Device' is greyed out unless the vm is running.
It's done.
Thanks
- PsySc0rpi0n
- Posts: 322
- Joined: 2012-10-24 13:54
- Location: Bitcoin World
- Has thanked: 8 times
- Been thanked: 1 time
Re: Virt-Manager Qemu/KVM USB problem
I'll use this thread to ask more questions about Virt-Manager and Qemu/KVM
For instance, how can I share host and client machine's clipboard so that I can copy/paste between both?
For instance, how can I share host and client machine's clipboard so that I can copy/paste between both?
-
- Global Moderator
- Posts: 2709
- Joined: 2018-06-20 15:16
- Location: Colorado
- Has thanked: 41 times
- Been thanked: 201 times
Re: Virt-Manager Qemu/KVM USB problem
A default virt-manager created vm should have the qemu-ga and spice channels, so no concern on the host.
In the guest install spice-vdagent and use xserver-xorg-video-qxl, other video drivers work too.
There are the same for windows from Fedora.
With 5+ vm's communicating sometimes a few channels drop off after weeks of uptime, haven't traced that out. If you're mixing in Wayland, since it's inferior in function, I don't care...
If and when you get serious with vfio passed gpu's, add a passed nic to the vm and you can use x2x for linux guest and it is far superior offering functional multi-media keys and the like, more mouse-hoover functions work, etc. x2vnc also works, and may work for a wayland desktop. They both use their own c-n-p functions and do work.
Note the primary and secondary clipboards can get tangled. I've used things to help, whatever clipboard managers but found they can trap contents so no advice there. middleclick c-n-p on the host often has the contents from a gui copy on a guest.
In the guest install spice-vdagent and use xserver-xorg-video-qxl, other video drivers work too.
There are the same for windows from Fedora.
With 5+ vm's communicating sometimes a few channels drop off after weeks of uptime, haven't traced that out. If you're mixing in Wayland, since it's inferior in function, I don't care...
If and when you get serious with vfio passed gpu's, add a passed nic to the vm and you can use x2x for linux guest and it is far superior offering functional multi-media keys and the like, more mouse-hoover functions work, etc. x2vnc also works, and may work for a wayland desktop. They both use their own c-n-p functions and do work.
Note the primary and secondary clipboards can get tangled. I've used things to help, whatever clipboard managers but found they can trap contents so no advice there. middleclick c-n-p on the host often has the contents from a gui copy on a guest.
- PsySc0rpi0n
- Posts: 322
- Joined: 2012-10-24 13:54
- Location: Bitcoin World
- Has thanked: 8 times
- Been thanked: 1 time
Re: Virt-Manager Qemu/KVM USB problem
CwF wrote:A default virt-manager created vm should have the qemu-ga and spice channels, so no concern on the host.
In the guest install spice-vdagent and use xserver-xorg-video-qxl, other video drivers work too.
There are the same for windows from Fedora.
With 5+ vm's communicating sometimes a few channels drop off after weeks of uptime, haven't traced that out. If you're mixing in Wayland, since it's inferior in function, I don't care...
If and when you get serious with vfio passed gpu's, add a passed nic to the vm and you can use x2x for linux guest and it is far superior offering functional multi-media keys and the like, more mouse-hoover functions work, etc. x2vnc also works, and may work for a wayland desktop. They both use their own c-n-p functions and do work.
Note the primary and secondary clipboards can get tangled. I've used things to help, whatever clipboard managers but found they can trap contents so no advice there. middleclick c-n-p on the host often has the contents from a gui copy on a guest.
Yeah, I managed to find that out while searching internet. It's working now. At least from client to host. Haven't tried the other way around tough!.
Thank you @CwF
- PsySc0rpi0n
- Posts: 322
- Joined: 2012-10-24 13:54
- Location: Bitcoin World
- Has thanked: 8 times
- Been thanked: 1 time
Re: Virt-Manager Qemu/KVM USB problem
Oh nice, that's also handy!CwF wrote:Also, you can graphically drag a file from the host to the guest desktop - it's one way, no guest to host.
Thank you
- PsySc0rpi0n
- Posts: 322
- Joined: 2012-10-24 13:54
- Location: Bitcoin World
- Has thanked: 8 times
- Been thanked: 1 time
Re: Virt-Manager Qemu/KVM USB problem
I have another question.
I need to add/share a SATA disk I have in my laptop with my VM. I searched but only thing I found is to edit some XML file and add some lines.
Isn't there another way?
I need to add/share a SATA disk I have in my laptop with my VM. I searched but only thing I found is to edit some XML file and add some lines.
Isn't there another way?
-
- Global Moderator
- Posts: 2709
- Joined: 2018-06-20 15:16
- Location: Colorado
- Has thanked: 41 times
- Been thanked: 201 times
Re: Virt-Manager Qemu/KVM USB problem
Yes, simpler than many say. If this doesn't work for you, I don't know why?! Another guy I explained this to said he had permission problems, then it worked, then didn't hold after a reboot, then deleted the thread here, probably because it did work and he figured out what he was doing wrong!
Create a link for the disk in question, /dev/disk/by-id/your disk or by-label if it's labeled, in the directory /var/lib/libvirt/images. This needs done by root.
Then, with the link in the standard storage pool, refresh if needed and using virt-manager attach this in the VM's properties page with 'Select or Create Custom Storage'. It will be storage type Disk, storage format raw, hypervisor default caching should be ok, or none.
Actual example:
/var/lib/libvirt/ata-ST31000528AS_9VPBXMK9 links to /dev/disk/by-id/ata-ST31000528AS_9VPBXMK9
I add a step to hide this disk from the desktop and others,
Create the file /etc/udev/rules.d/99-hide-partition.rules with the following content:
You can leave the disk attached to the vm, umount in the vm, and mount on the host while the guest is live, umount from the host and remount in the vm. BE VERY CAREFUL.
Create a link for the disk in question, /dev/disk/by-id/your disk or by-label if it's labeled, in the directory /var/lib/libvirt/images. This needs done by root.
Then, with the link in the standard storage pool, refresh if needed and using virt-manager attach this in the VM's properties page with 'Select or Create Custom Storage'. It will be storage type Disk, storage format raw, hypervisor default caching should be ok, or none.
Actual example:
/var/lib/libvirt/ata-ST31000528AS_9VPBXMK9 links to /dev/disk/by-id/ata-ST31000528AS_9VPBXMK9
I add a step to hide this disk from the desktop and others,
Create the file /etc/udev/rules.d/99-hide-partition.rules with the following content:
Code: Select all
ENV{ID_SERIAL}=="ST31000528AS_9VPBXMK9", ENV{UDISKS_IGNORE}="1"
- PsySc0rpi0n
- Posts: 322
- Joined: 2012-10-24 13:54
- Location: Bitcoin World
- Has thanked: 8 times
- Been thanked: 1 time
Re: Virt-Manager Qemu/KVM USB problem
Ok, I'll try that when I get home.CwF wrote:Yes, simpler than many say. If this doesn't work for you, I don't know why?! Another guy I explained this to said he had permission problems, then it worked, then didn't hold after a reboot, then deleted the thread here, probably because it did work and he figured out what he was doing wrong!
Create a link for the disk in question, /dev/disk/by-id/your disk or by-label if it's labeled, in the directory /var/lib/libvirt/images. This needs done by root.
Then, with the link in the standard storage pool, refresh if needed and using virt-manager attach this in the VM's properties page with 'Select or Create Custom Storage'. It will be storage type Disk, storage format raw, hypervisor default caching should be ok, or none.
Actual example:
/var/lib/libvirt/ata-ST31000528AS_9VPBXMK9 links to /dev/disk/by-id/ata-ST31000528AS_9VPBXMK9
I add a step to hide this disk from the desktop and others,
Create the file /etc/udev/rules.d/99-hide-partition.rules with the following content:You can leave the disk attached to the vm, umount in the vm, and mount on the host while the guest is live, umount from the host and remount in the vm. BE VERY CAREFUL.Code: Select all
ENV{ID_SERIAL}=="ST31000528AS_9VPBXMK9", ENV{UDISKS_IGNORE}="1"
However, the last part of your post says I can mount and unmount and etc while VM is live. Then, you say BE VERY CAREFUL... Why is this? Am I getting into dangerous fields? How come? What are the risks?
Thanks
Psy
-
- Global Moderator
- Posts: 2709
- Joined: 2018-06-20 15:16
- Location: Colorado
- Has thanked: 41 times
- Been thanked: 201 times
Re: Virt-Manager Qemu/KVM USB problem
It is possible to have a disk in this fashion mounted twice, on the host and in a vm. That's not good, yet you will get no warning. Typically the secondary mount will appear to work fine, but changes may be held in cache and never committed to disk. Just saying cool magic functionality and disaster are close friends. Similar issues can happen with improper use of guestmount.
My posting may sometimes deserve a disclaimer!
My posting may sometimes deserve a disclaimer!
- PsySc0rpi0n
- Posts: 322
- Joined: 2012-10-24 13:54
- Location: Bitcoin World
- Has thanked: 8 times
- Been thanked: 1 time
Re: Virt-Manager Qemu/KVM USB problem
So, to be safe, better to unmount from host and use it solely in guest, is that it?CwF wrote:It is possible to have a disk in this fashion mounted twice, on the host and in a vm. That's not good, yet you will get no warning. Typically the secondary mount will appear to work fine, but changes may be held in cache and never committed to disk. Just saying cool magic functionality and disaster are close friends. Similar issues can happen with improper use of guestmount.
My posting may sometimes deserve a disclaimer!
Where can I see the pool? I only remember it when about to create a new VM!???
Edited;
Forget about the pool. I foun it.
However I can't find the option 'raw' and I have another option you don't mention:
BUS TYPE:
-IDE
-SATA
-SCSI
-SD
-USB
-VirtIO
I chose VirtIO and going to restart VM now!
I'm having issues is with unmounting it from the host!
Edited;
I think I got it!
- PsySc0rpi0n
- Posts: 322
- Joined: 2012-10-24 13:54
- Location: Bitcoin World
- Has thanked: 8 times
- Been thanked: 1 time
Re: Virt-Manager Qemu/KVM USB problem
New problem with my VM...
I had to force restart my host and couldn't gracefully shutdown my guest OS.
Now when I reboot the VM I always get this for ever:
Any help to solve this? Or do I have to reinstall the damn VM?
edited;
another screenshot
Just another information.
I can login in rescue mode into text mode, meaning no desktop GUI...
Anything I can do here?
I had to force restart my host and couldn't gracefully shutdown my guest OS.
Now when I reboot the VM I always get this for ever:
Any help to solve this? Or do I have to reinstall the damn VM?
edited;
another screenshot
Just another information.
I can login in rescue mode into text mode, meaning no desktop GUI...
Anything I can do here?