我想获得 tigervnc 服务器的 VNC 访问权限。两台笔记本电脑都运行 ArchLinux sddm KDE xorg(不是 wayland),我花了一天时间才让服务器运行起来,Dolphin 也打开了 - 仅此而已。我的 xstartup 文件包含以下内容:
#!/bin/sh
# Run a generic session
if [ -z "$MODE" ]
then
xsetroot -solid grey & #has impact on the background
export XKB_DEFAULT_RULES=base #no impact
export QT_XKB_CONFIG_ROOT=/usr/share/X11/xkb #no impact
kstart5 plasmashell & #no impact
konsole & #is opening
firefox & #is opening
xrandr --dpi 144 & #see no difference
dbus-launch startplasma-x11 #this is what moves the needle rn :)
fi
我启动服务器,vncserver :1 -depth 24 -geometry 1920x1080
并使用 remmina 客户端、google vnc viewer 和 KRDC 通过 ip:port 访问服务器,vnc 传输效果很好,反应时间也不错。只是我无法在桌面上单击鼠标右键,并且没有任务栏/等离子面板丢失。
我可以用终端启动应用程序,例如 Firefox,但不知何故无法启动等离子面板。注销屏幕也运行良好,我可以用完美的图形和动画注销和登录。
所以我的问题是:如何让等离子面板 + 桌面显示在 vnc 服务器上,或者如何连接到 tty1 上的原始桌面?
(如果我直接访问服务器笔记本电脑,它可以正常工作,面板会显示出来并且运行顺畅。我还可以在几秒钟内启动并运行一个 gnome vnc 服务器 - 我爱上了 KDE,它实际上比通过 vnc 的 gnome 运行得更顺畅/更快/反应更灵敏)
[jack@nasa .vnc]$ cat nasa:1.log
16/12/19 02:43:40 Xvnc version TightVNC-1.3.10
16/12/19 02:43:40 Copyright (C) 2000-2009 TightVNC Group
16/12/19 02:43:40 Copyright (C) 1999 AT&T Laboratories Cambridge
16/12/19 02:43:40 All Rights Reserved.
16/12/19 02:43:40 See http://www.tightvnc.com/ for information on TightVNC
16/12/19 02:43:40 Desktop name 'X' (nasa:1)
16/12/19 02:43:40 Protocol versions supported: 3.3, 3.7, 3.8, 3.7t, 3.8t
16/12/19 02:43:40 Listening for VNC connections on TCP port 5901
16/12/19 02:43:40 Listening for HTTP connections on TCP port 5801
16/12/19 02:43:40 URL http://nasa:5801
RandR extension missing
qt.qpa.xcb: XKeyboard extension not present on the X server
QApplication: invalid style override passed, ignoring it.
Available styles: Breeze, qt5ct-style, Oxygen, Windows, Fusion
Omitting both --window and --windowclass arguments is not recommended
qt.qpa.xcb: XKeyboard extension not present on the X server
qt.qpa.xcb: XKeyboard extension not present on the X server
dbus-update-activation-environment: warning: error sending to systemd: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.systemd1 was not provided by any .service files
QApplication: invalid style override passed, ignoring it.
Available styles: Breeze, qt5ct-style, Oxygen, Windows, Fusion
kdeinit5: preparing to launch '/usr/lib/kf5/klauncher'
kdeinit5: Launched KLauncher, pid = 36797, result = 0
kdeinit5: opened connection to :1
kdeinit5: preparing to launch 'libkdeinit5_kded5'
kdeinit5: Launched KDED, pid = 36814 result = 0
kdeinit5: preparing to launch 'libkdeinit5_kcminit_startup'
kdeinit5: Launched 'kcminit_startup', pid = 36816 result = 0
kdeinit5: Got SETENV 'GTK_RC_FILES=/etc/gtk/gtkrc:/home/jack/.gtkrc:/home/jack/.config/gtkrc' from launcher.
kdeinit5: Got SETENV 'GTK2_RC_FILES=/etc/gtk-2.0/gtkrc:/home/jack/.gtkrc-2.0:/home/jack/.config/gtkrc-2.0' from launcher.
Xlib: extension "XInputExtension" missing on display ":1".
kdeinit5: Got SETENV 'XCURSOR_THEME=breeze_cursors' from launcher.
kdeinit5: Got EXEC_NEW '/usr/bin/kaccess' from launcher.
kdeinit5: preparing to launch '/usr/bin/kaccess'
kdeinit5: PID 36816 terminated.
kdeinit5: Got EXEC_NEW '/usr/lib/kf5/kconf_update' from launcher.
kdeinit5: preparing to launch '/usr/lib/kf5/kconf_update'
kdeinit5: PID 36867 terminated.
kdeinit5: PID 36839 terminated.
kdeinit5: Got SETENV 'SESSION_MANAGER=local/nasa:@/tmp/.ICE-unix/36864,unix/nasa:/tmp/.ICE-unix/36864' from launcher.
org.kde.plasma.session: Starting autostart service "/etc/xdg/autostart/xembedsniproxy.desktop" ("/usr/bin/xembedsniproxy")
Xlib: extension "XInputExtension" missing on display ":1".
org.kde.plasma.session: Starting autostart service "/etc/xdg/autostart/polkit-kde-authentication-agent-1.desktop" ("/usr/lib/polkit-kde-authentication-agent-1")
Xlib: extension "MIT-SCREEN-SAVER" missing on display ":1".
Xlib: extension "MIT-SCREEN-SAVER" missing on display ":1".
org.kde.plasma.session: Starting autostart service "/etc/xdg/autostart/org.kde.plasmashell.desktop" ("/usr/bin/plasmashell")
org.kde.plasma.session: Starting autostart service "/etc/xdg/autostart/pam_kwallet_init.desktop" ("/usr/lib/pam_kwallet_init")
org.kde.plasma.session: Starting autostart service "/etc/xdg/autostart/pulseaudio.desktop" ("/usr/bin/start-pulseaudio-x11")
org.kde.plasma.session: Starting autostart service "/etc/xdg/autostart/restore_kmix_volumes.desktop" ("/usr/bin/kmixctrl", "--restore")
org.kde.plasma.session: Starting autostart service "/etc/xdg/autostart/org.kde.kdeconnect.daemon.desktop" ("/usr/lib/kdeconnectd")
grep: .desktop: No such file or directory
/usr/bin/start-pulseaudio-x11: line 27: [: : integer expression expected
org.kde.plasma.session: Starting autostart service "/etc/xdg/autostart/org.kde.discover.notifier.desktop" ("/usr/lib/DiscoverNotifier")
org.kde.plasma.session: Starting autostart service "/etc/xdg/autostart/gmenudbusmenuproxy.desktop" ("/usr/bin/gmenudbusmenuproxy")
[ERROR audio_thread_priority::rt_linux] setrlimit64: 1
kdeinit5: Got EXEC_NEW '/usr/lib/DiscoverNotifier' from launcher.
kdeinit5: preparing to launch '/usr/lib/DiscoverNotifier'
16/12/19 02:43:45 Got connection from client 192.168.1.9
16/12/19 02:43:45 Using protocol version 3.8
16/12/19 02:43:45 Full-control authentication passed by 192.168.1.9
16/12/19 02:43:45 Pixel format for client 192.168.1.9:
16/12/19 02:43:45 32 bpp, depth 24, little endian
16/12/19 02:43:45 true colour: max r 255 g 255 b 255, shift r 16 g 8 b 0
16/12/19 02:43:45 no translation needed
16/12/19 02:43:45 Using hextile encoding for client 192.168.1.9
16/12/19 02:43:45 Enabling X-style cursor updates for client 192.168.1.9
16/12/19 02:43:45 Enabling cursor position updates for client 192.168.1.9
16/12/19 02:43:45 rfbProcessClientNormalMessage: ignoring unknown encoding -131072
16/12/19 02:43:45 rfbProcessClientNormalMessage: ignoring unknown encoding -223
16/12/19 02:43:45 rfbProcessClientNormalMessage: ignoring unknown encoding -131071
16/12/19 02:43:45 rfbProcessClientNormalMessage: ignoring unknown encoding -131070
16/12/19 02:43:45 rfbProcessClientNormalMessage: ignoring unknown encoding -131069
16/12/19 02:43:45 rfbProcessClientNormalMessage: ignoring unknown encoding -309
kdeinit5: Got EXEC_NEW '/usr/bin/kmix' from launcher.
kdeinit5: preparing to launch '/usr/bin/kmix'
kdeinit5: PID 36966 terminated.
The X11 connection broke: Unsupported extension used (code 2)
XIO: fatal IO error 2 (No such file or directory) on X server ":1"
after 305 requests (282 known processed) with 0 events remaining.
kdeinit5: Got EXEC_NEW '/usr/bin/korgac' from launcher.
kdeinit5: preparing to launch '/usr/bin/korgac'
XIO: fatal IO error 2 (No such file or directory) on X server ":1"
after 417 requests (417 known processed) with 0 events remaining.
kdeinit5: Got EXEC_NEW '/usr/bin/dolphin' from launcher.
kdeinit5: preparing to launch '/usr/bin/dolphin'
XIO: fatal IO error 0 (Success) on X server ":1"
after 404 requests (376 known processed) with 0 events remaining.
XIO: fatal IO error 0 (Success) on X server ":1"
after 336 requests (325 known processed) with 0 events remaining.
kdeinit5: PID 36987 terminated.
org.kde.plasma.session: Starting autostart service "/etc/xdg/autostart/powerdevil.desktop" ("/usr/lib/org_kde_powerdevil")
org.kde.plasma.session: Starting autostart service "/etc/xdg/autostart/gnome-shell-overrides-migration.desktop" ("/usr/lib/gnome-shell-overrides-migration.sh")
org.kde.plasma.session: Starting autostart service "/etc/xdg/autostart/light-locker.desktop" ("/usr/bin/light-locker")
org.kde.plasma.session: Starting autostart service "/etc/xdg/autostart/geoclue-demo-agent.desktop" ("/usr/lib/geoclue-2.0/demos/agent")
org.kde.plasma.session: Starting autostart service "/home/jack/.config/autostart/ignore-lid-switch-tweak.desktop" ("/usr/lib/gnome-tweak-tool-lid-inhibitor")
org.kde.plasma.session: Starting autostart service "/etc/xdg/autostart/org.kde.korgac.desktop" ("/usr/bin/korgac")
org.kde.plasma.session: Starting autostart service "/etc/xdg/autostart/tracker-miner-rss.desktop" ("/usr/lib/tracker-miner-rss")
org.kde.plasma.session: Starting autostart service "/etc/xdg/autostart/tracker-store.desktop" ("/usr/bin/gdbus", "call", "-e", "-d", "org.freedesktop.DBus", "-o", "/org/freedesktop/DBus", "-m", "org.freedesktop.DBus.StartServiceByName", "org.freedesktop.Tracker1", "0")
** (light-locker:37055): ERROR **: 02:43:47.104: Environment variable XDG_SESSION_PATH not set. Is LightDM running?
org.kde.plasma.session: Starting autostart service "/etc/xdg/autostart/tracker-extract.desktop" ("/usr/lib/tracker-extract")
org.kde.plasma.session: Starting autostart service "/etc/xdg/autostart/tracker-miner-fs.desktop" ("/usr/lib/tracker-miner-fs")
Xlib: extension "XInputExtension" missing on display ":1".
Xlib: extension "XInputExtension" missing on display ":1".
XIO: fatal IO error 0 (Success) on X server ":1"
after 304 requests (293 known processed) with 0 events remaining.
org.kde.plasma.session: Starting autostart service "/etc/xdg/autostart/kmix_autostart.desktop" ("/usr/bin/kmix", "--keepvisibility")
(uint32 1,)
Traceback (most recent call last):
File "/usr/lib/gnome-tweak-tool-lid-inhibitor", line 17, in on_activate
var, fdlist = bus.call_with_unix_fd_list_sync('org.freedesktop.login1',
gi.repository.GLib.Error: g-dbus-error-quark: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Permission denied (9)
KCrash: Attempting to start /usr/bin/kdeinit5 from kdeinit
kdeinit5: Got EXEC_NEW '/usr/bin/kdeinit5' from wrapper.
kdeinit5: preparing to launch '/usr/bin/kdeinit5'
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = kdeinit5 path = /usr/bin pid = 36814
KCrash: Arguments: /usr/bin/kdeinit5
KCrash: Attempting to start /usr/lib/drkonqi from kdeinit
kdeinit5: Got EXEC_NEW '/usr/lib/drkonqi' from wrapper.
kdeinit5: preparing to launch '/usr/lib/drkonqi'
kdeinit5: Shutting down running client.
kdeinit5: Got termination request (PID 36787).
kdeinit5: Closed sockets, but not exiting until all children terminate.
klauncher: Exiting on signal 15
kdeinit5: PID 36797 terminated.
KCrash: Attempting to start /usr/lib/org_kde_powerdevil from kdeinit
Warning: connect() failed: : No such file or directory
KCrash: Attempting to start /usr/lib/org_kde_powerdevil directly
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = org_kde_powerdevil path = /usr/lib pid = 37050
KCrash: Arguments: /usr/lib/org_kde_powerdevil
KCrash: Attempting to start /usr/lib/drkonqi from kdeinit
Warning: connect() failed: : No such file or directory
KCrash: Attempting to start /usr/lib/drkonqi directly
Xlib: extension "MIT-SCREEN-SAVER" missing on display ":1".
kdeinit5: preparing to launch '/usr/lib/kf5/klauncher'
kdeinit5: Launched KLauncher, pid = 37221, result = 0
XIO: fatal IO error 0 (Success) on X server ":1"
after 337 requests (326 known processed) with 0 events remaining.
kdeinit5: preparing to launch '/usr/lib/kf5/klauncher'
kdeinit5: Launched KLauncher, pid = 37234, result = 0
Xlib: extension "MIT-SCREEN-SAVER" missing on display ":1".
kdeinit5: opened connection to :1
kdeinit5: Got EXEC_NEW '/usr/lib/qt/plugins/kf5/kio/tags.so' from launcher.
kdeinit5: preparing to launch '/usr/lib/qt/plugins/kf5/kio/tags.so'
kdeinit5: Got EXEC_NEW '/usr/lib/qt/plugins/kf5/kio/trash.so' from launcher.
kdeinit5: preparing to launch '/usr/lib/qt/plugins/kf5/kio/trash.so'
kdeinit5: Got EXEC_NEW '/usr/lib/qt/plugins/kf5/kio/file.so' from launcher.
kdeinit5: preparing to launch '/usr/lib/qt/plugins/kf5/kio/file.so'
kdeinit5: Got EXEC_NEW '/usr/lib/qt/plugins/kf5/kio/file.so' from launcher.
kdeinit5: preparing to launch '/usr/lib/qt/plugins/kf5/kio/file.so'
kdeinit5: Got EXEC_NEW '/usr/lib/qt/plugins/kf5/kio/file.so' from launcher.
kdeinit5: preparing to launch '/usr/lib/qt/plugins/kf5/kio/file.so'
kdeinit5: Got EXEC_NEW '/usr/lib/qt/plugins/kf5/kio/thumbnail.so' from launcher.
kdeinit5: preparing to launch '/usr/lib/qt/plugins/kf5/kio/thumbnail.so'
kdeinit5: Communication error with launcher. Exiting!
kdeinit5: PID 37187 terminated.
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = drkonqi path = /usr/lib pid = 37189
KCrash: Arguments: /usr/lib/drkonqi --appname kdeinit5 --kdeinit --apppath /usr/bin --signal 11 --pid 36814 --startupid 0 --restarted
KCrash: Attempting to start /usr/lib/drkonqi from kdeinit
Warning: connect() failed: : Connection refused
KCrash: Attempting to start /usr/lib/drkonqi directly
kdeinit5: PID 36814 terminated.
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = drkonqi path = /usr/lib pid = 37213
KCrash: Arguments: /usr/lib/drkonqi --appname org_kde_powerdevil --apppath /usr/lib --signal 6 --pid 37050 --appversion 2.0.0 --programname KDE Power Management System --bugaddress [email protected] --startupid 0 --restarted
KCrash: Attempting to start /usr/lib/drkonqi from kdeinit
Warning: connect() failed: : Connection refused
KCrash: Attempting to start /usr/lib/drkonqi directly
Unable to start Dr. Konqi
Re-raising signal for core dump handling.
Unable to start Dr. Konqi
Re-raising signal for core dump handling.
kdeinit5: PID 37189 terminated.
16/12/19 02:44:56 KbdAddEvent: unknown KeySym 0xff61 - allocating KeyCode 89
(tracker-miner-fs:37115): Tracker-CRITICAL **: 02:45:24.859: Could not remove files in volumes: GDBus.Error:org.freedesktop.DBus.Error.NoReply: Message recipient disconnected from message bus without replying
(tracker-miner-fs:37115): Tracker-CRITICAL **: 02:45:24.859: Could not remove files in volumes: GDBus.Error:org.freedesktop.DBus.Error.NoReply: Message recipient disconnected from message bus without replying
(tracker-miner-fs:37115): Tracker-CRITICAL **: 02:45:24.859: Could not initialize currently active mount points: GDBus.Error:org.freedesktop.DBus.Error.NoReply: Message recipient disconnected from message bus without replying
kdeinit5: PID 37256 terminated.
kdeinit5: PID 37263 terminated.
kdeinit5: PID 37270 terminated.
kdeinit5: PID 37262 terminated.
kdeinit5: PID 37272 terminated.
16/12/19 02:53:56 Client 192.168.1.9 gone
16/12/19 02:53:56 Statistics:
16/12/19 02:53:56 key events received 12, pointer events 935
16/12/19 02:53:56 framebuffer updates 318, rectangles 834, bytes 13818357
16/12/19 02:53:56 cursor shape updates 74, bytes 9740
16/12/19 02:53:56 cursor position updates 1, bytes 12
16/12/19 02:53:56 copyRect rectangles 39, bytes 624
16/12/19 02:53:56 hextile rectangles 720, bytes 13807981
16/12/19 02:53:56 raw bytes equivalent 318610964, compression ratio 23.074406
答案1
因此,我找到了 2 个解决方案 - 如果有人遇到同样的问题。
使用 Tigervnc 或 Tightvnc
使用 x11vnc
两者的区别在于 1. 启动自己的 x11 服务器,2. 连接到现有桌面。使用 1. 我可以设置我想要的任何屏幕分辨率,并启动硬件可以处理的尽可能多的屏幕分辨率 - 没有任何限制。
1. 首次启动 tigervnc 后,~/.vnc 文件夹中会出现一个 xstartup 文件,该文件必须包含以下内容才能启动 kde plasma x11 会话:
#!/bin/sh
# Run a generic session
if [ -z "$MODE" ]
then
xsetroot -solid grey & #set the background picture
export XKB_DEFAULT_RULES=base & #both should be needed for keyboard signals
export QT_XKB_CONFIG_ROOT=/usr/share/X11/xkb &
# export $(dbus-launch) &
# exec startplasma-x11&
# kstart5 plasmashell &
konsole & #starts konsole (kde terminal)
firefox & #starts firefox
ksysguard & #starts the kde system monitor
# xrandr --dpi 144 & #
kstart5 plasmashell & #adds a task bar to the windows
dbus-launch startplasma-x11 #starts the actual window + Dolphin
# /opt/kde/bin/startkde &
fi
所有被评论过的选项(还有更多的是尝试过的,结果很糟糕或者根本没有结果)
vncserver :1 -depth 24 -geometry 1920x1080
以全高清格式启动服务器并vncserver -kill :1
终止它(1 代表会话,并且之前运行的命令越多,增量就越多)我可以使用 remmina GUI 客户端通过 ip 和端口连接到它 - fe 192.168.1.4:5901(标准端口,你可以使用 找到你的服务器 ip ip addr
)
仍然没有任务栏,仍然没有可用的背景桌面选项 - 但它可以工作,我可以移动和调整窗口大小并使用终端启动新窗口 - 如果您找到解决方案 - 很高兴听到它:)
2. 非常简单/快速,只需安装 x11vnc ( sudo pacman -S x11vnc
) 并在服务器上启动它即可x11vnc -many -display :0
然后连接 remmina 客户端和 ip(无端口)(fe 192.168.1.4)- 完成 - 原始显示器的图片。(在我的情况下只是高清分辨率 - 但有桌面和任务面板)
如果我跳过命令 -many,会话只适用于一个连接,并在我断开 vnc 客户端后结束,每次我想要连接时都必须重新启动。使用 many 时,它会保留。重新启动后自动启动 x11vnc 的操作如下:
我为此浪费了几个小时。我认为以 root 身份启动 x11vnc 不是一个好主意。[email protected]
在 Arch Linux 上,此文件夹位于/usr/lib/systemd/system/
- 只需创建一个文件[email protected]
并包含以下内容。
[Unit]
Description=VNC Server for X11
Requires=display-manager.service
After=display-manager.service
[Service]
Type=forking
ExecStart=/usr/bin/x11vnc -rfbauth /home/user/.vnc/passwd -ncache 2 -forever -shared -bg -display :0
Restart=on-failure
RestartSec=10
User=%I
[Install]
WantedBy=multi-user.target
可以启动一次
systemctl start [email protected]
你可以将“用户”更改为你的用户,并且可以在启动后自动启动
systemctl enable [email protected]
并且它永远不会失败(也许可以省略有关重启的部分)。
是的-就是这样:)
编辑:我现在已经在许多 arch linux 服务器上测试了它,出于稳定性原因,应该使用 git 版本(yay -S x11vnc-git
而不是yay -S x11vnc
),因为通过在特定计算机上编译它,编译器可以完美地针对已安装的系统进行优化。在大多数情况下没有必要,但对于某些硬件来说是必要的。
此外,-ncache 2 标志仅通过发送与前一张图片的差异来加速/保护 vnc 服务器的带宽,但如果带宽不重要,那么它是可选的并且没有它也可以正常工作。