Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Machine regularly segfaults [closed]

When I use apt-get to install or upgrade my Ubuntu hardy system, I often get messages like this:

$ sudo apt-get install foo
Reading package lists... Done
Segmentation faulty tree... 50%

$ sudo apt-get install foo
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Segmentation fault

$ sudo apt-get install foo
Reading package lists... Done
Building dependency tree       
Reading state information... Done
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_S_construct NULL not valid
Aborted

cc  -Os -g -Wall -DLOCAL_ROOT=\"/usr/share/polipo/www/\" -DDISK_CACHE_ROOT=\"/var/cache/polipo/\"  -DCHUNK_SIZE=16384   -c -o http_parse.o http_parse.c
http_parse.c:1564: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-4.2/README.Bugs>.
make: *** [http_parse.o] Error 1

It doesn't happen all the time, so if you retry enough you can usually get things done, but it does segfault an annoying large percentage of the time.

Any idea what's going on or how to fix it?

like image 904
aaronsw Avatar asked Mar 11 '09 13:03

aaronsw


People also ask

What causes segmentation error?

A segmentation fault (aka segfault) is a common condition that causes programs to crash; they are often associated with a file named core . Segfaults are caused by a program trying to read or write an illegal memory location.

What type of error is segmentation fault?

Core Dump/Segmentation fault is a specific kind of error caused by accessing memory that “does not belong to you.” When a piece of code tries to do read and write operation in a read only location in memory or freed block of memory, it is known as core dump. It is an error indicating memory corruption.

How do you fix a segmentation fault?

See if your compiler or library can be set to check bounds on [i] , at least in debug mode. Segmentation faults can be caused by buffer overruns that write garbage over perfectly good pointers. Doing those things will considerably reduce the likelihood of segmentation faults and other memory problems.

What causes segmentation fault 11?

Chances are your system is running out of memory when trying to execute your code, which results in a segmentation fault. This is still valid after 7 years.


1 Answers

If standard tools are intermittently failing, particularly with memory errors like that, it's time to suspect the hardware.

Run memtest (from the grub menu is best), and leave it to run for several cycles.

like image 149
Douglas Leeder Avatar answered Oct 13 '22 02:10

Douglas Leeder