views:

136

answers:

4

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&gt; 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?

+5  A: 

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.

Douglas Leeder
+1  A: 

Douglas gave the correct direction. Running memtest is the least expensive option.

Clocking down your CPU (if possible) is another option. If you have spare RAM modules lying around, try swapping them in for your current ones. If nothing works and you still have the same problem, suspect the mainboard.

pi
+1  A: 

I had a similar problem and it turns out that the CPU fan bracket cracked. It makes the temperature skyrocketed.

Also make sure your memory test passed. Using your ubuntu installation disk, boot up the machine and choose memory test. Let it run for about an hour, if there are memory problems, it will show up on the list of errors.

SamChandra
+1  A: 

Software installation is probably taxing the system a bit more than "regular" use, which can cause inherent problems to creep out of hiding. In addition to the suggestions given, if you start testing/swapping hardware components, start with the power supply.

It might be the PSU that is "dipping" in voltage under load, which wreaks havoc with the system. Luckily, PSU:s are quite cheap, and it's far easier to swap out a PSU than a motherboard.

unwind
I once had a problem with a weak PSU. The machine did a cold boot though when running under heavy load.
pi