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. This article Article description::describes how to start an 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 (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 and  for direct login in X.

Service example:

can be used rather than.

In case X startup fails with the error Xorg.wrap: Only console users are allowed to run the X server then read man Xorg.wrap how to allow any user to do so.

Links

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

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 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.

Custom text in console logon
We can create a simple wrapper for in order to show supplementary information on the console logon screen. E.g. on a 1-user system one may wish to see if there are any new emails without logging in. First, create a simple bash wrapper for :

The last line calls the actual which will do all the heavy lifting. You can omit the user name in that line if you want to be prompted about it. Passing a username results in being prompted about the password only.

Finally edit to use your  wrapper, here we'll use it on tty2: