hashicorp / hashicorp/packer-plugin-oracle

Packer oracle plugin fails with "This command has to run under the root user"

Open
#126 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
14
Forks
16
PR merge metrics
No merged PRs in 30d

Description

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

#### Overview of the Issue

Using default values from the repository to build the oci custom image. Following are steps:

root@mini-pc # git clone git@github.com:kubernetes-sigs/image-builder.git
root@mini-pc # cd image-builder/images/capi
root@mini-pc:~/Downloads/image-builder/images/capi# cat oci.json
{
"compartment_ocid": "...",
"subnet_ocid": "...",
"availability_domain": "...",
...
}
root@mini-pc # PACKER_VAR_FILES=oci.json make build-oci-oracle-linux-9
...
oracle-oci: TASK [Gathering Facts] *********************************************************
oracle-oci: ok: [default]
oracle-oci:
oracle-oci: TASK [ansible.builtin.include_role : node] *************************************
oracle-oci:
oracle-oci: TASK [setup : Perform dnf clean] ***********************************************
oracle-oci: changed: [default]
oracle-oci:
**oracle-oci: TASK [setup : Add epel repo] ***************************************************
oracle-oci: fatal: [default]: FAILED! => {"changed": false, "msg": "This command has to be run under the root user.", "results": []}
oracle-oci:**
oracle-oci: PLAY RECAP *********************************************************************
oracle-oci: default : ok=2 changed=1 unreachable=0 failed=1 skipped=172 rescued=0 ignored=0
oracle-oci:
==> oracle-oci: Provisioning step had errors: Running the cleanup provisioner, if present...
==> oracle-oci: Terminating instance (ocid1.instance.oc1.us-sanjose-1.anzwuljra62b4caczo7qsxenr6rudmdzhrakuk62xkrsgvqdygu6hh6ymctq)...
==> oracle-oci: Terminated instance.
Build 'oracle-oci' errored after 2 minutes 7 seconds: Error executing Ansible: Non-zero exit status: exit status 2

==> Wait completed after 2 minutes 7 seconds

==> Some builds didn't complete successfully and had errors:
--> oracle-oci: Error executing Ansible: Non-zero exit status: exit status 2

==> Builds finished but no artifacts were created.
make: *** [Makefile:568: build-oci-oracle-linux-9] Error 1

#### Reproduction Steps

root@mini-pc # PACKER_VAR_FILES=oci.json make build-oci-oracle-linux-9

### Plugin and Packer version

root@mini-pc # packer version
Packer v1.11.2
root@mini-pc # cat packer/oci/config.pkr.hcl
packer {
required_plugins {
oracle = {
source = "github.com/hashicorp/oracle"
version = "~> 1.1.0"
}
}
}

### Simplified Packer Buildfile
No change.

### Operating system and Environment details

Linux x86_64

### Log Fragments and crash.log files

Set the env var `PACKER_LOG=1` for maximum log detail.

Contributor guide

Open the contributing guide

Research direction

Start with the `build-oci-oracle-linux-9` target in Makefile:568 and the configuration in `packer/oci/config.pkr.hcl`, then reproduce the failing `setup : Add epel repo` task. Trace why that task is not running with the required privileges in the Oracle build. Done means the build completes successfully and creates an OCI artifact.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, linux
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.