Setting DISPLAY variable will avoid the typical problem "No protocol specified Error: Can't open display: :#" where # is usually 0.
If this variable is set incorrectly your session will have no access to run X applications in the visible display. Perhaps the fastest way to find out if your DISPLAY is correctly set is to run the xclock application. The commands below should be self explanatory about how it fails and how it should be corrected at least in Debian/Ubuntu:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check current DISPLAY value | |
$ echo $DISPLAY | |
:0 | |
# If xclock fails as below the variable is incorrect | |
$ xclock | |
No protocol specified | |
No protocol specified | |
Error: Can't open display: :0 | |
# Find the correct value for the current user session | |
$ xauth list|grep `uname -n` | |
uselenium/unix:10 MIT-MAGIC-COOKIE-1 48531d0fefcd0a9bde13c4b2f5790a72 | |
# Export with correct value | |
$ export DISPLAY=:10 | |
# Now xclock runs | |
$ xclock |
No comments:
Post a Comment