Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hyperv-iso builder types boot_command too fast, loosing key strokes #5291

Closed
StefanScherer opened this issue Aug 29, 2017 · 5 comments · Fixed by #9765
Closed

hyperv-iso builder types boot_command too fast, loosing key strokes #5291

StefanScherer opened this issue Aug 29, 2017 · 5 comments · Fixed by #9765

Comments

@StefanScherer
Copy link
Contributor

First thanks for having the Hyper-V builder integrated into packer.
I try to evaluate a PR to add the hyperv-iso builder section to the boxcutter/ubuntu Packer templates. Unfortunately the boot_command misses some keystrokes.
The boot_command is a little bit lengthy with a lot of backspaces and then the complete new boot options for the Ubuntu Server installation.

      "boot_command": [
        "{{ user `boot_command_prefix` }}",
        "/install/vmlinuz noapic ",
        "file=/floppy/hyperv-{{ user `preseed` }} ",
        "debian-installer={{ user `locale` }} auto locale={{ user `locale` }} kbd-chooser/method=us ",
        "hostname={{ user `hostname` }} ",
        "grub-installer/bootdev=/dev/sda<wait> ",
        "fb=false debconf/frontend=noninteractive ",
        "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
        "keyboard-configuration/variant=USA console-setup/ask_detect=false ",
        "passwd/user-fullname={{ user `ssh_fullname` }} ",
        "passwd/user-password={{ user `ssh_password` }} ",
        "passwd/user-password-again={{ user `ssh_password` }} ",
        "passwd/username={{ user `ssh_username` }} ",
        "initrd=/install/initrd.gz -- <enter>"
      ],

But instead of initrd=/install/initrd.gz -- the key scancodes typed into the VM show eg. initrd=/installngz in the input field.

bildschirmfoto 2017-08-29 um 11 32 36

I also tried to add some more <wait> special characters, this sometimes helps, but I also got an issue that the user-password and user-password-again had different values.

@mwhooker
Copy link
Contributor

As I saw pull requests #1663 and #2415 to add 1/10th second delay between key events I guess this is also needed for the hyperv-iso builder to run more stable.

I think you're right

@taliesins
Copy link
Collaborator

https://github.com/taliesins/packer-baseboxes/blob/master/hyperv-pfsense-2.3.2.json

This the approach I took.

You need to give machine a chance to process after filling in a value and pressing enter.

@StefanScherer
Copy link
Contributor Author

Thanks @taliesins. I agree that if a setup has several input prompts to type that you have to add <wait>. For Ubuntu it is just one long boot option input prompt.

Here is one weird situation I got once yesterday where some characters appear uppercase. From the Hyper-V Manager I just watched and haven't pressed any additional key.

bildschirmfoto_2017-08-31_um_09_58_38

The PR has been updated from generation 1 to 2 which seems to improve it a little bit. I'll investigate some more...

@dreadknought
Copy link
Contributor

dreadknought commented Aug 13, 2020

I am also experiencing this issue, although I haven't seen the uppercase problem. In fact, in at least a dozen runs, the boot command has not been correctly typed even one time, but can confirm it is typed correctly when using vmware-iso and virtualbox-iso builders on Ubuntu hardware

Packer 1.6.1
Windows Server 2016 (I believe it's bare metal) with 16 GB memory
Guest VM configured with 8 GB memory

dreadknought pushed a commit to dreadknought/packer that referenced this issue Aug 13, 2020
The boot command was being sent as a single long string to be
typed into the Hyper-V VM, which caused some scan codes to be
intermittently skipped.  The boot command is now split up and sent as
chunks of 32 scan codes at a time.
dreadknought pushed a commit to dreadknought/packer that referenced this issue Aug 14, 2020
    The boot command was being sent as a single long string to be
    typed into the Hyper-V VM, which caused some scan codes to be
    intermittently skipped.  The boot command now sends it in
    chunks of 32 scan codes.
dreadknought added a commit to dreadknought/packer that referenced this issue Aug 17, 2020
The boot command was being sent as a single long string to be
typed into the Hyper-V VM, which caused some scan codes to be
intermittently skipped. The boot command is now split up and sent as
chunks of 32 scan codes at a time.

Closes hashicorp#5291
@ghost
Copy link

ghost commented Oct 13, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked as resolved and limited conversation to collaborators Oct 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants