Coder Social home page Coder Social logo

Comments (12)

gusztavvargadr avatar gusztavvargadr commented on September 21, 2024

@SimonKirkhamCL4U sorry to hear you still have no luck with building this, at least the issue is different this time ;)

It seems to be an issue with VirtualBox and / or Packer to me, in my experience unfortunately it's not uncommon to have regressions in one or both of them in even hotfix releases. Could you please let me know the version numbers of your tools? Here's mine for a working setup:

  • Packer 1.1.1
  • VirtualBox 5.1.26
  • Windows 10 1709 (16299.19)

If yours differ, I'd first try with up / downgrading in the above order (starting with Packer).

If still no luck, you can try with a guest additions mode of attach instead of the current disable by updating it in the core template and doing a .\ci.ps1 rebuild ... (it's a pity Packer still tries to upload the version number though that feature is disabled in the configuration).

Btw, you can try debugging by changing the on-error option by modifying the wrapper Cake script here.

Please let me know if any of these help.

from packer.

SimonKirkhamCL4U avatar SimonKirkhamCL4U commented on September 21, 2024

I've switch to packer 1.1.1 and VirtualBox 5.1.2
Now getting a different issue -

Executing task: packer-build
w16s-virtualbox-core: Version
w16s-virtualbox-core: Restore
w16s-virtualbox-core: Build
w16s-virtualbox-core: Packer build template.json
Executing: "packer" build template.json
virtualbox-iso output will be in this color.

==> virtualbox-iso: Downloading or copying ISO
    virtualbox-iso: Downloading or copying: http://care.dlservice.microsoft.com/dl/download/1/4/9/149D5452-9B29-4274-B6B3-5361DBDA30BC/14393.0.161119-1705.RS1_REFRESH_SERVER_EVAL_X64FRE_EN-US.ISO
==> virtualbox-iso: Creating floppy disk...
    virtualbox-iso: Copying files flatly from floppy_files
    virtualbox-iso: Copying directory: builders/virtualbox-iso/floppy
    virtualbox-iso: Adding file: builders\virtualbox-iso\floppy\Autounattend.ps1
    virtualbox-iso: Adding file: builders\virtualbox-iso\floppy\Autounattend.xml
    virtualbox-iso: Adding file: builders\virtualbox-iso\floppy\shutdown.cmd
    virtualbox-iso: Done copying files from floppy_files
    virtualbox-iso: Collecting paths from floppy_dirs
    virtualbox-iso: Resulting paths from floppy_dirs : []
    virtualbox-iso: Done copying paths from floppy_dirs
==> virtualbox-iso: Creating virtual machine...
==> virtualbox-iso: Creating hard drive...
==> virtualbox-iso: Attaching floppy disk...
==> virtualbox-iso: Creating forwarded port mapping for communicator (SSH, WinRM, etc) (host port 2630)
==> virtualbox-iso: Executing custom VBoxManage commands...
    virtualbox-iso: Executing: modifyvm gusztavvargadr-w16s-virtualbox-core-0.7.0-1509010209 --memory 4096
    virtualbox-iso: Executing: modifyvm gusztavvargadr-w16s-virtualbox-core-0.7.0-1509010209 --cpus 2
==> virtualbox-iso: Starting the virtual machine...
    virtualbox-iso: The VM will be run headless, without a GUI. If you want to
    virtualbox-iso: view the screen of the VM, connect via VRDP without a password to
    virtualbox-iso: rdp://127.0.0.1:5978
==> virtualbox-iso: Waiting 1m0s for boot...
==> virtualbox-iso: Typing the boot command...
==> virtualbox-iso: Waiting for WinRM to become available...
    virtualbox-iso: #< CLIXML
    virtualbox-iso: WinRM connected.
    virtualbox-iso: <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><Obj S="progress" RefId="1"><TNRef RefId="0" /><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></Objs>
==> virtualbox-iso: Connected to WinRM!
==> virtualbox-iso: Uploading VirtualBox version info (5.1.26)
==> virtualbox-iso: Executing local command: berks package -b provisioners/chef/Berksfile provisioners/chef/upload/cookbooks.tar.gz
    virtualbox-iso: C:/opscode/chefdk/embedded/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- C:/Code/Devops/packer/lib/gusztavvargadr/infrastructure/src/components/core/chef/Berksfile.core (LoadError)
    virtualbox-iso:     from C:/opscode/chefdk/embedded/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    virtualbox-iso:     from C:/Code/Devops/packer/Berksfile.core.rb:2:in `<top (required)>'
    virtualbox-iso:     from C:/opscode/chefdk/embedded/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    virtualbox-iso:     from C:/opscode/chefdk/embedded/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    virtualbox-iso:     from C:/Code/Devops/packer/build/w16s/virtualbox-core/provisioners/chef/Berksfile:2:in `evaluate'
    virtualbox-iso:     from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/cleanroom-1.0.0/lib/cleanroom.rb:70:in `instance_eval'
    virtualbox-iso:     from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/cleanroom-1.0.0/lib/cleanroom.rb:70:in `evaluate'
    virtualbox-iso:     from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/cleanroom-1.0.0/lib/cleanroom.rb:56:in `evaluate_file'
    virtualbox-iso:     from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/cleanroom-1.0.0/lib/cleanroom.rb:173:in `evaluate_file'
    virtualbox-iso:     from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/berkshelf-6.3.1/lib/berkshelf/berksfile.rb:23:in `from_file'
    virtualbox-iso:     from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/berkshelf-6.3.1/lib/berkshelf/berksfile.rb:12:in `from_options'
    virtualbox-iso:     from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/berkshelf-6.3.1/lib/berkshelf/cli.rb:371:in `package'
    virtualbox-iso:     from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    virtualbox-iso:     from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    virtualbox-iso:     from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    virtualbox-iso:     from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/berkshelf-6.3.1/lib/berkshelf/cli.rb:49:in `dispatch'
    virtualbox-iso:     from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    virtualbox-iso:     from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/berkshelf-6.3.1/lib/berkshelf/cli.rb:25:in `execute!'
    virtualbox-iso:     from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/berkshelf-6.3.1/bin/berks:5:in `<top (required)>'
    virtualbox-iso:     from C:/opscode/chefdk/bin/berks:279:in `load'
    virtualbox-iso:     from C:/opscode/chefdk/bin/berks:279:in `<main>'
==> virtualbox-iso: Unregistering and deleting virtual machine...
==> virtualbox-iso: Deleting output directory...
Build 'virtualbox-iso' errored: Erroneous exit code 1 while executing command: berks package -b provisioners/chef/Berksfile provisioners/chef/upload/cookbooks.tar.gz

Please see output above for more information.

==> Some builds didn't complete successfully and had errors:
--> virtualbox-iso: Erroneous exit code 1 while executing command: berks package -b provisioners/chef/Berksfile provisioners/chef/upload/cookbooks.tar.gz

Please see output above for more information.

==> Builds finished but no artifacts were created.
An error occurred when executing task 'packer-build'.
Error: System.Exception: Process exited with code 1.
   at Submission#0.PackerTemplate_Packer(PackerTemplate template, String arguments)
   at Submission#0.PackerTemplate_Build(PackerTemplate template)
   at Submission#0.PackerTemplates_ForEach(String template, Action`1 action, Boolean recursive)
   at Submission#0.<.ctor>b__35()
   at Cake.Core.ActionTask.Execute(ICakeContext context)
   at Cake.Core.DefaultExecutionStrategy.Execute(CakeTask task, ICakeContext context)
   at Cake.Core.CakeEngine.ExecuteTask(ICakeContext context, IExecutionStrategy strategy, Stopwatch stopWatch, CakeTask task, CakeReport report)
   at Cake.Core.CakeEngine.RunTarget(ICakeContext context, IExecutionStrategy strategy, String target)
   at Cake.Scripting.BuildScriptHost.RunTarget(String target)
   at Submission#0..ctor(Session session, Object& submissionResult)
   at Submission#0.<Factory>(Session session)
   at Roslyn.Scripting.CommonScriptEngine.Execute[T](String code, String path, DiagnosticBag diagnostics, Session session, Boolean isInteractive)
   at Roslyn.Scripting.Session.Execute(String code)
   at Cake.Core.Scripting.ScriptRunner.Run(IScriptHost host, FilePath scriptPath, IDictionary`2 arguments)
   at Cake.Commands.BuildCommand.Execute(CakeOptions options)
   at Cake.CakeApplication.Run(CakeOptions options)
   at Cake.Program.Main()

from packer.

gusztavvargadr avatar gusztavvargadr commented on September 21, 2024

@SimonKirkhamCL4U it seems you don't have the submodule under lib initialized. Did you clone recursively, as mentioned in the documentation? See this answer for the details of initializing for existing clones.

from packer.

gusztavvargadr avatar gusztavvargadr commented on September 21, 2024

@SimonKirkhamCL4U did you manage to run the build?

from packer.

SimonKirkhamCL4U avatar SimonKirkhamCL4U commented on September 21, 2024

Thanks for your help. I have tried it again. I hadn't recursively cloned so that has helped.

It now gets stuck at this point -

virtualbox-iso: 'skipping chmod 0777 /tmp/packer-chef-solo' virtualbox-iso: Creating configuration file 'solo.rb' virtualbox-iso: Creating JSON attribute file virtualbox-iso: Executing Chef: c:/opscode/chef/bin/chef-solo.bat --no-color -c /tmp/packer-chef-solo/solo.rb -j /tmp/packer-chef-solo/node.json virtualbox-iso: [2017-11-01T09:49:54+00:00] INFO: Started chef-zero at chefzero://localhost:8889 with repository at C:/packer-chef virtualbox-iso: One version per cookbook virtualbox-iso: virtualbox-iso: [2017-11-01T09:49:54+00:00] INFO: *** Chef 12.14.77 *** virtualbox-iso: [2017-11-01T09:49:54+00:00] INFO: Platform: x64-mingw32 virtualbox-iso: [2017-11-01T09:49:54+00:00] INFO: Chef-client pid: 2332 virtualbox-iso: [2017-11-01T09:50:42+00:00] INFO: Setting the run_list to ["recipe[gusztavvargadr_packer_w16s::patch]", "recipe[gusztavvargadr_packer_virtualbox_iso::patch]"] from CLI options virtualbox-iso: [2017-11-01T09:50:42+00:00] INFO: Run List is [recipe[gusztavvargadr_packer_w16s::patch], recipe[gusztavvargadr_packer_virtualbox_iso::patch]] virtualbox-iso: [2017-11-01T09:50:42+00:00] INFO: Run List expands to [gusztavvargadr_packer_w16s::patch, gusztavvargadr_packer_virtualbox_iso::patch] virtualbox-iso: [2017-11-01T09:50:42+00:00] INFO: Starting Chef Run for WINVAGR-8US7LE0 virtualbox-iso: [2017-11-01T09:50:42+00:00] INFO: Running start handlers virtualbox-iso: [2017-11-01T09:50:42+00:00] INFO: Start handlers complete. virtualbox-iso: [2017-11-01T09:50:42+00:00] INFO: HTTP Request Returned 404 Not Found: Object not found: virtualbox-iso: [2017-11-01T09:50:43+00:00] INFO: Loading cookbooks [[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]] virtualbox-iso: [2017-11-01T09:50:44+00:00] INFO: Processing gusztavvargadr_windows_updates[] action install (gusztavvargadr_packer_w::patch line 1) virtualbox-iso: [2017-11-01T09:50:44+00:00] INFO: Processing gusztavvargadr_windows_powershell_script_elevated[Install Updates] action run (c:/tmp/packer-chef-solo/local-mode-cache/cache/cookbooks/gusztavvargadr_windows/resources/updates.rb line 38) virtualbox-iso: [2017-11-01T09:50:44+00:00] WARN: Cloning resource attributes for windows_task[powershell-script-elevated-1509529844] from prior resource (CHEF-3694) virtualbox-iso: Previous windows_task[powershell-script-elevated-1509529844]: c:/tmp/packer-chef-solo/local-mode-cache/cache/cookbooks/gusztavvargadr_windows/resources/powershell_script_elevated.rb:36:inblock in class_from_file'
virtualbox-iso: Current windows_task[powershell-script-elevated-1509529844]: c:/tmp/packer-chef-solo/local-mode-cache/cache/cookbooks/gusztavvargadr_windows/resources/powershell_script_elevated.rb:68:in block in class_from_file' at c:/tmp/packer-chef-solo/local-mode-cache/cache/cookbooks/gusztavvargadr_windows/resources/powershell_script_elevated.rb:68:in block in class_from_file' at c:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.14.77-universal-mingw32/lib/chef/event_dispatch/dispatcher.rb:43:in call' virtualbox-iso: [2017-11-01T09:50:44+00:00] INFO: Processing directory[c:\tmp\packer-chef-solo\local-mode-cache\cache\gusztavvargadr_windows] action create (c:/tmp/packer-chef-solo/local-mode-cache/cache/cookbooks/gusztavvargadr_windows/resources/powershell_script_elevated.rb line 15) virtualbox-iso: [2017-11-01T09:50:44+00:00] INFO: directory[c:\tmp\packer-chef-solo\local-mode-cache\cache\gusztavvargadr_windows] created directory c:\tmp\packer-chef-solo\local-mode-cache\cache\gusztavvargadr_windows virtualbox-iso: [2017-11-01T09:50:44+00:00] INFO: Processing file[c:\tmp\packer-chef-solo\local-mode-cache\cache\gusztavvargadr_windows\powershell-script-elevated-1509529844.ps1] action create (c:/tmp/packer-chef-solo/local-mode-cache/cache/cookbooks/gusztavvargadr_windows/resources/powershell_script_elevated.rb line 22) virtualbox-iso: [2017-11-01T09:50:44+00:00] INFO: file[c:\tmp\packer-chef-solo\local-mode-cache\cache\gusztavvargadr_windows\powershell-script-elevated-1509529844.ps1] created file c:\tmp\packer-chef-solo\local-mode-cache\cache\gusztavvargadr_windows\powershell-script-elevated-1509529844.ps1 virtualbox-iso: [2017-11-01T09:50:44+00:00] INFO: file[c:\tmp\packer-chef-solo\local-mode-cache\cache\gusztavvargadr_windows\powershell-script-elevated-1509529844.ps1] updated file contents c:\tmp\packer-chef-solo\local-mode-cache\cache\gusztavvargadr_windows\powershell-script-elevated-1509529844.ps1 virtualbox-iso: [2017-11-01T09:50:44+00:00] INFO: Processing windows_task[powershell-script-elevated-1509529844] action create (c:/tmp/packer-chef-solo/local-mode-cache/cache/cookbooks/gusztavvargadr_windows/resources/powershell_script_elevated.rb line 36) virtualbox-iso: [2017-11-01T09:50:50+00:00] INFO: Processing windows_task[powershell-script-elevated-1509529844] action run (c:/tmp/packer-chef-solo/local-mode-cache/cache/cookbooks/gusztavvargadr_windows/resources/powershell_script_elevated.rb line 36) virtualbox-iso: [2017-11-01T09:50:54+00:00] INFO: Processing powershell_script[Wait for task 'powershell-script-elevated-1509529844'] action run (c:/tmp/packer-chef-solo/local-mode-cache/cache/cookbooks/gusztavvargadr_windows/resources/powershell_script_elevated.rb line 57)

If I open the VM through virtual box nothing is happening.

from packer.

gusztavvargadr avatar gusztavvargadr commented on September 21, 2024

@SimonKirkhamCL4U we're getting there :)

It seems it's "stuck" at the Windows Update installation. I can't recall having issues with this part during my builds, can you please check if the box is actually stuck (e.g. idle) or busy working on anything? Could you check the resource usage (CPU, memory, disk) in the guest while waiting at this stage? FYI, you won't see anything in the UI as most of the tasks during the build are running as (background) scheduled tasks, but task manager could help.

Please note that this stage (and later, the Windows Update cleanup) can take significant time, depending on your host configuration and network speed the core image build can take several hours.

Btw, may I ask about your use case? E.g. what is the final image you are trying to build? If you think, I can help with that as well and publish it as the other images at https://app.vagrantup.com/gusztavvargadr/. Also, for the next version I plan to add support to build from existing Vagrant boxes, so you can save this very time consuming first steps at all by using the images published above.

from packer.

SimonKirkhamCL4U avatar SimonKirkhamCL4U commented on September 21, 2024

Sorry about the slow response. I appreciate you trying to help.
I have the initial w16s-virtualbox-core building now (not done anything different but worked on the 3rd attempt). Perhaps I just needed to leave it long enough.

I am now going to try chaining them together.

My use case was partly to learn more about these tools but also to be able to use vagrant for a virtual dev environment with IIS, SQL and VS as well as being able add other tools/setup to the process to make it specific to our environment.

from packer.

gusztavvargadr avatar gusztavvargadr commented on September 21, 2024

@SimonKirkhamCL4U glad to hear it seems to work now :)

Let me know how it goes or if you need any hints going further. I publish those tools only as individual images, but it's definitely possible to chain them together as you describe out of the box. This is a blind spot in the docs yet, but you can try expanding the config here to have a base image, then you can take a look at https://github.com/gusztavvargadr/workstations for more customizations / provisining on launch. I suggest to include only the tools which rarely change and / or take a long time to install in the Packer-built images.

Good luck with experimenting with the automation in general, some components have a steep learning curve, but it's well worth the effort in the long run :)

from packer.

gusztavvargadr avatar gusztavvargadr commented on September 21, 2024

@SimonKirkhamCL4U I close this now as the original problem seems to be resolved. Please feel free to open a new issue if anything else comes up.

from packer.

daemenseth avatar daemenseth commented on September 21, 2024

@gusztavvargadr removing cache_solved the issue and I have configured symlinks in secpol.msc in windows.

Now I have new issue:

==> virtualbox-iso: Error attaching floppy: VBoxManage error: VBoxManage.exe: error: Could not find file for the medium 'C:\tmp\virtualbox817365593\floppy.vfd' (VERR_PATH_NOT_FOUND)

from packer.

gusztavvargadr avatar gusztavvargadr commented on September 21, 2024

@daemenseth can you please maybe paste a full log and share your environment's details (OS, Packer and VirtualBox version)? If it's another box, feel free to open a new issue.

from packer.

gusztavvargadr avatar gusztavvargadr commented on September 21, 2024

@daemenseth I'm closing this now, please feel free to open a new issue if you still encounter any problems.

from packer.

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.