关于 TigerVNC + GNOME + Ubuntu 20.04 和黑屏的另一个问题

关于 TigerVNC + GNOME + Ubuntu 20.04 和黑屏的另一个问题

我几乎成功地在全新安装的 Ubuntu 20.04 中设置了 TigerVNC。我的问题是,如果我进行日志记录并通过执行以下命令手动启动 vncserver 服务,我才能获得有用的屏幕:

sudo systemctl start vncserver@1

然后,使用 RealVNC 客户端连接后,我得到了我期望的结果:

在此处输入图片描述

问题是:如果我重新启动整台机器,我可以连接到服务器,但屏幕完全是黑色的:

在此处输入图片描述

服务状态为:

$ sudo systemctl status [email protected][email protected] - Start TightVNC server at startup
     Loaded: loaded (/etc/systemd/system/[email protected]; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2021-02-24 06:11:37 -03; 4min 42s ago
    Process: 723 ExecStartPre=/usr/bin/vncserver -kill :1 > /dev/null 2>&1 (code=exited, status=0/SUCCESS)
    Process: 786 ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 -localhost :1 (code=exited, status=0/SUCCESS)
   Main PID: 800 (Xtigervnc)
      Tasks: 41 (limit: 9326)
     Memory: 108.0M
     CGroup: /system.slice/system-vncserver.slice/[email protected]
             ├─800 /usr/bin/Xtigervnc :1 -desktop sc-002-nuc:1 (impuser) -auth /home/impuser/.Xauthority -geometry 1280x800 -depth 24 -rfbwait 30000 -rfbauth /home/impuser/.vnc/passwd -rfbport 5901 -pn >
             ├─865 dbus-launch --exit-with-session /usr/libexec/gnome-session-binary --builtin
             ├─867 /usr/bin/dbus-daemon --syslog --fork --print-pid 5 --print-address 7 --session
             ├─875 /usr/libexec/gvfsd
             ├─880 /usr/libexec/gvfsd-fuse /home/impuser/.cache/gvfs -f -o big_writes
             ├─913 /usr/libexec/at-spi-bus-launcher
             ├─918 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --print-address 3
             └─940 /usr/bin/gnome-keyring-daemon --start --components=pkcs11

fev 24 06:11:38 sc-002-nuc gnome-session[825]: gnome-session-binary[825]: WARNING: App 'org.gnome.Shell.desktop' exited with code 1
fev 24 06:11:38 sc-002-nuc gnome-session-binary[825]: WARNING: App 'org.gnome.Shell.desktop' exited with code 1
fev 24 06:11:38 sc-002-nuc org.gnome.Shell.desktop[965]: Window manager warning: Unsupported session type
fev 24 06:11:38 sc-002-nuc gnome-session[825]: gnome-session-binary[825]: WARNING: App 'org.gnome.Shell.desktop' exited with code 1
fev 24 06:11:38 sc-002-nuc gnome-session[825]: gnome-session-binary[825]: WARNING: App 'org.gnome.Shell.desktop' respawning too quickly
fev 24 06:11:38 sc-002-nuc gnome-session-binary[825]: WARNING: App 'org.gnome.Shell.desktop' exited with code 1
fev 24 06:11:38 sc-002-nuc gnome-session-binary[825]: Unrecoverable failure in required component org.gnome.Shell.desktop
fev 24 06:11:38 sc-002-nuc gnome-session[825]: gnome-session-binary[825]: CRITICAL: We failed, but the fail whale is dead. Sorry....
fev 24 06:11:38 sc-002-nuc gnome-session-binary[825]: WARNING: App 'org.gnome.Shell.desktop' respawning too quickly
fev 24 06:11:38 sc-002-nuc gnome-session-binary[825]: CRITICAL: We failed, but the fail whale is dead. Sorry....

但如果我手动重新启动该服务,则该服务正常运行:

$ sudo systemctl stop vncserver@1
$ sudo systemctl start vncserver@1
$ sudo systemctl status [email protected][email protected] - Start TightVNC server at startup
     Loaded: loaded (/etc/systemd/system/[email protected]; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2021-02-24 07:10:13 -03; 7s ago
    Process: 2368 ExecStartPre=/usr/bin/vncserver -kill :1 > /dev/null 2>&1 (code=exited, status=0/SUCCESS)
    Process: 2373 ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 -localhost :1 (code=exited, status=0/SUCCESS)
   Main PID: 2383 (Xtigervnc)
      Tasks: 318 (limit: 9326)
     Memory: 371.4M
     CGroup: /system.slice/system-vncserver.slice/[email protected]
             ├─2383 /usr/bin/Xtigervnc :1 -desktop sc-002-nuc:1 (impuser) -auth /home/impuser/.Xauthority -geometry 1280x800 -depth 24 -rfbwait 30000 -rfbauth /home/impuser/.vnc/passwd -rfbport 5901 -pn>
             ├─2414 /usr/libexec/gnome-session-binary --builtin
             ├─2417 dbus-launch --exit-with-session /usr/libexec/gnome-session-binary --builtin
             ├─2418 /usr/bin/dbus-daemon --syslog --fork --print-pid 5 --print-address 7 --session
             ├─2424 /usr/libexec/gvfsd
             ├─2429 /usr/libexec/gvfsd-fuse /home/impuser/.cache/gvfs -f -o big_writes
             ├─2459 /usr/libexec/at-spi-bus-launcher
             ├─2464 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --print-address 3
             ├─2486 /usr/bin/gnome-keyring-daemon --start --components=secrets
             ├─2500 /usr/bin/gnome-shell
             ├─2535 ibus-daemon --panel disable --xim
             ├─2539 /usr/libexec/ibus-dconf
             ├─2540 /usr/libexec/ibus-extension-gtk3
             ├─2542 /usr/libexec/ibus-x11 --kill-daemon
             ├─2544 /usr/libexec/ibus-portal
             ├─2557 /usr/libexec/at-spi2-registryd --use-gnome-session
             ├─2562 /usr/libexec/xdg-permission-store
             ├─2566 /usr/libexec/gnome-shell-calendar-server
             ├─2574 /usr/libexec/evolution-source-registry
             ├─2582 /usr/libexec/goa-daemon
             ├─2586 /usr/libexec/evolution-calendar-factory
             ├─2594 /usr/libexec/goa-identity-service
             ├─2607 /usr/libexec/dconf-service
             ├─2614 /usr/libexec/evolution-addressbook-factory
             ├─2624 /usr/libexec/gvfs-udisks2-volume-monitor
             ├─2635 /usr/libexec/gvfs-gphoto2-volume-monitor
             ├─2640 /usr/libexec/gvfs-goa-volume-monitor
             ├─2645 /usr/libexec/gvfs-mtp-volume-monitor
             ├─2650 /usr/libexec/gvfs-afc-volume-monitor
             ├─2660 /usr/bin/gjs /usr/share/gnome-shell/org.gnome.Shell.Notifications
             ├─2674 /usr/libexec/gsd-usb-protection
             ├─2676 /usr/libexec/gsd-wacom
             ├─2677 /usr/libexec/gsd-media-keys
             ├─2679 /usr/libexec/gsd-rfkill
             ├─2681 /usr/libexec/gsd-a11y-settings
             ├─2682 /usr/libexec/gsd-xsettings
             ├─2684 /usr/libexec/gsd-power
             ├─2688 /usr/libexec/gsd-screensaver-proxy
             ├─2689 /usr/libexec/gsd-color
             ├─2693 /usr/libexec/gsd-print-notifications
             ├─2694 /usr/libexec/gsd-sharing
             ├─2698 /usr/libexec/gsd-wwan
             ├─2711 /usr/libexec/gsd-datetime
             ├─2713 /usr/libexec/gsd-smartcard
             ├─2715 /usr/libexec/gsd-housekeeping

这是我的 xstartup 文件的内容:

~$ cat ~/.vnc/xstartup
#!/bin/sh
PATH=/usr/bin:/usr/sbin
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec /usr/bin/gnome-session &
$ ls -ls ~/.vnc/xstartup
4 -rwxrw-r-- 1 my_user my_user 117 fev 24 06:06 /home/my_user/.vnc/xstartup

通过 ssh 远程重启服务不起作用。因此,我认为这个问题与某些 gnome 初始化有关,但我无法自己修复它。

编辑:xstartupx权限。

相关内容