我安装了TightVNC在Ubuntu20.04* 机器以便从我的 macbook pro 远程使用它。我已关注本教程,
它适用于fce4桌面。但我有一个黑屏每当我尝试使用gnome 桌面有了它:我试图改变配置如下这个问题,但似乎没有什么效果。
这是〜/ .vnc / xstartup
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
export XKL_XMODMAP_DISABLE=1
export XDG_CURRENT_DESKTOP="GNOME-Flashback:GNOME"
export XDG_MENU_PREFIX="gnome-flashback-"
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
gnome-session --builtin --session=gnome-flashback-metacity --disable-acceleration-check --debug &
nautilus &
gnome-terminal &
我的/etc/systemd/系统/[电子邮件保护]
[Unit]
Description=Start TightVNC server at startup
After=syslog.target network.target
[Service]
Type=forking
User=ben
Group=ben
WorkingDirectory=/home/ben
PIDFile=/home/ben/.vnc/%H:%i.pid
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 -localhost :%i
ExecStop=/usr/bin/vncserver -kill :%i
[Install]
WantedBy=multi-user.target
以及服务文件/etc/systemd/系统/[电子邮件保护]
[Unit]
Description=Start TightVNC server at startup
After=syslog.target network.target
[Service]
Type=forking
User=ben
Group=ben
WorkingDirectory=/home/ben
PIDFile=/home/ben/.vnc/%H:%i.pid
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 -localhost :%i
ExecStop=/usr/bin/vncserver -kill :%i
[Install]
WantedBy=multi-user.target
命令sudo systemctl status vncserver@1
返回:
● [email protected] - Start TightVNC server at startup
Loaded: loaded (/etc/systemd/system/[email protected]; enabled; vendor preset: enabled)
Active: inactive (dead) since Mon 2021-02-22 12:26:43 CET; 4min 53s ago
Process: 11916 ExecStop=/usr/bin/vncserver -kill :1 (code=exited, status=0/SUCCESS)
Main PID: 1235 (code=exited, status=0/SUCCESS)
Feb 22 12:01:51 ben-monster gnome-session-binary[1305]: WARNING: App 'org.gnome.Shell.desktop' exited with code 1
Feb 22 12:01:51 ben-monster gnome-session-b[1305]: unable to create file '/home/ben/.cache/dconf/user': Permission denied. dconf will not work properly.
Feb 22 12:01:51 ben-monster gnome-session[1305]: gnome-session-binary[1305]: CRITICAL: We failed, but the fail whale is dead. Sorry....
Feb 22 12:01:51 ben-monster gnome-session-binary[1305]: WARNING: App 'org.gnome.Shell.desktop' respawning too quickly
Feb 22 12:01:51 ben-monster gnome-session-binary[1305]: Unrecoverable failure in required component org.gnome.Shell.desktop
Feb 22 12:01:51 machine-name gnome-session-binary[1305]: CRITICAL: We failed, but the fail whale is dead. Sorry....
Feb 22 12:26:43 machine-name org.gtk.vfs.Daemon[1913]: A connection to the bus can't be made
Feb 22 12:26:43 machine-name vncserver[11916]: Killing Xtigervnc process ID 1235... which was already dead
Feb 22 12:26:43 machine-name vncserver[11916]: Cleaning stale pidfile '/home/ben/.vnc/machine-name:1.pid'!
Feb 22 12:26:43 machine-name systemd[1]: [email protected]: Succeeded.
此外,我的黑屏上出现了错误信息:
无法更新 ICEAuthority 文件 /run/-/user//-ICEAuthority
这可能是配置或权限错误,但经过两天的尝试后,我开始失去信心了。
答案1
我只是按照你的配置做了一些改动,我想我最终得到了你想要的:
。我的改变是:
我修正了以下行:
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
经过
ExecStartPre=/usr/bin/vncserver -kill :%i > /dev/null 2>&1
前面没有‘-’字符/usr/bin
除此之外,我将用户名称的引用从“ben”更改为我的用户:
User=ben
Group=ben
WorkingDirectory=/home/ben
PIDFile=/home/ben/.vnc/%H:%i.pid
因此,我的文件最终为:
User=my_user
Group=my_user
WorkingDirectory=/home/my_user
PIDFile=/home/my_user/.vnc/%H:%i.pid
假设您的用户实际上是ben
,我认为您的主文件夹中有一些文件权限有限/home/ben
。您可以检查这个问题了解有关修复它的详细信息。也许您需要使用命令将此目录中文件的所有权授予用户 ben,chown
或者仅使用更改权限chmod
。
答案2
我通过从 /etc/gdm3/custom.conf 中取消注释“WaylandEnable=false”获得了它
然后
sudo apt update
sudo apt install xserver-xorg-video-dummy
sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.bak # this file may not exist so if there is an error, it can be ignored
sudo cp /etc/X11/vncserver-virtual-dummy.conf /etc/X11/xorg.conf
注意:按照这些步骤操作会导致任何连接的显示器显示空白屏幕。如果您需要使用显示器,请运行 sudo mv /etc/X11/xorg.conf /etc/X11/xorg.conf.dummy 并重新启动