Packer: lxd Image not found by packer but really exists

Created on 10 Feb 2020  ยท  6Comments  ยท  Source: hashicorp/packer

packer1.5.1
host : ubuntu 19.10
provider: lxd

builder:

  "builders": [
    {
      "type": "lxd",
      "name": "ubuntu-14-04-i386",
      "image": "ubuntu:trusty/i386",
      "output_image": "ubuntu-14-04-i386",
      "publish_properties": {
        "description": "Ubuntu trusty i386 with python 2.7  built with packer "
      },
       "profile": "default",
      "launch_config": {
       "security.privileged": "false"
      }
    }
  ],

results

ubuntu-14-04-i386: output will be in this color.

==> ubuntu-14-04-i386: Creating container...
==> ubuntu-14-04-i386: Error creating container: LXD command error: Error: not found
==> ubuntu-14-04-i386: Error creating container: LXD command error: Error: not found
==> ubuntu-14-04-i386: Step "stepLxdLaunch" failed
==> ubuntu-14-04-i386: [c] Clean up and exit, [a] abort without cleanup, or [r] retry step (build may fail even if retry succeeds)? c
==> ubuntu-14-04-i386: Unregistering and deleting deleting container...
==> ubuntu-14-04-i386: Error deleting container: LXD command error: Error: not found
Build 'ubuntu-14-04-i386' errored: Error creating container: LXD command error: Error: not found

while image really exists:
lxc image list ubuntu:trusty/i386

LOG
2020/02/10 11:37:41 [INFO] Packer version: 1.5.1 [go1.13.5 linux amd64]
2020/02/10 11:37:41 Attempting to open config file: /home/gquentin/.packerconfig
2020/02/10 11:37:41 [WARN] Config file doesn't exist: /home/gquentin/.packerconfig
2020/02/10 11:37:41 Setting cache directory: /home/gquentin/Work/repositories/git/iac-learning/hashicorps/packer_cache
2020/02/10 11:37:41 Plugin could not be found at /opt/hashicorps/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-lxd (exec: "/opt/hashicorps/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-lxd": stat /opt/hashicorps/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-lxd: no such file or directory). Checking same directory as executable.
2020/02/10 11:37:41 Current exe path: /opt/hashicorps/packer
2020/02/10 11:37:41 Creating plugin client for path: /opt/hashicorps/packer
2020/02/10 11:37:41 Starting plugin: /opt/hashicorps/packer []string{"/opt/hashicorps/packer", "plugin", "packer-builder-lxd"}
2020/02/10 11:37:41 Waiting for RPC address for: /opt/hashicorps/packer
2020/02/10 11:37:41 packer-builder-lxd plugin: [INFO] Packer version: 1.5.1 [go1.13.5 linux amd64]
2020/02/10 11:37:41 packer-builder-lxd plugin: Attempting to open config file: /home/gquentin/.packerconfig
2020/02/10 11:37:41 packer-builder-lxd plugin: [WARN] Config file doesn't exist: /home/gquentin/.packerconfig
2020/02/10 11:37:41 packer-builder-lxd plugin: Setting cache directory: /home/gquentin/Work/repositories/git/iac-learning/hashicorps/packer_cache
2020/02/10 11:37:41 packer-builder-lxd plugin: args: []string{"packer-builder-lxd"}
2020/02/10 11:37:41 packer-builder-lxd plugin: Plugin address: unix /tmp/packer-plugin347938417
2020/02/10 11:37:41 packer-builder-lxd plugin: Waiting for connection...
2020/02/10 11:37:41 Received unix RPC address for /opt/hashicorps/packer: addr is /tmp/packer-plugin347938417
2020/02/10 11:37:41 packer-builder-lxd plugin: Serving a plugin connection...
2020/02/10 11:37:41 Plugin could not be found at /opt/hashicorps/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-file (exec: "/opt/hashicorps/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-file": stat /opt/hashicorps/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-file: no such file or directory). Checking same directory as executable.
2020/02/10 11:37:41 Current exe path: /opt/hashicorps/packer
2020/02/10 11:37:41 Creating plugin client for path: /opt/hashicorps/packer
2020/02/10 11:37:41 Starting plugin: /opt/hashicorps/packer []string{"/opt/hashicorps/packer", "plugin", "packer-provisioner-file"}
2020/02/10 11:37:41 Waiting for RPC address for: /opt/hashicorps/packer
2020/02/10 11:37:41 packer-provisioner-file plugin: [INFO] Packer version: 1.5.1 [go1.13.5 linux amd64]
2020/02/10 11:37:41 packer-provisioner-file plugin: Attempting to open config file: /home/gquentin/.packerconfig
2020/02/10 11:37:41 packer-provisioner-file plugin: [WARN] Config file doesn't exist: /home/gquentin/.packerconfig
2020/02/10 11:37:41 packer-provisioner-file plugin: Setting cache directory: /home/gquentin/Work/repositories/git/iac-learning/hashicorps/packer_cache
2020/02/10 11:37:41 packer-provisioner-file plugin: args: []string{"packer-provisioner-file"}
2020/02/10 11:37:41 packer-provisioner-file plugin: Plugin address: unix /tmp/packer-plugin720740408
2020/02/10 11:37:41 packer-provisioner-file plugin: Waiting for connection...
2020/02/10 11:37:41 Received unix RPC address for /opt/hashicorps/packer: addr is /tmp/packer-plugin720740408
2020/02/10 11:37:41 packer-provisioner-file plugin: Serving a plugin connection...
2020/02/10 11:37:41 Plugin could not be found at /opt/hashicorps/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-shell (exec: "/opt/hashicorps/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-shell": stat /opt/hashicorps/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-shell: no such file or directory). Checking same directory as executable.
2020/02/10 11:37:41 Current exe path: /opt/hashicorps/packer
2020/02/10 11:37:41 Creating plugin client for path: /opt/hashicorps/packer
2020/02/10 11:37:41 Starting plugin: /opt/hashicorps/packer []string{"/opt/hashicorps/packer", "plugin", "packer-provisioner-shell"}
2020/02/10 11:37:41 Waiting for RPC address for: /opt/hashicorps/packer
2020/02/10 11:37:41 packer-provisioner-shell plugin: [INFO] Packer version: 1.5.1 [go1.13.5 linux amd64]
2020/02/10 11:37:41 packer-provisioner-shell plugin: Attempting to open config file: /home/gquentin/.packerconfig
2020/02/10 11:37:41 packer-provisioner-shell plugin: [WARN] Config file doesn't exist: /home/gquentin/.packerconfig
2020/02/10 11:37:41 packer-provisioner-shell plugin: Setting cache directory: /home/gquentin/Work/repositories/git/iac-learning/hashicorps/packer_cache
2020/02/10 11:37:41 packer-provisioner-shell plugin: args: []string{"packer-provisioner-shell"}
2020/02/10 11:37:41 packer-provisioner-shell plugin: Plugin address: unix /tmp/packer-plugin998947676
2020/02/10 11:37:41 packer-provisioner-shell plugin: Waiting for connection...
2020/02/10 11:37:41 Received unix RPC address for /opt/hashicorps/packer: addr is /tmp/packer-plugin998947676
2020/02/10 11:37:41 packer-provisioner-shell plugin: Serving a plugin connection...
2020/02/10 11:37:41 Plugin could not be found at /opt/hashicorps/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-shell (exec: "/opt/hashicorps/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-shell": stat /opt/hashicorps/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-shell: no such file or directory). Checking same directory as executable.
2020/02/10 11:37:41 Current exe path: /opt/hashicorps/packer
2020/02/10 11:37:41 Creating plugin client for path: /opt/hashicorps/packer
2020/02/10 11:37:41 Starting plugin: /opt/hashicorps/packer []string{"/opt/hashicorps/packer", "plugin", "packer-provisioner-shell"}
2020/02/10 11:37:41 Waiting for RPC address for: /opt/hashicorps/packer
2020/02/10 11:37:41 packer-provisioner-shell plugin: [INFO] Packer version: 1.5.1 [go1.13.5 linux amd64]
2020/02/10 11:37:41 packer-provisioner-shell plugin: Attempting to open config file: /home/gquentin/.packerconfig
2020/02/10 11:37:41 packer-provisioner-shell plugin: [WARN] Config file doesn't exist: /home/gquentin/.packerconfig
2020/02/10 11:37:41 packer-provisioner-shell plugin: Setting cache directory: /home/gquentin/Work/repositories/git/iac-learning/hashicorps/packer_cache
2020/02/10 11:37:41 packer-provisioner-shell plugin: args: []string{"packer-provisioner-shell"}
2020/02/10 11:37:41 packer-provisioner-shell plugin: Plugin address: unix /tmp/packer-plugin051549302
2020/02/10 11:37:41 packer-provisioner-shell plugin: Waiting for connection...
2020/02/10 11:37:41 Received unix RPC address for /opt/hashicorps/packer: addr is /tmp/packer-plugin051549302
2020/02/10 11:37:41 packer-provisioner-shell plugin: Serving a plugin connection...
2020/02/10 11:37:41 Build debug mode: false
2020/02/10 11:37:41 Force build: false
2020/02/10 11:37:41 On error: ask
2020/02/10 11:37:41 Preparing build: ubuntu-14-04-i386
ubuntu-14-04-i386: output will be in this color.

2020/02/10 11:37:41 Waiting on builds to complete...
2020/02/10 11:37:41 Starting build run: ubuntu-14-04-i386
2020/02/10 11:37:41 Running builder: lxd
2020/02/10 11:37:41 [INFO] (telemetry) Starting builder lxd
2020/02/10 11:37:41 packer-builder-lxd plugin: Executing lxc command: []string{"launch", "--ephemeral=false", "--profile=default", "ubuntu:trusty/i386", "packer-ubuntu-14-04-i386", "--config", "security.privileged=false"}
==> ubuntu-14-04-i386: Creating container...
2020/02/10 11:37:41 packer-builder-lxd plugin: stdout: Creating packer-ubuntu-14-04-i386
2020/02/10 11:37:41 packer-builder-lxd plugin: stderr: Error: Failed instance creation: The requested image couldn't be found
==> ubuntu-14-04-i386: Error creating container: LXD command error: Error: Failed instance creation: The requested image couldn't be found
==> ubuntu-14-04-i386: Error creating container: LXD command error: Error: Failed instance creation: The requested image couldn't be found

Solution: using image fingerprint instead is worjking fine.

bug buildelxd community-supported plugin upstream-bug

All 6 comments

This appears to work on my test box. I see that you're on Ubuntu 19.10, so your LXD version is likely ahead of mine.

The builder essentially preforms the following command:

lxc launch [some flags] ubuntu:trusty/i386 test-x86 [other flags]

From your debug logs:

2020/02/10 11:37:41 packer-builder-lxd plugin: Executing lxc command: []string{"launch", "--ephemeral=false", "--profile=default", "ubuntu:trusty/i386", "packer-ubuntu-14-04-i386", "--config", "security.privileged=false"}
==> ubuntu-14-04-i386: Creating container...
2020/02/10 11:37:41 packer-builder-lxd plugin: stdout: Creating packer-ubuntu-14-04-i386
2020/02/10 11:37:41 packer-builder-lxd plugin: stderr: Error: Failed instance creation: The requested image couldn't be found
==> ubuntu-14-04-i386: Error creating container: LXD command error: Error: Failed instance creation: The requested image couldn't be found

The two scenarios that come to mind are:

  • LXD has made this somehow invalid between 3.0.3 -> yours
  • ~We have a regression in packer between 1.4.3 -> 1.5.1~
# this version also works fine
clundquist@nuc:~/go/src/github.com/hashicorp/packer$ ./bin/packer version
Packer v1.5.2-dev

What does:

lxc launch --ephemeral=false --profile=default ubuntu:trusty/i386 packer-ubuntu-14-04-i386 --config security.privileged=false

return for you from the command line? since that's the failing command.

Debugging version info below.

clundquist@nuc:~/go/src/github.com/hashicorp/packer$ packer version
Packer v1.4.3
$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"
clundquist@nuc:~/go/src/github.com/hashicorp/packer$ lxd --version
3.0.3



md5-25528945b71bf9f09720356aadcde9c4



{
"builders": [
    {
      "type": "lxd",
      "name": "ubuntu-14-04-i386",
      "image": "ubuntu:trusty/i386",
     "output_image": "ubuntu-14-04-i386",
      "publish_properties": {
        "description": "Ubuntu trusty i386 with python 2.7  built with packer "
      },
       "profile": "default",
      "launch_config": {
       "security.privileged": "false"
      }
    }
  ]
}



md5-6d0bcd2715851f9ef4281e1f04048b0d



+-------------------+--------------+--------+--------------------------------------------------------+--------+----------+------------------------------+
|       ALIAS       | FINGERPRINT  | PUBLIC |                      DESCRIPTION                       |  ARCH  |   SIZE   |         UPLOAD DATE          |
+-------------------+--------------+--------+--------------------------------------------------------+--------+----------+------------------------------+
| ubuntu-14-04-i386 | 96d78ed42b9e | no     | Ubuntu trusty i386 with python 2.7  built with packer  | i686   | 179.99MB | Feb 11, 2020 at 7:12am (UTC) |
+-------------------+--------------+--------+--------------------------------------------------------+--------+----------+------------------------------+

it must be a lxd regression:

lxd 3.19 & 3.20 (snap):
lxc launch --ephemeral=false --profile=default ubuntu:trusty/i386 packer-ubuntu-14-04-i386 --config security.privileged=false
Creating packer-ubuntu-14-04-i386
Error: Failed instance creation: The requested image couldn't be found

lxc image list ubuntu:trusty/i386

+-----------------+--------------+--------+--------------------------------------------+--------------+-----------+----------+------------------------------+ | ALIAS | FINGERPRINT | PUBLIC | DESCRIPTION | ARCHITECTURE | TYPE | SIZE | UPLOAD DATE | +-----------------+--------------+--------+--------------------------------------------+--------------+-----------+----------+------------------------------+ | t/i386 (2 more) | 57f0966d5e5d | yes | ubuntu 14.04 LTS i386 (release) (20191107) | i686 | CONTAINER | 120.49MB | Nov 7, 2019 at 12:00am (UTC) | +-----------------+--------------+--------+--------------------------------------------+--------------+-----------+----------+------------------------------+

it was a lxd bug. fixed with lxd 3.20.

Thanks for sharing !

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wduncanfraser picture wduncanfraser  ยท  3Comments

DanielBo picture DanielBo  ยท  3Comments

Tensho picture Tensho  ยท  3Comments

mushon4 picture mushon4  ยท  3Comments

PartyImp picture PartyImp  ยท  3Comments