I had the same problem when starting gvim and I got an error message as above.
My default DISPLAY setting: 0.0
However, I noticed in the output of my startxwin that he said
"" Rules = "base" Model = "pc105" Layout = "us" Variant = "none" Options = "none" winMultiWindowXMsgProc - DISPLAY =: 2.0 winInitMultiWindowWM - DISPLAY =: 2.0 winProcEstablishConnection - winInitClipboard is returned. ""
I set my display to: 2.0, and now it works. those. export DISPLAY =: 2.0
Hope this helps.
[In addition, the script seems to check /tmp/.X11-unix/Xn, where n in Xn is a number. It seems I already had X0 and X1, probably left from the old bad closure. Removing this seems to bring it back to use: 0.0]
source share