Understanding error 0x80070002

This is an extremely basic/entry level question, so please move it to the appropriate newbie forum. I also wrote this in html just to see all my tags being cheerfully ignored, but I digress.

Now that is out, let's get to the point. So we have error 0x80070002, "The system cannot find the file specified." The first thing I think of is permissions; a classical example could be <tt>dism</tt> trying to open a <tt>.cab</tt> file. I will use the <tt>dism</tt> because I can get some kind of logs. A typical log of this event would look something like this:

2015-08-25 22:49:28, Info                  DISM   DISM Package Manager: PID=2668 TID=1964 Routing the command... - CPackageManagerCLIHandler::ExecuteCmdLine
2015-08-25 22:49:28, Info                  DISM   DISM Package Manager: PID=2668 TID=1964 Encountered the option "packagepath" with value "c:\somewhere\package.cab" - CPackageManagerCLIHandler::Private_GetPackagesFromCommandLine
2015-08-25 22:49:28, Error                 DISM   DISM Package Manager: PID=2668 TID=1964 Failed opening package. - CDISMPackageManager::Internal_CreatePackageByPath(hr:0x80070002)
2015-08-25 22:49:28, Error                 DISM   DISM Package Manager: PID=2668 TID=1964 Failed to get the underlying CBS package. - CDISMPackageManager::OpenPackageByPath(hr:0x80070002)
2015-08-25 22:49:28, Error                 DISM   DISM Package Manager: PID=2668 TID=1964 Failed to open the package at location: "c:\somewhere\package.cab" - CPackageManagerCLIHandler::ProcessPackagePath(hr:0x80070002)
2015-08-25 22:49:28, Error                 DISM   DISM Package Manager: PID=2668 TID=1964 Failed while processing command add-package. - CPackageManagerCLIHandler::ExecuteCmdLine(hr:0x80070002)

What does that error actually means?

    • The first assumption would be that the user the path is invalid, so I will try to see if I can see the file as a garden-variety user
      PS C:\somewhere> dir C:\somewhere\package.cab
      
      
          Directory: C:\somewhere
      
      
      Mode                LastWriteTime     Length Name
      ----                -------------     ------ ----
      -a---         8/25/2015  12:08 PM       6384 package.cab
      
      
      PS C:\somewhere>
    • Maybe the program is being run as a user that has no read rights on the file. We must then find out which user can do what to this file:
    PS C:\somewhere> dir C:\somewhere\package.cab|get-acl| ForEach-Object { $_.Access  }
    
    
    FileSystemRights  : FullControl
    AccessControlType : Allow
    IdentityReference : THE-SERVER\Administrator
    IsInherited       : False
    InheritanceFlags  : None
    PropagationFlags  : None
    
    FileSystemRights  : FullControl
    AccessControlType : Allow
    IdentityReference : NT AUTHORITY\SYSTEM
    IsInherited       : True
    InheritanceFlags  : None
    PropagationFlags  : None
    
    FileSystemRights  : FullControl
    AccessControlType : Allow
    IdentityReference : BUILTIN\Administrators
    IsInherited       : True
    InheritanceFlags  : None
    PropagationFlags  : None
    
    FileSystemRights  : ReadAndExecute, Synchronize
    AccessControlType : Allow
    IdentityReference : BUILTIN\Users
    IsInherited       : True
    InheritanceFlags  : None
    PropagationFlags  : None
    
    PS C:\somewhere>

    That makes me think that the host and all administrators in general and the local one specifically can do whatever they want with the file while all users can read and execute it. Which permissions does <tt>DISM</tt> (and <tt>Private_GetPackagesFromCommandLine</tt> by extension) require to open the <tt>.cab</tt> file?

  1. I have seen threads stating that one of the causes for this error is a corrupted file. Unfortunately I do not have the md5sum for this specific .cab but I have no problems extracting its contents from command line, so I must take that it is good. That said, being able to see <tt>Private_GetPackagesFromCommandLine</tt> would answer such questions.

Apologies for using dism here since I am more concerned about understanding the error, but I needed something to illustrate it that would eliminate as much cruft as I could.

August 26th, 2015 1:12pm

Hi,

Thanks for your post.

May I ask what do you do when you meet the error? backup or deployment?

And what's your operating system for the computer?

The error usually happens in backup and deployment.

For deployment, if the WinPE version is not appropriate for the related operating system. It may show the error.

If it's in deployment, what's the version of winPE?

For backup, what's step do you operate when meet the error?

Here is the article about windows 7, if you may have a reference.

Error code 0x8100002F and or error code 0x80070002 when you back up files in Windows 7

https://support.microsoft.com/en-us/kb/979281

Best Regards,

Mary Dong

Free Windows Admin Tool Kit Click here and download it now
August 27th, 2015 3:09am

Thank you for the reply, but I am afraid you are replying to a different question, something along the lines of "how to make error 0x80070002 go away when I am doing X" . The question you are replying to has been asked here many times before. Clearly it is my fault for not being clear, and I apologize. You see, I was trying to find the simplest example I could find to show the error I want to understand. Best I could was using this .cab file. I wanted to eliminate as many issues -- where the file came from, why I am not running SCCM, what this package is for, why I am not running Y program, did you apply all the patches properly, which version of windows and how many GB of memory you have -- that have been sources of many interesting questions that populate not only this forum but many others.

I would rather not change my question to fit those answers. My question is more on the lines of "what 0x80070002 is anyway?" The not-so-helpful message tells it is a permissions problem, but fails to provide any further detail. When GetPackagesFromCommandLine says it cannot open a file due to 0x80070002, what really mean?

Let me use an example from a lesser operating system. If something similar happened there, I would look at the syslog (unless you told it to use its own log), auth.log, or the audit.log files and see if the service was not able to open file (maybe it dropped privilege to an user that was not allowed to open the file). And that should be a typical permissions issue: can't open file as user X (logs will show that), identify which users can open (logs or ls -Z), decide whether to allow X to open file or change user we are running as, implement decision, move on.

Does that help?
August 27th, 2015 6:30am

Thank you for the reply, but I am afraid you are replying to a different question, something along the lines of "how to make error 0x80070002 go away when I am doing X" . The question you are replying to has been asked here many times before. Clearly it is my fault for not being clear, and I apologize. You see, I was trying to find the simplest example I could find to show the error I want to understand. Best I could was using this .cab file. I wanted to eliminate as many issues -- where the file came from, why I am not running SCCM, what this package is for, why I am not running Y program, did you apply all the patches properly, which version of windows and how many GB of memory you have -- that have been sources of many interesting questions that populate not only this forum but many others.

I would rather not change my question to fit those answers. My question is more on the lines of "what 0x80070002 is anyway?" The not-so-helpful message tells it is a permissions problem, but fails to provide any further detail. When GetPackagesFromCommandLine says it cannot open a file due to 0x80070002, what really mean?

Let me use an example from a lesser operating system. If something similar happened there, I would look at the syslog (unless you told it to use its own log), auth.log, or the audit.log files and see if the service was not able to open file (maybe it dropped privilege to an user that was not allowed to open the file). And that should be a typical permissions issue: can't open file as user X (logs will show that), identify which users can open (logs or ls -Z), decide whether to allow X to open file or change user we are running as, implement decision, move on.

Does that help?
Free Windows Admin Tool Kit Click here and download it now
August 27th, 2015 10:25am

Hi
As far as I know, sometimes the error shows up doesn't for the same root cause. According to your question, it happens to .cab files when use DISM.  Error 0x80070002, "The system cannot find the file specified." Dism support cab file. But sometimes it doesn't support the package. It may be related to what exactly the package is. After unzip the package, if it not support, it may be shows the error. Or your operation do not right, it may also have the error. And sometimes even the package broken, it meets the same error either. And as I said before,  it could happend when backup. It may have different cause. I suggest you could have to look at it on an issue by issue basis.

Here is the article you may also check for a test.

How to use DISM to install a hotfix from within Windows

http://blogs.technet.com/b/askcore/archive/2011/02/15/how-to-use-dism-to-install-a-hotfix-from-within-windows.aspx       

Best Regards,

Mary Dong

   

August 27th, 2015 11:17pm

The log file states that when DISM runs the function CPackageManagerCLIHandler::Private_GetPackagesFromCommandLine on that file, it fails with that error. What does that function do? How does it open a file? Which are the arguments passed to it, which would indicate how much we already know about the file? If it does not support the files inside the package, it better report that. The name of the function makes me assume it has issues with the cab file itself. I don't know; I need more info. Dealing with blackbox coding which generates vague error messages is frustrating at best.

FYI, I chose DISM since I found other programs, such as pkgmgr, call it behind the scenes (check the log file for pkgmgr to see what I mean). I also found a lot entry in someone else's post that hints it can do checksum testing if asked. That makes me believe some of the higher level package managing -- SCCM comes to mind -- uses it. Therefore, it makes sense to eliminate as much of the noise caused by higher level package managerss and different versions of the OS and so on. My point is the error was not caused by running windows 8.1 on a tablet upside down on a sunday morning while shaking a chicken closer to the southernmost window on the second floor.

CPackageManagerCLIHandler::Private_GetPackagesFromCommandLine is as close as I got from who actually generated the error and then passed it up. If you search online for CPackageManagerCLIHandler you are hard pressed to find documentation on it. Instead you keep finding people talking about symptoms as observed by whatever program that in the end of the day is relying on DISM they are using.

Free Windows Admin Tool Kit Click here and download it now
August 30th, 2015 10:45pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics