[已解决] 普通用户无法在 chroot 容器中运行 X Window

秀秀桌面并和大家分享一下自己的经验。

版主: lionux天地乾坤

回复
Katzeilla
铁 Fe
帖子: 82
注册时间: 2018-10-01 8:06

[已解决] 普通用户无法在 chroot 容器中运行 X Window

帖子 Katzeilla » 2019-03-17 15:52

我尝试在 OpenBSD 6.4(loongson 8089D) 的 chroot 容器中以普通用户身份启动 X Window (使用 startx),但遇到了问题。

日志中提示找不到屏幕,但在同一个容器中使用 $ doas startx 却可以成功启动。

[ 1099.858] (EE) No drivers available.
[ 1099.859] (EE)
Fatal server error:
[ 1099.866] (EE) no screens found(EE)
[ 1099.876] (EE)

我怀疑可能是某些驱动问题,但不知道要如何定位具体的问题。

Katzeilla
铁 Fe
帖子: 82
注册时间: 2018-10-01 8:06

以普通用户身份启动时的错误日志

帖子 Katzeilla » 2019-03-17 15:53

[ 1099.685]
X.Org X Server 1.19.6
Release Date: 2017-12-20
[ 1099.701] X Protocol Version 11, Revision 0
[ 1099.710] Build Operating System: OpenBSD 6.4 loongson
[ 1099.721] Current Operating System: OpenBSD shell.my.domain 6.4 GENERIC#508 loongson
[ 1099.730] Build Date: 12 October 2018 06:33:06PM
[ 1099.737]
[ 1099.745] Current version of pixman: 0.34.0
[ 1099.757] Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
[ 1099.758] Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[ 1099.801] (==) Log file: "/home/master/.local/share/xorg/Xorg.0.log", Time: Wed Mar 13 09:53:16 2019
[ 1099.813] (==) Using system config directory "/usr/X11R6/share/X11/xorg.conf.d"
[ 1099.814] (==) No Layout section. Using the first Screen section.
[ 1099.814] (==) No screen section available. Using defaults.
[ 1099.814] (**) |-->Screen "Default Screen Section" (0)
[ 1099.814] (**) | |-->Monitor "<default monitor>"
[ 1099.815] (==) No monitor specified for screen "Default Screen Section".
Using a default monitor configuration.
[ 1099.815] (==) Automatically adding devices
[ 1099.816] (==) Automatically enabling devices
[ 1099.816] (==) Not automatically adding GPU devices
[ 1099.816] (==) Max clients allowed: 256, resource mask: 0x1fffff
[ 1099.817] (==) FontPath set to:
/usr/X11R6/lib/X11/fonts/misc/,
/usr/X11R6/lib/X11/fonts/TTF/,
/usr/X11R6/lib/X11/fonts/OTF/,
/usr/X11R6/lib/X11/fonts/Type1/,
/usr/X11R6/lib/X11/fonts/100dpi/,
/usr/X11R6/lib/X11/fonts/75dpi/
[ 1099.817] (==) ModulePath set to "/usr/X11R6/lib/modules"
[ 1099.817] (II) The server relies on wscons to provide the list of input devices.
If no devices become available, reconfigure wscons or disable AutoAddDevices.
[ 1099.817] (II) Loader magic: 0x27cd130010
[ 1099.817] (II) Module ABI versions:
[ 1099.817] X.Org ANSI C Emulation: 0.4
[ 1099.817] X.Org Video Driver: 23.0
[ 1099.817] X.Org XInput driver : 24.1
[ 1099.817] X.Org Server Extension : 10.0
[ 1099.818] (II) LoadModule: "glx"
[ 1099.822] (II) Loading /usr/X11R6/lib/modules/extensions/libglx.so
[ 1099.857] (II) Module glx: vendor="X.Org Foundation"
[ 1099.857] compiled for 1.19.6, module version = 1.0.0
[ 1099.858] ABI class: X.Org Server Extension, version 10.0
[ 1099.858] (==) Assigned the driver to the xf86ConfigLayout
[ 1099.858] (EE) No drivers available.
[ 1099.859] (EE)
Fatal server error:
[ 1099.866] (EE) no screens found(EE)
[ 1099.876] (EE)
Please consult the The X.Org Foundation support
at http://wiki.x.org
for help.
[ 1099.888] (EE) Please also check the log file at "/home/master/.local/share/xorg/Xorg.0.log" for additional information.
[ 1099.901] (EE)
[ 1099.918] (EE) Server terminated with error (1). Closing log file.

Katzeilla
铁 Fe
帖子: 82
注册时间: 2018-10-01 8:06

以 root 或使用 doas 启动时的正常日志

帖子 Katzeilla » 2019-03-17 15:54

[ 1790.713] (--) Using wscons driver on /dev/ttyC0
[ 1790.741]
X.Org X Server 1.19.6
Release Date: 2017-12-20
[ 1790.741] X Protocol Version 11, Revision 0
[ 1790.741] Build Operating System: OpenBSD 6.4 loongson
[ 1790.741] Current Operating System: OpenBSD shell.my.domain 6.4 GENERIC#508 loongson
[ 1790.743] Build Date: 12 October 2018 06:33:06PM
[ 1790.743]
[ 1790.743] Current version of pixman: 0.34.0
[ 1790.743] Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
[ 1790.743] Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[ 1790.744] (==) Log file: "/var/log/Xorg.0.log", Time: Wed Mar 13 10:28:12 2019
[ 1790.746] (==) Using system config directory "/usr/X11R6/share/X11/xorg.conf.d"
[ 1790.747] (==) No Layout section. Using the first Screen section.
[ 1790.747] (==) No screen section available. Using defaults.
[ 1790.747] (**) |-->Screen "Default Screen Section" (0)
[ 1790.747] (**) | |-->Monitor "<default monitor>"
[ 1790.748] (==) No monitor specified for screen "Default Screen Section".
Using a default monitor configuration.
[ 1790.749] (==) Automatically adding devices
[ 1790.749] (==) Automatically enabling devices
[ 1790.749] (==) Not automatically adding GPU devices
[ 1790.749] (==) Max clients allowed: 256, resource mask: 0x1fffff
[ 1790.750] (==) FontPath set to:
/usr/X11R6/lib/X11/fonts/misc/,
/usr/X11R6/lib/X11/fonts/TTF/,
/usr/X11R6/lib/X11/fonts/OTF/,
/usr/X11R6/lib/X11/fonts/Type1/,
/usr/X11R6/lib/X11/fonts/100dpi/,
/usr/X11R6/lib/X11/fonts/75dpi/
[ 1790.750] (==) ModulePath set to "/usr/X11R6/lib/modules"
[ 1790.750] (II) The server relies on wscons to provide the list of input devices.
If no devices become available, reconfigure wscons or disable AutoAddDevices.
[ 1790.750] (II) Loader magic: 0x18464f0010
[ 1790.750] (II) Module ABI versions:
[ 1790.750] X.Org ANSI C Emulation: 0.4
[ 1790.750] X.Org Video Driver: 23.0
[ 1790.750] X.Org XInput driver : 24.1
[ 1790.750] X.Org Server Extension : 10.0
[ 1790.752] (--) PCI:*(0:0:8:0) 126f:0712:0000:0000 rev 176, Mem @ 0x04000000/16777216
[ 1790.752] (II) LoadModule: "glx"
[ 1790.756] (II) Loading /usr/X11R6/lib/modules/extensions/libglx.so
[ 1790.798] (II) Module glx: vendor="X.Org Foundation"
[ 1790.798] compiled for 1.19.6, module version = 1.0.0
[ 1790.798] ABI class: X.Org Server Extension, version 10.0
[ 1790.799] (==) Matched wsfb as autoconfigured driver 0
[ 1790.799] (==) Assigned the driver to the xf86ConfigLayout
[ 1790.799] (II) LoadModule: "wsfb"
[ 1790.802] (II) Loading /usr/X11R6/lib/modules/drivers/wsfb_drv.so
[ 1790.804] (II) Module wsfb: vendor="X.Org Foundation"
[ 1790.804] compiled for 1.19.6, module version = 0.4.1
[ 1790.804] ABI class: X.Org Video Driver, version 23.0
[ 1790.804] (II) wsfb: driver for wsdisplay framebuffer: wsfb
[ 1790.804] (WW) Falling back to old probe method for wsfb
[ 1790.806] (II) wsfb(0): using default device
[ 1790.808] (II) wsfb(0): Creating default Display subsection in Screen section
"Default Screen Section" for depth/fbbpp 16/16
[ 1790.808] (==) wsfb(0): Depth 16, (==) framebuffer bpp 16
[ 1790.808] (==) wsfb(0): RGB weight 565
[ 1790.808] (==) wsfb(0): Default visual is TrueColor
[ 1790.808] (==) wsfb(0): Using gamma correction (1.0, 1.0, 1.0)
[ 1790.808] (II) wsfb(0): Vidmem: 1200k
[ 1790.809] (==) wsfb(0): DPI set to (96, 96)
[ 1790.809] (**) wsfb(0): Using "Shadow Framebuffer"
[ 1790.809] (II) Loading sub module "shadow"
[ 1790.809] (II) LoadModule: "shadow"
[ 1790.815] (II) Loading /usr/X11R6/lib/modules/libshadow.so
[ 1790.817] (II) Module shadow: vendor="X.Org Foundation"
[ 1790.817] compiled for 1.19.6, module version = 1.1.0
[ 1790.817] ABI class: X.Org ANSI C Emulation, version 0.4
[ 1790.817] (II) Loading sub module "fb"
[ 1790.817] (II) LoadModule: "fb"
[ 1790.822] (II) Loading /usr/X11R6/lib/modules/libfb.so
[ 1790.826] (II) Module fb: vendor="X.Org Foundation"
[ 1790.827] compiled for 1.19.6, module version = 1.0.0
[ 1790.827] ABI class: X.Org ANSI C Emulation, version 0.4
[ 1790.831] (==) wsfb(0): Backing store enabled
[ 1790.832] (==) RandR enabled
[ 1790.916] (II) AIGLX: Screen 0 is not DRI2 capable
[ 1790.916] (EE) AIGLX: reverting to software rendering
[ 1791.029] (II) IGLX: enabled GLX_MESA_copy_sub_buffer
[ 1791.037] (II) IGLX: Loaded and initialized swrast
[ 1791.037] (II) GLX: Initialized DRISWRAST GL provider for screen 0
[ 1792.090] (II) config/wscons: checking input device /dev/wskbd
[ 1792.090] (II) wskbd: using layout us
[ 1792.090] (II) LoadModule: "kbd"
[ 1792.095] (II) Loading /usr/X11R6/lib/modules/input/kbd_drv.so
[ 1792.097] (II) Module kbd: vendor="X.Org Foundation"
[ 1792.097] compiled for 1.19.6, module version = 1.9.0
[ 1792.097] Module class: X.Org XInput Driver
[ 1792.097] ABI class: X.Org XInput driver, version 24.1
[ 1792.098] (II) Using input driver 'kbd' for '/dev/wskbd'
[ 1792.098] (**) /dev/wskbd: always reports core events
[ 1792.098] (**) /dev/wskbd: always reports core events
[ 1792.098] (**) Option "Protocol" "standard"
[ 1792.099] (**) Option "XkbRules" "base"
[ 1792.099] (**) Option "XkbModel" "pc105"
[ 1792.099] (**) Option "XkbLayout" "us"
[ 1792.102] (II) XINPUT: Adding extended input device "/dev/wskbd" (type: KEYBOARD, id 6)
[ 1792.611] (II) config/wscons: checking input device /dev/wsmouse
[ 1792.611] (II) LoadModule: "ws"
[ 1792.616] (II) Loading /usr/X11R6/lib/modules/input/ws_drv.so
[ 1792.618] (II) Module ws: vendor="X.Org Foundation"
[ 1792.618] compiled for 1.19.6, module version = 1.3.0
[ 1792.618] Module class: X.Org XInput Driver
[ 1792.618] ABI class: X.Org XInput driver, version 24.1
[ 1792.618] (II) Using input driver 'ws' for '/dev/wsmouse'
[ 1792.619] (**) /dev/wsmouse: always reports core events
[ 1792.619] (II) ws: /dev/wsmouse: debuglevel 0
[ 1792.619] (**) Option "Device" "/dev/wsmouse"
[ 1792.620] (**) ws: /dev/wsmouse: ZAxisMapping: buttons 4 and 5
[ 1792.620] (**) ws: /dev/wsmouse: WAxisMapping: buttons 6 and 7
[ 1792.620] (**) ws: /dev/wsmouse: associated screen: 0
[ 1793.106] (II) ws: /dev/wsmouse: minimum x position: 0
[ 1793.106] (II) ws: /dev/wsmouse: maximum x position: 1023
[ 1793.106] (II) ws: /dev/wsmouse: minimum y position: 0
[ 1793.106] (II) ws: /dev/wsmouse: maximum y position: 599
[ 1793.107] (==) ws: /dev/wsmouse: Buttons: 7
[ 1793.107] (**) ws: /dev/wsmouse: YAxisMapping: buttons 4 and 5
[ 1793.107] (II) XINPUT: Adding extended input device "/dev/wsmouse" (type: MOUSE, id 7)
[ 1793.600] (**) /dev/wsmouse: (accel) keeping acceleration scheme 1
[ 1793.600] (**) /dev/wsmouse: (accel) acceleration profile 0
[ 1793.600] (**) /dev/wsmouse: (accel) acceleration factor: 2.000
[ 1793.600] (**) /dev/wsmouse: (accel) acceleration threshold: 4

Katzeilla
铁 Fe
帖子: 82
注册时间: 2018-10-01 8:06

Re: 普通用户无法在 chroot 容器中运行 X Window

帖子 Katzeilla » 2019-03-17 15:56

chroot 的搭建是按照这篇文章来的 https://www.ibm.com/developerworks/comm ... ot?lang=en

大概过程是

# mkdir sandbox
# cd sandbox
# tar -xzf /mnt/5.5/i386/base55.tgz
# tar -xzf /mnt/5.5/i386/etc55.tgz
# tar -xzf /mnt/5.5/i386/comp55.tgz
# tar -xzf /mnt/5.5/i386/xbase55.tgz
# tar -xzf /mnt/5.5/i386/xshare55.tgz
# tar -xzf /mnt/5.5/i386/xetc55.tgz
# tar -xzf /mnt/5.5/i386/xfont55.tgz
# tar -xzf /mnt/5.5/i386/xserv55.tgz
# cd dev
# ./MAKEDEV all
# cd ..
# chroot /jails/sandbox ldconfig /usr/lib /usr/local/lib /usr/X11R6/lib

Katzeilla
铁 Fe
帖子: 82
注册时间: 2018-10-01 8:06

Re: 普通用户无法在 chroot 容器中运行 X Window

帖子 Katzeilla » 2019-03-17 15:58

我怀疑和 wsfb 有关系,大家觉得呢?

Katzeilla
铁 Fe
帖子: 82
注册时间: 2018-10-01 8:06

问题解决

帖子 Katzeilla » 2019-03-21 18:48

直接使用 startx 启动 X Window 不是个好主意,官方推荐 [1] 使用 xenodm [0]

> The recommended way to run X is with the xenodm(1) display manager. It offers some important security benefits over the traditional startx(1) command.

解压系统安装包(xxx.tgz)时需要加上 -p 参数来保留元信息。

[0] https://man.openbsd.org/xenodm
[1] https://www.openbsd.org/faq/faq11.html

回复

在线用户

正浏览此版面之用户: 没有注册用户 和 1 访客