Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lxc builder ignoring command wrapper #84

Open
Dialgatrainer02 opened this issue Jan 24, 2025 · 0 comments
Open

lxc builder ignoring command wrapper #84

Dialgatrainer02 opened this issue Jan 24, 2025 · 0 comments
Labels

Comments

@Dialgatrainer02
Copy link

When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.

Overview of the Issue

lxc is ignoring the command wrapper option meaning i cant run the container as a normal user

Reproduction Steps

run packer init and packer build on example packer file

packer {
  required_plugins {
    ansible = {
      source  = "github.com/hashicorp/ansible"
      version = "~> 1"
    }
    lxc = {
      source = "github.com/hashicorp/lxc"
      version = "~> 1"
    }
  }
}

source "lxc" "test" {
  config_file         = "/etc/lxc/default.conf"
  template_name       = "download"
  template_parameters = ["--", "-d", "almalinux", "-a", "amd64", "-r", 9 ]
  command_wrapper = "systemd-run --unit=my-unit --user --scope -p 'Delegate=yes' -- {{.Command}}"
}

Plugin and Packer version

packer plugins installed
/home/olivia/.config/packer/plugins/github.com/hashicorp/ansible/packer-plugin-ansible_v1.1.2_x5.0_linux_amd64
/home/olivia/.config/packer/plugins/github.com/hashicorp/lxc/packer-plugin-lxc_v1.0.2_x5.0_linux_amd64

packer version
Packer v1.11.2

Simplified Packer Buildfile

If the file is longer than a few dozen lines, please include the URL to the
gist of the log or use the Github detailed
format

instead of posting it directly in the issue.

Operating system and Environment details

arch host
lxc ver lxc 1:6.0.3-1

Log Fragments and crash.log files

2025/01/24 18:10:47 [INFO] Packer version: 1.11.2 [go1.23.1 linux amd64]
2025/01/24 18:10:47 Detected xdg config directory from env var: /home/olivia/.config
2025/01/24 18:10:47 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2025/01/24 18:10:47 [INFO] PACKER_CONFIG env var set; attempting to open config file: /home/olivia/.packerconfig
2025/01/24 18:10:47 [WARN] Config file doesn't exist: /home/olivia/.packerconfig
2025/01/24 18:10:47 Detected xdg config directory from env var: /home/olivia/.config
2025/01/24 18:10:47 [INFO] Setting cache directory: /home/olivia/.cache/packer
2025/01/24 18:10:47 Detected xdg config directory from env var: /home/olivia/.config
2025/01/24 18:10:47 [TRACE] listing potential installations for "github.com/hashicorp/lxc" that match "~> 1". plugingetter.ListInstallationsOptions{PluginDirectory:"/home/olivia/.config/packer/plugins", BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"linux", ARCH:"amd64", Ext:"", Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0xc000a0c100)}}, ReleasesOnly:false}}
2025/01/24 18:10:47 [TRACE] Found the following "github.com/hashicorp/lxc" installations: [{/home/olivia/.config/packer/plugins/github.com/hashicorp/lxc/packer-plugin-lxc_v1.0.2_x5.0_linux_amd64 v1.0.2 x5.0}]
2025/01/24 18:10:47 [INFO] found external [-packer-default-plugin-name-] builders from lxc plugin
2025/01/24 18:10:47 [TRACE] listing potential installations for "github.com/hashicorp/ansible" that match "~> 1". plugingetter.ListInstallationsOptions{PluginDirectory:"/home/olivia/.config/packer/plugins", BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"linux", ARCH:"amd64", Ext:"", Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0xc000a0c100)}}, ReleasesOnly:false}}
2025/01/24 18:10:47 [TRACE] Found the following "github.com/hashicorp/ansible" installations: [{/home/olivia/.config/packer/plugins/github.com/hashicorp/ansible/packer-plugin-ansible_v1.1.2_x5.0_linux_amd64 v1.1.2 x5.0}]
2025/01/24 18:10:47 found external [-packer-default-plugin-name- local] provisioner from ansible plugin
2025/01/24 18:10:47 [TRACE] listing potential installations for <nil> that match "". plugingetter.ListInstallationsOptions{PluginDirectory:"/home/olivia/.config/packer/plugins", BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"linux", ARCH:"amd64", Ext:"", Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0xc0009ba080)}}, ReleasesOnly:false}}
2025/01/24 18:10:47 found external [-packer-default-plugin-name- local] provisioner from ansible plugin
2025/01/24 18:10:47 [INFO] found external [-packer-default-plugin-name-] builders from lxc plugin
2025/01/24 18:10:47 [INFO] Starting external plugin /home/olivia/.config/packer/plugins/github.com/hashicorp/lxc/packer-plugin-lxc_v1.0.2_x5.0_linux_amd64 start builder -packer-default-plugin-name-
2025/01/24 18:10:47 Starting plugin: /home/olivia/.config/packer/plugins/github.com/hashicorp/lxc/packer-plugin-lxc_v1.0.2_x5.0_linux_amd64 []string{"/home/olivia/.config/packer/plugins/github.com/hashicorp/lxc/packer-plugin-lxc_v1.0.2_x5.0_linux_amd64", "start", "builder", "-packer-default-plugin-name-"}
2025/01/24 18:10:47 Waiting for RPC address for: /home/olivia/.config/packer/plugins/github.com/hashicorp/lxc/packer-plugin-lxc_v1.0.2_x5.0_linux_amd64
2025/01/24 18:10:47 packer-plugin-lxc_v1.0.2_x5.0_linux_amd64 plugin: 2025/01/24 18:10:47 Plugin address: unix /tmp/packer-plugin1934693479
2025/01/24 18:10:47 packer-plugin-lxc_v1.0.2_x5.0_linux_amd64 plugin: 2025/01/24 18:10:47 Waiting for connection...
2025/01/24 18:10:47 Received unix RPC address for /home/olivia/.config/packer/plugins/github.com/hashicorp/lxc/packer-plugin-lxc_v1.0.2_x5.0_linux_amd64: addr is /tmp/packer-plugin1934693479
2025/01/24 18:10:47 packer-plugin-lxc_v1.0.2_x5.0_linux_amd64 plugin: 2025/01/24 18:10:47 Serving a plugin connection...
2025/01/24 18:10:47 packer-plugin-lxc_v1.0.2_x5.0_linux_amd64 plugin: 2025/01/24 18:10:47 [TRACE] starting builder -packer-default-plugin-name-
2025/01/24 18:10:47 [INFO] Starting external plugin /home/olivia/.config/packer/plugins/github.com/hashicorp/ansible/packer-plugin-ansible_v1.1.2_x5.0_linux_amd64 start provisioner -packer-default-plugin-name-
2025/01/24 18:10:47 Starting plugin: /home/olivia/.config/packer/plugins/github.com/hashicorp/ansible/packer-plugin-ansible_v1.1.2_x5.0_linux_amd64 []string{"/home/olivia/.config/packer/plugins/github.com/hashicorp/ansible/packer-plugin-ansible_v1.1.2_x5.0_linux_amd64", "start", "provisioner", "-packer-default-plugin-name-"}
2025/01/24 18:10:47 Waiting for RPC address for: /home/olivia/.config/packer/plugins/github.com/hashicorp/ansible/packer-plugin-ansible_v1.1.2_x5.0_linux_amd64
2025/01/24 18:10:47 packer-plugin-ansible_v1.1.2_x5.0_linux_amd64 plugin: 2025/01/24 18:10:47 Plugin address: unix /tmp/packer-plugin285342195
2025/01/24 18:10:47 packer-plugin-ansible_v1.1.2_x5.0_linux_amd64 plugin: 2025/01/24 18:10:47 Waiting for connection...
2025/01/24 18:10:47 Received unix RPC address for /home/olivia/.config/packer/plugins/github.com/hashicorp/ansible/packer-plugin-ansible_v1.1.2_x5.0_linux_amd64: addr is /tmp/packer-plugin285342195
2025/01/24 18:10:47 packer-plugin-ansible_v1.1.2_x5.0_linux_amd64 plugin: 2025/01/24 18:10:47 Serving a plugin connection...
2025/01/24 18:10:47 packer-plugin-ansible_v1.1.2_x5.0_linux_amd64 plugin: 2025/01/24 18:10:47 [TRACE] starting provisioner -packer-default-plugin-name-
2025/01/24 18:10:47 packer-plugin-ansible_v1.1.2_x5.0_linux_amd64 plugin: 2025/01/24 18:10:47 ansible-playbook version: 2.18.1
2025/01/24 18:10:47 Build debug mode: false
2025/01/24 18:10:47 Force build: false
2025/01/24 18:10:47 On error: 
2025/01/24 18:10:47 Waiting on builds to complete...
2025/01/24 18:10:47 Starting build run: lxc.test
2025/01/24 18:10:47 Running builder: lxc
2025/01/24 18:10:47 [INFO] (telemetry) Starting builder lxc.test
2025/01/24 18:10:47 packer-plugin-lxc_v1.0.2_x5.0_linux_amd64 plugin: 2025/01/24 **18:10:47 Executing args: []string{"env", "lxc-create", "-n", "packer-test", "-t", "download", "--", "--", "-d", "almalinux", "-a", "amd64", "-r", "9"}**
2025/01/24 18:10:47 packer-plugin-lxc_v1.0.2_x5.0_linux_amd64 plugin: 2025/01/24 18:10:47 stdout:
2025/01/24 18:10:47 packer-plugin-lxc_v1.0.2_x5.0_linux_amd64 plugin: 2025/01/24 18:10:47 stderr: ERROR: In a user namespace without a map
2025/01/24 18:10:47 packer-plugin-lxc_v1.0.2_x5.0_linux_amd64 plugin: lxc-create: packer-test: ../src/lxc/lxccontainer.c: create_run_template: 1601 Failed to create container from template
2025/01/24 18:10:47 packer-plugin-lxc_v1.0.2_x5.0_linux_amd64 plugin: lxc-create: packer-test: ../src/lxc/tools/lxc_create.c: lxc_create_main: 318 Failed to create container packer-test
==> lxc.test: lxc-create: packer-test: ../src/lxc/lxccontainer.c: create_run_template: 1601 Failed to create container from template
==> lxc.test: lxc-create: packer-test: ../src/lxc/tools/lxc_create.c: lxc_create_main: 318 Failed to create container packer-test
2025/01/24 18:10:47 packer-plugin-lxc_v1.0.2_x5.0_linux_amd64 plugin: 2025/01/24 18:10:47 Executing args: []string{"lxc-destroy", "-f", "-n", "packer-test"}
2025/01/24 18:10:47 packer-plugin-lxc_v1.0.2_x5.0_linux_amd64 plugin: 2025/01/24 18:10:47 stdout:
2025/01/24 18:10:47 packer-plugin-lxc_v1.0.2_x5.0_linux_amd64 plugin: 2025/01/24 18:10:47 stderr: lxc-destroy: packer-test: ../src/lxc/tools/lxc_destroy.c: lxc_destroy_main: 241 Container is not defined
2025/01/24 18:10:47 [INFO] (telemetry) ending lxc.test
lxc-create: packer-test: ../src/lxc/lxccontainer.c: create_run_template: 1601 Failed to create container from template
lxc-create: packer-test: ../src/lxc/tools/lxc_create.c: lxc_create_main: 318 Failed to create container packer-test
==> Wait completed after 47 milliseconds 18 microseconds
2025/01/24 18:10:47 machine readable: error-count []string{"1"}
==> Some builds didn't complete successfully and had errors:
2025/01/24 18:10:47 machine readable: lxc.test,error []string{"Error creating container: Command error: ERROR: In a user namespace without a map\nlxc-create: packer-test: ../src/lxc/lxccontainer.c: create_run_template: 1601 Failed to create container from template\nlxc-create: packer-test: ../src/lxc/tools/lxc_create.c: lxc_create_main: 318 Failed to create container packer-test"}
lxc-create: packer-test: ../src/lxc/lxccontainer.c: create_run_template: 1601 Failed to create container from template
lxc-create: packer-test: ../src/lxc/tools/lxc_create.c: lxc_create_main: 318 Failed to create container packer-test
==> Builds finished but no artifacts were created.
2025/01/24 18:10:47 [INFO] (telemetry) Finalizing.
2025/01/24 18:10:47 waiting for all plugin processes to complete...
2025/01/24 18:10:47 /home/olivia/.config/packer/plugins/github.com/hashicorp/ansible/packer-plugin-ansible_v1.1.2_x5.0_linux_amd64: plugin process exited
2025/01/24 18:10:47 /home/olivia/.config/packer/plugins/github.com/hashicorp/lxc/packer-plugin-lxc_v1.0.2_x5.0_linux_amd64: plugin process exited
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant