No protocol specified Error: Can't open display:

Hi my system is updated on a daily basis.

When I start X and work everything is okay, but after some time I cannot execute X programs through terminal!
I get the following error.

$ **xclock**
No protocol specified
No protocol specified
Error: Can't open display: :0

DISPLAY=:0 or localhost:0 doesn’t work
Setting XAUTHORITY doesn’t work, too.

I also cannot execute from other X opened programs like okular or kate or kwrite though Firefox or Dolphin

It’s like loosing authentication …

Only when I log off everything is fine again!

are you trying to run GUI apps as root in a terminal with sudo?
that won’t work (it’s a security feature) you need to use kdesu or gnomesu or xdg-su -c
in the past you couldn’t run GUI apps as root at all but now I think if you login as root

su -

you might be able to run GUI apps as root (I haven’t tested this as I avoid running GUI’s under root mostly because of the mess they create in /root and the possibility of borking my sistem)

or are you doing a remote login
afaik remote GUI logins are disabled by default (another security feature)

this might happen if your are trying to execute applications as a 2nd non-root user while being logged in with different credentials
if you have a two or more user setup and need to run applications as a user who didn’t start the X session you should add the users who you wish to allow extra privileges to the video group

I run it from terminal with the user I logged in, not root nor from another user nor from ssh

Edit: I’ve edited /etc/X11/xdm/xdm-config and disabled authorization but the problem remains

I’ve never had this issue but I’d still recommend adding that user to the video group

I’ll post the results in a minute …
I reboot the system and wait to happen again …

The problem remains the same.

The error from Dolphin is KDEInit could not launch '/usr/bin/kwrite’

these are general debugging steps regarding TW

do an update in TW

sudo zypper dup

what is your repo list

zypper lr -d

what kind of graphic card and driver do you have

sudo lspci | grep VGA

Repository priorities in effect:                                                                                 (See 'zypper lr -P' for details)
      98 (raised priority)  :  1 repository  
      99 (default priority) :  5 repositories

# | Alias                             | Name                       | Enabled | GPG Check | Refresh | Priority | Type   | URI                                                                                              | Service
--+-----------------------------------+----------------------------+---------+-----------+---------+----------+--------+--------------------------------------------------------------------------------------------------+--------
1 | Tryton                            | Tryton                     | No      | ----      | ----    |   99     | rpm-md | http://download.opensuse.org/repositories/Application:/ERP:/Tryton:/Factory/openSUSE_Tumbleweed/ |        
2 | VideoLan                          | VideoLan                   | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.videolan.org/pub/vlc/SuSE/Tumbleweed                                             |        
3 | download.opensuse.org-non-oss     | Main Repository (NON-OSS)  | Yes     | (r ) Yes  | Yes     |   99     | yast2  | http://download.opensuse.org/tumbleweed/repo/non-oss/                                            |        
4 | download.opensuse.org-oss         | Main Repository (OSS)      | Yes     | (r ) Yes  | Yes     |   99     | yast2  | http://download.opensuse.org/tumbleweed/repo/oss/                                                |        
5 | download.opensuse.org-tumbleweed  | Main Update Repository     | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/tumbleweed/                                                  |        
6 | http-ftp.uni-erlangen.de-2037714e | Packman Repository         | Yes     | (r ) Yes  | Yes     |   98     | rpm-md | http://ftp.uni-erlangen.de/pub/mirrors/packman/suse/openSUSE_Tumbleweed                          |        
7 | openSUSE-20170503-0               | openSUSE-20170503-0        | No      | ----      | ----    |   99     | yast2  | hd:///?device=/dev/disk/by-id/scsi-1PHISON_USB3-part2                                            |        
8 | repo-debug                        | openSUSE-Tumbleweed-Debug  | No      | ----      | ----    |   99     | yast2  | http://download.opensuse.org/debug/tumbleweed/repo/oss/                                          |        
9 | repo-source                       | openSUSE-Tumbleweed-Source | Yes     | (r ) Yes  | Yes     |   99     | yast2  | http://download.opensuse.org/source/tumbleweed/repo/oss/ 
lspci |grep VGA

00:02.0 VGA compatible controller: Intel Corporation HD Graphics 630 (rev 04)

everything looks fine before doing anything else I’d recommend creating a new user account log off your current user and login and try the fresh account
you can create a new account with yast or by doing

sudo useradd temp_user

on a side note you should remove the vlc repo as it can interfere with the packman repo as it has the same version of vlc but an incompatible version of ffmpeg note this is not the cause of your issues just a FYI

you didn’t say if you ran a recent update due to the fact TW is always changing it could be a new bug if you still have those issues with a clean account I’d say you have 2 choices left
#1 wait for it to be fixed and do an update which should be soonish (it is the weekend)
#2 if you’re using btrfs for root do a rollback to an earlier snapshot and don’t do updates until this is fixed

#3 if this is new ie you haven’t done any recent hardware or software changes and this issue persists with a clean account you should open a bug report over at opensuse’s bugzilla
https://bugzilla.opensuse.org/

It’s an old issue, I’ve been waiting for a fix for months, so only the #3 option is to be considered.
I did the test with a new clean user and I had the same results, so I’ll post to bugzilla.

I_A, thanks for your advises, have a nice day.

In .profile I’ve changed XAUTHORITY to .Xauthority and everything is okay now.
Thanks!

I’m experiencing a similar issue. I get a “No protocol specified” message (sometimes repeatedly) when launching X applications from a terminal window. But I don’t get any “Can’t open display” error, and the applications do seem to run fine. The “No protocol specified” messages are annoying, though. They started appearing recently on my Tumbleweed and Leap 15.0 systems.

Can you provide a link to your bug report?

This doesn’t seem to make sense—“XAUTHORITY” is a variable name, so changing it to “.Xauthority” should have caused a new error. Can you tell me exactly what line(s) in your profile you changed, including how they looked before and after the change?

export XAUTHORITY=~/.Xauthority