How to solve ‘Failed to start session’ with LightDM and Xfce

Failed to start session issues with LightDM and Xfce is really annoying. Due to some wrong configuration files, if you install Xfce on top of an Ubuntu Server or if you move away from an old desktop environment for an Xfce session on Ubuntu, you finally get in stuck at the LightDM login screen with no possibility to enter in your GUI system.

 

The infamous 'Failed to start session' error on LightDM
The infamous ‘Failed to start session’ error on LightDM

Failed to start session problem on Ubuntu, but also on another Linux systems

I was trying to log in to an Ubuntu system as usual and got a claimable error ‘Failed to start session’. I entered my password and it did not log me in, but the password was correct. Instead, it showed me a red color error message. I could not even log in to guest session nor use different session.

Whazzup???

Usually, when you are at the login screen, pressing Ctrl+Alt+F1, you can enter to command line interface from the GUI. There, inserting username and password, you’ll get a command line terminal session. But not in this case. From Ctrl+Alt+F1 to Ctrl+Alt+F10, do nothing and I’m stuck at LightDM login screen session.

Again, whazzup???

To solve this annoying issue, I did some simple things. My system was a fresh install of Ubuntu Server 18.04 from a minimal ISO, then I have installed Xfce with:

$ sudo apt install xfce4

At this point, no login screen. I booted in a classical CLI server interface and, after I was entered, I can go to GUI session with a classic command:

$ startx

So, I decided to install the default Xfce login manager, the famous LightDM.

$ sudo apt install lightdm

And, for Debian sake, also:

$ sudo dpkg-reconfigure lightdm

Ok, I’m on board. Let’s reboot the system and…

I’m stuck here. To solve this issue, restart the system from the icon at the top-right. During the rebooting process, press ‘ESC’ to enter in the Grub and select ‘Advanced options for Ubuntu’.

 

The recovery mode advanced options for Ubuntu
The recovery mode advanced options for Ubuntu

 

Then ‘Ubuntu, with Linux 4.xx.x-xx-generic (recovery mode)’ and wait until it’s completely loaded. On the next menu, please select ‘root’ for ‘Drop to root shell prompt’. In the end, press ‘Enter’ for maintenance mode and you get a root (#) terminal prompt.

 

LightDM on Ubuntu is configured for Unity, the old default DE

The problem with LightDM in Ubuntu repository is that it’s configured for Unity, the old default Ubuntu desktop environment. So, now, let’s config LightDM for Xfce.

We remove the Unity config file:

# rm /usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf

We create an Xfce config file for LightDM:

# vi /usr/share/lightdm/lightdm.conf.d/50-xfce-greeter.conf

And we populate it with the right things:

[SeatDefaults]
greeter-session=unity-greeter
user-session=xfce

Esc:wq and reboot to test if it’s working.

Bonus point. The autologin

If you also want to disable the guest user access and make effective the autologin option, add this lines in the file edited above:

allow-guest=false
autologin-user=<your-username>
autologin-user-timeout=0

Some useful links

Xfce Desktop Environment – https://www.xfce.org/

The Light Display Manager (LightDM) – https://www.freedesktop.org/wiki/Software/LightDM/

What is LightDM? – https://wiki.ubuntu.com/LightDM