virt-manager is a free software virtualization solution for Linux. virt-manager has a more complex interface than VirtualBox or GNOME Boxes but it also has a more complete set of features.

利用虛擬器運行 Tails 有很多不同的安全顧慮。依主機作業系統環境和用戶本身的安全需要狀況,在虛擬器上運行 Tails 可能有危險。

virt-manager is the only virtualization solution that we present that allows the use of a Persistent Storage. See Running Tails from a USB image.

The following instructions have been tested on Debian 9 (Stretch).

Please, let us know if they do not apply to Debian 10 (Buster).

Terminology

virt-manager 是一組低階的虛擬工具, 其包含用戶介面到與處理器之間的 互動作用。這個術語聽來令人迷惑而其它的文件 可能會提到以下的工具:

  • KVM 是 Linux kernel 核心模組用在與處理器虛擬功能上的互動。
  • QEMU 為一套虛擬軟體可模擬虛擬處理器和基於 KVM 的週邊設備,它用來啟動與停止虛擬器。
  • libvirt 是一個資源庫可讓 virt-manager 和 QEMU 的虛擬效能進行互動。
  • SPICE 協議可以虛擬化虛擬器的桌面環境。
  • virt-manager 是一個圖形介面可用來建立、設定和執行虛擬器。

Installation

欲在 Debian 下安裝 virt-manager,請執行以下指令:

sudo apt install virt-manager libvirt-daemon-system

要在 Ubutun 下安裝 virt-manager ,請執行以下指令:

sudo apt install virt-manager libvirt-bin qemu-kvm

Running Tails from an ISO image

  1. 啟用 virt-manager

  2. Double-click on localhost (QEMU) to connect to the QEMU system of your host.

  3. To create a new virtual machine, choose File ▸ New Virtual Machine.

  4. In step 1, choose Local install media (ISO image or CDROM).

  5. In step 2, choose:

    • Use ISO image, then Browse..., and Browse Local to browse for the ISO image that you want to start from
    • OS type: Linux
    • Version: Debian Stretch
  6. In step 3, allocate at least 2048 MB of RAM.

  7. In step 4, disable storage for this virtual machine.

  8. In step 5:

    • Type a name for the new virtual machine.
    • Click Finish to start the virtual machine.
如果看到錯誤訊息 "Error starting domain: Requested operation is not valid: network 'default' is not active",那麼請打開默認的虛擬網路:
  1. Click on localhost (QEMU).
  2. Choose Edit ▸ Connection details to administer the connection to your local QEMU system.
  3. Click on Virtual Networks tab, then select the default virtual network in the left pane.
  4. Click on the Start Network icon on the bottom of the left pane to start the default virtual network.

Running Tails from a USB image

Running Tails from a USB image is the only virtualization solution that allows you to use a Persistent Storage in a virtual machine.

  1. Download a USB image instead of an ISO image.

  2. Increase the size of the USB image to be at least 8 GB. This creates space for automatic upgrades and the Persistent Storage.

    truncate -s size tails.img

    • size has to be at least 7200M.
    • tails.img is the file name of the USB image that you want to resize.
  3. 啟用 virt-manager

  4. Double-click on localhost (QEMU) to connect to the QEMU system of your host.

  5. To create a new virtual machine, choose File ▸ New Virtual Machine.

  6. In step 1, choose Import existing disk image.

  7. In step 2, choose Browse..., and Browse Local to browse for the USB image that you want to start from.

    As operating system, choose Debian Stretch.

  8. In step 3, allocate at least 2048 MB of RAM.

  9. In step 4:

    • Type a name for the new virtual machine.
    • Choose Customize configuration before install.
    • Click Finish to open the configuration view.
  10. In the configuration view, choose VirtIO Disk 1 or IDE Disk 1

    • Expand the Advanced options and set Disk bus to USB.
    • Click Apply.
    • Check the Removable check box which should appear in the same view.
    • Click Apply again.
    • Click Begin Installation in the top left corner to start the virtual machine.

After you start on the USB image, you can create a Persistent Storage on it.

Running Tails from a USB stick

To run Tails from a USB stick using virt-manager, first create a virtual machine running from an ISO image as described above.

接著進行以下動作:

  1. 由虛擬器視窗下,選擇 Virtual Machine ▸ Shut Down ▸ Force Off 來關閉虛擬器。
  2. Plug in the USB stick from which you want to run Tails.
  3. 選擇 View ▸ Details以編輯虛擬器的設定。
  4. 在左側面板下方選取 Add Hardware按鍵。
  5. 在左側面板選取 USB Host Device
  6. 在右側面板中選取用於執行 Tails 的設備然後按 Finish

You can keep the original ISO image connected as a virtual DVD to install Tails onto the USB stick if needed.

也可以切斷 ISO 映像檔,直接利用已安裝 Tails 的 USB 隨身碟來開機,其方式為:

  1. 關閉虛擬器。
  2. In the configuration of the virtual machine, click on IDE CDROM 1 in the left pane.
  3. Click on the Disconnect button in the right pane.
  4. To enable the USB stick as a boot option:
    1. Click on Boot Options in the left pane.
    2. Select the USB boot option corresponding to your USB device.
    3. Click Apply.
  5. To start the virtual machine choose View ▸ Console and then Virtual Machine ▸ Run.

After you start on the USB device, you can create a Persistent Storage on it.

Troubleshooting

Graphics issues

Issues with graphics support in Tails running inside a virtual machine with virt-manager are common. The best solution can vary depending on the version of the virtualization solution and on the virtual machine configuration. For example:

  • The Auto resize VM with window feature does not work in all configurations.
  • The video device that provides optimal graphics performance can be different depending on the version of the host operating system.

To troubleshoot such issues:

  1. Ensure the virtual machine has a Spice display and a Spice channel configured, as opposed to VNC ones.

  2. Try various virtual video device models.

    Start with Virtio and QXL video devices: they generally give the best results. If they don't perform well for you, try every other video device model.