Vagrant là công cụ tự động tuyệt vời để xây dựng hệ thống công nghệ thông tin từ con số 0.
Tuy nhiên cũng như bất cứ công cụ tự động nào, Vagrant cũng có thể bị lỗi khi móc vào VirtualBox, VMware Workstation, VMware ESXi, Hyper V…
Sau đây là các lỗi thường thấy trên Vagrant.
Vagrant is currently configured to create VirtualBox synced folders with
the `SharedFoldersEnableSymlinksCreate` option enabled. If the Vagrant
guest is not trusted, you may want to disable this option. For more
information on this option, please refer to the VirtualBox manual:
https://www.virtualbox.org/manual/ch04.html#sharedfolders
This option can be disabled globally with an environment variable:
VAGRANT_DISABLE_VBOXSYMLINKCREATE=1
or on a per folder basis within the Vagrantfile:
config.vm.synced_folder '/host/path', '/guest/path', SharedFoldersEnableSymlinksCreate: false
==> control: Clearing any previously set network interfaces...
==> control: Preparing network interfaces based on configuration...
control: Adapter 1: nat
control: Adapter 2: intnet
==> control: Forwarding ports...
control: 22 (guest) => 2222 (host) (adapter 1)
==> control: Running 'pre-boot' VM customizations...
==> control: 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", "8595418c-c410-4c61-8d35-819931bfec30", "--type", "gui"]
Stderr: VBoxManage.exe: error: The machine 'Ansible-Control' is already locked by a session (or being locked or unlocked)
VBoxManage.exe: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee IUnknown
VBoxManage.exe: error: Context: "LaunchVMProcess(a->session, sessionType.raw(), ComSafeArrayAsInParam(aBstrEnv), progress.asOutParam())" at line 881 of file VBoxManageMisc.cpp
vagrant up
Bringing machine 'control' up with 'virtualbox' provider...
Bringing machine 'managed1' up with 'virtualbox' provider...
Bringing machine 'managed2' up with 'virtualbox' provider...
Bringing machine 'managed3' up with 'virtualbox' provider...
==> control: Box 'almalinux/9' could not be found. Attempting to find and install...
control: Box Provider: virtualbox
control: Box Version: >= 0
==> control: Loading metadata for box 'almalinux/9'
control: URL: https://vagrantcloud.com/api/v2/vagrant/almalinux/9
==> control: Adding box 'almalinux/9' (v9.4.20240509) for provider: virtualbox (amd64)
control: Downloading: https://vagrantcloud.com/almalinux/boxes/9/versions/9.4.20240509/providers/virtualbox/amd64/vagrant.box
control:
control: Calculating and comparing box checksum...
==> control: Successfully added box 'almalinux/9' (v9.4.20240509) for 'virtualbox (amd64)'!
==> control: Importing base box 'almalinux/9'...
==> control: Matching MAC address for NAT networking...
==> control: Checking if box 'almalinux/9' version '9.4.20240509' is up to date...
==> control: Setting the name of the VM: Ansible-Control
==> control: Clearing any previously set network interfaces...
==> control: Preparing network interfaces based on configuration...
control: Adapter 1: nat
control: Adapter 2: intnet
==> control: Forwarding ports...
control: 22 (guest) => 2222 (host) (adapter 1)
==> control: Running 'pre-boot' VM customizations...
==> control: 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", "4781310c-8176-4860-ad9c-1e90b6e2f969", "--type", "gui"]
Stderr: VBoxManage.exe: error: Not Hyper-V CPUID signature: 0x61774d56 0x4d566572 0x65726177 (expected 0x7263694d 0x666f736f 0x76482074) (VERR_NEM_NOT_AVAILABLE).
VBoxManage.exe: error: VT-x is not available (VERR_VMX_NO_VMX)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsole