The wsconsctl utility can be used to view and modify the behaviour of the keyboard, mouse, and display. It does so using the machine-independent workstation console device driver called wscons.
In order to change the keyboard encoding after installation, the following command can be used.
# wsconsctl keyboard.encoding=de
Keyboard options like, for example, keymappings can also be controlled using the wsconsctl utility.
In order to remap [Caps Lock] to be [Control L], the left control key, issue the following command:
# wsconsctl keyboard.map+="keysym Caps_Lock = Control_L"
Another way of achieving the same is by using the swapcrtlcaps option. Note that the following example also sets the keyboard encoding to “us”.
# wsconsctl keyboard.encoding=us.swapctrlcaps
The /etc/wsconsctl.conf file will be loaded on startup and any permananent changes need to be added there. By default such a file does not exist and must be created. All current parameters can be displayed by running the
wsconsctl command as root without any options.
Changing the font can be done by using the same wsconsctl utility as above.
# wsconsctl display.font=Spleen
The utility/daemon used to add mouse functionality to the console does not work simultaneously with the X Window System. It therefore has to be stopped before starting the X Window System.
It’s possible to add copy/paste functionality using a mouse on the console. The wsmoused daemon listens for mouse events on a specified device and communicates them to the wscons driver. By default it assumes a 2-button mouse where the left one will be used to select and copy text from the console, the right button is used to extend the selection, and the middle button is used to paste the selected text.
Changing the default behaviour can be done using the wsmoused utility.
The following command changes the functionality of the middle button to the right button and the right button to the middle one. So the text selection extention functionality will be attached to the middle button while the right button pastes the previously selected text.
# wsmoused -M 2=3 -M 3=2
By default, OpenBSD provides 6 virtual terminals: /dev/ttyC0 through /dev/ttyC5. The command to switch to a specific virtual terminal is [CTRL]+[ALT] and a function key [F1] through [F6] where [F1] corresponds with /dev/ttyC0, F2 with /dev/ttyC1, etc. Terminal /dev/ttyC4 is reserved for X window operations.
Blanking a console when inactive can be a good idea for multiple reasons. One of which could be preventing a screen burn in but privacy and energy saving considerations are also at play. The wscons utility allows you to set the variables surrounding console blanking without the use of the X Window Server. The following veriables can be modified using the wscons utility:
An example of setting the screen to blank after 60000 milliseconds or 1 minute:
# wsconsctl display.screen_off=60000 display.screen_off -> 60000
Adding these variables to /etc/wsconsctl.conf makes them permanent.
OpenBSD supports serial console on most platforms, however details vary greatly between platforms. In addition to allowing users to log in, they’re also useful for recording console output.
There are two parts to getting a fully functional serial console on an OpenBSD system:
Terminal sessions are controlled by the ttys(5) file. 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:
tty00 "/usr/libexec/getty std.9600" unknown off
to read something like:
tty00 "/usr/libexec/getty std.9600" vt220 on secure
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. 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 login.
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 available.
To configure the boot process to use the serial port as a console, your boot.conf(5) file should include the line:
set tty com0
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.
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.
This section discusses features of the vga driver. These drivers don’t support all video cards. The instructions below will not work on modern video cards that use the drm driver.
On a few platforms and hardware combinations, OpenBSD provides a console scrollback buffer. 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 [SHIFT]+[PGDN]. 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.
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. For example:
# wsconscfg -t 80x25 6 # this will not work on systems using drm(4)
This will create a virtual terminal for ttyC6, accessed by [CTRL]+[ALT]+[F7]. 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.
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 wsfontload(8). Then we delete and recreate a virtual console with the desired screen resolution using wsconscfg(8). This can be done automatically at boot by adding the following commands to the end of the rc.local(8) script:
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
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.