Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xdotool Segmentation fault when run in VNC #126

Open
dimecoin opened this issue Jul 9, 2016 · 30 comments
Open

xdotool Segmentation fault when run in VNC #126

dimecoin opened this issue Jul 9, 2016 · 30 comments

Comments

@dimecoin
Copy link

dimecoin commented Jul 9, 2016

If i run xdotool on a real display (ie, Display :0 with real videocard/monitor), it works fine. But if I run under VNC display, it gives segfault:

$ export DISPLAY=:0  
$ xdotool getmouselocation
x:35 y:31 screen:0 window:25165825
$ export DISPLAY=:1
$ xdotool getmouselocation
Segmentation fault
$

$ gdb --args xdotool getmouselocation
GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from xdotool...(no debugging symbols found)...done.
(gdb) r
Starting program: /usr/bin/xdotool getmouselocation
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7bd746f in xdo_new_with_opened_display () from /usr/lib/x86_64-linux-gnu/libxdo.so.3
(gdb) f
#0  0x00007ffff7bd746f in xdo_new_with_opened_display () from /usr/lib/x86_64-linux-gnu/libxdo.so.3
(gdb) q
A debugging session is active.

        Inferior 1 [process 27403] will be killed.

Quit anyway? (y or n) n
Not confirmed.
(gdb) n
Single stepping until exit from function xdo_new_with_opened_display,
which has no line number information.

Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.
(gdb) f
No stack.
(gdb) q
$

System info

Debian 8 (Jessie), x86_64
Linux server 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2 (2016-04-08) x86_64 GNU/Linux

Tried using using the following VNC servers (segfault on each) :

vnc4server 4.1.1+X4.3.0-37.6 
tightvncserver 1.3.9-6.5

Using xdotool package:

 xdotool 1:3.20140805.1-2
$ xdotool -v
xdotool version 3.20141006.1

vnc/xdotool all installed though debian's package management system (apt-get)

Let me know if I can provide any more information.

@mgobill
Copy link

mgobill commented Jul 25, 2016

i'm having this same problem on a raspberry pi 2 running raspbian jessie. please let me know if i can provide any other information as well. thanks for all the hard work!

i'm going to try this again on a raspberry pi 3 in a couple of days to see if the same problem occurs!

Edit: can confirm that this problem occurs on raspberry pi 3 as well

@Maltz42
Copy link

Maltz42 commented Aug 12, 2016

Ditto here - raspberry pi 3 / jessie, everything updated to current.

I even downloaded and compiled the source from here to get a newer version. Which weirdly, -version reports as 3.20141017.1 although CHANGELIST includes notes up to version 3.20160805.1

@PhilD41
Copy link

PhilD41 commented Aug 16, 2016

Also having this issue on Mint 18. It worked fine prior to upgrading. Is there a solution or work-around for this other than reverting back to Mint 17.3? It is really becoming problematic for me. Thanks!

@jordansissel
Copy link
Owner

I tried to reproduce this using tigervnc:

# Start my X VNC server
% Xvnc :1

Xvnc TigerVNC 1.6.0 - built Jan  4 2016 15:12:19
Copyright (C) 1999-2015 TigerVNC Team and many others (see README.txt)
See http://www.tigervnc.org for information on TigerVNC.
Underlying X server release 11800000, The X.Org Foundation


Tue Aug 16 22:01:33 2016
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on all interface(s), port 5901
 vncext:      created VNC server for screen 0

# Try to get mouse info from xdotool:
% xdotool getmouselocation
x:512 y:384 screen:0 window:616

It's working for me :\

@Maltz42
Copy link

Maltz42 commented Aug 17, 2016

Try it with tightvnc, that's what I'm having trouble with on a Raspberry Pi, as was dimecoin. I've run across this in other threads around the net, and it seems to usually be that combination, which I imagine is very popular since the Raspberry Pi website VNC instructions walks you through installing tightvnc, and Raspberry Pi is often a good use case for xdotool.

@mgobill
Copy link

mgobill commented Aug 17, 2016

oh wow, thanks for following up jordan! i love xdotool. but i agree with Maltz42, i was also using tightVNC on a fresh install of raspbian jessie and raspbian wheezy (i use raspberry pis a lot!). please let me know how i can help! thanks again!

@PhilD41
Copy link

PhilD41 commented Aug 17, 2016

I can confirm that xdotools works as expected on Linux Mint 18 with tigervncserver installed vs. tightvncserver. I am not sure what tightvnc changed but it is not compatible. I am very pleased to have this functioning again. Thank you @jordansissel !!

@jordansissel
Copy link
Owner

Ok cool thanks for the details about tightvnc maybe being a factor. I will
test this specifically!

On Wednesday, August 17, 2016, mgobill notifications@github.com wrote:

oh wow, thanks for following up jordan! i love xdotool. but i agree with
Maltz42, i was also using tightVNC on a fresh install of raspbian jessie
and raspbian wheezy (i use raspberry pis a lot!). please let me know how i
can help! thanks again!


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#126 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAIC6lF5L1Hp0VNN6ZN-9SoZ-1iagC0Tks5qgxKBgaJpZM4JInL7
.

@jordansissel
Copy link
Owner

I am able to reproduce this with tightvnc:

% Xvnc :1
17/08/16 23:38:27 Xvnc version TightVNC-1.3.9
%  DISPLAY=:1 xdotool getmouselocation
segmentation fault 

@jordansissel
Copy link
Owner

The crash is here:

(gdb) run
Starting program: /home/jls/projects/xdotool/xdotool getmouselocation
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7bd806b in _xdo_populate_charcode_map (xdo=0x61bb60) at xdo.c:1313
1313        groups = XkbKeyNumGroups(desc, keycode);

The failure is because desc is NULL. desc is set by this:

  XkbDescPtr desc = XkbGetMap(xdo->xdpy, XkbAllClientInfoMask, XkbUseCoreKbd);

I'm not sure what to make of this. It seems like tightvnc doesn't support Xkb. I'm not sure what the correct fix for this would be, yet, anyway.

@jordansissel
Copy link
Owner

The bbf0e70 commit switched to using Xkb to better support systems with multiple keyboards (I think?). Maybe the solution to this is that if XkbGetMap fails, we should fall back to the older implementation (before xkb was used). I think this would work for tightvnc, but I haven't tested.

@jordansissel
Copy link
Owner

As a workaround, y'all can use edbbb7a (from December 2013) as a git commit and is successful on tightvnc:

% git checkout edbbb7a8f664ceacbb2cffbe8ee4f5a26b5addc8
% make install
% DISPLAY=:1 xdotool getmouselocation
x:320 y:240 screen:0 window:37

@mgobill
Copy link

mgobill commented Aug 18, 2016

great! thank you so much for looking into and and getting back to us!

@toschneck
Copy link

thanks for this hint! tigervnc works great!

@jeroenmeulenaar
Copy link

Would it be much work to fix/workaround this for vnc4server?

@jordansissel
Copy link
Owner

jordansissel commented Jan 7, 2017 via email

@jeroenmeulenaar
Copy link

I checked out edbbb7a and that version indeed works with vnc4server, so maybe that's already enough workaround for me now :).

I don't think I know enough about the X window system to really code something myself... I'd be happy to test other solutions.

@jtmfam
Copy link

jtmfam commented Jul 25, 2017

Jordan,
Would you mind making a git branch with the fix in it? xdotool-3.20150503.1.tar.gz gives a segmentation fault. Git is telling me that the commit is gone and part of the branch (two years newer.)

git remote add origin https://github.com/jordansissel/xdotool.git
git fetch origin edbbb7a
error: no such remote ref edbbb7a

Thanks In Advance

@jordansissel
Copy link
Owner

@jtmfam According to github, edbbb7a is in the following branches/tags:

branches: master

tags: v3.20160805.1 v3.20160804.2 v3.20160804.1 v3.20150503.1

Looks like your .tar.gz you refer to should have this commit?

@simoncpu
Copy link

I'm also experiencing this with vnc4server and I've confirmed that edbbb7a addressed the problem. Thanks!

@stayprivate
Copy link

FYI. Ubuntu 18.04 tightvnc xdotool crashes. Got git version commit edbbb7a which get rid of the issue, but need to "make xdotool.static"

@stayprivate
Copy link

I spoke too soon. xdotool.static key --clearmodifiers Ctrl+Shift+T does nothing. But if I manually type, it works.

@TappingEther
Copy link

TappingEther commented May 27, 2019

As a workaround, y'all can use edbbb7a (from December 2013) as a git commit and is successful on tightvnc:

% git checkout edbbb7a8f664ceacbb2cffbe8ee4f5a26b5addc8
% make install
% DISPLAY=:1 xdotool getmouselocation
x:320 y:240 screen:0 window:37

@jordansissel When i run "git checkout edbbb7a" i get an error saying : "fatal: not a git repository (or any of the parent directories): .git"

FYI. Ubuntu 18.04 tightvnc xdotool crashes. Got git version commit edbbb7a which get rid of the issue, but need to "make xdotool.static"

@stayprivate Are you not getting segmentation fault (core dumped) anymore?

@wjandrea
Copy link

@TappingEther

When i run "git checkout edbbb7a" i get an error saying : "fatal: not a git repository (or any of the parent directories): .git"

You're in the wrong folder

@valdisvi
Copy link

I solved this with a workaround:

  1. Enabled autologin for user (e.g. for Lubuntu)
  2. Then shared tty7 session with x11vnc.

@gitlopao
Copy link

gitlopao commented Aug 1, 2021

I tried edbbb7a and was even able to compile it after installing more x11 libraries

But now running xdotool won't even run and reports this error

homelx01:~/work_area/github_repos/xdotool$ xdotool
xdotool: symbol lookup error: xdotool: undefined symbol: xdo_close_window

What did I screw up :) ?

Thank you

@philippludwig
Copy link

philippludwig commented Jul 8, 2023

At least on the current raspian edbbb7a does fix this issue, but only if you use xdotool.static, for whatever reason.

@Kvach-Lukich
Copy link

Anyone can explain what needed for last debian 12
libx11-dev
libxtst-dev
libxkbcommon-dev
libxinerama-dev
can't aderstand whot is xi lib?
make static && install static from curent master repo?
Right?

@Kvach-Lukich
Copy link

Kvach-Lukich commented Feb 4, 2024

Ok for debian users
1.apt install libx11-dev libxtst-dev libxkbcommon-dev libxinerama-dev
copy from console additional packages
The following additional packages will be installed: libpthread-stubs0-dev libxau-dev libxcb1-dev libxdmcp-dev libxext-dev libxfixes-dev libxi-dev x11proto-dev xorg-sgml-doctools xtrans-dev Suggested packages: libx11-doc libxcb-doc libxext-doc The following NEW packages will be installed: libpthread-stubs0-dev libx11-dev libxau-dev libxcb1-dev libxdmcp-dev libxext-dev libxfixes-dev libxi-dev libxinerama-dev libxkbcommon-dev libxtst-dev x11proto-dev xorg-sgml-doctools xtrans-dev
2. git clone https://github.com/jordansissel/xdotool.git
cd xdotool
3. git checkout edbbb7a8f664ceacbb2cffbe8ee4f5a26b5addc8
4. make static
5. chmod 777 xdotool.static
for tightvnc export DISPLAY=:1.0
./xdotool.static mousemove 1000 1000 must vorking
6. apt purge libpthread-stubs0-dev libxau-dev libxcb1-dev libxdmcp-dev libxext-dev libxfixes-dev libxi-dev x11proto-dev xorg-sgml-doctools xtrans-dev libpthread-stubs0-dev libx11-dev libxau-dev libxcb1-dev libxdmcp-dev libxext-dev libxfixes-dev libxi-dev libxinerama-dev libxkbcommon-dev libxtst-dev x11proto-dev xorg-sgml-doctools xtrans-dev remove all garbage

@TMSL
Copy link

TMSL commented Sep 8, 2024

FYI: the "xdotool.static" version and steps listed by Kvach-Lukich (thanks!) in post #126 (comment) also appear to work on my Libre Renegade (pi 'clone') running Armbian on an arm64 processor.

As a check, I did a build of the current xdotool (today 8-Sep-2024) and got the Segmentation Fault issue.

I'm running tightvncserver as a service on display :0. Also checked it running on demand using display :1. edbbb7a version works for both.

full uname info: Linux renegade 6.6.39-current-rockchip64 #1 SMP PREEMPT Thu Jul 11 10:49:22 UTC 2024 aarch64 GNU/Linux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests