0

Can somebody tell me what I am doing wrong here as I am unable to create the image? actually the commands, when I run on my host Centos machine, works fine but when I execute the same commands through packer result into error.

JSON file:

{
  "builders": [{
    "type": "azure-arm",
  
    "client_id": "{{user `azure-client-id`}}",
    "client_secret": "{{user `azure-client-secret`}}",
    "tenant_id": "{{user `azure-tenant-id`}}",
    "subscription_id": "{{user `azure-subscription-id`}}",
    
    "managed_image_resource_group_name": "{{user `azure-resource-group`}}",
    "managed_image_name": "CentOS8-Packer",
  
    "os_type": "Linux",
    "image_publisher": "OpenLogic",
    "image_offer": "CentOS",
    "image_sku": "8_2-gen2",

    "location": "{{user `azure-region`}}",
    "vm_size": "{{user `vm-size`}}"
  }],

  "provisioners": [
    {
      "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'",
      "script":"ami-script.sh"
      "type": "shell"
    }
  ]
}

ami-script.sh content:

#!/bin/bash -e
dnf update -y
dnf install terminator xrdp -y

Error: Updated part:

dnf update -y error:

enter image description here enter image description here dnf install terminator xrdp error (resolved) enter image description here

zuri_nahk
  • 13
  • 1
  • 4
  • Does your build environment have the `epel-release` repository enabled? The `terminator` and `xrdp` packages do not seem to be available in the official release repositories for CentOS 8. Maybe you need to add `dnf install epel-release -y` in `ami-script.sh` before attempting to install your packages? – GracefulRestart Aug 27 '20 at 19:43
  • @GracefulRestart Indeed the failure of terminator and xrdp was due to missing epel-release but the image creation is still failing due to ` dnf update -y ` command errors. How can i resolve this? – zuri_nahk Aug 27 '20 at 19:59
  • What errors do you get with `dnf update -y`? – GracefulRestart Aug 27 '20 at 21:29
  • @GracefulRestart `error: lsetfilecon: (/boot/efi/EFI/BOOT/BOOTX64.EFI;5f48155c, system_u:object_r:boot_t:s0) Operation not supported` Please look at images posted in question, the first and second one is showing `dnf update` error. – zuri_nahk Aug 27 '20 at 21:40
  • The pictures are difficult to read. The error in your last comment would indicate that the process was unable to set the SELinux file context for `/boot/efi/EFI/BOOT/BOOTX64.EFI`. This could be an indication that your `/boot` partition does not support SELinux contexts. According to a comment on this [bug report](https://bugzilla.redhat.com/show_bug.cgi?id=1722766#c46) that may be related, those errors should not cause installation failure. – GracefulRestart Aug 27 '20 at 23:23

0 Answers0