2 Efficient Fixes for Xterm Display is Not Set

xterm display is not set

“Xterm display is not set” is an error message that advanced Linux users must have encountered at some point. Xterm is a Terminal Emulator that works on top of the operating system’s default terminal emulator. It is used to run command-line programs while still working in the GUI background. Xterm is the default standard terminal system for the X Window System desktop environment. Xterm runs the user shell, i.e., the default shell on the user’s system. The official website for Xterm is https://invisible-island.net/xterm/.

Contents

What is Xterm

Xterm is a terminal emulator aside from the default terminal emulators of the operating system. Xterm runs over the user’s terminal and uses the same shell as the user’s default. Unlike other terminal emulators that can just run without a graphical display output, Xterm requires a GUI to run. Error messages like “Xterm display is not set” can come up in unsuitable environments. It runs on all the UNIX-based operating systems. Just as gnome-terminal is the default terminal emulator of the GNOME desktop environment, Xterm is the default terminal emulator for X Window system environment.

after xterm display not set resolved
Xterm window using bash shell over POP!_os’s gnome-terminal.

Installing Xterm

If you do not have Xterm installed on your system, you could easily install it using the default package manager of your operating system. Or, if you have Xterm installed already and it is showing “Xterm display is not set,” try reinstalling or updating the package as it might help eradicate the error problem. Different distributions of Linux use other package managers to download and install programs. For example, Debian-based distros use dpkg package manager while Arch-based distributions use Pacman.

Installing Xterm on Debian Based OS

Follow the given steps to download and install Xterm on Debian-based systems.

  • Open the default terminal emulator.
  • Type the following command in the shell.
sudo apt install xterm
  • You would be prompted to enter the root password in order to install it.
  • Enter Y(yes) when promted to, wait for the downloading and installation to complete.
Installing Xterm on Debian-based POP!_os.
Installing Xterm on Debian-based POP!_os.

Downloading the source code

If you are on other platforms than Debian, you could download the source code file from the official website of Xterm and then extract it yourself on your system. follow the steps to download the term source code manually.

  • Head to Xterm’s official website. https://invisible-island.net/xterm/
  • Under the download section. choose the protocol you want to use to download the compressed file.
  • Choose http if you are using a browser or ftp is downloading through terminal.
  • Download the tar.gz file and extract it.
Manually downloading Xterm
Manually downloading Xterm

Xterm Display is not set

As mentioned earlier, Xterm requires a GUI display environment to work seamlessly. If the DISPLAY environment variable is not set for the Xterm terminal emulator, it won’t work, and ‘Xterm display is not set’ would be shown as the output. If you are using an SSL connection to a remote server that doesn’t have any display environment installed, you are more likely to face an Xterm display is not set issue.

  • input:
xterm
  • output:
xterm: Xt error: Can't open display:  
xterm: DISPLAY is not set

2 Methods to Fix Xterm Display is Not Set

The following fixes can be tried to resolve the Xterm display is not set issue.

Dispay variable

The “Xterm display is not set issue” can be resolved by setting the DISPLAY environment in the terminal before connecting to the remote host. Run the following commands shown in the image to set your display output variable and then log in to the ssh session with the remote host.

The first command sets the display environment variable, and the second connects to the remote host.
The first command sets the display environment variable, and the second connects to the remote host.

NOTE – The username and remote host are to be replaced with the actual username and remote-host name of the server you are trying to connect, respectively.

Desktop environments

A desktop environment is a set of GUI programs that runs on top of the underlying operating system. It is responsible for all the visible elements of the operating system. The same underlying operating system can have different desktop environments. Users can even switch to other desktop environments without reinstalling the operating system as per their appearance or performance preferences. Some famous desktop environments are Gnome, KDE, Xfce, etc. The point is, an operating system can run even without a desktop environment, for example, vanilla Arch Linux.

In such a case, only a command-line terminal is available to interact with the system, so the applications that depend on the GUI elements like Xterm would not work. Therefore another way to resolve the “Xterm display is not set” issue is to ensure that the host system has a suitable desktop environment. If the problem persists trying switching the environment. You could visit the official websites of the popular desktop environments of your choice and follow the installation process mentioned there.

cygwin xterm display is not set

Cygwin is a Unix-based programming runtime environment compatible with Microsoft windows. Unix-based applications can efficiently be run on Windows using the Cygwin environment. Xterm is a GUI-based program and requires an X windows system to run, Which can be done by running an X server on the host system. The Xterm would show the error message “Xterm display is not set without the X server running.”

To work around this issue, you need to install two packages in your Cygwin environment, Xorg-server and xinit. After installing these two packages, start the server by running the startxwin command and then set the display variable below.

Aix xterm: display is not set

Aix, which stands for Advanced Interactive Executive, is a proprietary operating system series based on UNIX. Again, to run Xterm in this AIX environment Display variable needs to be set. And the X server needs to be started. Run the following commands to eradicate the “xterm display is not set” error.

startx
xclock
export DISPLAY=localhost:0.0
xinit

WSL xterm not opening display is not set

WSL is short for Windows Subsystem for Linux; it is a compatibility layer between the Microsoft Windows operating system and Linux packages. It allows users to run native Linux binary executables on Windows machines. Using WSL, Xterm can be made to run on Windows. WSL2 has a slightly different way of resolving servers’ name, which could cause issues with X server’s DISPLAY variable. Run the following command to set your display variable in WSL Xterm.

export DISPLAY=$(grep nameserver /etc/resolv.conf | awk '{print $2}'):0.0

FAQs

Is Xterm available in Windows?

No, natively, it is not. It is for UNIX-based OSs.

What do you mean by FTP?

It stands for File Transfer Protocol. It is used to transfer large files across the internet.

What is the full form of SSh and SSL?

The full form of SSh is Secured Shell, and the complete form of SSL is Secure Socket Layer.

Conclusion

Xterm is a terminal emulator like other terminal emulators like gnome-terminal. The difference is, it runs on top of the user’s terminal and even uses the same shell. One additional feature in the Xterm shell is that it supports 8-bit colors. We saw that the “Xterm display is not set” error message can show up if the DISPLAY variable is not set and how to resolve that issues in just two commands. Then we discussed how the desktop environment could make a difference if the problem persists.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top