[vox-tech] Part Way Into X

ME vox-tech@lists.lugod.org
Fri, 28 Jun 2002 16:18:58 -0700 (PDT)


On Fri, 28 Jun 2002, Peter Jay Salzman wrote:
> begin ME <dugan@passwall.com> 
> > These would likely be options or packages. I do not use RedHat, but might
> > expect it could come up like this... 
> > You choose to install a new game, and while doing so the installer tells
> > you that you need to install other packages. These other packages might
> > include names like those above ("add support for DRI", "Support for GLX",
> > "support for hardware accelleration", "3d video card support").
>  
> mike, you prolly saw this in my previous post, but his card doesn't
> support DRI.  his mtrr's also weren't set up correctly.  but neither of
> these should be "problems".   
> 
> i couldn't see anything obviously wrong with stderrput of startx.

Yeah, one of those "composing a message so cant read while
writing" things.

> jim, if you send me the output of dmesg, i'll look at your boot messages
> and see if anything is wrong there.
> 
> the only reason why i suggest this is you mentioned that the machine's
> lost networking at the same time as it lost a functioning window/desk
> manager.
> 
> sounds suspicious that both happened at the same time.  makes me think
> there might be a larger issue here.
> 
> hmm...  just for shits and giggles, why not post the output of "df -h"?

It also might be a good idea to make startx into a wrapper that:
checks to see if ~/.X.log exists, and if so, moves it to ~/.X.log.0 and
then runs the "real" startx with a > ~/.X.log 2>&1 &

This way, if/when it happens again, you should be able to find the errors
where is died if they were actually logged.

The problem with this is that there is no guarantee that there was a sync
just before a freeze and the last bits of data may not actually be in the
log file. It is however, better than nothing.

You may also want to examine your distro to see if it has this feature
built-in. (That is to roll your X server output into different logs for
each restarts of the X Server.)

Below is a poorly designed wrapper that could be much better, but provides
with some very basic and not so secure code. (This is not production, it
is for one user doing a test on their own machine.)

You could mv the real "startx" to /usr/local/bin/startx and then save this
one where the original "startx" was and change the line below
"/path/to/real/startx" to "/usr/local/bin/startx" and then chmod 755 this
wrapper/shell script.

Once done, the next time you have this sort of problem... see if you can
find a way to get back to a shell and sync or just wait some time and hope
data does get synced or have a process sync often, or run a service to
allow sync to take place upon connect or try to enable synchronous writed
(costly) on your fs or...

Anyway, here is a basic wrapper that could be imporved in many places...
----- cut below this line such that the next line it in top of file ----
#!/bin/bash
#
# new startx shell script and wrapper

#If there exists a file in the calling user's home directory called
#  ".X.log" ...
if [ -e ~/.X.log ]; then
	# Rotate the file to an archive: (only keep one for now)
	mv ~/.X.log ~/.X.log
	# If the exit status of the last command (mv) is non-zero
	#  (unhappy) ...
	if [ "$?" != "0" ]; then
		/bin/echo "Error with backing up last log file."
	else
		/bin/echo "Rotated X Server Log file"
	fi
# If there is no file called ".X.log" in the caling user's home dir...
else
	/bin/echo "First instance of ~/.X.log - creating a new one"
fi

#Tell the user what we do:
/bin/echo "Now starting X with stdout and stderr directed to ~/.X.log"
#Actually launch the real startx after it was moved/renamed and
# redirect stderr to std out and send std out to destructively
# overwrite the file ".X.log" in the calling users home dir and then wait
# for it to finish before moving on...
/path/to/real/startx $@ > ~/.X.log 2>&1
# Check the exit status. Of course, if X is really hosed, it will never
#  get here. However, on the off chance it is able to get here when
#  nothing else works, then sync the disk, etc.

export XEXITST="$?"

if [ "$XEXITST" != "0" ]; then
	sync
else
	/bin/echo "X Server exited with zero (happy) exit status.)
fi

#Have this script return the same exit status of the real startx
exit $EXITST

----- cut above this line such that the prev line it in top of file ----