x2x sharing problem i karmic

Bug #471726 reported by Claus Lensbøl
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
gdm
Unknown
Medium
gdm (Ubuntu)
Triaged
Low
Unassigned

Bug Description

I've been using x2x under ubuntu 8.10 and 9.04 to share mouse and keyboard between multiple pc's, but it doesn't seem to work in karmic.

i run on master pc:
ssh -X *USER*@*IP-ADDRESS-SLAVE* x2x -west -to :0

I used to get a password promt and after typing pass, it just worked. Now I get a password promt and an error:

No protocol specified
x2x - error: can not open display :0

When I search the error, people are talking about /etc/gdm/gdm.conf but that file is not present (in karmic?).

x2x is really a great tool and I use it allot, so I hope there's a fix :)

Tags: x2x
Revision history for this message
Brian Murray (brian-murray) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. This bug did not have a package associated with it, which is important for ensuring that it gets looked at by the proper developers. You can learn more about finding the right package at https://wiki.ubuntu.com/Bugs/FindRightPackage. I have classified this bug as a bug in x2x.

When reporting bugs in the future please use apport, either via the appropriate application's "Help -> Report a Problem" menu or using 'ubuntu-bug' and the name of the package affected. You can learn more about this functionality at https://wiki.ubuntu.com/ReportingBugs.

affects: ubuntu → x2x (Ubuntu)
Revision history for this message
Claus Lensbøl (cmol) wrote :

Thanks Brian. I don't quite know the bug reporting process yet :)

In this case I really don't know if it's a bug in x2x. The version haven't changed since jaunty, so it could just as well be a bug in gdm, or ufw for what I know?

Revision history for this message
Robert C Jennings (rcj) wrote :

I found a way to make x2x work, I wouldn't call it a solution but it points to what is missing when you get this error. The xauth authority file used when tunneling X through ssh does not have the cookie for the X server.

Setup:
 - 2 machines, called 'desktop' and 'laptop' where x2x is run on the laptop.
 - Run 'ssh -XC laptop x2x -east -to :0.0' from desktop
 - Error seen: 'x2x - error: can not open display :0'

From the desktop:
# ssh -X laptop 'xauth info'
Authority file: /home/user/.Xauthority
File new: no
File locked: no
Number of entries: 2
Changes honored: yes
Changes made: no
Current input: (argv):1

# ssh -X laptop 'xauth list'
laptop/unix:10 MIT-MAGIC-COOKIE-1 84924c4306f8234702fe1cec2c821c8f

From the laptop:
# xauth info
Authority file: /var/run/gdm/auth-for-user-w9KmhU/database
File new: no
File locked: no
Number of entries: 1
Changes honored: yes
Changes made: no
Current input: (argv):1

# xauth list
laptop/unix:0 MIT-MAGIC-COOKIE-1 007d71f327f9cf279ff3c5fb9d21b5a7

At this point the ssh session from the desktop to the laptop has a cookie for display :10 only. So the message regarding a failure to open :0 isn't a big surprise. I resolved this by running the following from the desktop:

# ssh -X laptop 'xauth merge /var/run/gdm/auth-for-user-w9KmhU/database'

After this is run, you can check that the cookie has been added for :0 by running:

# ssh -X laptop 'xauth list'
laptop/unix:0 MIT-MAGIC-COOKIE-1 007d71f327f9cf279ff3c5fb9d21b5a7
laptop/unix:10 MIT-MAGIC-COOKIE-1 84924c4306f8234702fe1cec2c821c8f

From there I can run:

# ssh -X laptop 'x2x -east -to :0.0'

Here's the caveat, the cookie (and the file it's stored in) for :0 changes each time you log in on the remote machine (in this case, 'laptop'). Here's the output on the laptop after logging out and back into X.

# xauth info
Authority file: /var/run/gdm/auth-for-user-u4JpYD/database
File new: no
File locked: no
Number of entries: 1
Changes honored: yes
Changes made: no
Current input: (argv):1

# xauth list
laptop/unix:0 MIT-MAGIC-COOKIE-1 149afc922a496cae086650e10f113bf5

At this point, the command 'ssh -X laptop x2x -east -to :0.0' will again fail. I cleaned up by running 'ssh -X laptop xauth remove laptop/unix:0' so that I only had a cookie entry for :10 at this point.

I don't have a real solution, but I hope this helps improve the understanding of the problem.

Revision history for this message
Robert C Jennings (rcj) wrote :

#!/bin/bash
## This is provided as a example of the steps required to work-around this issue.
## I am worried that it will get less attention with a workaround provided, but
## someone is going to do it, so here it is.

HOST=laptop
USER=user

## Add the cookie for :0 to the xauth file
## NOTE: This assumes that there is only one /var/run/gdm/auth-for-${USER}* directory
ssh -XC ${USER}@${HOST} 'xauth merge /var/run/gdm/auth-for-${USER}*/database'
# ssh -XC ${USER}@${HOST} 'xauth list'

## Run x2x on the remote host
## NOTE: This assumes that the desktop on the remote host is :0.0
ssh -XC ${USER}@${HOST} 'x2x -east -to :0.0'

## Remove the cookie for :0 from the xauth file
## NOTE: This assumes that the desktop on the remote host is :0.0
ssh -XC ${USER}@${HOST} 'xauth remove ${HOST}/unix:0'
# ssh -XC ${USER}@${HOST} 'xauth list'

Revision history for this message
David Boersma (david-boersma) wrote :

@Brian, Claus: at ubuntuforums it was suggested (http://ubuntuforums.org/showthread.php?t=1309289) that this is maybe (indeed) more a gdm issue than an x2x issue.

@Robert: I tried your workaround script and it works, thanks! I needed a little tweak though; our network administrator assigned a different static name to my laptop than I configured when installing Karmic. I need the network name to run ssh, but xauth uses the local install name. So I rewrote the script to:

#!/bin/bash
HOST=laptop-networkname
HOSTlocal=laptop-installname
USER=user

cmd1="xauth merge /var/run/gdm/auth-for-${USER}*/database"
cmd2="xauth list"
cmd3="x2x -west -to :0.0"
cmd4="xauth remove ${HOSTlocal}/unix:0"
ssh -XC ${USER}@${HOST} "$cmd1; $cmd2; $cmd3; $cmd4"
ssh -XC ${USER}@${HOST} "xauth list"

When I interrupt the script with ^C, cmd4 (xauth remove) apparently still gets executed, because the final xauth list shows only one entry, as desired.

Thanks!

Claus Lensbøl (cmol)
affects: x2x (Ubuntu) → gdm (Ubuntu)
Revision history for this message
Sebastien Bacher (seb128) wrote :

not sure I understand the description or care enough about that x2x thing to try to understand it but that doesn't seem a gdm bug

Changed in gdm (Ubuntu):
importance: Undecided → Low
Revision history for this message
Claus Lensbøl (cmol) wrote :

Since the version of x2x haven changed since hardy (and x2x worked in jaunty), it must be a bug in gdm. Or a change at least.

Please tell what you don't understand, and I will try to clear it up to you.

Revision history for this message
Sebastien Bacher (seb128) wrote :

gdm is a login manager, it just let you enter login informations to start your session, it's not a ssh server or anything which should impact on what you do over ssh on that box

Revision history for this message
Claus Lensbøl (cmol) wrote :

Then I don't understand how David Boersma above made it work, with his script by doing changes to gdm?

ssh -XC ${USER}@${HOST} 'xauth merge /var/run/gdm/auth-for-${USER}*/database'

Revision history for this message
Robert C Jennings (rcj) wrote :

GDM is no longer storing the xauth info for the current login in /home/${USER}/.Xauthority, rather it is using /var/run/gdm/auth-for-${USER}*/database

As ssh uses the former for xauth keys, the x2x command run in the ssh environment will not find the existing key for the GDM session.

Revision history for this message
Sebastien Bacher (seb128) wrote :

not sure if that's a bug seems rather a decision from upstream, should be sent to GNOME

Revision history for this message
Claus Lensbøl (cmol) wrote :
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for sending the bug to GNOME

Changed in gdm (Ubuntu):
status: New → Triaged
Changed in gdm:
importance: Unknown → Medium
status: Unknown → New
Revision history for this message
David Boersma (david-boersma) wrote :

FWIW: for me x2x works now the way it should, in Lucid, without having to resort to funny xauth tricks (like I had to with karmic). So on my desktop I just run:

ssh -XC username@laptop 'x2x -west -to :0.0'

and it does what i want it to do.

Revision history for this message
Claus Lensbøl (cmol) wrote :

I just testet et in lucid too. It works like a charm without any weird tricks.
Ran:
ssx -XC user@host x2x -west -to :0

This could be a Karmic only problem?

Changed in gdm:
status: New → Unknown
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.