If i try to run any graphical application the following error is reported:
Invalid MIT-MAGIC-COOKIE-1 keyWarning: This program is an suid-root program or is being run by the root user.
The full text of the error or warning message cannot be safely formatted
in this environment. You may get a more descriptive message by running the
program as a non-root user or by removing the suid bit on the executable.
xterm: Xt error: Can't open display: %s
I run artix from a base install, with a minimal desktop environment (lightdm openbbox tint2).
It seems that doas can't read the $DISPLAY variable.
https://wiki.archlinux.org/title/Running_GUI_applications_as_root
By default it doesn't. It's explained in the manual:
thanks for the suggestion.
I solved using the keepenv option int /etc/doas.conf
Just in case you haven't clicked the above link:
I'm curious, what program do you need to run as root? If it's xterm with a root shell, you should just run
$ xterm -e doas su
instead.
Wouldn't just "su" be enough? This reminds of the "sudo su" thing which is pure evil from my young days.
If you have set up doas as
permit :wheel or similar to not have to type in password, it makes a difference. Of course, if that is not the case or not desired, use
$ xterm -e su
I understand all the risks associated to the use of X11 application with sudo.
For this and many other reasons i don't use gnome or kde or any other heavy DE.
But i'm not a programmer and the use of vim or emacs is not an option for me. So, to respond to the reason why i must run graphical apps whit doas or sudo, it is only to edit configuration file with a simple editor like mousepad.
In this specific case i'm testing doas only because i use octopi (before someone can object that aur helpers are dangerous, i use octopi and yay only to speed up aur mangement, i never update the system with these tools). Octopi use doas as default privilege elevation utility with sudo as fallback, so i was testing doas trying to solve some probems i have with octopi opening conf files from GUI.
Have you tried using nano? It is more similar to text editors for DOS or Windows, while being TUI.
Its older sibling, joe, is (was?) available from AUR (https://aur.archlinux.org/joe.git) or from https://joe-editor.sourceforge.io/.