Seems to be a timing issue. Runs OK with -debug flag on packer.
sleep 15s makes it suceed too:
"provisioners": [
{
"type": "shell",
"inline": [
"lsb_release -a",
"sleep 15s",
"cat /etc/resolv.conf",
"ping -c 1 archive.ubuntu.com",
"apt-get update && apt-get install -y python-minimal" ]
},
packer build -debug template.json
Debug mode enabled. Builds will not be parallelized.
lxd-xenial output will be in this color.
==> lxd-xenial: Creating container...
==> lxd-xenial: Pausing after run of step 'stepLxdLaunch'. Press enter to
continue.
==> lxd-xenial: Provisioning with shell script: /tmp/packer-shell373068117
lxd-xenial: Distributor ID: Ubuntu
lxd-xenial: No LSB modules are available.
lxd-xenial: Description: Ubuntu 16.04.4 LTS
lxd-xenial: Release: 16.04
lxd-xenial: Codename: xenial
lxd-xenial: # Dynamic resolv.conf(5) file for glibc resolver(3) generated
by resolvconf(8)
lxd-xenial: # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE
OVERWRITTEN
lxd-xenial: nameserver 10.89.242.1
lxd-xenial: search lxd
lxd-xenial: PING archive.ubuntu.com (91.189.88.162) 56(84) bytes of data.
lxd-xenial: 64 bytes from yukinko.canonical.com (91.189.88.162): icmp_seq=1
ttl=48 time=278 ms
lxd-xenial:
lxd-xenial: --- archive.ubuntu.com ping statistics ---
lxd-xenial: 1 packets transmitted, 1 received, 0% packet loss, time 0ms
lxd-xenial: rtt min/avg/max/mdev = 278.910/278.910/278.910/0.000 ms
lxd-xenial: Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease
lxd-xenial: Get:2 http://security.ubuntu.com/ubuntu xenial-security
InRelease [102 kB]
lxd-xenial: Get:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
[102 kB]
lxd-xenial: Get:4 http://security.ubuntu.com/ubuntu xenial-security/main
amd64 Packages [463 kB]
lxd-xenial: Get:5 http://archive.ubuntu.com/ubuntu xenial-backports
InRelease [102 kB]
lxd-xenial: Get:6 http://archive.ubuntu.com/ubuntu xenial/universe amd64
Packages [7532 kB]
On Friday, March 9, 2018 at 11:51:49 AM UTC+11, Peter Goodall wrote:
Hello Rickard,
>
> I am using ‘ubuntu-daily:16.04’ as my base_image.
> have attached relevant files. Project very similar to the example you
> posted for me some time ago.
> Here is the output from running packer:
>
> packer build template.json
> lxd-xenial output will be in this color.
>
> ==> lxd-xenial: Creating container...
> ==> lxd-xenial: Provisioning with shell script: /tmp/packer-shell321894822
> lxd-xenial: Distributor ID: Ubuntu
> lxd-xenial: No LSB modules are available.
> lxd-xenial: Description: Ubuntu 16.04.4 LTS
> lxd-xenial: Release: 16.04
> lxd-xenial: Codename: xenial
> lxd-xenial: # Dynamic resolv.conf(5) file for glibc resolver(3) generated
> by resolvconf(8)
> lxd-xenial: # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE
> OVERWRITTEN
> lxd-xenial: ping: unknown host archive.ubuntu.com
> ==> lxd-xenial: Unregistering and deleting deleting container...
>
> On Saturday, January 20, 2018 at 7:22:41 PM UTC+11, Rickard von Essen
> wrote:
>
> Can you share your packer template?
>>
>> On Jan 20, 2018 06:01, "HSB" <[email protected]> wrote:
>>
>>> Hi, Created new VM Box using Vagrant. I can SSH and also connect to
>>> internet from that host.
>>>
>>> But when I execute packer build (type: lxd) with shell commands for
>>> ubuntu updates, I get following error. I can CURL all of the following urls
>>> from command line successfully. I have name-servers setup properly.
>>>
>>> But, I am not sure why packer is complaining about it? Thoughts?
>>>
>>> xenial-container: Firewall stopped and disabled on system startup
>>> xenial-container: sudo: unable to resolve host
>>> packer-xenial-container: Connection refused
>>> xenial-container: Err:1 http://security.ubuntu.com/ubuntu
>>> xenial-security InRelease
>>> xenial-container: Temporary failure resolving 'security.ubuntu.com
>>> '
>>> xenial-container: Err:2 http://archive.ubuntu.com/ubuntu xenial
>>> InRelease
>>> xenial-container: Temporary failure resolving 'archive.ubuntu.com'
>>> xenial-container: Err:3 http://archive.ubuntu.com/ubuntu
>>> xenial-updates InRelease
>>> xenial-container: Temporary failure resolving 'archive.ubuntu.com'
>>> xenial-container: Err:4 http://archive.ubuntu.com/ubuntu
>>> xenial-backports InRelease
>>> xenial-container: Temporary failure resolving 'archive.ubuntu.com'
>>>
>>> xenial-container: W: Failed to fetch
>>> http://archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease
>>> Temporary failure resolving 'archive.ubuntu.com'
>>> xenial-container: W: Failed to fetch
>>> http://archive.ubuntu.com/ubuntu/dists/xenial-backports/InRelease
>>> Temporary failure resolving 'archive.ubuntu.com'
>>> xenial-container: W: Failed to fetch
>>> http://security.ubuntu.com/ubuntu/dists/xenial-security/InRelease
>>> Temporary failure resolving 'security.ubuntu.
>>>
>>> --
>>> This mailing list is governed under the HashiCorp Community Guidelines -
>>> https://www.hashicorp.com/community-guidelines.html. Behavior in
>>> violation of those guidelines may result in your removal from this mailing
>>> list.
>>>
>>> GitHub Issues: https://github.com/mitchellh/packer/issues
>>> IRC: #packer-tool on Freenode
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Packer" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/packer-tool/4b63ceae-f93a-4fe8-a3d1-e3869e11f4d2%40googlegroups.com
>>>
>>> <https://groups.google.com/d/msgid/packer-tool/4b63ceae-f93a-4fe8-a3d1-e3869e11f4d2%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>
--
This mailing list is governed under the HashiCorp Community Guidelines -
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of
those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/packer-tool/a0cad9c4-a70d-44c0-9633-efab07c32710%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.