You are not logged in.
Fresh install of Arch/KDE/Wayland (no x11)
Certain graphical apps won't run when invoked from the command line, but work fine when invoked from the KDE menu. The ones that fail all complain about "cannot open display".
My understanding was that XWayland runs automatically to support apps that don't have Wayland baked in, and that indeed appears to be the case when using the KDE menu to start them.
I've really got to be able to start these apps from the CLI, though. For example, "gvim" is one of these apps.
I guess the central question here is: what's different between how KDE starts these apps internally, and how they are started from the command line?
Do I have to invoke XWayland explicitly somehow? Is there something missing in the CLI environment? Any help will be greatly appreciated.
Here's all the gory details when trying to run "gvim":
attempt to run from command line (fails - defaults into text mode)
tsod@puck[~]$ gvim /tmp/foo.txt
E233: Cannot open display
Press ENTER or type command to continue
E852: The child process failed to start the GUI
Press ENTER or type command to continue
inxi -v4
System:
Host: puck Kernel: 6.15.4-arch2-1 arch: x86_64 bits: 64 compiler: gcc
v: 15.1.1
Desktop: KDE Plasma v: 6.4.1 Distro: Arch Linux
Machine:
Type: Desktop Mobo: Intel model: NUC5i5RYB v: H40999-506
serial: <superuser required> UEFI: Intel v: RYBDWi35.86A.0386.2022.0705.1602
date: 07/05/2022
CPU:
Info: dual core model: Intel Core i5-5250U bits: 64 type: MT MCP
arch: Broadwell rev: 4 cache: L1: 128 KiB L2: 512 KiB L3: 3 MiB
Speed (MHz): avg: 500 min/max: 500/2700 cores: 1: 500 2: 500 3: 500 4: 500
bogomips: 12771
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Graphics:
Device-1: Intel HD Graphics 6000 driver: i915 v: kernel arch: Gen-8
bus-ID: 00:02.0
Display: wayland server: X.org v: 1.21.1.18 with: Xwayland v: 24.1.8
compositor: kwin_wayland driver: X: loaded: modesetting dri: iris gpu: i915
resolution: 3840x2160~60Hz
API: OpenGL v: 4.6 compat-v: 4.5 vendor: mesa v: 25.1.4-arch1.1
note: incomplete (EGL sourced) renderer: Mesa Intel HD Graphics 6000 (BDW
GT3), llvmpipe (LLVM 20.1.6 256 bits)
Info: Tools: api: clinfo, eglinfo, glxinfo, vulkaninfo
de: kscreen-console,kscreen-doctor gpu: nvidia-settings,nvidia-smi
wl: wayland-info x11: xdpyinfo,xprop
Network:
Device-1: Intel Ethernet I218-V driver: e1000e v: kernel port: 3060
bus-ID: 00:19.0
IF: enp0s25 state: up speed: 1000 Mbps duplex: full mac: f4:4d:30:61:eb:56
Device-2: Intel Wireless 7265 driver: iwlwifi v: kernel bus-ID: 02:00.0
IF: wlp2s0 state: down mac: 16:25:bb:77:89:ca
Drives:
Local Storage: total: 953.87 GiB used: 13.6 GiB (1.4%)
ID-1: /dev/nvme0n1 vendor: Western Digital model: PC SN810 NVMe WDC 1024GB
size: 953.87 GiB temp: 29.9 C
Partition:
ID-1: / size: 96 GiB used: 13.12 GiB (13.7%) fs: btrfs dev: /dev/nvme0n1p3
ID-2: /boot size: 252 MiB used: 158.6 MiB (62.9%) fs: vfat
dev: /dev/nvme0n1p1
ID-3: /home size: 849.62 GiB used: 327.4 MiB (0.0%) fs: btrfs
dev: /dev/nvme0n1p4
ID-4: swap-1 size: 8 GiB used: 0 KiB (0.0%) fs: swap dev: /dev/nvme0n1p2
Info:
Memory: total: 8 GiB available: 7.64 GiB used: 2.48 GiB (32.4%)
Processes: 268 Uptime: 1d 20h 35m Init: systemd
Packages: 1290 Compilers: clang: 20.1.6 gcc: 15.1.1 Shell: Bash v: 5.2.37
inxi: 3.3.38
/usr/share/applications/gvim.desktop (for KDE "gvim" menu item)
[Desktop Entry]
Name=GVim
# Translators: This is the Generic Application Name used in the Vim desktop file
GenericName=Text Editor
# Translators: This is the comment used in the Vim desktop file
Comment=Edit text files
# The translations should come from the po file. Leave them here for now, they will
# be overwritten by the po file when generating the desktop.file!
TryExec=gvim
Exec=gvim -f %F
Terminal=false
Type=Application
# Translators: Search terms to find this application. Do NOT change the semicolons! The list MUST also end with a semicolon!
Keywords=Text;editor;
# Translators: This is the Icon file name. Do NOT translate
Icon=gvim
Categories=Utility;TextEditor;
StartupNotify=true
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
"sdiff" of environments when running gvim successfully from KDE menu vs. from command line
==========================================================================================
sdiff between envvars:
left <- gvim run successfully from KDE menu
right <- gvim failed from Konsole command line (defaults to text mode)
ANSI_COLOR='38;2;23;147;209' ANSI_COLOR='38;2;23;147;209'
BASH=/bin/bash BASH=/bin/bash
BASHOPTS=checkwinsize:cmdhist:complete_fullquote:extquote:force_fignore:globasciiranges:globskipdots:ho BASHOPTS=checkwinsize:cmdhist:complete_fullquote:extquote:force_fignore:globasciiranges:globskipdots:ho
BASHRC=0 BASHRC=0
BASH_ALIASES=() BASH_ALIASES=()
BASH_ARGC=() BASH_ARGC=()
BASH_ARGV=() BASH_ARGV=()
BASH_CMDS=() BASH_CMDS=()
BASH_EXECUTION_STRING='set > /tmp/gvim_env.txt' | BASH_EXECUTION_STRING='set > /tmp/vim2_env.txt'
BASH_LINENO=() BASH_LINENO=()
BASH_LOADABLES_PATH=/usr/local/lib/bash:/usr/lib/bash:/opt/local/lib/bash:/usr/pkg/lib/bash:/opt/pkg/li BASH_LOADABLES_PATH=/usr/local/lib/bash:/usr/lib/bash:/opt/local/lib/bash:/usr/pkg/lib/bash:/opt/pkg/li
BASH_SOURCE=() BASH_SOURCE=()
BASH_VERSINFO=([0]="5" [1]="2" [2]="37" [3]="1" [4]="release" [5]="x86_64-pc-linux-gnu") BASH_VERSINFO=([0]="5" [1]="2" [2]="37" [3]="1" [4]="release" [5]="x86_64-pc-linux-gnu")
BASH_VERSION='5.2.37(1)-release' BASH_VERSION='5.2.37(1)-release'
BUG_REPORT_URL=https://gitlab.archlinux.org/groups/archlinux/-/issues BUG_REPORT_URL=https://gitlab.archlinux.org/groups/archlinux/-/issues
BUILD_ID=rolling BUILD_ID=rolling
BWL_COMMON_DIR=BWL_Common BWL_COMMON_DIR=BWL_Common
BWL_COMMON_LOCN=/nfs/raid_A1/BWL_Common BWL_COMMON_LOCN=/nfs/raid_A1/BWL_Common
BWL_DEBUG=2 BWL_DEBUG=2
BWL_DIAG_LOG=/dev/shm/tsod/startup.log BWL_DIAG_LOG=/dev/shm/tsod/startup.log
COLORS=16777216 | CDPATH=.:..:/home/tsod
COLUMNS=222 | COLORFGBG='15;0'
> COLORTERM=truecolor
> COLUMNS=210
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/2001/bus DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/2001/bus
DEBUGINFOD_URLS='https://debuginfod.archlinux.org ' DEBUGINFOD_URLS='https://debuginfod.archlinux.org '
DESKTOP_SESSION=plasma DESKTOP_SESSION=plasma
DIRSTACK=() DIRSTACK=()
DISPLAY=:1 <
DMESGF_OPTS= DMESGF_OPTS=
DOCUMENTATION_URL=https://wiki.archlinux.org/ DOCUMENTATION_URL=https://wiki.archlinux.org/
> EDITOR=/bin/vim
ENV= ENV=
EUID=2001 EUID=2001
GLOBIGNORE=.:.. GLOBIGNORE=.:..
> GREP_COLORS='ms=01;31:mc=01;33:sl=:cx=:fn=35:ln=32:bn=32:se=36'
GROUPS=() GROUPS=()
GTK2_RC_FILES=/etc/gtk-2.0/gtkrc:/home/tsod/.gtkrc-2.0:/home/tsod/.config/gtkrc-2.0 GTK2_RC_FILES=/etc/gtk-2.0/gtkrc:/home/tsod/.gtkrc-2.0:/home/tsod/.config/gtkrc-2.0
GTK_RC_FILES=/etc/gtk/gtkrc:/home/tsod/.gtkrc:/home/tsod/.config/gtkrc GTK_RC_FILES=/etc/gtk/gtkrc:/home/tsod/.gtkrc:/home/tsod/.config/gtkrc
> HISTCONTROL=ignoreboth
> HISTFILE=/home/tsod/chaff/bashHistory
> HISTFILESIZE=2000
> HISTIGNORE='h:cls:cdd*([ \.]):,,:ll:dir:wipeh*:su:history -d+([ 0-9-])'
> HISTSIZE=10000
> HISTTIMEFORMAT='%m/%d-%H:%M:%S '
HOME=/home/tsod HOME=/home/tsod
HOME_URL=https://archlinux.org/ HOME_URL=https://archlinux.org/
HOST=puck HOST=puck
HOSTNAME=puck HOSTNAME=puck
HOSTTYPE=x86_64 HOSTTYPE=x86_64
ICEAUTHORITY=/run/user/2001/iceauth_LqYWTv ICEAUTHORITY=/run/user/2001/iceauth_LqYWTv
ID=arch ID=arch
IFS=$' \t\n' IFS=$' \t\n'
> INCLUDE_PATH=
INVOCATION_ID=a242a1530e45441baeca4f22932e0b0c INVOCATION_ID=a242a1530e45441baeca4f22932e0b0c
JOURNAL_STREAM=9:19734 JOURNAL_STREAM=9:19734
KDE_APPLICATIONS_AS_SCOPE=1 KDE_APPLICATIONS_AS_SCOPE=1
KDE_FULL_SESSION=true KDE_FULL_SESSION=true
KDE_SESSION_UID=2001 KDE_SESSION_UID=2001
KDE_SESSION_VERSION=6 KDE_SESSION_VERSION=6
> KONSOLE_DBUS_SERVICE=:1.88
> KONSOLE_DBUS_SESSION=/Sessions/1
> KONSOLE_DBUS_WINDOW=/Windows/1
> KONSOLE_VERSION=250402
LANG=C.UTF-8 LANG=C.UTF-8
> LANGUAGE=
LC_ADDRESS=C.UTF-8 LC_ADDRESS=C.UTF-8
LC_ALL=C.UTF-8 LC_ALL=C.UTF-8
LC_COLLATE=C.UTF-8 LC_COLLATE=C.UTF-8
LC_CTYPE=C.UTF-8 LC_CTYPE=C.UTF-8
LC_IDENTIFICATION=C.UTF-8 LC_IDENTIFICATION=C.UTF-8
LC_MEASUREMENT=C.UTF-8 LC_MEASUREMENT=C.UTF-8
LC_MESSAGES=C.UTF-8 LC_MESSAGES=C.UTF-8
LC_MONETARY=C.UTF-8 LC_MONETARY=C.UTF-8
LC_NAME=C.UTF-8 LC_NAME=C.UTF-8
LC_NUMERIC=C.UTF-8 LC_NUMERIC=C.UTF-8
LC_PAPER=C.UTF-8 LC_PAPER=C.UTF-8
LC_TELEPHONE=C.UTF-8 LC_TELEPHONE=C.UTF-8
LC_TIME=C.UTF-8 LC_TIME=C.UTF-8
LINES=118 | LESS='-SFRXiJ -j3 --use-color -DSkY'
> LINES=103
LOGNAME=tsod LOGNAME=tsod
LOGO=archlinux-logo LOGO=archlinux-logo
> LS_COLORS='rs=0:di=1;38;2;244;190;135:ln=0;38;5;36:mh=7:pi=1;7;38;2;208;187;255:so=4;35;47:do=01;35:bd=
MACHTYPE=x86_64-pc-linux-gnu MACHTYPE=x86_64-pc-linux-gnu
MAIL=/var/spool/mail/tsod MAIL=/var/spool/mail/tsod
MANAGERPID=3537 MANAGERPID=3537
> MANPATH=
MANWIDTH=120 MANWIDTH=120
MEMORY_PRESSURE_WATCH=/sys/fs/cgroup/user.slice/user-2001.slice/user@2001.service/session.slice/plasma- MEMORY_PRESSURE_WATCH=/sys/fs/cgroup/user.slice/user-2001.slice/user@2001.service/session.slice/plasma-
MEMORY_PRESSURE_WRITE=c29tZSAyMDAwMDAgMjAwMDAwMAA= MEMORY_PRESSURE_WRITE=c29tZSAyMDAwMDAgMjAwMDAwMAA=
MOTD_SHOWN=pam MOTD_SHOWN=pam
MYGVIMRC=/home/tsod/.gvimrc <
MYVIMDIR=/home/tsod/.vim/ MYVIMDIR=/home/tsod/.vim/
MYVIMRC=/home/tsod/.vimrc MYVIMRC=/home/tsod/.vimrc
NAME='Arch Linux' NAME='Arch Linux'
NO_AT_BRIDGE=1 NO_AT_BRIDGE=1
OLDPWD=/home/tsod/.uenv | OLDPWD=/usr/share/applications
OPTERR=1 OPTERR=1
OPTIND=1 OPTIND=1
OSTYPE=linux-gnu OSTYPE=linux-gnu
> PAGER=less
PAM_KWALLET5_LOGIN=/run/user/2001/kwallet5.socket PAM_KWALLET5_LOGIN=/run/user/2001/kwallet5.socket
PATH=/home/tsod/bin:/home/tsod/.local/bin:/usr/openwin/bin:/bin:/usr/bin:/usr/sbin:/usr/ucb:/usr/local/ | PATH=/home/tsod/.local/bin:/bin:/usr/bin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/sbin:/usr/bin/site_p
PPID=11405 | PIDFILE=/dev/shm/tsod/pidlist.M4L14v.lst
> PPID=12314
PRETTY_NAME='Arch Linux' PRETTY_NAME='Arch Linux'
PRIVACY_POLICY_URL=https://terms.archlinux.org/docs/privacy-policy/ PRIVACY_POLICY_URL=https://terms.archlinux.org/docs/privacy-policy/
> PROFILEHOME=
> PROMPT_DIRTRIM=6
PS4='+ ' PS4='+ '
PWD=/home/tsod | PWD=/tmp
QT_WAYLAND_RECONNECT=1 QT_WAYLAND_RECONNECT=1
RCSINIT=-zLT RCSINIT=-zLT
ROWS=118 <
SESSION_MANAGER=local/puck:@/tmp/.ICE-unix/5307,unix/puck:/tmp/.ICE-unix/5307 SESSION_MANAGER=local/puck:@/tmp/.ICE-unix/5307,unix/puck:/tmp/.ICE-unix/5307
SHELL=/bin/bash SHELL=/bin/bash
> SHELLCHECK_OPTS=--exclude=SC2154,SC1117
SHELLOPTS=braceexpand:hashall:interactive-comments SHELLOPTS=braceexpand:hashall:interactive-comments
> SHELL_SESSION_ID=8865d3c154d744869ea1bb4a8e061a04
SHLVL=1 SHLVL=1
> STD_BG=rgb:05/1D/18
> STD_CR=rgb:D0/FF/F0
> STD_FG=rgb:F8/FF/F0
SUPPORT_URL=https://bbs.archlinux.org/ SUPPORT_URL=https://bbs.archlinux.org/
SYSTEMD_EXEC_PID=5344 SYSTEMD_EXEC_PID=5344
TERM=dumb | TERM=xterm-256color
> TERM_COLORDEPTH=256
TMPDIR=/dev/shm/tsod TMPDIR=/dev/shm/tsod
UID=2001 UID=2001
USER=tsod USER=tsod
UTIL_COLOR=auto UTIL_COLOR=auto
VIM=/usr/share/vim VIM=/usr/share/vim
VIMRUNTIME=/usr/share/vim/vim91 VIMRUNTIME=/usr/share/vim/vim91
VIM_SERVERNAME=GVIM | VIM_EXTRA=
> VISUAL=/bin/vim
WAYLAND_DISPLAY=wayland-0 WAYLAND_DISPLAY=wayland-0
> WINDOWID=94795997141296
> WINID=tsod@puck
XAUTHORITY=/run/user/2001/xauth_EMYSan XAUTHORITY=/run/user/2001/xauth_EMYSan
XDG_ACTIVATION_TOKEN=kwin-13 <
XDG_CONFIG_DIRS=/home/tsod/.config/kdedefaults:/etc/xdg XDG_CONFIG_DIRS=/home/tsod/.config/kdedefaults:/etc/xdg
XDG_CURRENT_DESKTOP=KDE XDG_CURRENT_DESKTOP=KDE
XDG_DATA_DIRS=/home/tsod/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/s XDG_DATA_DIRS=/home/tsod/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/s
XDG_MENU_PREFIX=plasma- XDG_MENU_PREFIX=plasma-
XDG_RUNTIME_DIR=/run/user/2001 XDG_RUNTIME_DIR=/run/user/2001
XDG_SEAT=seat0 XDG_SEAT=seat0
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0 XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_SESSION_CLASS=user XDG_SESSION_CLASS=user
XDG_SESSION_DESKTOP=KDE XDG_SESSION_DESKTOP=KDE
XDG_SESSION_ID=7 XDG_SESSION_ID=7
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session1 XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session1
XDG_SESSION_TYPE=wayland XDG_SESSION_TYPE=wayland
XDG_VTNR=1 XDG_VTNR=1
==========================================================================================
Last edited by CantConfirmOrDeny (2025-07-03 22:44:54)
Offline
DISPLAY=:1 <
How do you start KDE? Do you maybe unset that variable in your bashrc?
Offline
Bog standard SDDM at startup.
Edit: I'm guessing that DISPLAY=:1 is coming from how KDE invokes XWayland under the covers. I have not been able to find any documentation on the nuts & bolts of how KDE actually invokes menu items when you click on them.
Last edited by CantConfirmOrDeny (2025-07-02 20:23:10)
Offline
The main question is why the environment isn't inherited by your interactive shell.
What and how is that started?
konsole? tmux? or gnu screen? (ie. a terminal multiplexer that starts outside the GUI environment and therefore does not inherit that variable from it)
Offline
Yeah, so if I manually set DISPLAY=:1 , it works. I'm not "unsetting" DISPLAY anywhere, so apparently something somewhere else is.
Thanks, that works for now.
Offline
Adding
printenv
set -x
to your bashrc might shed light on what bash sees before it starts and then what happens.
Also
tr '\0' '\n' < /proc/$(pidof konsole)/environ
will show the environment konsole (assuming that's your terminal emulator of choice) sees outside the shell
Offline