4

I created an user from console in my Ubuntu Destkop 14.04 LTS, doing this:

sudo addgroup hadoop
sudo adduser --ingroup hadoop hduser

I used that user for doing all sort of stuff, because i'm using it for doing some programming stuff that is related to hadoop, so i know that it works fine, always using it from console and executing stuff without a GUI. And i want to open, with this user, an Eclipse (Luna), so, i do this:

su hduser
cd /opt/eclipse
./eclipse

But it throws me an error:

!MESSAGE Application error
!STACK 1
org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]
    at org.eclipse.swt.SWT.error(SWT.java:4467)
    at org.eclipse.swt.widgets.Display.createDisplay(Display.java:934)
    at org.eclipse.swt.widgets.Display.create(Display.java:918)
    at org.eclipse.swt.graphics.Device.<init>(Device.java:157)
    at org.eclipse.swt.widgets.Display.<init>(Display.java:514)        
    at org.eclipse.swt.widgets.Display.<init>(Display.java:505)
    at org.eclipse.ui.internal.Workbench.createDisplay(Workbench.java:732)
    at org.eclipse.ui.PlatformUI.createDisplay(PlatformUI.java:162)
    at org.eclipse.ui.internal.ide.application.IDEApplication.createDisplay$
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEAppl$
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHand$
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runAppl$
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(E$
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.j$
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.j$
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl$
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce$
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1438)

But, if i open eclipse from console using my "main user" (the same that i used for loging into my ubuntu destkop), the eclipse opens perfectly fine.

That's why i suspect that the difference existing between both users doesn't let me do this, and i suspect that the problem is that hduser doesn't have the proper configurations for being used in a graphical environment. I'm righ? Can be hduser modified in a way that let me open eclipse?

chomp
  • 143

2 Answers2

3

Try executing this command:

export DISPLAY=:0

It makes sure it knows which X display to use before executing Eclipse.

If that doesn't work, this user may also need to have configuration files for a window manager. So just do the GUI route for adding a new user (I believe it's under Preferences → Users and Groups) so all the default configs are loaded.

Lii
  • 215
  • 2
  • 13
1

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

slm
  • 10,859