GDM

From ArchWiki

From GDM - GNOME Display Manager: "The GNOME Display Manager (GDM) is a program that manages graphical display servers and handles graphical user logins."

Display managers provide X Window System and Wayland users with a graphical login prompt.

Installation

GDM can be installed with the gdm package, and is installed as part of the gnome group.

Starting

To start GDM at boot time, enable gdm.service.

Autostarting applications

To automatically start applications after logging in, follow the instructions in Autostarting#On desktop environment startup that pertain to your desktop environment.

Configuration

Note: Most of the configuration options listed below can be easily set using the gdm-settingsAUR GUI application.

Login screen background image

The factual accuracy of this article or section is disputed.

Reason: Configuration is not persistent and changes will be undone after an update of GNOME Shell. Suggestion: Rewrite to use the "User Themes" Gnome extension. (Discuss in Talk:GDM)
Note:
  • Since GNOME 3.16, GNOME Shell themes are now stored as binary files (gresource).
  • This change will be overwritten on subsequent updates of gnome-shell.

Firstly, you need to extract the existing GNOME Shell theme to a directory in your home directory. You can do this using the following script:

extractgst.sh
#!/bin/sh
gst=/usr/share/gnome-shell/gnome-shell-theme.gresource
workdir=${HOME}/shell-theme

for r in `gresource list $gst`; do
	r=${r#\/org\/gnome\/shell/}
	if [ ! -d $workdir/${r%/*} ]; then
	  mkdir -p $workdir/${r%/*}
	fi
done

for r in `gresource list $gst`; do
        gresource extract $gst $r >$workdir/${r#\/org\/gnome\/shell/}
done

Navigate to the created directory. You should find that the theme files have been extracted to it. Now copy your preferred background image to this directory.

Next, you need to create a file in the directory with the following content:

gnome-shell-theme.gresource.xml
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
  <gresource prefix="/org/gnome/shell/theme">
    <file>calendar-today.svg</file>
    <file>calendar-today-light.svg</file>
    <file>checkbox.svg</file>
    <file>checkbox-focused.svg</file>
    <file>checkbox-off-focused-light.svg</file>
    <file>checkbox-off-focused.svg</file>
    <file>checkbox-off-light.svg</file>
    <file>checkbox-off.svg</file>
    <file>gnome-shell.css</file>
    <file>gnome-shell-high-contrast.css</file>
    <file>gnome-shell-start.svg</file>
    <file>pad-osd.css</file>
    <file>process-working.svg</file>
    <file>toggle-off.svg</file>
    <file>toggle-off-hc.svg</file>
    <file>toggle-off-light.svg</file>
    <file>toggle-on.svg</file>
    <file>toggle-on-hc.svg</file>
    <file>toggle-on-light.svg</file>
    <file>workspace-placeholder.svg</file>
    <file>filename</file>
  </gresource>
</gresources>

Replace filename with the filename of your background image or remove the line to use a hex color value instead.

Now, open the gnome-shell.css file in the directory and change the #lockDialogGroup definition as follows:

#lockDialogGroup {
  background: url(filename);
  background-size: widthpx heightpx;
  background-repeat: no-repeat;
}

Set background-size to the resolution that GDM uses; this might not necessarily be the resolution of the image. For a list of display resolutions, see Display resolution. Again, set filename to be the name of the background image.

If you only want to change the background color, adjust the #lockDialogGroup definition as follows:

#lockDialogGroup {
  background-color: #color;
}

where color is the new hex-encoded background color.

Next, compile the theme using the following command:

$ glib-compile-resources gnome-shell-theme.gresource.xml

Then, copy the resulting gnome-shell-theme.gresource file to the /usr/share/gnome-shell directory.

Finally, restart gdm.service (note that simply logging out is not enough) and you should find that it is using your preferred background image.

For more information, please see the following forum thread. A shell script to automate the above steps is available on DimaZirix's github repository.

dconf configuration

Some GDM settings are stored in a dconf database. They can be configured either by adding keyfiles to the /etc/dconf/db/gdm.d directory and then recompiling the GDM database by running dconf update as root or by logging into the GDM user on the system and changing the setting directly using the gsettings command line tool. Note that for the former approach, a GDM profile file is required—this must be created manually as it is no longer shipped upstream, see below:

/etc/dconf/profile/gdm
user-db:user
system-db:gdm
file-db:/usr/share/gdm/greeter-dconf-defaults

For the latter approach, you can log into the GDM user with the command below:

# machinectl shell gdm@ /bin/bash

Create the following keyfile:

/etc/dconf/db/gdm.d/02-logo
[org/gnome/login-screen]
logo='/path/to/logo.png'

Then recompile the GDM database.

Alternatively, execute the following as the GDM user to change the logo:

[gdm]$ dbus-launch gsettings set org.gnome.login-screen logo '/path/to/logo.png'

To disable the logo, you can set the value to an empty string:

[gdm]$ dbus-launch gsettings set org.gnome.login-screen logo ''

Changing the cursor theme

GDM disregards GNOME cursor theme settings and it also ignores the cursor theme set according to the XDG specification. To change the cursor theme used in GDM, create the following keyfile:

/etc/dconf/db/gdm.d/10-cursor-settings
[org/gnome/desktop/interface]
cursor-theme='theme-name'

Then recompile the GDM database. Alternatively, execute the following as the GDM user temporarily and change the cursor theme:

[gdm]$ dbus-launch gsettings set org.gnome.desktop.interface cursor-theme 'theme-name'

Changing the icon theme

The same methods can be used to change the icon theme. Create the following keyfile:

/etc/dconf/db/gdm.d/11-icon-settings
[org/gnome/desktop/interface]
icon-theme='theme-name'

Then, recompile the GDM database. Alternatively, execute the following as the GDM user temporarily and change the icon theme:

[gdm]$ dbus-launch gsettings set org.gnome.desktop.interface icon-theme 'theme-name'

Larger font for log-in screen

Click on the accessibility icon at the top right of the screen (a white circle with the silhouette of a person in the centre) and check the Large Text option.

To set a specific scaling factor, create the following keyfile:

/etc/dconf/db/gdm.d/03-scaling
[org/gnome/desktop/interface]
text-scaling-factor='1.25'

Then recompile the GDM database. Alternatively, execute the following as the GDM user temporarily and change the font:

[gdm]$ dbus-launch gsettings set org.gnome.desktop.interface text-scaling-factor '1.25'

Turning off the sound

This tweak disables the audible feedback heard when the system volume is adjusted (via keyboard) on the login screen.

Create the following keyfile:

/etc/dconf/db/gdm.d/04-sound
[org/gnome/desktop/sound]
event-sounds=false

Then recompile the GDM database. Alternatively execute the following as the GDM user temporarily and turn off the sound:

[gdm]$ dbus-launch gsettings set org.gnome.desktop.sound event-sounds 'false'

Configure power button behavior

Note:
  • The logind settings for the power button are overriden by GNOME Settings Daemon. [1]
  • As of GDM 3.18, the power button cannot be set to interactive. [2]
  • In some cases, this setting will be ignored and hardcoded defaults will be used. [3]
Warning: Please note that the acpid daemon also handles the "power button" and "hibernate button" events. Running both systems at the same time may lead to unexpected behaviour.

Create the following keyfile:

/etc/dconf/db/gdm.d/05-power
[org/gnome/settings-daemon/plugins/power]
power-button-action='action'

Then recompile the GDM database. Alternatively, execute the following as the GDM user temporarily and configure the behavior:

[gdm]$ dbus-launch gsettings set org.gnome.settings-daemon.plugins.power power-button-action 'action'

where action can be one of nothing, suspend or hibernate.

Enabling tap-to-click

Tap-to-click is disabled in GDM (and GNOME) by default, but you can easily enable it with a dconf setting.

Note: If you want to do this under X, you have to first set up correct X server access permissions—see #Configure X server access permission.

To enable tap-to-click, create the following keyfile:

/etc/dconf/db/gdm.d/06-tap-to-click
[org/gnome/desktop/peripherals/touchpad]
tap-to-click=true

Then recompile the GDM database. Alternatively, execute the following as the GDM user temporarily and enable the action:

[gdm]$ dbus-launch gsettings set org.gnome.desktop.peripherals.touchpad tap-to-click 'true'

Disable/Enable Accessibility Menu

This article or section is out of date.

Reason: As of GDM 43, the configuration key below does not work (yet, the docs still reference it [4].) Instead, use the key org.gnome.desktop.a11y.applications screen-keyboard-enabled true. (Discuss in Talk:GDM)

To disable or enable the Accessibility Menu, create the following keyfile:

/etc/dconf/db/gdm.d/07-accessibility
[org/gnome/desktop/interface]
toolkit-accessibility='boolean'

Then recompile the GDM database. Alternatively, execute the following as the GDM user temporarily and change the status:

[gdm]$ dbus-launch gsettings set org.gnome.desktop.interface toolkit-accessibility 'boolean'

The menu is disabled when the key is false, enabled when it is true.

Enable Night Light on GDM

To enable Night Light on GDM, run

[gdm]$ dbus-launch gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled true

Keyboard layout

GDM requires the XKBLAYOUT parameter to be set in /etc/vconsole.conf; without it it defaults to a standard us (qwerty) layout, i.e it will not honor the value set in KEYMAP.

One generally applicable way to do so is to use localectl --no-convert set-x11-keymap [keymap]: see Keyboard configuration in Xorg#Setting keyboard layout for details.

Warning: Using localectl set-x11-keymap without --no-convert will also change the value of KEYMAP=, which may result in an unbootable system if encrypting an entire system with a passphrase containing accented characters. See systemd issue #34967.

Change the language

The system language will be applied to GDM. If a system has multiple users, it is possible to set a language for GDM different to the system language. In this case, firstly ensure that gnome-control-center is installed. Then, start gnome-control-center and choose Region & Language. In the header bar, check the Login Screen toggle button. Finally, click on Language and choose your language from the list. You will be prompted for your root password. Note that the Login Screen button will not be visible in the header bar unless multiple users are present on the system [5].

Tip: By adding 2 different input languages, logging out then selecting your default language GDM will remember your choice once the second option is removed.

Users and login

Automatic login

Warning: Do not attempt to do this for users managed by systemd-homed. This is currently not implemented and will crash GDM.

To enable automatic login with GDM, add the following to /etc/gdm/custom.conf (replace username with your own):

/etc/gdm/custom.conf
# Enable automatic login for user
[daemon]
AutomaticLogin=username
AutomaticLoginEnable=True
Tip: If GDM fails after adding these lines, comment them out from a TTY.

or for an automatic login with a delay:

/etc/gdm/custom.conf
[daemon]
TimedLoginEnable=true
TimedLogin=username
TimedLoginDelay=1

You can set the session used for automatic login (replace gnome-xorg with desired session):

/var/lib/AccountsService/users/username
XSession=gnome-xorg

Passwordless login

If you want to bypass the password prompt in GDM then simply add the following line on the first line of /etc/pam.d/gdm-password:

auth sufficient pam_succeed_if.so user ingroup nopasswdlogin

Then, add the group nopasswdlogin to your system. See User group for group descriptions and group management commands.

Now, add your user to the nopasswdlogin group and you will only have to click on your username to login.

Warning:
  • Do not do this for a root account.
  • You will not be able to change your session type at login with GDM anymore. If you want to change your default session type, you will first need to remove your user from the nopasswdlogin group.

Passwordless shutdown for multiple sessions

GDM uses polkit and logind to gain permissions for shutdown. You can shutdown the system when multiple users are logged in by setting:

/etc/polkit-1/localauthority.conf.d/org.freedesktop.logind.policy
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
 "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
 "http://www.freedesktop.org/software/polkit/policyconfig-1.dtd">

<!--
Policy definitions for logind
 -->

<policyconfig>

  <action id="org.freedesktop.login1.power-off-multiple-sessions">
    <description>Shutdown the system when multiple users are logged in</description>
    <message>System policy prevents shutting down the system when other users are logged in</message>
    <defaults>
      <allow_inactive>yes</allow_inactive>
      <allow_active>yes</allow_active>
    </defaults>
  </action>

</policyconfig>

You can find all available logind options (e.g. reboot-multiple-sessions) in org.freedesktop.login1(5).

Enable root login in GDM

It is not advised to login as root, but if necessary you can edit /etc/pam.d/gdm-password and add the following line before the line auth required pam_deny.so:

/etc/pam.d/gdm-password
auth            sufficient      pam_succeed_if.so uid eq 0 quiet

The file should look something like this:

/etc/pam.d/gdm-password
...
auth            sufficient      pam_succeed_if.so uid eq 0 quiet
auth            sufficient      pam_succeed_if.so uid >= 1000 quiet
auth            required        pam_deny.so
...

You should be able to login as root after restarting GDM.

Hide user from login list

The users for the gdm user list are gathered by AccountsService. It will automatically hide system users (UID < 1000). To hide ordinary users from the login list create or edit a file named after the user to hide in /var/lib/AccountsService/users/ to contain at least:

/var/lib/AccountsService/users/username
[User]
SystemAccount=true


Remote login via RDP

Note: Currently, only headless sessions can be created remotely.
Note: Only one graphical session can exist at a time. Attempting to create a new session will prompt to kill the other one, if it exists.
Via Graphical Interface

Remote login can be configured via graphical interface by navigating to System > Remote Desktop > Remote Login in Gnome Settings app.

Via CLI
Note: To function, Gnome Remote Desktop requires both TLS certificates and credentials. Unless they were set before, both will be missing and need to be set manually.

To display current status and credentials, the following command can be used:

# grdctl --system status --show-credentials

To set credentials:

# grdctl --system rdp set-credentials rdp_login rdp_password

To generate new TLS key and certificate:

# winpr-makecert3 -rdp -path /etc/gnome-remote-desktop -n rdp-tls

If -n rdp-tls part is omitted, hostname will be used as the name instead.

To set TLS key and certificate:

# grdctl --system rdp set-tls-key /etc/gnome-remote-desktop/rdp-tls.key
# grdctl --system rdp set-tls-cert /etc/gnome-remote-desktop/rdp-tls.crt

Finally, to enable Remote Login:

# grdctl --system rdp enable

Setup default monitor settings

Some desktop environments store display settings in ~/.config/monitors.xml. xrandr commands are then generated on the base of the file content. GDM has a similar file stored in /var/lib/gdm/.config/monitors.xml.

If you have your monitors setup as you like (resolution, refresh rate, orientation, scaling, primary and so on) in ~/.config/monitors.xml and want GDM to honor those settings:

# cp ~/.config/monitors.xml /var/lib/gdm/.config/

To automatically re-configure the monitor setup on each boot, use a drop-in file for gdm.service:

/etc/systemd/system/gdm.service.d/override.conf
[Service]
ExecStartPre=/bin/cp /home/user/.config/monitors.xml /var/lib/gdm/.config/monitors.xml

The relevant parts of monitors.xml for screen rotation and scaling are:

<monitors version="2">
  <configuration>
    <logicalmonitor>
      ...
      <scale>2</scale>
      ...
      <transform>
        <rotation>right</rotation>
        <flipped>no</flipped>
      </transform>
      ...
    </logicalmonitor>
  </configuration>
</monitors>

Changes will take effect on logout. This is necessary because GDM does not respect xorg.conf.

Note:
  • If you use GDM under Wayland, you must also use a monitors.xml that was created under Wayland. See GDM bug 224 for more info. Alternatively, you can force GDM to #Use Xorg backend, and use a monitors.xml that was created under Xorg.
  • If you use fractional scaling, you need to enable it for user gdm,
[gdm]$ dbus-launch gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"

Configure X server access permission

You can use the xhost command to configure X server access permissions.

For instance, to grant GDM the right to access the X server, use the following command:

# xhost +SI:localuser:gdm

Troubleshooting

Wayland and the proprietary NVIDIA driver

To use Wayland in GDM with the NVIDIA driver, you must fulfill the three following conditions:

As of GDM 42 and NVIDIA driver 510, GDM defaults to Wayland. For older NVIDIA drivers (in between version 470 and 510), GDM has chipset-dependent udev rules to use Xorg rather than Wayland. To force-enable Wayland, instead of following the three regular steps above, override these rules by creating the following symlink:

# ln -s /dev/null /etc/udev/rules.d/61-gdm.rules
Note: This command works because rules in /etc/udev/rules.d/ override those in /usr/lib/udev/rules.d/ (see udev#About udev rules). It is also advised to modify files in /etc/ rather than in /usr/ as those are managed by pacman.

If, instead of GDM, a black screen appears, try disabling integrated graphics in your computer's BIOS settings.

In some cases, GNOME fails to start and transfers control back to GDM, which in turn causes the login screen to reappear. You may try setting the following environment variable as suggested in BBS#2126478:

/etc/environment
MUTTER_DEBUG_KMS_THREAD_TYPE=user

Failure on logout

If GDM starts up properly on boot, but fails after repeated attempts on logout, try adding this line to the daemon section of /etc/gdm/custom.conf:

GdmXserverTimeout=60

Rootless Xorg

See Xorg#Rootless Xorg.

Use Xorg backend

The Wayland backend is used by default, and the Xorg backend is used only if the Wayland backend cannot be started. You may wish to use the Xorg backend instead if, for example:

To use the Xorg backend by default, uncomment the following line in /etc/gdm/custom.conf:

#WaylandEnable=false

Incomplete removal of gdm

After removing gdm, systemd may report the following:

user 'gdm': directory '/var/lib/gdm' does not exist

To remove this warning, login as root and delete the primary user gdm and then delete the group gdm:

Verify that gdm is successfully removed via pwck and grpck with root privileges. To round it off, you may want to double-check no unowned files for gdm remain.

GDM auto-suspend (GNOME 3.28)

GDM uses a separate dconf database to control power management. To apply your user's power settings, copy them to GDM's dconf database:

$ IFS=$'\n'; for x in $(sudo -u username gsettings list-recursively org.gnome.settings-daemon.plugins.power); do eval "sudo -u gdm dbus-launch gsettings set $x"; done; unset IFS

where username is your username.

To only disable auto-suspend on AC, run:

[gdm]$ dbus-launch gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing'

(To also disable auto-suspend on battery, run the command with battery instead of ac.)

Restart GDM to activate your changes.

GDM ignores Wayland and uses X.Org by default

Wayland requires Kernel Mode Setting (KMS) running in order to work, and on some machines the GDM process start earlier than KMS, resulting in GDM unable to see Wayland and working only with X.Org. This might result in messages like the following showing up in your log:

gnome-shell[569]: Failed to open gpu '/dev/dri/card0': GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Operation not permitted
gnome-shell[569]: Failed to create backend: No GPUs found
systemd[505]: org.gnome.Shell@wayland.service: Failed with result 'protocol'.
systemd[505]: Failed to start GNOME Shell on Wayland.

Alternatively, the same issue may lead to GDM not appearing or monitor only displaying the TTY output.

You can solve this problem by starting KMS earlier. You may also wish to just verify that Wayland is enabled in the GDM config (see above).

Also, if you use a NVIDIA driver, the Wayland session might be blocked by a udev rule (see the notes under GNOME#Wayland sessions). This might result in messages like the following:

systemd[1022]: Condition check resulted in GNOME Shell on Wayland being skipped.
systemd[1022]: org.gnome.Shell@wayland.service: Skipped due to 'exec-condition'.
systemd[1022]: org.gnome.Shell@wayland.service: Control process exited, code=exited, status=2/INVALIDARGUMENT

See #Wayland and the proprietary NVIDIA driver for a workaround.

Black screen on AMD or Intel GPUs when an NVIDIA (e)GPU is present

At first, without an NVIDIA device, GDM starts and works normally on Wayland, but stops working once an NVIDIA eGPU is plugged in (or the nvidia module is loaded for other reasons). A typical symptom of the problem is a black screen with a blinking cursor upon logouts and GDM restarts and the following message in GDM's logs (accessed by running journalctl -u gdm -b as root):

Gdm: Child process -<some PID> was already dead.

The solution is the same as #GDM ignores Wayland and uses X.Org by default: Prevent /usr/lib/gdm-disable-wayland from running upon nvidia module loading.

Notice that GDM on Wayland will no longer work once /usr/lib/gdm-disable-wayland has run. This is because WaylandEnable=false has been written into /run/gdm/custom.conf, which overrides /etc/gdm/custom.conf. To fix the situation without a reboot, remove /run/gdm/custom.conf and then restart GDM.

GDM cannot be enabled

See systemd/FAQ#Failure to enable unit due to preexisting symlink.

See also