Clint Pachl wrote, On 08/25/14 16:36:
It seems one should be able to get getty(8) to do this using /etc/ttys. I tried:

console "/usr/bin/su -l USER -c /usr/X11R6/bin/startx" xterm on secure

which automatically launched X, but I didn't have access to the console (i.e., no write permission on /dev/console, no keyboard, etc.). I looked into fbtab(5), but I'm not sure how this works in this situation.

Thanks to David Coppa, he set me on the right track by sharing Marc Balmer's "Starting X11 Applications on OpenBSD at Boot Time." I will summarize:

Use rc.local to launch X server manually on a virtual terminal and make sure getty(8) is not listening on that VT. This setup will not require user login or authentication. It can operate as a kiosk.

First, setup an unprivileged user (USER) that will automatically run X11 and any specified GUI apps. Then add an .xinitrc startup script for the USER's X11 session. Here we will launch Chrome and load a local web application.

/home/USER/.xinitrc:
/usr/local/bin/chrome http://localhost/app

Now, just execute X11 as the unprivileged user from the system local script. Note we are running the X server on display 0 on virtual terminal 5. The startx script will run the .xinitrc above.

/etc/rc.local:
(
    while sleep 1
do su -l USER -c '/usr/X11R6/bin/startx -- /usr/X11R6/bin/Xorg vt05 :0'
    done
) &

Now if Chrome crashes or quits, X will restart and relaunch Chrome.

Finally, make sure getty does not interfere with this finely tuned operation.

/etc/ttys:
ttyC4   "/usr/libexec/getty std.9600"   vt220   off

Reply via email to