How to Pass TTY2 Key Combo to Guest VM?

Needing to enter TTY2 on an installed guest standalone VM, but when inserting the TTY2 key combo of Ctrl-Alt-F2, this drops the host into TTY2.

How can we pass a key combo to a specific qube?

There are no guests and hosts in Qubes OS. Just qubes and dom0.

$ sudo chvt 2

in a StandaloneVM’s terminal?

This won’t work as I’m in the installation process of the OS and only have access to the GUI, unless I can figure out how to get into TTY2

Well then you have to describe your goal, and not the step.
(regardless of this, you first said “on an installed”, and now you are saying "I’m in the installation process of the OS ")

@agreesee

In my experience tty access via keys during GUI boot can vary. Would you mind sharing the distro in question so that I can do some testing locally?

I’m installing Qubes OS in a StandaloneVM, and I’m in the GUI installer. I want to enter TTY2.

Which distro are you attempting to install in an HVM/StandaloneVM?

I’ve found a viable solution, although rather annoying.

I have an external (external from the laptop) USB keyboard nearby, that I attached to one of my USB ports. I then attached that port’s controller to the StandaloneVM that I’m using to install Qubes OS in with this command:

qvm-pci attach --persistent {vmname} dom0:{BDF-address} -no-strict-reset=True

From here, I am able to boot the StandaloneVM with the Qubes OS installation disc and proceed to drop into TTY2 with the normal Ctrl+Alt+F2 key combo, using the attached USB keyboard, without dropping dom0 into TTY2, and being able to proceed with my work.

Until a better workaround is found, this method should always work in any case of needing to pass any key combo to any VM where the key combo would conflict with dom0.

2 Likes

FWIW, within an HVM/StandaloneVM with Qubes 4.1.1 installed, I’m able to cycle between tty1 (GUI) & tty2 (dom0 login) with: Fn+Ctrl+Alt+F2 & Fn+Ctrl+Alt+F2, respectively.

I’m not sure how, as for my Qubes 4.1.1 installation, dom0 actual receives this key command first and drops itself to TTY2, not passing it to the HVM.

Are you including the Fn key? Your posts have spoken to Ctrl-Alt-F2 sans Fn.

If so, I’d verify keyboard mapping during install to assure the proper keyboard layout is being applied.

Also, I just checked and, if window focus is on the host (ie: dom0 all guest VMs minimized + only desktop visible) the same key combination does in fact drop me into dom0 on the host system. Whereas, if window focus is on the guest install of Qubes 4.1.1, the same key combination is applied to said guest as expected.

Not that I’m certain this would cause any issue but, as an aside, I applied qvm-features <YOUR_GUEST_HERE> uefi 1 within dom0 (host) prior to install.

Yes, the Fn key is being used correctly. I’m not sure why my system doesn’t pass the TTY2 combo to the guest, but it doesn’t. Even with the guest window focused, doesn’t work. I can confirm that the proper keyboard layout is being used.

I tried also with uefi 1, but the results are the same.

While this is a workaround, I’m still looking for an actual solution.

A) From what’s been observed and reported, you already have the “actual solution”. Based on testing, Fn+Ctrl+Alt+F2 “just works”, as expected to reach dom0 on both host as well as guest. My advice? Look inward toward your own setup/configuration, something (I would say broken hardware but, seems to work for dom0 so, being certain that keyboard mapping is a match is where I’d be looking) is disrupting expected behavior.

B) Installing Qubes OS in a virtual machine is not supported

This is a solution, but apparently not one that works for you.

You can use xdotool to send key events to specific qubes.
xdotool search --name QUBE key ctrl+alt+F2 will send that key combo
to QUBE.

You can use xdotool to find the active window if you habitually wanted
to pass in a specific key combo - this has been covered a number of time
in the Forum.
For your current use, just the command line should be enough.

Nested Qubes is not supported, and will massively enlarge the attack
surface, but if you want to try it, have fun.

I never presume to speak for the Qubes team. When I comment in the Forum or in the mailing lists I speak for myself.
1 Like

I’ll be testing this solution soon, hoping that xdotool is able to work for my use case.

In regards to running Qubes nested, I’m aware of the risks, and the purpose of running Qubes nested is for configuration testing, whereby performing this testing on the host may be both inconvenient and destructive.

Thank you for your responses

Your command xdotool search --name QUBE key ctrl+alt+F2 results in sending the ctrl+alt+F2 keystroke to dom0.

After exploring xdotool, I found that these steps result in reproducible success:

  1. Use xdotool to find the ID of the desired window:

    xdotool selectwindow
    

The cursor will change into a target selector, proceed to click on the target window. In my case, this was the open StandaloneVM Qubes OS installer window. xdotool selectwindow then outputs an 8 digit number string (Ex: 27831926) that is the ID of the target window.

  1. Using the output from xdotool selectwindow, proceed to inject the TTY2 keystroke command

    xdotool key --window 27831926 ctrl+alt+F2
1 Like

Bizarre - it doesn’t for me.
xdotool search --name is the canonical way of finding windows and
sending key codes to them.
As you have a HVM, there will be only one window with title QUBE, and that
command will send the key code to the HVM.
I’ve tested this on a variety of Qubes installs, and it works as
expected.

No idea why this (like the other solution) didn’t work for you.