我已经遵循了这个指南:在 RHEL 中配置 VNC 服务器AlmaLinux 9.3
在我的机器上设置 vnc 连接。我遇到了 VNC 会话期间显示的实际桌面的问题,如下所示:
我不知道为什么我会出现一个Firefox
和XTerm
窗口,而不是预期的xfce4-session
。但是,如果我输入命令:startx
桌面xfce4
将会出现。
当我检查服务文件的状态时,我似乎没有什么立即显而易见的事情。
● vncserver@:2.service - Remote desktop service (VNC)
Loaded: loaded (/etc/systemd/system/vncserver@:2.service; disabled; preset: disabled)
Active: active (running) since Fri 2024-01-05 17:22:54 GMT; 53s ago
Process: 11707 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill :2 > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
Process: 11712 ExecStart=/usr/bin/vncserver :2 -geometry 1280x1024 (code=exited, status=0/SUCCESS)
Main PID: 11719 (Xvnc)
Tasks: 243 (limit: 48083)
Memory: 368.7M
CPU: 3.734s
CGroup: /system.slice/system-vncserver.slice/vncserver@:2.service
├─11719 /usr/bin/Xvnc :2 -alwaysshared -geometry 1920x1080 -securitytypes vncauth,tlsvnc -auth /home/user/.Xauthority -desktop "localhost:2 (user)" -fp catalogue:/etc/X11/fontpath.d -pn -rfbauth /home/user/.vnc/passwd -rfbport 5902
├─11737 dbus-launch --sh-syntax --exit-with-session
├─11738 /usr/bin/dbus-daemon --syslog --fork --print-pid 5 --print-address 7 --session
├─11773 /usr/bin/xterm -geometry 80x50-50+150
├─11774 /usr/lib64/firefox/firefox /usr/share/doc/HTML/index.html
├─11795 bash
├─11893 /usr/libexec/gvfsd
├─11912 /usr/libexec/xdg-desktop-portal
├─11919 /usr/libexec/xdg-document-portal
├─11925 /usr/libexec/xdg-permission-store
├─11932 fusermount -o rw,nosuid,nodev,fsname=portal,auto_unmount,subtype=portal -- /home/user/.cache/doc
├─11947 /usr/libexec/xdg-desktop-portal-gtk
├─11957 /usr/libexec/at-spi-bus-launcher
├─11964 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --print-address 3
├─11971 /usr/libexec/at-spi2-registryd --use-gnome-session
├─12078 /usr/lib64/firefox/firefox -contentproc -parentBuildID 20231129035847 -prefsLen 27636 -prefMapSize 237382 -appDir /usr/lib64/firefox/browser {675b4206-c092-4a32-ab77-a4582e559da7} 11774 socket
├─12159 /usr/lib64/firefox/firefox -contentproc -childID 1 -isForBrowser -prefsLen 27830 -prefMapSize 237382 -jsInitLen 240916 -parentBuildID 20231129035847 -appDir /usr/lib64/firefox/browser {4e1242e4-50f6-4731-9502-01745913ab95} 11774 tab
├─12223 /usr/lib64/firefox/firefox -contentproc -childID 2 -isForBrowser -prefsLen 32519 -prefMapSize 237382 -jsInitLen 240916 -parentBuildID 20231129035847 -appDir /usr/lib64/firefox/browser {be1c4cbc-6d2c-4174-ae32-65e69f2566b1} 11774 tab
├─12269 /usr/lib64/firefox/firefox -contentproc -childID 3 -isForBrowser -prefsLen 32576 -prefMapSize 237382 -jsInitLen 240916 -parentBuildID 20231129035847 -appDir /usr/lib64/firefox/browser {1ca48e96-b7d0-4844-9d74-b269aa003429} 11774 tab
├─12303 /usr/lib64/firefox/firefox -contentproc -childID 4 -isForBrowser -prefsLen 28144 -prefMapSize 237382 -jsInitLen 240916 -parentBuildID 20231129035847 -appDir /usr/lib64/firefox/browser {56c69dce-39f9-40bf-bff1-b24208d9e6c7} 11774 tab
├─12306 /usr/lib64/firefox/firefox -contentproc -childID 5 -isForBrowser -prefsLen 28144 -prefMapSize 237382 -jsInitLen 240916 -parentBuildID 20231129035847 -appDir /usr/lib64/firefox/browser {e114b097-4c1b-40ea-86c5-53d6d9cc3928} 11774 tab
└─12310 /usr/lib64/firefox/firefox -contentproc -childID 6 -isForBrowser -prefsLen 28144 -prefMapSize 237382 -jsInitLen 240916 -parentBuildID 20231129035847 -appDir /usr/lib64/firefox/browser {feaa6536-974f-4dc1-a1ff-bd923039c8d3} 11774 tab
Jan 05 17:22:55 localhost dbus-daemon[11738]: [session uid=1000 pid=11736] Successfully activated service 'org.freedesktop.portal.Documents'
Jan 05 17:22:55 localhost dbus-daemon[11738]: [session uid=1000 pid=11736] Activating service name='org.freedesktop.impl.portal.desktop.gtk' requested by ':1.5' (uid=1000 pid=11912 comm="/usr/libexec/xdg-desktop-portal " label="kernel")
Jan 05 17:22:55 localhost dbus-daemon[11738]: [session uid=1000 pid=11736] Activating service name='org.a11y.Bus' requested by ':1.8' (uid=1000 pid=11947 comm="/usr/libexec/xdg-desktop-portal-gtk " label="kernel")
Jan 05 17:22:55 localhost dbus-daemon[11738]: [session uid=1000 pid=11736] Successfully activated service 'org.a11y.Bus'
Jan 05 17:22:55 localhost org.a11y.Bus[11964]: dbus-daemon[11964]: Activating service name='org.a11y.atspi.Registry' requested by ':1.0' (uid=1000 pid=11947 comm="/usr/libexec/xdg-desktop-portal-gtk " label="kernel")
Jan 05 17:22:55 localhost org.a11y.Bus[11964]: dbus-daemon[11964]: Successfully activated service 'org.a11y.atspi.Registry'
Jan 05 17:22:55 localhost org.a11y.Bus[11971]: SpiRegistry daemon is running with well-known name - org.a11y.atspi.Registry
Jan 05 17:22:55 localhost dbus-daemon[11738]: [session uid=1000 pid=11736] Successfully activated service 'org.freedesktop.impl.portal.desktop.gtk'
Jan 05 17:22:55 localhost xdg-desktop-por[11912]: Failed connect to PipeWire: Couldn't connect to PipeWire
Jan 05 17:22:55 localhost dbus-daemon[11738]: [session uid=1000 pid=11736] Successfully activated service 'org.freedesktop.portal.Desktop'
我的猜测是,VNC 默认情况下会尝试加载gnome
桌面,但我只使用桌面xfce
。我不知道如何或在哪里设置默认桌面。任何建议将不胜感激。
我的文件内容~/.vnc/xstarup
:
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
/etc/X11/xinit/xinitrc
# Assume either Gnome will be started by default when installed
# We want to kill the session automatically in this case when user logs out. In case you modify
# /etc/X11/xinit/Xclients or ~/.Xclients yourself to achieve a different result, then you should
# be responsible to modify below code to avoid that your session will be automatically killed
if [ -e /usr/bin/gnome-session ]; then
vncserver -kill $DISPLAY
fi