我正在尝试使用 tightvnc 在 Ubuntu 22.04 中设置 VNC 服务器。我基本上可以正常工作,只是 gnome 会话无法正确显示。它看起来像这样:
它有点像 gnome classic,但没有桌面背景,所以显然内容没有完全加载。
这是我的 ~/.vnc/xstartup 文件:
$ cat ~/.vnc/xstartup
#!/bin/sh
autocutsel -fork
xrdb $HOME/.Xresources
xsetroot -solid grey
export XKL_XMODMAP_DISABLE=1
export XDG_CURRENT_DESKTOP="GNOME-Flashback:Unity"
export XDG_MENU_PREFIX="gnome-flashback-"
unset DBUS_SESSION_BUS_ADDRESS
gnome-session --session=gnome-flashback-metacity --disable-acceleration-check --debug &
我也尝试了另一个版本,它基本上看起来相同:
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /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 &
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
这是我的 systemd 服务:
$ cat /etc/systemd/system/[email protected]
[Unit]
Description=Start TightVNC server at startup
After=syslog.target network.target
[Service]
Type=forking
User=user
Group=user
WorkingDirectory=/home/user
PIDFile=/home/user/.vnc/%H:%i.pid
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1920x1080 -localhost :%i
ExecStop=/usr/bin/vncserver -kill :%i
[Install]
WantedBy=multi-user.target
我的 .Xresources 文件是空的(但是存在)。
最后,服务的当前状态出现了一些错误,但我不知道它们是什么意思或者如何调试它们:
● [email protected] - Start TightVNC server at startup
Loaded: loaded (/etc/systemd/system/[email protected]; enabled; vendor preset: enabled)
Active: active (running) since Wed 2022-12-14 18:53:37 CET; 19min ago
Process: 28167 ExecStartPre=/usr/bin/vncserver -kill :1 > /dev/null 2>&1 (code=exited, status=2)
Process: 28171 ExecStart=/usr/bin/vncserver -depth 24 -geometry 1920x1080 -localhost :1 (code=exited, status=0/SUCCESS)
Main PID: 28182 (Xtightvnc)
Tasks: 155 (limit: 629145)
Memory: 257.2M
CPU: 32.435s
CGroup: /system.slice/system-vncserver.slice/[email protected]
├─28182 Xtightvnc :1 -desktop X -auth /home/user/.Xauthority -geometry 1920x1080 -depth 24 -rfbwait 120000 -rfbauth /home/user/.vnc/passwd -rfbport 5901 -fp /usr/share/font>
├─28269 /usr/libexec/gnome-session-binary --session=gnome-flashback-metacity --disable-acceleration-check --debug
├─28272 dbus-launch --exit-with-session /usr/libexec/gnome-session-binary --session=gnome-flashback-metacity --disable-acceleration-check --debug
├─28273 /usr/bin/dbus-daemon --syslog --fork --print-pid 5 --print-address 7 --session
├─28283 /usr/bin/gnome-keyring-daemon --start --components=ssh
├─28293 gnome-flashback
├─28294 /usr/libexec/gnome-flashback-clipboard
├─28297 /usr/libexec/gnome-flashback-media-keys
├─28298 /usr/libexec/at-spi-bus-launcher --launch-immediately
├─28304 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --print-address 11 --address=unix:path=/home/user/.cache/at-spi/bus_1
├─28308 /usr/libexec/at-spi2-registryd --use-gnome-session
├─28324 /usr/libexec/gvfsd
├─28324 /usr/libexec/gvfsd
├─28332 /usr/libexec/gvfsd-fuse /home/user/.cache/gvfs -f
├─28348 /usr/libexec/gvfs-udisks2-volume-monitor
├─28357 /usr/libexec/gvfs-mtp-volume-monitor
├─28362 /usr/libexec/gvfs-gphoto2-volume-monitor
├─28367 /usr/libexec/gvfs-afc-volume-monitor
├─28373 /usr/libexec/gvfs-goa-volume-monitor
├─28377 /usr/libexec/goa-daemon
├─28385 /usr/libexec/goa-identity-service
├─28390 ibus-daemon --xim --panel disable
├─28395 /usr/libexec/dconf-service
├─28397 /usr/libexec/ibus-dconf
├─28398 /usr/libexec/ibus-extension-gtk3
├─28402 /usr/lib/x86_64-linux-gnu/xfce4/notifyd/xfce4-notifyd
├─28404 /usr/libexec/ibus-x11 --kill-daemon
├─28408 metacity
├─28411 /usr/libexec/ibus-portal
├─28421 /usr/lib/x86_64-linux-gnu/xfce4/xfconf/xfconfd
├─28434 /usr/libexec/gvfsd-trash --spawner :1.23 /org/gtk/gvfs/exec_spaw/0
├─28444 gnome-panel
├─28445 /usr/libexec/ibus-engine-simple
├─28459 /usr/libexec/geoclue-2.0/demos/agent
├─28460 nm-applet
├─28466 /usr/lib/x86_64-linux-gnu/indicator-messages/indicator-messages-service
├─28467 /usr/libexec/tracker-miner-fs-3
├─28484 /usr/lib/x86_64-linux-gnu/indicator-application/indicator-application-service
├─28498 /usr/libexec/evolution-data-server/evolution-alarm-notify
├─28564 /usr/libexec/evolution-source-registry
├─28576 /usr/libexec/evolution-calendar-factory
├─28591 /usr/libexec/evolution-addressbook-factory
├─30350 update-notifier
└─30411 /usr/bin/python3 /usr/share/apport/apport-gtk
Dez 14 18:54:39 BF1370032 update-notifier.desktop[30399]: Error executing command as another user: Not authorized
Dez 14 18:54:39 BF1370032 update-notifier.desktop[30399]: This incident has been reported.
Dez 14 18:54:41 BF1370032 metacity.desktop[28408]: Xlib: extension "X-Resource" missing on display ":1".
Dez 14 18:55:37 BF1370032 gnome-session-binary[28269]: DEBUG(+): Starting app: /org/gnome/SessionManager/App58
Dez 14 18:55:37 BF1370032 gnome-session-binary[28269]: DEBUG(+): GsmAutostartApp: starting org.gnome.DejaDup.Monitor.desktop: command=/usr/libexec/deja-dup/deja-dup-monitor startup-id=1>
Dez 14 18:55:37 BF1370032 gnome-session-binary[28269]: GnomeDesktop-DEBUG(+): Not systemd managed, will not move PID 30446 into transient scope
Dez 14 18:55:37 BF1370032 gnome-session-binary[28269]: DEBUG(+): GsmAutostartApp: started pid:30446
Dez 14 18:57:37 BF1370032 gnome-session-binary[28269]: DEBUG(+): GsmAutostartApp: (pid:30446) done (status:0)
Dez 14 19:05:36 BF1370032 gnome-session-binary[28269]: DEBUG(+): GsmSystemd: received logind signal: SessionNew
Dez 14 19:05:36 BF1370032 gnome-session-binary[28269]: DEBUG(+): GsmSystemd: ignoring SessionNew signal
关于如何使 gnome 会话看起来像默认的 gnome 环境,您有什么想法吗?我是否只需要安装一些其他扩展,还是我做错了?