Building an Ubuntu Vagrant box

wget --no-check-certificate \
    https://raw.githubusercontent.com/hashicorp/vagrant/main/keys/vagrant.pub \
    -O /home/vagrant/.ssh/authorized_keys

sudo rm -f /etc/machine-id
sudo dbus-uuidgen –ensure=/etc/machine-id
sudo rm /var/lib/dbus/machine-id
sudo dbus-uuidgen –ensure
reboot

You can also try this parameter in the Ubuntu netplan configuration file:

dhcp4: yes
dhcp-identifier: mac



sudo qemu-img convert -f qcow2 -O qcow2 /nvmedata2/test1_default.img ~/.vagrant.d/boxes/betterubuntu-VAGRANTSLASH-1804-1/0/libvirt/box.img

cory@lab1:/nvmedata/labs/test2$ cat ~/.vagrant.d/boxes/betterubuntu-VAGRANTSLASH-1804-1/0/libvirt/Vagrantfile

# The contents below were provided by the Packer Vagrant post-processor

Vagrant.configure(“2”) do |config|
config.vm.provider :libvirt do |libvirt|
libvirt.driver = “kvm”
end
end


# The contents below (if any) are custom contents provided by the
# Packer template during image build.
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure(2) do |config|

config.vm.boot_timeout = 1800
config.vm.synced_folder “.”, “/vagrant”, disabled: true

config.vm.box_check_update = true

# config.vm.post_up_message = “”
config.vm.boot_timeout = 1800
# config.vm.box_download_checksum = true
config.vm.boot_timeout = 1800
# config.vm.box_download_checksum_type = “sha256”

# config.vm.provision “shell”, run: “always”, inline: <<-SHELL
# SHELL

# Adding a second CPU and increasing the RAM to 2048MB will speed
# things up considerably should you decide to do anythinc with this box.
config.vm.provider :hyperv do |v, override|
v.maxmemory = 2048
v.memory = 2048
v.cpus = 2
end

config.vm.provider :libvirt do |v, override|
v.disk_bus = “virtio”
v.driver = “kvm”
v.video_vram = 256
v.memory = 2048
v.cpus = 2
end

config.vm.provider :parallels do |v, override|
v.customize [“set”, :id, “–on-window-close”, “keep-running”]
v.customize [“set”, :id, “–startup-view”, “headless”]
v.customize [“set”, :id, “–memsize”, “2048”]
v.customize [“set”, :id, “–cpus”, “2”]
end

config.vm.provider :virtualbox do |v, override|
v.customize [“modifyvm”, :id, “–memory”, 2048]
v.customize [“modifyvm”, :id, “–vram”, 256]
v.customize [“modifyvm”, :id, “–cpus”, 2]
v.gui = false
end

[“vmware_fusion”, “vmware_workstation”, “vmware_desktop”].each do |provider|
config.vm.provider provider do |v, override|
v.whitelist_verified = true
v.gui = false
v.vmx[“cpuid.coresPerSocket”] = “1”
v.vmx[“memsize”] = “2048”
v.vmx[“numvcpus”] = “2”
end
end

end

cory@lab1:/nvmedata/labs/test2$


cory@lab1:/nvmedata/labs/test2$ cat ~/.vagrant.d/boxes/betterubuntu-VAGRANTSLASH-1804-1/0/libvirt/metadata.json
{“format”:”qcow2″,”provider”:”libvirt”,”virtual_size”:128}
cory@lab1:/nvmedata/labs/test2$