Could not write pid to lock file

Error SCreen

I was working on my Pi when suddenly it stuck. I attempted to restart but upon entering startx I got the error " Could not write pid to lock file in /tmp/xtX0-lock ' I've looked around and many people advised running the df -h Command. I have done that and nothing has changed for me. Looking at the error screen it seems to be out of space, but placing it on my windows computer it shows me space. But even if it really is out of space. How do I clear up some items or what can I delete as I really have scripts I need. Thank you

asked Mar 16, 2016 at 18:06 103 2 2 silver badges 7 7 bronze badges

Windows does not show that full partion (which is mounted as root), windows shows you only the fat-partition (mounted as /boot) - which is not full. You'll need to get rid of some files, your package managers cache is a good point to start with.

Commented Mar 16, 2016 at 18:19

2 Answers 2

This is usually caused by a stale lock file from a crashed previous session. As root, look for an existing /tmp/xtX0-lock and delete it, then try starting X again.

Being out of drive space will also do it. Try deleting everything under /var/log , then use sudo apt-get erase to perhaps remove some packages you don't actually need.

NOTE: Don't delete the directory structure under /var/log . just delete files; otherwise some services that expect certain log directories to exist will fail to start.

Realistically, 4GB is much too small a root device on a system which runs X. Image the SD card onto a larger one and expand the fs.