Introduction to the Problem
This post discusses solutions to this error message:
Unable to Terminate Process
The operation could not be completed.
Access is denied.
I got that error message when I tried to kill a process in Windows Task Manager. To get into Windows Task Manager, I could use Ctrl-Alt-Del > Start Task Manager, or I could use the Run dialog. To get the Run dialog, I could use the Start Menu or the Windows key. The Windows key was the one near the bottom right and/or bottom left corner of the keyboard, with a picture of a Microsoft window on it. (I will usually refer to the Windows key as WinKey or just Win-.) In the Run dialog, I typed taskmgr.exe. My Run dialog was preset to commence tasks with administrator privileges. I was able to preset it that way by taking additional steps.
Once I was in Windows Task Manager, I might or might not see the troublesome program listed in the Applications tab. If I did, I could right-click on that program and select Go to Process. Alternately, I could just go into the Processes tab and scroll down until I saw the troublesome process underlying that program.
In this particular case, I was trying to kill firefox.exe. I was running a portable version of Firefox, and for some reason the Firefox application would disappear from the Applications tab in Task Manager when I tried to close Firefox, but firefox.exe would remain in the Processes tab list. In that list, I could right-click on firefox.exe and choose End Process or End Process Tree, and that’s when I would get the error message shown above.
It seemed there might be some solutions or workarounds that would be specific to Firefox. Another post explores those possibilities. This post is more concerned with the generic problem of having a process, be it Firefox or something else, that is simply unwilling to die. I was using Windows 7 x64, but it appeared that many users had run into this same error message with many programs under various versions of Windows over a period of years.
Sometimes, when I had this error, I could restart Firefox. In that case, I would have more than one Firefox entry in the Processes list in Task Manager. I was most likely to notice the problem while using Firefox Portable. So in Task Manager, there could be more than one instance of firefox.exe, or there could be firefox.exe plus FirefoxPortable.exe, or both. At other times, I would have only one instance of firefox.exe, but it would not go away, and its presence seemed to be keeping Firefox from restarting.
I did find that I could terminate the process by rebooting the system. The objective here was to find a way of terminating the process without having to reboot.
There seemed to be quite a few utilities designed to kill processes. I liked Daphne as a GUI tool because it had a target that I could drag and drop onto the window of a running program, if that program refused to die. Other GUI task killers included Process Lasso, Kill Process, AnVir, Process Hacker, Process Explorer, Task Blocker, RKill, and KillProcess. Command-line task killers included taskkill, PsKill, and kill.exe. The last was available through Windows 7 SDK > GRMSDK_EN_DVD.iso > unzip using a zip program like WinRar > go into the WinSDKDebuggingTools_amd64 folder (or another nearby, if this one won’t run on your machine) > run dbg_amd64_184.108.40.2064.msi, or whatever it is called in your preferred folder > go to the output folder you have designated > find and extract kill.exe > delete the rest.
Taskkill did give me some information, when I tried it:
X:\>taskkill /T /F /IM firefox.exe ERROR: The process with PID 12616 (child process of PID 12560) could not be terminated. Reason: There is no running instance of the task.
It seemed, in other words, that some other program (perhaps FirefoxPortable.exe) had spawned the firefox.exe process, and then the spawning program had gone away, but for some reason the child process was left behind as an orphan. The child was not only an orphan; it also appeared to be dysfunctional. Specifically, I noticed that the firefox.exe process was the only running process that did not display anything in the Description column in Task Manager.
kill -processname firefox.exe
Another approach was to type this:
kill -id [PID]
Taskkill (above) seemed to give me some PIDs I could use in the latter kill command. Apparently “kill” was shorthand for “Stop-Process,” which would also apparently work with either Stop-Process -Name firefox.exe or Stop-Process -ID 2668 (or whatever the PID happened to be). My attempts with taskkill had suggested, however, that there was no PID (i.e., Process ID): in the example quoted above, Windows had said there was no running instance of PID 12616. Regardless, PowerShell did not solve the problem in this case.
Among the GUI programs listed above, Process Hacker seemed to take a particularly thorough approach. I tried Process Hacker > Processes tab > click on Name column heading to sort by name > right-click on firefox.exe > Miscellaneous > Terminator > Run selected (almost all boxes selected by default). This would reportedly try multiple methods of killing the process. Unfortunately, that Terminator failed, even when I checked the two kill methods that were not checked by default in the Terminator box.
In my browsing, I ran numerous other possible solutions. I tried some of them. Here are some of those suggestions and a summary of what happened, for those that I tried:
- One suggestion was to kill explorer.exe in Task Manager. I had two running explorer.exe processes. I right-clicked and killed both. But even with explorer.exe dead, I still could not end firefox.exe. I used Task Manager > File > New Task > explorer.exe to get Explorer back.
- There were the inevitable suggestions to run various virus scans and malware testers, perhaps after booting Windows in Safe Mode.
- I followed the advice to run CCleaner. I had it clean many but not all of the things that it could have cleaned. There were some things I was not ready to lose at this point. I doubted that this would be the solution anyway — I did not recall an instance when CCleaner had made the difference in solving a problem — but perhaps it was something to return to if all else failed.
- How-To Geek raised the possibility that I did not have ownership of Firefox when I opened it. That did not seem applicable.
- Someone suggested that the problem of the unkillable process might be due to some other program, so I thought maybe reducing other processes might be a solution. I could have kept on closing processes until it actually would have been easier to just reboot. The processes that I did close were not the culprits: I still could not kill firefox.exe.
- A search led to a thread indicating that the problem also arose in Windows 8. Several posts in that thread said that, for at least some situations in Win8, the solution was to disable Internet Connection Sharing (ICS). The advice on doing that suggested going to Control Panel > Network and Sharing Center > Change Adapter Settings > right-click on a network device > Properties > Sharing tab > uncheck “Allow other network users to connect through this computer’s Internet connection.” This did not work for me: mine was already unchecked.
- At least for problems with Spotify, another user found that turning off all network adapters in Network and Sharing Center made it possible to kill the program. Someone suggested also killing VPN connections.
- Someone suggested going into Task Manager > right-click on the unkillable process > Properties > Previous Versions tab > select the most recent previous version > Open. That just opened an instance of Windows Explorer, focused on the System32 folder. It was not clear what next steps I should take at that point.
- Trevor said that the solution was to go into services.msc and terminate the service associated with the unkillable process. I tried that, but could not figure out which service might be associated with firefox.exe.
- Someone said the problem arose after the machine had been locked (e.g., Ctrl-Alt-Del > Lock this computer). To test this, I restarted the machine and ran it without locking it. Several days later, the problem had not recurred. At first, I thought this might be the problem, but then it started to look like a Firefox extension was the cause.
- There was a suggestion to unplug all USB devices.
- In another post, had previously dealt with a somewhat similar problem in Google’s Chrome browser: I wanted to kill Chrome, but it would not die. In that case, I had created a taskbar button that I could click to run a batch file that would automatically kill processes and take care of the problem. I had verified that this batch file would remove all relevant Chrome processes from the Task Manager list. It seemed worth keeping this technique in mind, but I did not see how it would be helpful in this particular situation, since commands were not closing Firefox.
As noted above, the other post pursues Firefox-specific measures in more detail.