hashicorp / packer-plugin-virtualbox

Packer plugin for VritualBox Builder
https://www.packer.io/docs/builders/virtualbox
Mozilla Public License 2.0
22 stars 36 forks source link

Error unregistering floppy: VBoxManage error: VBoxManage: error: Could not find a controller named 'Floppy Controller'. Not considering this a critical failure; build will continue. #73

Open hc-github-team-packer opened 2 years ago

hc-github-team-packer commented 2 years ago

This issue was originally opened by @KptnKMan in https://github.com/hashicorp/packer/issues/11935 and has been migrated to this repository. The original issue description is below.


Community Note

When filing a bug, please include the following headings if possible. Any example text in this template can be deleted.

Overview of the Issue

This seems to be an issue that has been occuring since earlier than 2016, and continues to present itself, across platforms and use cases. There are dozens of issues logged in this project, but I want to bring particular attention to #2401 which was logged in 2015, and was closed in 2020, but is still not resolved. There are earlier examples like #1193 and later examples also.

==> virtualbox-iso: Cleaning up floppy disk...
==> virtualbox-iso: Error unregistering floppy: VBoxManage error: VBoxManage: error: Could not find a controller named 'Floppy Controller'. Not considering this a critical failure; build will continue.
==> virtualbox-iso: Deregistering and deleting VM...

I am experiencing this issue, and it crashes my build and deletes all my efforts basically every time after hours of running, unless I can literally snatch the image file away before packer gets a chance.

That this has gone on for so long unresolved, I'm not sure what to say. Can something be done about this, beyond workarounds adjusting timeouts of shutdown_timeout and post_shutdown_delay?

I have adjusted these timeouts higher and higher, and still experience this issue. Running headless doesn't help. I would appreciate if this could get beyond screaming into the void, and nothing being done about it.

Reproduction Steps

Run Packer template as normal. Issue occurs at end of runtime.

Packer version

Packer v1.8.2 on Ubuntu 20.04 Virtualbox 6.1.34_Ubuntur150636

Simplified Packer Template

In this example am using packer recommended scripts from: https://github.com/StefanScherer/packer-windows

{
  "builders": [
    {
      "boot_command": [
        "<leftShiftOn><f10><leftShiftOff><wait>",
        "reg add HKLM\\SYSTEM\\Setup\\LabConfig /t REG_DWORD /v BypassTPMCheck /d 1<return>",
        "reg add HKLM\\SYSTEM\\Setup\\LabConfig /t REG_DWORD /v BypassSecureBootCheck /d 1<return><wait>",
        "reg add HKLM\\System\\Setup\\LabConfig /t REG_DWORD /v BypassRAMCheck /d 1<return><wait>",
        "reg add HKLM\\System\\Setup\\LabConfig /t REG_DWORD /v BypassCPUCheck /d 1<return><wait>",
        "reg add HKLM\\System\\Setup\\LabConfig /t REG_DWORD /v BypassStorageCheck /d 1<return><wait>",
        "exit<return>",
        "<wait><return>"
      ],
      "boot_wait": "2m",
      "communicator": "winrm",
      "cpus": "{{user `cpus`}}",
      "disk_size": "{{user `disk_size`}}",
      "floppy_files": [
        "./answer_files/11_efi/Autounattend.xml",
        "./scripts/fixnetwork.ps1",
        "./scripts/disable-screensaver.ps1",
        "./scripts/disable-winrm.ps1",
        "./scripts/enable-winrm.ps1",
        "./scripts/microsoft-updates.bat",
        "./scripts/win-updates.ps1"
      ],
      "cd_files": [
        "./answer_files/11_efi/Autounattend.xml",
        "./scripts/fixnetwork.ps1",
        "./scripts/disable-screensaver.ps1",
        "./scripts/disable-winrm.ps1",
        "./scripts/enable-winrm.ps1",
        "./scripts/microsoft-updates.bat",
        "./scripts/win-updates.ps1"
      ],
      "cd_label": "unattend",
      "guest_additions_mode": "disable",
      "guest_os_type": "Windows11_64",
      "headless": "{{user `headless`}}",
      "iso_checksum": "{{user `iso_checksum`}}",
      "iso_url": "{{user `iso_url`}}",
      "memory": "{{user `memory`}}",
      "shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
      "type": "virtualbox-iso",
      "vm_name": "{{user `vm_name`}}",
      "name": "windows_11_vboxiso_efi",
      "winrm_password": "vagrant",
      "winrm_timeout": "{{user `winrm_timeout`}}",
      "winrm_username": "vagrant",
      "firmware": "efi",
      "gfx_controller": "vboxsvga",
      "gfx_vram_size": "128",
      "gfx_accelerate_3d": "true"
    }
  ],
  "post-processors": [
    {
      "type": "amazon-import",
      "boot_mode": "uefi",
      "region": "{{user `region`}}",
      "profile": "{{user `profile`}}",
      "role_name": "{{user `role_name`}}",
      "s3_bucket_name": "{{user `s3_bucket_name`}}",
      "s3_key_name": "{{user `s3_key_name`}}",
      "s3_encryption": "{{user `s3_bucket_encryption`}}",
      "format": "{{user `vm_image_format`}}",
      "keep_input_artifact": false,
      "license_type": "{{user `license_type`}}",
      "ami_encrypt": "{{user `ami_encrypt`}}",
      "ami_kms_key": "{{user `ami_encrypt_kms_key`}}",
      "ami_name": "{{user `environment`}}-{{user `service-team`}}-{{user `created-by`}}-{{user `service-component`}}{{user `ami_name_suffix`}}",
      "tags": {
        "Name": "{{user `environment`}}-{{user `service-team`}}-{{user `created-by`}}-{{user `service-component`}}{{user `ami_name_suffix`}}",
        "environment": "{{user `environment`}}",
        "service-team": "{{user `service-team`}}",
        "created-by": "{{user `created-by`}}",
        "service-component": "{{user `service-component`}}",
        "tagging-version": "{{user `tagging-version`}}",
        "source-ami": "{{user `iso_url`}}",
        "build-time": "{{isotime \"20060102-1504\"}}",
        "build-id": "{{user `build_id`}}"
      }
    }
  ],
  "provisioners": [
    {
      "execute_command": "{{ .Vars }} cmd /c \"{{ .Path }}\"",
      "remote_path": "/tmp/script.bat",
      "scripts": [
        "./scripts/enable-rdp.bat"
      ],
      "type": "windows-shell"
    },
    {
      "scripts": [
        "./scripts/vm-guest-tools.ps1",
        "./scripts/debloat-windows.ps1"
      ],
      "type": "powershell"
    },
    {
      "restart_timeout": "{{user `restart_timeout`}}",
      "type": "windows-restart"
    },
    {
      "scripts": [
        "./scripts/set-powerplan.ps1",
        "./scripts/docker/disable-windows-defender.ps1"
      ],
      "type": "powershell"
    },
    {
      "execute_command": "{{ .Vars }} cmd /c \"{{ .Path }}\"",
      "remote_path": "/tmp/script.bat",
      "scripts": [
        "./scripts/compile-dotnet-assemblies.bat",
        "./scripts/set-winrm-automatic.bat",
        "./scripts/uac-enable.bat",
        "./scripts/dis-updates.bat",
        "./scripts/compact.bat"
      ],
      "type": "windows-shell"
    }
  ]
}

Operating system and Environment details

Ubuntu 20.04 Virtualbox 6.1.34_Ubuntur150636

Log Fragments and crash.log files

...
==> virtualbox-iso: 2022-08-11 12:26:25 Info: Sysprep command: C:\Windows\System32\Sysprep\Sysprep.exe /oobe /quit /generalize /unattend:C:\ProgramData\Amazon\EC2Launch\sysprep\unattend.xml
    virtualbox-iso:
    virtualbox-iso: C:\Users\Administrator>shutdown /s /t 10 /f /d p:4:1
==> virtualbox-iso: Automatic shutdown disabled. Please shutdown virtual machine.
    virtualbox-iso: Removing floppy drive...
==> virtualbox-iso: Preparing to export machine...
    virtualbox-iso: Deleting forwarded port mapping for the communicator (SSH, WinRM, etc) (host port 3551)
==> virtualbox-iso: Exporting virtual machine...
    virtualbox-iso: Executing: export win11base --output output-virtualbox-iso/win11base.ova --manifest --vsys 0 --description Windows 11 Enterprise V10.0.22000 SPB318 --version 0.1.0
==> virtualbox-iso: Cleaning up floppy disk...
==> virtualbox-iso: Error unregistering floppy: VBoxManage error: VBoxManage: error: Could not find a controller named 'Floppy Controller'. Not considering this a critical failure; build will continue.
==> virtualbox-iso: Deregistering and deleting VM...
==> virtualbox-iso: Running post-processor: amazon-import
...