OpenBSD Handbook

    Theme
    • Part I. Install & Configure
      • Introduction to OpenBSD
      • Installing OpenBSD
      • The X Window System
      • The Wayland Display System
      • Networking on OpenBSD
      • System Configuration
      • OpenBSD Basics
      • Managing Software: Packages and Ports
    • Part II. Daily Operations
      • OpenBSD Desktop Environments
      • Multimedia
      • Printing
      • Linux Compatibility
      • Windows Compatibility
      • Games
    • Part III. System Administration
      • Virtualization
      • Storage and File Systems
      • Updating and Upgrading
      • Localization
      • The OpenBSD Boot Process
      • Security
    • Part IV. Networking & Daemons
      • Services
        • Database
          • MariaDB
          • PostgreSQL
          • Redis
          • memcached
        • Directory
          • YP (NIS)
          • LDAP
        • File
          • NFS
          • Samba
        • FTP Services
          • ftpd
          • ProFTPD
          • vsftpd
          • Pure-FTPd
          • TFTP
        • Mail
          • OpenSMTPD Mail Server
          • Dovecot IMAP and POP3 Server
          • Postfix
          • Exim
          • Rspamd
        • Name
          • Unbound DNS Resolver
          • NSD Authoritative DNS Server
          • BIND DNS Server
        • Networking
          • OpenBGPD
          • rad
          • DHCP on OpenBSD
          • slaacd
        • Web
          • Apache HTTP Server
          • nginx Web Server
          • OpenBSD httpd Web Server
          • relayd Reverse Proxy
        • Logging
          • syslogd
        • Monitoring
          • SNMP
        • Remote Access
          • Audit OpenSSH
          • OpenSSH Server
        • File Synchronization
          • rsync
        • Messaging
          • RabbitMQ Message Broker
        • Time
          • NTP Time Synchronization
        • Load Balancing
          • Build Redundant Load-Balanced Gateways
          • Load Balance Services with NAT or DSR
          • Build an HA HTTPS Load Balancer
      • PF
        • pfctl cheat sheet
        • PF Anchors
        • PF Filter Rules
        • PF Forwarding
        • PF Lists and Macros
        • PF Load Balancing
        • PF Logging
        • PF NAT
        • PF Options
        • PF Policies
        • PF Shortcuts
        • PF Tables
      • Advanced Networking
        • High Availability and State Replication
        • Multi-WAN and Policy-Based Routing
        • VPN and Cryptographic Tunneling
        • Classic and Lightweight Tunnels
        • IPv6 at Scale
        • QoS and Traffic Shaping
        • MPLS and Label Distribution
        • Network Services at Scale
        • Virtualization and Host Networking
        • Large-Scale L2 and L3 Design
        • Telemetry, Logging, and Flow Export
        • Hardening and Operational Safety
        • Reference Architectures
        • Troubleshooting Playbooks
      • Serial Communication
    • Part V. Miscellaneous
      • Virtualization Cheat Sheet
      • OpenBSD Cheatsheet
      • How-to Guides
        • Installation and First Boot
          • Complete the First 30 Minutes After Installation
          • Check Hardware Compatibility Before Installing
          • Bootstrap Wi-Fi Firmware Without Ethernet
          • Run OpenBSD as a Virtual Machine Guest
          • Install OpenBSD on a VPS or Cloud Server
          • Install OpenBSD with Full-Disk Encryption
          • Run FreeBSD on OpenBSD with vmd
          • Dual-Boot OpenBSD on a UEFI System
          • Automate OpenBSD Installation with Autoinstall and PXE
        • Desktops and Laptops
          • Set Up OpenBSD as a Laptop or Workstation
          • Configure Laptop Power Management
          • Troubleshoot Web Browsers on OpenBSD
          • Run Sway on OpenBSD
          • Use Plan 9 Tools on OpenBSD
          • Build a Minimal Desktop with suckless Tools
          • Install Z shell (zsh)
        • Networking and Remote Access
          • Create an Administrator Account with doas and SSH Keys
          • Configure Secure Remote Access with OpenSSH
          • Use FIDO Security Keys with OpenSSH
          • Configure Wi-Fi Roaming and Wired Failover
          • Troubleshoot PF, NAT, and Routing
          • Route Multiple VLANs with PF
          • Configure a Road-Warrior WireGuard VPN
          • Route IPv6 Networks without NAT
          • Test OpenBGPD with Two Providers
          • Unlock an Internal Service with an SSH Key
          • Build a Simple Router and Firewall
        • Servers and Services
          • Set Up WordPress on OpenBSD
          • Build a Mail Server with OpenSMTPD, Dovecot, and Rspamd
        • Security, Maintenance and Recovery
          • Establish a Conservative Security Baseline
          • Recover Access and Reset the Root Password
          • Collect OpenBSD Diagnostic Evidence
          • Troubleshoot Package Installation and Update Failures
          • Schedule Recurring Maintenance
          • Monitor an OpenBSD System
          • Back Up and Restore an OpenBSD System
          • Configure softraid RAID1
          • Recover an OpenBSD System That Does Not Boot
        • Building, Automation and Virtual Machines
          • Manage OpenBSD with Ansible
          • Build Third-Party Software from Ports
          • Build OpenBSD from Source
          • Plan a Docker Workload Migration to OpenBSD
      • OpenBSD for Linux Users
      • OpenBSD for FreeBSD Users
      • OpenBSD for macOS Users
    • OpenBSD FAQ
    • OpenBSD Handbook Style Guide
    • OpenBSD Architectures
      • OpenBSD Package Search
        • Synopsis
        • Install and Configure Sway
        • Start from a Text Console
        • Check the Session
        • Return to X11
        • References

        Run Sway on OpenBSD

        Synopsis #

        Install Sway and start a tiling Wayland session using the OpenBSD package launcher. For the display system, requirements, and other compositors, see The Wayland Display System .

        This guide follows the OpenBSD 8.0 amd64 Sway package. It requires a local text console, supported graphics hardware, and administrative access for package installation and stopping xenodm. Keep a working X11 session available while setting up Sway.

        Install and Configure Sway #

        Install the compositor and Xwayland for X11 applications:

        doas pkg_add sway xwayland
        less /usr/local/share/doc/pkg-readmes/sway
        

        Read the installed README before changing session startup. The package supplies /etc/sway/config and a sample under /usr/local/share/examples/sway/. For an account without an existing Sway configuration, copy the sample. Do not overwrite an existing configuration:

        mkdir -p ~/.config/sway
        cp /usr/local/share/examples/sway/config ~/.config/sway/config
        

        If XDG_CONFIG_HOME is set, use its sway/config path instead. The configuration defines the modifier key, terminal, application launcher, and exit binding. Read man 5 sway and check those bindings before leaving the current desktop. The OpenBSD sample selects xterm, which needs Xwayland.

        Start from a Text Console #

        Save work and log out of the graphical session first. Stopping xenodm terminates any remaining sessions it manages. From a local text console, stop it for this test without disabling startup at boot:

        doas rcctl stop xenodm
        

        Log in as the ordinary desktop account and run the package launcher:

        /usr/local/bin/startsway.sh
        

        The launcher sets OpenBSD-specific defaults, including the runtime directory and display device. Use it rather than copying Linux service or seat-management instructions. Do not run the desktop as root or make device nodes writable by everyone to bypass a startup error.

        Check the Session #

        From a terminal inside Sway, inspect the active displays:

        swaymsg -t get_outputs
        

        Confirm that the expected monitor appears, keyboard and pointer input work, and a terminal opens using the configured binding. Test required applications individually; a working compositor does not establish that every application uses Wayland natively.

        If startup fails, run the launcher with debug output from the text console:

        /usr/local/bin/startsway.sh -d > ~/sway.log 2>&1
        

        Check the log for the failing graphics device or input backend and compare it with the installed package README and dmesg. The supplied launcher defaults to /dev/dri/card0; a machine with multiple graphics devices can require a different selection. Inspect startsway.sh before customizing its environment.

        Return to X11 #

        Exit Sway using the binding in the configuration, then restart the display manager from the text console:

        doas rcctl start xenodm
        

        Keep the X11 configuration separate from ~/.config/sway/config. For other desktops and window managers, see OpenBSD Desktop Environments .

        References #

        • OpenBSD Sway package README
        • OpenBSD session launcher
        • Sway configuration manual
        Report a bug
        • Synopsis
        • Install and Configure Sway
        • Start from a Text Console
        • Check the Session
        • Return to X11
        • References