Skip to content

Copying the formula from a VM to dom0

Skyper edited this page Feb 18, 2019 · 4 revisions

As specified in the official documentation, there should normally be few reasons to copy files from a VM to dom0. However, if we want to be able to use a Salt formula to set up our Qubes OS environment, we need to get access to these files from dom0. And this task can become very tedious as the command line specified in the documentation for copying files from VMs to dom0 can't be used to copy a complete folder in one go.

This script can be used to circumvent the problem:

  1. Copy the script to dom0 (from dom0's console):

     sudo qvm-run --pass-io <VM containing the formula> 'cat <folder containing the formula>/copy-from-vm-to-dom0.sh' > copy-from-vm-to-dom0.sh
    
  2. Edit the script in order to define the VM_TARGET and DIR_TARGET variables:

     # Variables
     # --------------------------------------------------------------#
    
     DIR_PREFIX=/srv/salt
     VM_TARGET=
     DIR_TARGET=
    
  3. Add the execute permission to the script:

     chmod +x copy-from-vm-to-dom0.sh
    
  4. Execute the script to copy the formula from the VM defined in VM_TARGET to dom0:

     sudo ./copy-from-vm-to-dom0.sh