FAQ - Keyboard and Display Controls
Working on the console
Remapping the keyboard
The kbd(8) utility can be used to
change the keyboard encoding.
Most keyboard options can be controlled using the
For example, to change keymappings with
one would execute the following:
Remap [Caps Lock] to be [Control L], the left control key:
# wsconsctl keyboard.encoding=uk
To make changes permanent, use the
# wsconsctl keyboard.map+="keysym Caps_Lock = Control_L"
Console mouse support
For the alpha, amd64
and i386 platforms, OpenBSD provides
It can be enabled with the rcctl(8)
utility also described in the FAQ on the rc script.
On most alpha, amd64 and i386 systems, OpenBSD provides six virtual terminals by
default: /dev/ttyC0 through /dev/ttyC5.
You can switch between them using [CTRL]+[ALT] together with
[F1] through [F6].
The virtual terminal ttyC4 is reserved for use by the
X Window system.
Consoles on VGA hardware
Note: This section discusses features of the
They are not supported by all video cards.
The instructions below will not work on modern graphics hardware that uses
the drm(4) driver.
On a few platforms and hardware combinations, OpenBSD provides a console
This allows you to see information that has already scrolled past your screen.
To move up and down in the buffer, use [SHIFT]+[PGUP] and
The number of pages that you can move up and view is 8.
Switching consoles will clear the scrollback buffer.
Due to space limitations, the install kernels do not have this feature.
Adding more virtual consoles
If you wish to have more than the default number of virtual consoles, use the
wsconscfg(8) command to create
screens for ttyC6, ttyC7 and above.
This will create a virtual terminal for ttyC6, accessed by
To get a login: prompt on the newly created virtual console, you need
to set it to on in ttys(5),
and either reboot or send init(8)
a HUP signal using kill(1).
Add this command to rc.local(8)
if you want the extra screen the next time you boot the computer.
# wsconscfg -t 80x25 6 # this will not work on systems using drm(4)
Changing console font and resolution
Many VGA video cards on alpha, amd64 and i386 are capable of displaying a higher
text resolution of 50 lines instead of the usual 25 lines.
The standard 80x25 text screen uses 8x16 pixel fonts.
To double the number of lines, we first load an 8x8 pixel font with
Then we delete and recreate a virtual console with the desired screen resolution
This can be done automatically at boot by adding the following commands to
the end of the rc.local(8) script:
If you wish to modify other screens, simply repeat the delete and add screen
steps for whichever screens you want running at the 80x50 resolution.
It is not possible to change the resolution of the primary console device
ttyC0 accessed by [CTRL]+[ALT]+[F1].
Avoid changing screen 4 which is used by X as a graphical screen.
wsfontload -h 8 -e ibm /usr/share/misc/pcvtfonts/vt220l.808 # load 8x8 font
wsconscfg -dF 5 # delete screen 5 accessed by [CTRL]+[ALT]+[F6]
wsconscfg -t 80x50 5 # add screen 5 with 50 lines of 80 characters
Blanking the console after a period of inactivity
If you wish to blank your console after a period of inactivity without using X,
modify the following wscons(4)
determines the blanking time in milliseconds.
if set to on, keyboard activity will unblank the screen.
if set to on, console mouse
activity will unblank the screen.
if set to on, screen output will unblank the screen.
if set to on will disable the vertical sync pulse.
This will cause many monitors to go into an energy saver mode.
Set them permanently by editing
The blanker is activated when either display.kbdact or
display.outact is set to on.
Note that one of those two must be off.
# wsconsctl display.screen_off=60000
display.screen_off -> 60000
Configuring a serial console
OpenBSD supports serial console on most platforms, however details vary greatly
In addition to allowing users to log in, they're also useful for recording
There are two parts to getting a fully functional serial console on an OpenBSD
- Enable the serial port to be used as an interactive terminal, so a user
can log into it when running multi-user.
- Configure OpenBSD to use your serial port as a console for status and
single user mode.
This part is very platform-dependent.
Change /etc/ttys to get a login prompt
Terminal sessions are controlled by the
Before OpenBSD will give you a login: prompt at a device, it has to be
enabled in /etc/ttys.
The serial terminal is disabled by default on platforms which typically have
a keyboard and screen attached.
We'll use the amd64 platform as an example.
In this case, you must edit the line that reads:
to read something like:
tty00 "/usr/libexec/getty std.9600" unknown off
Here, tty00 is the serial port we are using as a console and
vt220 is the termcap(5)
entry that matches your terminal.
Other likely options might include vt100, xterm, etc.
The on bit enables the login prompt by activating
getty(8) for that serial port.
The secure bit permits a root login at this console.
The 9600 bit is the terminal baud rate.
tty00 "/usr/libexec/getty std.9600" vt220 on secure
Note that you can use a serial console for install without doing this step, as
the system is running in single user mode, and not using getty for
On some platforms and some configurations, you must bring the system up in
single user mode to make this change if a serial console is all you have
amd64 and i386
To configure the boot process to use the serial port as a console, your
boot.conf(5) file should
include the line:
This file is put on your boot drive, which could also be your install media.
Use the stty option if you need a baud rate other than 9600bps.
set tty com0
- Some systems may be able to operate without a video card in the machine,
but certainly not all -- many consider this an error condition.
- Others are capable of redirecting all BIOS keyboard and screen activity to
a serial port through a configuration option, so the machine can be
completely maintained through the serial port.
Your results may vary -- when using this feature, some BIOS
implementations may prevent the boot loader from seeing the serial port,
thus the kernel will not be told to use it.
There may be a BIOS option "Continue Console Redirection after POST."
This should be set to OFF, so the boot loader and the kernel can handle
their own console.
- To use the machine in multi-user mode, you will need to edit
/etc/ttys as explained above.
These machines are designed to be completely maintainable with a serial console.
Simply remove the keyboard from the machine, and the system will run serial.
- On some systems, the serial ports are labeled ttya,
ttyb, ttyh0 or ttyh1.
- It is not necessary to make any changes to /etc/ttys to use a
serial console in multi-user mode.
- Some sparc64 systems interpret a BREAK signal on the console port to be the
same as a STOP-A command.
This kicks the system back to the Forth prompt, stopping any application
and operating system at that point.
This is handy when desired, but unfortunately, some serial terminals at
power-down and some RS-232 switching devices send something the computer
interprets as a break signal, halting the machine.
Test before you go into production.
- If you have a keyboard and monitor attached, you can still force the
serial console to be used instead by using the following commands at the
If ttyC0 is active in /etc/ttys, as
explained above, you can use the keyboard and
monitor in X.
ok setenv input-device ttya
ok setenv output-device ttya
The MacPPC machines are configured for a serial console through OpenFirmware.
Use the commands:
Set your serial console to 57600bps, 8N1.
ok setenv output-device scca
ok setenv input-device scca
- Unfortunately, serial console is not directly possible on most MacPPCs.
While most of these machines do have serial hardware, it isn't accessible
outside the machine.
Fortunately, a few companies offer add-on devices for several Macintosh
models which will make this port available for use as a serial console.
- You will have to change tty00 in /etc/ttys to
on and set the speed to 57600 instead of the default of 9600 as
detailed above in single user mode before booting
multi-user and having the serial console functional.
I get input/output error when trying to use my tty devices
You need to use /dev/cuaXX for connections initiated from the OpenBSD
The /dev/ttyXX devices are intended only for terminal or dial-in usage.
Refer to the cua(4) manual for more