Two days ago, I turned on my Dell desktop computer, and encountered a major problem.
A black screen immediately loaded and said:
Windows could not start because the following file is missing or corrupt:
<Windows root>\system32\hal.dll
Please re-install a copy of the above file.
This, of course, freaked me out, as the computer would not load Windows and I couldn’t get into safe mode or anything. I immediately got on my laptop and started researching the problem.
As typical, 90% of the responses you’ll find on message boards have so-called experts suggesting you reinstall Windows. These people must not mind reinstalling what would now be about 10 years worth of Windows Updates again and reinstalling all other software you find necessary to have on your computer. This is not a solution. This is the idiot’s way out, and you’ll sure feel like an idiot, especially if you have to spend the next 2 or 3 days reinstalling Adobe Creative Suite, Microsoft Office, your printer drivers, and everything else. Don’t do this.
You’ll also find some seemingly quick and easy methods (some of which I outline below) but if your computer is like mine, the quick and easy method isn’t going to work at all.
What causes the hal.dll file to go missing or become corrupted?
I have no idea.
The only thing I did different from any other day was install a program called Samsung PC Studio V.7.2 in an effort to make a backup copy of my phone contacts. Turned out my phone was not supported by the program and it wouldn’t work. I uninstalled all three Samsung programs the program installed and shut my computer off. The next day, I turned on my computer and found the above message. This was possibly coincidental.
A possible reason this problem happened I found through my research yesterday… Someone suggested that hal.dll problems are occasionally due to the computer shutting down improperly from a power outage, multiple power outages, or other reasons. It’s summer (as I’m writing this) in Dallas, TX and it’s been over 100 degrees every day the past month. My power has gone out multiple times both while I’ve been on the computer and while it was turned off due to tree branches falling on nearby power lines and rolling blackouts.
I don’t recommend these methods, but read my comments before starting:
I don’t necessarily endorse these methods, because to my knowledge, they did not help me whatsoever.
One of the most popular results for fixing this problem is a video created by Britec on youtube. http://www.youtube.com/watch?v=jvMkt9fkHCI I did both parts of what he suggests, and it did not help me. It would get me to a screen that would say something about the computer being improperly shut down and it would give me the option of starting Windows regularly, with last known good configuration, and in three different versions of safe mode. Regular start up would freeze on the Windows XP loading screen, last known good configuration would freeze, and safe mode would spout out several dozen similar codes like “multi(0)disk(0)rdisk(0)partition(2)\windows\system32\drivers\acpi.sys” and then freeze. I did not wait more than a few seconds with that entire screen of similar codes on the screen, but it’s possible that Windows may have eventually started. I think this method is flawed because it does not address the fact that if your computer has a Pentium D, two processors, or dual/quad core processors, the hal.dll file is actually the wrong file to get from the Windows XP cd and he also doesn’t mention that you need /NOEXECUTE=OPTIN in addition to /fastdetect on computers like mine. So let’s skip this unless you know for a fact you only have one processor.
Next thing I tried was on Britec’s website. http://www.briteccomputers.co.uk/forum/tutorials-and-how-to/how-to-fix-missing-or-corrupt-system32hal-dll/ These instructions are a bit different, but flawed as well because they didn’t help me. One thing that doesn’t work on either of Britec’s methods (which have obviously become the default method for fixing this problem–saw it copy and pasted all over google) is typing “attrib -h -s -r”, you have to do those commands individually or it doesn’t even work. Ex: attrib -h c:\\boot.ini
This solution may have actually worked, had I not already screwed up the hal.dll files thanks to Britec’s methods. If nothing else, it’s worth reading because you’ll start to understand things and get to see screenshots I’m not providing in my blog. http://tech.icrontic.com/articles/repair_windows_xp/ The info about /NOEXECUTE=OPTIN being mandatory for CPUs featuring Intel’s XD or AMD’s NX buffer overflow protection is important and not defined on any of the other links I’m posting.
What are you going to need to fix the hal.dll problem?
First of all, you’re going to need a few things, especially if you have files on your C: drive you want to save before continuing:
- a Windows XP cd (doesn’t have to be the one that came with your computer)
- another computer with internet access that can burn a CD-R
- one CD-R
- an external hard drive (USB one) that you can use to save your important files from the C: drive
- a great deal of computer literacy and/or patience as this process isn’t fun, fast, or easy
Getting to your files and saving them to another hard drive
I had a lot of files on my desktop that I really had to make sure I wouldn’t lose, should reinstalling Windows be my only option. I heavily recommend that you try to copy your files, so that’s what we’re going to do.
You’ll find that no matter how good of a programmer you are in Windows Recovery Console (which you’re going to be very familiar with soon) you aren’t going to be able to copy your files from My Documents, your Desktop, etc. from your C: drive to an external drive. You will get “Access Denied” as a response, and this cannot be undone easily, and especially cannot be fixed if you have Windows XP Home Edition (like me) instead of Windows XP Professional. I’m not going to go into detail about this. It’s faster and easier to do what I did.
What you’re going to do is follow the instructions here: http://www.datarecoverytutorial.com/how-to-recover-files-from-laptop-with-crashed-windows/ (Update 11/26/14: Avast reports this site as an attack site… so don’t go to it. Google “how to recover files from Windows using knoppix” and hopefully that will get you similar instructions). This page is a little outdated, but it’s important. These instructions work on both desktops and laptops. I’ll summarize the info below, in case the link goes dead at some time in the future.
What you’re going to do is download an Operating System called Knoppix on your working computer with CD burner. Knoppix is based on Linux. Now, if you’re like me, you’re computer literate, but you’re not even really all that sure what Linux is or even care. No worries. You still don’t really need to know.
So go to http://knopper.net/knoppix-mirrors/index-en.html and download the latest version of Knoppix. Yeah, the website is a bit confusing. I just clicked the first ftp link, accepted the agreement, and downloaded “KNOPPIX_V6.4.4CD-2011-01-30-DE.iso” from their file list. Looking back, I probably should have downloaded the iso from one of the sites in the list located in the US or England, because my Knoppix is in German… and I don’t speak German.
When the download finishes, virus scan it, and then try right clicking it. If you’re lucky, the context menu might say something along the lines of “burn CD image”. If not, you can download a free program called CDburnerXP from http://cdburnerxp.se/ . I was lucky, I didn’t have to install burning software to burn an iso.
Burn the ISO to a CD.
Turn on your hal.dll problem computer, and there should be an F key on your keyboard that will allow you to start your computer from a CD. In the case of my Dell, I have to press and hold the F12 button just after the DELL logo comes up on my screen seconds after hitting the power button. You may have to press F11, F10, or something else. For our purposes, I’m just going to assume F12 works for you. A menu should come up and you’ll be able to select your DVD/CDRW/CDR/CDROM drive. Open your CD drive first and stick your new Knoppix CD in the drive. Then select the CD drive and it’ll come up with a message that says to press any key to continue and you better immediately press a button (I just press one of the cursor buttons like up or down) or it’ll time out and take you back to the hal.dll error page or the page about improper shutdown and safe mode.
The CD will start spinning and the Knoppix loading screen will come up. Don’t touch anything, just let it load. It’ll load a desktop that looks similar to a Mac eventually.
Depending on what version of Knoppix you downloaded, these instructions could be a bit different. I used a German version of 6.4.4
There’s an icon on the upper left of the desktop, click or double click it. It’ll open a window similar to My Computer on Windows. On the left side of it, just like a Mac, there will be your C: hard drive with a funny name and any other drives you have plugged in. If it isn’t plugged in already, go ahead and plug your USB external hard drive into your computer now. It’ll show up on the left side and likely have a name of some sort. What I’d do is click or double click the icon on the desktop again to open up a new tab or window. View both your C: drive and your external drive at the same time. Make a new folder in your external drive and name it something like “c backup”. Go to your C: drive tab/window and locate the files you need to save.
Most of what you need is probably located in C:\documents and settings\brandon\ (where brandon is your user name on the computer). A few things might be located in C:\documents and settings\all users\. Just hover or select the folder (such as desktop) you want to copy, press ctrl + c, go to the window/tab with your external hard drive, and ctrl + v inside your “c backup” folder to paste the entire folder.
Tip 1: If you’re a firefox user, some of your important custom settings are located in a folder called Application Data inside C:\documents and settings\brandon. You’re going to want to save the Mozilla folder to your external hard drive. If you have a big external drive, you might as well save all of your application data files from brandon as well as all users into separate folders named as such.
Tip 2: The two folders you definitely want are brandon\desktop and brandon\my documents. If you have a large external drive, you could go ahead and save C:\program files to it just so you have a list of all programs you have installed on your C: drive. You’ll still have to reinstall them should you have to redo Windows, but at least you’ll have the names, add ons (such as Photoshop brushes), etc. that’ll help when you’re putting your computer back to the way it was.
Depending on how much stuff you have, this could take a few hours to copy over. When it’s done, close the open windows/tabs, and wait a few minutes for your external drive to go idle (you can probably hear it power down) and then you can unplug it.
Since I couldn’t read German, I didn’t know how to shut down the computer. If you press and hold the on/off button, a message will come up, you’ll click the equivalent of “yes” and it’ll send a kill signal to Knoppix and start shutting down. It’ll spit the CD out, take it out, close the drive, and then press enter and your computer will turn off.
You have your files backed up, now let’s start fixing the hal.dll file issues!!!
To fix the hal.dll issues, you’re going to need a Windows XP cd, a ton of patience, and a basic understanding of some coding doesn’t hurt.
Microsoft has some of the coding commands explained here: http://support.microsoft.com/kb/314058 (since Microsoft’s support section ends up with dead links usually, the article is titled “Description of the Windows XP Recovery Console for advanced users” so you might be able to google that). You don’t NEED to read any of this, but it helps if you run into something you don’t understand.
Now here’s the great part. A user named TheOutcaste wrote up EXACTLY, yes, 100% exactly, what you need to do to fix your hal.dll issues here: http://www.techsupportforum.com/forums/f10/corrupt-hal-dll-on-boot-running-into-recovery-console-problems-need-help-528313.html Scroll down a bit and you’ll see a post he typed that must have taken him 5 hours to type!
I am copy and pasting it below, and adding additional comments and changes in a green color where I feel necessary. Thank God for TheOutcaste or I wouldn’t be on my WORKING computer right now. I’m not an expert. He is.
How to fix the missing or corrupt <windows root>\system32\hal.dll error.
This could be due to an invalid boot.ini file, which is more common than the hal.dll file actually being missing or corrupted. Could be other things contributing as well. My hal.dll file was messed up no matter what from trying Britec’s methods and other methods I found online before this one.
First, boot to the XP Recovery Console.
Set your system to boot from CD, either by setting the boot order in the BIOS, or using the boot menu if your system provides one, usually by pressing one of the FX keys; F9, F10, F12 are common.
Insert the Windows XP CD and boot the system.
When prompted to Press any key to boot from CD… press any key like Spacebar or Enter
When you boot from the CD, the following is displayed:
On a black screen:
Setup is inspecting your computer’s hardware configuration…
Screen turns Blue, and Windows Setup is displayed at the top.
at the bottom is displayed the following in sequence:
Press F6 if you need to install a third party SCSI or RAID driver
Press F2 to run Automated System Recovery (ASR)…
Setup is loading files (file names displayed)
Title changes to Windows XP Professional (or Home Edition) Setup
The options to setup or repair Windows are displayed
Choose To repair a Windows XP installation using recovery console, press R.
You may need to choose the Windows installation if you have a dual boot system. Type the number of the Windows installation you want to log into.
You will need to enter the Administrator password unless you previously disabled that requirement; if it’s blank, just press enter.
You should now be at a C:\WINDOWS> prompt
Type the following lines pressing Enter after each one. Change the drive letter if needed.
Note that there are spaces between each differently colored part of the commands:
- CD \ (There is a space after CD)
- Ren Boot.ini Boot.old
If you get an error that the file can’t be found skip step 3.
- Type Exit. This will reboot the system. Re-enter the Recovery Console and start at step 4.
(If you don’t reboot, any previous entries in the boot.ini file might get added again, as they are stored in memory)
- Type BootCfg /Rebuild
This will go through several prompts.
The following is an example. You would type the colored text:
Code:
Scanning all disks for Windows installations.
Please wait, since this may take a while...
The Windows installation scan was successful.
Note: These results are stored statically for this session.
If the disk configuration changes during this session,
in order to get an updated scan, you must first reboot
the machine and then rescan the disks.
Total identified Windows installs: 1
[1]: C:\WINDOWS
Add installation to boot list? (Yes/No/All):y
Enter Load Identifier:Microsoft Windows XP Professional (or whatever you want to id the OS)
I recommend something a bit easier to identify like "Windows XP Redo"
Enter OS Load Options:/noexecute=optin /fastdetect
Note: There is a space between optin and /fastdetect
Type Fixboot
type Y to write the new boot sector
What if fixboot wants to do it on something other than my c: drive?!
When I was doing what TheOutcaste said, I had a flash drive plugged into my computer still. When I did fixboot, it wanted to put it on my flashdrive which it was calling the D: drive. I removed the drive and it still wanted to put it there.
My solution was to type “exit”, restart, F12, R, etc. to get back into the recovery console without the computer thinking I had the flash drive still plugged in, but according to this http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/bootcons_fixboot.mspx?mfr=true I could have simply typed “fixboot c:”
Remove the CD, then type Exit and see if it will boot into Windows.
If that doesn’t work, (didn’t work for me) we can try replacing the hal.dll file, either from the ServicePackFiles folder (if present) or the CD.
There are 7 different versions of the hal.dll file. When Windows XP is installed, it selects the correct file from one of the following and renames it to hal.dll
Code:
HAL File Copied Computer Description in Device Manager
Halmacpi.dll ACPI Multiprocessor PC
Halaacpi.dll ACPI Uniprocessor PC
Halacpi.dll Advanced Configuration and Power Interface (ACPI) PC
Halmps.dll MPS Multiprocessor PC
Halapic.dll MPS Uniprocessor PC
Hal.dll Standard PC
Halsp.dll Compaq SystemPro Multiprocessor or 100% Compatible
The first three are the most common. If you have two processors, or a dual/quad core processor, the ACPI MultiProcessor PC hal (halmacpi.dll) is the one to use.
If a Single core/Single processor, one of the next two should be chosen, Halaacpi.dll or Halacpi.dll.
If you are not sure, you can pick the Standard PC Hal.dll, and then we can check the version of the old file after booting to Safe Mode, then correct our choice if needed.
Running System Restore after replacing the hal.dll file might not replace this file with the correct version, so easiest to replace it manually.
There are two other files that are tied to the hal.dll. They are:
ntoskrnl.exe
ntkrnlpa.exe
For single processor systems, the files are named the same as above.
For multi-processor systems, these two files get renamed:
ntkrnlmp.exe -> ntoskrnl.exe
ntkrpamp.exe -> ntkrnlpa.exe
I haven’t tested all combinations of these files to see which will work. If you install the Standard PC hal.dll, you may need to also install the single processor versions of ntoskrnl.exe and ntkrnlpa.exe or the system might not boot. I have a Pentium D, so I had to select the ones that are automatically renamed normally
On a Dual Core Pentium D system running XP MCE 2005 w/SP2 (Same as XP Pro), the system will not boot after replacing the hal.dll file with the one from the CD no, it will not, which is why the general directions Britec and others supply suck. I had to replace the ntoskrnl.exe and ntkrnlpa.exe files with the single processor versions for it to boot, and the system then was only using one core from the Pentium D processor.
The correct file to use on this system is the halmacpi.dll
The ntkrpamp.exe and ntkrnlpa.exe files will be in the i386\SPX.CAB file on the CD, where X is the Service Pack number.
To extract the file, use this command in the Recovery Console, using the appropriate SP# and file name:
expand D:\i386\SP2.cab /F:ntkrnlpa.exe C:\Windows\System32
Once expanded, rename if needed.
Boot to the Recovery Console as above.
Type the following:
Systemroot
CD System32
Ren hal.dll halold.dll
If the hal.dll file is actually missing, this will give an error, just ignore it.
Copy ntoskrnl.exe ntoskrnl.old
Copy ntkrnlpa.exe ntkrnlpa.old
Dir C:\Windows\ServicePackFiles\i386\hal*
Do one of the following depending on the result
Note: Do not add a space between the Dark Red and Red sections.
- If it lists 7 files (or at least hal.dll)
type the following:
Copy C:\Windows\ServicePackFiles\i386\hal.dll C:\Windows\System32\hal.dll
Replace hal.dll with the appropriate file name from the above table.
Do NOT change hal.dll
Example for an ACPI Multiprocessor PC:
Copy C:\Windows\ServicePackFiles\i386\Halmacpi.dll C:\Windows\System32\hal.dll
I didn’t have the files in this location, but thanks to using Knoppix again to investigate my C: drive, I knew another location I had them. My hal.dll files were located in C:\Windows\Driver Cache\i386
Since “driver cache” has a space in it, you have to put the file path in quotes or it won’t work. Copy “C:\Windows\Driver Cache\i386\Halmacpi.dll” C:\Windows\System32\hal.dll
I heavily recommend locating the real ones on your computer using Knoppix instead of doing the 2nd option written below. Why? Because if you have, for example, Service Pack 3, your dll will be from 2008, and if you get the one off the XP CD, it’s probably going to be from about the year 2001. You might be able to use his instructions below to search your C: drive though without exiting and using Knoppix again.
- If you get an error The system cannot find the file or directory specified.
Type the following:
Map
Find the line Device\CdRom0 and note the drive letter X:. This is your CD-Rom.
Copy X:\i386\hal.dl_ C:\Windows\System32\hal.dll
Replace hal.dl_ with the appropriate file name from the above table, but change the last L to an underscore. Do NOT change hal.dll
Some OEM CDs have those files uncompressed. If you get an error that the file can’t be found type this:
dir X:\i386\hal*.*
If the files are listed with a .dll extension instead of .dl_, use Copy X:\i386\hal.dll C:\Windows\System32\hal.dll instead.
Remove the CD, then type Exit
When the system reboots we want to boot to Safe Mode, so tap F8 to bring up the Windows Advanced Options Menu and choose Safe Mode.
If other files have been corrupted, you may get a different error message. Post the complete error message, and we’ll see what other steps need to be taken.
Otherwise, you should end up in Safe Mode.
What happened to me is I got those crazy “multi(0)disk(0)rdisk(0)partition(2)\windows\system32\drivers\acpi.sys” codes covering my screen, but after a few seconds, they disappeared and Safe Mode started up. A message popped up and asked me if I wanted to use Safe Mode or System Restore. I chose Safe Mode.
If the system hangs, and you copied the Standard hal.dll file, you may need to go back into the Recovery Console and copy the single processor versions of ntoskrnl.exe and ntkrnlpa.exe from the CD or the C:\Windows\ServicePackFiles\i386 folder into the C:\Windows\System32 folder
Check which version the old file was:
- Double click My Computer
- Double click the C: drive
- Double click Windows
- Double click System32
- Right click on halold.dll, click Properties.
If hal.dll was missing, the halold.dll file won’t exist. Best we can do here is see if ntoskrnl.exe and ntkrnlpa.exe are Uniprocessor versions or Multiprocessor versions, and use a matching hal.dll
- Click the Version tab
- Click on Original File Name
- The original name will be displayed.
- Repeat for the ntoskrnl.old and ntkrnlpa.old files
If the wrong hal file was chosen, you may at some point get a notice that Windows has finished installing new devices and needs to reboot. Click No.
If you need to change the file, first copy it to your desktop.
Copy the correct file(s) from one of these folders:
C:\Windows\ServicePackFiles\i386
C:\Windows\System32\dllcache
C:\Windows\Driver Cache\i386\drivers.cab
C:\Windows\Driver Cache\i386\SPX.CAB
or from the CD:
D:\i386
D:\i386\drivers.cab
D:\i386\SPX.CAB
- If it is compressed (it’ll have a .dl_ or .ex_ extension) we first need to expand it.
Click Start | Run, type cmd, Press Enter
type the following:
CD /D %userprofile%\Desktop
expand halXXXX.dl_ hal.dll
where halXXXX.dl_ is the name of the file you copied
- If not compressed, just rename the file to hal.dll
- Do the same for the ntoskrnl.exe and ntkrnlpa.exe files
Use ntkrnlmp.exe and ntkrpamp.exe if you want the Multi-processor versions
renaming them to ntoskrnl.exe and ntkrnlpa.exe
Now navigate back to the C:\Windows\System32 folder and drag the hal.dll, ntoskrnl.exe, and ntkrnlpa.exe files from the desktop and drop it into the System32 folder. You’ll be asked if you want to replace the existing files, click Yes
Reboot the system.
If at any point it told you that it installed new devices it will have installed “ghost” drivers. These can cause issues so here’s how to remove them.
These ghost drivers will show if you boot to Safe Mode and check the Device Manager. (Click View | Show hidden devices).
I didn’t have any ghost icons, so this wasn’t anything I had to do.
Or we can set the Device Manager to show them in Normal mode:
Go to Control Panel | System
Click the Advanced tab, then click the Environment Variables button
Under the System variables section, click the New button.
In the Variable name: box type DevMgr_Show_NonPresent_Devices
In the Variable value: box type 1
Click OK, then click OK again on the Environment Variables window
In Device Manager, Click View | Show hidden devices
Any duplicate drivers, and drivers for devices not connected (USB Flash etc), will show up as “ghost” icons.
Go through each category in Device Manager and remove each “ghost” by right clicking, then click Uninstall.
Note that there are several items under Non-Plug and Play Drivers and Sound, video and game controllers that are normal to show as a “ghost” icon, such as Microsoft Kernel devices. Don’t remove them unless they are duplicated, then remove both instances.
Under Network Adapters there will also be a RAS Async Adapter and possibly a Microsoft TV/Video Connection item, you can leave those as well unless they are duplicated.
External USB drives, Flash drives, and memory cards that are not connected will show as ghost devices under Disk Drives. Removing these entries won’t hurt anything, but if you’ve assigned a specific drive letter to these devices, you’ll have to re-assign the drive letter again. You may want to make sure those devices you use frequently are connected.
For the Computer Category, if there are two entries, remove the one that doesn’t match the hal.dll file you installed.
Once you have this done, you can go ahead and try to restart your computer normally by clicking the start button, shut down, restart and see if it works properly like mine did.
A Vista/Win7 DVD can also be used to for this, except you have to manually edit the boot.ini file.
Boot with the DVD
Select your language and click Next
Click Repair your Computer
After it scans for Windows installations click Next (Win 7: Select Top option first)
Click Command Prompt.
Type Notepad and press Enter.
Click File | Open
On the left, click Computer
This will let you verify the drive letter, as they may be different when booted to the CD/DVD
Type the following, press Enter after each line:
attrib -H -R -S C:\boot.ini
Notepad c:\boot.ini
Correct any errors, then save the file
Close Notepad
In the Command Prompt, type the following and press Enter:
attrib +H +R +S C:\boot.ini
(If you get errors that the file can’t be found, either the boot.ini file is missing, or the drive letter is not C:
Sometimes the drive letters are different when booted to a CD/DVD.
In Notepad, click File | Open
Click Computer on the left. This will show the drives on the PC as seen by the Recovery Environment
If the boot.ini file is missing, use Notepad to create one).
For the rest of the procedure, you can use the Command Prompt and follow the instructions above.
(Use Notepad to determine the CD-ROM drive letter if needed, rather than Map)
You can use Notepad as a mini Windows Explorer, and browse to the files, but would need to use the Command Prompt to expand the files from the XP CD.
In the Command Prompt:
Type Notepad
Notepad should open
Press Alt+Tab to switch back to the Command Prompt
Press the Up Arrow, then Enter. This will open a 2nd instance of Notepad.
Click File | Open
Change the Files of type: box to All Files
Press Alt+Tab to switch to the other Notepad window
Click File | Open
Change the Files of type: box to All Files
Position the two Open dialogs so you can easily switch between the two, and widen them if needed.
Depending on your Screen Resolution, they may overlap.
I position one top left, and one bottom right.
Hooray! I fixed it! Now what should I do?
http://forums.whatthetech.com/index.php?showtopic=95574 I recommend running chkdsk from the recovery console, so it can check your C: drive for errors and fix them (thanks to having the Windows XP cd still in the CD drive obviously).
What you’ll do is get into the recovery console (the whole R, 1, enter, enter thing) and then you’ll type “chkdsk /r” the “/r” part means it’s basically going to fix all errors it finds. It will take an hour or two to fully run, so don’t do this if you are in danger of a power outage or don’t have time to let it finish… because it has to finish! Once it is done, type “exit” and your computer should hopefully start up perfectly and you can remove the CD and go about your usual business.