Skip to content

Create Libvirt Box

ppggff edited this page Oct 11, 2022 · 4 revisions

Notes: this is the temp solution.

Use shell script create_box.sh. This is edited version of create_box.sh from vagrant-libvirt.

Steps:

  1. stop the vm

    vagrant stop
    
    # wait 10 - 20 seconds
    
    # check
    vagrant status
    
    # or, check qemu process
    ps -ef | grep qemu
    
  2. find the image (in the same dir with the Vagrantfile)

    find . -name "*.img"
    
  3. create box with create_box.sh

    ./create_box.sh [path to img, from step 2] [box name]
    
    # for example
    ./create_box.sh ./.vagrant/machines/default/qemu/bU6uTtFoXTE/linked-box.img mybox
    

Notes:

  • Each box contains a default Vagrantfile, you can change it by:
    • Provide the third argument (path to the addition config file) to add more info to the default Vagrantfile (see create_box.sh for detail)
    • Edit the create_box.sh directly to change the default Vagrantfile
  • You may need to check the original default Vagrantfile with the source box (you can find it by find ~/.vagrant.d -name Vagrantfile)
  • In the default Vagrantfile, all parts related to libvirt will be ignored by this vagrant-qemu provider
Clone this wiki locally