Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Segmentation fault with Python/Chrome/Java (linux mint)

When I run python (without any argument) in command line, segmentation fault is occurred.

the error is:

$ python
[1]    11094 segmentation fault  python2.7

And the linux kernel traps:

$ dmesg
traps: python2[10923] general protection ip:4db605 sp:7fffe4b29e70 error:0 in  python2.7[400000+2ba000

$gdb python
Program received signal SIGSEGV, Segmentation fault.
0x00000000004db605 in PyDict_SetItemString ()
(gdb) backtrace
#0  0x00000000004db605 in PyDict_SetItemString ()
#1  0x000000000044719b in _PyExc_Init ()
#2  0x000000000046928e in Py_InitializeEx ()
#3  0x0000000000469db3 in Py_Main ()
#4  0x00007ffff7816de5 in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6
#5  0x00000000005735fe in _start ()

Selected part of objdump -d /usr/bin/python2.7 | less

4db5f7:       0f 84 a6 02 00 00       je     4db8a3 <PyDict_SetItemString+0x323>
4db5fd:       4d 8b 48 08             mov    0x8(%r8),%r9
4db601:       41 83 00 01             addl   $0x1,(%r8)
4db605:       4d 8b 11                mov    (%r9),%r10
4db608:       4d 89 cc                mov    %r9,%r12
4db60b:       4d 85 d2                test   %r10,%r10
4db60e:       4d 89 50 08             mov    %r10,0x8(%r8)

My machine specification is:

  • Linux Mint 16 (64bit)
  • Ram: 8GB (6 GB is free)
  • I have install Mint on SSD (64 GB) last night, 1TB HDD
  • CPU: Core I5 4670k
  • Linux kernel: Linux mint 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:20:46 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

I tried to install new kubuntu 14.04 on my machine (and as another solution, upgrade distribution to mint 17) but unfortunately the distribution had crashed.

Could someone please say, why the error is occurred? and how can I fix it?

I am wondering if any one help me to fix the problem. (I know what is segsegv, but I dont know why this error is occur in fresh installation of linux)

There is exist same problem with Google-Chrome, Java, and other programs.

Thanks

like image 496
Ocean Avatar asked Jun 04 '14 16:06

Ocean


1 Answers

This is not an explanation as to why your python is currently crashing -- unless you have some strange configuration on your system that you haven't mentioned, it appears to be a python bug -- but here's a possible fix:

I can only guess that something was corrupted when you installed python. An ideal solution would be to uninstall and reinstall, but that's a pain because there's a large number of system critical programs that have python as a dependency. So you can follow the instructions here to find everything that you deleted and reinstall it. Here's my suggestion:

  1. sudo apt-get purge python2.7

    You'll be given a long list of packages that you're about to delete, and that's okay. Let them be deleted.

  2. sudo apt-get install python2.7

    Reinstall python. Now, reinstall your old deleted packages:

  3. grep Remove /var/log/apt/history.log | tail -n1 | cut -d: -f2- | sed "s/(.*)//g" | sed "s/:your_processor//g"

    This is a list of your most recently deleted packages, which you can now give to apt-get to reinstall. :your_processor is the architecture listed by apt, which, for me, is :amd64.

Be aware that this a fairly dangerous operation.

Also, seeing your comment -- it appears that you have bad RAM. This is a hardware issue. A reinstall might fix it, but the problem will reappear -- get the offending stick replaced. If this is a new machine, it will probably be covered by your warranty. Also check to see that there's no dust, etc, in the slot, assuming you built the machine yourself. Here's a Super User post that explains why a memtest failure is a big deal.

like image 125
Patrick Collins Avatar answered Sep 21 '22 14:09

Patrick Collins