Re: [packer] Error executing packer build on Ubuntu VM (Xenial)

249 views
Skip to first unread message

Rickard von Essen

unread,
Jan 20, 2018, 3:22:41 AM1/20/18
to packe...@googlegroups.com
Can you share your packer template?

On Jan 20, 2018 06:01, "HSB" <hsbawa.te...@gmail.com> 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 packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/4b63ceae-f93a-4fe8-a3d1-e3869e11f4d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

HSB

unread,
Jan 20, 2018, 2:11:27 PM1/20/18
to Packer
Thanks. After some debugging and playing around, I found that the issue was with Linux Container configuration and packer failed executing commands on Linux Container. 
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.

Peter Goodall

unread,
Mar 8, 2018, 7:21:23 PM3/8/18
to Packer
Hello,

Can you let me know what the problem was please. I am having the same issue.
I am building from 'ubuntu-daily:16.04' as a base, from a ubuntu 16.04  host.

Cheers,
--Peter G


On Sunday, January 21, 2018 at 6:11:27 AM UTC+11, HSB wrote:
Thanks. After some debugging and playing around, I found that the issue was with Linux Container configuration and packer failed executing commands on Linux Container. 

[...]
Message has been deleted

Peter Goodall

unread,
Mar 8, 2018, 7:51:49 PM3/8/18
to Packer

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...
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.

Pipfile
playbook.yml
template.json
.envrc

Peter Goodall

unread,
Mar 8, 2018, 8:04:04 PM3/8/18
to Packer

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]

Rickard von Essen

unread,
Mar 9, 2018, 1:35:36 AM3/9/18
to packe...@googlegroups.com
Great troubleshooting. I don't know LXC/LXD very well but I expect that there is some network script that runs on startup and adjusts the network settings. Looks like it is possible to get in before that has completed. 

To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/a0cad9c4-a70d-44c0-9633-efab07c32710%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages