I did a bad thing the other day and have just barely lived to tell about it. I turned of my Linux box without shutting down. All you Linux & Unix veterans know my horror when I realized what I had just done. I hit the shutdown button and, when the screen briefly blanked out before going into the shutdown graphic, I hit the power button on my power strip to turn it all off. Oh oh, says I...
Now, I never used to shut off my machine(s). The only time I have ever had a hardware problem (he says, knocking on wood), is when I was turning on a machine. Given that, and some daemons that like to run in the background at night, I usually left my computers turned on.
But I have started to get more worried about power consumption, including 'zombie' electronic devices, I have started to power down all the computers in the house before I head to bed. It makes me feel all virtuous and green. But the other night I nearly paid dearly for my greeness.
When I turn the computer on the next morning, it booted to a text screen. Somehow, I just wasn't surprised. But I couldn't figure out why. dmesg told me nothing, nor did /var/log/messages. But when I tried to 'startx', I got a complaint about .X0.lock and a "stale NFS handle". How odd, as I don't use NFS at all.
Well, this file proved to be very difficult to get rid of. See, when your X server starts up, it creates this file to prevent X from running twice. So at startup, it checks to see if /tmp/.X0.lock exists. If it doesn't, X will create it and carry on its merry way. If it does, it assumes X is already running and will complain, albeit in a very obscure fashion. The usual solution, if you're sure there isn't a X server already running, is to just delete it. But 'stale NFS handle' files are a real pain to delete, especially if they aren't really NFS handles!
I had an inkling that I needed to run fsck on the partition, but that's a problem on the root partition. Luckily, I have several other Linux partitions I can boot into, so I just booted up my openSUSE 11.1 and tried fsck from there. Haven't made the jump to 11.1 yet, as too many of my packages don't quite work right, or I don't like the newer versions (I'm talking to you, Eclipse Ganymede and Amarok 2). But fsck
didn't find anything wrong either, so I was stuck for ideas.
But then I read about the force option for e2fsck, so I ran that. Voila! A few odd errors, but most especially an odd error with .X0.lock. So I mounted the filesystem while still in 11.1 and was finally able to delete the .X0.lock file. And the reboot back into my 11.0 openSUSE went swimmingly!
So the lessons learned:
- If X won't start, try removing the lock file found at /tmp/.X0.lock
- If you can't remove a file because there is a bogus 'stale NFS handle' error (and believe me, it doesn't let you do anything with it), try forcing an fsck on the partition
No comments:
Post a Comment