Comments (19)
I ran into similar issues, but I was able to add the environment variable without a problem because I was using Git Bash to execute the command. I've tried the example tutorial using Windows CMD and Git Bash with mixed results. For example, running the command packer push template.json
from CMD returns this output:
Push target doesn't exist: example. Either create this online via the website or pass the -create flag.
_BEGIN UPDATE_
I discovered why I was getting the output above, it seems that even after executing
SET ATLAS_TOKEN="J_qMfVVviSy__U1n_2YX7ckV1qM6tquxXi2pk6n69yQqyP...
The environment variable wasn't added (or at least listed), so I did this manually through Windows UI and was able to execute the command successfully (using CMD) immediately after. I think the issue here is that the output doesn't really tell the user that there's a problem. I wasn't informed of a problem until I tried running the command with the -create
flag, which told me there was an authentication issue or the ATLAS_TOKEN
wasn't defined.
_END UPDATE_
If I run the same command from within Git Bash I get this output:
Push successful to 'ontic/example'
Then when I check the build configuration output on https://atlas.hashicorp.com it display this:
---- Started new build at 2015-06-02 14:42:01.031413132 +0000 UTC ----
Packer v0.7.5
virtualbox-iso output will be in this color.
7 error(s) occurred:
* Bad script 'scripts/base.sh': stat scripts/base.sh: no such file or directory
* Bad script 'scripts/virtualbox.sh': stat scripts/virtualbox.sh: no such file or directory
* Bad script 'scripts/vmware.sh': stat scripts/vmware.sh: no such file or directory
* Bad script 'scripts/vagrant.sh': stat scripts/vagrant.sh: no such file or directory
* Bad script 'scripts/dep.sh': stat scripts/dep.sh: no such file or directory
* Bad script 'scripts/cleanup.sh': stat scripts/cleanup.sh: no such file or directory
* Bad script 'scripts/zerodisk.sh': stat scripts/zerodisk.sh: no such file or directory
from atlas-packer-vagrant-tutorial.
@ontic it seems like the files in scripts
aren't being sent with packer push
along with the template. Those files need to be sent to Atlas.
In the push configuration, can you set the field "vcs:false" and let me know if the files get sent up properly?
http://www.packer.io/docs/templates/push.html#vcs
from atlas-packer-vagrant-tutorial.
@KFishner Thanks for your help, adding the vcs
option made no difference. But you lead me to the template documentation where I came across the option base_dir
. Below is part of my template.json
file which did work (sort of).
{
"push": {
"name": "ontic/example",
"vcs": false,
"base_dir": "C:/Users/Adam/Packer/Tutorial/atlas-packer-vagrant-tutorial/scripts/"
},
"variables": {
"atlas_username": "{{env `ATLAS_USERNAME`}}",
"atlas_name": "{{env `ATLAS_NAME`}}"
},
"provisioners": [
{
"type": "shell",
"scripts": [
"base.sh",
"virtualbox.sh",
"vmware.sh",
"vagrant.sh",
"dep.sh",
"cleanup.sh",
"zerodisk.sh"
],
...
I was exited to see the build running after making those changes, however it comes to a halt when waiting for SSH to become available. Below is the output:
---- Started new build at 2015-06-03 00:27:19.046794833 +0000 UTC ----
Packer v0.7.5
virtualbox-iso output will be in this color.
==> virtualbox-iso: Cannot find "Default Guest Additions ISO" in vboxmanage output (or it is empty)
==> virtualbox-iso: Downloading or copying Guest additions checksums
virtualbox-iso: Downloading or copying: http://download.virtualbox.org/virtualbox/4.3.10/SHA256SUMS
==> virtualbox-iso: Downloading or copying Guest additions
virtualbox-iso: Downloading or copying: http://download.virtualbox.org/virtualbox/4.3.10/VBoxGuestAdditions_4.3.10.iso
==> virtualbox-iso: Downloading or copying ISO
virtualbox-iso: Downloading or copying: http://releases.ubuntu.com/precise/ubuntu-12.04.5-server-amd64.iso
virtualbox-iso: Download progress: 15%
virtualbox-iso: Download progress: 44%
virtualbox-iso: Download progress: 100%
==> virtualbox-iso: Starting HTTP server on port 8662
==> virtualbox-iso: Creating virtual machine...
==> virtualbox-iso: Creating hard drive...
==> virtualbox-iso: Creating forwarded port mapping for SSH (host port 3611)
==> virtualbox-iso: Starting the virtual machine...
virtualbox-iso: WARNING: The VM will be started in headless mode, as configured.
virtualbox-iso: In headless mode, errors during the boot sequence or OS setup
virtualbox-iso: won't be easily visible. Use at your own discretion.
==> virtualbox-iso: Waiting 10s for boot...
==> virtualbox-iso: Typing the boot command...
==> virtualbox-iso: Waiting for SSH to become available...
from atlas-packer-vagrant-tutorial.
hmmm @ontic that's odd — I just ran this build and it worked fine. How long did you wait for SSH to become available?
from atlas-packer-vagrant-tutorial.
I have also tried following the tutorial on a Windows machine (Windows 7 x64 Professsional). I made the following changes to the template.json.
diff --git a/template.json b/template.json
index f0e3433..6503a26 100644
--- a/template.json
+++ b/template.json
@@ -1,6 +1,8 @@
{
"push": {
- "name": ""
+ "name": "nigelw/example",
+ "vcs": false,
+ "base_dir": "H:/workspace/atlas-packer-vagrant-tutorial/scripts/"
},
"variables": {
"atlas_username": "{{env `ATLAS_USERNAME`}}",
@@ -10,13 +12,13 @@
{
"type": "shell",
"scripts": [
- "scripts/base.sh",
- "scripts/virtualbox.sh",
- "scripts/vmware.sh",
- "scripts/vagrant.sh",
- "scripts/dep.sh",
- "scripts/cleanup.sh",
- "scripts/zerodisk.sh"
+ "base.sh",
+ "virtualbox.sh",
+ "vmware.sh",
+ "vagrant.sh",
+ "dep.sh",
+ "cleanup.sh",
+ "zerodisk.sh"
],
"override": {
"virtualbox-iso": {
Both the virtualbox and vmware builds have stopped at the same place.
---- Started new build at 2015-06-20 20:27:33.426618441 +0000 UTC ----
Packer v0.7.5
virtualbox-iso output will be in this color.
==> virtualbox-iso: Downloading or copying Guest additions
virtualbox-iso: Downloading or copying: file:///usr/share/virtualbox/VBoxGuestAdditions.iso
==> virtualbox-iso: Downloading or copying ISO
virtualbox-iso: Downloading or copying: http://releases.ubuntu.com/precise/ubuntu-12.04.5-server-amd64.iso
virtualbox-iso: Download progress: 18%
virtualbox-iso: Download progress: 51%
virtualbox-iso: Download progress: 100%
==> virtualbox-iso: Starting HTTP server on port 8900
==> virtualbox-iso: Creating virtual machine...
==> virtualbox-iso: Creating hard drive...
==> virtualbox-iso: Creating forwarded port mapping for SSH (host port 3440)
==> virtualbox-iso: Starting the virtual machine...
virtualbox-iso: WARNING: The VM will be started in headless mode, as configured.
virtualbox-iso: In headless mode, errors during the boot sequence or OS setup
virtualbox-iso: won't be easily visible. Use at your own discretion.
==> virtualbox-iso: Waiting 10s for boot...
==> virtualbox-iso: Typing the boot command...
==> virtualbox-iso: Waiting for SSH to become available...
This is after 2 hours.
from atlas-packer-vagrant-tutorial.
It seems to have failed after 3 hours with the below text.
==> virtualbox-iso: Timeout waiting for SSH.
==> virtualbox-iso: Unregistering and deleting virtual machine...
==> virtualbox-iso: Deleting output directory...
Build 'virtualbox-iso' errored: Timeout waiting for SSH.
==> Some builds didn't complete successfully and had errors:
--> virtualbox-iso: Timeout waiting for SSH.
==> Builds finished but no artifacts were created.
from atlas-packer-vagrant-tutorial.
@nwns @ontic thanks for sending this over. I think the issue is that the reference to the preseed.cfg is broken with your current base_dir setup:
https://github.com/hashicorp/atlas-packer-vagrant-tutorial/blob/master/template.json#L36
This file is necessary to setup the VM for SSH. As you can see, it uses a reference to the http dir, which is missed if you set the base_dir to H:/workspace/atlas-packer-vagrant-tutorial/scripts/
. My recommendation is to set the base_dir to H:/workspace/atlas-packer-vagrant-tutorial/
and update the provisioning block back to scripts/base.sh
, scripts/virtualbox.sh
, etc.
That way when you packer push
, it will send up the http
directory as well, which can then be referenced in the boot_command.
Let me know if this works!
from atlas-packer-vagrant-tutorial.
@KFishner Doing that results in the issue mentioned originally.
7 error(s) occurred:
* Bad script 'scripts/base.sh': stat scripts/base.sh: no such file or directory
* Bad script 'scripts/virtualbox.sh': stat scripts/virtualbox.sh: no such file or directory
* Bad script 'scripts/vmware.sh': stat scripts/vmware.sh: no such file or directory
* Bad script 'scripts/vagrant.sh': stat scripts/vagrant.sh: no such file or directory
* Bad script 'scripts/dep.sh': stat scripts/dep.sh: no such file or directory
* Bad script 'scripts/cleanup.sh': stat scripts/cleanup.sh: no such file or directory
* Bad script 'scripts/zerodisk.sh': stat scripts/zerodisk.sh: no such file or directory
If I change the direction of the slashes it then works and I can push, but it still seems to hang (it has been running for 30 minutes waiting for SSH).
diff --git a/template.json b/template.json
index f0e3433..5fd2f39 100644
--- a/template.json
+++ b/template.json
@@ -1,6 +1,8 @@
{
"push": {
- "name": ""
+ "name": "nigelw/example",
+ "vcs": false,
+ "base_dir": "H:/workspace/atlas-packer-vagrant-tutorial/"
},
"variables": {
"atlas_username": "{{env `ATLAS_USERNAME`}}",
@@ -10,13 +12,13 @@
{
"type": "shell",
"scripts": [
- "scripts/base.sh",
- "scripts/virtualbox.sh",
- "scripts/vmware.sh",
- "scripts/vagrant.sh",
- "scripts/dep.sh",
- "scripts/cleanup.sh",
- "scripts/zerodisk.sh"
+ "scripts\\base.sh",
+ "scripts\\virtualbox.sh",
+ "scripts\\vmware.sh",
+ "scripts\\vagrant.sh",
+ "scripts\\dep.sh",
+ "scripts\\cleanup.sh",
+ "scripts\\zerodisk.sh"
],
"override": {
"virtualbox-iso": {
Interestingly, if I packer build -only virtualbox-iso template.json
the build completes and fails at the push to atlas step (because the ENV variables are missing). I am using Virtualbox 4.3.20.
from atlas-packer-vagrant-tutorial.
cool thanks for the update @nwns. Did you try changing the reference to the http dir?
from atlas-packer-vagrant-tutorial.
Yes, I pushed what changes I had to make to a5360a1.
It seems to work now for Virtual Box on Atlas, but the VMWare build is hanging with the same waiting for SSH to become available
.
As an aside, I am had a similar problem with the new base that I created yesterday for SmartOS (found: https://github.com/nwns/vagrant-smartos-host). I just skipped using a VMWare builder for my SmartOS one because I have no way to troubleshoot it.
from atlas-packer-vagrant-tutorial.
Hmm apologies if this is an obvious question, but it looks like you changed the http
dir reference in the virtualbox-iso
builder, but not the vmware-iso
builder. That could be the issue if you didn't test that out
from atlas-packer-vagrant-tutorial.
Yep, you are correct. I missed that.
Changing it fixed the vmware build, thanks
from atlas-packer-vagrant-tutorial.
Wish I'd looked in here first, could of saved myself a couple of days :)
Can confirm those fixes as required to run it under a Windows development environment. jedineeper@89b290b
from atlas-packer-vagrant-tutorial.
I went through the atlas tutorial on Windows and eventually got through but I had to change a few things.
When I performed the instructions for exporting the atlas token I changed export to "set" but I also had to remove the quotes from around the value. If the quotes are in there the packer push doesn't work. I eventually figured out they were causing a problem when I did "vagrant login" (which worked) and then did "vagrant login --check" which got a bad uri error due to the quotes from the %ATLAS_TOKEN% environment variable. When I removed the quotes I was able to run vagrant login --check and then the packer push worked.
I also had to change the curl url to use %ATLAS_TOKEN% instead of $ATLAS_TOKEN.
I think with a couple minor changes the tutorial could be made to work fairly smoothly on windows, assuming people have curl installed.
- Provide set ATLAS_TOKEN=asdf (no quotes, set vs. export)
- Provide curl command with variable as %ATLAS_TOKEN% instead of $ATLAS_TOKEN
from atlas-packer-vagrant-tutorial.
@hdeadman Thanks a lot for this. We can check OS with JavaScript and conditionally fix some of these issues. Appreciate you and others in the thread for bringing it to our attention!
from atlas-packer-vagrant-tutorial.
+1 👯
from atlas-packer-vagrant-tutorial.
+1
from atlas-packer-vagrant-tutorial.
Another note, using packer 0.9.0 on Windows in PowerShell, I was able to get the tutuorial example to work without modifying template.json, like so:
$env:ATLAS_TOKEN="abcdef"
packer push -name accountname/example ./template.json
The key for me was in the template documentation, where it says that the base_dir
is relative to the template. If you don't include the ./
in the path to the template, then the relative path fails and the build fails with the errors in original post.
from atlas-packer-vagrant-tutorial.
@lorengordon Thanks! This worked for me in PowerShell on Windows 10, Packer v0.10.1
from atlas-packer-vagrant-tutorial.
Related Issues (9)
- Problem adapting the tutorial to use ubuntu 15.10 HOT 3
- What is the best approach to deal with VERSION in atlas post-processor? HOT 1
- Finding for option to build ami from running ec2
- aws creds HOT 1
- which post-processors? HOT 1
- Vagrant init error HOT 1
- Javascript error in step 4 HOT 2
- Simpler license? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from atlas-packer-vagrant-tutorial.