Try using: sudo service lightdm start
Instead of: sudo lightdm I *guess* you're experiencing this problem because you invoke lightdm directly in the current TTY, so lightdm thinks it must assume/take the current TTY. In turn, the X server is usually started after lightdm, and, on most .deb based distributions, the X server usually assumes that you want TTY 7 to be graphical environment. So, in your case, since you're invoking lightdm directly, lightdm is taking you back and forth every time it operates successfully. Other than this guess, I don't really know what could be happening, since I only guessed this based on what I have experienced in the past, and on some basic Bash process operations. This means I don't know how to configure neither lightdm nor X.
