When cloning a Linux image with Clonezilla on  my HP 1040 g3 notebook I had to deal with the problem of lightdm not starting, the cloning process worked fine with several notebook models, except that one.

Bloody hell of errors with lightdm:

  • xhost: unable to open display «»»
  • settings.vala the file has no key…
  • xorg no devices to configure configuration failed
  • el archivo de claves no tiene la clave gtk
  • failed to start detects available gpus and deal with any system changes
  • session_get_login1_sesion_id assertion

Things I’ve tried:

  • Creating a custom xorg.conf file
  • Deleting autostart of lightdm under /home/user/.config/LXDE/…
  • dpkg-reconfigure xorg
  • dpkg-reconfigure lightdm

None of that worked.

Solving all the mentioned errors

I compared the filesystem against one that worked fine with this command:

diff -r -q /dir /dir2

Some of the paths/files caught my attention:

First, I deleted all the cache of lightdm and Xorg:

rm -rf /var/lib/lightdm/.cache/*
rm -rf /var/cache/lightdm/*
rm -rf /tmp/.X11-unix

Then I moved the old configuration files of lightdm:

mv /var/lib/lightdm/.Xauthority /var/lib/lightdm/.Xauthority_bk
mv /var/lib/lightdm/.dbus/session-bus/ /var/lib/lightdm/.dbus/session-bus_bk/

Then reconfigure and restart the service:

dpkg-reconfigure lightdm
service lightdm restart

And finally lightdm started, no blackscreen after reboot 🙂

How did I achieve this solution (process of thinking)

I’ve seen many technical articles since 2009 when I started working in IT. But none of them explains the process of achieving the solution, the approach, the guesses or anything that explains the process of thinking and how you followed each step to solve the problem.

I think that revealing this process helps people to understand better the solution and also helps to construct your own ways of thinking which may lead to faster or better solutions.

The first thing I tried was using google to have a clue about the first error I saw, in this case I used this search exactly as it is:

failed to start detects available gpus and deal with any system changes

I was surprised that in the first result one of the answers was mine! Then I tried following my own answer which didn’t work.

The next step was searching for logs and other errors in google and trying to apply the found solutions, some of them partially worked and I wasn’t satisfied with it.

Then I went for the aggressive approach, reinstalling lightdm, that didn’t solve the issue.

So I tried reinstalling xorg which actually solved the problem.

I knew that could be the end of it, but then one new question appeared: Why reinstall of xorg works? Could it be some sort of misconfiguration or temporary files of the previous install/hardware that are making some kind of conflict? What is it? Why reinstalling xorg makes it work???

Because I had the capability to restore (replicate the problem) I restored the filesystem to a previous state (where the error was present) after doing a backup of the current filesystem which actually worked.

Because I’m not an expert on LightDM nor Xorg I though the best way to find answers was comparing both filesystems, first I tried going in each configuration folder (for Xorg and LightDM) and made a md5sum to find differences with vimdiff:

I found one symlink different in /etc/X11/app-defaults/ but that was not the problem. And doing md5sum for each folder was a pain so I searched in google for an effective way to compare directories, I liked this one:

diff -r -q /dir /dir2

But I also needed to know where to look, because I don’t know which folders I had to look up, so I made a rsync from the non-working filesystem to the working one to see what was being replaced, then I filtered the results by lightdm, xorg, and X:

rsync -avz --delete --progress /mnt/fs1/ /mnt/fs2/ > logito # logito means "little log"

And filtering:

mortiz@florida:/media/mortiz/data$ cat logito | grep lightdm
etc/lightdm/
etc/lightdm/lightdm.conf
etc/lightdm/lightdm-gtk-greeter.conf.d/
usr/lib/lightdm/
usr/share/doc/lightdm/
usr/share/lightdm/
......... # and more....
mortiz@florida:/media/mortiz/data$ cat logito | grep X
etc/X11/
etc/X11/app-defaults/
etc/X11/app-defaults/XScreenSaver -> XScreenSaver-nogl
etc/X11/xinit/
etc/alternatives/Xvnc -> /usr/bin/Xtightvnc
etc/alternatives/Xvnc.1.gz -> /usr/share/man/man1/Xtightvnc.1.gz
tmp/.X11-unix/
tmp/.XIM-unix/
usr/bin/Xtightvnc
................ # and more.....
mortiz@florida:/media/mortiz/data$ cat logito | grep xorg
usr/include/xorg/
usr/lib/x86_64-linux-gnu/xorg/
usr/lib/x86_64-linux-gnu/xorg/x11-extra-modules/
usr/lib/xorg/
usr/lib/xorg/modules/
usr/lib/xorg/modules/drivers/
.... # and more....

So for each directory I applied the previous diff command which resulted in this locations with relevant differences:

/var/lib/lightdm/.cache/
/var/cache/lightdm/
/tmp/.X11-unix
/var/lib/lightdm/.Xauthority
/var/lib/lightdm/.dbus/session-bus/

After understanding some of the files I realized that some of them were related to the errors listed at the start of this document, finally I applied the reconfiguration for LightDM and lucky me after restarting the service everything worked.

Maybe my process for searching an answer wasn’t pro, but at least I feel it’s a good way to understand how I thought I could find an answer, because isn’t about the problem itself, it’s about getting an answer to satisfy my curiosity.