ArduPilot / ardupilot_wiki

Repository for ArduPilot wiki issues and wiki-specific website infrastructure.
Other
506 stars 1.25k forks source link

Vagrant doesn't work on Apple Silicon Macs because ubuntu/jammy64 is not an Arm image #6316

Open master0v opened 1 month ago

master0v commented 1 month ago

I am following the instructions on this page: https://ardupilot.org/dev/docs/setting-up-sitl-using-vagrant.html

When I get to "vagrant up" step - it craps out due to the fact that Vagrant 2.4.1 doesn't support virtualbox Version 7.1.2 r164945 (Qt6.5.3). That can be fixed with the suggestion provided here: https://github.com/hashicorp/vagrant/issues/13501

Once that is working, however, the fundamental problem is that the VM that it is trying to pull is built for the Intel architecture. Here is the full error message:

MacBook-Pro ardupilot % vagrant up --provider=virtualbox   
Bringing machine 'jammy' up with 'virtualbox' provider...
==> jammy: Checking if box 'ubuntu/jammy64' version '20240912.0.0' is up to date...
==> jammy: Clearing any previously set forwarded ports...
==> jammy: Clearing any previously set network interfaces...
==> jammy: Preparing network interfaces based on configuration...
    jammy: Adapter 1: nat
==> jammy: Forwarding ports...
    jammy: 22 (guest) => 2222 (host) (adapter 1)
==> jammy: Running 'pre-boot' VM customizations...
==> jammy: Booting VM...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["startvm", "8ef543d5-204a-4df4-830f-d075932bdcd3", "--type", "headless"]

Stderr: VBoxManage: error: The VM session was aborted
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component SessionMachine, interface ISession

The same issue happens when I try to run the VM from the UI:

Screenshot 2024-10-03 at 11 13 09

Would it be possible to support this? Thank you!

peterbarker commented 1 month ago

From random googling, it may be possible by changing the machine from eg. ubuntu/jammy64 to perk/ubuntu-2204-arm64

https://portal.cloud.hashicorp.com/vagrant/discover/perk/ubuntu-2204-arm64

There may also be bento boxes to allow for it.

You might need to experiment a bit :-)

master0v commented 1 month ago

Forgive me for the dumb question, but how do you change it?

Simply replacing 'ubuntu/jammy64' with 'perk/ubuntu-2204-arm64' in Vagrantfile didn't work:

MacBook-Pro ardupilot % vagrant up --provider=virtualbox
Bringing machine 'jammy' up with 'virtualbox' provider...
==> jammy: Box 'perk/ubuntu-2204-arm64' could not be found. Attempting to find and install...
    jammy: Box Provider: virtualbox
    jammy: Box Version: >= 0
==> jammy: Loading metadata for box 'perk/ubuntu-2204-arm64'
    jammy: URL: https://vagrantcloud.com/api/v2/vagrant/perk/ubuntu-2204-arm64
The box you're attempting to add doesn't support the provider
you requested. Please find an alternate box or use an alternate
provider. Double-check your requested provider to verify you didn't
simply misspell it.

If you're adding a box from HashiCorp's Vagrant Cloud, make sure the box is
released.

Name: perk/ubuntu-2204-arm64
Address: https://vagrantcloud.com/api/v2/vagrant/perk/ubuntu-2204-arm64
Requested provider: virtualbox (arm64)
Knowledgelocater commented 3 days ago

Add the following to your Vagrantfile before running vagrant up:

ruby Vagrant.configure("2") do |config| config.vm.provider "virtualbox" do |vb| vb.customize ["modifyvm", :id, "--cpuidset", "00000001", "000306a9", "00100800", "7ffafbbf", "bfebfbff"] end end

Update vagrant bash:-
brew install vagrant

otherwise use this :- Vagrant.configure("2") do |config| config.vm.box = "bento/ubuntu-22.04-arm64" # Choose an ARM-compatible box end

and re initialize vagrant reload --provision