autologin from console not working on FreeBSD-11.1p2

Polytropon freebsd at
Thu Oct 26 19:59:06 UTC 2017

On Thu, 26 Oct 2017 14:22:27 -0500, Antonio Olivares wrote:
> I had a machine that did not want to boot up anymore.  This morning my
> friend which is a computer technician started it up for me and it is
> working.  I setup FreeBSD 11.1 on it and installed pkgs and xorg and
> have it working.  However, my autologin procedures which worked before
> no longer work.  I have a user olivares and configured /etc/gettytab
> and /etc/ttyS

I did quickly review a message to you regarding the same topic
(from 2011) and would like to quickly check a few things:

> In /etc/ttyS

That is /etc/ttys, right? :-)

> ttyv0     "/usr/libexec/getty Al"        cons25    on  secure


> in /etc/gettytab
> # log me in automatically
> A|Al|Autologin console:\
>     ht:np:sp#115200:al=olivares

Where is this entry located in the gettytab? It needs to be placed
after the "Pc" entry and should "source" it, so "tc=Pc" should be
added. On the other hand, the options "ht:np:sp#115200" aren't needed
as you are not defining a (hardware) serial terminal, and the "Pc"
profile covers this anyway.

> and when i startup system instead of logging in automagically, it asks
> for password.  I have .profile configured to automatically run startx.

This point isn't even reached if a password is being asked for.
If you are using ~/.profile, make sure you are using the shell
that matches this file, i. e., the default dialog shell C shell
won't care for this file, it requires ~/.login instead.

> How do i enable passwordless logins?
> I have another working machine but i have updated from 11.0-RELEASE to
> 11.1-RELEASE-p2

Check the "initial instructions" again. Allow me to provide a
full quote:

*** begin quote ***

From: Polytropon <freebsd at>
To: Antonio Olivares <olivares14031 at>
Cc: freebsd-questions at
Reply-To: Polytropon <freebsd at>
Subject: Re: autologin on default shell /bin/sh
Date: Tue, 27 Sep 2011 20:13:45 +0200
Organization: EDVAX
X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2)

On Mon, 26 Sep 2011 19:07:47 -0500, Antonio Olivares wrote:
> I had it working (autologin on 8.2 amd64) on two machines, but I
> wanted to test out/install nvidia driver and I used sysinstall to
> install kernel source from 8.2 dvd and then many things I had working,
> like printer, scanner were erased.  Shell changed back to /bin/sh, I
> was using bash.  For some reason or another, it was not working.  I
> did the same thing and now it works again :)

Your autologin configuration is a little bit different from
mine. I'll share and accomodate it to your particular use.

Step 1:

In /etc/gettytab,


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

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 "olivares" (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. :-)

There should not be any problem if you have "xterm" there.
Maybe just some terminal capabilities don't work in text
mode, but there should be no effect on autologin functionality.

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

Step 3:

In /home/olivares (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:

	[ ! -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 (if you want to) and the
different system shells, for your user account there can be
some additional settings.

In ~/.xsession, put

	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.

	[ -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. :-)

Step 5:

Profit. :-)

> In the beta 2 machine, the /dev/ttys has xterm instead of original
> cons25.  Other than that, you are correct with the rest of the
> information.  It was strange that someone/some folks have changed
> cons25 to xterm.

Surprises me too, but maybe the console driver now uses
this emulation for I/O... I'm not running 9-BETA here so
I cannot check, sorry.

*** end quote ***

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

More information about the freebsd-questions mailing list