QubesOS / qubes-issues

The Qubes OS Project issue tracker
https://www.qubes-os.org/doc/issue-tracking/
535 stars 47 forks source link

"operation failed: domain <name> already exists with uuid..." #1910

Closed tasket closed 1 year ago

tasket commented 8 years ago

Qubes OS version (e.g., R3.1):

R3.1

Affected TemplateVMs (e.g., fedora-23, if applicable):

fedora-23


Expected behavior:

Template is trimmed without error

Actual behavior:

When trying to use qvm-trim-template I get one of two errors:

Errno 17: file exists '/var/lib/qubes/appvms/fedora-23-fstrim'

or

libvirterror operation failed: domain 'fedora-23-fstrim' already exists with uuid ....

Steps to reproduce the behavior:

$ qvm-trim-template fedora-23

General notes:

Rebooting Qubes has not helped.


Related issues:

Relevant labels:

tasket commented 8 years ago

(This new issue template needs a section for general notes/description.)

andrewdavidwong commented 8 years ago

(This new issue template needs a section for general notes/description.)

Thanks; I'll add one.

tasket commented 8 years ago

I noticed there is now a 'fedora-23-fstrim' entry in my KDE launcher menu. Hmmm!

cryptix commented 7 years ago

I also ran into this when qubes couldn't start the trim vm because of low memory. I naively deleted the folder and tried again but now there seems to be a orphaned entry in libvirt's db. Is there a manual step to remove that, too?

Disk usage before:
3974352 /var/lib/qubes/vm-templates/whonix-ws/root.img
1596676 /var/lib/qubes/vm-templates/whonix-ws/root-cow.img.old
5571028 total
Creating temporary VM...
--> Creating volatile image: /var/lib/qubes/appvms/trim-whonix-ws/volat
--> Loading the VM (type = AppVM)...
Traceback (most recent call last):
  File "/usr/bin/qvm-trim-template", line 171, in <module>
    main()
  File "/usr/bin/qvm-trim-template", line 116, in main
    fstrim_vm.start(start_guid=False, verbose=True)
  File "/usr/lib64/python2.7/site-packages/qubes/modules/000QubesVm.py"
    qmemman_client = self.request_memory(mem_required)
  File "/usr/lib64/python2.7/site-packages/qubes/modules/000QubesVm.py"
    raise MemoryError ("ERROR: insufficient memory to start VM '%s'" % 
MemoryError: ERROR: insufficient memory to start VM 'trim-whonix-ws'
[cryptix@dom0 ~]$ qvm-trim-template whonix-ws
Disk usage before:
3974352 /var/lib/qubes/vm-templates/whonix-ws/root.img
Creating temporary VM...
Traceback (most recent call last):
  File "/usr/bin/qvm-trim-template", line 171, in <module>
    main()
  File "/usr/bin/qvm-trim-template", line 115, in main
    fstrim_vm.create_on_disk()
  File "/usr/lib64/python2.7/site-packages/qubes/modules/000QubesVm.py"
    self.storage.create_on_disk(verbose, source_template)
  File "/usr/lib64/python2.7/site-packages/qubes/storage/__init__.py", 
    os.mkdir (self.vmdir)
OSError: [Errno 17] File exists: '/var/lib/qubes/appvms/trim-whonix-ws'
[cryptix@dom0 ~]$ rm -rf /var/lib/qubes/appvms/trim-whonix-ws/
[cryptix@dom0 ~]$ qvm-trim-template whonix-ws
Disk usage before:
3974352 /var/lib/qubes/vm-templates/whonix-ws/root.img
Creating temporary VM...
Traceback (most recent call last):
  File "/usr/bin/qvm-trim-template", line 171, in <module>
    main()
  File "/usr/bin/qvm-trim-template", line 115, in main
    fstrim_vm.create_on_disk()
  File "/usr/lib64/python2.7/site-packages/qubes/modules/000QubesVm.py", line 1308, in create_on_disk
    self._update_libvirt_domain()
  File "/usr/lib64/python2.7/site-packages/qubes/modules/000QubesVm.py", line 755, in _update_libvirt_domain
    raise e
libvirt.libvirtError: operation failed: domain 'trim-whonix-ws' already exists with uuid 779fdd96-a4d9-4f25-bdd4-ca9d35c33ef9
[cryptix@dom0 ~]$ qvm-remove trim-whonix-ws
A VM with the name 'trim-whonix-ws' does not exist in the system.
[cryptix@dom0 ~]$ qvm-remove --just-db trim-whonix-ws
A VM with the name 'trim-whonix-ws' does not exist in the system.
marmarek commented 7 years ago

Yes, you can remove it from libvirt by virsh -c xen:/// undefine trim-whonix-ws.

SuzanneSoy commented 5 years ago

I had this issue on R4.0 with a simple qvm-start the-vm, it gives the error Domain the-vm has failed to start: operation failed: domain 'the-vm' already exists with uuid xxx…

The VM originally failed to start on startup after a few seconds. Thinking that the VM (which was restored from a backup) was in an inconsistent state (e.g. some startup service had a problem), I deleted the VM and re-created it (it's a throwaway service VM).

Now, the error above appears immediately and the VM doesn't start at all.

I tried rebooting Qubes, deleting the VM and re-creating it again: still the same error which appears instantly.

I re-created the VM with the same exact configuration (memory, vcpus etc. : it's created automatically by a script) but with a different name, and that one starts without any issues.

virsh -c xen:/// undefine the-vm solved the issue.

fepitre commented 5 years ago

I also experienced this trouble when executing multiple times Salt formulas for creating VM and then deleting them. I confirm that undefining the vm using virsh solved the problem as they some VMs were still existing under virsh database.

andrewdavidwong commented 5 years ago

(Generalized issue title.)

DemiMarie commented 3 years ago

virsh undefine solved this problem when it happened for me.

marmarek commented 3 years ago

Have anybody seen this issue recently? There were related changes since this issue was originally reported, so if there are no fresh confirmations it is still an issue, I'd close it as fixed.

github-actions[bot] commented 1 year ago

This issue is being closed because:

If anyone believes that this issue should be reopened and reassigned to an active milestone, please leave a brief comment. (For example, if a bug still affects Qubes OS 4.1, then the comment "Affects 4.1" will suffice.)