"Run terminal" does not run TERMINAL

Hi,

Looking at the code of /usr/bin/qubes-run-terminal, I notice that it is possible to set default terminal through environment variable TERMINAL. I set that to xterm in .bashrc and it works fine as long as I run qubes-run-terminal directly, e.g. through another terminal window.

However, whenever I try to “Run terminal” from qui-domains, it launches xfce4-terminal, not what is set in TERMINAL.

What is the reason for that and how to make it work as expected?

I think this has been discussed before, see this thread:

1 Like

And… on Fedora-based qubes, you have “alternatives” to fiddle with the defaults. Also covered in the thread linked above.

Thanks for the feedback.
I wonder if this is a bug.

My solution is to simply symlink the terminal binary that I prefer to /usr/bin/gnome-terminal. Is that a clean solution? No, not really, but as long as you don’t use the GNOME templates, you should be fine.

Setting it in .bashrc only applies to shells launched by user user. If you set it in /etc/environment in the template it may work.

2 Likes

Or if you want to set it in an individual AppVM, use ~/.config/environment.d/*.conf or /usr/local/lib/environment.d/*.conf

https://www.freedesktop.org/software/systemd/man/latest/environment.d.html

1 Like

I added in template:

# cat /etc/environment.d/99-terminal.conf 
export TERMINAL=xterm

but it seems to have no effect. TERMINAL does not show in printenv in AppVMs.

Without export

Without export

I tried that first. Then with it. - Same.

Try putting it in the /etc/environment file like

TERMINAL=xterm

Odd. Works for me (after restarting the AppVM)

@rustybird

Odd. Works for me (after restarting the AppVM)

What template? I am testing on debian-13-xfce.

@Atrate

What you suggested works. But why doesn’t /etc/environment/*.conf?

Same.

Maybe try it with a freshly installed, unmodified fedora-43-xfce-4.3.0-202601041226 and a new AppVM?

Double check that it’s /etc/environment.d/*.conf

Double double checked.

This worked:

# cat /etc/profile.d/default-terminal.sh 
export TERMINAL=xterm
user@vm:~ > grep -r TERM /etc/profile.d
/etc/profile.d/96-default-terminal.sh:export TERMINAL=xterm
/etc/profile.d/97-color-xterm.sh:export TERM=xterm-256color

user@vm:~ > printenv | grep -E '^TERM(INAL)?'
TERMINAL=xterm
TERM=xterm

Why does TERM’s value change from ‘xterm-256color’ to just ‘xterm’?

xterm by default does not run a login shell, so bash does not use /etc/profile(.d/) and TERM is set by xterm itself.

1 Like

If you’re wondering why environment variables from /etc/profile(.d/) other than TERM do appear in the xterm shell’s environment: It’s because qrexec uses a non-interactive login shell to run xterm, which overrides TERM and then runs the interactive non-login shell.

Hm. Then I guess the way to have xterm-256color is to set it in .bashrc and forget about 256 colors unless bash is started first?

Setting it in xterm’s termName X resource seems like the right place