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
gvim so I'm not sure if this makes any difference.
How do I debug this? This has been bugging me for years.