Tuesday, 1 March 2011

Solved cygwin + windows7 STATUS_ACCESS_VIOLATION problem

[1 Mar 2011 12:39:14] Solved cygwin + windows7 STATUS_ACCESS_VIOLATION problem.

User that installed cygwin was "Someone Else" Administrator.
ls -R /cygdrive/c/cygwin # showed mixed ownership between "Someone Else" and "Me Myself" both Administrator.


Solution:
  export PATH=/usr/bin:$PATH
  chown -R me.myself /cygdrive/c/cygwin
  chmod 777 $TMP
  # stop all cygwin processes (close windows and use Task Manager to kill hangers on)
  start ash and run rebaseall

Killing processes in ash:

  export PATH=/usr/bin:$PATH
  ps -e
  PIDS=$(ps -e |grep -E -v "ash|PID" |sed s/^.// |awk '{print $1}')
  kill $PIDS
  kill -9 $PIDS
  ps -e

This is why chmod 777 $TMP is needed:
  ash$ rebaseall
  rebaseall: '/cygdrive/c/Users/JAMES~1.COL/AppData/Local/Temp' is not writable

This also happened:
  ash$ rebaseall 
  ReBaseImage (/usr/bin/cygcrypt-0.dll) failed with last error = 6

  ash$ cd \cygwin\bin
  ash$ mv cygcrypt-0.dll cygcrypt-0.dll.hmm  #?
  ash$ cp cygcrypt-0.dll.hmm cygcrypt-0.dll  #?

Finally:
  ash$ rebaseall
  /usr/bin/cygcrypto-0.9.8.dll: skipped because nonexistent
  /usr/bin/cygssl-0.9.8.dll: skipped because nonexistent

Cygwin now working.
Final step to make sure all is clean: Run cygwin setup.exe to update.



What happened to cause problem:
Cygwin was pre-installed by another user someone.else.
And I ran a cygwin update as my user me.myself.
No obvious cygwin errors but cygwin DLL must have been updated and rebaseing had errors.
 errors are gone


Finally found this on web which had part of this solution:

http://comments.gmane.org/gmane.os.cygwin/120053

Actually, you might be able to get away with something like this from
the DOS prompt.

c:
cd \cygwin\bin
ren cygcrypt-0.dll cygcrypt-0.dll.hmm
copy cygcrypt-0.dll.hmm cygcrypt-0.dll


If you can do the rename but not the copy then reinstalling (via
setup.exe's Reinstall option) cygcrypt-0.dll from the crypt package
might work.

cgf

Oops, I figured out why this was happening and it was rather silly on
my part. I installed cygwin under the Administrator account and was
trying to run rebaseall under a different account. I thought using the
"run as administrator" option when opening ash would give it enough
privileges but apparently it's not enough. Running ash under the
actual Administrator account made the error go away and solved my
status_access_violation problems. Thanks for the help everyone.





Also changed Microsoft Security Essentials exclude scans in C:\cygwin and C:\cygwin\bin
http://cygwin.com/faq/faq.using.html#faq.using.bloda
http://www.mail-archive.com/cygwin-xfree@cygwin.com/msg20643.html
Re: frequently getting a STATUS_ACCESS_VIOLATION exception under win7



Symptoms of problem:
Under cygwin any cmd prone to failing and whether fail or not results in 0 or more messages like this:



bash-3.2$ tclsh
656645530 [main] bash 9244 exception::handle: Exception: STATUS_ACCESS_VIOLATION
656646262 [main] bash 9244 open_stackdumpfile: Dumping stack trace to bash.exe.stackdump
656781862 [main] bash 9256 exception::handle: Exception: STATUS_ACCESS_VIOLATION
656782603 [main] bash 9256 open_stackdumpfile: Dumping stack trace to bash.exe.stackdump
      1 [main] bash 9348 child_copy: linked dll data write copy failed, 0x2DD000..0x2E14A4, done 0, windows pid 9348, Win32 error 487

e.g. output from startup of Hudson:

      1 [main] bash 7312 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    618 [main] bash 7312 open_stackdumpfile: Dumping stack trace to bash.exe.stackdump
      1 [main] bash 6288 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    440 [main] bash 6288 open_stackdumpfile: Dumping stack trace to bash.exe.stackdump
      1 [main] bash 7796 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    430 [main] bash 7796 open_stackdumpfile: Dumping stack trace to bash.exe.stackdump
      1 [main] bash 9352 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    427 [main] bash 9352 open_stackdumpfile: Dumping stack trace to bash.exe.stackdump
      1 [main] bash 5496 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    452 [main] bash 5496 open_stackdumpfile: Dumping stack trace to bash.exe.stackdump
      1 [main] bash 9960 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    443 [main] bash 9960 open_stackdumpfile: Dumping stack trace to bash.exe.stackdump
      1 [main] bash 9080 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    494 [main] bash 9080 open_stackdumpfile: Dumping stack trace to bash.exe.stackdump
      2 [main] bash 3228 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    601 [main] bash 3228 open_stackdumpfile: Dumping stack trace to bash.exe.stackdump
      1 [main] bash 9304 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    479 [main] bash 9304 open_stackdumpfile: Dumping stack trace to bash.exe.stackdump
      1 [main] sh 4124 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    602 [main] sh 4124 open_stackdumpfile: Dumping stack trace to sh.exe.stackdump
      1 [main] sh 8324 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    427 [main] sh 8324 open_stackdumpfile: Dumping stack trace to sh.exe.stackdump
      2 [main] sh 4848 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    953 [main] sh 4848 open_stackdumpfile: Dumping stack trace to sh.exe.stackdump
      1 [main] sh 9296 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    429 [main] sh 9296 open_stackdumpfile: Dumping stack trace to sh.exe.stackdump
      2 [main] sh 8316 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    575 [main] sh 8316 open_stackdumpfile: Dumping stack trace to sh.exe.stackdump
      1 [main] sh 7712 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    621 [main] sh 7712 open_stackdumpfile: Dumping stack trace to sh.exe.stackdump
      2 [main] sh 9656 fork: child -1 - died waiting for longjmp before initialization, retry 0, exit code 0x600, errno 11
1022408 [main] sh 9712 exception::handle: Exception: STATUS_ACCESS_VIOLATION
1023148 [main] sh 9712 open_stackdumpfile: Dumping stack trace to sh.exe.stackdump
Running from: C:\CR1\Hudson\hudson.war
[Winstone 2011/03/03 10:51:59] - Beginning extraction from war file
hudson home directory: c:\CR1\Hudson\HudsonHome\.hudson
[Winstone 2011/03/03 10:52:02] - HTTP Listener started: port=8080
[Winstone 2011/03/03 10:52:02] - Error during AJP13 listener init or shutdown
java.net.BindException: Address already in use: JVM_Bind
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.PlainSocketImpl.bind(Unknown Source)
        at java.net.ServerSocket.bind(Unknown Source)
        at java.net.ServerSocket.(Unknown Source)
        at java.net.ServerSocket.(Unknown Source)
        at winstone.ajp13.Ajp13Listener.run(Ajp13Listener.java:99)
        at java.lang.Thread.run(Unknown Source)

Using one-time self-signed certificate
[Winstone 2011/03/03 10:52:02] - Winstone Servlet Engine v0.9.10 running: controlPort=disabled
03-Mar-2011 10:52:02 hudson.model.Hudson$4 onAttained
INFO: Started initialization
03-Mar-2011 10:52:02 hudson.model.Hudson$4 onAttained
INFO: Listed all plugins
03-Mar-2011 10:52:03 hudson.model.Hudson$4 onAttained
INFO: Prepared all plugins
03-Mar-2011 10:52:06 hudson.model.Hudson$4 onAttained
INFO: Started all plugins


There are files like bash.exe.stackdump and sh.exe.stackdump dumped to current dir.

They look like this:
$ cat bash.exe.stackdump
Exception: STATUS_ACCESS_VIOLATION at eip=61020137
eax=00B442A8 ebx=6123A614 ecx=7595783F edx=002E41B8 esi=00000000 edi=0022FA04
ebp=61020890 esp=0022C7D4 program=C:\cygwin\bin\bash.exe, pid 6796, thread main
cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023
Stack trace:
Frame     Function  Args
End of stack trace

$ cat sh.exe.stackdump
Exception: STATUS_ACCESS_VIOLATION at eip=610C51B9

Windows Error 487 is ERROR_INVALID_ADDRESS, when DLL lib loading has symbol resolution error.


9 comments:

beginnersgrace said...

In my case doing
chown -R user.group /cygdrive/c/cygwin
seemed to be all I needed. (Note it should be "chown" not "chmod".)

But I never would've thought of permissions until reading your post. So, thanks!

There's a useless thread on this at cygwin.com going back a year. I'm glad I found this.

Unknown said...

tried permissions. What cleared up the problem for me was changing the value for my TERM environment variable. for some reason it was set to "dumb".

in my .bashrc I added:
TERM=cygwin
export TERM

I did it to fix some bash oddities I experienced ("less," "clear," etc., not working right) but it seemed to effect a change for this issue for me as well.

gaoithe said...

My goodness. Comments! Thanks beginnersgrace, doh, oops, that's fixed.

Roman Kuzmik said...

thx a lot for solving this one!!! drives me nuts for a week :-(

Old rookey said...

Thanks, this has been showing up intermittently for while. chown plus rebase did the trick.

abedamatta said...

Thanks dude.. you rock!

levanto said...

This was very helpful. Solved my SSH not working from CYGWIN problem!

Bob H. said...

Thank you! I had the same problem, Google yielded this post as the top result, and it worked like a charm. :-)

Martelo said...

Holy Fuuuuck! ur talking greek! Are you sure you are talking about windows?? It does not seem to be a Windows language lol

I'm having this Access Violation Problem and tried everything no success. Could you help me in a dumb language?
thanks