Fact-checked by Grok 2 weeks ago

Xephyr

Xephyr is a kdrive-based that implements the X11 display server protocol by targeting a on a host as its , enabling nested X sessions within an existing graphical environment. Developed by Matthew Allum and first released on September 10, 2004, as part of the X.Org project, Xephyr was created to address limitations in earlier nested server tools like Xnest by providing support for modern X extensions including Composite, , and RandR, while initially forgoing features like for acceleration—support for which has since been added through integrations such as GLAMOR. It utilizes efficient mechanisms such as SHM XImages and shadow updates for rendering, allowing it to function as a full embedded in a host rather than a mere . Xephyr's primary applications include testing and developing window managers, debugging toolkit and internals, and isolating misbehaving applications—such as those that disrupt focus or require specific X configurations—without impacting the main session. It is invoked via command-line options like -screen to set dimensions and -ac for , often paired with tools like xinit to launch sessions, and includes debugging aids such as visual overlays for screen updates toggled by signals. Available in major distributions through packages like xorg-server-xephyr, it remains a lightweight utility for multi-user or experimental X11 setups on single machines.

Overview

What is Xephyr?

Xephyr is an X11 display server software that implements the X11 protocol, based on the KDrive architecture, and operates by targeting a window on a host as its to enable nested display functionality. At its core, Xephyr runs as an ordinary X application within an existing X environment, facilitating the execution of isolated X sessions confined to a single window on the host display, which supports modern X extensions unlike earlier nested servers such as Xnest. Xephyr is distributed under the and is primarily implemented in the .

Primary Applications

Xephyr is primarily utilized in and testing environments to run X11 applications and within an isolated nested X session, preventing any disruption to the host desktop. This containment allows developers to prototype, configure, and validate graphical interfaces or desktop environments safely, leveraging Xephyr's ability to act as a full embedded in a host window. For instance, it facilitates the evaluation of window manager behaviors or application rendering without requiring dedicated hardware or risking system-wide changes. A key application lies in graphical issues and simulating display configurations, such as setups, all rendered within a single host . Through its support for the RandR extension, Xephyr enables dynamic screen resizing and virtual , aiding in the testing of applications under varied output scenarios. Additionally, its built-in visual paints temporary rectangles over screen regions prior to content rendering, allowing developers to detect inefficiencies like redundant repaints in toolkits; this feature is toggled with the SIGUSR1 signal and can be paused via the XEPHYR_PAUSE for detailed inspection. Xephyr also provides a practical for X11 forwarding over SSH when remote server policies prohibit direct X access. In such cases, it runs locally to establish a dedicated (e.g., :2), and SSH forwards a connection to this , enabling remote applications to appear and operate securely within an isolated local window without exposing the primary host .

History

Development Origins

Xephyr was originally developed by Matthew Allum as part of the under the initiative, aiming to provide an improved solution for nested environments. The project began in , with its initial announcement and release occurring in of that year, specifically on September 10, 2004, as documented in the project's . This timing aligned with efforts to modernize tools within the open-source community. Xephyr emerged primarily as a response to the limitations of existing nested servers like Xnest, which functioned as an X proxy and lacked support for contemporary extensions such as Composite, , and RandR. Motivated by the need for a lightweight, full-fledged that could render to a window on a host display using fast XImages, Allum designed Xephyr on the KDrive architecture to enable better extension handling in nested contexts. This approach facilitated applications like development, toolkit with visual modes, and server internals testing without additional hardware, while also supporting multiterminal setups for multi-user environments on single machines.

Key Milestones

Xephyr has been a component of the X.Org Server releases since its early development, providing nested X server functionality within the broader X Window System ecosystem. In the release notes for X11R7.7, announced in June 2012, developers noted that Xephyr, Xnest, and other nested servers like Xvfb and Xfake might be replaced in future versions by the xf86-video-nested and xf86-video-dummy drivers integrated directly into the standard X.Org server, aiming to streamline nested and virtual display capabilities. A significant enhancement came with the release of 1.16.0 on July 17, 2014, which integrated Glamor rendering acceleration into Xephyr, enabling hardware-accelerated 2D operations and improving performance for nested sessions without frequent software fallbacks. This update marked a key advancement in Xephyr's rendering efficiency, leveraging for better compatibility with modern graphics hardware. Xephyr continues to be maintained as part of the X.Org Server, with security updates in versions up to 21.1.12 as of 2024, and remains available in major Linux distributions without the proposed replacement being implemented.

Technical Foundations

KDrive Architecture

KDrive is a lightweight X server framework developed within the X.Org project, designed primarily for embedded systems and specialized applications where minimal resource consumption and simplicity are paramount. Unlike the full-featured X.Org server, KDrive emphasizes a streamlined architecture by focusing on core X11 protocol handling while reducing dependencies on complex hardware drivers and unnecessary extensions, making it suitable for environments with limited computational power or memory. This minimalism is achieved through a modular Device Dependent X (DDX) layer that allows for targeted implementations without the overhead of the broader Xfree86 codebase. Xephyr, as a kdrive-based , exploits this modular structure to render output directly into a on an existing host X display, treating the host as its virtual framebuffer rather than interfacing with physical hardware. This approach enables nested X sessions by leveraging KDrive's flexible hooks and acceleration primitives, such as those in the Kdrive Acceleration Architecture (), to manage rendering without requiring a separate . By integrating with the host's (SHM) mechanisms, Xephyr avoids the performance bottlenecks of traditional proxy-based nesting solutions like Xnest. A pivotal element in Xephyr's efficiency for nested scenarios is its use of a shadow framebuffer, which maintains an offscreen buffer mirroring the display content to minimize redundant updates to the host window. This technique, combined with SHM Images for fast data transfer, allows only changed regions to be blitted to the host, reducing and usage in dynamic environments. The shadow framebuffer approach aligns with KDrive's emphasis on optimized , ensuring smooth operation even under high update frequencies typical of interactive sessions.

Integration with X.Org

Xephyr is distributed as a component of the package suite, enabling its inclusion in various distributions. For instance, in , users install it via the xorg-server-xephyr subpackage, which depends on the core xorg-server and provides the nested X server functionality as an X application. This packaging approach ensures seamless integration with the broader X.Org ecosystem, allowing Xephyr to leverage shared libraries and build tools from the main server distribution. Xephyr's compatibility with X.Org's development aligns closely with the server's evolution, particularly in adopting features. Since 2014, it has supported the for 2D rendering acceleration using , enhancing performance in nested environments without requiring protocol relaying like its predecessor Xnest. This integration was achieved through targeted patches to enable Glamor in Xephyr, ensuring it benefits from modern graphics hardware while remaining rooted in the KDrive architecture. Xephyr receives ongoing maintenance as part of releases, with updates addressing bugs, build improvements, and extension compatibility up to version 21.1.20 (as of October 2025). Although 2012 discussions considered removing the KDrive framework underlying Xephyr due to overlapping functionality with other servers, these plans were not pursued, preserving its role in the ecosystem.

Capabilities

Extension Support

Xephyr provides robust support for several key X11 extensions, enabling advanced features in nested X server environments. The Composite extension allows for window compositing, which facilitates the creation of layered visual effects and supports compositing window managers by enabling off-screen rendering and redirection of window contents. The Damage extension enhances efficiency by tracking and reporting only the regions of the screen that have changed, reducing unnecessary redraws and optimizing update processes in dynamic displays. Additionally, the RandR (Resize and Rotate) extension enables dynamic reconfiguration of screen resolutions, rotations, and setups without restarting the server, providing flexibility for varied display needs. A significant advantage of Xephyr is its independence from the host X server's extension availability; it implements these extensions internally, ensuring full functionality even when the host lacks support, which contrasts with proxy-based tools like Xnest that inherit host limitations. This design allows developers and users to test modern X11 applications in isolated nested sessions without relying on the underlying system's capabilities. Xephyr includes a visual debugging mode specifically for inspecting extension behaviors and screen update processes during development. Activating this mode by sending a SIGUSR1 signal to the server process (e.g., via pkill -USR1 Xephyr) overlays red rectangles on areas being repainted, offering a clear visual representation of how extensions like and Composite handle rendering and updates. This feature aids in and verifying the correct operation of extension-driven features in .

Optimization Techniques

Xephyr employs (SHM) images to facilitate efficient data transfer between the host and the nested server instance. By utilizing the MIT-SHM extension, Xephyr allocates shared memory segments for operations, allowing direct access without the need for repeated data copying over the X protocol, which significantly reduces latency in rendering updates. Another core optimization involves shadow updates, where Xephyr maintains an off-screen shadow buffer that tracks only the modified regions of the display. This technique avoids redundant drawing by propagating solely the differential changes to the host window, thereby minimizing computational overhead and improving overall responsiveness in nested sessions. For mitigating visual inconsistencies during dynamic operations like window resizing, Xephyr includes the -br command-line option to enable background repainting with a solid black color. This ensures that exposed areas are promptly filled, reducing artifacts such as flickering or residual image remnants that could otherwise degrade the . These performance enhancements rely on underlying X protocol extensions, including MIT-SHM, to enable seamless integration with the host environment.

Practical Usage

Setup and Installation

Xephyr is typically installed via the of major distributions, as it is distributed as part of the suite. On , the package is named xorg-server-xephyr and can be installed using pacman -S xorg-server-xephyr. On and systems, the package is xserver-xephyr, installable via apt install xserver-xephyr. For , the equivalent package is xorg-x11-server-Xephyr, available through dnf install xorg-x11-server-Xephyr. Installation requires core X.Org libraries, including libX11, libXext, libXrender, and related dependencies for rendering and input handling, which are usually pulled in automatically by the . In certain configurations, such as or headless setups, additional drivers like xf86-video-dummy may be needed to provide a . After installation, verify the setup by running Xephyr -version in , which displays the server version and confirms the binary is accessible in the system's . Successful output indicates that Xephyr is ready for use, with no further compilation or configuration required in standard environments.

Running Nested Sessions

To launch a nested X session using Xephyr, execute the command Xephyr -br -ac -noreset -screen 800x600 :1 in a on the host , which starts the server in a windowed mode with a black background, disables for simplicity, prevents automatic resets, sets the screen to 800x600 pixels, and assigns it to number :1. This creates an embedded window that serves as the root for the nested environment, allowing independent X operations within the host session. Once Xephyr is running, applications can be launched inside the nested session by prefixing the command with DISPLAY=:1, such as DISPLAY=:1 xterm to open a terminal emulator. Similarly, a full desktop environment or window manager can be initiated with DISPLAY=:1 i3 (replacing i3 with the desired window manager like Openbox or Fluxbox), which starts the session manager within the Xephyr window and handles window placement and input routing exclusively for that display. These commands direct graphical output and events to the nested display, isolating the session from the host's primary X server. Input handling in Xephyr defaults to automatic grabbing of the and upon cursor entry into the , ensuring focused with the nested session; to release or recapture input, press Ctrl+Shift, which toggles the grab state and allows seamless switching between and nested environments without closing the . This mechanism supports efficient management of , particularly useful for testing configurations or running untrusted applications, though it may require the -no-host-grab option if grabbing interferes with shortcuts.

Configuration Tips

Xephyr supports several command-line options to tailor its behavior for specific use cases, such as disabling access controls or preventing automatic resets. The -ac option disables access control mechanisms on the host, allowing unrestricted connections from clients, which is useful in development or testing environments where security restrictions might otherwise interfere. Similarly, the -noreset flag instructs the server not to reset upon client disconnection, ensuring persistent sessions even if individual applications exit unexpectedly. These options can be combined with display specifications, for example: Xephyr :1 -ac -noreset -screen 1024x768. When integrating Xephyr with desktop environments like , configuring window rules helps avoid conflicts with host-level input handling. In , users can create a window rule via > Window Management > Window Rules to ignore global shortcuts for the Xephyr window, enabling seamless use of intra-session navigation like without interference from the host environment. This rule applies the "Ignore global shortcuts" attribute, which can be set to "Force" for consistent behavior across sessions. For automated session management, Xephyr can be launched via startx to initialize a nested X session directly. The command startx -- /usr/bin/Xephyr :1 passes Xephyr as the server argument to xinit, starting the display on :1 while executing the default client script, which simplifies testing window managers or desktop environments without manual intervention. This approach is particularly effective for scripted workflows, though users should verify the Xephyr binary path matches their system installation.

Challenges and Alternatives

Known Limitations

Xephyr's implementation relies on software rendering for support, which lacks and leads to suboptimal performance in graphics-intensive applications such as 3D games or rendering tasks. This approach utilizes software-based renderers like llvmpipe, resulting in low frame rates and increased CPU usage compared to native hardware-accelerated environments. In certain desktop environments, Xephyr encounters input focus challenges, where and events may not be consistently captured within the nested window, often requiring users to manually toggle input grabbing via the Ctrl+ combination. This toggle mechanism, while functional, can interfere with system-wide shortcuts and lead to usability friction during session management. The mainline version of Xephyr does not provide native for or other graphics extensions, limiting its suitability for high-performance rendering scenarios. However, a forked implementation developed by Feng Haitao introduces acceleration through DRI2 forwarding, addressing some of these constraints in specialized setups. Despite these limitations, Xephyr remains maintained and available in major distributions as of 2025, with ongoing security updates such as fixes for use-after-free vulnerabilities.

Comparisons to Similar Tools

Xephyr distinguishes itself from Xnest, an earlier nested , primarily through its robust support for contemporary X11 extensions. While Xnest functions by proxying protocol requests to the host , thereby inheriting the host's extension capabilities, Xephyr operates as a kdrive-based server that renders directly to an X image on the host display. This allows Xephyr to provide independent implementation of extensions like Composite, , and RandR, even if the host server lacks them, making it more suitable for modern desktop environments and testing scenarios. In comparison to Xwayland, Xephyr maintains a strictly X11-centric approach for embedding full X sessions, whereas Xwayland integrates as a client to enable individual X11 applications within a compositor without requiring a complete nested X . This positions Xephyr as a tool for preserving legacy X11 compatibility in nested contexts, avoiding the protocol translation overhead of Xwayland while forgoing native features like improved security isolation between clients. The xf86-video-nested driver provides an integrated alternative to standalone servers like Xephyr and Xnest by leveraging the core X server's paths where available. Designed as a video driver for the , it facilitates running a nested X instance atop another Xorg or alternative backend.

References

  1. [1]
    Xephyr(1) manual page - X.Org
    Xephyr is a kdrive server that outputs to a window on a pre-existing host X display. Think Xnest but with support for modern extensions like composite, damage ...
  2. [2]
    Xephyr - Freedesktop.org
    May 18, 2013 · Xephyr is a kdrive based X Server which targets a window on a host X Server as its framebuffer. Unlike Xnest it supports modern X extensions.
  3. [3]
    Xephyr - ArchWiki
    Jun 12, 2023 · Xephyr is a nested X server that runs as an X application. This may be useful to workaround a badly written application.
  4. [4]
    Xephyr(1) - Arch manual pages
    Xephyr is a kdrive server that outputs to a window on a pre-existing "host" X display. Think Xnest but with support for modern extensions like composite, damage ...Missing: definition | Show results with:definition
  5. [5]
    Licenses - X.Org
    This is a slight variant of the common MIT license form published by the Open Source Initiative at https://www.opensource.org/licenses/mit-license.php.
  6. [6]
    xserver-xephyr — Debian testing
    Jun 20, 2025 · Xephyr is a kdrive server that outputs to a window on a pre-existing "host" X display. Think Xnest but with support for modern extensions like ...
  7. [7]
    Forwarding X11 over SSH if the server configuration doesn't allow it
    May 6, 2011 · Use SSH to forward a remote socket to the Xephyr socket. SSH supports forwarding Unix sockets, too. Set the environment variables on the ...x11 - Forwarding an entire desktop over SSH without third party toolsHow to forward X over SSH to run graphics applications remotely?More results from unix.stackexchange.com
  8. [8]
  9. [9]
    [ANN] Xephyr kdrive backend - Mailing Lists - Freedesktop.org
    Sep 17, 2004 · [ANN] Xephyr kdrive backend. Matthew Allum mallum at gmail.com. Fri Sep 17 05:40:24 PDT 2004. Previous message: Panel resolution derivation ...
  10. [10]
    Index of /releases/individual/xserver - X.Org
    Index of /releases/individual/xserver ; xorg-server-1.0.1.tar.bz2, 2006-01-18 23:51, 5.7M ; xorg-server-1.0.1.tar.gz, 2006-01-18 23:51, 7.7M ; xorg-server-1.0.2.Missing: Xephyr milestones
  11. [11]
    Release Notes for X11R7.7 - X.Org
    These may be replaced in a future release by use of the Xorg server with the xf86-video-nested and xf86-video-dummy drivers which perform the same tasks.
  12. [12]
    [ANNOUNCE] xorg-server 1.16.0 - Mailing Lists
    ... 0. Keith Packard keithp at keithp.com. Thu Jul 17 00:28:51 PDT 2014 ... At long last, here's the 1.16 release of the X server! Lots of new stuff, including (but not limited to): * Glamor integration.Missing: enhancements | Show results with:enhancements
  13. [13]
    [PDF] High Performance X Servers in the Kdrive Architecture - USENIX
    This paper describes changes made to the Kdrive X server implementation to implement new 2D acceleration, improve management of offscreen memory, implement.
  14. [14]
    xorg-server-xephyr 21.1.20-1 (x86_64) - Arch Linux
    License(s):, BSD-3-Clause, HPND, HPND-sell-variant, ICU, ISC, LicenseRef-Adobe-Display-PostScript, LicenseRef-DEC-3-Clause, LicenseRef-HPND-sell-MIT ...
  15. [15]
    glamor: Enabling xephyr and Xorg. - x.org Mailing Lists
    Feb 24, 2014 · Next message: [PATCH 1/6] xephyr: Build support for rendering with glamor using a -glamor option. Messages sorted by: [ date ] [ thread ] ...[Pull Request] Glamor: A 2D rendering acceleration implementation ...[PULL] glamor xephyr and xorg changes - Mailing ListsMore results from lists.x.org
  16. [16]
    GLAMOR Xephyr & DRI3 Support Called For Pulling - Phoronix
    Mar 5, 2014 · The Xephyr GLAMOR code and code that adds DRI3 support to GLAMOR has been called to be pushed into the xorg-server code-base for X.Org Server ...Missing: rendering | Show results with:rendering
  17. [17]
    [PULL to discuss] Remove kdrive, Xnest, and Xvfb - x.org Mailing Lists
    Mar 2, 2016 · [PULL to discuss] Remove kdrive, Xnest, and Xvfb. Jeremy Huddleston jeremyhu at apple.com. Mon Mar 26 16:13:46 PDT 2012.Don't discard one-time driver structure at server reset[PATCH 1/3] kdrive: fix "set but not used" warnings - x.org Mailing ListsMore results from lists.x.orgMissing: deprecation 2013
  18. [18]
    Debian -- Details of package xserver-xephyr in sid
    Xephyr is an X server that can be run inside another X server, much like Xnest. It is based on the kdrive X server, and as a result it supports newer extensions ...Missing: definition MIT
  19. [19]
  20. [20]
    xephyr(1) - Linux man page - Die.net
    Xephyr is a kdrive server that outputs to a window on a pre-existing host X display. Think Xnest but with support for modern extensions like composite, damage ...
  21. [21]
    xephyr man - Linux Command Library
    For example, -screen 800x600. -resizeable. Allows the xephyr window to be resized by the host window manager, which in turn resizes the X screen within xephyr.
  22. [22]
    XSERVER(1) manual page - X.Org
    Server-specific man pages: Xorg(1) , Xdmx(1) , Xephyr(1) , Xnest(1) , Xvfb(1) , XDarwin(1) , XWin(1) . Server internal documentation: Definition of the ...<|control11|><|separator|>
  23. [23]
    Attributes
    Make the window read-only. Toggle whether to ignore global shortcuts (as defined by System Settings → Shortcuts and Gestures → Global Shortcuts or by running ...
  24. [24]
    XINIT(1) manual page
    ### Summary: Specifying Custom X Server with xinit or startx
  25. [25]
    Multiseat - X.Org
    Aug 25, 2013 · The Xephyr's approach is known to work with “any” video card vendor but lacks some extensions (3D, OpenGL) and has the latency for being nested ...
  26. [26]
    Xephyr: Low FPS inside 3D accelerated games
    Jan 15, 2017 · Xephyr does not support hardware acceleration. Instead, software rendering with llvmpipe is used, as your output shows.Xephyr - no gpu acceleration? - Unix & Linux Stack ExchangeUsing software OpenGL rendering with XMore results from unix.stackexchange.comMissing: limitations | Show results with:limitations
  27. [27]
    How to change default behavior of Xephyr for capturing ... - Super User
    May 7, 2011 · Is it possible to change the default hotkeys for mouse/keyboard grabbing in Xephyr? Ideally, I would like a VirtualBox-like behavior: Xephyr ...Missing: initial | Show results with:initial
  28. [28]
    Mouse and keyboard not getting captured by Xephyr
    Feb 15, 2022 · For Xephyr 21.1.3 - 21.1.6 (e.g. xserver-xephyr 2:21.1.3, Ubuntu 22.04.1) unset XDG_SEAT to make input devices work again:Missing: initial | Show results with:initial<|control11|><|separator|>
  29. [29]
    fenghaitao/xserver-with-gl-accelerated-xephyr - GitHub
    Xephyr with GL acceleration by DRI2 forwarding. Contribute to fenghaitao/xserver-with-gl-accelerated-xephyr development by creating an account on GitHub.Missing: Feng Haitao
  30. [30]
    Chapter 5. X11 Application Support - Wayland
    Xwayland is a complete X11 server, just like Xorg is, but instead of driving the displays and opening input devices, it acts as a Wayland client.
  31. [31]
    xorg/driver/xf86-video-nested - driver to run ... - freedesktop.org git
    driver to run Xorg on top of Xorg or something else (mirrored from https://gitlab.freedesktop.org/xorg/driver/xf86-video-nested), anholt. summaryrefslogtree ...