Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vagrant up on the development folder fails #14

Open
mefellows opened this issue Jan 8, 2015 · 11 comments
Open

Vagrant up on the development folder fails #14

mefellows opened this issue Jan 8, 2015 · 11 comments
Assignees
Labels

Comments

@mefellows
Copy link
Owner

See #10 for context.

Running vagrant up on the development folder results in:

The following WinRM command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mkdir c:\ -force
if ($?) { exit 0 } else { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } }

Stdout from the command:

Stderr from the command:

#< CLIXML
System.Management.Automation.PSCustomObjectSystem.Object1<PR N="Record"

    Preparing modules for first use.0-1-1Completed-1 </
    PR>mkdir : The path is not of a legal form.x000D__x000AAt line:1 char:1_x000D
    __x000A_+ mkdir c:\ -force_x000D__x000A_+ ~~~~~~~~~~~~~~~~x000D__x000A + CategoryInfo : InvalidArgument: (C::String) [New-Item], Argume x000D__x000A ntEx
    ception_x000D__x000A_ + FullyQualifiedErrorId : CreateDirectoryArgumentError,Microsoft.PowerShel x0
    00D__x000A l.Commands.NewItemCommand_x000D__x000A_ x000D__x000A
@mefellows
Copy link
Owner Author

@Jonne, in order to diagnose this problem further, can you please:

  • Update to the latest vagrant-dsc plugin (should be 1.0.3): vagrant plugin update vagrant-dsc
  • Clean your working environment (ensure you're working from this code base's master branch)
  • Destroy and run a clean vagrant box: vagrant destroy && VAGRANT_LOG=debug vagrant up
  • Upload the detailed output to a gist and provide a link to it in here?

@mefellows
Copy link
Owner Author

Hmm, funny thing, it seems it only works on a 2012r2 image if I run provision at least twice. The first provision fails when it runs DSC:

==> default: Running provisioner: dsc...
==> default: "Running DSC Provisioner with manifests/MyWebsite.ps1..."
#< CLIXMLAdding to path: C:\tmp\vagrant-dsc-4\modules-0;C:\tmp\vagrant-dsc-4\modules-1
PSModulePath Configured: C:\tmp\vagrant-dsc-4\modules-0;C:\tmp\vagrant-dsc-4\modules-1;C:\Users\vagrant\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
Running Configuration file: C:\tmp\vagrant-dsc-4\manifests\MyWebsite.ps1
    Directory: C:\tmp\vagrant-dsc-4\staging


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---          1/8/2015   4:21 AM       5580 localhost.mof


Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' =
MSFT_DSCLocalConfigurationManager,'namespaceName' =
root/Microsoft/Windows/DesiredStateConfiguration'.
An LCM method call arrived from computer VAGRANT-2012-R2 with user sid
S-1-5-21-3341160440-4185694322-4094034967-1001.
[VAGRANT-2012-R2]: LCM:  [ Start  Set      ]
[VAGRANT-2012-R2]: LCM:  [ End    Set      ]
Operation 'Invoke CimMethod' complete.
Time taken for configuration job to complete is 0.868 seconds

<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><Obj S="progress" RefId="0"><TN RefId="0"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj><S S="Error">Importing module SEEK_cWebsite failed with error - The specified module _x000D__x000A_</S><S S="Error">'WebAdministration' was not loaded because no valid module file was found in _x000D__x000A_</S><S S="Error">any module directory._x000D__x000A_</S><S S="Error">    + CategoryInfo          : InvalidOperation: (root/Microsoft/...gurationMan _x000D__x000A_</S><S S="Error">   ager:String) [], CimException_x000D__x000A_</S><S S="Error">    + FullyQualifiedErrorId : ImportModuleFailed_x000D__x000A_</S><S S="Error">    + PSComputerName        : localhost_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S></Objs>[email protected]

It could be the use of the SEEK DSC installation via Chocolatey, although that seems unlikely, even unblocking the modules in advance doesn't seem to help. Will talk to my resident DSC expert tomorrow and hopefully nut this out - should be something basic.

Sorry Jonne - there is an issue after all (although different to what you're seeing).

On a side note, this works first time on a 2008r2 server.

@mefellows
Copy link
Owner Author

As a debugging note, locally i've started to isolate what specifically requires DSC to be run twice. My results:

  • Using only a the File resource in a configuration, DSC runs perfectly on the first go
  • Using the MyWebApp composite resource also works on the first go
  • Adding the cWebAdministration resource to the Configuration requires 2 attempts.

Note this works on a 2008r2 image I have locally running WMF 5. I will next look at swapping out the current 2012r2 server with my own one build via Packer Community to rule out server-config issues, I suspect it could be that or even timing issues with running provisioning as soon as WinRM is available (perhaps other sub-systems are not yet?).

@mefellows
Copy link
Owner Author

NOTE: I have created a new Windows 2012r2 standard server Vagrant box and the issue persists.

mefellows added a commit that referenced this issue Jan 12, 2015
…already contains chocolatey and Seek DSC resources (#14)
@mefellows
Copy link
Owner Author

Seems there may be an issue specific to the cWebAdministration module in the SEEK-Jobs/DSC resource. For now, I have temporarily replaced it with the xWebAdministration module and now it works on first boot.
@Jonne Would you like to give this a try?

@mefellows
Copy link
Owner Author

@warnergodfrey - Great news, you've hit the nail on the head - Import-Module WebAdministration was the culprit! Removing this declaration on a 2012r2 box fixes the problem, and also explains why it works on 2008r2.

Now, to find a solution. I'm hoping we can keep it as simple as something like a check for the command (i.e. Get-Command).

@dragon788
Copy link
Contributor

I'm running into this issue as well. I changed the path to simply remove the C:\ and it worked for getting past the mkdir C:\ -force error (which I think is a Vagrant bug as seen in the #7435 above). But now I'm hitting the same can't find module issues.

I noticed that all the SEEK modules were mentioning moving to the Powershell official repos, are there any plans to update this repository in that case, or is there a good document on the migration path to using the official modules instead of the SEEK ones?

@dragon788
Copy link
Contributor

I think I found part of the problem, you replaced the cWebAdministration portion, but when you updated for the new Vagrant version that got pulled back out and replaced with just the SEEK-DSC package again.

@mefellows
Copy link
Owner Author

Hi @dragon788.

I reverted to the SEEK-DSC resources as the fix was applied (https://github.com/SEEK-Jobs/DSC/pull/23).

I'm not aware of any migration documents but yes as I understand those modules have been merged into the official repos (which is awesome!).

That being said, I just attempted a fresh install on Vagrant 1.8.1 and a vagrant-up on the development folder and all was successful.

I'm going to upgrade Vagrant to latest now and try again.

In any case, I wouldn't be too concerned about this - it's just an example repository and is in no indication a problem with the vagrant-dsc plugin. If I have time I'll look to update using the official PoSH modules.

@mefellows
Copy link
Owner Author

Just tried with vagrant version 1.8.4 also, worked a treat.

Are you able to please put together some of the debugging notes from #14 (comment)? That might help get to the bottom of it all.

I note you're running on Windows. I can't test this locally so it's just a guess, but if the files aren't syncing to the remote machine then the DSC will fail with something similar to the above - i.e. the DSC resources aren't on the filesystem so they can't be used.

@dragon788
Copy link
Contributor

I wonder if the first failure may be due to pending Windows Updates causing issues. I just ran into this where I was attempting to run the Vagrantfile against another box and even though I was updating PowerShell and trying to install the latest version of DSC, without a reboot PowerShell wasn't getting updated, but it also wasn't properly installing any modules due to some other pending reboot from Updates which causes a weird exit code from some installers when it detects the pending reboot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants