virtualbox在macbook pro m1上vagrant启动rockylinux10

问题

vagrant up 在m1上提示: There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["startvm", "0f035c23-1ced-4dc5-98e6-c4d62d3e39ea", "--type", "headless"]

Stderr: VBoxManage: error: Cannot run the machine because its platform architecture x86 is not supported on ARM
VBoxManage: error: Details: code VBOX_E_PLATFORM_ARCH_NOT_SUPPORTED (0x80bb0012), component MachineWrap, interface IMachine, callee nsISupports
VBoxManage: error: Context: "LaunchVMProcess(a->session, sessionType.raw(), ComSafeArrayAsInParam(aBstrEnv), progress.asOutParam())" at line 921 of file VBoxManageMisc.cpp

vagrant无法有效识别出系统的架构arm64,导致的问题。
7e520fa7f434825adc24ab86871d8a36.png

1d0866142623bb690c0e1b6fd8d0f8f4.png

解决

mac@GaGa ~ % vgt box list
rocky10-arm64     (virtualbox, 0, (arm64))
ubunt-22.04-arm64 (virtualbox, 0, (arm64))

1.通过virtualbox中介打包box

  • 1.qcow2转换成vdi格式
  • 2.通过virtualbox创建虚拟机,使用vdi磁盘
  • 3.把当前虚拟机打包box,在导入到vagrant
  • 4.Vagrantfile启动虚拟机

有个致命问题,如果没有默认vagrant/vagrant账户会导致创建密钥不成功,bios进入修改密码也不行。

2.通过multipass平台

通过ubuntu的multipass虚拟化平台支持cloud-init注入配置修改/创建账户密码。