LightDM

Revision 16 as of 2014-05-16 09:50:57

Clear message

What is LightDM?

LightDM is a display manager. The most user visible aspect of the display manager is the login screen, however it also manages the X servers and facilitates remote logins using the XDMCP protocol. It was added as default display manager display manager in Ubuntu 11.10 (Oneric) replacing GDM which has been the display manager since the beginning. See the blueprint for more details.

Testing LightDM

Note: Ubuntu is no longer testing LightDM, but the developer continues to work on this project. The remaining information should apply to newer releases, but there may be some minor differences if you are using Kubuntu, Lubuntu, Xubuntu, etc.

To test LightDM in Oneiric, Use the following command:

sudo apt-get install lightdm lightdm-greeter-example-gtk

If using Ubuntu 11.04 (Natty) then use the the LightDM PPA (No Longer Updated):

sudo apt-add-repository ppa:lightdm-team/ppa
sudo apt-get install lightdm lightdm-greeter-example-gtk

When installing the package you will be prompted to choose your default display manager. You can either run LightDM by default or on demand.

Running LightDM by default

If you have LightDM as your default display manager then it will just be there when you boot! To switch the default run:

sudo dpkg-reconfigure lightdm

Running LightDM on demand

If you are using another display manager by default (e.g. GDM) then you will have to stop that and run LightDM on demand. Log out of any graphical sessions, go to a text terminal (alt-ctrl-F1) then switch display managers with the following commands:

sudo stop gdm
sudo start lightdm

Running LightDM in test mode

You can also run LightDM in a test mode to try out the greeters (you cannot log into any accounts except your own). You do not need root access to do this. Open a terminal and enter:

lightdm --test-mode

Configuration and Tweaks

LighDM configuration is governed by the configuration files in /etc/lightdm/lightdm.conf.d/. To add your own configuration, create a new file in that directory such as /etc/lightdm/lightdm.conf.d/my.conf.

Disabling Guest Login

If you want to disable guest login, use:

[SeatDefaults]
allow-guest=false

The default for this option is true, so if unset, the guest account will be enabled.

Hiding the User List

If you don’t want a user list to be displayed, you can enable this option. This should also be used with the enabling manual login (below) or logging in may be a challenge.

[SeatDefaults]
greeter-hide-users=true

The default for this option is false, so if unset, you will get a user list in the greeter.

Show Manual Login Box

If you previously hid your user list and would like a box where you can manually type in a user name you can enable it with:

[SeatDefaults]
greeter-show-manual-login=true

The default for this option is false, so if unset, you won’t get a manual login box.

Autologin

You can enable autologin by specifying the autologin user.

[SeatDefaults]
autologin-user=username

There are other autologin related options which you may want to set, but none of these can be set using lightdm-set-defaults:

To change how long the greeter will delay before starting autologin. If not set, the delay is 0, so if you want this to be 0, you don’t need to change it. Note: the default for all unset integers in the [SeatDefaults] section is 0.

autologin-user-timeout=delay

To enable autologin of the guest account:

autologin-guest=true

You could disable autologin by removing the configure item

autologin-user=username

at /etc/lightdm/lightdm.conf

Autorun a Command

You can run a command when the X Starts, when the greeter starts or when the user session starts

Autorun a Command when X starts

When lightdm starts X you can run a command or script, like xset perhaps.

display-setup-script=[script|command]

Autorun a Command when the Greeter starts

You can do something similar when the greeter starts:

greeter-setup-script=[script|command]

Autorun a Command when the User Session starts

If you want to spawn something when the user session starts, you can do it with:

session-setup-script=[script|command]

Change the Default Session

If you want a different session for the default, you can modify this option. The greeter will default to give you the last session you chose, so this option will only change the default session. Note: The session switcher will only show up if you have more than one VALID session; a valid session is one that points to a valid executable. By default in 12.10 you will have a session file for gnome-shell, but gnome-shell won’t be installed, so the session is invalid, leaving you with a single valid session (Ubuntu), and hence no session selector!

[SeatDefaults]
user-session=true

The list of user sessions is in /usr/share/xsessions, although even that location is configurable (see Advanced Options).

You can change the default greeter in the same manner, using --greeter for lightdm-set-defaults or greeter-session for the config file. The list of installed greeters is in /usr/share/xgreeters.

* Note: The default greeter for Ubuntu is currently unity-greeter without lightdm in the name.

Change the wallpaper

gksudo leafpad /etc/lightdm/lightdm-gtk-greeter.conf
  • Replace leafpad with your favorite text editor

background=/usr/share/lubuntu/wallpapers/lubuntu-default-wallpaper.png

Now replace the default wallpaper with the one you want. Then Save.

Advanced Options

There is no manpage for lighdm.conf, but there is an example that lists all the options and a bit about what they do, just look in /usr/share/doc/lightdm/lightdm.conf.gz. Running zless /usr/share/doc/lightdm/lightdm.conf.gz will show you the full list of configuration options.

#
# General configuration
#
# start-default-seat = True to always start one seat if none are defined in the configuration
# greeter-user = User to run greeter as
# minimum-display-number = Minimum display number to use for X servers
# minimum-vt = First VT to run displays on
# lock-memory = True to prevent memory from being paged to disk
# user-authority-in-system-dir = True if session authority should be in the system location
# guest-account-script = Script to be run to setup guest account
# log-directory = Directory to log information to
# run-directory = Directory to put running state in
# cache-directory = Directory to cache to
# sessions-directory = Directory to find sessions
# remote-sessions-directory = Directory to find remote sessions
# greeters-directory = Directory to find greeters
#
[LightDM]
#start-default-seat=true
#greeter-user=lightdm
#minimum-display-number=0
#minimum-vt=7
#lock-memory=true
#user-authority-in-system-dir=false
#guest-account-script=guest-account
#log-directory=/var/log/lightdm
#run-directory=/var/run/lightdm
#cache-directory=/var/cache/lightdm
#sessions-directory=/usr/share/lightdm/sessions:/usr/share/xsessions
#remote-sessions-directory=/usr/share/lightdm/remote-sessions
#greeters-directory=/usr/share/lightdm/greeters:/usr/share/xgreeters

#
# Seat defaults
#
# type = Seat type (xlocal, xremote)
# xdg-seat = Seat name to set pam_systemd XDG_SEAT variable and name to pass to X server
# xserver-command = X server command to run (can also contain arguments e.g. X -special-option)
# xserver-layout = Layout to pass to X server
# xserver-config = Config file to pass to X server
# xserver-allow-tcp = True if TCP/IP connections are allowed to this X server
# xserver-share = True if the X server is shared for both greeter and session
# xserver-hostname = Hostname of X server (only for type=xremote)
# xserver-display-number = Display number of X server (only for type=xremote)
# xdmcp-manager = XDMCP manager to connect to (implies xserver-allow-tcp=true)
# xdmcp-port = XDMCP UDP/IP port to communicate on
# xdmcp-key = Authentication key to use for XDM-AUTHENTICATION-1 (stored in keys.conf)
# unity-compositor-command = Unity compositor command to run (can also contain arguments e.g. unity-system-compositor -special-option)
# unity-compositor-timeout = Number of seconds to wait for compositor to start
# greeter-session = Session to load for greeter
# greeter-hide-users = True to hide the user list
# greeter-allow-guest = True if the greeter should show a guest login option
# greeter-show-manual-login = True if the greeter should offer a manual login option
# greeter-show-remote-login = True if the greeter should offer a remote login option
# user-session = Session to load for users
# allow-guest = True if guest login is allowed
# guest-session = Session to load for guests (overrides user-session)
# session-wrapper = Wrapper script to run session with
# greeter-wrapper = Wrapper script to run greeter with
# guest-wrapper = Wrapper script to run guest sessions with
# display-setup-script = Script to run when starting a greeter session (runs as root)
# display-stopped-script = Script to run after stopping the display server (runs as root)
# greeter-setup-script = Script to run when starting a greeter (runs as root)
# session-setup-script = Script to run when starting a user session (runs as root)
# session-cleanup-script = Script to run when quitting a user session (runs as root)
# autologin-guest = True to log in as guest by default
# autologin-user = User to log in with by default (overrides autologin-guest)
# autologin-user-timeout = Number of seconds to wait before loading default user
# autologin-session = Session to load for automatic login (overrides user-session)
# autologin-in-background = True if autologin session should not be immediately activated
# exit-on-failure = True if the daemon should exit if this seat fails
#
[SeatDefaults]
#type=xlocal
#xdg-seat=seat0
#xserver-command=X
#xserver-layout=
#xserver-config=
#xserver-allow-tcp=false
#xserver-share=true
#xserver-hostname=
#xserver-display-number=
#xdmcp-manager=
#xdmcp-port=177
#xdmcp-key=
#unity-compositor-command=unity-system-compositor
#unity-compositor-timeout=60
#greeter-session=example-gtk-gnome
#greeter-hide-users=false
#greeter-allow-guest=true
#greeter-show-manual-login=false
#greeter-show-remote-login=true
#user-session=default
#allow-guest=true
#guest-session=
#session-wrapper=lightdm-session
#greeter-wrapper=
#guest-wrapper=
#display-setup-script=
#display-stopped-script=
#greeter-setup-script=
#session-setup-script=
#session-cleanup-script=
#autologin-guest=false
#autologin-user=
#autologin-user-timeout=0
#autologin-in-background=false
#autologin-session=UNIMPLEMENTED
#exit-on-failure=false

#
# Seat configuration
#
# Each seat must start with "Seat:".
# Uses settings from [SeatDefaults], any of these can be overriden by setting them in this section.
#
#[Seat:0]

#
# XDMCP Server configuration
#
# enabled = True if XDMCP connections should be allowed
# port = UDP/IP port to listen for connections on
# key = Authentication key to use for XDM-AUTHENTICATION-1 or blank to not use authentication (stored in keys.conf)
#
# The authentication key is a 56 bit DES key specified in hex as 0xnnnnnnnnnnnnnn.  Alternatively
# it can be a word and the first 7 characters are used as the key.
#
[XDMCPServer]
#enabled=false
#port=177
#key=

#
# VNC Server configuration
#
# enabled = True if VNC connections should be allowed
# command = Command to run Xvnc server with
# port = TCP/IP port to listen for connections on
# width = Width of display to use
# height = Height of display to use
# depth = Color depth of display to use
#
[VNCServer]
#enabled=false
#command=Xvnc
#port=5900
#width=1024
#height=768
#depth=8

Debugging LightDM

LightDM writes verbose logs to /var/log/lightdm. Please check these if there appears to be a problem. If you are running it from the command line (e.g. in test mode) you can also get debugging information by running with the --debug flag.

What to do if things go wrong

If things go horribly wrong (we promise to try very hard to avoid this) you may need switch back to GDM. Some tricks to do this:

  • If you have no graphics, go to a text terminal using alt-ctrl-F1
  • Stop LightDM with sudo stop lightdm

  • Start GDM with sudo start gdm

  • Run sudo dpkg-reconfigure lightdm to set the default display manager

  • Edit /etc/X11/default-display-manager and set it to /usr/sbin/gdm if you can't run the above
  • Uninstall LightDM and GDM will replace it after a reboot
  • If things go really bad, you may need to remote login using SSH or by using grub to enter a recovery mode (It should never get this bad and if it does then blame X).

Reporting problems, feature requests

Use the Launchpad project and file bugs please. If you are using Oneiric or later please use:

ubuntu-bug lightdm

so that all appropriate information/logs are attached. If you are using Natty you will have to report the bugs manually, please give the version of LightDM you are using.

Developing greeters

Install liblightdm-gobject-0-dev or liblightdm-qt-0-dev for the LightDM greeter API. Look at the LightDM source for example greeters in greeters/.