I have the following error when I try to trim my debian-8 template VM
qvm-trim-template debian-8
Disk usage before:
6212224 /var/lib/qubes/vm-templates/debian-8/root.img
Creating temporary VM...
Traceback (most recent call last):
File "/usr/bin/qvm-trim-template", line 172, 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 1292, in create_on_disk
self.storage.create_on_disk(verbose, source_template)
File "/usr/lib64/python2.7/site-packages/qubes/storage/__init__.py", line 175, in create_on_disk
os.mkdir (self.vmdir)
OSError: [Errno 17] File exists: '/var/lib/qubes/appvms/trim-debian-8'
I tried the following naive solution but it didn't work
mv /var/lib/qubes/appvms/trim-debian-8 /var/lib/qubes/appvms/trim-debian-8.old
qvm-trim-template debian-8
Disk usage before:
6212224 /var/lib/qubes/vm-templates/debian-8/root.img
Creating temporary VM...
Traceback (most recent call last):
File "/usr/bin/qvm-trim-template", line 172, 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 1314, in create_on_disk
self._update_libvirt_domain()
File "/usr/lib64/python2.7/site-packages/qubes/modules/000QubesVm.py", line 761, in _update_libvirt_domain
raise e
libvirt.libvirtError: operation failed: domain 'trim-debian-8' already exists with uuid 7f653418-846b-4ddd-b42f-52d800fc478c
I thought about trying to recover a backup qubes.xml from
/var/lib/qubes/backup, but the UUID 7f653418-846b-4ddd-b42f-52d800fc478c
does not appear in any them and I'm not sure which one to use because
I've run updates since.
If I then do
rm -rf /var/lib/qubes/appvms/trim-debian-8
mv /var/lib/qubes/appvms/trim-debian-8.old /var/lib/qubes/appvms/trim-debian-8
I'm back to where I started.
Can anyone please tell me how to fix this problem.
Thanks,
Paul
It guided me to a solution which was to run
rm -rf /var/lib/qubes/appvms/trim-debian-8
virsh -c xen:/// undefine trim-debian-8
qvm-trim-template debian-8
This fixes the problem.