Bug 849975

Summary: sysrq magic key combos are not passed to the guest
Product: Red Hat Enterprise Linux 6 Reporter: David Jaša <djasa>
Component: spice-gtkAssignee: Christophe Fergeau <cfergeau>
Status: CLOSED WORKSFORME QA Contact: Desktop QE <desktop-qa-list>
Severity: low Docs Contact:
Priority: medium    
Version: 6.3CC: acathrow, cfergeau, dblechte, jjongsma, marcandre.lureau, pvine
Target Milestone: beta   
Target Release: 6.4   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-02-19 14:17:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description David Jaša 2012-08-21 11:48:47 UTC
Description of problem:
sysrq magic key combos are not passed to the guest

Version-Release number of selected component (if applicable):
virt-viewer-0.5.2-9.el6.x86_64
spice-gtk-0.11-11.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1. open a terminal in a client and in a guest
2. in both terminals, run: tail -fn0 /var/log/messages
3. focus virt-viewer client window (both keyboard & mouse)
4. issue alt+sysrq+s (emergency sync) combo
  
Actual results:
only the client gets the combo:
# tail -fn0 /var/log/messages
Aug 21 13:10:44 dhcp-29-7 kernel: SysRq : Emergency Sync
Aug 21 13:10:44 dhcp-29-7 kernel: Emergency Sync complete

Expected results:
only the guest gets the combo (because the user doesn't want to send say alt+sysrq+c to both...)

Additional info:

Comment 1 David Jaša 2012-08-21 13:54:48 UTC
Few clarifications:

* in remote-viewer and spicy, the only way to pass a combo to the guest is to add shift key to is, like alt+shift+sysrq+s. Even then, the combo is passed to both client and guest

* old spice-client can issue the combos using its now-deprecated sticky alt feature

Comment 2 Christophe Fergeau 2012-08-29 16:21:37 UTC
I don't think we can intercept sysrq combinations, so we'd need a send-key menu, or sticky keys to implement this...

Comment 3 Marc-Andre Lureau 2012-11-18 16:55:34 UTC
(In reply to comment #1)
> Few clarifications:
> 
> * in remote-viewer and spicy, the only way to pass a combo to the guest is
> to add shift key to is, like alt+shift+sysrq+s. Even then, the combo is
> passed to both client and guest


lowering severity since it is not critical for the normal usage, no crash/leak etc either. Furthermore you found a solution to the issue.

Comment 4 RHEL Program Management 2012-12-14 07:23:51 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 6 Jonathon Jongsma 2013-09-09 16:40:42 UTC
We could add a menu item to the "Send key" menu, but that's only really feasible if we want to support a small number of these magic sysrq combinations.  if we had to add an item for each possible magic sysrq combination, that menu would get rather huge. Which combinations do we want to support?

On the other hand, the workaround mentioned above (including Shift) doesn't appear to work here (with a Fedora 19 host)

Comment 7 Christophe Fergeau 2013-09-10 07:19:09 UTC
Iirc virtualbox handles that by having scroll lock (iirc)  act as alt when pressed in a key combination.
spicec used to handle that using a sticky alt (hold alt for 5 seconds, release it, and then press the rest of the key combination).

Comment 8 RHEL Program Management 2013-10-14 04:50:31 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 9 Marc-Andre Lureau 2014-02-18 20:01:10 UTC
Otoh, if you disable sysrq on client side, it is working. Thus I would consider this as notabug, as this is certainly not a good idea to try a sysrq on both client and guest at the same time. Somebody disagree with that?

Comment 10 David Jaša 2014-02-19 14:11:58 UTC
(In reply to Marc-Andre Lureau from comment #9)
> Otoh, if you disable sysrq on client side, it is working. Thus I would
> consider this as notabug, as this is certainly not a good idea to try a
> sysrq on both client and guest at the same time. Somebody disagree with that?

Sure.

Would it make sense to have keyboard shortcuts for sysrq key combos similar to ctrl-alt-end for ctrl-alt-del - so that user can press e.g. alt+pause/break+<key>? If so, we could transform the bug so such a RFE.

Comment 11 Marc-Andre Lureau 2014-02-19 14:15:29 UTC
imho, someone doing sysrq with a guest should know that it is intercepted by client first. I don't see the need for extra shortcuts for something that is very much only for hackers (I even never use sysrq myself!).

Comment 12 Marc-Andre Lureau 2014-02-19 14:17:36 UTC
closing as worksforme, feel free to reopen if you have valid reasons..

Comment 13 Christophe Fergeau 2014-02-20 12:13:06 UTC
(In reply to Marc-Andre Lureau from comment #9)
> Otoh, if you disable sysrq on client side, it is working.

Fwiw, no idea how you disable sysrq on client side, this would probably deserve some documentation, or a kb article...

Comment 14 Christophe Fergeau 2014-02-20 12:14:28 UTC
(In reply to David Jaša from comment #10)
> Would it make sense to have keyboard shortcuts for sysrq key combos similar
> to ctrl-alt-end for ctrl-alt-del - so that user can press e.g.
> alt+pause/break+<key>? If so, we could transform the bug so such a RFE.

Imo it would be nice to have.

Comment 15 Marc-Andre Lureau 2014-02-20 12:23:29 UTC
I just google:

http://en.wikipedia.org/wiki/Magic_SysRq_key

There are also alternate way to do sysrq,

I disagree having keymaps/translation by default, we should have 1-1 whenever possible. In this case, the combination works when the client side is configured to permit it.

Comment 16 Christophe Fergeau 2014-02-28 12:58:30 UTC
(In reply to Marc-Andre Lureau from comment #15)
> I just google:
> 
> http://en.wikipedia.org/wiki/Magic_SysRq_key
> 

For anyone reading this bug

https://en.wikipedia.org/wiki/Magic_SysRq_key#Configuration

"The feature is controlled both by a compile-time option in the kernel configuration, CONFIG_MAGIC_SYSRQ, and a sysctl kernel parameter, kernel.sysrq. To be able to use this functionality the CONFIG_MAGIC_SYSRQ option has to be enabled at kernel compile time.

The SysRq key can be disabled with the following command:

echo 0 > /proc/sys/kernel/sysrq

To re-enable:

echo 1 > /proc/sys/kernel/sysrq"

> There are also alternate way to do sysrq,
> 
> I disagree having keymaps/translation by default, we should have 1-1
> whenever possible. In this case, the combination works when the client side
> is configured to permit it.

Except that this cannot be configured by regular users. And if this is our 'official' answer for people asking how to achieve that, this imo should be documented.