Subject: Doas environment not right?

From: Ian Smith <[email-masked]>
Date: Sat, 23 Aug 2025 12:06:37 +0100

According to the doas(1) manpage:

"The variables DISPLAY and TERM are inherited from the current
environment."

This is incorrect:

$ env|grep -e TERM -e DISPLAY
TERM=xterm-256color
DISPLAY=localhost:10.0

$ doas su -
# env|grep -e TERM -e DISPLAY
TERM=xterm-256color

This prevents me from e.g. running gparted from an XFCE panel launcher.

# gparted

(gpartedbin:15313): Gtk-WARNING **: 12:03:23.389: cannot open display: 

Have I missed something?

BTW I also experimented with the "keepenv" option in doas.conf, whcih
allows gparted to run, but that caused the progress indicator of "apk
add" to turn into a solid block insted of a hash symbol.  Weird!

---

From: "Sertonix" <[email-masked]>
Date: Sat, 23 Aug 2025 11:52:56 +0000

> # env|grep -e TERM -e DISPLAY

The - option of su clears the environment. If you do 'doas env' it will list DISPLAY.

> (gpartedbin:15313): Gtk-WARNING **: 12:03:23.389: cannot open display: 

Maybe 'doas gparted' is what you want?

---

From: Ian Smith <[email-masked]>
Date: Sat, 23 Aug 2025 13:21:36 +0100

Good points, you are correct; the '-' is a hang-over habit from my
"sudo" days.

'doas gparted' is what I am actually doing, I just happened to run it
from a root prompt when I wrote the email!

THX - solved that one, now I just need to resolve the auth issue!

---

From: Unicorn <[email-masked]>
Date: Sat, 23 Aug 2025 14:29:06 +0200 (GMT+02:00)

> $ doas su -
You can use `doas -s` for this purpose, just as a side note :)