Friday, May 20, 2016

Terminal is Not Opening In Linux

When try to open terminal in linux (debian, ubuntu,..) that defaults uses GNOME-Terminal it refuses to start.
And when try to open from cli "root@sys:~# gnome-terminal" from any terminal (install 'Xfce Terminal' or 'LXTerminal' to run following commands)it shows the following error.

Error constructing proxy for org.gnome.Terminal:/org/gnome/Terminal/Factory0: Error calling StartServiceByName for org.gnome.Terminal: Timeout was reached

This error show that there is some problem to start GNOME Terminal service.
To check the failed services in system by user run the sollowing command systemctl which used for control systemd and processes.

root@sys:~# systemctl --user --failed
  UNIT                          LOAD   ACTIVE SUB    DESCRIPTION
* gnome-terminal-server.service loaded failed failed GNOME Terminal

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

1 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.

Here its  shows the gnome-terminal-server.service unit or service is loaded but not active.
There can be several reason to cause these error like misconfig of terminal profile, system locale is not set.

To solve this first you need to install gnome-terminal by typing :

root@sys:~# apt-get install gnome-terminal

If u have already installed it then 'purge' it so if there is any misconfig of profile or configuration file then it will remove it.
This Package will also remove when you purge the GNOME terminal so install it again.

root@sys:~# apt-get install gnome-terminal
root@sys:~# apt-get install gnome-core*
root@sys:~# apt-get install gnome-terminal*

Reboot the computer and try to open terminal if still getting error then check system locale.

root@sys:~# localectl

LANG="your locale,shoud not be empty"
To generate locale run following command.

root@sys:~# locale-gen

To set your locale run following command(in my case : en_US.UTF-8).

root@sys:~# localectl set-locale LANG="en_US.UTF-8"

After setting system locale reboot the computer and open gnome-terminal it will open successfully.