When autologon is active, lightdm will start the Unity 3D session, not the 2D (or any other shell that I want to auto-login to).

Is there a way to start the shell I want automatically (autologon)?

Anyway, if autologon is disabled, the last used session is launched, and that's fine. I just want to choose which is default with autologon.


7 Answers 7


The list of sessions is described in the directory /usr/share/xsessions.

Some of the more common session names are as follows:

  • For unity-2d the session file is called ubuntu-2d.desktop
  • For gnome-classic the session file is called gnome-classic.desktop
  • For gnome-classic (no effects) aka gnome-fallback the session file is called gnome-fallback.desktop
  • For unity-3d the session file is called ubuntu.desktop
  • For Lubuntu the session file is called Lubuntu.desktop
  • For LXDE the session file is called LXDE.desktop

Thus, if you change the light-dm configuration file to "ubuntu-2d" this will default the session to Unity-2D


sudo nano /etc/lightdm/lightdm.conf

change the line




Note - if you don't have a lightdm.conf file then for a autologin use the following values for this file:


Another possibility is to run:

sudo /usr/lib/lightdm/lightdm-set-defaults -s <session-name>


sudo /usr/lib/lightdm/lightdm-set-defaults -s ubuntu-2d

This will also create the lightdm.conf file if it wasn't already present.

  • If the line user-session=ubuntu does not exist in the file /etc/lightdm/lightdm.conf, Then just type it in as the last line: user-session=ubuntu-2d
    – Sepero
    Commented Oct 15, 2015 at 19:10
  • Worth noting that current distros (16.04 definitely) moves the config files into /usr/share/lightdm/. I had to edit lightdm.conf.d/50-ubuntu.conf
    – Gargravarr
    Commented Jan 19, 2018 at 14:13

It is strange that LightDM (Ubuntu 11.10's display manager, which provides the graphical login screen) is not remembering your selection across reboots.

You can manually edit the relevant configuration file, which is called .dmrc and is located in your home folder. In Nautilus (the file browser), you'll have to press Ctrl+H (or View > Show Hidden Files) to see it and other files that start with a . character. If you have this file--which you probably do--then its contents will be like:


For GNOME Classic you can change it to say:


Or for GNOME Classic (no effects) you can change it to say:


If you happened to want to use Unity 2D (session type Ubuntu 2D), you could change it to say:


If you don't have the file at all, then you can create it with the appropriate contents.

If you want to set GNOME Classic or GNOME Classic (no effects) as the default session type for all users--or you'd prefer not to, but the above user-specific method doesn't work--then you can edit /etc/lightdm/lightdm.conf, changing the line that says user-session=ubuntu to instead say user-session=gnome-classic or user-session=gnome-fallback (or user-session=ubuntu-2d). A few things to keep in mind when considering doing this:

  1. It is preferable to edit the per-user configuration files in users' home folders, unless you have a reason to prefer changing the global configuration (like that not working).

  2. Since this is a global configuration file and it contains considerably more than the simple configuration option that you are intending to edit, it is advisable to back it up before editing it, in case you make a mistake. You can do that in the Terminal by running the command sudo cp /etc/lightdm/lightdm.conf /etc/lightdm/lightdm.conf.old.

  3. This file is owned by root, hence the sudo command above. You must also edit it as root. To open it in gedit as root, you can run gksu gedit /etc/lightdm/lightdm.conf (either in a Terminal window, or in the graphical Run Application text box, when you can get by pressing Alt+F2) or sudo -H gedit /etc/lightdm/lightdm.conf in a Terminal window.

It seems likely that the behavior you're experiencing is a bug, so after gathering additional information by seeing if manually editing ~/.dmrc works, you may want to report it as one. Read this carefully first, then after searching to see if a similar bug has been reported, initiate the reporting process by invoking ubuntu-bug with the PID of the running lightdm process, or, almost as good, run ubuntu-bug lightdm ...which should all make sense after you've read that guide.

By the way, besides Unity (session type Ubuntu), Unity 2D (session type Ubuntu 2D), and GNOME 3 Fallback (GNOME Classic and GNOME Classic (no effects)), you might also consider, as even lighter-weight options, Xfce4 (install the package xubuntu-desktop and select session type Xubuntu) and LXDE (install the package lubuntu-desktop and select session type Lubuntu).

  • In newer versions of Ubuntu than existed when this question was originally asked, Unity 2D and GNOME 3 Fallback are not available. (In the newest versions, Unity is not available either.) But Xfce4/Xubuntu and LXDE/Lubuntu remain available.
  • These days, users who who have used GNOME 3 Fallback are likely to prefer the MATE desktop environment, provided by the ubuntu-mate-desktop package (see Ubuntu MATE).
  • Lubuntu remains more lightweight (i.e., it tends to consume the fewest resources and to work acceptably on more old hardware). But it is not as fully featured as Xubuntu or Ubuntu MATE.

There's also GNOME 3 with the GNOME Shell instead of Unity (install the package gnome-shell and select GNOME) and KDE 4 Plasma (install the package kubuntu-desktop and select Kubuntu), but those unlikely to be less resource-intensive than the above options.


to change the default per user, check


seems like this set's the .dmrc in the user home.



To change the default Session in Lightdm

sudo /usr/lib/lightdm/lightdm-set-defaults --session gnome-shell
  • 1
    Thanks, I actually wanted gnome shell, but I found it with sudo /usr/lib/lightdm/lightdm-set-defaults --session gnome-shell
    – wim
    Commented Oct 23, 2011 at 13:09
  • no problem. I couldn't test it but the documentation I foudn suggested gnome for 'gnome-shell'. Did passing gnome for session give an error? Then I should edit my answer Commented Oct 23, 2011 at 14:16
  • no, but it went into the old gnome 2.
    – wim
    Commented Oct 23, 2011 at 23:24

I edited /etc/lightdm/lightdm.conf with this content:


And it starts automatically to gnome-shell.


I find that setting any of the above is overridden by the users last session stored by lightdm. You may have to remove or edit the user files at /var/cache/lightdm/dmrc to enable the global default setting. Or on an individual basis by editing the user.dmrc file that has the following contents:

  • What exactly is the .dmrc file and how is it created?
    – Andy
    Commented Aug 3, 2017 at 16:50

This may not work in Ubuntu but it worked for me in Fedora. It took days to figure out and I wanted to share it:

Go to /usr/share/xsessions and /usr/share/wayland-sessions and add prefixes with a different number and a dash to every file ending in .desktop.
The lowest number will be the default. For example, I want xfce to be my default so that file is named 1-xfce.desktop

Hope this helps.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .