我尝试在 Ubuntu 18.04.1 LTS 上启动第二个 xsession。我切换到tty3:Ctrl+Alt+F3然后执行以下命令:
export DISPLAY=:2
startx -- :2
但它失败了。日志。怎么了 ?同样的方法在 Ubuntu 16.04.5 LTS 上运行良好。
答案1
您的 DISPLAY=:2 技术适用于我的计算机,并且我同时运行两个 Xserver。我的 Xserver 是 1.20.3,因此应该仍然可以与您的 1.19.6 版本一起使用。我的电脑配备英特尔 iGPU。另外,我没有 Ubuntu,我使用没有 systemd 的 Linux dist,所以这可能会有所不同。
我查看了您的日志,发现 Xserver 在键盘部分之后关闭。我将其与 Xorg.2.log 进行了比较,想知道键盘是否存在混淆。尝试将其添加到 xorg conf 文件的键盘部分:
MatchProduct "Logitech HID compliant keyboard"
例如,这应该可以防止 Xserver 篡改电源按钮和睡眠按钮。例如,您的日志文件中的键盘型号和布局消息没有出现在我的有关电源按钮和睡眠按钮的日志文件中,我看到您的键盘在哪里被识别为键盘、指针和鼠标:
[ 42.146] (II) event4 - Logitech HID compliant keyboard: is tagged by udev as: Keyboard Mouse Joystick
也许 libinput 部分“忽略重复”正在删除键盘,因为键盘/PixArt 鼠标。另外,我注意到您在此处收到了来自 systemd 的消息:
[ 42.153] (II) systemd-logind: returning pre-existing fd for /dev/input/event4 13:68
这并不是一个答案,只是一些线索。 Xserver 将在没有输入设备的情况下终止,我认为它们由于重复而被删除。
编辑:这是我的/etc/X11/xorg.conf.d/50-keyboard.conf:
Section "InputClass"
Identifier "ASUS laptop keyboard"
MatchIsKeyboard "on"
MatchProduct "AT Translated Set 2"
Option "XkbModel" "asus_laptop"
Option "XkbLayout" "us"
Option "XkbOptions" "caps:none,terminate:ctrl_alt_bksp"
EndSection
编辑2:现在我看到触摸板的重复项被忽略,所以鼠标可能是不同的。您的 MatchIsKeyboard 仍然匹配电源按钮和睡眠按钮,所以这不好。我希望你能找出问题所在。除了键盘之外,您的日志的其余部分看起来与我的 DISPLAY=:2 类似。
EDIT3:您的 Xorg.2.log 是否仍然包含这些条目?
[ 42.142] (II) XINPUT: Adding extended input device "Sleep Button" (type: KEYBOARD, id 8)
[ 42.142] (**) Option "xkb_model" "pc105"
[ 42.142] (**) Option "xkb_layout" "pl"
[ 42.143] (II) event1 - Sleep Button: is tagged by udev as: Keyboard
[ 42.143] (II) event1 - Sleep Button: device is a keyboard
这没有出现在我的 Xorg.2.log 文件中。 libinput 键盘驱动程序处理许多事情,因此编辑 /usr/share/X11/xorg.conf.d 中的文件可能无法正常工作,并且在升级软件包时会被替换。
检查您的日志文件并查看键盘是否匹配。现在我认为 MatchProduct 只是一个子字符串,因此“Logitech”可能会更好,以防“兼容键盘”不匹配。
EDIT4:/usr/share/X11/xorg.conf.d/ 文件是系统文件,您应该将自己的配置文件放在 /etc/X11/xorg.conf.d 中,如果该目录不存在,则只需创建该目录。
如果正常的 startx 工作正常,我不确定这就是 DISPLAY=:2 问题的原因。我认为您的 Xorg 服务器配置不正确,只有在同时运行 2 个服务器时才会出现问题。否则,我没有发现您的 Xorg.2.log 信息有问题。
编辑5:
我现在有 4 个 Xserver 以相同的设置运行,并且可以使用 ctrl-alt F7 F8 F9 或 F10 切换到它们。我没有想法,除了以下设置可能有助于在每个设置上运行不同的设置,也许尝试这些设置可以让您的多个 Xserver 也运行:
use: X [:<display>] [option]
-a # default pointer acceleration (factor)
-ac disable access control restrictions
-audit int set audit trail level
-auth file select authorization file
-br create root window with black background
+bs enable any backing store support
-bs disable any backing store support
-c turns off key-click
c # key-click volume (0-100)
-cc int default color visual class
-nocursor disable the cursor
-core generate core dump on fatal error
-displayfd fd file descriptor to write display number to when ready to connect
-dpi int screen resolution in dots per inch
-dpms disables VESA DPMS monitor control
-deferglyphs [none|all|16] defer loading of [no|all|16-bit] glyphs
-f # bell base (0-100)
-fc string cursor font
-fn string default font name
-fp string default font path
-help prints message with these options
+iglx Allow creating indirect GLX contexts
-iglx Prohibit creating indirect GLX contexts (default)
-I ignore all remaining arguments
-ld int limit data space to N Kb
-lf int limit number of open files to N
-ls int limit stack space to N Kb
-nolock disable the locking mechanism
-maxclients n set maximum number of clients (power of two)
-nolisten string don't listen on protocol
-listen string listen on protocol
-noreset don't reset after last client exists
-background [none] create root window with no background
-reset reset after last client exists
-p # screen-saver pattern duration (minutes)
-pn accept failure to listen on all ports
-nopn reject failure to listen on all ports
-r turns off auto-repeat
r turns on auto-repeat
-render [default|mono|gray|color] set render color alloc policy
-retro start with classic stipple and cursor
-s # screen-saver timeout (minutes)
-seat string seat to run on
-t # default pointer threshold (pixels/t)
-terminate terminate at server reset
-to # connection time out
-tst disable testing extensions
ttyxx server started from init on /dev/ttyxx
v video blanking for screen-saver
-v screen-saver without video blanking
-wm WhenMapped default backing-store
-wr create root window with white background
-maxbigreqsize set maximal bigrequest size
+xinerama Enable XINERAMA extension
-xinerama Disable XINERAMA extension
-dumbSched Disable smart scheduling and threaded input, enable old behavior
-schedInterval int Set scheduler interval in msec
-sigstop Enable SIGSTOP based startup
+extension name Enable extension
-extension name Disable extension
-query host-name contact named host for XDMCP
-broadcast broadcast for XDMCP
-multicast [addr [hops]] IPv6 multicast for XDMCP
-indirect host-name contact named host for indirect XDMCP
-port port-num UDP port number to send messages to
-from local-address specify the local address to connect from
-once Terminate server after one session
-class display-class specify display class to send in manage
-cookie xdm-auth-bits specify the magic cookie for XDMCP
-displayID display-id manufacturer display ID for request [+-]accessx [ timeout [ timeout_mask [ feedback [ options_mask] ] ] ] enable/disable accessx key sequences
-ardelay set XKB autorepeat delay
-arinterval set XKB autorepeat interval
Device Dependent Usage
-config file specify a configuration file, relative to the xorg.conf search path, only root can use absolute
-configdir dir specify a configuration directory, relative to the xorg.conf.d search path, only root can use absolute
-verbose [n] verbose startup messages
-logverbose [n] verbose log messages
-quiet minimal startup messages
-fbbpp n set bpp for the framebuffer. Default: 8
-depth n set colour depth. Default: 8
-gamma f set gamma value (0.1 < f < 10.0) Default: 1.0
-rgamma f set gamma value for red phase
-ggamma f set gamma value for green phase
-bgamma f set gamma value for blue phase
-weight nnn set RGB weighting at 16 bpp. Default: 565
-layout name specify the ServerLayout section name
-screen name specify the Screen section name
-keyboard name specify the core keyboard InputDevice name
-pointer name specify the core pointer InputDevice name
-nosilk disable Silken Mouse
-flipPixels swap default black/white Pixel values
-disableVidMode disable mode adjustments with xvidtune
-allowNonLocalXvidtune allow xvidtune to be run as a non-local client
-allowMouseOpenFail start server even if the mouse can't be initialized
-ignoreABI make module ABI mismatches non-fatal
-isolateDevice bus_id restrict device resets to bus_id (PCI only)
-version show the server version
-showDefaultModulePath show the server default module path
-showDefaultLibPath show the server default library path
-novtswitch don't automatically switch VT at reset & exit
-sharevts share VTs with another X server
vtXX use the specified VT number
-keeptty don't detach controlling tty (for debugging only)
-masterfd <fd> use the specified fd as the DRM master fd (not if setuid/gid)