packer-plugin-hyperv icon indicating copy to clipboard operation
packer-plugin-hyperv copied to clipboard

Special keys (<up> <down> <end> etc) being misinterpreted on Hyper-V

Open ghost opened this issue 4 years ago • 2 comments

This issue was originally opened by @robleady as hashicorp/packer#10882. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


When using certain special keys in the boot_command of a VM with the Hyper-V builder, they are being interpreted as numbers rather than the required key.

When booting a Debian 10.x UEFI installation, I use the following boot_command to move into the Install menu and edit the linux boot parameters.

e

The and keys are being interpreted as the numbers 2 and 1 respectively, which are the corresponding numbers on a number pad keyboard - ie the keys that would be pressed were numlock turned on.

This looks to be the same issue mentioned in https://github.com/hashicorp/packer/issues/7315

As discussed in that previous issue, this can be worked around by surrounding each special key with <leftShiftOn> and <leftShiftOff>, however this is makes for a rather cumbersome build file.

Packer version 1.7.2

Snippet from build file:

source "hyperv-iso" "debian10-uefi" { boot_command = ["e", ... ] ... generation = 2 enable_secure_boot = "true" secure_boot_template = "MicrosoftUEFICertificateAuthority" }

Windows 10, x86_64, Hyper-V ISO builder. Attempting to build a Debian 10.9 machine.

2021/04/07 15:55:55 packer.exe plugin: Special code 'Press' '' found, replacing with: &{[e0 50] [e0 d0]} 2021/04/07 15:55:56 packer.exe plugin: [INFO] Waiting 1s 2021/04/07 15:55:57 packer.exe plugin: Sending char 'e', code '1292', shift false 2021/04/07 15:55:58 packer.exe plugin: [INFO] Waiting 1s 2021/04/07 15:55:59 packer.exe plugin: Special code 'Press' '' found, replacing with: &{[e0 50] [e0 d0]} 2021/04/07 15:55:59 packer.exe plugin: Special code 'Press' '' found, replacing with: &{[e0 50] [e0 d0]} 2021/04/07 15:55:59 packer.exe plugin: Special code 'Press' '' found, replacing with: &{[e0 50] [e0 d0]} 2021/04/07 15:55:59 packer.exe plugin: Special code 'Press' '' found, replacing with: &{[e0 4f] [e0 cf]} 2021/04/07 15:56:00 packer.exe plugin: [INFO] Waiting 1s

ghost avatar Apr 22 '21 15:04 ghost

Hello! Any update on this? I am expiriensing the same issues on fresh versions of packer and hyperv plugin during rocky10 deployment.

Here is my boot command

  boot_command = [
    "<up><wait5>",
    "e",
    "<wait5>",
    "<down><down><end><wait5>",
    " text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg <enter><wait5><f10>"
  ]

After starting the VM and booting into grub menu it seems to completly ignore <up> key. <down> and <end> keys are replaced by a buch of numbers.

Here is a screenshot where I marked with red line what is being typed instead of <down> and <end> keys

Image

As you can see regular charachters are typed normally.

Here is a chunk of log file containing the debug info

==> hyperv-iso.rocky10: Typing the boot command...
2025/07/18 10:20:40 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:40 Special code 'Press' '<up>' found, replacing with: &{[e0 48] [e0 c8]}
2025/07/18 10:20:40 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:40 [INFO] Waiting 5s
2025/07/18 10:20:45 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:45 Sending char 'e', code '1292', shift false
2025/07/18 10:20:46 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:46 [INFO] Waiting 5s
2025/07/18 10:20:51 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:51 Special code 'Press' '<down>' found, replacing with: &{[e0 50] [e0 d0]}
2025/07/18 10:20:51 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:51 Special code 'Press' '<down>' found, replacing with: &{[e0 50] [e0 d0]}
2025/07/18 10:20:51 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:51 Special code 'Press' '<end>' found, replacing with: &{[e0 4f] [e0 cf]}
2025/07/18 10:20:52 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:52 [INFO] Waiting 5s
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char ' ', code '39b9', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char 't', code '1494', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char 'e', code '1292', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char 'x', code '2dad', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char 't', code '1494', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char ' ', code '39b9', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char 'i', code '1797', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char 'n', code '31b1', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char 's', code '1f9f', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char 't', code '1494', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char '.', code '34b4', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char 'k', code '25a5', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char 's', code '1f9f', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char '=', code '0d8d', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char 'h', code '23a3', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char 't', code '1494', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char 't', code '1494', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char 'p', code '1999', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char ':', code '2a27a7aa', shift true
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char '/', code '35b5', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char '/', code '35b5', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char '1', code '0282', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char '7', code '0888', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char '2', code '0383', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char '.', code '34b4', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char '2', code '0383', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char '2', code '0383', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char '.', code '34b4', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char '0', code '0b8b', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char '.', code '34b4', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char '1', code '0282', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char ':', code '2a27a7aa', shift true
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char '8', code '0989', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char '7', code '0888', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char '4', code '0585', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char '1', code '0282', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char '/', code '35b5', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char 'k', code '25a5', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char 's', code '1f9f', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char '.', code '34b4', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char 'c', code '2eae', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char 'f', code '21a1', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char 'g', code '22a2', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Sending char ' ', code '39b9', shift false
2025/07/18 10:20:57 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:57 Special code 'Press' '<enter>' found, replacing with: &{[1c] [9c]}
2025/07/18 10:20:59 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:20:59 [INFO] Waiting 5s
2025/07/18 10:21:04 packer-plugin-hyperv_v1.1.4_x5.0_windows_amd64.exe plugin: 2025/07/18 10:21:04 Special code 'Press' '<f10>' found, replacing with: &{[44] [c4]}

genie-zs avatar Jul 18 '25 19:07 genie-zs

I have exactly the same issue, anyone can help?

wbp2019 avatar Nov 05 '25 11:11 wbp2019