Using Package Resource to Install NodeJS Returns 1603

Tagged: 

This topic contains 14 replies, has 3 voices, and was last updated by Profile photo of Dave Wyatt Dave Wyatt 2 years, 5 months ago.

  • Author
    Posts
  • #16928
    Profile photo of Aaron Jensen
    Aaron Jensen
    Participant

    Here's my (first) DSC script:

    param(
        [string[]]
        $ComputerName = 'localhost'
    )
    
    configuration InstallNodeJS
    {
        param(
            [string[]]
            # The name of the computer(s) to install node JS.
            $ComputerName
        )
        
        node $ComputerName
        {
            Package installNodeJS
            {
                Name = 'NodeJS';
                Path = 'C:\node-v0.10.29-x64.msi';
                Ensure = 'Present';
                ProductId = '';
                Arguments = '/log C:\nodeInstallLog.txt';
            }
        }
        
    }
    
    InstallNodeJS -ComputerName $ComputerName

    When I run

    Start-DscConfiguration

    , the node installation fails with error code 1603:

    >> Start-DscConfiguration .\InstallNodeJS -Wait -Verbose -Credential ********
    VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
    VERBOSE: An LCM method call arrived from computer ********with user sid ********
    VERBOSE: [********]: LCM:  [ Start  Set      ]
    VERBOSE: [********]: LCM:  [ Start  Resource ]  [[Package]installNodeJS]
    VERBOSE: [********]: LCM:  [ Start  Test     ]  [[Package]installNodeJS]
    VERBOSE: [********]:                            [[Package]installNodeJS] The package NodeJS is not installed
    VERBOSE: [********]: LCM:  [ End    Test     ]  [[Package]installNodeJS]  in 0.3280 seconds.
    VERBOSE: [********]: LCM:  [ Start  Set      ]  [[Package]installNodeJS]
    VERBOSE: [********]:                            [[Package]installNodeJS] The package NodeJS is not installed
    VERBOSE: [********]:                            [[Package]installNodeJS] Package configuration starting
    VERBOSE: [********]: LCM:  [ End    Set      ]  [[Package]installNodeJS]  in 10.5950 seconds.
    PowerShell provider MSFT_PackageResource  failed to execute Set-TargetResource functionality with error message: The return code 1603 was not expected. Configuration is likely not correct 
        + CategoryInfo          : InvalidOperation: (:) [], CimException
        + FullyQualifiedErrorId : ProviderOperationExecutionFailure
        + PSComputerName        : ********
     
    VERBOSE: [********]: LCM:  [ End    Set      ]
    The SendConfigurationApply function did not succeed.
        + CategoryInfo          : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
        + FullyQualifiedErrorId : MI RESULT 1
        + PSComputerName        : ********
     
    VERBOSE: Operation 'Invoke CimMethod' complete.
    VERBOSE: Time taken for configuration job to complete is 11.465 seconds
    

    When I inspect the installation log, I'm seeing this error:

    WixCreateInternetShortcuts:  Creating IUniformResourceLocatorW shortcut 'C:\Windows\system32\config\systemprofile\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Node.js\Node.js website.url' target 'http://nodejs.org'
    WixCreateInternetShortcuts:  Error 0x80070003: failed to save shortcut 'C:\Windows\system32\config\systemprofile\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Node.js\Node.js website.url'
    WixCreateInternetShortcuts:  Error 0x80070003: failed to create Internet shortcut
    CustomAction WixCreateInternetShortcuts returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
    

    So it looks like the installer doesn't have permission to write some shortcuts.

    The installer runs fine when I run it in quiet mode via a remoting prompt:

    > msiexec /i C:\node-v0.10.29-x64.msi /quiet /log C:\nodeInstallLog.txt
    

    When I look at the installation log, I see the shortcut was put under my user directory:

    WixCreateInternetShortcuts:  Creating IUniformResourceLocatorW shortcut 'C:\Users\********\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Node.js\Node.js website.url' target 'http://nodejs.org'
    WixCreateInternetShortcuts:  Creating IUniformResourceLocatorW shortcut 'C:\Users\********\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Node.js\Node.js documentation.url' target 'http://nodejs.org/dist/v0.10.29/docs/api/'
    

    Is this a problem with the package resource? The Node installer? My system's permissions?

    I'm getting this behavior on Windows 7 and Windows 2012 R2.

  • #16929
    Profile photo of Don Jones
    Don Jones
    Keymaster

    It looks like the installer is expecting to be run only in the context of a logged-on user – it's trying to create per-user shortcuts. That's failing, because it isn't being run interactively by the LCM. The LCM isn't a "user." Looks like your guess was correct.

    The installation may have been successful in every way that counts, but because the installer is returning an error code, the LCM doesn't know it all went fine.

  • #16930
    Profile photo of Aaron Jensen
    Aaron Jensen
    Participant

    NodeJS installs to

    C:\Program Files\nodejs

    . After

    Start-DscConfiguration

    fails, that directory does not exist. When I install myself, it does.

    Looks like I'm filing a bug with the NodeJS people.

  • #16931
    Profile photo of Don Jones
    Don Jones
    Keymaster

    It's likely not appreciating being run without user context. That's a not-uncommon problem.

    I'm not *sure* DSC is going to prove to be a wonderful software deployment mechanism, at least with the current Windows Installer technology. There are definitely assumptions about the installation environment that don't correspond to the "headless, not necessarily domain joined" world that DSC considers to be its main focus. We need *nix-style packages, really, which is what OneGet is all about.

  • #16932
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    This seems to be a fairly common problem. Installers aren't being written or tested with installation by the LocalSystem account in mind.

    There's probably a way to get it working, but in the worst case, that would involve using Orca or another MSI editor to null out the actions which are failing for System. (Some installers may be written in such a way that you can fix it by just using the right command line arguments, but others are more of a pain.) It would be better if the installer just worked.

  • #16933
    Profile photo of Aaron Jensen
    Aaron Jensen
    Participant
  • #16936
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    just for giggles, try adding this to your arguments for the package resource:

    ADDLOCAL=ALL REMOVE=DocumentationShortcuts
    
  • #16937
    Profile photo of Aaron Jensen
    Aaron Jensen
    Participant

    The install is successful, but I notice two things: 1) the node directory isn't added to the system path and 2) Node doesn't show up in the Programs and Features control panel. It does show up in the registry as installed, though. Is that normal for DSC-installed packages? Any thoughts on what's going on?

    How did you figure out those properties? Please teach me! Seriously.

  • #16938
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    DSC isn't doing anything special here, it's just running msiexec with a certain set of command-line arguments. The problems are coming from the fact that the msiexec process is being launched by the SYSTEM account instead of another user. I'm not sure why you're not seeing the package in add/remove programs, or why the system path modification didn't work.

    Anyhow, I used Orca.exe (an MSI editing tool in the Windows SDK) and looked at the Feature table of the package. The ADDLOCAL and REMOVE properties are common to all MSI packages; you can find some documentation on them at http://support.microsoft.com/kb/230781 . All I needed to know was the name of the feature associated with the shortcut creation.

  • #16939
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    More MSI documentation:
    [url]http://msdn.microsoft.com/en-us/library/aa367536(v=vs.85).aspx[/url]
    [url]http://msdn.microsoft.com/en-us/library/aa371194(v=vs.85).aspx[/url]

  • #16941
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    BTW, I'm seeing some of the same behavior as you. I used PSExec to launch a command prompt as the system account, then ran:

    msiexec /i node-v0.10.29-x64.msi /passive ADDLOCAL=ALL REMOVE=DocumentationShortcuts
    

    I do see the app's folder installed in Program Files, and I do see the nodejs folder added to the system path. However, for some reason, there is no entry in Add/Remove Programs. I'll keep playing with it and see if I can figure that out.

  • #16942
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    A little bit of Google Fu seems to have turned up the answer. In addition to what you've already got, try adding ALLUSERS=1 to the arguments list. (See [url]http://msdn.microsoft.com/en-us/library/aa367559(v=vs.85).aspx[/url] for a description of this.)

    However, this won't work right away if you're testing on a system where you already did the default "per-user" installation of node as the System account. To clean things up so you can test it properly with ALLUSERS=1, delete the registry keys associated with Node.js under HKEY_USERS\S-1-5-18\Software\Microsoft\Installer. (In my tests, this was a key named 7E8E2AB1E3C7C6D4A9A865A9978167A1 under both Features and Products, and a key named C44906D1EC9B17A47A0C3048BE88B4AA under UpgradeCodes ).

    In fact, when you use ALLUSERS=1, it appears that you don't even have to bother with ADDLOCAL and REMOVE. It installs the shortcuts successfully to the C:\ProgramData folder.

  • #16974
    Profile photo of Aaron Jensen
    Aaron Jensen
    Participant

    The ALLUSERS=1 switch worked. How do you know these things? 🙂

    I have no experience with installers. I searched Google, but I think I didn't even know what I needed to be searching for. Thanks for the help.

  • #16975
    Profile photo of Don Jones
    Don Jones
    Keymaster

    Aaron, I tell you – you could really return the favor by writing all this up in a short Word doc. Start with the problem you ran into, what you tried, what you learned, and what the eventual fix was. We can turn that into a TechLetter article that'll live forever and help others learn from your experience. Contact me at donj@ (same domain name as this website) if you're interested, and thanks for considering it!

  • #16976
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    Some things I've picked up over the years, others I just find with web searches as needed. In this case, I think I searched for something like "MSI LocalSystem not in add remove programs", and one of the top hits was this article which mentions the ALLUSERS=1 argument: http://www.symantec.com/connect/forums/application-installed-altiris-not-addremove-programs

    I tried it out, failed originally (due to the first tests on the same machine), found the registry values in System's user hive, removed them, and tested again.

You must be logged in to reply to this topic.