2012-12-29 10:26:51 -05:00
---
2015-04-10 16:17:45 -04:00
layout: doc
2015-10-13 23:31:03 -04:00
title: Disposable VMs
2015-10-28 18:14:40 -04:00
permalink: /doc/dispvm/
2015-10-11 03:04:59 -04:00
redirect_from:
2015-10-28 18:14:40 -04:00
- /en/doc/dispvm/
2015-10-11 03:04:59 -04:00
- /doc/DisposableVms/
- /wiki/DisposableVMs/
2012-12-29 10:26:51 -05:00
---
2013-11-08 20:00:00 -05:00
Disposable VMs (DispVMs)
========================
2012-12-29 10:26:51 -05:00
2018-02-09 07:12:21 -05:00
A Disposable VM (DispVM) is a lightweight VM that can be created quickly and will disappear when closed.
Disposable VMs are usually created in order to host a single application, like a viewer, editor, or web browser.
From inside an AppVM, choosing the `Open in Disposable VM` option on a file will launch a DispVM for just that file.
Changes made to a file opened in a DispVM are passed back to the originating VM.
This means that you can safely work with untrusted files without risk of compromising your other VMs.
DispVMs can be launched either directly from Dom0's Start Menu or terminal window, or from within AppVMs.
While running, DispVMs will appear in Qubes VM Manager with the name `disp####` .
2017-12-04 15:13:11 -05:00
See [this article ](https://blog.invisiblethings.org/2010/06/01/disposable-vms.html ) for more on why one would want to use a Disposable VM.
2018-02-09 07:12:21 -05:00
2018-02-10 06:44:43 -05:00
Disposable VMs and Networking (R4.0 and later)
-----------------------------
2018-02-09 07:12:21 -05:00
Similarly to how AppVMs are based on their underlying [TemplateVM ](https://www.qubes-os.org/doc/glossary/#templatevm ), DispVMs are based on their underlying [DVM Template ](https://www.qubes-os.org/doc/glossary/#dvm-template ).
2018-02-10 06:44:43 -05:00
R4.0 introduces the concept of multiple DVM Templates, whereas R3.2 was limited to only one.
2018-02-09 07:12:21 -05:00
2018-02-10 06:44:43 -05:00
On a fresh installation of Qubes, the default DVM Template is called `fedora-XX-dvm` (where `XX` is the Fedora version of the default TemplateVM).
If you have included the Whonix option in your install, there will also be a `whonix-ws-dvm` DVM Template available for your use.
2018-01-28 14:02:24 -05:00
2018-02-09 07:12:21 -05:00
You can set any AppVM to have the ability to act as a DVM Template with:
2018-01-28 14:02:24 -05:00
2018-08-07 23:21:56 -04:00
qvm-prefs < vmname > template_for_dispvms True
2018-01-28 14:02:24 -05:00
2018-02-10 06:44:43 -05:00
The default system wide DVM Template can be changed with `qubes-prefs default_dispvm` .
By combining the two, choosing `Open in Disposable VM` from inside an AppVM will open the document in a DispVM based on the default DVM Template you specified.
2018-02-09 07:12:21 -05:00
You can change this behaviour for individual VMs: in the Application Menu, open Qube Settings for the VM in question and go to the "Advanced" tab.
2018-02-10 06:44:43 -05:00
Here you can edit the "Default DispVM" setting to specify which DVM Template will be used to launch DispVMs from that VM.
2018-02-09 07:12:21 -05:00
This can also be changed from the command line with:
qvm-prefs < vmname > default_dispvm < dvmtemplatename >
2018-02-10 06:44:43 -05:00
For example, `anon-whonix` has been set to use `whonix-ws-dvm` as its `default_dispvm` , instead of the system default.
You can even set an AppVM that has also been configured as a DVM Template to use itself, so DispVMs launched from within the AppVM/DVM Template would inherit the same settings.
2018-02-09 07:12:21 -05:00
2018-02-10 06:44:43 -05:00
NetVM and firewall rules for DVM Templates can be set as they can for a normal VM.
2018-02-09 07:12:21 -05:00
By default a DispVM will inherit the NetVM and firewall settings of the DVM Template on which it is based.
2018-02-10 06:44:43 -05:00
This is a change in behaviour from R3.2, where DispVMs would inherit the settings of the AppVM from which they were launched.
Therefore, launching a DispVM from an AppVM will result in it using the network/firewall settings of the DVM Template on which it is based.
For example, if an AppVM uses sys-net as its NetVM, but the default system DispVM uses sys-whonix, any DispVM launched from this AppVM will have sys-whonix as its NetVM.
2018-02-09 07:12:21 -05:00
2018-02-10 06:44:43 -05:00
**Warning:** The opposite is also true. This means if you have changed anon-whonix's `default_dispvm` to use the system default, and the system default DispVM uses sys-net, launching a DispVM from inside anon-whonix will result in the DispVM using sys-net.
2018-01-28 14:02:24 -05:00
2018-02-09 07:12:21 -05:00
A Disposable VM launched from the Start Menu inherits the NetVM and firewall settings of the DVM Template on which it is based.
Note that changing the "NetVM" setting for the system default DVM Template *does* affect the NetVM of DispVMs launched from the Start Menu.
Different DVM Templates with individual NetVM settings can be added to the Start Menu.
2018-01-28 14:02:24 -05:00
Disposable VMs and Networking (R3.2 and earlier)
2017-12-04 15:13:11 -05:00
-----------------------------
NetVM and firewall rules for Disposable VMs can be set as they can for a normal VM.
By default a DispVM will inherit the NetVM and firewall settings of the VM from which it is launched.
Thus if an AppVM uses sys-net as its NetVM, any DispVM launched from this AppVM will also have sys-net as its NetVM.
You can change this behaviour for individual VMs: in Qubes VM Manager open VM Settings for the VM in question and go to the "Advanced" tab.
Here you can edit the "NetVM for DispVM" setting to change the NetVM of any DispVM launched from that VM.
2018-02-10 06:44:43 -05:00
A Disposable VM launched from the Start Menu inherits the NetVM of the [DVM Template ](/doc/glossary/#dvm-template ).
By default the DVM template is called `fedora-XX-dvm` (where `XX` is the Fedora version of the default TemplateVM).
2017-12-04 15:13:11 -05:00
As an "internal" VM it is hidden in Qubes VM Manager, but can be shown by selecting "Show/Hide internal VMs".
Note that changing the "NetVM for DispVM" setting for the DVM Template does *not* affect the NetVM of DispVMs launched from the Start Menu; only changing the DVM Template's own NetVM does.
Opening a file in a Disposable VM via GUI
-----------------------------------------
In an AppVM's file manager, right click on the file you wish to open in a Disposable VM, then choose "Open in Disposable VM".
Wait a few seconds and the default application for this file type should appear displaying the file content.
This app is running in its own dedicated VM -- a Disposable VM created for the purpose of viewing or editing this very file.
Once you close the viewing application the whole Disposable VM will be destroyed.
If you have edited the file and saved the changes, the changed file will be saved back to the original AppVM, overwriting the original.
2012-12-29 10:26:51 -05:00
2015-03-02 00:09:37 -05:00
![r1-open-in-dispvm-1.png ](/attachment/wiki/DisposableVms/r1-open-in-dispvm-1.png ) ![r1-open-in-dispvm-2.png ](/attachment/wiki/DisposableVms/r1-open-in-dispvm-2.png )
2012-12-29 10:26:51 -05:00
Opening a fresh web browser instance in a new Disposable VM
-----------------------------------------------------------
2017-12-04 15:13:11 -05:00
Sometimes it is desirable to open an instance of Firefox within a new fresh Disposable VM.
2018-01-28 14:02:24 -05:00
This can be done easily using the Start Menu: just go to **Application Menu -\> DisposableVM -\> DispVM:Firefox web browser** .
2017-12-04 15:13:11 -05:00
Wait a few seconds until a web browser starts.
Once you close the viewing application the whole Disposable VM will be destroyed.
2012-12-29 10:26:51 -05:00
2015-03-02 00:09:37 -05:00
![r1-open-in-dispvm-3.png ](/attachment/wiki/DisposableVms/r1-open-in-dispvm-3.png )
2012-12-29 10:42:54 -05:00
Opening a file in a Disposable VM via command line (from AppVM)
---------------------------------------------------------------
2017-12-04 15:13:11 -05:00
Use the `qvm-open-in-dvm` command from a terminal in your AppVM:
2012-12-29 10:42:54 -05:00
2015-09-26 19:00:33 -04:00
~~~
2012-12-29 10:42:54 -05:00
[user@work-pub ~]$ qvm-open-in-dvm Downloads/apple-sandbox.pdf
2015-09-26 19:00:33 -04:00
~~~
2012-12-29 10:42:54 -05:00
2017-12-04 15:13:11 -05:00
Note that the `qvm-open-in-dvm` process will not exit until you close the application in the Disposable VM.
2012-12-29 10:42:54 -05:00
2017-12-04 15:13:11 -05:00
Starting an arbitrary program in a Disposable VM from an AppVM
--------------------------------------------------------------
2012-12-29 10:42:54 -05:00
2017-12-04 15:13:11 -05:00
Sometimes it can be useful to start an arbitrary program in a DispVM. This can be done from an AppVM by running
2012-12-29 10:42:54 -05:00
2015-09-26 19:00:33 -04:00
~~~
2017-12-04 15:13:11 -05:00
[user@vault ~]$ qvm-run '$dispvm' xterm
2015-09-26 19:00:33 -04:00
~~~
2012-12-29 10:42:54 -05:00
2018-01-28 14:02:24 -05:00
The created Disposable VM can be accessed via other tools (such as `qvm-copy-to-vm` ) using its `disp####` name as shown in the Qubes Manager or `qvm-ls` .
2013-03-11 09:05:38 -04:00
2017-12-04 15:13:11 -05:00
Starting an arbitrary application in a Disposable VM via command line (from Dom0)
---------------------------------------------------------------------------------
2013-03-11 09:18:04 -04:00
2017-12-04 15:13:11 -05:00
The Start Menu has shortcuts for opening a terminal and a web browser in dedicated DispVMs, since these are very common tasks.
However, it is possible to start an arbitrary application in a DispVM directly from Dom0 by running
2013-03-11 09:18:04 -04:00
2018-01-28 14:02:24 -05:00
R4.0 (border colour will be inherited from that set in the `dispvm-template` )
~~~
[joanna@dom0 ~]$ qvm-run --dispvm=dispvm-template --service qubes.StartApp+xterm
~~~
R3.2 (border colour can be specified in the command)
2015-09-26 19:00:33 -04:00
~~~
2017-12-04 15:13:11 -05:00
[joanna@dom0 ~]$ echo xterm | /usr/lib/qubes/qfile-daemon-dvm qubes.VMShell dom0 DEFAULT red
2015-09-26 19:00:33 -04:00
~~~
2013-03-11 09:18:04 -04:00
2017-12-04 15:13:11 -05:00
(The Disposable VM appmenu used for starting Firefox runs a very similar command to the one above.)
2013-03-11 09:05:38 -04:00
2015-08-14 21:16:49 -04:00
Customizing Disposable VMs
2017-12-04 15:13:11 -05:00
--------------------------
2013-03-11 09:31:48 -04:00
2018-01-28 14:02:24 -05:00
You can change the template used to generate the Disposable VMs, and change settings used in the Disposable VM savefile.
2018-02-10 06:44:43 -05:00
These changes will be reflected in every new Disposable VM based on that template.
2017-12-04 15:13:11 -05:00
Full instructions can be found [here ](/doc/dispvm-customization/ ).
2013-11-08 20:00:00 -05:00
Disposable VMs and Local Forensics
----------------------------------
2017-12-04 15:13:11 -05:00
At this time, DispVMs should not be relied upon to circumvent local forensics, as they do not run entirely in RAM.
For details, see [this thread ](https://groups.google.com/d/topic/qubes-devel/QwL5PjqPs-4/discussion ).
When it is essential to avoid leaving any trace, consider using [Tails ](https://tails.boum.org/ ).