Bitcoin Forum

Other => Beginners & Help => Topic started by: devz3ro on May 10, 2013, 05:08:20 PM



Title: Xubuntu Headless Miner *unable to open display* SOLVED
Post by: devz3ro on May 10, 2013, 05:08:20 PM
Are you stuck with the dreaded
Code:
xhost:  unable to open display ":0"
when trying to run cgminer / bfgminer on a headless machine?

After banging my head against the wall for a few hours I figured this out and decided to try and pass the knowledge onto anyone else that may be having a difficult time.

My goal was to have a completely headless setup which means:
Start the pc with no monitor, keyboard, or mouse plugged in whatsoever and be able to mine.

I followed both Xubuntu guides to get bfgminer and the ati drivers installed & enabled (more from the 12.10 one because that had the bfgminer instructions):

"Installed - Xubuntu 13.04, Raring Ringtail"

1. https://docs.google.com/document/d/1Gw7YPYgMgNNU42skibULbJJUx_suP_CpjSEdSi8_z9U/preview?sle=true
2. https://docs.google.com/document/d/1a1T3j5Vr5mAmet47VnVfZ2ba4XVQkwLrYarl6PpUs_E/edit

The instructions assume you aren't headless. The command that makes it all possible is 'xhost +'. The problem is 'xhost +' from a headless machine gives you something similar to the following (even as root):

    miner@rig:~$ export DISPLAY=:0
    miner@rig:~$ xhost +
    xhost:  unable to open display ":0"
    miner@rig:~$ sudo aticonfig --adapter=all --odgt
    ERROR - X needs to be running to perform AMD Overdrive(TM) commands
    miner@rig:~$

    miner@rig:~$ cgminer -n
     [2013-04-18 14:16:18] CL Platform 0 vendor: Advanced Micro Devices, Inc.                    
     [2013-04-18 14:16:18] CL Platform 0 name: AMD Accelerated Parallel Processing                    
     [2013-04-18 14:16:18] CL Platform 0 version: OpenCL 1.2 AMD-APP (1016.4)                    
     [2013-04-18 14:16:18] Error -1: Getting Device IDs (num)                    
     [2013-04-18 14:16:18] clDevicesNum returned error, no GPUs usable                    
     [2013-04-18 14:16:18] 0 GPU devices max detected

But if you run
Code:
netstat -l
you can clearly see that X is running.

What you will need to do is:

1. Install x11vnc
Code:
sudo apt-get install x11vnc

2. Create a password to connect
Code:
sudo x11vnc -storepasswd /etc/x11vnc.pass

3. Start it on ":0" referencing your magic cookie
Code:
sudo /usr/bin/x11vnc -auth /var/run/lightdm/root/:0 -noxrecord -noxfixes -noxdamage -rfbauth /etc/x11vnc.pass -forever -bg -rfbport 5900 -o /tmp/x11vnc.log -display :0

4. Connect to your headless machine via VNC on port 5900 (example using realvnc: 192.168.0.100:5900)

5. Open a terminal via the VNC session and type:
Code:
xhost +

6. Either connect via ssh and try to run your miner or try to start it via the VNC session.


Troubleshooting:

If the x11vnc password is giving your problems you can skip step 2 and run this in step 3 (to connect insecurely with no password)
Code:
sudo /usr/bin/x11vnc -auth /var/run/lightdm/root/:0 -noxrecord -noxfixes -noxdamage -forever -bg -rfbport 5900 -o /tmp/x11vnc.log -display :0

If you are having issues connecting via VNC, you can try the following (although I only used it with tightvncserver):

Edit using vi or pico, etc:

/home/youruser/.vnc/xstartup

Comment out:
Code:
#/etc/X11/Xsession

Add the following to the end of the file:

Code:
unset SESSION_MANAGER
exec startxfce4

Close & save the file, then issue the following command:

Code:
sudo coldreboot

Please donate LTC if this helped :-) @ LTgWjHtzgkLiXSDDBFdh8XwWJw3x6Hv5qu


Title: Re: Xubuntu Headless Miner *unable to open display* SOLVED
Post by: devz3ro on May 11, 2013, 04:14:51 AM
Here is my current mining script for my 7950 Sapphire 4L (I'm pretty sure shaders and thread-concurrency is redundant, but it works so I'm not messing with it):

#!/bin/bash
export GPU_MAX_ALLOC_PERCENT=100
export GPU_USE_SYNC_OBJECTS=1
export DISPLAY=:0
cd ./bfgminer
./bfgminer --scrypt -o stratum+tcp://someminingpool.com:3333 -u worker.1 -p worker --gpu-powertune 20 --gpu-engine 1075 --gpu-memclock 1650 --auto-fan --temp-target 75 --failover-only --shaders 1792 --thread-concurrency 21712 -I 19 --lookup-gap 2 --gpu-vddc 1.012 -g 1 -w 256


Title: Re: Xubuntu Headless Miner *unable to open display* SOLVED
Post by: devz3ro on May 17, 2013, 03:45:18 AM
Anyone getting the error below using the latest cgminer + Xubuntu:

./cgminer: error while loading shared libraries: libudev.so.0: cannot open shared object file: No such file or directory

Try the following:

Code:
$ sudo apt-get install libudev-dev libudev1
$ sudo cd /lib/x86_64-linux-gnu
$ sudo ln -s libudev.so.1 libudev.so.0


Title: Re: Xubuntu Headless Miner *unable to open display* SOLVED
Post by: cooltobe on May 27, 2013, 09:17:09 PM
Anyone getting the error below using the latest cgminer + Xubuntu:

./cgminer: error while loading shared libraries: libudev.so.0: cannot open shared object file: No such file or directory

Try the following:

Code:
$ sudo apt-get install libudev-dev libudev1
$ sudo cd /lib/x86_64-linux-gnu
$ sudo ln -s libudev.so.1 libudev.so.0

Thank you devz3ro


Title: Re: Xubuntu Headless Miner *unable to open display* SOLVED
Post by: devz3ro on June 19, 2013, 08:23:30 AM
Thank you devz3ro

Not a problem, glad I was able to help!