使用VNC获取错误:会话已在运行

时间:2015-02-27 00:21:26

标签: solaris-10

在Solaris 10中启动VNC会话时,我收到以下错误:

vncserver:0

VNC服务器已经运行为:0

ps -ef | grep -i vnc

root 19790 15407 0 05:55:22 pts / 3 0:00 grep -i vnc #

但是没有会话运行在:0。我不太确定我们是否需要定义:0端口。

4 个答案:

答案 0 :(得分:2)

经过大量努力,我发现删除.vnc文件夹(在$ Home内)解决了这个问题。 每次运行vncserver时都会创建.VNC文件夹。此文件夹的文件具有要杀死的vnc进程ID。 如果vncserver进程挂起并且在ps -ef命令中甚至不显示,则删除.vnc文件夹,之后vncserver将能够创建新的.vnc文件夹并终止现有进程。

答案 1 :(得分:0)

显示:0可能被先前失败的\ crashed vnc会话锁定。

您可以通过运行:

来终止:0会话
vncserver -kill :0

来自vncserver手册页:

 -kill :display#
      This  kills  a  VNC  desktop  previously  started  with
      vncserver.   It  does this by killing the Xvnc process,
      whose   process   ID   is   stored    in    the    file
      "$HOME/.vnc/host:display#.pid".    The   -kill   option
      ignores anything preceding the first colon (":") in the
      display  argument.   Thus,  you  can  invoke "vncserver
      -kill  $DISPLAY",  for  example  at  the  end  of  your
      xstartup file after a particular application exits.

您还可以检查锁定文件是否仍然存在。这是相关文件,来自手册页:

  

FILES        在目录中找到几个与VNC相关的文件        $ HOME / .vnc:

 $HOME/.vnc/xstartup
      A shell script specifying X applications to be run when
      a VNC desktop is started.  If this file does not exist,
      then vncserver will create a  default  xstartup  script
      which attempts to launch your chosen window manager.

 $HOME/.vnc/passwd
      The VNC password file.

 $HOME/.vnc/host:display#.log
      The log file  for  Xvnc  and  applications  started  in
      xstartup.

 $HOME/.vnc/host:display#.pid
      Identifies the Xvnc  process  ID,  used  by  the  -kill
      option.

例如,我使用:22启动vncserver然后将其杀死(两次):

[raamee 25 0 ~]$ vncserver :22

New 'myhost:22 (raamee)' desktop is myhost:22

Starting applications specified in /home/raamee/.vnc/xstartup
Log file is /home/raamee/.vnc/myhost:22.log

[raamee 26 0 ~]$ vncserver -kill :22
Killing Xvnc process ID 22733

[raamee 27 0 ~]$ vncserver -kill :22

Can't find file /home/raamee/.vnc/myhost:22.pid
You'll have to kill the Xvnc process manually

答案 2 :(得分:0)

对我来说,正如评论中所建议的那样,解决方案是从以前的运行中删除一些临时文件:

rm -f /tmp/.X0-lock
rm -f /tmp/.X11-unix/X0

答案 3 :(得分:0)

待办事项

sudo netstat -anp

你会发现xinetd持有端口。

tcp     0   0 0.0.0.0:5901      0.0.0.0:*         LISTEN      531/xinetd      
tcp     0   0 0.0.0.0:5902      0.0.0.0:*         LISTEN      531/xinetd 

如上所示为pid 531

kill 531

你很高兴。 我通过编辑/etc/xinetd.d/Xvnc来修复我的看起来像这样

service Xvnc
{
        type = UNLISTED
        disable = yes
        socket_type = stream
        protocol = tcp
        wait = yes
        user = root
        server = /usr/bin/Xvnc
        server_args = -inetd :1 -query localhost -geometry 1920x1080 -depth 24 -once -fp /usr/share/fonts/X11/misc -DisconnectClients=0 -NeverShared passwordFile=/root/.vncpasswd -extension XFIXES
        port = 5905
}