The Handbook

    Theme
    • Guides
        • Check a system before installing FreeBSD
        • Orient a Linux administrator on FreeBSD
        • Supported FreeBSD releases
        • Choose a FreeBSD documentation and support channel
        • Move files safely without GNU mv -t
        • Update, upgrade, or update packages?
        • Upgrade 14.4 or 15.0 to FreeBSD 15.1
        • Choose packages, ports, or poudriere
        • Choose the quarterly or latest package branch
        • Choose a FreeBSD download or package mirror
        • Make a system setting persistent
        • Configure locale, keyboard, and time zone
        • Configure a serial console for recovery
        • Choose a custom kernel, module, or loader setting
        • Run a Linux binary with the compatibility layer
        • Check desktop and laptop hardware before installation
        • Choose and check a graphics driver
        • Choose Xorg or Wayland
        • Build a maintainable desktop baseline
        • Install and check a desktop browser
        • Check laptop Wi-Fi, power, and suspend
        • Check multimedia readiness
        • Choose and configure a printing stack
        • Run Windows applications with Wine
        • Snapshot and replicate a ZFS dataset
        • Choose a filesystem and storage layout
        • Operate ZFS without losing the recovery path
        • Restore files from a ZFS snapshot
        • Read ZFS pool health and run a scrub
        • Replace a failed device in a ZFS mirror
        • Replicate a ZFS dataset over SSH
        • Change PF safely on a remote host
        • Configure a narrow WireGuard tunnel
        • Plan a FreeBSD home server
        • Choose a mail server or an outgoing relay
        • Publish a network service safely
        • Choose a jail network model
        • Choose native jails or a jail manager
        • Choose a jail or a bhyve virtual machine
        • Establish a FreeBSD security baseline
        • Choose a MAC policy
        • Audit security-relevant activity
        • Start a DTrace performance investigation
    • Integrations
        • Create a first jail with Bastille
        • Compare jail managers and OCI tooling
        • Publish a Bastille service through PF
        • Mount a ZFS dataset in a Bastille jail
        • Update and upgrade Bastille jails
        • Back up and restore a Bastille jail
        • Prepare bhyve and vm-bhyve
        • Choose NFS or Samba for file sharing
        • Choose ZFS backup automation
        • Operate a signed poudriere repository
        • Manage FreeBSD configuration with Ansible or Salt
        • Run Motion with webcamd on FreeBSD
        • Design a reverse proxy, certificates, and monitoring
    • FAQ
    • Troubleshooting
        • Recover an interrupted freebsd-update run
        • Resolve a package repository or ABI mismatch
        • Diagnose the FreeBSD boot path
        • Recover with a ZFS boot environment
        • Diagnose DNS, routing, and firewall paths
        • Diagnose network mbuf exhaustion
        • Bind a service to a low port without running it as root
        • Diagnose audio output or input
        • Diagnose webcamd, cuse, and a webcam
        • Fix USB device permissions without opening every device
    • About this handbook
    • Synopsis
    • Inventory the current state
    • Select and test a locale
    • Make a per-account locale persistent
    • Test and retain a console keymap
    • Configure Xorg input separately
    • Configure Wayland input through the compositor
    • Set the system time zone
    • Separate time zone from clock correction
    • Verify a complete session
    • Primary references

    Configure locale, keyboard, and time zone

    Last reviewed
    13 August 2026
    Applies to
    15.1-RELEASE, 15.0-RELEASE, 14.4-RELEASE

    Synopsis #

    Locale, keyboard layout, time zone, and clock synchronization are independent settings. A locale controls how applications interpret and present language-sensitive data. A console keymap controls keys on FreeBSD virtual consoles. Xorg and Wayland sessions have their own input configuration. A time zone changes civil-time display, while a time-synchronization service corrects the system clock.

    Test each layer temporarily, record the original value, and make only the confirmed setting persistent. This avoids a login environment that cannot start, an unusable console keymap, or a clock that appears wrong for two different reasons.

    Inventory the current state #

    Collect the current application locale, console keymap setting, time-zone record, and clock state:

    $ locale
    $ sysrc keymap
    $ test -r /var/db/zoneinfo && cat /var/db/zoneinfo
    $ date
    # service ntpd status
    

    An unset keymap rc variable means that the base default can still be active. A stopped ntpd service does not prove the clock is wrong, because another synchronization mechanism may exist. Record the installed desktop or compositor before changing graphical input.

    Select and test a locale #

    List locale names supplied by the installed base system and choose an exact entry:

    $ locale -a
    

    Test that entry in a child process before changing login files. Replace locale-name with the exact reported value:

    $ env LANG=locale-name locale
    

    LANG supplies defaults for locale categories. A specific LC_CTYPE, LC_TIME, or another LC_* variable overrides its category. LC_ALL overrides every category and is best reserved for a deliberate temporary test; setting it globally makes category-specific configuration difficult to understand.

    Check application behavior that matters, including character input, filename display, sorting, decimal formatting, and date formatting. Changing a locale does not translate an application that lacks message catalogs or add missing fonts and input methods.

    Make a per-account locale persistent #

    FreeBSD login classes provide a shell-independent per-account mechanism. A minimal UTF-8 example in ~/.login_conf is:

    me:\
        :charset=UTF-8:\
        :lang=en_US.UTF-8:
    

    Replace both values when a different entry from locale -a and its documented character set are required. Compile the per-account capability database:

    $ cap_mkdb "$HOME/.login_conf"
    

    Log out completely and start a new login session before evaluating the result. Existing shells and applications retain their previous environment.

    For a system-wide policy, define a named class in /etc/login.conf, run cap_mkdb /etc/login.conf, and assign that class to accounts with the documented account-management tools. Do not alter the default class for every account merely to fix one desktop application. Keep a root or administrative session open while validating a new login class.

    To roll back a per-account change when ~/.login_conf existed previously, restore the recorded file, run cap_mkdb again, and begin a fresh login. If the file was newly created, remove both ~/.login_conf and ~/.login_conf.db, then begin a fresh login. A stale compiled database can otherwise keep the removed settings active. Shell startup files can also set locale variables, but their syntax and coverage differ; avoid configuring the same variable in both mechanisms.

    Test and retain a console keymap #

    kbdmap(1) applies to a FreeBSD virtual console, not to Xorg or native Wayland applications. Run it from a local virtual console with another administrative session available:

    # kbdmap
    

    Select a candidate interactively and test letters, digits, punctuation, modifiers, function keys, and any key needed for the root password. The change is temporary and can be replaced by another selection or reset during the test.

    After recording the selected keymap name, make that exact name persistent with sysrc:

    # sysrc keymap="selected-keymap"
    

    Do not include a filename suffix unless the installed rc.conf(5) and keymap data require it. Verify at a new virtual console and again after reboot. To roll back, restore the recorded value; if the variable was originally absent, remove the override:

    # sysrc -x keymap
    

    Console fonts and screen maps are separate from the keymap. Change them only when the selected character repertoire needs them and the active console driver supports the documented setting.

    Configure Xorg input separately #

    An Xorg session uses XKB configuration. Inspect the active session rather than inferring its layout from the console:

    $ setxkbmap -query
    

    If setxkbmap is installed, a temporary layout change can validate an XKB layout and variant for that Xorg session. Persistence belongs in the desktop environment, display manager, or a narrow Xorg input configuration, not in the console keymap variable.

    Keep Xorg input snippets limited to the keyboard match and the verified XkbLayout, XkbVariant, and XkbOptions values. A catch-all input rule can alter keyboards, accessibility devices, remote sessions, or hot-plugged hardware unexpectedly. The Xorg or Wayland guide establishes which session stack is active.

    Configure Wayland input through the compositor #

    Native Wayland clients receive keyboard configuration from the compositor. setxkbmap changes Xorg and can affect Xwayland, but it is not a general native-Wayland configuration tool.

    Use the installed compositor’s current FreeBSD package documentation and configuration syntax for layout, variant, and compose options. Test the compositor’s reload or a separate session before replacing a working login configuration. Desktop-environment settings can override or regenerate compositor configuration, so keep one owner for the persistent layout.

    Input methods for languages that need composition or candidate selection are another layer. Select a packaged input method that supports the session protocol and application toolkit, then test it in both native and compatibility applications. A locale alone does not start an input-method daemon.

    Set the system time zone #

    tzsetup(8) installs the selected zone as the system default and records it for later base-system updates. Use a name found under /usr/share/zoneinfo. A no-write check validates the proposed zone without changing files:

    # tzsetup -n Region/City
    

    After verifying the region and city, apply the same explicit zone:

    # tzsetup Region/City
    $ date
    

    Record the prior /var/db/zoneinfo value so the same command can restore it. Do not replace /etc/localtime by hand when tzsetup can maintain both the zone file and update record.

    Changing the system time zone affects the default display of civil time; it does not change the underlying instant. Individual processes can use a TZ environment variable and some applications maintain an independent preferred zone. Verify cron jobs, databases, logs, and calendaring applications separately when their interpretation of local time matters.

    Separate time zone from clock correction #

    If the displayed hour is offset by a whole number of hours but minutes and seconds are correct, inspect the zone first. If the clock drifts or the underlying instant is wrong, inspect the configured synchronization service and upstream reachability.

    FreeBSD’s base ntpd can be enabled through rc.conf when Network Time Protocol is the selected design:

    # sysrc ntpd_enable=YES
    # service ntpd start
    # service ntpd status
    

    Do not run multiple time-synchronization daemons against the same clock. Stepping a badly wrong production clock can affect logs, certificates, databases, and scheduled work, so follow ntpd(8) policy and application requirements before forcing a correction.

    The hardware clock’s UTC-versus-local-time policy is separate again. tzsetup can account for systems whose hardware clock is not UTC, but changing that policy can break dual-boot expectations. Record whether /etc/wall_cmos_clock exists and consult adjkerntz(8) before changing it.

    Verify a complete session #

    After the next login and controlled reboot, verify:

    • locale reports only intended category overrides;
    • console input works before any graphical session starts;
    • the Xorg or Wayland layout works in native applications and compatibility applications;
    • date reports the intended zone and civil time;
    • one time-synchronization service owns clock correction;
    • scheduled tasks and logs retain the intended time semantics.

    The maintainable desktop baseline provides the wider package, display, and service boundary for a graphical installation.

    Primary references #

    • FreeBSD Handbook: Localization
    • FreeBSD Handbook: Installing FreeBSD
    • FreeBSD Handbook: The X Window System
    • FreeBSD Handbook: Wayland
    • locale(1)
    • login.conf(5)
    • cap_mkdb(1)
    • kbdmap(1)
    • rc.conf(5)
    • tzsetup(8)
    • adjkerntz(8)
    • ntpd(8)

    Independent documentation. Not affiliated with or endorsed by the FreeBSD Project or the FreeBSD Foundation.

    Report a bug
    • Synopsis
    • Inventory the current state
    • Select and test a locale
    • Make a per-account locale persistent
    • Test and retain a console keymap
    • Configure Xorg input separately
    • Configure Wayland input through the compositor
    • Set the system time zone
    • Separate time zone from clock correction
    • Verify a complete session
    • Primary references