XServer Error could not create lock file

I have tried to create a config file for my xserver with X -configure in the root shell (started ubuntu 14.04 in the save mode and selected root shell). But it puts out this Error:

(EE) Fatal server error: (EE) Could not create lock file int /tmp/.tX0-lock (EE) (EE) Please consult the The X.Org Foundation support at http://wiki.x.org for help (EE)


If you dropped to a root shell from the Ubuntu recovery mode, then the filesystem is mounted in read-only mode by default. You will probably need to re-mount with read-write permissions in order to allow X -configure to write the xorg.conf file:

mount -o remount,rw /

(note: there is no space between the remount and rw options - just a comma). Then try the X -configure command again.