New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libvirterror: domain 'fedora-23-fstrim' already exists #1910

Open
tasket opened this Issue Apr 15, 2016 · 5 comments

Comments

Projects
None yet
4 participants
@tasket

tasket commented Apr 15, 2016

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

This comment has been minimized.

Show comment
Hide comment
@tasket

tasket Apr 15, 2016

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

tasket commented Apr 15, 2016

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

@andrewdavidwong

This comment has been minimized.

Show comment
Hide comment
@andrewdavidwong

andrewdavidwong Apr 15, 2016

Member

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

Thanks; I'll add one.

Member

andrewdavidwong commented Apr 15, 2016

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

Thanks; I'll add one.

@tasket

This comment has been minimized.

Show comment
Hide comment
@tasket

tasket Apr 22, 2016

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

tasket commented Apr 22, 2016

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

marmarek added a commit to marmarek/old-qubes-core-admin that referenced this issue May 18, 2016

trim-template: Fix handling long named templates
Trim template name to fit full VM name in 31 chars.
At the same time, check if the VM already exists - if so - remove it
first (or error out asking the user to remove it manually - if VM isn't
marked as internal).
Now that VM is created as internal, to skip appmenus creation.

QubesOS/qubes-issues#1910
Fixes QubesOS/qubes-issues#1655

marmarek added a commit to QubesOS/qubes-core-admin that referenced this issue Jun 25, 2016

trim-template: Fix handling long named templates
Trim template name to fit full VM name in 31 chars.
At the same time, check if the VM already exists - if so - remove it
first (or error out asking the user to remove it manually - if VM isn't
marked as internal).
Now that VM is created as internal, to skip appmenus creation.

QubesOS/qubes-issues#1910
Fixes QubesOS/qubes-issues#1655

(cherry picked from commit 10f0716)
@cryptix

This comment has been minimized.

Show comment
Hide comment
@cryptix

cryptix Jan 25, 2017

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.

cryptix commented Jan 25, 2017

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

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Jan 25, 2017

Member

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

Member

marmarek commented Jan 25, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment