Home / Alt manpages / unicode_stop(1)

  • unicode_stop(1)
  • User command
  • linux

Recover a Linux Virtual Console with unicode_stop

If a Linux virtual console has been left in UTF-8 mode and is displaying or accepting input incorrectly, unicode_stop puts that console back into ASCII keyboard mode and clears its UTF-8 console mode. This guide uses the installed kbd package, version 2.6.4-2ubuntu2, and shows how to tell a real reset from a command that politely skipped your terminal.

Allow about ten minutes. You need a shell on the affected machine and access to the virtual console you want to repair. The command changes terminal state, so do not run it blindly in a terminal emulator or against a console another person is using.

1. Confirm the command and the kind of terminal

Check the installed command first. These checks are ordinary and do not need elevated privileges:

$ command -v unicode_stop
/usr/bin/unicode_stop
$ dpkg-query -W -f='${Package} ${Version}\n' kbd
kbd 2.6.4-2ubuntu2
$ tty
/dev/tty2

The last line matters. unicode_stop is intended for a Linux virtual console such as /dev/tty2, /dev/tty7 or /dev/console. It is not a general-purpose setting for an SSH session, a graphical terminal emulator or a pseudo-terminal.

Checkpoint: if tty prints not a tty, or a path such as /dev/pts/3, stop here. You are not attached to the target virtual console. Log in on that console, or use the console's own recovery path instead.

2. Warn anyone using the console

This changes the active virtual console. It switches the keyboard to ASCII, tells the terminal that UTF-8 input is no longer expected, and sends a terminal reset sequence when standard input is a terminal. Screen output and key interpretation can change immediately.

If the console is shared, announce the change first. Do not use sudo as a way to guess which console is broken. Privilege may be required to change the device, but it cannot identify the correct target for you.

3. Run unicode_stop on the affected virtual console

With the correct virtual console in the foreground, run the command with no options:

$ sudo unicode_stop
$ printf 'exit status: %s\n' "$?"
exit status: 0

The man page gives unicode_stop no command-line options. The installed shell script calls kbd_mode -a, which selects ASCII (also called XLATE) keyboard mode, then clears the terminal's UTF-8 input setting with stty -iutf8. It also sends the terminal's ASCII mode escape sequence when the input is a terminal.

Use elevated privileges only if the command cannot access the console device as your current user. On a local root shell, omit sudo. A successful exit status means the reset steps completed for the selected console; it does not mean that every virtual console on the machine was changed.

4. Verify the keyboard mode

Ask kbd_mode to report the mode of the console attached to standard input after the reset:

$ kbd_mode
XLATE

The exact word depends on the console state and the installed kbd_mode build. The useful result is the ASCII or XLATE mode described by your installed kbd_mode(1) manual, rather than a raw or medium-raw mode. If the report is unexpected, make sure you ran the command on the affected virtual console and that unicode_stop returned success.

For an explicit console device, kbd_mode supports -C CONSOLE. That option changes which console it operates on, but it does not move your shell there. Prefer running the recovery command from the affected console so that keyboard, terminal and device state agree.

5. Check the terminal setting without changing it

Once the keyboard mode is correct, inspect the input flags:

$ stty -a
... -iutf8 ...

The exact stty output varies by terminal and system. The useful detail is that -iutf8 is present, meaning the terminal is not asking the line discipline to interpret input as UTF-8. This is a read-only check. Do not copy an entire stty line from another machine: terminal flags are device-specific.

If the display is still garbled, the issue may be the console font, keymap or application output rather than Unicode mode. unicode_stop does not repair all three. The related unicode_start command can later restore Unicode mode, but use it only when the console and the applications writing to it are ready for UTF-8 again.

6. Recognise a skipped terminal

On a non-console terminal, the installed command reports that it skipped the terminal and exits successfully:

$ unicode_stop
unicode_stop skipped on /dev/pts/3
$ printf 'exit status: %s\n' "$?"
exit status: 0

This is not a failed recovery. It is a deliberate guard: the script only acts when tty identifies /dev/console, /dev/vc* or /dev/tty followed by digits. A zero status here means no reset was needed or attempted on that pseudo-terminal. This is the most common distraction when testing over SSH.

There is no persistent configuration to undo for the normal example. The command changes the current console's runtime state. To return that console to Unicode mode later, use unicode_start according to its manual and keep the console font and application encoding consistent. If the reset disrupted a local session, switch to another virtual terminal with the host's normal console key combination and investigate from there.

Done means

  • tty identified the affected Linux virtual console.
  • unicode_stop returned success while running on that console.
  • kbd_mode no longer reports UTF-8 mode.
  • stty -a shows the input setting with -iutf8.
  • You know whether the command changed the target console or merely skipped a pseudo-terminal.
  • You have not confused a font or keymap problem with a console encoding problem.