LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 04-13-2014, 11:55 AM   #1
rshepard
Member
 
Registered: Oct 2007
Location: Troutdale, Oregon
Distribution: Slackware
Posts: 130

Rep: Reputation: 15
14.1: ~/.Xmodmap Not Implemented When X Starts; Fails During Use


This started a couple of weeks ago and has never before happened in 17 years of running linux and the X Window System.

~/.Xmodmap:
remove Lock = Caps_Lock
remove Control = Control_L
keysym Control_L = Caps_Lock
keysym Caps_Lock = Control_L
add Lock = Caps_Lock
add Control = Control_L
keysym Alt_L = Meta_L Alt_L

In ~/.bashrc are the lines:
if [ -n $DISPLAY ]; then
/usr/bin/xmodmap ~/.Xmodmap
fi

In ~/.xinitrc are these lines:
usermodmap=$HOME/.Xmodmap
/usr/bin/modmap $HOME/.Xmodmap
userresources=$HOME/.Xresources
sysresources=$HOME/.Xresources
sysmodmap=$HOME/.Xmodmap

Despite all this, .Xmodmap key swaps are not happening when I run 'startx' (for xfce4). Worse, now the bindings are lost at random times while I'm working in an X app or virtual terminal.

My Web searches find others with this problem (on Slackware and other distribuitons) but their solutions are not resolving the problem here. Please suggest what might be causing this behavior and how I can fix it.

TIA,

Rich
 
Old 04-13-2014, 12:34 PM   #2
Emerson
Senior Member
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~
Posts: 3,177

Rep: Reputation: Disabled
I'm having this same issue, and the other day my wife complained she cannot do any more. It started with some Xorg upgrade. We probably should file a bug at x.org (if it is not opened yet).
 
Old 04-13-2014, 02:27 PM   #3
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,592
Blog Entries: 2

Rep: Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047
Using ~/.Xmodmap (to swap Esc and Caps/Lock) in Slackware 14.1 works fine here, but loading of that file is done in my xinitrc, not my bashrc (or zshrc, for that matter). My xinitrc (obviously for the i3 WM) looks like that:
Code:
#!/bin/sh

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap

# Merge in defaults and keymaps
[ -f $sysresources ] && /usr/bin/xrdb -merge $sysresources
[ -f $sysmodmap ] && /usr/bin/xmodmap $sysmodmap
[ -f $userresources ] && /usr/bin/xrdb -merge $userresources
[ -f $usermodmap ] && /usr/bin/xmodmap $usermodmap

# Start i3
if [ -z "$DESKTOP_SESSION" -a -x /usr/bin/ck-launch-session ]; then
    exec ck-launch-session dbus-launch --exit-with-session /usr/bin/i3
else
    exec /usr/bin/i3
fi
 
Old 04-13-2014, 02:32 PM   #4
Loomx
LQ Newbie
 
Registered: Sep 2012
Distribution: Slackware
Posts: 27

Rep: Reputation: Disabled
Are you sure you're not switching them twice and ending up back where you started?
I'd take those lines out of your ~/.bashrc and see if that fixes the issue.
 
Old 04-14-2014, 06:25 PM   #5
rshepard
Member
 
Registered: Oct 2007
Location: Troutdale, Oregon
Distribution: Slackware
Posts: 130

Original Poster
Rep: Reputation: 15
I intially had the command for xmodmap only in ~/.xinitrc. I added it to ~/.bash_profile and the if statement in ~/.bashrc because those seemed to have worked for others when I searched the Web.

I can remove (or comment out) the extras and see if the system returns to normal. As I typed this last sentence, the key swapping was lost again. It would be nice to figure out what is causing this behavior since it does not appear on any other host on the LAN nor has it happend before on this or any other system I've had.

Might there be a log file with information on this? It's a frustrating situation and needs to somehow be resolved.

Thanks, all of you,

Rich
 
Old 04-14-2014, 06:36 PM   #6
Emerson
Senior Member
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~
Posts: 3,177

Rep: Reputation: Disabled
I do not think the problem lies in executing xmodmap when X is started. Sometimes X comes up with custom keymap loaded, sometimes not. Sometimes custom mapping is lost during X session. What does the above tell to you? That there is some issue with Xorg.
 
Old 04-14-2014, 08:39 PM   #7
j_v
Member
 
Registered: Oct 2011
Distribution: Slackware64, LFS, Crux
Posts: 194

Rep: Reputation: 26
I would be looking closer at the desktop environment for the source of the problem.
 
Old 04-14-2014, 09:06 PM   #8
Emerson
Senior Member
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~
Posts: 3,177

Rep: Reputation: Disabled
DE runs on top of X, what has it to do with core functions provided by X? I'm running bare Openbox, BTW. OP is running Xfce.
 
Old 04-14-2014, 09:16 PM   #9
j_v
Member
 
Registered: Oct 2011
Distribution: Slackware64, LFS, Crux
Posts: 194

Rep: Reputation: 26
Openbox also does it's own keymappings.

EDIT:
So xmodmap sets the keymap, right? I can see the argument if xmodmap is messed up somehow. That's not what I'm hearing. It's that something after the xmodmap is messing up the keymappings, or maybe I misunderstood. There COULD be a problem with core X, but I would eliminate the top layer (DE, WM, XAP), then look at extensions like XKb before trying to find this in either the server or the protocol libs. I will try to think of a way to trace this... but it will not be tonight as I am too tired to start researching where I should start (also most of my coding for X has been about xrandr and xinerama). But if no one figures this out before I get time, I will give a shot.

Last edited by j_v; 04-14-2014 at 09:33 PM.
 
Old 04-14-2014, 09:19 PM   #10
Emerson
Senior Member
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~
Posts: 3,177

Rep: Reputation: Disabled
Theoretically it is possible, both Openbox and Xfce suddenly started reconfiguring X keymaps. But what are the odds?
 
Old 04-14-2014, 09:37 PM   #11
j_v
Member
 
Registered: Oct 2011
Distribution: Slackware64, LFS, Crux
Posts: 194

Rep: Reputation: 26
Good point. Like I said in my ealier EDIT, I will work on a small app that somehow traces what happens per keyboard and mappings, but I won't start until at least tomorrow evening.

EDIT:
One point though, with .Xmodmap files like the op's, each time xmodmap is run with that .Xmodmap file as arg, most of those settings just get reversed. At least the Caps_lock and Control_L part just reverses it self on each invocation. I guess the thing to do is to setup a system wide alias or wrapper for the xmodmap executable that logs as much information as relavent when called. A script wrapper would be enough... rename /usr/bin/xmodmap to /usr/bin/xmodmap.bak, put the wrapper in it's place. Would be easier than writing the C code like I was thinking about.

Last edited by j_v; 04-14-2014 at 09:56 PM.
 
Old 04-15-2014, 06:51 PM   #12
j_v
Member
 
Registered: Oct 2011
Distribution: Slackware64, LFS, Crux
Posts: 194

Rep: Reputation: 26
Well, interesting find. If running xdm, it runs the users ~/.Xmodmap as part of it's session startup. So if you have a line in ~/.xsession or ~/.xinitrc that runs xmodmap, then xmodmap will be run twice. I will have to investigate other greeters. The pertinent xdm startup file is /etc/X11/xdm/Xsession.

Last edited by j_v; 04-15-2014 at 06:52 PM.
 
Old 04-22-2014, 07:49 PM   #13
rshepard
Member
 
Registered: Oct 2007
Location: Troutdale, Oregon
Distribution: Slackware
Posts: 130

Original Poster
Rep: Reputation: 15
I'm still having this problem. Let me try to clarify the situation here.

-- I don't use a GUI login; I log into a console then run 'startx' which is an alias for start xfce4.
-- The command 'xmodmap ~/.Xmodmap' has been in ~/.xinitrc with both Red Hat (4.0-7.0) and Slackware (8.0-14.1).
-- It has always worked as intended until a few weeks ago.
-- This is the only host (of 3 hosts on the LAN) with this issue; all run xfce4 and Slackware-14.1.
-- The only difference among the 3 hosts is that this one runs the 32-bit version for historical and practical reasons (e.g., I don't need 64-bit capabilities on this host).
-- While xmodmap apparently does not read and invoke the key mapping changes when X is started via ~/.xinitrc, manually running it in a virtual terminal always works.
-- For a while last week, the key mapping would be lost one or more times during the day. That no longer happens. As soon as the X Window System starts I manually run xmodmap and the mapping is stable through the time I kill X and log off.

Do these details provide any clue about what might have broken when I startx?

Thanks,

Rich
 
Old 04-22-2014, 08:32 PM   #14
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,592
Blog Entries: 2

Rep: Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047
According to your first post you are using the xmodmap command in your ~/.xinitrc and your ~/.bashrc. Is this still the case?
 
Old 04-22-2014, 09:48 PM   #15
j_v
Member
 
Registered: Oct 2011
Distribution: Slackware64, LFS, Crux
Posts: 194

Rep: Reputation: 26
I unpacked all xfce related packages into a temporary directory. Then I ran
Code:
cd xfce-tmp
find . -type f -exec grep -nH "xmodmap" {} \;
here's the results:
Quote:
./xfce4-settings-4.10.1-x86_64-1/usr/doc/xfce4-settings-4.10.1/NEWS:147:- Process xmodmap file at startup and on layout change (bug #5094).
./xfwm4-4.10.1-x86_64-2/etc/X11/xinit/xinitrc.xfce:20: /usr/bin/xmodmap $sysmodmap
./xfwm4-4.10.1-x86_64-2/etc/X11/xinit/xinitrc.xfce:28: /usr/bin/xmodmap $usermodmap
./xfce4-session-4.10.1-x86_64-3/etc/xdg/xfce4/xinitrc:82:test -r $HOME/.Xmodmap && xmodmap $HOME/.Xmodmap
Clearly, there is a good chance that xmodmap could be, and probably is, called twice.

I understand your frustration. I set up a ~/.Xmodmap file. It get's loaded twice if I add a line in .xinitrc that runs xmodmap to load it. This happens both from text terminal login + startx, as well as my usual xdm login. I don't use a desktop environment, so the first call to xmodmap is somewhere in the system X startup scripts. When I remove/comment the xmodmap line in my ~/.xinitrc, then xmodmap only get's called once.

I've checked the slackware64-14.1 and slackware-14.1 directories at ftp://ftp.slackware.com/pub/slackware. The only changes this year to any X related packages are cairo in February and libXfont in January. I can't see how this could have started two weeks ago. So it worked before? What changed? Curse me for saying it, but the change is most likely on your end. I'm trying to help, but frankly, it sounds to me like a problem with xmodmap being called multiple times, each call reversing the affects of the last; given your .Xmodmap contents, that is exactly what would happen.

My suggestion is to comment out all lines in your .xinitrc/.xsession/.bashrc that run xmodmap (anything that runs xmodmap that is in your $HOME dir).
Leave your ~/.Xmodmap file intact. Then see where you stand as far as key mapping after starting X.

Just a suggestion.

Over and out.

EDIT:
I apologize for my tone in this post. I generally try to keep my bad moods to myself. You've don't deserve it. My bad day elsewhere shouldn't have shown through at you or here at all.

Last edited by j_v; 04-23-2014 at 04:18 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Keyboard randomly fails when X starts reg.doug Linux - Hardware 3 08-13-2009 12:07 PM
Kmix fails to starts on Aspire 3680 lhuser Linux - Laptop and Netbook 10 10-31-2007 12:28 AM
Network fails when X starts Vie Linux - Wireless Networking 0 07-13-2005 12:24 PM
ALSA fails after XOrg+KDE starts ERTW Linux - Hardware 1 08-10-2004 08:37 AM
Mandrake 9.1 -> rpmDrake starts, but fails - Please help me! Eagle3386 Mandriva 9 10-28-2003 01:19 PM


All times are GMT -5. The time now is 08:58 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration