How to initialize the default dvm template

I accidentally browsed using Firefox in the default dvm template. Since it’s not safe, please tell me how to create a clean default dvm template.

1 Like

If you ever need to reconfigure according to defaults, you can find salt scripts at /srv/formula/base/virtual-machines-formula/qvm/, and execute sudo qubesctl state.sls qvm.<your-vm-here>. For example: sudo qubesctl state.sls qvm.sys-whonix. Note that must correlate to a file in the aforementioned directory ending in .top, and the VM in question must not be present.

1 Like

It might be more convenient to clear the ‘private’ volume of the disposable template (e.g. default-dvm), resetting it to a pristine state containing no data. This function is not exposed in the tooling but it’s straightforward to invoke:

$ qvm-shutdown --wait default-dvm
$ qubesd-query --empty --fail dom0 admin.vm.volume.Clear default-dvm private

Or even simpler, revert the volume to its previous state - if you’re sure that you just dirtied it up the last time the disposable template was running, and that you haven’t started it since:

$ qvm-shutdown --wait default-dvm
$ qvm-volume revert default-dvm:private
7 Likes

You can restore the previous state of your dvm template after a mistake using qvm-volume revert, unless you rebooted it more times than you have backups.

3 Likes

qubesd-query --empty --fail dom0 admin.vm.volume.Clear default-dvm private
this command is very easy!! how did you know this?

Sorry to say I don’t have a good answer for that. There’s a qubesd-query manpage covering just the tool itself, but to figure out the actual admin API calls you have to read their code.

Really though, this low-level stuff should be exposed in one of the qvm-something commands. E.g. admin.vm.volume.Clear is yearning to be hooked up as qvm-volume clear VM:VOLUME

2 Likes