What Do I Do If the GUI Cannot Be Displayed When MindStudio IDE Is Started?
Symptom
When MindStudio IDE is started, the error message "Failed to initialize graphics environment", "Unable to detect graphics environment", or "Can't connect to X11 window server using 'localhost:xxx' as the value of the DISPLAY variable" is displayed. See Figure 1, Figure 2, and Figure 3.
Possible Cause
- After a user logs in to MobaXterm, the graphical environment is occupied by the user group to which the user belongs. After the user changes, the graphical environment is unavailable.
- The login user is different from the user who starts MindStudio IDE.
- The X11-forwarding dependency is not installed.
- X11 forwarding is not enabled for SSH.
- $HOME/.Xauthority is presented as a folder, not a file.
Solution
- For the problem of unavailable graphical environment, perform the following steps:
- Add the new user to the user group of the original user.
- Use MobaXterm to enable the user who wants to start MindStudio IDE.
- Start MindStudio IDE as the user.
- If the login user is different from the user who starts MindStudio IDE, perform the following step:
Restart MindStudio IDE as the user who logs in to the system.
- If the X11 dependency is not installed, install it based on the system type.
- For Red Hat and openEuler OSs:
yum install -y xorg-x11-xauth xorg-x11-apps xterm libXext libXtst libXrender
- For Ubuntu OS:
apt-get install -y xorg x11-apps xterm libxtst-dev libxext-dev libxrender-dev
- For Red Hat and openEuler OSs:
- If X11 forwarding is not enabled, modify sshd_config, set X11Forwarding to yes, and restart the SSH service.
- Use the vi editor to set X11Forwarding to yes in the /etc/ssh/sshd_config file. For CentOS 7.6/EulerOS 2.8, set X11UseLocalhost to no.
vi /etc/ssh/sshd_config
- Check whether the configuration takes effect.
cat /etc/ssh/sshd_config |grep -i X11Forwarding
If "X11Forwarding yes" is displayed, the X11 forwarding configuration takes effect.
cat /etc/ssh/sshd_config |grep -i X11UseLocalhost
If "X11UseLocalhost no" is displayed, the X11UseLocalhost configuration takes effect.
- Restart the SSH service.
- For Red Hat and openEuler OSs:
service sshd restart
- For Ubuntu OSs:
service ssh restart
- For Red Hat and openEuler OSs:
- Use the vi editor to set X11Forwarding to yes in the /etc/ssh/sshd_config file. For CentOS 7.6/EulerOS 2.8, set X11UseLocalhost to no.
- If $HOME/.Xauthority is presented as a folder, delete it.
Parent topic: FAQs


