Virt-Manager Qemu/KVM USB problem

New to Debian (Or Linux in general)? Ask your questions here!

Re: Virt-Manager Qemu/KVM USB problem

Postby CwF » 2019-08-13 22:39

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:
Code: Select all
ENV{ID_SERIAL}=="ST31000528AS_9VPBXMK9", ENV{UDISKS_IGNORE}="1"


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.
CwF
 
Posts: 501
Joined: 2018-06-20 15:16

Re: Virt-Manager Qemu/KVM USB problem

Postby PsySc0rpi0n » 2019-08-14 11:55

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:
Code: Select all
ENV{ID_SERIAL}=="ST31000528AS_9VPBXMK9", ENV{UDISKS_IGNORE}="1"


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.


Ok, I'll try that when I get home.
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
User avatar
PsySc0rpi0n
 
Posts: 117
Joined: 2012-10-24 13:54
Location: Portugal

Re: Virt-Manager Qemu/KVM USB problem

Postby CwF » 2019-08-14 15:41

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!
CwF
 
Posts: 501
Joined: 2018-06-20 15:16

Re: Virt-Manager Qemu/KVM USB problem

Postby PsySc0rpi0n » 2019-08-14 18:09

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!


So, to be safe, better to unmount from host and use it solely in guest, is that it?

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!
User avatar
PsySc0rpi0n
 
Posts: 117
Joined: 2012-10-24 13:54
Location: Portugal

Re: Virt-Manager Qemu/KVM USB problem

Postby PsySc0rpi0n » 2019-08-17 22:06

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:
Image

Any help to solve this? Or do I have to reinstall the damn VM?



edited;
another screenshot
Image

Just another information.
I can login in rescue mode into text mode, meaning no desktop GUI...
Anything I can do here?
User avatar
PsySc0rpi0n
 
Posts: 117
Joined: 2012-10-24 13:54
Location: Portugal

Re: Virt-Manager Qemu/KVM USB problem

Postby CwF » 2019-08-18 13:14

Actually, from the screenshots I don't see the error. I do see evidence of things I wouldn't do, but no errors. If you get past unlocking the drive, and then get to a blank screen, then you need to probe around, it's a config issue in the vm, try a 'startx'. It's salvageable, approach it like bare metal, it's not a vm or disk issue ?

The screenshot shows a clean file system. Other than the fact it does work, I would not recommend passing a single disk encrypted device to a VM. At least set hypervisor caching to 'none'.
Yes, it's good to have ALL OS images setup to be virtualized. Passing the lvm disk should be a rescue or forensics attempt, and not the daily driver. That extra disk should boot the host too btw, so consider setting up your host to be able to be virtualized also, just in case.

There are better ways to utilize extra disk space. I assume the primary host is also on a single disk lvm? If so, any extra space should be linked in to the host disk, but not in a dependent way, and in a crash worthy way. Look into using qcow2 layers and place only the read-write 'runtime' layer on the host. Use the external space for READ-ONLY qcow2 layers, virtual usb qcows, ISO's, or guest controlled simple FS's. I use 3 layers typically, and have 5 disk in my main machine. I do pass 2 spinners to vm's, but with only guest caching.

Before you go much further verify some parachutes. If the power button is setup to shutdown the system it will shut down vm's if the OS is alive and it's some gui lockup. If it is a gui lockup and the system is still running, be aware VM's may continue oblivious to the issue, so learn to identify that, and give things time. It's useful to have a second machine capable of reaching in via ssh, vnc, etc. A vfio assisted vm with it's own kbm can even reach back into host if setup. If the situation is a hardware lock and the OS is indeed froze, identify and fix it before continuing.

Fun!
CwF
 
Posts: 501
Joined: 2018-06-20 15:16

Re: Virt-Manager Qemu/KVM USB problem

Postby PsySc0rpi0n » 2019-08-18 19:50

CwF wrote:Actually, from the screenshots I don't see the error. I do see evidence of things I wouldn't do, but no errors. If you get past unlocking the drive, and then get to a blank screen, then you need to probe around, it's a config issue in the vm, try a 'startx'. It's salvageable, approach it like bare metal, it's not a vm or disk issue ?

The screenshot shows a clean file system. Other than the fact it does work, I would not recommend passing a single disk encrypted device to a VM. At least set hypervisor caching to 'none'.
Yes, it's good to have ALL OS images setup to be virtualized. Passing the lvm disk should be a rescue or forensics attempt, and not the daily driver. That extra disk should boot the host too btw, so consider setting up your host to be able to be virtualized also, just in case.

There are better ways to utilize extra disk space. I assume the primary host is also on a single disk lvm? If so, any extra space should be linked in to the host disk, but not in a dependent way, and in a crash worthy way. Look into using qcow2 layers and place only the read-write 'runtime' layer on the host. Use the external space for READ-ONLY qcow2 layers, virtual usb qcows, ISO's, or guest controlled simple FS's. I use 3 layers typically, and have 5 disk in my main machine. I do pass 2 spinners to vm's, but with only guest caching.

Before you go much further verify some parachutes. If the power button is setup to shutdown the system it will shut down vm's if the OS is alive and it's some gui lockup. If it is a gui lockup and the system is still running, be aware VM's may continue oblivious to the issue, so learn to identify that, and give things time. It's useful to have a second machine capable of reaching in via ssh, vnc, etc. A vfio assisted vm with it's own kbm can even reach back into host if setup. If the situation is a hardware lock and the OS is indeed froze, identify and fix it before continuing.

Fun!



Thank you for replying again.
You address so many things that I don't even know where to start.

My thing with VMs is just to test things instead of using my host machine to mess with things I never messed before.

Anyway, the problem I see is the messages saying:

Volume group "tugarevo-vg" not found
Cannot process volume group tugarevo-vg


Then it all looks fine. Then at the bottom of the first screen there is another message that seems to raise some flags but I have no idea of what it might mean.

[ OK ] Started Restore /etc/resolv.conf if the system crashed befre th ppp link was shut down.


Then, last line is just weir. on't you agree?

Resuming from hibernationet up successfullypatcher Service...


Code: Select all
journal -xb
shows only the same messages about volume tugarevo volume groups cannot be processed.

Where is that option you say about HyperCisor Cache? Is it in IDE isk Options??
Image

You tell me to probe around but I have no more clues of what to do.
I tried "startx" but that an unknown command. I chose not to install any desktop but even so, somehow I got some desktop GUI installed!.

edited;
I tried to set Hypervision to none in the above screenshot but boot freezes here:
Image

No cpu or disk I/O activity whatsoever. :s
User avatar
PsySc0rpi0n
 
Posts: 117
Joined: 2012-10-24 13:54
Location: Portugal

Re: Virt-Manager Qemu/KVM USB problem

Postby CwF » 2019-08-18 20:26

Well I could be doing more harm than good. From the screen shot I see we are not on the same page.

There are many ways to do things, and I'm missing your point and methodology. So I throw out ideas and generalities

The Source path tells me your out bounds to what I'd allow. Can't really address that...
Disk Bus 'IDE' -Why?
Storage format 'qcow2' -thought we we're talking passed disk (raw)?
Cache Mode 'Hypervisor Default' -this is where you find 'none'

IF the broken LVM is on in that qcow2, yes start over.
Keep in mind, not all vm test are valid. No good reason for LVM in a vm. No reason for hibernation either, you do have a pause button ya know?
KISS
CwF
 
Posts: 501
Joined: 2018-06-20 15:16

Re: Virt-Manager Qemu/KVM USB problem

Postby PsySc0rpi0n » 2019-08-18 21:27

CwF wrote:Well I could be doing more harm than good. From the screen shot I see we are not on the same page.

There are many ways to do things, and I'm missing your point and methodology. So I throw out ideas and generalities

The Source path tells me your out bounds to what I'd allow. Can't really address that...
Disk Bus 'IDE' -Why?
Storage format 'qcow2' -thought we we're talking passed disk (raw)?
Cache Mode 'Hypervisor Default' -this is where you find 'none'

IF the broken LVM is on in that qcow2, yes start over.
Keep in mind, not all vm test are valid. No good reason for LVM in a vm. No reason for hibernation either, you do have a pause button ya know?
KISS


Ok, somehow I made it to work again.

Well, about the disk, I don't remember to have changed anything. I guess I just accepted the default options.

And, I need to apologize about the confusion.
About the raw disk, is already past. I got it working but it was not a good solution. What I needed to do with it, would take ages that way, so I end up doing that operation in my local/real laptop and now I'll try to move it to the VM now that it's complete!

So, at this point, no physical drive is needed in my VM. I'm now trying that this operation don't use so much space in disk and if I can manage to set it up that way, I'll be able to proceed from the VM.

But I got the problem fixed by disabling hibernation by booting from Recovery Mode and then issuing the following command from Debian Wiki:
Code: Select all
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target


Debian Wiki - Suspend
User avatar
PsySc0rpi0n
 
Posts: 117
Joined: 2012-10-24 13:54
Location: Portugal

Re: Virt-Manager Qemu/KVM USB problem

Postby CwF » 2019-08-18 21:34

Just keep doing what you're doing. Think, create, break, fix, discover, repeat.
CwF
 
Posts: 501
Joined: 2018-06-20 15:16

Re: Virt-Manager Qemu/KVM USB problem

Postby PsySc0rpi0n » 2019-08-19 18:24

CwF wrote:Just keep doing what you're doing. Think, create, break, fix, discover, repeat.


Definitely...

Thanks
Psy
User avatar
PsySc0rpi0n
 
Posts: 117
Joined: 2012-10-24 13:54
Location: Portugal

Re: Virt-Manager Qemu/KVM USB problem

Postby PsySc0rpi0n » 2019-08-20 21:19

Hi again.

I'm not sure if this is the correct way of doing this but the way to remove internet connectivity from the VM is to actually remove the hardware that emulates the network card which is the selected one in the below image?

Image

Or is there another more graceful way?
User avatar
PsySc0rpi0n
 
Posts: 117
Joined: 2012-10-24 13:54
Location: Portugal

Re: Virt-Manager Qemu/KVM USB problem

Postby CwF » 2019-08-20 23:26

Sure, if not using it. I believe net it is hot-pluggable, test that for me!? Add one and remove it live!

Simpler to use control within the vm if you want it off. It doesn't effect spice control if you remove it, I have some without any.
CwF
 
Posts: 501
Joined: 2018-06-20 15:16

Re: Virt-Manager Qemu/KVM USB problem

Postby PsySc0rpi0n » 2019-08-22 20:42

CwF wrote:Sure, if not using it. I believe net it is hot-pluggable, test that for me!? Add one and remove it live!

Simpler to use control within the vm if you want it off. It doesn't effect spice control if you remove it, I have some without any.


Nice. I removed it. Thanks again.
User avatar
PsySc0rpi0n
 
Posts: 117
Joined: 2012-10-24 13:54
Location: Portugal

Previous

Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 8 guests

fashionable