A while back I did an introduction about .xinitrc which is a nice display manager free way of autostarting programs with Linux. With .xinitrc you can however do much more than start some programs. In fact you can start the whole desktop with .xinitrc and a command known as startx
Why would you want to remove display managers in the first place?
In most cases simple is better and as the software dependencies of modern display managers (gdm, lightdm, mdm…) are getting bigger and bigger there is certainly no harm done if we keep our log in simple and under our full control, right?
Edit: The method of not having a display manager around also makes possible the usage of .xinitrc in systems which would otherwise use their own files and configs as defaults instead of .xinitrc when running a display manager (Ubuntu, Debian…). Also when it comes to display managers ,for example, Slim in Arch Linux works with .xinitrc from the start but distros coming from Debian family usually need some work until their Slim display managers see .xinitrc. In addition to previous: configuring Gdm3, lightdm or any modern dm to respect .xinitrc or .xsessions (which is a similar kind of file) can be a very complex task depending on the users needs.
With the method of not having a display manager at all you will skip all the previously mentioned hassle while having a clean and simple universal autostart file for your desktop session(s)
Getting the components for the log in without a display manager:
1. A working .xinitrc file. I did a post about .xinitrc a while back so check it out for more info: https://www.techtimejourney.net/?p=555
You will also see an example of .xinitrc below (my current configuration):
setxkbmap fi &
nitrogen –restore &
Notice: the setxkbmap variable should be changed to correspond your local keyboard. So change it if you are not using fi as a keyboard layout.
Notice: the .xinitrc needs to be saved inside your home directory and it needs to be executable: again see the linked post above for more details.
Edit: If you wish to use gnome with .xinitrc add this line: exec gnome-session to .xinitrc file shown above.
2. You will need to have a package called xorg-xinit installed since it has the startx script which will be used to start the desktop. So install xorg-xinit with a gui tool or via terminal. For example as a sudo:
sudo pacman -S xorg-xinit OR sudo apt-get install xinit
As shown above: the actual package name hosting startx script might be different depending on your system of choice.
Getting into action
Once you are done customizing your .xinitrc file and you have the startx script installed then you are ready to test things out. When you have removed your display managers you will see a simple terminal asking you to login. Once you have done the login part just type startx and you should end up seeing your desktop.
The overall process described in this post was verified with Debian Wheezy and Arch Linux.