Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

/tmp/.X0-lock

1,744 views
Skip to first unread message

Charles Kroeger

unread,
May 5, 2017, 7:20:03 PM5/5/17
to
running freshly upgraded kernel image 4.9.0.3 on normal boot with startx
command but getting the following error message from (X server) xorg: could not
create lock file in /tmp/.X0-lock (the contents of, are the numbers 2994)
unable to connect to the X server: connection refused

there's a lot about this problem on the Internet but the information is
quite old and nothing applies to my present problem, it would seem.

happily and also the reason I'm writing this letter (et.al) is that I can still
use the sysvinit boot option that presents a graphical login and after that
starts the X server. (I then have to run 'service network restart' to connect
to the Internet and there is complaining about that being deprecated but good
thing something works.

there's more error messages I've decided to keep as separate post, in the spirit
of helping others down the line.

--
CK

Ben Caradoc-Davies

unread,
May 5, 2017, 7:30:03 PM5/5/17
to
On 06/05/17 11:06, Charles Kroeger wrote:
> running freshly upgraded kernel image 4.9.0.3 on normal boot with startx
> command but getting the following error message from (X server) xorg: could not
> create lock file in /tmp/.X0-lock (the contents of, are the numbers 2994)
> unable to connect to the X server: connection refused

Check permissions and free space:

ls -ld /tmp
ls -l /tmp/.X0-lock
df /tmp

If /tmp/.X0-lock already exists, is there another instance of the X
server running (with that PID? Or did a previous instance crash without
removing it?

Kind regards,

--
Ben Caradoc-Davies <b...@transient.nz>
Director
Transient Software Limited <http://transient.nz/>
New Zealand

Charles Kroeger

unread,
May 5, 2017, 8:30:04 PM5/5/17
to

>ls -ld /tmp

drwxrwxrwt 10 root root 20480 May 5 18:58 /tmp

(looks good)

>ls -l /tmp/.S0-lock

-r--r--r-- 1 root root 11 May 5 17:36 /tmp/.X0-lock

>df /tmp

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdc1 245996848 42724396 203256068 18% /

> If /tmp/.X0-lock already exists, is there another instance of the X
> server running (with that PID? Or did a previous instance crash without
> removing it?>

not that I know of how do you tell if there's another X server running. I mean
there is after I do a sysvinit boot (from the grub advanced menu) but on a
reboot of course the X server obviously shuts down (or does it?)

--
CK

Ben Caradoc-Davies

unread,
May 5, 2017, 9:00:03 PM5/5/17
to
On 06/05/17 12:09, Charles Kroeger wrote:
> not that I know of how do you tell if there's another X server running. I mean
> there is after I do a sysvinit boot (from the grub advanced menu) but on a
> reboot of course the X server obviously shuts down (or does it?)

Does the PID in the lock file correspond to a running process?

ps -f `cat /tmp/.X0-lock`

Are there any running instances of an X server?

ps -fC Xorg

Charles Kroeger

unread,
May 5, 2017, 10:20:04 PM5/5/17
to
> Does the PID in the lock file correspond to a running process?
>
> ps -f `cat /tmp/.X0-lock`

I get nothing from that command

> Are there any running instances of an X server?
>
> ps -fC Xorg

UID PID PPID C STIME TTY TIME CMD
root 2994 2812 0 17:36 tty7 00:01:23 /usr/lib/xorg/Xorg :0 -seat
seat0 -auth /var/run/lightdm/root/:0 -nolist

that would be the one I'm using. I will try that command after stopping the
X-server

after stopping the X-server I ran: ps --fC Xorg
UID PID PPID C STIME TTY TIME CMD

on running startx (as user) the X server failed to start with these error
messages:

(EE) could not create lock file in /tmp/.tX0-lock

Xinit: unable to connect to X server: connection refused

Xauth: error in locking authority file /home/charles/.Xauthority

the contents of this file is some machine language symbols and some
english -MIT-MAGIC-COOKIE-1 (and) mundo 0 -MIT-MAGIC-COOKIE-1
(and that is all)

thanks for being patient,

--
CK

Greg Wooledge

unread,
May 8, 2017, 8:20:04 AM5/8/17
to
On Fri, May 05, 2017 at 06:06:30PM -0500, Charles Kroeger wrote:
> I can still
> use the sysvinit boot option that presents a graphical login and after that
> starts the X server. (I then have to run 'service network restart' to connect
> to the Internet and there is complaining about that being deprecated but good
> thing something works.

On Fri, May 05, 2017 at 09:04:02PM -0500, Charles Kroeger wrote:
> UID PID PPID C STIME TTY TIME CMD
> root 2994 2812 0 17:36 tty7 00:01:23 /usr/lib/xorg/Xorg :0 -seat
> seat0 -auth /var/run/lightdm/root/:0 -nolist
>
> that would be the one I'm using. I will try that command after stopping the
> X-server
>
> after stopping the X-server I ran: ps --fC Xorg
> UID PID PPID C STIME TTY TIME CMD
>
> on running startx (as user) the X server failed to start with these error
> messages:
>
> (EE) could not create lock file in /tmp/.tX0-lock

I'm assuming you are on stretch.

So, when you allow lightdm to run at boot, everything is fine, but if you
run "startx" as a non-root user from a text console, you get the error.

lightdm is running the X server as root (verified by your ps output),
and this is presumably creating the /tmp/.X0-lock (and/or .tX0-lock)
file(s) as root.

Then, when you try to run startx as a non-root user, it tries to create
the same file(s), but they already exist under a different owner (root),
and so it fails. (And this would have worked under jessie, because the
X server ran setuid root in jessie. Not so in stretch.)

The obvious temporary fix would be to remove those files (as root, after
verifying that the X server is indeed terminated). I do not know how
a permanent fix would be achieved. My first guess would be that either
lightdm or Xorg should be removing those files from /tmp upon termination,
but I don't know which one.
0 new messages