Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARM64 Support for Vagrant Configuration #504

Open
ThierDev opened this issue Feb 2, 2025 · 2 comments
Open

ARM64 Support for Vagrant Configuration #504

ThierDev opened this issue Feb 2, 2025 · 2 comments
Assignees
Labels
ENHANCEMENT New feature or request PROVISION Deploy & Provision Related
Milestone

Comments

@ThierDev
Copy link

ThierDev commented Feb 2, 2025

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:

  1. The default generic/rocky9 box doesn't support ARM64 architecture
  2. VirtualBox customization commands included parameters not supported in the ARM version

Solution Implementation

Here's how I got it working:

  1. Replaced the base box:

    • Original: generic/rocky9
    • New: net9/ubuntu-24.04-arm64
  2. 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:

  1. Add conditional box selection based on architecture:

    if arm64?
      config.vm.box = "net9/ubuntu-24.04-arm64"
    else
      config.vm.box = "generic/rocky9"
    end
  2. 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?

@Vonng
Copy link
Owner

Vonng commented Feb 2, 2025

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:

  1. The default generic/rocky9 box doesn't support ARM64 architecture
  2. VirtualBox customization commands included parameters not supported in the ARM version

Solution Implementation

Here's how I got it working:

  1. Replaced the base box:

    • Original: generic/rocky9
    • New: net9/ubuntu-24.04-arm64
  2. 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:

  1. Add conditional box selection based on architecture:
    if arm64?
    config.vm.box = "net9/ubuntu-24.04-arm64"
    else
    config.vm.box = "generic/rocky9"
    end
  2. 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?

@Vonng Vonng added ENHANCEMENT New feature or request PROVISION Deploy & Provision Related labels Feb 2, 2025
@Vonng Vonng added this to Pigsty Feb 2, 2025
@Vonng Vonng moved this to Todo in Pigsty Feb 2, 2025
@Vonng Vonng self-assigned this Feb 2, 2025
@m-gris
Copy link

m-gris commented Feb 3, 2025

Linked to this issue, that I have just raised:

hashicorp/vagrant#13588

[Bug]: Rocky9 box fails on Apple Silicon - Architecture mismatch despite ARM64 listing

@Vonng Vonng added this to the v3.4 milestone Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ENHANCEMENT New feature or request PROVISION Deploy & Provision Related
Projects
Status: Todo
Development

No branches or pull requests

3 participants