0

Been working with RPi3, fresh installed this Jessie OS and had no problems for ages, until earlier today.

Current situation: When booting pi, the messages aren't the same as before, but ends with the line No directory, logging in with HOME=/. I try startx and it freezes for ages, then returns "xauth: timeout in locking authority file //.Xauthority". After a little longer left alone, it eventually returns: (with a few extra lines of just (EE) removed for clarity, if that's actually something important do let me know and I'll type out the results again)

(EE) Fatal server error: Cannot open log file "//.local/share/xorg/Xorg.0.log" 
Please consult the The X.Org Foundation support at http://wiki.x.org for help.
xinit: giving up
xinit: unable to connect to X server: connection refused

How it worked before: Booted to terminal thing, I could just type in 'startx' and the GUI desktop appeared all pretty and wonderful and automatic...

What I've tried already: I've read some other similar situations on this forum, and elsewhere on the web, and some went as follows:
"sudo chown pi ~/.Xauthority" - did this one and got no response from terminal, then I tried the next step to "chmod u+rw ~/.Xauthority" and got the response "chmod: cannot access '/home/pi/.Xauthority': Permission denied"
"sudo chown -R pi:pi /home/pi" - gets no response, then trying "xauth -b" gives "Attempting to break locks on authority file /.Xauthority", waits a few seconds, then shows "xauth: timeout in locking authority file /.Xauthority"

How to replicate error: I'm not 100% sure, but I know it was while I was using chmod and chown commands that everything went wrong...
EDIT: This error occurred while I was trying to set up MySQL, python and django. I assume I installed them correctly the first time, as I was able to check versions and create a project and run server etc, but when I tried to set up another project following the same instructions, I reached this point. I was following instructions from this website. Since posting this question I have successfully been able to SSH to the Pi, but on login I recieve this message:

Could not chdir to home directory /home/pi: Permission denied
-bash: /home/pi/.bash_profile: Permission denied

And when I try to cd to pi, the message is similar:

-bash: cd: pi: Permission denied

What I want to happen: StartX to be running like before! Ah! Any help is hugely appreciated, and I apologise in advance for my level of understanding with Linux...

This is my first time posting a question here, so go easy on me (ha), and PLEASE let me know if there's anything you think might work, I'll be sure to execute and reply with any further information. Let's figure this out! - peanut

  • Why did you fiddle with it? What were you trying to achieve? Learn to use the code formatting to make it possible for others to see what you have done. Writing things like StartX does not enhance your credibility, type EXACT commands as you enter them. Probably no one can help, because it unclear what you did. If you don't have a backup I suggest you start again. – Milliways Jul 20 '17 at 11:14
  • I was following instructions to install Django - bear with me I'll edit the original question, include a link, and try to improve it. Thank-you. – P.Nut Jul 20 '17 at 11:16
  • @Milliways thank-you for your comments, I have updated the question. – P.Nut Jul 20 '17 at 12:02
0

Fixed it! (In the sense that I can at least now startx, I still can't startx as the pi user though...) Thought I'd share how just in case anyone else finds themselves in this position... This is basically in a nutshell what I did on the Pi:

#Login as root instead of pi user
sudo su
passwd root

then gave it a password, I don't know if this part is relevant but it's what I did...

#Change directory to the broken user, which I couldn't do before...
cd /home/pi/ 
#Rename .Xauthority file with...
mv .Xauthority OLD.Xauthority 
reboot
startx 

And yeah. It worked. Also, when logging in, I opened the terminal and discovered the last commands I typed before this, detailed as follows...

sudo chmod -R 775 /home/pi/PROJECT/

Turns out I'd tried editing permissions because the Thonny editor was not letting me save any changes to the settings.py file in my Django project. Hope this helps someone else out...

  • 1
    By using sudo su you have become root for the entire time you are using the GUI. This is not a good idea from a security point of view. I would not consider this a fix but a kludge. – Steve Robillard Jul 20 '17 at 12:32
  • Ah, thank-you. I've tried raspberrypi.stackexchange.com/a/1735/70540 answers here but I still get timeout in locking authority file... do you have any other suggestions? – P.Nut Jul 20 '17 at 12:36
  • At this point, I would suggest backing up any important files from your SD card and restart with a fresh install. I normally don't suggest such drastic measures, but given that you do not know what you did, and what other gotchas may be lurking in your system I think it is the best option. As an aside some commands such as chown do not return a message unless there is an error. – Steve Robillard Jul 20 '17 at 12:40
  • That was what I did, the chmod line in that answer, followed by running the server again, then rebooting... Ah darn, I was really hoping that wouldn't be what I'd have to do :( might be a pain... thanks anyway for trying! – P.Nut Jul 20 '17 at 12:51
  • Most of us have been in the situation you are when we were first starting out. I suggest you learn the lesson and implement some best practices when you setup your Pi next time 1) backups - had you had a backup from before you started trying to install django you could simply restore the backup copy, 2) you should never blindly apply a command that you don't know what it does - the man command will give you the help for the command (e.g. man ls or man man). There are other lessons but these of big ones. – Steve Robillard Jul 20 '17 at 12:55

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.