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

Getting "fatal error: runtime: out of memory" #181

Open
dglinder opened this issue Mar 30, 2023 · 0 comments
Open

Getting "fatal error: runtime: out of memory" #181

dglinder opened this issue Mar 30, 2023 · 0 comments
Labels

Comments

@dglinder
Copy link
Contributor

Overview of the Issue

I've used Packer to build VMWare VMs, and this is my first attempt using it with ProxMox, so I won't discount user error.

My system (RHEL 8 with 16GB RAM) running Packer (1.8.6 [go1.18.9 linux amd64]), and the ProxMox server is version 7.3-3.

But when I run it with PACKER_LOG=1 and -debug, the ISO upload/download appears to work, but it soon exits with fatal error: runtime: out of memory

Reproduction Steps

Run the PACKER_LOG=1 packer build -on-error=ask -timestamp-ui -debug ./rhel-8.pkr.hcl command with the simple Packer build file (below) against a ProxMox 7.3-3 system and it bails.

I am open to suggestions to simplify this to remove points of errors for further debugging.

Plugin and Packer version

Packer v1.8.6

Simplified Packer Buildfile

This is the main portion of my HCL file (omitting the local variables). The storage_pool, iso_storage_pool, and the hostnames in the URLs below have been redacted, but are correct for my network (using copy-and-paste from the debug output into a browser retrieves expected files).

And yes, for now I'm using my "root" account in ProxMox to login - trying to eliminate permissions errors where possible.

variable "iso_checksum" {
  type    = string
  default = "sha256:8cb0dfacc94b789933253d5583a2fb7afce26d38d75be7c204975fe20b7bdf71"
}

variable "iso_url" {
  type    = string
  default = "http://nas.home.example.com:8080/isos/RedHat/rhel-8.6-x86_64-dvd.iso"
}

variable "pve_password" {
  type    = string
  default = "[redacted]"
}

variable "pve_token_ID" {
  type    = string
  default = "root@pam!anssrv-packer"
}

variable "pve_token_Secret" {
  type    = string
  default = "[redacted]"
}

variable "pve_username" {
  type    = string
  default = "root"
}

variable "rhel_password" {
  type    = string
  default = "packer"
}

variable "rhel_user" {
  type    = string
  default = "root"
}
# The "legacy_isotime" function has been provided for backwards compatability, but we recommend switching to the timestamp and formatdate functions.

source "proxmox-iso" "autogenerated_1" {
  boot_command = ["<up><tab> ip=dhcp inst.cmdline inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/RHEL8-ks.cfg<enter>"]
  boot_wait    = "30m"
  cores        = "2"
  cpu_type     = "kvm64"
  disks {
    cache_mode        = "none"
    disk_size         = "50G"
    format            = "qcow2"
    storage_pool      = "nas-nfs-storage"
    type              = "scsi"
  }
  http_directory           = "http"
  insecure_skip_tls_verify = "true"
  iso_checksum             = "${var.iso_checksum}"
  iso_storage_pool         = "nas-nfs-storage"
  iso_url                  = "${var.iso_url}"
  memory                   = "8192"
  network_adapters {
    bridge = "vmbr0"
    model  = "e1000"
  }
  node                 = "node-rhel-8"
  os                   = "l26"
  pool                 = "packer_pool"
  proxmox_url          = "https://pve2.lab.example.com:8006/api2/json"
  scsi_controller      = "lsi"
  sockets              = "1"
  ssh_password         = "packer"
  ssh_timeout          = "30m"
  ssh_username         = "root"
  template_name        = "template-rhel-8-packer-26a"
  token                = "${var.pve_token_Secret}"
  unmount_iso          = true
  username             = "${var.pve_token_ID}"
  vm_id                = "555"
  vm_name              = "template-rhel-8.lab.example.com"
}

build {
  sources = ["source.proxmox-iso.autogenerated_1"]
}

Operating system and Environment details

Build system is a Red Hat Enterprise Linux 8.7 VM (running on the same ProxMox server), with 16GB RAM, 2 vCPUs, and sufficient disk space in my $HOME/.cache/packer filesystem.

[dan@anssrv packer]$ cat /etc/system-release
Red Hat Enterprise Linux release 8.7 (Ootpa)

[dan@anssrv packer]$ free -h
              total        used        free      shared  buff/cache   available
Mem:           15Gi       188Mi        11Gi       4.0Mi       3.8Gi        14Gi
Swap:         6.4Gi        48Mi       6.4Gi

[dan@anssrv packer]$ df -h ~/.cache/packer/
Filesystem                    Size  Used Avail Use% Mounted on
/dev/mapper/rhel_anssrv-home   45G   34G   12G  74% /home

[dan@anssrv packer]$ uname -a
Linux anssrv.lab.linder.org 4.18.0-425.13.1.el8_7.x86_64 #1 SMP Thu Feb 2 13:01:45 EST 2023 x86_64 x86_64 x86_64 GNU/Linux

Log Fragments and crash.log files

The error output of this command:

PACKER_LOG=1 packer build -on-error=ask -timestamp-ui -debug ./rhel-8.pkr.hcl

... is in this Gist:
https://gist.github.com/dglinder/fdd2034a90239c4e4d4aff0043d1b983

@dglinder dglinder added the bug label Mar 30, 2023
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