We've been having troubles recently using Cygwin from last week, and today I checked my personal installation which is 3 or 4 weeks older than that, and found the problem is present in that, too.
The symptom is that sometimes XWin.exe starts, but doesn't show an icon in the taskbar, and you can't display any X windows (like xterm, rxvt). They start, but no windows appear. A look at the task list shows xrdb running. We're not using the standard supplied startup scripts (I've attached our simpler ones, below). We wanted to provide all these features: 1) A default working X setup. (E.g. we found -multiwindow crashed X, but -rootless worked okay. So we wanted to change the default options.) 2) We want easily configured per-user options. 3) We want a user to be able to start X after someone else has started it, so we wanted to use XWin.log.$USER for the log file, not XWin.log. (If Administrator owns /tmp/XWin.log, you have to have admin rights to remove it, so you can start X. Or override the log file.) 4) We want a much simpler and easy to fix script than startx. We didn't need all the features startx provides. I'll attach the startup script, cisraxwin.sh and the DOS equivalent, and the default user.xinitrc. The user can define WINDOWMANAGER in their environment to select a WM, they can set XSERVER_ARGS in their environment to select what options are passed to XWin, and it detects whether X was started with -multiwindow and avoids running a WM in that case. It all works, mostly, but maybe every 2nd time or every 4th time we start X with it, X fails as mentioned above. Here is some sample output, with comments typed by me in the shell, to show what's happening. (I've indented all the output copied from the rxvt window, to make it clearer what is what. cisraxwin.sh, user.xinitrc and cisrastartx.bat are attached at the end.) : /tmp ; tail -f XWin.xlog.luke winPointerWarpCursor - Discarding first warp: 747 600 winProcEstablishConnection - Hello winInitClipboard () winProcEstablishConnection - winInitClipboard returned. winClipboardProc - Hello DetectUnicodeSupport - Windows NT/2000/XP (II) XF86Config is not supported (II) See http://x.cygwin.com/docs/faq/cygwin-x-faq.html for more information winDetectSupportedEngines - Windows NT/2000/XP winDetectSupportedEngines - DirectDraw installed : /tmp ; # X is not starting, icon hasn't appeared in tray, xrdb stopped : /tmp ; ps ax PID PPID PGID WINPID TTY UID STIME COMMAND 3952 1 3952 3952 con 11021 Jul 15 /usr/bin/rxvt 3924 3952 3924 2656 1 11021 Jul 15 /usr/bin/bash 2984 1 2984 2984 con 11021 Jul 15 /usr/bin/rxvt 3292 2984 3292 2716 0 11021 Jul 15 /usr/bin/bash 3256 1 3256 3256 con 11021 Jul 16 /usr/bin/rxvt I 3408 3256 3408 2660 2 11021 Jul 16 /usr/bin/bash I 2324 1 2324 440 3 11021 Jul 19 /usr/bin/bash I 2768 1 2768 3400 4 11021 Jul 19 /usr/bin/bash I 800 1 800 3280 5 11021 Jul 19 /usr/bin/bash I 3520 1 3520 4000 6 11021 Jul 19 /usr/bin/bash 212 1 212 3544 9 11021 Jul 19 /usr/bin/sh I 2448 212 212 2936 9 11021 Jul 19 /usr/bin/ssh I 3600 1 3600 3120 11 11021 Jul 19 /usr/bin/bash S 2168 1 2168 2180 13 11021 Jul 19 /usr/bin/bash 3736 3612 3508 3440 1 11021 Jul 22 <defunct> 676 3612 3508 676 1 11021 Jul 22 <defunct> 1968 3292 1968 3932 0 11021 14:34:48 /usr/bin/sh 4012 1 4012 268 8 11021 Jul 19 <defunct> 2164 1968 1968 3072 0 11021 14:34:50 /usr/bin/sh 2824 2164 1968 4056 0 11021 14:34:50 /usr/X11R6/bin/xrdb 3984 3924 3984 2908 1 11021 14:36:28 /usr/bin/ps : /tmp ; strace -p 2824 Attached to pid 2824 (windows pid 4056) 1881 1881 [win] xrdb 2824 wndproc 537 unknown 7 0 122964 124845 [win] xrdb 2824 wndproc 537 unknown 7 0 # The above output only appeared after clicking End Process on the # xrdb task in task manager (but not actually ending it). # The strace seemed to block, and could not be killed with CTRL-C. : /tmp ; : /tmp ; # The above output only appeared after click End Process on the : /tmp ; # xrdb task in task manager (but not actually ending it). : /tmp ; # The strace seemed to block, and could be killed with CTRL-C. Here is some further output from several runs, one after the other. I can't see a pattern in the success or failure: : /cygdrive/x/cygnus/cisra ; cisraxwin.sh Please see /tmp/XWin.xlog.luke for extra X11 startup output ... X server is running # Xserver is not starting: blocked by xrdb, task manager would indicate # Kill xrdb: # Kill wmaker: : /cygdrive/x/cygnus/cisra ; # Xserver is not starting: blocked by xrdb, task manager would indicate : /cygdrive/x/cygnus/cisra ; # Kill xrdb: : /cygdrive/x/cygnus/cisra ; # Kill wmaker: : /cygdrive/x/cygnus/cisra ; # Kill XWin.exe : /cygdrive/x/cygnus/cisra ; : /cygdrive/x/cygnus/cisra ; # Try again: : /cygdrive/x/cygnus/cisra ; cisraxwin.sh Please see /tmp/XWin.xlog.luke for extra X11 startup output : /cygdrive/x/cygnus/cisra ; # X icon in task bar, no xrdb; 20 mins later, : /cygdrive/x/cygnus/cisra ; # X icon in taskbar. Still no windows or wmaker. : /cygdrive/x/cygnus/cisra ; # Make X exit now: : /cygdrive/x/cygnus/cisra ; cisraxwin.sh Please see /tmp/XWin.xlog.luke for extra X11 startup output ... X server is running # That one worked! kill 2296: No such process : /cygdrive/x/cygnus/cisra ; # That one worked! : /cygdrive/x/cygnus/cisra ; cisraxwin.sh Please see /tmp/XWin.xlog.luke for extra X11 startup output ... X server is running kill 3588: No such process : /cygdrive/x/cygnus/cisra ; # So di dtha - 2 in a row worked. : /cygdrive/x/cygnus/cisra ; cisraxwin.sh Please see /tmp/XWin.xlog.luke for extra X11 startup output ... X server is running # No X icon in task bar, xrdb seems blocked. # Kill xrdb: # Still no X icon in task bar, wmaker process but no windows. Logfile shows: # tail XWin.log.luke | sed 's/^/#/' #(EE) Keyboardlayout "US" (00000409) is unknown #Rules = "xorg" Model = "pc101" Layout = "us" Variant = "(null)" Options = "(null)" #Could not init font path element /usr/X11R6/lib/X11/fonts/CID/, removing from list! #winPointerWarpCursor - Discarding first warp: 747 600 #winProcEstablishConnection - Hello #winInitClipboard () #winProcEstablishConnection - winInitClipboard returned. #winClipboardProc - Hello #DetectUnicodeSupport - Windows NT/2000/XP # Now kill the XWin.exe: kill 792: No such process : /cygdrive/x/cygnus/cisra ; # No X icon in task bar, xrdb seems blocked. : /cygdrive/x/cygnus/cisra ; # Kill xrdb: : /cygdrive/x/cygnus/cisra ; # Still no X icon in task bar, wmaker process but no windows. Logfile shows: : /cygdrive/x/cygnus/cisra ; # tail XWin.log.luke | sed 's/^/#/' : /cygdrive/x/cygnus/cisra ; #(EE) Keyboardlayout "US" (00000409) is unknown : /cygdrive/x/cygnus/cisra ; #Rules = "xorg" Model = "pc101" Layout = "us" Variant = "(null)" Options = "(null)" : /cygdrive/x/cygnus/cisra ; #Could not init font path element /usr/X11R6/lib/X11/fonts/CID/, removing from list! : /cygdrive/x/cygnus/cisra ; #winPointerWarpCursor - Discarding first warp: 747 600 : /cygdrive/x/cygnus/cisra ; #winProcEstablishConnection - Hello : /cygdrive/x/cygnus/cisra ; #winInitClipboard () : /cygdrive/x/cygnus/cisra ; #winProcEstablishConnection - winInitClipboard returned. : /cygdrive/x/cygnus/cisra ; #winClipboardProc - Hello : /cygdrive/x/cygnus/cisra ; #DetectUnicodeSupport - Windows NT/2000/XP : /cygdrive/x/cygnus/cisra ; : /cygdrive/x/cygnus/cisra ; # Now kill the XWin.exe: : /cygdrive/x/cygnus/cisra ; head /tmp/XWin.log.luke Welcome to the XWin X Server Vendor: The Cygwin/X Project Release: 6.7.0.0-10 Contact: [EMAIL PROTECTED] XWin was started with the following command line: Xwin -rootless -clipboard -logfile /tmp/XWin.log.luke In contrast, starting it via a bat script from inside a bash shell works 100% reliably, as far as I can tell. (I've never had 6 successes in a row running cisraxwin.sh directly). See: : /cygdrive/x/cygnus/cisra ; ./cisrastartx.bat The system cannot find the path specified. Setting OFFICE_PATH (if MS Office is installed) ... Path is /cygdrive/c/Program Files/Microsoft Office/Office10/, version: 10.0 Running .profile Setting up for bash Setting up GNU environment Setting up CVS environment stty: standard input: Not a typewriter Please see /tmp/XWin.xlog.luke for extra X11 startup output cisraxwin.sh: waiting for X server ... ... X server is running kill 2760: No such process : /cygdrive/x/cygnus/cisra ; # That worked. : /cygdrive/x/cygnus/cisra ; cat ./cisrastartx.bat @echo off rem The D: gets replaced by the real Cygwin drive during installation: D: chdir \cygwin\bin rem For use with sample .profile: stop the exec in user's .profile for the rem case where we're really starting the X server. set STARTX=df bash --login -c "PATH=$PATH:/usr/X11R6/bin; exec cisraxwin.sh" rem pause : /cygdrive/x/cygnus/cisra ; ./cisrastartx.bat The system cannot find the path specified. Setting OFFICE_PATH (if MS Office is installed) ... Path is /cygdrive/c/Program Files/Microsoft Office/Office10/, version: 10.0 Running .profile Setting up for bash Setting up GNU environment Setting up CVS environment stty: standard input: Not a typewriter Please see /tmp/XWin.xlog.luke for extra X11 startup output ... X server is running kill 3336: No such process : /cygdrive/x/cygnus/cisra ; # That worked. That's 2 in a row. : /cygdrive/x/cygnus/cisra ; ./cisrastartx.bat The system cannot find the path specified. Setting OFFICE_PATH (if MS Office is installed) ... Path is /cygdrive/c/Program Files/Microsoft Office/Office10/, version: 10.0 Running .profile Setting up for bash Setting up GNU environment Setting up CVS environment stty: standard input: Not a typewriter Please see /tmp/XWin.xlog.luke for extra X11 startup output ... X server is running kill 2352: No such process : /cygdrive/x/cygnus/cisra ; ./cisrastartx.bat The system cannot find the path specified. Setting OFFICE_PATH (if MS Office is installed) ... Path is /cygdrive/c/Program Files/Microsoft Office/Office10/, version: 10.0 Running .profile Setting up for bash Setting up GNU environment Setting up CVS environment stty: standard input: Not a typewriter Please see /tmp/XWin.xlog.luke for extra X11 startup output ... X server is running kill 2556: No such process : /cygdrive/x/cygnus/cisra ; # That worked. That was 4 in a row. : /cygdrive/x/cygnus/cisra ; ./cisrastartx.bat The system cannot find the path specified. Setting OFFICE_PATH (if MS Office is installed) ... Path is /cygdrive/c/Program Files/Microsoft Office/Office10/, version: 10.0 Running .profile Setting up for bash Setting up GNU environment Setting up CVS environment stty: standard input: Not a typewriter Please see /tmp/XWin.xlog.luke for extra X11 startup output ... X server is running kill 2140: No such process : /cygdrive/x/cygnus/cisra ; # 5 in a row. : /cygdrive/x/cygnus/cisra ; ./cisrastartx.bat The system cannot find the path specified. Setting OFFICE_PATH (if MS Office is installed) ... Path is /cygdrive/c/Program Files/Microsoft Office/Office10/, version: 10.0 Running .profile Setting up for bash Setting up GNU environment Setting up CVS environment stty: standard input: Not a typewriter Please see /tmp/XWin.xlog.luke for extra X11 startup output ... X server is running kill 2376: No such process : /cygdrive/x/cygnus/cisra ; # 6 in a row. Any insights would be welcome! We do also have a ~/.Xresources, though I doubt that's relevant. ------------------------ cisraxwin.sh ------------------------ #!/bin/sh # # Start up X. Allow XSERVER_ARGS to define args to pass to the X server. # Use ~/.xinitrc if it exists, otherwise an xterm and $WINDOWMANAGER. # # Authors: Cameron Simpson and Luke Kendall # MYNAME=`basename $0` USAGE="$MYNAME This will start X (by running $HOME/.xserverrc if that file exists), otherwise by running Xwin \$XSERVER_ARGS. An example of the (optional) ~/.xserverrc file: Xwin \$XSERVER_ARGS After starting X, we run $HOME/.xinitrc if it exists. The default window manager is wmaker; use \$WINDOWMANAGER to override." # # Process the command line arguments. # Of which there are none, presently. # if [ $# != 0 ] then echo "Usage: $USAGE" >&2 exit 1 fi # # If the user has a .xserverrc, use that instead of the default, which is to # run "Xwin $XSERVER_ARGS". # XSERVER_ARGS are defined in /etc/profile.d/cisra.sh # if [ -f $HOME/.xserverrc ] then $HOME/.xserverrc & else Xwin $XSERVER_ARGS & fi > /tmp/XWin.xlog.$USER 2>&1 # Collect all the ugly output xserver=$! echo "Please see /tmp/XWin.xlog.$USER for extra X11 startup output" DISPLAY=:0 export DISPLAY while : do # If we can run xdpyinfo, the server is running properly: xdpyinfo >/dev/null 2>&1 && echo "... X server is running" && break # Did the X server die during startup? If so, give up and exit: kill -0 $xserver 2> /dev/null || exit 1 echo "$MYNAME: waiting for X server ..." sleep 1 done # # If the user has a .xinitrc file, run that after the X server has started, # else just give them an xterm and run the Window Maker window manager. # ( if [ -f $HOME/.xinitrc ] then exec sh $HOME/.xinitrc >> /tmp/XWin.xlog.$USER 2>&1 else xterm & exec ${WINDOWMANAGER:-wmaker} fi ) # Do what xinit does when the window manager exits: kill $xserver ------------------------ ~/.xinitrc -------------------------- #!/bin/sh # $Xorg: xinitrc.cpp,v 1.3 2000/08/17 19:54:30 cpqbld Exp $ userresources="$HOME"/.Xresources usermodmap="$HOME"/.Xmodmap sysresources=/usr/X11R6/lib/X11/xinit/.Xresources sysmodmap=/usr/X11R6/lib/X11/xinit/.Xmodmap # merge in defaults and keymaps if [ -f $sysresources ]; then xrdb -merge $sysresources fi if [ -f $sysmodmap ]; then xmodmap $sysmodmap fi if [ -f $userresources ]; then xrdb -merge $userresources fi if [ -f $usermodmap ]; then xmodmap $usermodmap fi # start some nice programs echo DISPLAY is $DISPLAY DISPLAY="$DISPLAY.0" rxvt -sr -backspacekey ^? -g 80x45-65+0 -fn 10x20 -title "rxvt 1" & xterm -sb -g 80x24+58-75 -fn 10x20 -title "xterm 2" & #xclock -geometry 50x50-1+1 & # Uncomment this line after you've modified mailprog-on-linux # if you want to automatically start your Linux mail reader # on your Windows machine, when X starts: # #xterm -g 72x12+0+75 -e /usr/local/script/mailprog-on-linux & # # Explanation of xterm arguments: # # -g means geometry: columns x lines (e.g. 80x23) followed first by a # horizontal placement and 2nd by a vertical placement. These placements # are relative to the left (or top) if they start with a `+', and # relative to the right (or bottom) if they start with a `-'. # So 80x24+0-0 means 80 cols, 24 lines, 0 from the left edge of the screen, # and 0 from the bottom. The placements, incidentally, are in pixels. # # -fn 9x15 means choose the 9x15 (in pixels) font. And 9x15bold is just that. # # You can resize windows with the mouse by dragging from the top-right # icon of the title bar. You can bring up the xterm font panel by holding # down the CTRL key before you press the right mouse button down inside the # xterm. The left and middle things access other functions. # # # Finally, start the window manager. # Except in the case of wmaker, this will be the last command, run with no "&". # No window manager must be used at all if you're running -multiwindow # since then you're using the Windows desktop manager instead. # if grep -e -multiwindow /tmp/XWin.log.$USER then # It's fatal to run a 2nd window manager if you're running with Windows' # desktop as your window manager. else # Treat wmaker specially. if [ "${WINDOWMANAGER:-wmaker}" != "wmaker" ] then # WINDOWMANAGER could be fvwm2, mwm, twm, icewm, blackbox, ... echo "Window Manager is $WINDOWMANAGER" exec $WINDOWMANAGER else # If wmaker crashes it won't run exitscript, so run it this way # instead, to ensure that exitscript is always run: wmaker ~/GNUstep/Library/Windowmaker/exitscript fi fi ------------------------ cisrastartx.bat --------------------- @echo off rem The D: gets replaced by the real Cygwin drive during installation: D: chdir \cygwin\bin rem For use with sample .profile: stop the exec in user's .profile for the rem case where we're really starting the X server. set STARTX=df bash --login -c "PATH=$PATH:/usr/X11R6/bin; exec cisraxwin.sh" rem pause ------------------------ ~/.Xresources ----------------------- ! rxvt settings rxvt*saveLines: 5000 rxvt*scrollBar: on rxvt*scrollTtyOutput: off rxvt*scrollTtyKeypress: on rxvt*cursorColor: blue !rxvt*ttyModes: erase ^? rxvt*background: white rxvt*foreground: black ! XTerm*saveLines: 2000 XTerm*scrollBar: on !XTerm*ttyModes: erase ^H ! Possible sizes include 6x13, 1x9, 7x13, 8x13, 9x15, 10x20, 12x24 - see ! usr/X11/lib/X11/fonts/misc... XTerm*font: 9x15 *cursorColor: blue *pointerColor: red *scrollTtyOutput: false *scrollKey: true luke