boot - How to Diagnose a Pre-Operating System Load or Hardware Issue

05
2014-04
  • Questioner
    • How can I find out if my problem is hardware based?
    • If it is, how can I figure out what component is to blame
    • How can I fix other pre-operating system issues?

    As an aside, what are all of these components responsible for, and if they break, what can go wrong?

    (This question comes up frequently, and the suggested solutions are usually the same. This community wiki is an attempt to serve as the definitive, most comprehensive answer possible. Feel free to add your contributions via edits.)

  • Answers
  • Area 51

    How can I tell if my problem is because of my hardware?

    1. Does the problem happen before your operating system loads?
    2. Does the problem happen on different operating systems on the same machine?
    3. Do the errors seem like they have no cause (i.e. random crashes every few days/hours, not linked to any particular program running or time spent with the PC on?

    How can I figure out which component is to blame?

    A very short summary of what happens when components fail

    • Hard Drive: "Missing Operating system" or similar, frequently prompted to run CHKDSK (or similar).
    • RAM: Programs/OS crash for seeming no reason, and with no real pattern.
    • CPU / Heatsink / Power Supply / Outlet: Computer shuts off when doing a lot of work, computer refuses to start at all, or shuts down abruptly.
    • USB drive: Devices plugged in do not get recognized, or they do not get powered.
    • Motherboard: Nothing starts up.

    End summary

    My computer does not turn on at all

    A short-circuit anywhere in the system can cause the power supply to enter over-current shutdown. Therefore disconnect all components except:

    • power supply
    • motherboard
    • CPU
    • CPU fan
    • one memory module (sometimes one module per bank is needed)
    • video card (may be part of the motherboard or processor)
    • power switch and LED
    • PC speaker (the piezo buzzer connected to a four pin connector on the motherboard, not your stereo/surround computer speakers)

    If your computer still cannot turn on at all (power supply and CPU fans are not rotating), your problem lies with one (or more) of the following components:

    • Power supply: Your machine is not getting enough power to start. For desktops make sure you have a large enough supply. If the supply seems large enough, it might still be broken. For laptops, make sure it is plugged in, and the charger works.
    • Motherboard: Somewhere on your motherboard there is a fried/broken something. While this is rare, it does happen.
    • BIOS chip: The BIOS chip itself might be fried on the machine. This is extremely rare, but possible.

    My computer turns on, beeps, and shuts off

    These are called beep codes. Use your manufacturer's website (in the case of a desktop, the motherboard's manufacturer's website) to find out what the beep codes for your particular machine are. Generally, the beep code will tell you exactly what is wrong with the machine (i.e. keyboard not found, hard drive not found, etc). Beep codes will work even if there is no screen (this is their primary advantage to on-screen messages).

    My computer turns on, but has some issues:

    Step 1: Checking BIOS settings

    The very first thing to check is if the problem is actually a BIOS problem as opposed to a hardware problem. In some cases they can appear to be very similar as BIOS runs before boot.

    While the way to get into your computer's BIOS settings may vary, generally there is a button you can press before the operating system loads (Delete, F2, F10, F12, End are the most common options) that will bring you into the BIOS setup.

    Once there, check to see if any hardware (particularly the hardware that you suspect might be operating incorrectly or not at all) is disabled. If it is, enable it, and see if things work now. If it doesn't read on.

    Step 2: Running memory diagnostics

    If the RAM has problems, pretty much anything can happen. So the first thing to do is to run a program that will test your memory. Windows 7 has a memory diagnostic built in, but if that is unavailable (windows does not boot, you don't run windows, etc) you can always use Memtest. Just burn it to a CD/USB and boot to the device. If there are memory errors, even when running at specified voltage and speed, you need new RAM. Try swapping out a stick at a time to see which sticks/positions are faulty. If a stick is faulty, just get a new one, and if a position is faulty, you have to decide if you want to get a new motherboard.

    Step 3: Running hard drive diagnostics

    Make sure the hardware is OK:

    There is something called S.M.A.R.T that comes with almost all modern hard drives that is supposed to be able to tell you if your hard drive is going to fail. It does a not so good job at that, but it is better than nothing. To look at the S.M.A.R.T. data use:

    • Windows: you can use wmic followed by diskdrive get status
    • Mac: DiskUtility (off of the mac install disk, or after the OS is booted if that is an option)
    • Unix: You can use SmartMonTools (and see here) for more info. (SmartMontools also has a windows version).

    It should be noted that these are just locations of where you can find utilities that can read the S.M.A.R.T data. You can run any of these utilities though, on basically any drive.

    Additionally, these programs refer to the host OS, NOT the OS on the drive. The OS on the drive has no baring at all on which one of these tools to use.

    Check the file system

    • Windows, get an installation disk, and run chkdsk from that. To do this, select repair, and then after you pick the OS (if any is found) select Command Prompt. Then, type something like chkdsk c: /f (optionally add /r to try and recover some data, /b to try and get some sectors back, /v to see the errors, and /i to speed it up at the cost of not checking everything as stringently).
    • Unix-like systems, you can use fsck(1) (File System ChecK) which is part of all major Unix distros (including mac, FreeBSD, and Linux).

    These tools should be able to repair the file systems, if that is indeed the issue.

    Step 4: Bootloader

    Only use this step if the issue is that you cannot boot into/find your operating system

    Super GRUB disk is a great utility that can scour your hard drive and try to find all bootable partitions, and will let you boot to them. Once you have booted, it is important to actually repair the Master Boot Record (MBR).

    • Windows this is possible with a utility called EasyBCD
    • Mac: Use Disk Utility, click on your hard drive (the drive itelf, not the partitions). Move the triangular slider that adjusts the partition back and forth, and the click Apply. The boot infrastructure (either MBR, or EFI) will be recreated. Note: It should warn you that a partition is being changed.
    • Grub (many Linux distros): (taken from here Note change the appropriate references from hd2, hd0, etc to what is appropriate for your setup)

      1. Open a terminal as the root user.
      2. Enter GRUB (we're now are in a command line interface shell for GRUB).
      3. Enter root (hd2,0) (setting the boot drive where most of GRUB, and the system kernel files are).
      4. Enter find (hd2,0)/grub/stage1 (the first file GRUB uses to boot up from). This step may not be necessary, but better safe than sorry.
      5. This gives a list of drives partitions where GRUB could be installed.
      6. Enter setup (hd0) (to install the bootloader to the drive my system BIOS boots up).
      7. Enter quit (to properly exit from the GRUB command line interface shell).
    • FreeBSD: The page here contains extensive instructions for how to restore a bootloader in FreeBSD. The shortened summary though is that if your MBR gets overwritten by some other OS or something else, it can be restored to its plain vanilla state with fdisk -B -b /boot/boot0 device where device is that device that you boot from.

    Step 5: Graphics

    Only read this step if you have a graphics problem

    • If the problem shows up before your OS boots up, then it is a hardware problem.
    • If before the BIOS it is fine, and after not, it might be a graphics card or driver issue
    • If the problem occurs at random, then it is probably a hardware issue.

    Closing notes:

    Hopefully, if you have reached the end of this post (I know, its long) you have an idea of what the issue is if it is hardware based or pre-OS problem. If not, feel free to ask a question on Super User that lists more details of your situation.

    Related information:
    How do I troubleshoot hardware issues related to a computer freeze/crash?
    How do I troubleshoot when I have no clue where to start?


  • Related Question

    windows - How do I get rid of malicious spyware, malware, viruses or rootkits from my PC?
  • Questioner

    What should I do if my Windows computer seems to be infected with a virus or malware?

    • What are the symptoms of an infection?
    • What should I do after noticing an infection?
    • What can I do to get rid of it?

    This question comes up frequently, and the suggested solutions are usually the same. This community wiki is an attempt to serve as the definitive, most comprehensive answer possible.

    Feel free to add your contributions via edits.


  • Related Answers
  • Area 51

    Here's the thing: Malware in recent years has become both sneakier and nastier:

    Sneakier, because it travels in packs. Subtle malware can hide behind more obvious infections. There are lots of good tools listed in answers here that can find 99% of malware, but there's always that 1% they can't find yet. Mostly, that 1% is stuff that is new: the malware tools can't find it because it just came out and is using some new exploit or technique to hide itself that the tools don't know about yet. The anti-malware tools still have their place, but I'll get to that later.

    Malware also has a short shelf-life. If you're infected, something from that new 1% is actually very likely to be one part of your infection. It won't be the whole infection: just a part of it. Security tools will help you find and remove the more obvious and well-known malware, and most likely remove all of the symptoms (because you can keep digging until you get that far), but they can leave little pieces behind, like a keylogger or rootkit.

    Nastier, in that it won't just show ads, install a toolbar, or use your computer as a zombie anymore. Modern malware is likely to go right for the banking or credit card information. The people building this stuff are motivated by profit, and if they can't steal from you directly, they'll look for something that they can turn around and sell. This might be processing or network resources in your computer, but it might also be your social security number.

    Put these two factors together, and it's no longer worthwhile to even attempt to remove malware from an installed operating system. I used to be very good at removing this stuff, to the point where I made a significant part of my living that way, and I no longer even make the attempt. I'm not saying it can't be done, but I am saying that the risk analysis results have changed: it's just not worth it anymore. There's too much at stake, and it's too easy to get results that only seem to be effective.

    Lots of people will disagree with me on this, but I challenge that they are not weighing consequences of failure strongly enough. Are you willing to wager your life savings, your good credit, even your identity, that you're better at this than crooks who make millions doing this every day? ...'cause if you try to remove malware and then keep running that old system, that's exactly what you're doing.

    I know there are people out there reading this thinking, "Hey, I've removed several infections from various machines and nothing bad ever happened." I suggest you need to add "yet" to the end of that statement. You might be 99% effective, but you only have to be wrong one time, and the consequences of failure are much higher than they once were. You might even have a machine already out there that still has a ticking time bomb inside, just waiting to be activated or waiting for the right information before reporting it back. Even if you have a 100% effective process now, this stuff changes all the time. Remember: you have to be perfect every time; the bad guys only have to get lucky once.

    In summary, it's unfortunate, but if you have a confirmed malware infection, a complete re-pave of the computer should be the first place you turn instead of the last.


    Here's how to accomplish that:

    Before you're infected, make sure you have a way to re-install any purchased software, including the operating system, that does not depend on anything stored on your internal hard disk. Normally, that just means hanging onto cd/dvds or product keys1, but the operating system may require you to create recovery disks yourself. Don't rely on a recovery partition for this. If you wait until after an infection to ensure you have what you need to re-install, you may find yourself paying for the same software again.

    If you suspect you have mal-ware, look to other answers here. There are a lot of good tools suggested. My only issue is the best way to use them: I only rely on them for the detection. Install and run the tool, but as soon as it finds evidence of a real infection just stop the scan: the tool has done it's job and confirmed your infection.

    Now, at the time of a confirmed infection, take the following steps:

    1. Check your credit and bank accounts. By the time you find out about the infection, real damage may have already been done. Take any steps necessary to secure your cards, bank account, and identity. Do not use the compromised computer to do this.
    2. Take a backup of your data (even better if you already have one).
    3. Re-install the operating system using disks shipped with the computer, purchased separately, or the recovery disk you should have created when the computer was new. Make sure the re-install includes a complete re-format of your disk.
    4. Re-install your applications.
    5. Make sure your system is fully patched.
    6. Run a complete anti-virus scan to clean the backup from step one.
    7. Restore the backup.

    If done properly, this is likely to take between two and six real hours of your time, spread out over two to three days (or even longer) while you wait for things like apps to install, windows updates to download, or large backup files to transfer... but it's better than finding out later that crooks drained your bank account. Unfortunately, this is something you should do yourself, or a have a techy friend do for you. At a typical consulting rate of around $100/hr, it can be cheaper to buy a new machine than pay a shop to do this. If you have a friend do it for you, do something nice to show your appreciation. Even geeks the love helping you set up new things or fix broken hardware often hate the tedium of clean-up work. It's also best if you take your own backup... your friends aren't going to know where you put what files, or which ones are really important to you. You're in a better position to take a good backup than they are.


    If you absolutely insist, beyond all reason, that you really want to clean your existing install rather than start over, then for the love of God make sure that whatever method you use involves one of the following two procedures:

    • Remove the hard drive and connect it as a guest disk in a different (clean!) computer to run the scan.

    OR

    • Boot from a CD with it's own set of tools running it's own kernel. Make sure the image for this CD was obtained and burned on a clean computer. If necessary, have a friend make the disk for you.

    Under no circumstances should you try to clean an infected operating system using software that is running as a guest process of that compromised operating system. That's just plain dumb.


    Of course, the best way to fix an infection is to avoid it in the first place, and there are some things you can do to help with that:

    1. Keep your system patched. Make sure you promptly install Windows Updates, Adobe Updates, Java Updates, Apple Updates, etc. This is far more important even than anti-virus software, and for the most part it's not that hard, as long as you keep current. Most of those companies have informally settled on all releasing new patches on the same day each month, so if you keep current it doesn't interrupt you that often.
    2. Do not run as administrator by default. In recent versions of Windows, that is as simple as leaving the UAC feature turned on.
    3. Use a good firewall tool. These days the default firewall in Windows is actually good enough. You may want to supplement this layer with something like WinPatrol that helps stop malicious activity on the front end. Windows Defender works in this capacity to some extent as well.
    4. Run current anti-virus software. This is a distant fourth to the first three, as traditional A/V software often just isn't that effective anymore. It's also important to emphasize the "current". You could have the best antivirus software in the world, but if it's not up to date, you may just as well uninstall it. For this reason, I currently recommend Microsoft Security Essentials. There are likely far better scanning engines out there, but Security Essentials will keep itself up to date, without ever risking an expired registration. AVG and AVast also work well in this way. I just can't recommend any anti-virus software you have to actually pay for, because it's just far too common that a paid subscription lapses and you end up with out-of-date definitions.
    5. Avoid warez, pirated software, and pirated movies/videos. This stuff is often injected with malware by the person who cracked or posted it — not always, but often enough to avoid the whole mess. It's part of why the cracker would do this: sometimes they will get a cut of the profits.
    6. Use your head when browsing the web. If something sounds too good to be true, it probably is.

    1 You should also backup your data, but that's really a separate issue: if you're system security was compromised, your backups are likely compromised, too.