Skip to main content

Command Palette

Search for a command to run...

Simple Way To Import .ova file to KVM

Published
1 min read
L

Full time job to handle operational private cloud. In spare time love to building and breaking stuff 👀

Well, simple post here.

So, while i train/recall my pwn skills i found some cool PWN labs by samiux here https://cybersecurity-ninjas.com/ctf-pwn.html

The provided file to deploy the labs is file with format .ova which is used by virtualbox and vmware. Since i’m a KVM enjoyer, i need to convert it before the vm can run in KVM.

Here the simple steps

# Install virt-v2v to convert file
sudo apt install virt-v2v

# Run convert command
virt-v2v -i ova /PwnCTF_22.04_v20230202.ova -o libvirt -of qcow2 -os nvme-pool -n host-network

options:

  • -i : input mode

  • -o : output mode

  • -of : output format file

  • -os : output storage (storage pool in kvm)

  • -n : network used by vm

After execute command above, now the vm been listed in virsh

 virsh list --all
 Id   Name                     State
-----------------------------------------
 -    PwnCTF_22.04_v20230202   shut off

Well, sometimes we need to make adjustment inside the VM like interface name. We can reset the root password for vm using command below:

# Check disk output file path
virsh vol-list nvme-pool
 Name                         Path
-------------------------------------------------------------------
 PwnCTF_22.04_v20230202-sda   /nvme-lv/PwnCTF_22.04_v20230202-sda

# Reset password
virt-customize -a /nvme-lv/PwnCTF_22.04_v20230202-sda --root-password password:<new-password-here>

Then, we can start the VM, login and make some adjustment if needed

# Start the vm
virsh start PwnCTF_22.04_v20230202

# Login console
virsh console PwnCTF_22.04_v20230202