patternMinor
Understanding Vagrant virtual machine import
Viewed 0 times
understandingvagrantmachinevirtualimport
Problem
I'm building my Windows server 2012 vm with packer and when I'm doing a
Here is my json file for packer
``
"winrm_username": "vagrant"
}
],
"post-processors": [
{
"keep_input_artifact": false,
"output": "vagrantenv/windows_2012_r2_{{.Provider}}.box",
"type": "vagrant",
"vagrantfile_template": "vagrantfile-windows_2012_r2.template"
}
],
"provisioners": [
{
"scripts": [
"./scripts/vm-guest-tools.bat",
"./scripts/enable-rdp.bat"
],
"type": "windows-shell"
}
],
"variables": {
"autounattend": "./answer_files/2012_r2/Autounattend.xml",
"disk_size": "61440",
"disk_type_id": "1",
"headless": "true",
"iso_checksum": "5b5e08c490ad16b59b1d9fab0def883a",
"iso_checksum_type": "md5",
"iso_url": "./iso/
vagrant up it's failing because the folder name already exists…Here is my json file for packer
``
{
"builders": [
{
"boot_wait": "2m",
"communicator": "winrm",
"disk_size": "{{user disk_size}}",
"floppy_files": [
"{{user autounattend}}",
"./scripts/disable-winrm.ps1",
"./scripts/enable-winrm.ps1"
],
"guest_additions_mode": "disable",
"guest_os_type": "Windows2012_64",
"headless": "{{user headless}}",
"iso_checksum": "{{user iso_checksum}}",
"iso_checksum_type": "{{user iso_checksum_type}}",
"iso_url": "{{user iso_url}}",
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"type": "virtualbox-iso",
"vboxmanage": [
[
"modifyvm",
"{{.Name}}",
"--memory",
"2048"
],
[
"modifyvm",
"{{.Name}}",
"--nic1",
"NAT"
],
[
"modifyvm",
"{{.Name}}",
"--cpus",
"2"
]
],
"vm_name": "windows_2012_r2",
"winrm_password": "vagrant",
"winrm_timeout": "{{user winrm_timeout`}}","winrm_username": "vagrant"
}
],
"post-processors": [
{
"keep_input_artifact": false,
"output": "vagrantenv/windows_2012_r2_{{.Provider}}.box",
"type": "vagrant",
"vagrantfile_template": "vagrantfile-windows_2012_r2.template"
}
],
"provisioners": [
{
"scripts": [
"./scripts/vm-guest-tools.bat",
"./scripts/enable-rdp.bat"
],
"type": "windows-shell"
}
],
"variables": {
"autounattend": "./answer_files/2012_r2/Autounattend.xml",
"disk_size": "61440",
"disk_type_id": "1",
"headless": "true",
"iso_checksum": "5b5e08c490ad16b59b1d9fab0def883a",
"iso_checksum_type": "md5",
"iso_url": "./iso/
Solution
It looks like that there is a name conflict:
According to @xofer on Github on has to set the
The name of your virtual machine couldn't be set because VirtualBox
is reporting another VM with that name already exists. Most of the
time, this is because of an error with VirtualBox not cleaning up
properly. To fix this, verify that no VMs with that name do exist
(by opening the VirtualBox GUI). If they don't, then look at the
folder in the error message from VirtualBox below and remove it
if there isn't any information you need in there.According to @xofer on Github on has to set the
name. However in the example you provided in conjunction with the logging, the issue seems to be caused by a VM that was created and still exists in Virtualbox. In other words one has to ensure that the VM has been removed or another name has to be defined to prevent this collision.Code Snippets
The name of your virtual machine couldn't be set because VirtualBox
is reporting another VM with that name already exists. Most of the
time, this is because of an error with VirtualBox not cleaning up
properly. To fix this, verify that no VMs with that name do exist
(by opening the VirtualBox GUI). If they don't, then look at the
folder in the error message from VirtualBox below and remove it
if there isn't any information you need in there.Context
StackExchange DevOps Q#7971, answer score: 2
Revisions (0)
No revisions yet.