1

There are some pages about timeout in locking authority file /root/.xauth but I really don't understand what is the root of the problem.

As I start vnc service, I see:

root@cluster:mahmood# /etc/init.d/vncserver start
Starting VNC server: 1:vahidms xauth:  timeout in locking authority file /root/.xauthVdNayr

New 'cluster.scu:1 (vahidms)' desktop is cluster.scu:1

Starting applications specified in /home/vahidms/.vnc/xstartup
Log file is /home/vahidms/.vnc/cluster.scu:1.log

Although the command is run by root, but it seems that it wants to access /root/.xauthVdNayr on behalf of /home/vahidms (a user).

So, why?

UPDATE 1 Please see the output of the commands as stated in the answer

root@cluster:~# ls -l /etc/init.d/vncserver
-rwxr-xr-x 1 root root 3126 Dec  8  2011 /etc/init.d/vncserver
root@cluster:~# grep -i xauth /etc/init.d/vncserver
root@cluster:~# env | grep XAUTHORITY
root@cluster:~# su - vahidms
vahidms@cluster:~$ env | grep XAUTHORITY
vahidms@cluster:~$ exit
logout
root@cluster:~# lslocks
-bash: lslocks: command not found

UPDATE 2

Please see the related output. I wonder why the lslocks command is not available.

root@cluster:~# yum list | grep util-linux-ng.x86_64
util-linux-ng.x86_64                       2.17.2-12.18.el6            @base
root@cluster:~# find / -name lslocks
root@cluster:~# grep -i xauth /usr/bin/vncserver
$xauth = "xauth";
$xauthorityFile = "$ENV{XAUTHORITY}" || "$ENV{HOME}/.Xauthority";
open (XAUTH, "|xauth -f $xauthorityFile source -");
print XAUTH "add $host:$displayNumber . $cookie\n";
print XAUTH "add $host/unix:$displayNumber . $cookie\n";
close XAUTH;
$cmd .= " -auth $xauthorityFile";
    if (-x "/usr/X11R6/bin/xauth") {
        $xauth = "/usr/X11R6/bin/xauth";
        foreach $cmd ("xauth") {
root@cluster:~# grep -i env /etc/init.d/vncserver
root@cluster:~# grep -i env /etc/rc.d/init.d/vncserver
root@cluster:~#  

Any idea?

1

vncserver is a perl script, so you look inside to see that it runs xauth to add a newly created random MIT-MAGIC-COOKIE-1 value (got from mcookie) for the server it is about to start. By default it tells xauth to use the file ~/.Xauthority, but you seem to have set XAUTHORITY=/root/.xauthVdNayr in your environment, and this takes precedence.

The authority file to use is normally in the home directory of the user that will be creating clients for the server.

You are probably inheriting the XAUTHORITY from xdm or some similar display manager, and it is probably the process that has locked the file. Use command lslocks to list which commands have which files locked.

You can simply unset the XAUTHORITY environment variable so that the default file is used.

  • Please see the updated post – mahmood May 25 '16 at 18:33
  • I'm assuming /etc/init.d/vncserver runs /usr/bin/vncserver or similar. I have fedora 22 which I thought would be similar in some ways with centos. You need to check the env inside /etc/init.d/vncserver for XAUTHORITY. You might find lslocks in the package util-linux. – meuh May 25 '16 at 18:43
  • Please see the updated post. Any more idea? – mahmood May 25 '16 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.