Giter Club home page Giter Club logo

Comments (12)

sneal avatar sneal commented on July 30, 2024

Sounds familiar hashicorp/packer#700

from packer-windows.

stonith avatar stonith commented on July 30, 2024

@sneal That does look very familiar. How did you end up working around it? I tried adding the SeServiceLogonRight role to the sshd_server user and disabling UsePrivelegeSeperation and it still doesn't work. I'm thinking of trying to move the scheduled task creation to the Autounattend.xml

2014/05/07 05:33:29 ui:     null: C:\Users\vagrant>cmd /c schtasks /create /tn "initial_chef_run" /tr c:\opscode\chef\bin\chef-client.bat /sc once /sd 01/01/3000 /st 00:00 /np /rl highest
    null: C:\Users\vagrant>cmd /c schtasks /create /tn "initial_chef_run" /tr c:\opscode\chef\bin\chef-client.bat /sc once /sd 01/01/3000 /st 00:00 /np /rl highest
2014/05/07 05:33:29 ui:     null: ERROR: Access is denied.
    null: ERROR: Access is denied.

from packer-windows.

stonith avatar stonith commented on July 30, 2024

Adding the scheduled task via Autounattend.xml worked. But running the task via the provisioner fails with "The wait operation timed out".

from packer-windows.

sneal avatar sneal commented on July 30, 2024

I remember seeing the same error creating scheduled tasks via a provisioner. I did get it working and was able to run Chef through several separate provisioner blocks including reboots between. The Chef runs were using a PowerShell script I ripped off from vagrant-windows to run Chef through a scheduled task.

Some things to try:

  1. Is sshd running as the Administrator account?
  2. I think my Packer hack that calls reconnect may be required...

This is the script I used in my Packer runs to install OpenSSH and correctly configure it to work with provisioners. Its possible this differs from what you're doing.

from packer-windows.

stonith avatar stonith commented on July 30, 2024

I ended up getting around this by using the chef-client windows service. All of my recipes completed without issue as the system user except for winrm -quickconfig. To get around that, I added logonasaservice rights to the vagrant user and have the service start as the vagrant user.

cmd /c c:\windows\temp\ntrights -u vagrant +r SeServiceLogonRight
cmd /c sc config chef-client obj= .\vagrant password= vagrant
cmd /c sc start chef-client

from packer-windows.

sneal avatar sneal commented on July 30, 2024

Nice idea. How did Packer know when your Chef run was complete?

from packer-windows.

stonith avatar stonith commented on July 30, 2024

@sneal still working on that :D

from packer-windows.

stonith avatar stonith commented on July 30, 2024

This seems to work but it won't catch errors in chef runs:

do {
    $chef_active = Get-Content C:\chef\cache\chef-client-running.pid
    $pid_running = Get-Process -Id $chef_active
    Start-Sleep 5
}
until ($pid_running -eq $null)

from packer-windows.

stonith avatar stonith commented on July 30, 2024

@sneal Similar to your comment in hashicorp/packer#700 , if I do a whoami as the first block in packer, I get sshd_server. Doing it via logging in with ssh I get vagrant.

from packer-windows.

sneal avatar sneal commented on July 30, 2024

Aw, interesting. I bet the difference is because of the way Go/Packer reuses the TCP connection - rightly or wrongly. I guess the Packer reconnect call is required to make OpenSSH happy. Sounds like a OpenSSH bug.

I'm not going to worry about it though, I've gotten pretty far with a WinRM communicator for Packer.

from packer-windows.

stonith avatar stonith commented on July 30, 2024

Looking forward to it. I'll close this off as openssh will likely be deprecated in the future.

from packer-windows.

stonith avatar stonith commented on July 30, 2024

Another workaround the lower privelege of the packer provisioner seems to be using psexec -u vagrant -p vagrant <cmd|bat>

from packer-windows.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.