ARM64 Support for Vagrant Configuration
First, I want to express my sincere appreciation for Pigsty - it's an incredibly well-designed alternative RDS solution, and the Vagrant configuration has been invaluable for local development and testing.
Issue Description
When running the Vagrant configuration on an Apple Silicon (ARM64) machine, I encountered a few challenges that required modifications to make it work. Note that I didn't want to use rosetta for x86 emulation . The main issues were:
- The default
generic/rocky9box doesn't support ARM64 architecture - VirtualBox customization commands included parameters not supported in the ARM version
Solution Implementation
Here's how I got it working:
-
Replaced the base box:
- Original:
generic/rocky9 - New:
net9/ubuntu-24.04-arm64
- Original:
-
Modified VirtualBox customization commands:
# Original (causing errors): v.customize ["modifyvm", :id, "--cpus", "2", "--memory", "4096", "--nictype1", "virtio", "--nictype2", "virtio", "--hwvirtex", "on", "--ioapic", "on", "--rtcuseutc", "on", "--vtxvpid", "on", "--largepages", "on"] # Working modification: v.customize ["modifyvm", :id, "--cpus", spec["cpu"], "--memory", spec["mem"]]
The error was resolved by removing the unsupported virtualization parameters that aren't applicable to ARM architecture.
Suggestion for Best Practices
For better cross-platform compatibility, perhaps we could:
-
Add conditional box selection based on architecture:
if arm64? config.vm.box = "net9/ubuntu-24.04-arm64" else config.vm.box = "generic/rocky9" end -
Make VirtualBox customizations architecture-aware:
v.customize ["modifyvm", :id, "--cpus", spec["cpu"], "--memory", spec["mem"]] if !arm64? v.customize ["modifyvm", :id, "--nictype1", "virtio", "--nictype2", "virtio", "--hwvirtex", "on", "--ioapic", "on", "--rtcuseutc", "on", "--vtxvpid", "on", "--largepages", "on"] end
This would maintain the original functionality for x86_64 systems while adding ARM64 support.
Would you consider adding these modifications to support developers using Apple Silicon machines?
When I switched from an Intel Mac to Apple Silicon, I ran into the problem of VirtualBox not working. I tried a bunch of workarounds but none of them really did the trick. In the end, I gave up and switched to using Vagrant + libvirt on a Linux server or just went straight to Terraform with Spot instances in the cloud.
That said, I recently noticed that the latest release of VirtualBox has started offering ARM64 support, which is really exciting. We’ll need ARM64-compatible boxes for EL/8, EL/9, Debian 12, Ubuntu 22, and Ubuntu 24 to achieve full Vagrant ARM64 support.
I’m currently on vacation, but I’ll start looking into this next week to see if we can make some progress. If you have any practical suggestions or would like to submit a PR, I’d love to hear from you!
First, I want to express my sincere appreciation for Pigsty - it's an incredibly well-designed alternative RDS solution, and the Vagrant configuration has been invaluable for local development and testing.
Issue Description
When running the Vagrant configuration on an Apple Silicon (ARM64) machine, I encountered a few challenges that required modifications to make it work. Note that I didn't want to use rosetta for x86 emulation . The main issues were:
- The default
generic/rocky9box doesn't support ARM64 architecture- VirtualBox customization commands included parameters not supported in the ARM version
Solution Implementation
Here's how I got it working:
Replaced the base box:
- Original:
generic/rocky9- New:
net9/ubuntu-24.04-arm64Modified VirtualBox customization commands:
Original (causing errors):
v.customize ["modifyvm", :id, "--cpus", "2", "--memory", "4096", "--nictype1", "virtio", "--nictype2", "virtio", "--hwvirtex", "on", "--ioapic", "on", "--rtcuseutc", "on", "--vtxvpid", "on", "--largepages", "on"]
Working modification:
v.customize ["modifyvm", :id, "--cpus", spec["cpu"], "--memory", spec["mem"]]
The error was resolved by removing the unsupported virtualization parameters that aren't applicable to ARM architecture.
Suggestion for Best Practices
For better cross-platform compatibility, perhaps we could:
- Add conditional box selection based on architecture: if arm64? config.vm.box = "net9/ubuntu-24.04-arm64" else config.vm.box = "generic/rocky9" end
- Make VirtualBox customizations architecture-aware: v.customize ["modifyvm", :id, "--cpus", spec["cpu"], "--memory", spec["mem"]] if !arm64? v.customize ["modifyvm", :id, "--nictype1", "virtio", "--nictype2", "virtio", "--hwvirtex", "on", "--ioapic", "on", "--rtcuseutc", "on", "--vtxvpid", "on", "--largepages", "on"] end
This would maintain the original functionality for x86_64 systems while adding ARM64 support.
Would you consider adding these modifications to support developers using Apple Silicon machines?
Linked to this issue, that I have just raised:
https://github.com/hashicorp/vagrant/issues/13588
[Bug]: Rocky9 box fails on Apple Silicon - Architecture mismatch despite ARM64 listing
now the bento/rockylinux-9 and bento/ubuntu-24.04 works as expected