Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

VBoxManage controlvm keyboardputscancode fails on macOS #114

Closed
houtanb opened this issue Oct 30, 2019 · 20 comments
Closed

VBoxManage controlvm keyboardputscancode fails on macOS #114

houtanb opened this issue Oct 30, 2019 · 20 comments
Assignees
Labels
bug Something isn't working

Comments

@houtanb
Copy link

houtanb commented Oct 30, 2019

When I run the script with the following options

vmname="macOS"             # name of the VirtualBox virtual machine
storagesize=22000          # VM disk image size in MB. minimum 22000
cpucount=4                 # VM CPU cores, minimum 2
memorysize=8192            # VM RAM in MB, minimum 2048
gpuvram=128                # VM video RAM in MB, minimum 34, maximum 128
resolution="1280x800"      # VM display resolution

choosing C for Catalina, I eventually run into this problem:

Press enter when the Terminal command prompt is ready.

Partitioning target virtual disk.
VBoxManage: error: Failed to send a scancode

I have tried creating a Virtual Box for Mojave as well. It always fails on write to Terminal. Any suggestions?

@myspaghetti myspaghetti self-assigned this Oct 30, 2019
@myspaghetti myspaghetti added the bug Something isn't working label Oct 30, 2019
@myspaghetti
Copy link
Owner

Please check that the VirtualBox Extension Pack and Virtualbox are the same version.

@houtanb
Copy link
Author

houtanb commented Oct 30, 2019

They are both 6.0.14

@myspaghetti
Copy link
Owner

Would you mind trying to remove and reinstall the extension pack?

@houtanb
Copy link
Author

houtanb commented Oct 30, 2019

I did it. It didn't work.

Partitioning target virtual disk.
VBoxManage: error: Failed to send a scancode

Here's a screenshot. Note I was not pressing any buttons on the keyboard when this happened (other than Enter when the Terminal window popped up
Screen Shot 2019-10-30 at 17 55 58

@houtanb
Copy link
Author

houtanb commented Oct 30, 2019

A second attempt:

Press enter when the Terminal command prompt is ready.

Partitioning target virtual disk.
VBoxManage: error: Failed to send a scancode

Screen Shot 2019-10-30 at 18 28 44

@myspaghetti
Copy link
Owner

Please download the attached file and rename it to macos-guest-virtualbox.sh and attempt to run it. You can skip all the stages before populate_virtual_disks. It's version 0.76.1 of the script with each keystroke sent by an individual instance of VBoxManage instead of sending entire lines with the same instance.

macos-guest-virtualbox.txt

I'll try to reproduce the issue later, meanwhile you can see if this change works around the issue.

@houtanb
Copy link
Author

houtanb commented Oct 31, 2019

It worked! Thanks so much :)

@houtanb houtanb closed this as completed Oct 31, 2019
@myspaghetti myspaghetti reopened this Oct 31, 2019
@myspaghetti myspaghetti changed the title Problem running script on macOS 10.14.6 to create VirtualBox with 10.15 VBoxManage controlvm keyboardputscancode fails on macOS Oct 31, 2019
@myspaghetti
Copy link
Owner

Could not reproduce on macOS 10.14.6 (18G103) i5-7360U with VirtualBox and Extension Pack version 6.0.14-133895-OSX.

  • Is your processor very fast or very slow that it might affect the VM's input rate?
  • Do you have any USB peripherals or other input devices that might affect keyboard input?
  • Do you have any accessibility settings that might affect keyboard input?

@houtanb
Copy link
Author

houtanb commented Oct 31, 2019

Thanks for looking into this. I have a MacBook Pro Mid 2014, i7-4770HQ CPU @ 2.20GHz with 16 GB RAM running macOS 10.14.6

I have an external Dvorak keyboard connected via USB port. Other things connected by USB: mouse and iPhone.

No specific Keyboard/Accessibility settings

@myspaghetti
Copy link
Owner

The external keyboard could be causing the issue. I tried running the script with an external keyboard on macOS and Windows on a couple of machines but I could not reproduce the bug.

If you could troubleshoot, it would be very helpful.

  • On the guest, open TextEdit or Terminal or any other app that echoes keyboard input
  • On the host, enter the following [replace "macOS" with the name of the VM if necessary] in Terminal:
faceroll=$(for i in $(seq 2 13) $(seq 16 27) $(seq 30 38) $(seq 43 53); do let j=i+128; printf '%02X %02X ' ${i} ${j}; done); faceroll="2A 04 84 AA ${faceroll} ${faceroll} ${faceroll} ${faceroll} ${faceroll} 1C 9C"; while True; do read -p "CTRL-C to quit, ENTER to continue"; VBoxManage controlvm macOS keyboardputscancode ${faceroll}; done

This will repeatedly prompt you to press enter to send keystrokes to the virtual machine. If the line aborts in the middle you should see a repeating character or no enter being pressed, as with the bug before.

Please test this a few times with the USB keyboard connected and disconnected, it would be very helpful in confirming or excluding the keyboard as the reason for the bug.

@houtanb
Copy link
Author

houtanb commented Oct 31, 2019

With keyboard plugged in

Screen Shot 2019-10-31 at 14 58 46

@houtanb
Copy link
Author

houtanb commented Oct 31, 2019

With all USB devices unplugged
Screen Shot 2019-10-31 at 15 04 11

@houtanb
Copy link
Author

houtanb commented Oct 31, 2019

NB: Using GNU bash, version 5.0.11(1)-release (x86_64-apple-darwin18.6.0) installed via homebrew

@myspaghetti
Copy link
Owner

So it's not the keyboard. I'll keep trying to reproduce the bug. Thanks for all your help!

@houtanb
Copy link
Author

houtanb commented Oct 31, 2019

No problem, thanks for all the work you put into this!

@thoernle
Copy link

Had the same issue and it got fixed by your edited file. Please let me know if you need any further information.

@myspaghetti
Copy link
Owner

@thoernle thank you very much.

  • Any USB or Bluetooth devices that might produce/interrupt keyboard input?
  • Dvorak keyboard layout?
  • Any host settings that might affect keyboard accessibility?
  • Is the host OS macOS?

@thoernle
Copy link

thoernle commented Nov 12, 2019

- Any USB or Bluetooth devices that might produce/interrupt keyboard input?
Yes, I am using a Apple Magic Keyboard on a MacBook Pro connected via USB

- Dvorak keyboard layout?
No, I am using "ABC - QWERTZ"

- Any host settings that might affect keyboard accessibility?
Nothing special set

- Is the host OS macOS?
Yes, macOS Mojave - Version 10.14.6 to be exact

@myspaghetti
Copy link
Owner

I'm sorry, I haven't been able to reproduce the issue still. Closing unresolved, feel free to reopen the issue or start a new one.

@myspaghetti
Copy link
Owner

Script version 0.96.0 defaults to sending one scancode at a time, so this issue is workaround-ed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants