我已经在我的 Raspberry PI 3 model b+ 上使用 Ubuntu Mate“Ubuntu 20.04.4 LTS”安装了“tigervnc-standalone-server”(不是树莓派),配置并设置 vncserver 作为系统服务。
我已经编辑了~/.vnc/xstartup
这样的文件:
#!/bin/sh
# Uncomment the following two lines for normal desktop:
#unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
#. /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
mate-session &
并像这样配置:/etc/systemd/system/[email protected]
[Unit]
Description=Start TigerVNC server at startup
After=syslog.target network.target
[Service]
Type=forking
User=hamham
#Group=hamham
#WorkingDirectory=/home/hamham
#PAMName=login
PIDFile=/home/hamham/.vnc/%H:%i.pid
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 -localhost no :%i
ExecStop=/usr/bin/vncserver -kill :%i
[Install]
WantedBy=multi-user.target
然后像这样启用:
sudo systemctl daemon-reload && sudo systemctl enable [email protected]
检查实例 vnc 运行情况:
hamham@astroloutre:~$ vncserver -list
TigerVNC server sessions:
X DISPLAY # RFB PORT # PROCESS ID
:1 5901 1202
服务器端似乎一切正常。在尝试从客户端连接之前记录:
hamham@astroloutre:~/.vnc$ more astroloutre\:1.log
blueman-applet 16.10.04 WARNING DiscvManager:109 update_menuitems: warning: Adapter is None
(process:2158): Indicator-Messages-WARNING **: 16:10:05.122: Unable to get a proxy on accounts service for touch settings: Error calling StartServiceByName for org.freedesktop.Accounts: Refusing activation, D-Bus is shutting down.
X connection to :1 broken (explicit kill or server shutdown).
Gdk-Message: 16:10:05.759: xfce4-terminal: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.
mate-session[1438]: WARNING: Detected that screensaver has left the bus
Gdk-Message: 16:10:05.775: marco: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.
Gdk-Message: 16:10:05.776: mate-settings-daemon: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.
Gdk-Message: 16:10:05.780: mate-panel: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.
Gdk-Message: 16:10:05.784: caja: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.
Gdk-Message: 16:10:05.792: mate-session: Fatal IO error 104 (Connection reset by peer) on X server :1.
Gdk-Message: 16:10:05.797: update-notifier: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.
Gdk-Message: 16:10:05.799: blueman-applet: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.
** (process:2039): WARNING **: 16:10:05.818: exiting: service couldn't acquire, or lost ownership of, busname
Gdk-Message: 16:10:05.832: nm-applet: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.
X connection to :1 broken (explicit kill or server shutdown).
Gdk-Message: 16:10:05.841: mate-maximus: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.
Gdk-Message: 16:10:05.844: mate-screensaver: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.
(process:2085): indicator-application-service-WARNING **: 16:10:05.845: Name Lost
Indicator-Datetime-Message: 16:10:05.851: indicator-datetime exiting; failed/lost bus ownership
Gdk-Message: 16:10:05.851: evolution-alarm-notify: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.
(process:2110): indicator-sound-WARNING **: 16:10:05.885: Name lost or unable to acquire bus: com.canonical.indicator.sound
Gdk-Message: 16:10:05.893: blueman-tray: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.
Tue Aug 9 16:10:05 2022
ComparingUpdateTracker: 0 pixels in / 0 pixels out
ComparingUpdateTracker: (1:nan ratio)
(process:2158): GLib-GObject-CRITICAL **: 16:10:05.917: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
(process:2110): GLib-GObject-CRITICAL **: 16:10:05.946: g_object_ref: assertion 'old_val > 0' failed
(process:2110): GLib-GIO-CRITICAL **: 16:10:05.952: Error while sending AddMatch() message: The connection is closed
(process:2110): GLib-GIO-CRITICAL **: 16:10:05.952: Error while sending AddMatch() message: The connection is closed
(process:2110): GLib-GIO-CRITICAL **: 16:10:05.953: Error while sending AddMatch() message: The connection is closed
(process:2110): GLib-GIO-CRITICAL **: 16:10:05.954: Error while sending AddMatch() message: The connection is closed
Xvnc TigerVNC 1.10.0 - built Apr 9 2020 06:49:31
Copyright (C) 1999-2019 TigerVNC Team and many others (see README.rst)
See https://www.tigervnc.org for information on TigerVNC.
Underlying X server release 12008000, The X.Org Foundation
Tue Aug 9 16:10:19 2022
vncext: VNC extension running!
vncext: Listening for VNC connections on all interface(s), port 5901
vncext: created VNC server for screen 0
Impossible de se connecter au gestionnaire de sessions : Impossible de se connecter au gestionnaire de session : SESSION_MANAGER environment variable not defined
GNOME_KEYRING_CONTROL=/home/hamham/.cache/keyring-GR6SQ1
SSH_AUTH_SOCK=/home/hamham/.cache/keyring-GR6SQ1/ssh
mate-session[1439]: WARNING: Unable to find provider '' of required component 'dock'
Avertissement du gestionnaire de fenêtres : Log level 128: unsetenv() is not thread-safe and should not be used after threads are created
GNOME_KEYRING_CONTROL=/home/hamham/.cache/keyring-GR6SQ1
SSH_AUTH_SOCK=/home/hamham/.cache/keyring-GR6SQ1/ssh
(polkit-mate-authentication-agent-1:1989): polkit-mate-1-WARNING **: 16:11:51.621: Unable to determine the session we are in: No session for pid 1989
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
GNOME_KEYRING_CONTROL=/home/hamham/.cache/keyring-GR6SQ1
SSH_AUTH_SOCK=/home/hamham/.cache/keyring-GR6SQ1/ssh
(process:2103): indicator-sound-WARNING **: 16:11:53.080: volume-control-pulse.vala:735: unable to get pulse unix socket: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.PulseAudio1 was not provided by any .service fil
es
** (process:2012): WARNING **: 16:11:53.157: could not find the desktop file for 'org.gnome.Calendar.desktop'
(process:2012): Indicator-Datetime-WARNING **: 16:11:53.259: Unrecognized TZID: 'Etc/Utc'
(process:2012): Indicator-Datetime-WARNING **: 16:11:53.260: Unrecognized TZID: 'Etc/Utc'
caja-dropbox is not installed, doing nothing.
GNOME_KEYRING_CONTROL=/home/hamham/.cache/keyring-GR6SQ1
SSH_AUTH_SOCK=/home/hamham/.cache/keyring-GR6SQ1/ssh
(caja:1984): Gtk-WARNING **: 16:11:53.787: Failed to register client: GDBus.Error:org.gnome.SessionManager.AlreadyRegistered: Unable to register client
no maximize: true
*** ERROR ***
TI:16:11:54 TH:0x2022320 FI:gpm-manager.c FN:gpm_manager_systemd_inhibit,1786
- Error in dbus - GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Permission denied
Traceback:
mate-power-manager(+0x13716) [0x4de716]
mate-power-manager(+0xcfbe) [0x4d7fbe]
** (light-locker:2175): ERROR **: 16:11:54.460: Environment variable XDG_SESSION_PATH not set. Is LightDM running?
** (xiccd:2172): WARNING **: 16:11:55.011: EDID is empty
** (xiccd:2172): CRITICAL **: 16:11:55.252: failed to create colord device: failed to obtain org.freedesktop.color-manager.create-device auth
Initializing caja-open-terminal extension
mate-optimus-applet: launched.
- nvidia-settings and prime-select not detected.
mate-optimus-applet: NVIDIA Optimus is not supported.
(mate-settings-daemon:1865): Gtk-WARNING **: 16:11:58.343: gtk_widget_size_allocate(): attempt to allocate widget with width -1 and height 28
blueman-applet 16.11.58 WARNING PluginManager:147 __load_plugin: Not loading PPPSupport because its conflict has higher priority
INFO:root:The HUD is disabled via org.mate.hud in gsettings.
blueman-applet 16.12.00 WARNING PluginManager:147 __load_plugin: Not loading DhcpClient because its conflict has higher priority
blueman-applet 16.12.00 WARNING DiscvManager:109 update_menuitems: warning: Adapter is None
blueman-tray version 2.1.2 starting
There is an instance already running
[Debug] Autostart mode enabled.
[Welcome] Welcome was autostarted but autostart is disabled.
RuntimeError: object at 0xaedf9c68 of type RenameMenu is not initialized
RuntimeError: object at 0xaedf9c28 of type FolderColorMenu is not initialized
桌面大小,在我的智能手机(不是笔记本电脑)上,我尝试连接 RealVNC 客户端,我输入192.168.1.5:5901
地址(或192.168.1.5:1
),添加密码,尝试连接并收到消息:
The connection closed unexpectedly
已添加到日志中~/.vnc/astroloutre:1.log
:
Tue Aug 9 16:13:40 2022
Connections: accepted: 192.168.1.22::40366
SConnection: Client needs protocol version 3.8
SConnection: Client requests security type VncAuth(2)
terminate called after throwing an instance of 'rdr::Exception'
terminate called recursively
(EE)
(EE) Backtrace:
(EE)
(EE)
Fatal server error:
(EE) Caught signal 6 (Aborted). Server aborting
(EE)
Gdk-Message: 16:13:48.236: evolution-alarm-notify: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.
Gdk-Message: 16:13:48.236: caja: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.
Gdk-Message: 16:13:48.238: xfce4-terminal: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.
X connection to :1 broken (explicit kill or server shutdown).
Gdk-Message: 16:13:48.239: update-notifier: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.
X connection to :1 broken (explicit kill or server shutdown).
Gdk-Message: 16:13:48.239: mate-panel: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.
Gdk-Message: 16:13:48.262: mate-session: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.
Gdk-Message: 16:13:48.271: marco: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.
Gdk-Message: 16:13:48.296: mate-settings-daemon: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.
(process:2103): GLib-GObject-CRITICAL **: 16:13:48.631: g_object_ref: assertion 'old_val > 0' failed
看来问题不是关于 VNC 而是关于桌面管理器,但我不知道为什么以及如何解决它。谢谢你的帮助。