X without Display Manager

Usually, the X11 session is started by a display manager. However, when running a single-user system you may find display managers an unnecessary waste of resources. Fortunately, you can start X11 session without a display manager.

Using startx
See the Using startx section of the Xorg/Guide article.

Using a dedicated session runner
Some of the desktop environments provide their own replacements for. For example, Xfce4 provides :

Starting X11 on console login
To avoid having to type the startx command over and over again, you may decide that a login to a specific vt should start X11. One of the ways to achieve that is to put a code like the following into your shell's login script (e.g. ):

systemd
The XDG_VTNR variable specifies the VT number. To use another VT adjust the number accordingly.

The additional DISPLAY check is necessary because the snippet will be executed on both graphical and non-graphical logins. Since XDG_VTNR will be set to the same value in the shells started within the X11 session (e.g. terminals), it is necessary to prevent them from trying to start X11.

The command causes the login shell to be replaced by the X11 session. This means that the user won't be able to use the shell used to start X11 anymore, and whenever the X11 session terminates, user will be logged back out. If you'd prefer to remain being logged in into vt, remove the word.

Multiple X Session/Virtual Console
An alternate method is to auto-login to a Window Manager (WM) or a Desktop Environment (DE) depending on the Virtual Console (VT) used to login. A fallback session can be easily achieved in this manner. Just grab the following file excerpts to get going.

First, set up the sessions or WM or DE to use depending on the VT.

And then set up the login shell accordingly:

Or else, a zsh variant could be used instead.

The previous files can be used to login into an Enlightenment or LXDE session without needing any middle man or rather Diplay Manager (DM)! and OpenBox session as a fallback session using VT 1, 2, & 3.

Adapt it to your favorite DE or WM.

Method 1
In order to obtain complete X11 autologin, you can use the getty/login autologin feature along with the fore-mentioned trick.

First, create a new service file like the following:

username replaced by the user's username, and tty8 being the tty the X11-starting login to be performed on. It should be noted that this tty will be used for login and console output, and X11 can be started on any other tty.

Afterwards, add the fore-mentioned snippet to your bashrc (with the same vt specified), enable the service:

In order to avoid relying on the DISPLAY+XDG_VTNR trick to determine whether to start X11, we can extend the two above approaches by using a dedicated environment variable to distinguish the specific shell where X11 is to be started.

First, create a dedicated login wrapper:

This causes the user to be logged in with START_X11=1 environment variable set. Then, tell getty to use that file instead of the default :

Finally, modify bashrc (or equivalent) to use the variable rather than guessing:

Remember to unset the variable before starting X11 -- otherwise all the X11 terminals would have it set and try to spawn another X11 session.

Method 2
In another way, you can use su and xinit for direct login in X.

Service example:

startx can be used rather than xinit.

Automatic user selection
On a 1-user system it's possible to avoid typing the username, so the login prompt will ask you only about the password. E.g. here we adjust /etc/inittab so that the third terminal asks about the password only:

Of course, one can have various preselected users on different terminals, e.g. user_a on tty1 and user_b on tty2.

Links

 * http://mywiki.wooledge.org/DotFiles