What causes a Segmentation fault?

You just saw "Segmentation fault (core dumped)" or a message like "Unexpected Signal 11 ". Why? Short answer: it's most likely hardware unless you wrote the program or just now installed it on your machine.

If you are trying to install an OS from a CD, it could be that the people who created that OS are idiots, but it's much more likely that bad hardware is involved: bad media, a cheap cd burner, a faulty download, or the hardware you are installing on. It doesn't matter if that hardware has been running Windows flawlessly for years: it *still* may be bad hardware. If you insist that it isn't, and refuse to even contemplate that possibility, you might spend a lot of time chasing solutions that aren't going to help you one bit.


Hate these ads?

I did an install a few years back for a local company. The install kept failing reading from the CD, but not at the same place. Segmentation errors mostly, but sometimes other complaints. I asked them to switch out the CD reader, but met resistance: nothing wrong with that CD, I was told, we've used it for years. I pointed out that they were paying me $150.00 an hour and that it was my opinion that we needed different hardware, but I could keep foolishly attempting to install if that's what they insisted upon. Reluctantly, they coughed up a new CDROM and (of course) the install worked flawlessly.

If you've transfered a program from some other machine, you may have corrupted the file in the transfer - run sum on that file on both machines and see if they agree. If you used a Windows box to ftp a file, did you remember that most Windows ftp programs are too stupid to set binary mode unless you tell them to?

If you wrote the program, did you write it in C? Congratulations: you've made the first of many pointer errors you will make while learning. If you wrote it in a higher level language like Perl, it's unlikely to be your fault unless you are extraordinarly creative.

Did you get this compiling a Linux kernel? Almost certainly hardware; see the excellent Signal 11 while compiling the kernel page.

Your machine has been running for years and suddenly stuff like this starts happening. It's hardware, and you'll probably have a kernel panic soon enough.

If you are ready to accept that it just might be hardware, the number one most likely area to cause a segmentation fault is memory. Yes, you might have a bad CPU, but CPU's do extremely rigorous self testing and are unlikely to let themselves start with any defect. It can happen, and you could get hit by a meteorite this afternoon too. CPU's are seldom just randomly flaky. Memory, however is. The "memory test" that happens as the machine boots is roughly similar to walking across a wooden plank to see if its strong enough for the load of bricks you plan to have it carry later. If it cracks under your weight, sure, it wouldn't have worked with the bricks. But it can also carry you just fine and dump the bricks all over the place later. There are better memory tests out there, but given how cheap memory is today, and how valuable your time is, it's often better to just rip the stuff out and replace it. Maybe when you have some spare time you can figure out which chips were good and which were bad, but if the new memory takes the problem away, you just saved yourself a lot of time and trouble.






Heat affects electronics. If cooling the place down 20 degrees or blowing a fan on the motherboard "fixes" the problem, you have a rather obvious hardware problem. Again, probably memory.

The memory isn't always RAM. It can be cache corruption. It can also be bad disk blocks putting garbage into perfectly good memory. Sometimes it can be hellishly difficult to find, so you really have to think about the cost of your time chasing it vs. the cost of tossing this box away and starting over with something else. Sometimes that's worth doing even if you have no intention of actually using the other hardware: it's just a test bed to prove what is or isn't happening.


Technorati tags:





Enter your email address for automatic notification of new posts here
(be sure to whitelist 'feedburner.com' if you use spam filtering)

Or use any RSS reader

Delivered by FeedBurner





Views for this page
Today This Week This Month This Year  Overall
3757378,977 14,904

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

pavatar.jpg
More:
       - Kernel/Internals
       - Hardware




Unix/Linux Consultants


http://bcstechnology.net Full service Linux & UNIX systems integrator; Windows to UNIX/Linux Client-Server Specialist; Secure E-Mail & Website Hosting; Thoroughbred Software Developer; Custom Industrial Automation; Hardware & Electronics Experts; In Business Since 1985.


http://www.vss3.com SCO/Caldera OpenServer, Unixware & Linux. Tarantella & Non-stop Clustering


UBB Computer Services Support for Openserver, Unixware and Linux. Windows integration with Unix/Linux servers. Hardware, Backup and Networking issues. Located near Sacramento CA, we provide onsite support throughout Northern CA and Nationwide via remote access. We are a SCO Authorized Partner and a Microlite BackupEdge Certified Reseller.



Twitter
  • Nov 30 20:25
    I have 37,000 words of a 50,000 word project. I'd like to finish it this week..
  • Nov 30 20:05
    My wife made turkey sandwiches with stuffing and cranberry orange relish - I did not want to eat the last bite. Didn't want it to end!









Change Congress


Related Posts