SDDM

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page SDDM and the translation is 18% complete.
Other languages:

Simple Desktop Display Manager (SDDM) 是 一款支持同时X serverWayland协议的现代显示管理器

Warning
默认情况下,点击SDDM中的“关机”(power off)图标将会立即关机,不会要求用户确认。

安装

USE标记

USE flags for x11-misc/sddm Simple Desktop Display Manager

+X Add support for X11
+elogind Enable session tracking via sys-auth/elogind
+pam Add support for PAM (Pluggable Authentication Modules) - DANGEROUS to arbitrarily flip
systemd Enable use of systemd-specific libraries and features like socket activation or session tracking
test Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)

Emerge

安装x11-misc/sddm:

root #emerge --ask x11-misc/sddm

如果出现任何显示问题,我们可能需要将sddm用户加入video用户组。

root #usermod -a -G video sddm

配置

文件

SDDM有两个配置路径:/usr/share/sddm/sddm.conf.d//etc/sddm.conf.d/用于覆盖特定选项。KDE Plasma会将用户修改写入/etc/sddm.conf.d/,两个位置支持的文件格式相同。关于可用选项的详细信息,请参阅man 5 sddm.conf man page

override.conf和Xsetup文件

Note
在大多数情况下,这些文件是不必须的。因此你可以跳过本节。

在某些配置案例中,我们需要在启动X server并显示欢迎屏幕之前执行一些命令。我们可以使用Xsetup文件,其位置必须被本地/etc/sddm.conf.d/override.conf覆盖。

Create local configuration directory if it does not exists:

root #mkdir -p /etc/sddm.conf.d

After that create and edit file /etc/sddm.conf.d/override.conf with following lines in it:

FILE /etc/sddm.conf.d/override.conf
[X11]
DisplayCommand=/etc/sddm/scripts/Xsetup

Next create the directory /etc/sddm/scripts and the file /etc/sddm/scripts/Xsetup:

root #mkdir -p /etc/sddm/scripts
root #touch /etc/sddm/scripts/Xsetup
root #chmod a+x /etc/sddm/scripts/Xsetup
FILE /etc/sddm/scripts/Xsetup
#!/bin/sh
# Xsetup - run as root before the login dialog appears
 
# Here can be various command that can be executed on SDDM start.

override.conf and X11 rootless mode

By default SDDM runs in X11 as the root user. This may be considered a security risk.

Since x11-misc/sddm version 0.20 it is possible to run SDDM in X11 rootless mode instead.

To accomplish this the Display server configuration must be overridden using the local /etc/sddm.conf.d/override.conf.

Create local configuration directory if it does not exists:

root #mkdir -p /etc/sddm.conf.d

After that create and edit file /etc/sddm.conf.d/override.conf with following lines in it:

FILE /etc/sddm.conf.d/override.conf
[General]
DisplayServer=x11-user

override.conf and wayland mode

Warning
Running SDDM in Wayland mode is highly experimental

Since x11-misc/sddm version 0.20 it is possible to run SDDM in Wayland mode.

Weston

SDDM supports several Wayland compositors. This first example uses SDDMs default compositor, Weston, for systems where kde-plasma/plasma-desktop is not used. First install dev-libs/weston with the fullscreen USE flag enabled.

Then the Display server configuration should be overridden in the local /etc/sddm.conf.d/override.conf.

Create local configuration directory if it does not exists:

root #mkdir -p /etc/sddm.conf.d

After that create and edit file /etc/sddm.conf.d/override.conf with following lines in it:

FILE /etc/sddm.conf.d/override.conf
[General]
DisplayServer=wayland
 
# This part is optional
[Wayland]
CompositorCommand=weston --shell=fullscreen-shell.so
Kwin

Users of systems using kde-plasma/plasma-desktop may want to use Kwin as the compositor instead:

FILE /etc/sddm.conf.d/override.conf
[General]
DisplayServer=wayland
GreeterEnvironment=QT_WAYLAND_SHELL_INTEGRATION=layer-shell
 
[Wayland]
CompositorCommand=kwin_wayland --drm --no-lockscreen --no-global-shortcuts --locale1

Keymap

To select the correct keymap on the login screen, add command setxkbmap to the /etc/sddm/scripts/Xsetup file:

FILE /etc/sddm/scripts/Xsetup
#!/bin/sh
# Xsetup - run as root before the login dialog appears
 
# ...
 
# First keymap will be gb
setxkbmap gb,us

The first country code is the default.

Multimonitor configuration

The greeter location can be set by xrandr configuration in SDDM's /etc/sddm/scripts/Xsetup script. First, install x11-apps/xrandr:

root #emerge --ask x11-apps/xrandr

Here xrandr reports that there are two connected monitors: primary (DP-4) and secondary (DP-2):

user $xrandr | grep -w connected
DP-2 connected 2160x3840+0+0 left (normal left inverted right x axis y axis) 597mm x 336mm
DP-4 connected primary 3840x2160+2160+0 (normal left inverted right x axis y axis) 697mm x 392mm

Add following lines to the /etc/sddm/scripts/Xsetup file:

FILE /etc/sddm/scripts/Xsetup
#!/bin/sh
# Xsetup - run as root before the login dialog appears
 
# ...
 
# First, set DP-4 as primary
xrandr --output DP-4 --auto --primary
# Second, DP-2 will be placed on left of DP-4 and rotated by 270 degree clockwise.
xrandr --output DP-2 --left-of DP-4 --rotate left --noprimary

After reboot SDDM will show the greeter in DP-4 monitor.

Service

OpenRC

If gui-libs/display-manager-init is not present, emerge it with:

root #emerge --ask gui-libs/display-manager-init

The configuration file should be modified to use SDDM:

FILE /etc/conf.d/display-managerSet SDDM as the display manager
CHECKVT=7
DISPLAYMANAGER="sddm"

In its default configuration, SDDM likely won't start without elogind. Enable and start it using:

root #rc-update add elogind boot
root #rc-service elogind start

To start the chosen display manager on boot, add the display-manager to the system's default runlevel:

root #rc-update add display-manager default

To start the display-manager immediately, run:

root #rc-service display-manager start

systemd

To start SDDM on boot:

root #systemctl enable sddm.service

To start SDDM now:

root #systemctl start sddm.service

Plasma

Graphical configuration is integrated in Plasma system settings by installing kde-plasma/sddm-kcm:

root #emerge --ask kde-plasma/sddm-kcm

Troubleshooting

Long load time before SDDM shows the greeter

A low entropy pool can cause long SDDM load time - see upstream bug report. If using systemd, the graphical target is reached and then everything appears to hang. Moving the mouse or using the keyboard will make the SDDM greeter launch (faster).

Solve the problem by using, for example, the sys-apps/haveged package to increase the entropy pool or by enabling RANDOM_TRUST_CPU kernel config option with a recent-enough CPU.

Permission denied errors in Xorg.log

The X server will not start and permission denied errors (such as the following) are present in the Xorg.log log file:

FILE /var/log/Xorg.log
/var/log/Xorg.0.log:[ 2058.998] (EE) /dev/dri/card0: failed to set DRM interface version 1.4: Permission denied
/var/log/Xorg.0.log:[ 2061.229] (EE) intel(0): [drm] failed to set drm interface version: Permission denied [13].

It is likely the sddm user has not been added to the video group. Running the following command should fix the problem:

root #usermod -a -G video sddm

Missing system buttons

SDDM only displays buttons if the functionality evaluates to being available. This can depend on several factors. For OpenRC systems using elogind, this can be caused by the service not running when the display manager is initialized. To make sure it is running, just add elogind to the boot run level.

root #rc-update add elogind boot

Missing users

If the login screen is missing some user(s) to choose from, this might be caused by /etc/sddm.conf - standard MinimumUid is 1000 and some existing users may have lower uids.

FILE /etc/sddm.conf
[Users]
MaximumUid=60000
MinimumUid=1000

SDDM service starts but yields a black screen

On NVIDIA cards, SDDM appears to require DRM enabled and operational according to this closed bug report.

Ensure Direct Rendering Manager is enabled in the kernel. If it isn't, enable it, rebuild the kernel, and re-emerge x11-drivers/nvidia-drivers.

KERNEL Enable Direct Rendering Manager
Device Drivers --->
    Graphics support --->
        <*> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) --->
            [*] Enable legacy fbdev support for your modesetting driver

Ensure the nvidia-drm module is configured to load at startup and modeset option enabled:

FILE /etc/modules-load.d/nvidia-drm.conf
nvidia-drm
options nvidia-drm modeset=1

Alternatively, modeset option can be enabled on the kernel command line with nvidia-drm.modeset=1. This can be set in the bootloader or embedded in the kernel configuration.

See also