Stock Ubuntu 14.04 Trusty. I seem to regularly experience the $DISPLAY environment variable getting cleared for some reason I don't understand.

Basically everything will work just fine until it's cleared and then a vast variety of my command-line tools will stop working because they rely on a $DISPLAY being defined. For example, I can no longer use xsel -b -i.

This often happens a few hours into a fresh reboot of the machine. Setting $DISPLAY back to :0 works for some applications, others (such as tmux) not so much.

Note that I'm using both tmux, xmonad and gvim so I'm not sure if this makes any difference.

How do I debug this? This has been bugging me for years.

  • The typical issue is starting tmux on boot, from crontab, through ssh, or otherwise with DISPLAY unset. Whenever you attach tmux and/or create a new window, DISPLAY will be unset in that window. Meanwhile, it will still be set in all xterms you have started in the session but not attached tmux in. The next time it happens, check if you're using tmux in that terminal, and whether it still works fine from a non-tmux terminal. – that other guy Nov 8 '14 at 23:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.