How do I change the default session for when using auto-logins?
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
i.e.
sudo nano /etc/lightdm/lightdm.conf
change the line
user-session=ubuntu
to
user-session=ubuntu-2d
Note - if you don't have a lightdm.conf file then for a autologin use the following values for this file:
[SeatDefaults]
greeter-session=unity-greeter
user-session=ubuntu-2d
autologin-user=myusername
autologin-user-timeout=0
Another possibility is to run:
sudo /usr/lib/lightdm/lightdm-set-defaults -s <session-name>
E.g.:
sudo /usr/lib/lightdm/lightdm-set-defaults -s ubuntu-2d
This will also create the lightdm.conf
file if it wasn't already present.
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:
[Desktop]
Session=ubuntu
For GNOME Classic you can change it to say:
[Desktop]
Session=gnome-classic
Or for GNOME Classic (no effects) you can change it to say:
[Desktop]
Session=gnome-fallback
If you happened to want to use Unity 2D (session type Ubuntu 2D), you could change it to say:
[Desktop]
Session=ubuntu-2d
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:
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).
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
.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 graphicalRun Application
text box, when you can get by pressing Alt+F2) orsudo -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
/var/lib/AccountsService/users
seems like this set's the .dmrc
in the user home.
cheers