From f37ef4e82ccd73950b45e0dcb5ff90cc13770387 Mon Sep 17 00:00:00 2001 From: Rui Lopes Date: Sun, 11 Feb 2024 14:41:28 +0000 Subject: [PATCH] drop support for virtualbox --- Makefile | 13 ++--------- README.md | 20 +---------------- Vagrantfile-uefi.template | 3 --- example/Vagrantfile | 13 ----------- provision-guest-additions.sh | 21 +----------------- ubuntu.pkr.hcl | 43 ------------------------------------ 6 files changed, 4 insertions(+), 109 deletions(-) diff --git a/Makefile b/Makefile index a63090c..0a357f3 100644 --- a/Makefile +++ b/Makefile @@ -4,11 +4,10 @@ SHELL=bash VERSION=22.04 help: - @echo type make build-libvirt, make build-uefi-libvirt, make build-virtualbox, make build-hyperv or make build-vsphere + @echo type make build-libvirt, make build-uefi-libvirt, make build-hyperv or make build-vsphere build-libvirt: ubuntu-${VERSION}-amd64-libvirt.box build-uefi-libvirt: ubuntu-${VERSION}-uefi-amd64-libvirt.box -build-virtualbox: ubuntu-${VERSION}-amd64-virtualbox.box build-hyperv: ubuntu-${VERSION}-amd64-hyperv.box build-vsphere: ubuntu-${VERSION}-amd64-vsphere.box @@ -32,14 +31,6 @@ tmp/libvirt-uefi-autoinstall-cloud-init-data/user-data: autoinstall-cloud-init-d mkdir -p $(shell dirname $@) sed -E 's,\*storage-config-msdos,*storage-config-gpt,g' $< >$@ -ubuntu-${VERSION}-amd64-virtualbox.box: autoinstall-cloud-init-data/* provision.sh ubuntu.pkr.hcl Vagrantfile.template - rm -f $@ - CHECKPOINT_DISABLE=1 PACKER_LOG=1 PACKER_LOG_PATH=$@.init.log \ - packer init ubuntu.pkr.hcl - CHECKPOINT_DISABLE=1 PACKER_LOG=1 PACKER_LOG_PATH=$@.log PKR_VAR_vagrant_box=$@ \ - packer build -only=virtualbox-iso.ubuntu-amd64 -on-error=abort -timestamp-ui ubuntu.pkr.hcl - @./box-metadata.sh virtualbox ubuntu-${VERSION}-amd64 $@ - ubuntu-${VERSION}-amd64-hyperv.box: tmp/hyperv-autoinstall-cloud-init-data/user-data autoinstall-cloud-init-data/* provision.sh ubuntu.pkr.hcl Vagrantfile.template rm -f $@ CHECKPOINT_DISABLE=1 PACKER_LOG=1 PACKER_LOG_PATH=$@.init.log \ @@ -74,4 +65,4 @@ tmp/vsphere-autoinstall-cloud-init-data/user-data: autoinstall-cloud-init-data/u mkdir -p $(shell dirname $@) sed -E 's,((.+)- openssh-server.*),\1\n\2- open-vm-tools,g' $< >$@ -.PHONY: help build-libvirt build-uefi-libvirt build-virtualbox build-hyperv build-vsphere +.PHONY: help build-libvirt build-uefi-libvirt build-hyperv build-vsphere diff --git a/README.md b/README.md index db7e525..cfe4ade 100644 --- a/README.md +++ b/README.md @@ -38,9 +38,7 @@ For more information see the [Vagrant NFS documentation](https://www.vagrantup.c On a Windows host, install [Chocolatey](https://chocolatey.org/install), then execute the following PowerShell commands in a Administrator PowerShell window: ```powershell -# NB if you want to use Hyper-V see the Hyper-V section in this document -# and do not install virtualbox at all. -choco install -y virtualbox --params "/NoDesktopShortcut /ExtensionPack" +# NB if you want to use Hyper-V see the Hyper-V section in this document. choco install -y packer vagrant jq msys2 ``` @@ -80,22 +78,6 @@ exit vagrant destroy -f ``` -## VirtualBox usage - -Install [VirtuaBox](https://www.virtualbox.org/). - -Type `make build-virtualbox` and follow the instructions. - -Try the example guest: - -```bash -cd example -vagrant up --provider=virtualbox --no-destroy-on-error --no-tty -vagrant ssh -exit -vagrant destroy -f -``` - ## Hyper-V usage Install [Hyper-V](https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v) diff --git a/Vagrantfile-uefi.template b/Vagrantfile-uefi.template index 82fe8fa..8a3e59e 100644 --- a/Vagrantfile-uefi.template +++ b/Vagrantfile-uefi.template @@ -9,7 +9,4 @@ Vagrant.configure(2) do |config| lv.channel :type => 'unix', :target_name => 'org.qemu.guest_agent.0', :target_type => 'virtio' lv.channel :type => 'spicevmc', :target_name => 'com.redhat.spice.0', :target_type => 'virtio' end - config.vm.provider 'virtualbox' do |vb| - vb.customize ['modifyvm', :id, '--firmware', 'efi'] - end end diff --git a/example/Vagrantfile b/example/Vagrantfile index 2b97b37..00e2f78 100644 --- a/example/Vagrantfile +++ b/example/Vagrantfile @@ -129,19 +129,6 @@ Vagrant.configure(2) do |config| config.vm.synced_folder '.', '/vagrant', type: 'nfs', nfs_version: '4.2', nfs_udp: false end - config.vm.provider 'virtualbox' do |vb, config| - vb.linked_clone = true - vb.memory = $vm_memory - vb.cpus = $vm_cpus - vb.customize [ - 'storageattach', :id, - '--storagectl', 'SATA Controller', - '--device', 0, - '--port', 1, - '--type', 'dvddrive', - '--medium', create_cloud_init_iso_trigger(config, nil, cloud_init_user_data, cloud_init_network_config)] - end - config.vm.provider 'hyperv' do |hv, config| hv.vmname = "#{File.basename(File.dirname(File.dirname(__FILE__)))}-example" hv.linked_clone = true diff --git a/provision-guest-additions.sh b/provision-guest-additions.sh index b4bc1ab..0e6e6f7 100644 --- a/provision-guest-additions.sh +++ b/provision-guest-additions.sh @@ -5,26 +5,7 @@ set -euxo pipefail cloud-init status --long --wait # install the Guest Additions. -if [ -n "$(lspci | grep VirtualBox)" ]; then -# install the VirtualBox Guest Additions. -# this will be installed at /opt/VBoxGuestAdditions-VERSION. -# NB You can unpack the VBoxLinuxAdditions.run file contents with: -# VBoxLinuxAdditions.run --target /tmp/VBoxLinuxAdditions.run.contents --noexec -# NB REMOVE_INSTALLATION_DIR=0 is to fix a bug in VBoxLinuxAdditions.run. -# See http://stackoverflow.com/a/25943638. -apt-get -y -q install gcc dkms -mkdir -p /mnt -mount /dev/sr1 /mnt -while [ ! -f /mnt/VBoxLinuxAdditions.run ]; do sleep 1; done -# NB we ignore exit code 2 (cannot find vboxguest module) because of what -# seems to be a bug in VirtualBox 5.1.20. there isn't actually a problem -# loading the module. -REMOVE_INSTALLATION_DIR=0 /mnt/VBoxLinuxAdditions.run --target /tmp/VBoxGuestAdditions || [ $? -eq 2 ] -rm -rf /tmp/VBoxGuestAdditions -umount /mnt -eject /dev/sr1 -modinfo vboxguest -elif [ -n "$(lspci | grep 'Red Hat' | head -1)" ]; then +if [ -n "$(lspci | grep 'Red Hat' | head -1)" ]; then # install the qemu-kvm Guest Additions. apt-get install -y qemu-guest-agent spice-vdagent elif [ -n "$(lspci | grep VMware | head -1)" ]; then diff --git a/ubuntu.pkr.hcl b/ubuntu.pkr.hcl index bfa82be..d8a86e3 100644 --- a/ubuntu.pkr.hcl +++ b/ubuntu.pkr.hcl @@ -10,11 +10,6 @@ packer { version = ">= 1.1.3" source = "github.com/hashicorp/hyperv" } - # see https://github.com/hashicorp/packer-plugin-virtualbox - virtualbox = { - version = ">= 1.0.5" - source = "github.com/hashicorp/virtualbox" - } } } @@ -150,48 +145,11 @@ source "qemu" "ubuntu-uefi-amd64" { shutdown_command = "sudo -S poweroff" } -source "virtualbox-iso" "ubuntu-amd64" { - cd_label = "cidata" - cd_files = [ - "autoinstall-cloud-init-data/user-data", - "autoinstall-cloud-init-data/meta-data", - ] - boot_command = local.boot_command - boot_wait = "5s" - disk_size = var.disk_size - guest_additions_mode = "attach" - guest_os_type = "Ubuntu_64" - hard_drive_discard = true - hard_drive_interface = "sata" - headless = true - iso_checksum = var.iso_checksum - iso_url = var.iso_url - vboxmanage = [ - ["modifyvm", "{{.Name}}", "--memory", "2048"], - ["modifyvm", "{{.Name}}", "--cpus", "2"], - ["modifyvm", "{{.Name}}", "--vram", "16"], - ["modifyvm", "{{.Name}}", "--audio", "none"], - ["modifyvm", "{{.Name}}", "--nictype1", "82540EM"], - ["modifyvm", "{{.Name}}", "--nictype2", "82540EM"], - ["modifyvm", "{{.Name}}", "--nictype3", "82540EM"], - ["modifyvm", "{{.Name}}", "--nictype4", "82540EM"], - ] - vboxmanage_post = [ - ["storagectl", "{{.Name}}", "--name", "IDE Controller", "--remove"], - ] - ssh_username = "vagrant" - ssh_password = "vagrant" - ssh_timeout = "60m" - shutdown_command = "sudo -S poweroff" - post_shutdown_delay = "2m" -} - build { sources = [ "source.hyperv-iso.ubuntu-amd64", "source.qemu.ubuntu-amd64", "source.qemu.ubuntu-uefi-amd64", - "source.virtualbox-iso.ubuntu-amd64", ] provisioner "shell" { @@ -245,7 +203,6 @@ build { post-processor "vagrant" { only = [ "qemu.ubuntu-amd64", - "virtualbox-iso.ubuntu-amd64", "hyperv-iso.ubuntu-amd64", ] output = var.vagrant_box