[xubuntu only]xfce4-session seems to reset xmodmap

Bug #97175 reported by Oliver Brakmann
12
Affects Status Importance Assigned to Milestone
xfce-mcs-plugins (Ubuntu)
Fix Released
Medium
Unassigned
xfce4-session (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: xfce4-session

After upgrading to Xubuntu feisty, my $HOME/.Xmodmap does not work anymore, ie. it does not take effect.

After some searching I found the place that should read the .Xmodmap in Xubuntu, which is /etc/xdg/xfce4/xinitrc.
Adding some strategically placed debug statements ("xmodmap -pke > /tmp/xmodmap-$stamp") to that script shows that my .Xmodmap actually _is_ read. However, bracketing the call to "$xfcesm" (ie. xfce4-session) in line 84 with above-mentioned debug statements shows that before xfce4-session is called, the xmodmap looks the way I want it to be, but afterwards (ie. after the session ends), it is reset to defaults.
Running xmodmap by hand works as expected.

Conclusion: either xfce4-session directly or something called by xfce4-session resets the xmodmap to defaults.

Steps to reproduce:
- create a ~/.Xmodmap:
----[ cut here ]--------------
keycode 0x71 = Mode_switch
keycode 0x3A = m M mu
----[ cut here ]--------------

Run "xmodmap ~/.Xmodmap" and press AltGr + m... the µ character should appear.
Log out and back in. Press AltGr + m again. Instead of the µ character, a simple m appears.

Revision history for this message
Jani Monoses (jani) wrote :

is this on feisty? if so when did you notice the breakage?

Revision history for this message
Oliver Brakmann (obrakmann) wrote :

Hi Jani,

yes, this is on Feisty. I upgraded on Monday (which went fine except that I hit bug #75681, which took me the rest of the day to fix). I noticed the breakage yesterday, investigated a bit and then reported this bug.

I'll be testing with a newly created user lest some of my configuration screws things up. I'll report back.

Otherwise it's running great. I especially like how I can set mutt as my preferred mail app and have it work seamlessly. Even Thunar's "send to mail recipient" works as expected. Great work!

Revision history for this message
Oliver Brakmann (obrakmann) wrote :

I just created a new user using "useradd -m" and performed the test described above. The result is the same, it does not work, so my configuration is probably not at fault.

Please let me know if you need more information or if there is anything I can do to help fix this. At this point I don't really know what to look at.

My current workaround btw. is to put the xmodmap statement into my .bashrc. Since I always have a shell open anyways, I'm ok with that.

Thanks,
Oliver

Revision history for this message
Jani Monoses (jani) wrote :

to see if the latest xfce4-session update is the cause or not, see if you can downgrade and reproduce? If you do not have an older version in /var/cache/apt/archives maybe the edgy relese form here is good enough
http://archive.ubuntu.com/ubuntu/pool/main/x/xfce4-session/

thanks

Revision history for this message
Oliver Brakmann (obrakmann) wrote :

sorry, that doesn't help. I tried reverting xfwm4 and xfce4-mcs-manager as well, just for kicks, but it doesn't work either.

So, it probably isn't a bug in xfce4-session, but somewhere else.

Revision history for this message
Oliver Brakmann (obrakmann) wrote :

I know a little more now:
I straced xfce4-session from the xinitrc. In the output, there was a suspicious call to xkbcomp. So I removed the executable bit from /usr/bin/xkbcomp, and voilà, my .Xmodmap works. I'll try reverting to a previous version of xkb-data and xkb-utils next.

Revision history for this message
Oliver Brakmann (obrakmann) wrote :

ok, the current version of xkbutils is from August 2006, so it was present in Edgy already. And I can't downgrade xkb-data because of dependencies.

I'm attaching the strace output for other people to look over.

Revision history for this message
Gauvain Pocentek (gpocentek) wrote :

I'll look at this ASAP. My guess is that the keyboard layout tool overrides the xmodmap settings.

Revision history for this message
Ted Anderson (ota-surfvi) wrote :

Thank you Oliver. Removing the x bit from /usr/bin/xkbcomp, resolved this problem for me.

Revision history for this message
Ted Anderson (ota-surfvi) wrote :

There turn out to be some annoying side-effects of disabling xkbcomp. The problems I was were that the alt key didn't work in xterm or when switching virtual terminals using crtl-alt-F1 (see bug #111372).

I have a little more data on how xkbcomp is invoked. By changing /usr/bin/xkbcomp into a shell script I was able to determine that during login it is run 3 times.

1. |-gdm(14821)---gdm(14822)---Xorg(14863)---sh(9127)---xkbcomp(9128)---xkbcomp(9129)---pstree(9131)
    Called with args: -w 1 -R/usr/share/X11/xkb -xkm - -em1 The XKEYBOARD keymap com
piler (xkbcomp) reports: -emp > -eml Errors from xkbcomp are not fatal to the X
 server /var/lib/xkb/server-0.xkm

2. |-gdm(14821)---gdm(14822)-+-Xorg(14863)
        | `-Xsession(9233)---xkbcomp(9251)---xkbcomp(9252)---pstree(9254)
Called with args: /home/ota/.keymap.xkb :0

3. |-gdm(14821)---gdm(14822)-+-Xorg(14863)
        | `-sh(9233)-+-ssh-agent(9293)
        | |-xfce4-session(9338)---xfce-mcs-manage(9341)---xkbcomp(9342)---xkbcomp(9343)---pstree+
        | `-xscreensaver(9304)
Called with args: -I -I/etc/X11/xkb -xkm /tmp/fileCbGof2 /tmp/fileaVT6TK

The second of these is due to my ~/.xprofile invoking xkbcomp "by hand".

Reviewing Oliver's strace output, it seems that xfce-mcs-manager reads the output of xkbcomp (step 3 above) and sends it to the X server.

Revision history for this message
Luzius Thöny (lucius-antonius) wrote :

this is still broken for me on xubuntu gutsy (has been broken since somwhere in the feisty release cycle, i believe).

Revision history for this message
Hannes (hannesl-web) wrote :

Still broken for me on cli-install gutsy + xfce4 with gdm. I have not found a workaround so far. I manually xmodmap after logging in...

Revision history for this message
Jérôme Guelfucci (jerome-guelfucci-deactivatedaccount) wrote :

This is caused by a xubuntu patch which makes possible to add/delete keyboard layouts.

Changed in xfce4-session:
status: New → Invalid
Revision history for this message
Jérôme Guelfucci (jerome-guelfucci-deactivatedaccount) wrote :

Setting th package affected to the right package.

Changed in xfce-mcs-plugins:
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Gauvain Pocentek (gpocentek) wrote :

I've uploaded a small fix which should the problem for users who use the default config (xorg.conf ones).
As workaround is you use a custom conf could be to edit /etc/xdg/xfce4/xinitrc (or copy it to ~/.xinitrc and modify this file) and call xfce-mcs-manager before calling xmodmap.

Revision history for this message
Akkana Peck (akkzilla) wrote :

Gauvain, is your fix only uploaded in gutsy? I'm trying to help someone who's still on feisty, and the problem is still evident there. Editing /etc/xdg/xfce4/xinitrc doesn't help because it doesn't call xfce-mcs-manager, but passes control off to xfce4-session shortly after calling xmodmap (and then something called from xfce4-session overrides the xmodmap settings). I've been fiddling with two or three other places within /etc/X11 where xmodmap is being called, but none of them is late enough in the xfce4 init cycle so they're all overridden. Any hints would be appreciated.

Revision history for this message
Gauvain Pocentek (gpocentek) wrote :

This fix is only uploaded in hardy.

Revision history for this message
Akkana Peck (akkzilla) wrote :

Would you be willing to describe what you changed, or point to a diff?

Revision history for this message
asdfhjkllkjhfdsa (asdfhjkllkjhfdsa-deactivatedaccount) wrote :

Since the above fix was only for Hardy, I'll post the workaround I found for Gutsy. I needed this for the extra keys on my Logitech G11 keyboard.

Background:
As mentioned before, Xfce's xinitrc calls xfce-session, which calls xfce-mcs-manager. And this is the program that is using xkbcomp to override .Xmodmap. The problem is that xfce-mcs-manager is called as pretty much the last step in xfce-session (even after Xfce's autostarted programs list, and the ClientN_Command lines in xfce4-session.rc), and xfce-session does not actually complete until you log out of Xfce (obviously.) So there's no place to ask Xfce to load a custom .Xmodmap without having it overridden, short of modifying the sources to xfce-session and/or xfce-mcs-manager.

Workaround:
Since xfce-mcs-manager is causing the problem, we can replace it with a small shell script that will execute it, and then load the .Xmodmap file upon completion. The following commands will work:

cd /usr/bin
sudo mv xfce-mcs-manager xfce-mcs-manager-bin
sudo mousepad xfce-mcs-manager
sudo chmod 0755 xfce-mcs-manager

After the third line, you'll obviously get a blank mousepad window. Add the following to it and then save the file:

#!/bin/sh
xfce-mcs-manager-bin
test -r $HOME/.Xmodmap && xmodmap $HOME/.Xmodmap

... and follow with the chmod command to mark the new script as executable. Log out and back in, and your custom .Xmodmap should still be active. Verify with xev, if you like.

I understand this may not be the desirable way to fix this problem. But it works, and doesn't break anything (as chmod 0644 xkbcomp does.)

Hope this helps.

Revision history for this message
Ted Anderson (ota-surfvi) wrote :

Thanks for the workaround. It was easy to apply and worked for me.

Revision history for this message
Oliver Brakmann (obrakmann) wrote :

Gauvain, after upgrading to Hardy, I confirm your fix works. Thanks a lot! :-)

Revision history for this message
Oliver Brakmann (obrakmann) wrote :

I hope it's ok now for me to close this bug.

Changed in xfce-mcs-plugins:
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.