bingshui.org

the Life of Zim

7th February
2013
written by dzimney

THE ISSUE:
Last night I was messing around with SSH and X. Essentially attempting to use a Raspberry Pi as a client workstation to my Xubuntu 12.04 desktop. I played around a bit, shutdown my desktop remotely and went to bed. When I woke in the morning and attempted to log into desktop’s GUI. The screen would got blank, flash the following message and then go back to the login screen.

could not write bytes: Broken pipe
* Starting NFS kernel daemon
* Starting crash report submission daemon
speech-dispachter disabled: edit /etc/default/speach-dispatcher
* Stopping restore sound card(s') mixer state(s)
* Starting VirtualBox kernel modules
* Starting the Winbind daemon winbind
saned disabled: edit /etc/default/saned
* Starting NetBIOS name server

* Starting Mount network filesystems

* Stopping Mount network filesystems

* Checking battery state...

At some point last night, I believe that I also ran an update on Xubuntu. However, I can’t remember if I rebooted the system and had a successful login prior to messing around with SSH and X. That said, it’s possible that either could be the root of this problem.

THE TESTS:
In either case, in an attempt to figure out what was going wrong, I first switched to a terminal over the GUI login. To do this at the login screen press Crtl+Alt+F2. To switch back to the GUI from the terminal press Crtl+Alt+F7. From here I logged in with my normal user and password. I did not log in as root. Once logged in I attempted to start x from the terminal by issuing the following command: sudo startx

This produced the following output:

xauth: error in locking authority file ~/.Xauthority
xauth: error in locking authority file ~/.Xauthority

Fatal server error:
Server is already active for display 0
    If this server is no longer running, remove /tmp/.X0-lock and start again.

Please consult the The X.Org Foundation support at http://wiki.x.org for help.

ddxSigGiveUp: Closing log
No protocol specified
No protocol specified
xinit: giving up
xinit: unable to connect to X server: Resource temporarily unavailable
xinit: server error
xauth: error in locking authority file ~/.Xauthority

With this information my first action was to do what was suggested and “remove /tmp/.X0-lock and start again.” After doing so the problem persisted. I then attempted to start X from the terminal again to see what the output was. This time I got the following:

Fatal server error:
Server is already active for display 0
    If this sever is no longer running, remove /tmp/.X0-lock and start again.

Please consult the The X.Org Foundation support at http://wiki.x.org for help.

ddxSigGiveUp: Closing log
Invalid MIT-MAGIC-COOKIE-1 keyInvalid MIT-MAGIC-COOKIE-1 keyxinit: giving up
xinit: unable to connect to X server: Resource temporarily unavailable
xinit: server error

THE FIX:
Looking back at the orignal output from startx and spending a little time Googling the issue. I decided to try and remove the ~/.Xauthority file. And PRESTO! After a reboot, I was able to log in with no issue.

THOUGHTS:
Looking at the errors, it seems to me that I somehow locked up my display in X while doing so. It likely happened when I shutdown the system from SSH — the system shutdown will the SSH connection was active, resulting in the display remaining locked to the SSH session that would have been terminated by the shutdown. Admittedly, this could just be my failed interpretation of things.

I’m also not sure if I only needed to remove ~/.Xauthory or if it was also necessary that I removed /tmp/X0-lock. However, it seemed odd that the message to remove /tmp/X0-lock remained in the output from my second attempt at running startx, while the first and final errors regarding the .Xauthority file were missing. Curious… but not that curious.

NOTES:
Throughout this post, I’ve replaced terminal outputs containing the full path to my user directory with “~”.