Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Nov 2013 03:57:06 +0100
From:      Polytropon <freebsd@edvax.de>
To:        Yuri <yuri@rawbw.com>
Cc:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: What is the "thinnest" display manager available?
Message-ID:  <20131126035706.a04de661.freebsd@edvax.de>
In-Reply-To: <5293C1D4.3010608@rawbw.com>
References:  <5293C1D4.3010608@rawbw.com>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Mon, 25 Nov 2013 13:32:04 -0800, Yuri wrote:
> I want to have as few packages installed as possible, and I want to use 
> small window manager (dwm). But what is the thinnest display manager 
> available? I know kdm and gdm both work, but both pull a ton of 
> dependencies which I don't want.

I'd say the classic xdm won't be a bad choice: it's common,
secure, easy to use, and fast. If you're using WindowMaker
for one or more accounts on your system, maybe wdm isn't
a bad choice.

However, xdm and wdm are started by an entry in /etc/ttys.



> Features required:
> * automatic start (through /etc/rc.conf)
> * automatically run xorg and window manager of choice
> * automatically login a particular user
> * not many or no dependencies
> 
> What is the smallest display manager that qualifies?

If I understand your requirements correct, "no display manager"
would be a possible answer. You want to automatically login a
particular user? You don't even need a display manager then.
A display manager works similarly to login: ask for a user name
and a password, then run the appropriate startup shell and
scripts. For auto-login, this is not required.



> Or maybe there is an easy way to run xorg + WM with some simple shell 
> script? Anything like this ready to use?

Everything for this task is present in the base system, it just
requires a few steps. I'll provide a little howto in case this
is what you need (refactored from an earlier post I wrote to
that list).



Step 1:

In /etc/gettytab,

	autologin:\
	        :al=<USERNAME>:tc=Pc:

is to be placed _after_ the "default:" entry. This step defines
the "getty profile" for an automated login with the username
"olivares" as associated to the "al=" parameter. Also note
the "tc=" parameter which incorporates the default "Pc"
settings (that you can encounter in the next step's working
file). Here, <USERNAME> is the user you want to be logged in
automatically.



Step 2:

In /etc/ttys, the line for ttyv0 is to be changed like this:

	ttyv0  "/usr/libexec/getty autologin"  cons25l1  on  secure

This instructs the "getty" program to use the "autologin
profile" at system startup and automatically log in the
user <USERNAME> (see step 1).

Attention: Maybe you need a different console configuration;
"cons25" is the system's default. In Germany, I have to use
cons25l1 for the local magic. :-)

Make sure you _don't_ have a line calling xdm here - maybe this
causes conflicts.



Step 3:

In /home/<USERNAME> (or where $HOME is located for that user),
make ~/.login end in

	[ ! -f /tmp/.X0-lock ] && startx

For bash, this would go to ~/.bash_login. Other shells may
have different startup files; see "man sh", "man csh",
"man bash" and "man <yourshell>" for details.

To become independent from the actual login shell, you can
write this command into a script that is executable by the
user, e. g. "chmod +x /opt/bin/autostartx"; if you have
/opt/bin in $PATH, you just need to call "autostartx" in
the correct startup file. Then _any_ shell startup script
could contain the call that script, like this:

	#!/bin/sh
	[ ! -f /tmp/.X0-lock ] && startx
	exec $0

You can also make this script local to your user in ~/bin,
maybe you already have that in $PATH.

Attention: This _might_ get you into an "infinite loop" if
something is _really_ wrong. :-)

You can even modify the script to _restart_ X if it should
have crashed, so you don't fall back to the console in
case of a severe error (and enter "startx" again).



Step 4 (optional):

In order to combine the use of xdm (or other DMs) and the
different system shells, for your user account there can be
some additional settings.

In ~/.xsession, put

	#!/bin/csh
	source ~/.cshrc
	exec ~/.xinitrc

This file will be executed in case xdm is used. I am using the
C shell as a dialog shell here, so this makes sure my shell
settings get incorporated. Then control will be given to the
.xinitrc file, usually executed when you run "startx", but
xdm _may_ have a different opinion.

In ~/.xinitrc, put all your X startup stuff.

	#!/bin/sh
	[ -f ~/.xmodmaprc ] && xmodmap ~/.xmodmaprc
	#xrandr --fb 1400x1050
	#xrandr --size 1400x1050
	intclock -geometry 186x65+151-0 &
	xload -geometry 150x70+0+826 -bg white -fg black -hl gray \
		-scale 5 -label "System load" -update 1 &
	xmbmon -g 150x100+0+897 -tmin 20.0 -tmax 70.0 -cmtmb CPU \
		-cltmb blue -cmtcpu CS -cltcpu cyan -cmtcs SYS \
		-cltcs green -vmin 2.0 -vmax 3.0 -cmvc V -clvc red &
	xclock -geometry 50x50+50+998 &
	xbiff -geometry 50x50+0+998 &
	xlogo -geometry 50x50+100+998 -render &
	xcpufreq -geometry 183x167+151+826 -cpuscalecolor grey \
		-freqscalecolor grey -scales 6 -update 1 -jumpscroll 1 &
	xterm -geometry 80x25+0+465 -class NOCLOSE_TERMINAL -fg black \
		-bg beige -title Terminal &
	xsetroot -solid rgb:3b/4c/7a
	xset b 100 1000 15 &
	xset r rate 250 30 &
	xset s off &
	xset -dpms &
	exec wmaker

The first line (#!) is optional. I'm not fully sure if those
files have to be +x attributes (I _have_ those settings, no idea
where they came from and why they are still here). But it works,
so I don't question it. :-)

The last line, "exec", contains the call to the desired window
manager. Maybe the file just needs to be as short as maybe

	#!/bin/sh
	exec startxfce4

to do everything you need.







-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?20131126035706.a04de661.freebsd>