org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed] while running eclipse on ubuntu
Solution 1
I think this is a problem with gtk. Check what version is installed.
dpkg -l libgtk[0-9]* | grep ^i
If it's not installed or is the incorrect version then do a sudo apt-get install gtk
or do an sudo apt-get update
.
EDIT
The problem was that SSH was using SSH to remote into a Linux VM and didn't have an X-Server set up on Windows and didn't have X11 forwarding enabled. After getting that straightened out the OP shouldn't have any issues running Eclipse.
Solution 2
This is also the error you get if you try to start Eclipse over ssh without forwarding X access. Ie, you forgot to run ssh -X user@host
or forgot to include ForwardX11 yes
in your ~/.ssh/config
entry for the server.
I'm adding this answer for anyone who may stumble upon this question from a Google search even though technically, OP is asking about a VM case.
Solution 3
In addition, this may also be caused by the application not having the correct authorization to display to the remote X server
. This typically happens when you log into the ssh session as one user and execute a command as another user to lauch a GUI application. For example when you log into the remote server and execute a sudo
command. To resolve this issue, you will need to obtain the magic cookie of the user logging in and import the cookie for the user running the command.
As the user logging into the server which has authority to display to X
, run:
xauth extract cookie_file $DISPLAY
Then as the user trying to run the gui:
xauth
merge cookie_file
Once the cookie is imported into the user's .Xauthority
file, you should be able to execute the GUI.
Solution 4
I ran into a similar problem while installing IBM Installation Manager (IBMIM) on CentOS 6.x and worked around the issue by installing several packages which were the cause of this identical error:
$ sudo /opt/IBM/InstallationManager/eclipse/IBMIM \
-record /root/was8nd_v85_install.xml \
-skipInstall /tmp/was8nd
00:00.46 ERROR [main] org.eclipse.equinox.log.internal.ExtendedLogReaderServiceFactory safeLogged
Application error
org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]
org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]
at org.eclipse.swt.SWT.error(SWT.java:4387)
at org.eclipse.swt.widgets.Display.createDisplay(Display.java:913)
at org.eclipse.swt.widgets.Display.create(Display.java:899)
at org.eclipse.swt.graphics.Device.<init>(Device.java:156)
...
IBMIM:
An error has occurred. See the log file
/opt/IBM/InstallationManager/eclipse/configuration/1457978953529.log.
Solution part 1 - missing packages
$ sudo yum install \
gtk2 \
libXtst \
gnome-desktop \
xorg-x11-xauth \
dejavu-lgc-sans-fonts
Something similar to this could've been done on Ubuntu as well.
Solution part 2 - xauth
The other issue that'll arise is you're attempting to run the IBMIM installer (Eclipse based) as the root user via sudo. When you do this you'll get the above Application error from the installer:
00:00.46 ERROR [main] org.eclipse.equinox.log.internal.ExtendedLogReaderServiceFactory safeLogged
Application error
org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]
org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]
To work around this you'll need to use xauth add
to add the initial user you logged in as to root's $HOME/.Xauthority
file.
As user1:
$ xauth list
ip-10-10-10-10.us-west-1.compute.internal/unix:10 MIT-MAGIC-COOKIE-1 6902e8c245a01ca50XXXXXXXXXXXXXXXX
Then as root:
$ xauth add ip-10-10-10-10.us-west-1.compute.internal/unix:10 MIT-MAGIC-COOKIE-1 6902e8c245a01ca50XXXXXXXXXXXXXXXX
xauth: creating new authority file /root/.Xauthority
$ xauth list
ip-10-10-10-10.us-west-1.compute.internal/unix:10 MIT-MAGIC-COOKIE-1 6902e8c245a01ca50XXXXXXXXXXXXXXXX
References
Related videos on Youtube
SSH
Updated on September 18, 2022Comments
-
SSH over 1 year
I was trying to open eclipse in my ubuntu VM with the below commmand.. And as soon as I do that, I always get the below exception -
ubuntu@username-dyn-vm1-48493:~$ eclipse Eclipse: An error has occurred. See the log file /home/ubuntu/.eclipse/org.eclipse.platform_3.8_155965261/configuration/1381367113197.log.
so when I went to that particular log file, this is what I can see in the log -
ubuntu@username-dyn-vm1-48493:~$ more /home/ubuntu/.eclipse/org.eclipse.platform_3.8_155965261/configuration/1381367113197.log !SESSION 2013-10-10 01:05:13.088 ----------------------------------------------- eclipse.buildId=debbuild java.version=1.7.0_25 java.vendor=Oracle Corporation BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US Command-line arguments: -os linux -ws gtk -arch x86_64 !ENTRY org.eclipse.osgi 4 0 2013-10-10 01:05:17.555 !MESSAGE Application error !STACK 1 org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed] at org.eclipse.swt.SWT.error(SWT.java:4387) at org.eclipse.swt.widgets.Display.createDisplay(Display.java:914) at org.eclipse.swt.widgets.Display.create(Display.java:900) at org.eclipse.swt.graphics.Device.<init>(Device.java:156) at org.eclipse.swt.widgets.Display.<init>(Display.java:498) at org.eclipse.swt.widgets.Display.<init>(Display.java:489) at org.eclipse.ui.internal.Workbench.createDisplay(Workbench.java:716) at org.eclipse.ui.PlatformUI.createDisplay(PlatformUI.java:161) at org.eclipse.ui.internal.ide.application.IDEApplication.createDisplay(IDEApplication.java:154) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:96) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584) at org.eclipse.equinox.launcher.Main.run(Main.java:1438) at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
Does anyone know what wrong has happened? Or what I am supposed to do to fix this issue? Thanks..
Update:-
Version details below -
ubuntu@username-dyn-vm1-48493:~$ dpkg -l libgtk[0-9]* | grep ^i ii libgtk2.0-0:amd64 2.24.17-0ubuntu2 amd64 GTK+ graphical user interface library ii libgtk2.0-bin 2.24.17-0ubuntu2 amd64 programs for the GTK+ graphical user interface library ii libgtk2.0-common 2.24.17-0ubuntu2 all common files for the GTK+ graphical user interface library
-
matchew over 4 yearsweirdly enough I had a similiar problem trying to run dbeaver. I had to exit tmux first for it to work properly. Odd
-
taari almost 3 yearsNote: I got this issue with pentaho.I wasn't sshed into another machine but was switching user by
sudo su username
. Instead when i didssh -X username@localhost
, things worked
-
-
SSH over 10 yearsI updated my question with the actual version information.. Let me know if still I need to do update?
-
Jeight over 10 yearsWell there is a version 3.8 for gtk out there so it couldn't hurt to update to the latest version.
-
SSH over 10 yearsI see.. But when I updated it this is what I got -
sudo apt-get install gtk Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package gtk
. It's not able to locate the package gtk somehow.. Any idea? -
Jeight over 10 yearsWhat do you get when you do a
sudo apt-cache search gtk
? -
SSH over 10 yearsIt did lot of things.. And whole bunch of things got printed out on my screen.. Not sure what you might be interested in?
-
Jeight over 10 yearsI don't have access to an Ubuntu machine atm but google tells me that you should do
sudo aptitude install gnome-core-devel build-essential
-
SSH over 10 years
-
Staszek over 6 yearsThere is also possible, that host just doe not have display at all. In this case you can install Xvfb, and create virtual frame buffer with commands:
Xvfb :1 -ac -screen 0 1024x768x8 &
export DISPLAY=:1
source -
Kody over 4 years@isakbob Thank you, this solved my issue. Couldn't find the answer anywhere else. Might want to post it as an answer.
-
isakbob over 4 years@Matthew I don't think my comment warrants another answer. I just edited this answer to include my comment.
-
Kody over 4 years@isakbob doesnt look like it's there anymore
-
isakbob over 4 years@Matthew ¯\_(ツ)_/¯ guess it's assumed to be common sense then.
-
Juan Calero about 3 years@Staszek: Thanks, thanks, thanks!