You are not logged in.

#1 2021-12-23 17:59:20

anthanor2
Member
Registered: 2021-09-24
Posts: 18

[SOLVED] Can't launch GUI applications in xsession

This is happening with multiple commands but here are some examples:

$ sudo gparted

    Authorization required, but no authorization protocol specified

    (gpartedbin:3754): Gtk-WARNING **: 17:52:38.185: cannot open display: :0

$ baobab
    Authorization required, but no authorization protocol specified

    (baobab:3793): Gtk-WARNING **: 17:53:54.993: cannot open display: :0

Even xclip doesn't work:

$ echo "hello arch forums" | xclip -sel clip
    Authorization required, but no authorization protocol specified
    Error: Can't open display: :0

I tried this but it doesn't seem to work

$ export DISPLAY'":0.0"

$ xhost +
Authorization required, but no authorization protocol specified
xhost:  unable to open display ":0.0"

I haven't been able to find a solution online so if anyone has suggestions I'd really appreciate it.

Last edited by anthanor2 (2021-12-23 21:11:09)

Offline

#2 2021-12-23 18:02:56

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: [SOLVED] Can't launch GUI applications in xsession

How do you start X?  Post any xinitrc or other startup file that's used.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2021-12-23 18:32:12

anthanor2
Member
Registered: 2021-09-24
Posts: 18

Re: [SOLVED] Can't launch GUI applications in xsession

Thanks for the quick response.

I forgot to mention that I do have a graphical desktop running bspwm.

This is my xinitrc:

#!/bin/sh

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap

# merge in defaults and keymaps

if [ -f $sysresources ]; then
    xrdb -merge $sysresources
fi

if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi

if [ -f "$userresources" ]; then
    xrdb -merge "$userresources"
fi

if [ -f "$usermodmap" ]; then
    xmodmap "$usermodmap"
fi

if [ -d /etc/X11/xinit/xinitrc.d ] ; then
 for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
  [ -x "$f" ] && . "$f"
 done
 unset f
fi

exec bspwm
sxhkd & > ~/.sxhkd.log 2>&1

In my /etc/X11/xinit/xinitrc.d there are two files.

/etc/X11/xinit/xinitrc.d/40-libcanberra-gtk-module.sh:

#!/bin/sh

case "${DESKTOP_SESSION-}" in
  gnome*) # Done by gnome-settings-daemon
  ;;
  *)
    # Extra check in case DESKTOP_SESSION is not set correctly
    if [ -z "${GNOME_DESKTOP_SESSION_ID-}" ]; then
      GTK_MODULES="${GTK_MODULES:+$GTK_MODULES:}canberra-gtk-module"
      export GTK_MODULES
    fi
  ;;
esac

/etc/X11/xinit/xinitrc.d/50-systemd-user.sh:

systemctl --user import-environment DISPLAY XAUTHORITY
if command -v dbus-update-activation-environment >/dev/null 2>&1; then
    dbus-update-activation-environment DISPLAY XAUTHORITY
fi

Offline

#4 2021-12-23 19:41:10

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: [SOLVED] Can't launch GUI applications in xsession

Are you trying to run these commands from another tty or another machine?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2021-12-23 20:05:30

seth
Member
Registered: 2012-09-03
Posts: 58,859

Re: [SOLVED] Can't launch GUI applications in xsession

Output of

hostnamectl

?

Online

#6 2021-12-23 20:58:13

anthanor2
Member
Registered: 2021-09-24
Posts: 18

Re: [SOLVED] Can't launch GUI applications in xsession

Here's the output of hostnamectl

Static hostname: n/a                             
Transient hostname: thinkpad
Icon name: computer-laptop
Chassis: laptop
Operating System: Arch Linux                      
Kernel: Linux 5.15.10-arch1-1
Architecture: x86-64
Hardware Vendor: Lenovo
Hardware Model: ThinkPad X260

Offline

#7 2021-12-23 20:58:52

seth
Member
Registered: 2012-09-03
Posts: 58,859

Re: [SOLVED] Can't launch GUI applications in xsession

Online

#8 2021-12-23 21:02:49

anthanor2
Member
Registered: 2021-09-24
Posts: 18

Re: [SOLVED] Can't launch GUI applications in xsession

Sorry I didn't make it clear, I I have an X session running in tty1. I was able to initially launch two terminator windows in my ~/.config/bspwm/bspwmrc and am only able to launch firefox after rebooting some of the time. I have a graphical interface (I have a mouse icon and polybar up for example). I just cant open any new windows besides the three I currently have open (two terminals one firefox).

Offline

#9 2021-12-23 21:05:06

seth
Member
Registered: 2012-09-03
Posts: 58,859

Re: [SOLVED] Can't launch GUI applications in xsession

You don't have a static hostname so (likely) networkmanager gets you a transient one and the new hostname isn't in the

xauth list

Set a static hostname, the issue will be gone.

Then review the other parts of the installation guide you might have skipped.

Online

#10 2021-12-23 21:10:51

anthanor2
Member
Registered: 2021-09-24
Posts: 18

Re: [SOLVED] Can't launch GUI applications in xsession

I figured it out just needed to run pacman -Syu! Marking this as solved. Thanks for your help!

Offline

#11 2021-12-23 21:24:30

seth
Member
Registered: 2012-09-03
Posts: 58,859

Re: [SOLVED] Can't launch GUI applications in xsession

No, that didn't solve anything.
Do you actually read replies?

Online

#12 2021-12-23 21:44:18

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,300
Website

Re: [SOLVED] Can't launch GUI applications in xsession

Just for the record:

seth wrote:

You don't have a static hostname so (likely) networkmanager gets you a transient one and the new hostname isn't in the

xauth list

^ This is incorrect. The transient hostname is added to 'xauth list'. I can run gparted (in openbox) just fine with no /etc/hostname (yes, I did reboot after removing the file):

$ hostnamectl hostname --static             

$ hostnamectl hostname --transient
archlinux
$ xauth list
archlinux/unix:  MIT-MAGIC-COOKIE-1  413def54a75683b38dd43a9d96b2c27c
#ffff#617263686c696e7578#:  MIT-MAGIC-COOKIE-1  413def54a75683b38dd43a9d96b2c27c
$ cat /etc/hostname
cat: /etc/hostname: No such file or directory
$

No idea what caused the problem though hmm


Para todos todo, para nosotros nada

Offline

#13 2021-12-23 21:49:01

seth
Member
Registered: 2012-09-03
Posts: 58,859

Re: [SOLVED] Can't launch GUI applications in xsession

Using networkmanager?
It's absolutely possible to add the/any hostname but historically NM hasn't done this and it used to be the cause for losing access to the server and the symptom description of the OP fits that scenario perfectly.

Also, very important: if NM (or whatever) has and sets the transient hostname *before* X11 starts (check your log) this becomes irrelevant.
The problem isn't that the hostname is transient, it's that it changes against the X11 server.

Online

#14 2021-12-23 21:57:01

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,300
Website

Re: [SOLVED] Can't launch GUI applications in xsession

seth wrote:

Using networkmanager?

No, just iwd:

$ find /etc/systemd -type l -exec test -f {} \; -print | awk -F'/' '{ printf ("%-40s | %s\n", $(NF-0), $(NF-1)) }' | sort -f
btrfs-scrub@-.timer                      | timers.target.wants
ctrl-alt-del.target                      | system
dbus-org.freedesktop.resolve1.service    | system
dbus-org.freedesktop.timesync1.service   | system
default.target                           | system
dirmngr.socket                           | sockets.target.wants
display-manager.service                  | system
fstrim.timer                             | timers.target.wants
gcr-ssh-agent.socket                     | sockets.target.wants
getty@tty1.service                       | getty.target.wants
gpg-agent-browser.socket                 | sockets.target.wants
gpg-agent-extra.socket                   | sockets.target.wants
gpg-agent.socket                         | sockets.target.wants
gpg-agent-ssh.socket                     | sockets.target.wants
iwd.service                              | multi-user.target.wants
nftables.service                         | multi-user.target.wants
p11-kit-server.socket                    | sockets.target.wants
pipewire-pulse.socket                    | sockets.target.wants
pipewire-session-manager.service         | user
pipewire.socket                          | sockets.target.wants
systemd-resolved.service                 | multi-user.target.wants
systemd-timesyncd.service                | sysinit.target.wants
wireplumber.service                      | pipewire.service.wants
xdg-user-dirs-update.service             | default.target.wants
$

Para todos todo, para nosotros nada

Offline

#15 2021-12-23 22:02:21

Lilitu-Blackstar
Member
Registered: 2021-12-23
Posts: 51

Re: [SOLVED] Can't launch GUI applications in xsession

Head_on_a_Stick wrote:
seth wrote:

Using networkmanager?

No, just iwd:

OP using gnome -desktop from the looks of logs... so i see why nm needs be relevant to the sitch in context

Offline

#16 2021-12-23 22:03:33

seth
Member
Registered: 2012-09-03
Posts: 58,859

Re: [SOLVED] Can't launch GUI applications in xsession

You only have the transient hostname and "archlinux" is probably even system provided and never changed at all.

https://man.archlinux.org/man/extra/net … IN_SECTION suggests that

hostname-mode

Set the management mode of the hostname. This parameter will affect only the transient hostname. If a valid static hostname is set, NetworkManager will skip the update of the hostname despite the value of this option. An hostname empty or equal to 'localhost', 'localhost6', 'localhost.localdomain' or 'localhost6.localdomain' is considered invalid.
default: NetworkManager will update the hostname with the one provided via DHCP or reverse DNS lookup of the IP address on the connection with the default route or on any connection with the property hostname.only-from-default set to 'false'. Connections are considered in order of increasing value of the hostname.priority property. In case multiple connections have the same priority, connections activated earlier are considered first. If no hostname can be determined in such way, the hostname will be updated to the last one set outside NetworkManager or to 'localhost.localdomain'.

dhcp: this is similar to 'default', with the difference that after trying to get the DHCP hostname, reverse DNS lookup is not done. Note that selecting this option is equivalent to setting the property 'hostname.from-dns-lookup' to 'false' globally for all connections in NetworkManager.conf.

none: NetworkManager will not manage the transient hostname and will never set it.

it still does that.

Online

#17 2021-12-23 22:30:26

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,300
Website

Re: [SOLVED] Can't launch GUI applications in xsession

Tried again with just NM running (disabled both iwd & systemd-resolved) and I can still run gparted without a static hostname set. The transient hostname is still "archlinux" even though the IP addresses haven't changed and the router identifies the machine as "archie".

From the NM logs:

hostname: hostname: using hostnamed

So it looks like it's deferring to systemd.

Anyway this is going nowhere fast now that the OP has checked out so I'll stop making noise now.


Para todos todo, para nosotros nada

Offline

#18 2022-02-16 01:00:41

anthanor2
Member
Registered: 2021-09-24
Posts: 18

Re: [SOLVED] Can't launch GUI applications in xsession

Hi, I Know this is from a while ago, but I wanted to apologize for my ignorance and dismissal. I had a family emergency that drew me away from my personal life for a while which caused me to complete forget about this thread. You all spend your free time helping less informed noobs like me for which I and many many others are very appreciative. I want to say that I am sorry and it wont happen again. Trillby was completely correct and I never set a hostname. I have fixed this and this won't repeat itself. Thanks again for everything you guys do.

Offline

Board footer

Powered by FluxBB