Linux Applications

GNOME – How to control the start sequence

Which is the most popular desktop?What makes it start?

What GNOME needs to get started, values you want to supply…

From the beginning and with small systems, you will put values in ~/.xinitrc. The simplest file will just contain ‘exec gnome-session’. A more reasonable file would look like the one below.

export XDG_MENU_PREFIX=gnome-
exec gnome-sesson

Using this approach is not the default way to do it. This approach assumes only one choice of desktop environment. This assumption is no longer valid for most systems. Distributions nowadays use a display manager, since GNOME is the default desktop they have chosen GNOME’s own GDM3 as the display manager. On most systems, you will start from GDM3 and have a control file that sets things up.

Where do you start GDM3?

If you used a regular distribution, gdm is already installed and the default login. You may want to switch to other display managers, a popular option is SDDM. To install it, you use your package manager. At the end of the installation, you are prompted to choose which manager you want to use. The script sets the correct manager for your next boot. If you want to switch back, just run the below command.

$ sudo dpkg-reconfigure gdm3

The same menu will appear and you can choose which one you want to run without uninstalling any of them. What happens is that the text string in the file /etc/X11/default-display-manager is changed to point to the correct display manager. In systemd machines, the ‘display-manager.service’ makes sure it starts and keep running. The daemon named logind is the general daemon, which you can check using systemctl.

$ systemctl status systemd-logind.service

GDM3 reads /etc/gdm3/custom.conf to get its correct configuration. In this file, you can set your system to login automatically. You can also set xdmcp parameters and security settings. Here, you can also enable debugging in this file.

After GDM has started, you are greeted with your login page. On this page you can choose which desktop environment you want to use. Those choices comes from files in usr/share/xsessions. One example is the default one from Ubuntu, seen below.

The values in GDM – The session Desktop file is an init style file as shown below. The entries control the session by setting values for the desktop.

[Desktop Entry]
Comment=This session logs you into Ubuntu
Exec=env GNOME_SHELL_SESSION_MODE=ubuntu /usr/bin/gnome-session --systemd

You have many options in this file, the main ones are Exec and TryExec. The first one starts the desktop, in this file gnome-shell. The second one, checks if the binary file exists. Using the TryExec statement, you can have GDM3 ignore the entry if it does not exist.

Another important file is /usr/share/gnome-session/sessions/gnome.session. This file clarifies the required software for this session.

How do you change your own desktop?

Once you have chosen GNOME, gnome-session starts to look around for a number of files. In the directory $XDGCONFIGHOME/gnome-session/saved-session, gnome should have saved the last session.

To have specific applications start when your desktop starts, you can add them to the autostart directory. They are listed below.

usr/share/gnome/autostart & ~/.config/autostart/

You can also set the same values with the built-in tweak tool.

The component that runs your desktop, the graphical part, is gnome-shell. Gnome-shell reads data from the gnome-session file. Any applications are available in usr/share/application. Information about applications and mime-types are available in the usr/share/application-registry directory.

gnome-shell the graphical shell

The gnome-shell creates everything for your desktop, the system settings are in usr/share/gnome*. You also find the settings for many gnome applications here. For your personal settings, they are in ~.local/share/gnome-[Name of app] for certain applications.


When GNOME starts, there is a lot happening. It is good to have a basic grasp of this process, so you can either solve problems or tweak how it works to your own preferences.

About the author

Mats Tage Axelsson

I am a freelance writer for Linux magazines. I enjoy finding out what is possible under Linux and how we can all chip in to improve it. I also cover renewable energy and the new way the grid operates. You can find more of my writing on my blog.