Sending Keys through VM Console incorrect Ascii mapping?

Hi All,

I’m using a Hyper-V environment, and using Powershell to send keys via the console to the SUSE VM for setup scripting. This all works fine with CentOS, Debian, Fedora and Ubuntu.

However, with SUSE 13 when I sent keys from powershell using the following commands:
$VMConsole = Connect-VMConsole
$KB = $VMConsole.VSMKB
$KB.TypeText(“root”)

It does not work. On further investigation I found that using TypeKey or TypeText it sends the keystrokes using standard ascii table as found at: http://www.bluesock.org/~willg/dev/ascii.html

However, SUSE interprets using a different ascii table, found at: http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx

I can provide this by sending:
$KB.TypeKey(0x6B)
This produces the character + on the console.

Whereas, it should produce the character: k

This only seems to happen on OpenSUSE (at least it doesn’t happen on CentOS, Ubuntu, Debian or Fedora).

Have you got any ideas? I’ve tried resetting the keyboard to US layout on the SUSE VM, and I’ve also tried using loadkeys us.

Cheers
Will

I guess the first Q that occurs to me is why you feel the need to send virtual keystrokes.
Seems to me in most cases if you’re trying to execute something on a Linux box there should be plenty of ways to do so usually without having to send a virtual keystroke.

TSU

Hi Tsu2,

Unfortunately that’s not a very constructive or helpful answer. Please see http://www.setlinuxvm.com/ which uses keystrokes to setup a newly provisioned VM (networking, password, LVM expansion, installations of latest versions of products). We use this for provisioning of lots of linux based operating systems including CentOS, Ubuntu, Debian, Fedora, Linux Mint.

Thanks,
Will

Well,
I just watched the video “How it works” on the setlinuxvm website.
It seems pretty clear that no keystrokes are being sent to the VM, it merely accepts your keystroke imput, creates an XML file that contains the information you just entered using Powershell and then embeds the information into a BASH command to be executed in the Guest.

So,
My question again is why you feel you need to send virtual keystrokes.
I can imagine an <interactive> session where you might be communicating with some agent in the Guest which might require such a thing, but that’s a far cry from the demo I saw in the video.

If you describe exactly what you’re trying to accomplish so it’s understood how what you’re trying to do is different then I might understand better your need.

TSU

Hi Tsu,

Okay, firstly SetLinuxVM does indeed sendkeys. It sends keys to login, sends keys to mount an ISO which it then sends keys to run.

Secondly, as in my first post I provided exact information on reproducing the problem.

To reproduce you need a windows machine with the Hyper-V role installed. A VM created and openSUSE 13.1 installed.

Then open a powershell window and type:

$VMConsole = Connect-VMConsole
$KB = $VMConsole.VSMKB
$KB.TypeText(“root”)

On all other variants of Linux this sends the characters: root
On openSUSE this sends nothing as the characters don’t match the ascii table that openSUSE appears to be using.

So my question is, is there something that openSUSE does that sets a different keyboard ASCII table than everyone else?

Thanks,
Will

Yes, it does look like the method you use to login to the remote machine is an interactive session.

Without being able to provide an answer to your originaal question, it seems to me that a simple workaround which is probably the standard method setup such scripts use is to simply provide the credentials in the script. I don’t know the exact type of session SetLinuxVM sets up but if it’s an SSH session(hopefully) or telnet(hopefully not) this should be easy to configure.

TSU

Hi Tsu,

Well obviously if you are provisioning a VM there is no networking set in the operating system and therefore no way to SSH or Telnet in. That is why setups use console access. As mentioned this works on EVERY other Linux distribution except openSUSE, and is used by multiple tools for both VMWare and Hyper-V for template configuration.

Please don’t worry about workarounds unless you have actually reproduced the problem and understand it properly.

My main question after all this remains exactly as in the first post. Is there a keyboard mapping or something that is making openSUSE different from other Linux distributions?

Why is it using a different ASCII character set than everything else?

Thanks,
Will

Why? I suspect you would need to ask on a developer mail list. We are just users here.

I can’t imagine that SetLinuxVM should be different than any other “provisioning” app. Fundamentally all such apps are scripts.

If you’re not remoting into the VM, the setup should be even simpler in concept because as you say… There is no networking that needs to be configured/setup.

I strongly recommend you ask the SetLinuxVM folks how to pass your credentials directly to the VM in the script without requiring an interactive session. It’s not just a “workaround,” it’s generally the preferred way for provisioning scripts to run so that it removes <all> interactivity, you simply click the script and the whole thing runs from beginning to end.

BTW - The main reason I see to consider SetLinuxVM is to leverage any existing Powershell skills you have. Else, I’d recommend a well-known, popular cross-platform and cross-technology provisioning app like Vagrant

TSU