LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 06-10-2017, 07:40 PM   #1
RandyTech
Member
 
Registered: Oct 2010
Posts: 62

Rep: Reputation: 3
Disable CTRL ALT Switching of VT Screens


I have "Raspberry Pi 3, model B" using a straight Raspbian (recommended) install and I want to disable all CTRL ALT switching to make vt1 vt2 vt3 vt4 vt5 vt6 inaccessible -- specifically, to force the display to remain in the single GUI environment. Is that possible and if so, how?

Please keep in mind, I'm a newbie to Raspberry. I've searched here, on the Raspberry site and googled it to death. Deleting the getty-static.service file didn't work. Also to no avail I tried editing ACTIVE_CONSOLES="/dev/tty[1-6]". Any solution to this?

Thanks in advance,
Randy
 
Old 06-11-2017, 01:08 PM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,840

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
I would try to remap those key bindings to something else.
 
Old 06-11-2017, 05:10 PM   #3
RandyTech
Member
 
Registered: Oct 2010
Posts: 62

Original Poster
Rep: Reputation: 3
Thanks pan64. Yes and I found one reference pointing me to:

~/.config/openbox/lxde-rc.xml for the Pi 2
which eventually led me to this file for the Pi 3:
~/.config/openbox/lxde-pi-rc.xml

I don't know what I am doing there though. I tried deleting things in there that looked like something I wanted to disable but that didn't pan out too well. I think this is the block that controls the ATL F4:
Code:
    <keybind key="A-F4">
      <action name="Close"/>
    </keybind>
Deleting that "A-F4" block did nothing but strangely deleting the block for "A-C-Delete" was effective. I restored the file and I was going to try as you and others suggested to "remap those key bindings to something else". Not sure what the "something else" would be that I can map to safely. I do feel like I am getting closer, finding lots of stuff about "bindings".
 
Old 06-11-2017, 06:07 PM   #4
RandyTech
Member
 
Registered: Oct 2010
Posts: 62

Original Poster
Rep: Reputation: 3
I found this page on openbox binding:
http://openbox.org/wiki/Help:Bindings

They say bindings are created here:
/etc/xdg/openbox/rc.xml

Further search in the Raspberry Pi 3 I discovered there appears to be 3 files to create bindings:

/etc/xdg/openbox/rc.xml
/etc/xdg/openbox/lxde-pi-rc.xml
~/.config/openbox/lxde-pi-rc.xml

More to sort out. Hopefully a solution in there somewhere
 
Old 06-12-2017, 02:11 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,840

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
There are two ways (at least I think): 1. remove those mappings, so Ctrl-Alt-Fx will do nothing. 2 remap to do something else, like beep or whatever you like.
 
Old 06-12-2017, 04:14 AM   #6
RandyTech
Member
 
Registered: Oct 2010
Posts: 62

Original Poster
Rep: Reputation: 3
Hi, and thanks again pan64. When I removed mapping for any other hotkey combo it was affective. That ALT F4 just does not want to lay down and die though. I removed it from all 3 files so I'm beginning to think its hard coded into the kernel or something. I'll play with it some more, put the block of code back in there and see if I can make it beep. Do you know off hand would the action be "beep" or "0x07"? I guess it won't hurt to try either one.
 
Old 06-12-2017, 04:34 AM   #7
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Have you tried the xmodmap command as per https://askubuntu.com/questions/5023...rtual-terminal ?:

Code:
xmodmap -pke | sed -n 's/ = .*VT_4.*/ = /p' | xmodmap -
 
Old 06-18-2017, 12:33 AM   #8
RandyTech
Member
 
Registered: Oct 2010
Posts: 62

Original Poster
Rep: Reputation: 3
Hello hydrurga and thanks for the post. The xmodmap command seems to work if I execute manually in a terminal window but I can't seem to figure out how to attach it to the kiosk window when I boot into Chrome. I tried putting the xmodmap lines in a cron using @reboot and tried creating a conf script inside /etc/init but no joy there. Also tried putting lines in the /etc/rc.local
 
Old 06-18-2017, 05:29 AM   #9
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
According to this - https://www.raspberrypi.org/forums/v...?f=63&t=169935 - "xmodmap won't run until X windows is running, so you should start it in the autostart list not in /etc/rc.local (which runs too early)."

It suggests placing the command in an autostart directory (/home/pi/.config/lxsession/LXDE-pi/autostart) - I'm sure this won't be the exact directory you use as it refers to the LXDE desktop. Which desktop environment are you using?
 
Old 06-18-2017, 07:44 PM   #10
RandyTech
Member
 
Registered: Oct 2010
Posts: 62

Original Poster
Rep: Reputation: 3
This is crazy. I thought I was using the LXDE desktop because /home/pi/.config/lxsession/LXDE-pi/autostart is where I auto-launch the browser. If not, how can I tell? I got the start of my config using tips from this site:
http://www.pricelessgeek.com/2013/08...web-kiosk.html

Afterwhich my autostart file looks like this and all seems to be working:

@xset s off
@xset -dpms
@xset s noblank
@/usr/bin/chromium-browser --kiosk --disable-restore-session-state http://yoursitehere
@xmodmap -e "pointer = 1 10 9 8 7 6 5 4 3 2"
@pcmanfm --desktop --profile LXDE-pi

Seeing there is already an xmodmap line from the pricelessgeek tip I thought your suggestion looked promising so I tried appending these lines after the browser kiosk call but didn't work so I moved them in front of the browser kiosk call and still did not work:

@xmodmap -pke | sed -n 's/ = .*VT_2.*/ = /p' | xmodmap -
@xmodmap -pke | sed -n 's/ = .*VT_3.*/ = /p' | xmodmap -
@xmodmap -pke | sed -n 's/ = .*VT_4.*/ = /p' | xmodmap -
@xmodmap -pke | sed -n 's/ = .*VT_5.*/ = /p' | xmodmap -
@xmodmap -pke | sed -n 's/ = .*VT_6.*/ = /p' | xmodmap -

Very confusing becasue I also have a line in in my rc.local file to disable the VT1 login and that seems to work fine too so it makes no sense to me that neither location works for those xmodmap lines:

systemctl mask getty@tty1.service

I forget where I found that tip and cannot find the reference again now, but I recall them saying that you cannot disable all vt screens, that you need to leave at least one. Their solution was to apply separate systemctl lines for each vt screen. I didn't like that solution because it still allows switching to all the vt screens -- you just can't do anything because the login prompt is not there. I prefer that the CTRL ALT Fx keys just do nothing at all. I can live with CTRL ALT F1 going to a useless screen if thats how it has to be.
 
Old 06-19-2017, 04:21 AM   #11
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Ah, my apologies, you *are* using LXDE then. I didn't realise that this was a popular Raspi option.

My only further suggestion would be to create your own custom keymap using xmodmap -pke > ~/.Xmodmap, edit it according to your needs, and then use xmodmap ~/.Xmodmap to load that map in the autostart file.
 
Old 06-19-2017, 05:54 AM   #12
RandyTech
Member
 
Registered: Oct 2010
Posts: 62

Original Poster
Rep: Reputation: 3
I used the NOOBS installation manager, first option at the top:
Code:
Raspbian (RECOMMENDED)
A port of Debian jessie for the Raspberry Pi (full desktop version)
It came with a Chrome browser which offers the kiosk mode so that seemed like a good starting point. Very disappointed with their interpretation of kiosk.

I am guessing this "xmodmap -pke > ~/.Xmodmap" would create a third config file (of a sort) in addition to the rc.local and autostart files I am already using? When I add this new "xmodmap ~/.Xmodmap" to my autostart, does it get added into my existing list of commands with the @ prefix?
Code:
@xset s off
@xset -dpms
@xset s noblank
@/usr/bin/chromium-browser --kiosk --disable-restore-session-state http://yoursitehere
@xmodmap -e "pointer = 1 10 9 8 7 6 5 4 3 2"
@pcmanfm --desktop --profile LXDE-p
@xmodmap ~/.Xmodmap
If that looks correct, can you explain why the above would be any different from this?:
Code:
@xset s off
@xset -dpms
@xset s noblank
@/usr/bin/chromium-browser --kiosk --disable-restore-session-state http://yoursitehere
@xmodmap -e "pointer = 1 10 9 8 7 6 5 4 3 2"
@pcmanfm --desktop --profile LXDE-pi
@xmodmap -pke | sed -n 's/ = .*VT_2.*/ = /p' | xmodmap -
@xmodmap -pke | sed -n 's/ = .*VT_3.*/ = /p' | xmodmap -
@xmodmap -pke | sed -n 's/ = .*VT_4.*/ = /p' | xmodmap -
@xmodmap -pke | sed -n 's/ = .*VT_5.*/ = /p' | xmodmap -
@xmodmap -pke | sed -n 's/ = .*VT_6.*/ = /p' | xmodmap -
Reason I ask, the above autostart did not work after the browser loaded up, but those same xmodmap -pke lines did work in a terminal window when I executed the lines manually (without the @ prefix).
 
Old 06-19-2017, 06:20 AM   #13
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
It's the fact that the xmodmap commands don't appear to be running in the autostart file, but that they work when you run them in terminal, that's encouraging me to try to find another way to run the commands (as late in the boot process as possible).

You could even set up a batch file, to be called in autostart in the same way that Chrome is, which carries out the xmodmap commands.

By the way, I don't know exactly how the autostart file works, but personally I would place the call to launch Chrome as the last thing in the file, after any xmodmaps.

Quote:
I am guessing this "xmodmap -pke > ~/.Xmodmap" would create a third config file (of a sort) in addition to the rc.local and autostart files I am already using? When I add this new "xmodmap ~/.Xmodmap" to my autostart, does it get added into my existing list of commands with the @ prefix?
No. Xmodmap allows you to edit the keyboard modifier map and keymap table. It's not a way of carrying out startup commands like e.g. autostart. xmodmap -pke > ~/.Xmodmap creates a xmodmap command file in your profile that gives you more control - you can edit that file as you see fit, and then run xmodmap ~/.Xmodmap at any point to run those xmodmap commands and test if it works as intended. Once you have determined that it works then you can try introducing that latter command into various stages of your startup process to see what works. It's just an alternative approach to the problem. If you're uncomfortable with it then don't worry about using it.
 
Old 06-23-2017, 07:07 AM   #14
RandyTech
Member
 
Registered: Oct 2010
Posts: 62

Original Poster
Rep: Reputation: 3
[SOLVED]
Too many days spent scouring over threads for the answer and finally it turns out the solution has nothing to do with the 'xmodmap' command. Found it here:

https://ubuntuforums.org/showthread.php?t=2146928
Quote:
Originally Posted by zombifier25
NOTE: Be very careful
As root, in the folder /usr/share/X11/xorg.conf.d, create a new file named 50-novtswitch.conf, with its content being:
Code:
Code:
Section "ServerFlags"
Option "DontVTSwitch" "true"
EndSection
Code:

Quote:
Save, reboot.

Of course, like others have said, it may be the only way to recover your system when X fails, so consider yourself before doing.
Thank you zombifier25 (from ubuntuforums)!!
NOTE: The above works on Raspberry PI3 running the LXDE on Devian Jessie ... Very Nicely!!
BTW: zombifier25's warning is moot because you can still ssh into the Raspberry for maintenance.
 
1 members found this post helpful.
Old 06-23-2017, 07:41 AM   #15
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Good find, RandyTech, and thanks for posting your solution!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Alt + Ctrl + F# X screens blank Legolas327 Ubuntu 2 12-27-2009 12:55 AM
Disable Ctrl+Alt+Fn lukeprog Ubuntu 5 12-22-2005 02:30 PM
Switching window focus (like alt+tab in windows) and Ctrl+Alt+F1 X windows problem... DiZASTiX Linux - Software 3 01-20-2005 04:56 PM
Switching To Console With CTRL+ALT+F2 Chryzmo Slackware 4 03-13-2004 08:40 PM
X freezes when changing screens (pressing CTRL+ALT+*1-7) Glover Linux - General 1 06-28-2002 03:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 03:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration