使用 Ubuntu 23.04 在无头 Raspberry Pi 上设置 VNC 无法打开显示

使用 Ubuntu 23.04 在无头 Raspberry Pi 上设置 VNC 无法打开显示

尝试使用 Raspberry Pi 4B 在 Ubuntu 23.04 上设置 TigerVNC。
输入“vncserver”进入测试步骤。
收到此输出:

New Xtigervnc server 'KG7JE-Ham:1 (steve)' on port 5901 for display :1.
Use xtigervncviewer -SecurityTypes VncAuth -passwd /tmp/tigervnc.IZRuvV/passwd :1 to connect to the VNC server.

--- tail /home/steve/.vnc/KG7JE-Ham:1.log---

Session startup via '/home/steve/.vnc/xstartup' cleanly exited too early (< 3 seconds)!

Maybe try something simple first, e.g.,
    tigervncserver -xstartup /usr/bin/xterm
The X session cleanly exited!
Killing Xtigervnc process ID 576114... success!

因此,尝试了tigervncserver -xstartup /usr/bin/xterm这个输出:

New Xtigervnc server 'KG7JE-Ham:1 (steve)' on port 5901 for display :1.
Use xtigervncviewer -SecurityTypes VncAuth -passwd /tmp/tigervnc.aBtKL_/passwd :1 to connect to the VNC server.

这似乎有效,因为我看到了锁定文件/tmp/
那么,vncserver 出了什么问题?

输出如下./.vnc/*.log

_XSERVTransmkdir: Owner of /tmp/.X11-unix should be set to root

Xvnc TigerVNC 1.12.0 - built 2023-01-06 16:01
Copyright (C) 1999-2021 TigerVNC Team and many others (see README.rst)
See https://www.tigervnc.org for information on TigerVNC.
Underlying X server release 12101006, X.Org


Thu Jul  6 13:38:17 2023
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on local interface(s), port 5901
 vncext:      created VNC server for screen 0
3NI3X0 New Xtigervnc server 'KG7JE-Ham:1 (steve)' on port 5901 for display :1.
3NI3X0 Use xtigervncviewer -SecurityTypes VncAuth -passwd /tmp/tigervnc.OPtlxa/passwd :1 to connect to the VNC server.
/usr/bin/startxfce4: X server already running on display :1

Thu Jul  6 13:38:18 2023
 ComparingUpdateTracker: 0 pixels in / 0 pixels out
 ComparingUpdateTracker: (1:nan ratio)
xrdb: Connection reset by peer
xrdb: Can't open display ':1'
xfce4-session: Cannot open display: .
Type 'xfce4-session --help' for usage.

答案1

问题出在这一行:

/usr/bin/startxfce4: X server already running on display :1

对我有用的是删除 xstartup 以下行中的“&”:

startxfce4 &

因此,我现在的思路很简单:

startxfce4

我在这里找到了这个解决方案: https://bbs.archlinux.org/viewtopic.php?pid=1411871#p1411871

希望能帮助到你。

相关内容