我遵循了本指南
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-ubuntu-20-04
但有时我在服务器上运行状态时无法连接到tightvnc,我发现它不再处于活动状态
我在日记里发现
Aug 06 01:56:49 myapp1 vncserver[6198]: Log file is /home/ubuntu/.vnc/myapp1:2.log
Aug 06 01:56:49 myapp1 systemd[1]: [email protected]: Can't open PID file /home/ubuntu/.vnc/myapp1:1.pid (yet?) after start: Operation not permitted
当我运行状态时我得到:
$ sudo systemctl status vncserver@1
● [email protected] - Start TightVNC server at startup
Loaded: loaded (/etc/systemd/system/[email protected]; enabled; vendor preset: enabled)
Active: failed (Result: core-dump) since Fri 2021-08-06 01:40:08 UTC; 14min ago
Main PID: 918 (code=dumped, signal=SEGV)
Aug 06 00:55:58 myapp1 dbus-daemon[1012]: [session uid=1001 pid=1006] Successfully activated service 'org.gnome.evolution.dataserver.AddressBook10'
Aug 06 00:55:58 myapp1 org.freedesktop.thumbnails.Thumbnailer1[1956]: Registered thumbnailer /usr/bin/gdk-pixbuf-thumbnailer -s %s %u %o
Aug 06 00:55:58 myapp1 org.freedesktop.thumbnails.Thumbnailer1[1956]: Registered thumbnailer /usr/bin/gdk-pixbuf-thumbnailer -s %s %u %o
Aug 06 00:55:58 myapp1 dbus-daemon[1012]: [session uid=1001 pid=1006] Successfully activated service 'org.freedesktop.thumbnails.Thumbnailer1'
Aug 06 00:55:58 myapp1 dbus-daemon[1012]: [session uid=1001 pid=1006] Activating service name='org.gtk.vfs.Metadata' requested by ':1.11' (uid=1001 pid=1547 comm="xfdesktop " label="unconfined")
Aug 06 00:55:58 myapp1 dbus-daemon[1012]: [session uid=1001 pid=1006] Successfully activated service 'org.gtk.vfs.Metadata'
Aug 06 01:40:08 myapp1 xfce4-notifyd[1933]: xfce4-notifyd: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.
Aug 06 01:40:08 myapp1 org.a11y.Bus[1065]: X connection to :1 broken (explicit kill or server shutdown).
Aug 06 01:40:08 myapp1 systemd[1]: [email protected]: Main process exited, code=dumped, status=11/SEGV
Aug 06 01:40:08 myapp1 systemd[1]: [email protected]: Failed with result 'core-dump'.
重新启动 tightvncserver 服务不起作用。sudo systemctl start vncserver@1
重启后,tightvnc 服务器又可以正常工作了。但我不想不断重启服务器。有什么想法吗?
我也对不同的 vnc 服务器持开放态度。
答案1
编辑:我想我刚刚找到了解决方案:改用 TigerVNC:
sudo apt purge tightvncserver
sudo apt install tigervnc-standalone-server tigervnc-viewer
这解决了我反复遇到的崩溃问题。
在我使用此解决方案之前,我至少有一种方法可以在不重新启动的情况下重新启动服务:当你运行
sudo systemctl start vncserver@1 #this fails
sudo systemctl status vncserver@1 #this shows why
您将会看到它失败了,因为 /tmp/.X1-lock 文件仍然存在,并且在删除该文件之后,它会抱怨 /tmp/.X11-unix。
因此,如果你这样做:
sudo rm -r /tmp/.X11-unix /tmp/.X1-lock
sudo systemctl start vncserver@1
您可以重新启动服务而无需重启