13.1. 配置 X11 服务
A brief reminder: X.org is the software component that allows graphical applications to display windows on screen. It includes a driver that makes efficient use of the video card. The features offered to the graphical applications are exported through a standard interface, X11 (Buster contains version X11R7.7).
观点 X11, XFree86 and X.org
X11 is the graphical system most widely used on Unix-like systems (also available for Windows and Mac OS). Strictly speaking, the term “X11” only refers to a protocol specification, but it is also used to refer to the implementation in practice.
X11 had a rough start, but the 1990s saw XFree86 emerge as the reference implementation because it was free software, portable, and maintained by a collaborative community. However, the rate of evolution slowed down near the end when the software only gained new drivers. That situation, along with a very controversial license change, led to the X.org fork in 2004. This is now the reference implementation, and Debian Buster uses X.org version 7.7.
Current versions of X.org are able to autodetect the available hardware: this applies to the video card and the monitor, as well as keyboards and mice; in fact, it is so convenient that the package no longer even creates a /etc/X11/xorg.conf
configuration file.
键盘的配置保存在 /etc/default/keyboard
。该文件用于配置文本控制台也用于图形界面,由keyboard-configuration 处理。配置键盘布局的细节在第 8.1.2 节 “键盘配置”中。
xserver-xorg-core 软件包提供X.org 7.x系列的通用X 服务。该服务是模块化的并使用一套相互独立的驱动来处理很多不同类型的显卡。安装 xserver-xorg 确保服务和至少一种显卡驱动被安装。
Note that if the detected video card is not handled by any of the available drivers, X.org tries using the vesa
and fbdev
drivers. VESA is a generic driver that should work everywhere, but with limited capabilities (fewer available resolutions, no hardware acceleration for games and visual effects for the desktop, and so on) while fbdev
works on top of the kernel’s framebuffer device. Nowadays the X server can run without any administrative privileges (this used to be required to be able to configure the screen) and its log file is then stored in the user’s home directory in ~/.local/share/xorg/Xorg.0.log
, whereas it is /var/log/Xorg.0.log
for X servers started with root privileges and for versions older than Debian 9 Stetch. That log file is where one would look to know what driver is currently in use. For example, the following snippet matches what the intel
driver outputs when it is loaded:
- (==) Matched intel as autoconfigured driver 0
- (==) Matched modesetting as autoconfigured driver 1
- (==) Matched vesa as autoconfigured driver 2
- (==) Matched fbdev as autoconfigured driver 3
- (==) Assigned the driver to the xf86ConfigLayout
- (II) LoadModule: "intel"
- (II) Loading /usr/lib/xorg/modules/drivers/intel_drv.so
其他 专利驱动
Some video card makers (most notably NVIDIA) refuse to publish the hardware specifications that would be required to implement good free drivers. They do, however, provide proprietary drivers that allow using their hardware. This policy is nefarious, because even when the provided driver exists, it is usually not as polished as it should be; more importantly, it does not necessarily follow the X.org updates, which may prevent the latest available driver from loading correctly (or at all). We cannot condone this behavior, and we recommend you avoid these makers and favor more cooperative manufacturers.
If you still end up with such a card, you will find the required packages in the non-free section: nvidia-driver for NVIDIA cards. It requires a matching kernel module. Building the module can be automated by installing the package nvidia-kernel-dkms (for NVIDIA).
The “nouveau” project aims to develop a free software driver for NVIDIA cards and is the default driver that you get for those cards in Debian. In general, its feature set and performance do not match the proprietary driver. In the developers’ defense, we should mention that the required information can only be gathered by reverse engineering, which makes things difficult. The free drivers for ATI video cards, called “radeon” and “amdgpu”, are much better in that regard although it often requires non-free firmware from the firmware-amd-graphics package.