[GH-ISSUE #68] Cloud-init Fails #14

Closed
opened 2026-03-03 15:29:30 +03:00 by kerem · 6 comments
Owner

Originally created by @mcbenjemaa on GitHub (Aug 7, 2023).
Original GitHub issue: https://github.com/luthermonson/go-proxmox/issues/68

After adding the iso the first time, the second run fails:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x8 pc=0x104837bb0]

goroutine 1 [running]:
github.com/luthermonson/go-proxmox.(*Task).Ping(0x0)
/Users/mbenjemaa/workspace/go/pkg/mod/github.com/luthermonson/go-proxmox@v0.0.0-alpha3/tasks.go:39 +0x20
github.com/luthermonson/go-proxmox.(*Task).Wait(0x0, 0x3b9aca00, 0x77359400)
/Users/mbenjemaa/workspace/go/pkg/mod/github.com/luthermonson/go-proxmox@v0.0.0-alpha3/tasks.go:145 +0x2c
github.com/luthermonson/go-proxmox.(*Task).WaitFor(...)
/Users/mbenjemaa/workspace/go/pkg/mod/github.com/luthermonson/go-proxmox@v0.0.0-alpha3/tasks.go:140
github.com/luthermonson/go-proxmox.(*VirtualMachine).CloudInit(0x140001980e0, {0x104844d81, 0x4}, {0x10485df67, 0x1ed}, {0x10485df67, 0x1ed})
/Users/mbenjemaa/workspace/go/pkg/mod/github.com/luthermonson/go-proxmox@v0.0.0-alpha3/virtual_machine.go:149 +0x1a8

Originally created by @mcbenjemaa on GitHub (Aug 7, 2023). Original GitHub issue: https://github.com/luthermonson/go-proxmox/issues/68 After adding the iso the first time, the second run fails: panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x2 addr=0x8 pc=0x104837bb0] goroutine 1 [running]: github.com/luthermonson/go-proxmox.(*Task).Ping(0x0) /Users/mbenjemaa/workspace/go/pkg/mod/github.com/luthermonson/go-proxmox@v0.0.0-alpha3/tasks.go:39 +0x20 github.com/luthermonson/go-proxmox.(*Task).Wait(0x0, 0x3b9aca00, 0x77359400) /Users/mbenjemaa/workspace/go/pkg/mod/github.com/luthermonson/go-proxmox@v0.0.0-alpha3/tasks.go:145 +0x2c github.com/luthermonson/go-proxmox.(*Task).WaitFor(...) /Users/mbenjemaa/workspace/go/pkg/mod/github.com/luthermonson/go-proxmox@v0.0.0-alpha3/tasks.go:140 github.com/luthermonson/go-proxmox.(*VirtualMachine).CloudInit(0x140001980e0, {0x104844d81, 0x4}, {0x10485df67, 0x1ed}, {0x10485df67, 0x1ed}) /Users/mbenjemaa/workspace/go/pkg/mod/github.com/luthermonson/go-proxmox@v0.0.0-alpha3/virtual_machine.go:149 +0x1a8
kerem closed this issue 2026-03-03 15:29:36 +03:00
Author
Owner

@luthermonson commented on GitHub (Aug 7, 2023):

the stack trace is saying this is coming from pinging a task and i think it's missing a client when it tries to do that. can you give me some code example on how you are using this?

<!-- gh-comment-id:1668650029 --> @luthermonson commented on GitHub (Aug 7, 2023): the stack trace is saying this is coming from pinging a task and i think it's missing a client when it tries to do that. can you give me some code example on how you are using this?
Author
Owner

@mcbenjemaa commented on GitHub (Aug 7, 2023):

I just have the example for the Cloud init on the second run it fails.

Basically, in the WaitFor

<!-- gh-comment-id:1668653556 --> @mcbenjemaa commented on GitHub (Aug 7, 2023): I just have the example for the Cloud init on the second run it fails. Basically, in the WaitFor
Author
Owner

@mcbenjemaa commented on GitHub (Aug 7, 2023):

I will paste code tomorrow

<!-- gh-comment-id:1668653749 --> @mcbenjemaa commented on GitHub (Aug 7, 2023): I will paste code tomorrow
Author
Owner

@mcbenjemaa commented on GitHub (Aug 8, 2023):

resp, err := proxmoxClient.GetVM("pve", 102)
if err != nil {
panic(err)
}

logger.Info("VM, ", resp.Name)

userData := `hostname: proxmox-control-plane
manage_etc_hosts: true
user: ionos
password: ...
ssh_authorized_keys:
  - >-
    .....
chpasswd:
  expire: false
users:
  - default
package_upgrade: true
network:
  version: 1
  config:
    - type: physical
      name: eth0
      subnets:
        - type: static
          address: 10.10.10.66/32
          gateway: 10.10.10.1`

err = resp.CloudInit("ide0", userData, metadata)
if err != nil {
logger.Error(err, "unable to create iso ")
}

run this twice, and in the second run, you get a runtime panic.

<!-- gh-comment-id:1669303920 --> @mcbenjemaa commented on GitHub (Aug 8, 2023): ``` resp, err := proxmoxClient.GetVM("pve", 102) if err != nil { panic(err) } logger.Info("VM, ", resp.Name) userData := `hostname: proxmox-control-plane manage_etc_hosts: true user: ionos password: ... ssh_authorized_keys: - >- ..... chpasswd: expire: false users: - default package_upgrade: true network: version: 1 config: - type: physical name: eth0 subnets: - type: static address: 10.10.10.66/32 gateway: 10.10.10.1` err = resp.CloudInit("ide0", userData, metadata) if err != nil { logger.Error(err, "unable to create iso ") } ``` run this twice, and in the second run, you get a runtime panic.
Author
Owner

@luthermonson commented on GitHub (Aug 9, 2023):

i will merge and cut a new alpha when we fix the other outstanding issue with the cpu float32... feel free to try my code change and see if it fixes your issue. it stemmed from the second call to add tag being a noop and returning a nil task. good catch!

<!-- gh-comment-id:1670741942 --> @luthermonson commented on GitHub (Aug 9, 2023): i will merge and cut a new alpha when we fix the other outstanding issue with the cpu float32... feel free to try my code change and see if it fixes your issue. it stemmed from the second call to add tag being a noop and returning a nil task. good catch!
Author
Owner

@mcbenjemaa commented on GitHub (Aug 9, 2023):

exactly the task for setting the tag is failing

<!-- gh-comment-id:1670983555 --> @mcbenjemaa commented on GitHub (Aug 9, 2023): exactly the task for setting the tag is failing
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/go-proxmox#14
No description provided.