AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 877930
Accepted
Edward_178118
Edward_178118
Asked: 2017-10-12 01:38:48 +0800 CST2017-10-12 01:38:48 +0800 CST 2017-10-12 01:38:48 +0800 CST

无法让 VNC 服务器在 CentOS 7.4 中工作

  • 772

我正在使用 Gnome 运行 CentOS 7.4,并且在让 VNC 服务器为客户端提供桌面环境时遇到问题。我要么得到一个空白的黑屏,要么得到一个带有复选框的文本。它正在为 VNC 运行:

Xvnc TigerVNC 1.8.0 - built Aug  7 2017 01:32:32

如果我使用主目录中提供的 .vnc/xstartup :

#!/bin/sh

unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec /etc/X11/xinit/xinitrc

它会提示输入密码,但它只是提供一个空白的黑屏。它根本不存在。当我从控制台登录到同一个帐户时,它工作得很好。

我让 VNC 服务器在一个现已退役的 CentOS 6 系统上工作,所以我决定从那个系统尝试 xstart:

#!/bin/sh

vncconfig -iconic &
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
OS=`uname -s`
if [ $OS = 'Linux' ]; then
  case "$WINDOWMANAGER" in
    *gnome*)
      if [ -e /etc/SuSE-release ]; then
        PATH=$PATH:/opt/gnome/bin
        export PATH
      fi
      ;;
  esac
fi
if [ -x /etc/X11/xinit/xinitrc ]; then
  exec /etc/X11/xinit/xinitrc
fi
if [ -f /etc/X11/xinit/xinitrc ]; then
  exec sh /etc/X11/xinit/xinitrc
fi
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &
exec gnome-session &

但这会为客户端生成带有以下复选框和文本的灰屏:

Accept clipboard from viewers
Also set primary selection
Send clipboard to viewers
Send primary selection to viewers

我可以选中和取消选中这些框,仅此而已。不要得到我根据我看过的 CentOS 7 文章和文档编辑的桌面环境:

这是 /etc/systemd/system/vncserver@:1.service 文件:

# The vncserver service unit file
#
# Quick HowTo:
# 1. Copy this file to /etc/systemd/system/[email protected]
# 2. Replace <USER> with the actual user name and edit vncserver
#    parameters appropriately
#   ("User=<USER>" and "/home/<USER>/.vnc/%H%i.pid")
# 3. Run `systemctl daemon-reload`
# 4. Run `systemctl enable vncserver@:<display>.service`
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted!  For a secure way of using VNC, you should
# limit connections to the local host and then tunnel from
# the machine you want to view VNC on (host A) to the machine
# whose VNC output you want to view (host B)
#
# [user@hostA ~]$ ssh -v -C -L 590N:localhost:590M hostB
#
# this will open a connection on port 590N of your hostA to hostB's port 590M
# (in fact, it ssh-connects to hostB and then connects to localhost (on hostB).
# See the ssh man page for details on port forwarding)
#
# You can then point a VNC client on hostA at vncdisplay N of localhost and with
# the help of ssh, you end up seeing what hostB makes available on port 590M
#
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
#
# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel.  See the "-via" option in the
# `man vncviewer' manual page.


[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[Service]
Type=forking
User=justme

# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=-/usr/bin/vncserver -kill %i
ExecStart=/usr/bin/vncserver %i
PIDFile=/home/justme/.vnc/%H%i.pid
ExecStop=-/usr/bin/vncserver -kill %i

[Install]
WantedBy=multi-user.target

我查看了日志文件,我看到的唯一错误/警告是:

[root@myserver ~]# systemctl status vncserver@:1.service
● vncserver@:1.service - Remote desktop service (VNC)
   Loaded: loaded (/etc/systemd/system/vncserver@:1.service; enabled; **vendor preset: disabled**)
   Active: inactive (dead) since Wed 2017-10-11 05:04:32 EDT; 21min ago
  Process: 2456 ExecStop=/usr/bin/vncserver -kill %i (code=exited, status=0/SUCCESS)
  Process: 1410 ExecStart=/usr/bin/vncserver %i (code=exited, status=0/SUCCESS)
  Process: 1358 ExecStartPre=/usr/bin/vncserver -kill %i (code=exited, status=2)
 Main PID: 1570 (code=exited, status=0/SUCCESS)

Oct 11 05:01:31 myserver vncserver[1358]: Can't find file /home/justme/.vnc/myserver:1.pid
Oct 11 05:01:31 myserver vncserver[1358]: You'll have to kill the Xvnc process manually
Oct 11 05:01:34 myserver vncserver[1410]: New 'myserver:1 (justme)' desktop is myserver:1
Oct 11 05:01:34 myserver vncserver[1410]: Starting applications specified in /home/justme/.vnc/xstartup
Oct 11 05:01:34 myserver vncserver[1410]: Log file is /home/justme/.vnc/myserver:1.log
Oct 11 05:01:34 myserver systemd[1]: Started Remote desktop service (VNC).
Oct 11 05:01:34 myserver gnome-session[1952]: gnome-session-binary[1952]: **WARNING: software acceleration check failed: Child process exited with code 1**
Oct 11 05:01:34 myserver gnome-session-binary[1952]: WARNING: software acceleration check failed: Child process exited with code 1
Oct 11 05:04:32 myserver vncserver[2456]: Killing Xvnc process ID 1570
Oct 11 05:04:32 myserver vncserver[2456]: Xvnc process ID 1570 already killed

我已经尝试更改 xstartup 和 etc/systemd/system/vncserver@:1.service 文件,但是除了空白的空白屏幕或带有复选框的屏幕之外,它们都没有产生结果。

如果有这方面经验的人对更多故障排除提出建议,或者您能够看到问题所在,请提出您的想法。

centos7
  • 2 2 个回答
  • 17213 Views

2 个回答

  • Voted
  1. Best Answer
    Edward_178118
    2017-10-12T23:05:22+08:002017-10-12T23:05:22+08:00

    遵循https://www.linuxtechi.com/install-configure-vnc-server-centos-7-rhel-7/等说明后, 它仍然无法正常工作。我在这里记录解决方案,以防其他人遇到这种情况。

    解决方案: 删除 Nvidia 驱动并用 xorg-x11-drv-nouveau 替换它。这解决了问题。这就是我删除它的方式: https ://ask.fedoraproject.org/en/question/78969/how-to-remove-the-nvidia-proprietary-driver/

    从那以后,我进行了一些搜索,并看到提到 Nvidia 驱动程序破坏了 VNC,即使它适用于有线显示器。

    • 4
  2. bravo
    2019-02-15T03:51:14+08:002019-02-15T03:51:14+08:00

    尝试启动两个过程:

    systemctl start vncserver-x11-serviced systemctl enable vncserver-x11-serviced systemctl start vncserver-vrituald systemctl enable vncserver-vrituald

    启动 vncserver

    • -2

相关问题

  • 如何在 Centos 上保持 openvpn 连接打开

  • LIST 上的 ProFTPd 超时

  • 与 AWS 中的其他系统相比,CentOS 报告的总内存较低

  • SELinux 阻止 Apache 写入文件

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve