qvm-trim-template hung now stuck with remnants of the process

34 views
Skip to first unread message

cubit

unread,
Nov 12, 2018, 2:47:46 PM11/12/18
to Qubes Users
I was running qvm-trim-template on my 6 templates - Qubes 3.2 -  but the process looked to hang on 2 of them.   After 30 minutes of waiting (usually 2-3 minutes max) I ctrl+c them

This resulted in files being left behind blocking me from running qvm-trim-template again on the problem ones.

If I do  qvm-trim-template whonix-gw-14   I get the error

Disk usage before:
2644484    /var/lib/qubes/vm-templates/whonix-gw-14/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 1298, 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-whonix-gw-14'

I though maybe I could delete the trim-whonix-gw-14 app VM but get this error then


$ sudo rm -rf /var/lib/qubes/appvms/trim-whonix-gw-14
$ qvm-trim-template whonix-gw-14
Disk usage before:
2644484    /var/lib/qubes/vm-templates/whonix-gw-14/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 1320, in create_on_disk
    self._update_libvirt_domain()
  File "/usr/lib64/python2.7/site-packages/qubes/modules/000QubesVm.py", line 767, in _update_libvirt_domain
    raise e
libvirt.libvirtError: operation failed: domain 'trim-whonix-gw-14' already exists with uuid 1dcd7cd5-aaa9-4b62-8254-73b8db63190b



Can anyone suggest how to rectify this so I can trim once again?


CuBit



unman

unread,
Nov 12, 2018, 7:46:08 PM11/12/18
to Qubes Users
Read https://www.qubes-os.org/doc/remove-vm-manually/

The libvirt error shows you need to manually remove that qube.

qvm-remove just-db trim-whonix-gw-14

unman

cubit

unread,
Nov 13, 2018, 4:13:22 AM11/13/18
to unman, Qubes Users
13. Nov 2018 00:46 by un...@thirdeyesecurity.org:

On Mon, Nov 12, 2018 at 08:47:43PM +0100, cubit wrote:
I was running qvm-trim-template on my 6 templates - Qubes 3.2 -  but the process looked to hang on 2 of them.   After 30 minutes of waiting (usually 2-3 minutes max) I ctrl+c them
This resulted in files being left behind blocking me from running qvm-trim-template again on the problem ones.



The libvirt error shows you need to manually remove that qube.

qvm-remove just-db trim-whonix-gw-14

unman



Thank you for the suggestion unman, when I do the `--just-db` step outlined it tells me


A VM with the name 'trim-whonix-gw-14' does not exist in the system.


I've also tried this before deleting the AppVM that trim creates but the error is the same



CuBit



unman

unread,
Nov 13, 2018, 6:09:38 AM11/13/18
to Qubes Users
On Tue, Nov 13, 2018 at 10:13:16AM +0100, cubit wrote:
> 13. Nov 2018 00:46 by un...@thirdeyesecurity.org <mailto:un...@thirdeyesecurity.org>:
>
>
> > On Mon, Nov 12, 2018 at 08:47:43PM +0100, cubit wrote:
> >> I was running qvm-trim-template on my 6 templates - Qubes 3.2 -  but the process looked to hang on 2 of them.   After 30 minutes of waiting (usually 2-3 minutes max) I ctrl+c them
> >> This resulted in files being left behind blocking me from running qvm-trim-template again on the problem ones.
> >>
> >>
> > Read > https://www.qubes-os.org/doc/remove-vm-manually <https://www.qubes-os.org/doc/remove-vm-manually/>
> >
> > The libvirt error shows you need to manually remove that qube.
> >
> > qvm-remove just-db trim-whonix-gw-14
> >
> > unman
> >
>
>
>
>
>
>
>
> Thank you for the suggestion unman, when I do the `--just-db` step outlined it tells me
>
>
>
>
> A VM with the name 'trim-whonix-gw-14' does not exist in the system.
>
>
>
>
> I've also tried this before deleting the AppVM that trim creates but the error is the same
>
>
>
>
>
>
>
> CuBit

Try virsh -c xen:/// undefine trim-whonix-gw-14

cubit

unread,
Nov 13, 2018, 8:14:48 AM11/13/18
to unman, Qubes Users
13. Nov 2018 11:09 by un...@thirdeyesecurity.org:


Thank you for the suggestion unman, when I do the `--just-db` step outlined it tells me

A VM with the name 'trim-whonix-gw-14' does not exist in the system.

I've also tried this before deleting the AppVM that trim creates but the error is the same

CuBit

Try virsh -c xen:/// undefine trim-whonix-gw-14


Success!  Thank you.


is it just a case of running that and rm'ing the appvm directory to remove a trim appvm?  I did not see any of the menu items being created during the process



CuBit



unman

unread,
Nov 13, 2018, 8:21:01 AM11/13/18
to Qubes Users
On Tue, Nov 13, 2018 at 02:14:45PM +0100, cubit wrote:
> 13. Nov 2018 11:09 by un...@thirdeyesecurity.org <mailto:un...@thirdeyesecurity.org>:
yes, that should do it.

unman
Reply all
Reply to author
Forward
0 new messages