xenserver / packer-plugin-xenserver

A builder plugin for Packer.IO to support building Citrix Hypervisor images.
Mozilla Public License 2.0
101 stars 113 forks source link

Unable to get VNC port #81

Open wkoszek opened 7 years ago

wkoszek commented 7 years ago

I've managed to install packer-builder-xenserver and I'd like to make my first VM on XenServer. However it looks like the packer is failing to setup the VNC connection appropriately. Has any of your encountered this problem before?

Debug mode enabled. Builds will not be parallelized.
xenserver-iso output will be in this color.

==> xenserver-iso: XAPI client session established
==> xenserver-iso: Downloading or copying ISO
    xenserver-iso: Downloading or copying: http://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/ISO-IMAGES/10.1/FreeBSD-10.1-RELEASE-amd64-disc1.iso
==> xenserver-iso: Starting HTTP server on port 8000
==> xenserver-iso: Step: Upload VDI 'FreeBSD-10.1-RELEASE-amd64-disc1.iso'
==> xenserver-iso: PUT 'https://MYHOST/import_raw_vdi?session_id=OpaqueRef%3A82c1fe80-446f-b816-63ba-f4fa70373341&task_id=OpaqueRef%3A16b53b84-fdde-273a-b412-f6d1608bb894&vdi=OpaqueRef%3Aa4ebd59a-9718-6c1b-3de6-d9d12da1faae'
==> xenserver-iso: Step: Create Instance
==> xenserver-iso: Created instance '35efa0ab-964e-f24b-225b-47cc5617aec6'
==> xenserver-iso: Step: Start VM Paused
==> xenserver-iso: Step: Set SSH address to VM host IP
==> xenserver-iso: Set host SSH address to 'MYIPADDRESS'.
==> xenserver-iso: Step: forward the instances VNC port over SSH
==> xenserver-iso: Unable to get VNC port (is the VM running?): ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain
==> xenserver-iso: Destroying VM
==> xenserver-iso: Destroying VDI
==> xenserver-iso: Destroyed VDI 'FreeBSD-10.1-RELEASE-amd64-disc1.iso'
==> xenserver-iso: Deleting output directory...
Build 'xenserver-iso' errored: Build was halted.

==> Some builds didn't complete successfully and had errors:
--> xenserver-iso: Build was halted.

==> Builds finished but no artifacts were created.
wkoszek commented 7 years ago

I'm investigating. I've run the builder with the env HTTP_PORT_MIN=5900 HTTP_PORT_MAX=5999 and there was no difference.

jesseops commented 6 years ago

@wkoszek - any progress on this? I'm seeing the same behavior building an Ubuntu Bionic image on XenServer 7.2.

Edit: In my environment, it was due to using a non-local user for XenServer authentication. Since the builder establishes an SSH connection to the XenServer (in order to forward the VNC connection) you need a user that can login directly to the box running XenServer. I was trying to use a user that was configured in XenServer for LDAP login.

wkoszek commented 6 years ago

@jesseops So it works all right for you?

Personally after trying the ecosystem around xenserver I decided to switch away from it. I tried vagrant-xenserver, and I recall that didn't work. Then I tried fog-xenserver and that didn't work either...

I installed Vagrant on my server. Securing stuff correctly was two days of work, but I haven't had problems ever since.

jesseops commented 6 years ago

It does now, just needed a user that could SSH to the actual host running Xen.

We're pretty heavily invested in Xen (to the tune of 4k VMs) so definitely happy I could get this builder working.

On Mon, Apr 2, 2018, 5:29 PM Wojciech Adam Koszek notifications@github.com wrote:

@jesseops https://github.com/jesseops So it works all right for you?

Personally after trying the ecosystem around xenserver I decided to switch away from it. I tried vagrant-xenserver, and I recall that didn't work. Then I tried fog-xenserver and that didn't work either...

I installed Vagrant on my server. Securing stuff correctly was two days of work, but I haven't had problems ever since.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/xenserver/packer-builder-xenserver/issues/81#issuecomment-378080362, or mute the thread https://github.com/notifications/unsubscribe-auth/AEZlvkeai5Hdf1KdrBTue9qDw4gu_oTjks5tkrRjgaJpZM4M5Tnt .

vithu95 commented 5 years ago

any progress on this? I'm facing the same issue I get this Output

xenserver-xva output will be in this color.

==> xenserver-xva: XAPI client session established
==> xenserver-xva: Starting HTTP server on port 8000
==> xenserver-xva: Step: Import Instance
==> xenserver-xva: PUT 'https://10.10.2.15/import?session_id=OpaqueRef%3Aa0d6b6ed-70a4-4a6a-81ce-e6428a730ba4&sr_id=OpaqueRef%3Aa0704c81-691f-4d94-8675-003b5f97ed15&task_id=OpaqueRef%3A604d9d52-073a-433e-b6e8-fb91df568186'
==> xenserver-xva: Imported instance '8b72660d-b1e7-be2e-0e47-8c6617edb94f'
==> xenserver-xva: Step: Start VM Paused
==> xenserver-xva: Step: Set SSH address to VM host IP
==> xenserver-xva: Set host SSH address to '10.10.3.57'.
==> xenserver-xva: Step: forward the instances VNC port over SSH
==> xenserver-xva: Unable to get VNC port (is the VM running?): Process exited with: 1. Reason was:  ()
==> xenserver-xva: Deleting output directory...
Build 'xenserver-xva' errored: Build was halted.

==> Some builds didn't complete successfully and had errors:
--> xenserver-xva: Build was halted.

==> Builds finished but no artifacts were created.
https://guides.github.com/features/mastering-markdown/
madwizard commented 5 years ago

I have the same issue:

Error log: ` ==> xenserver-iso: Step: Create Instance ==> xenserver-iso: Created instance 'e0bb6434-fd28-841f-85d2-f4fd643a9e4f' 2019/07/04 10:45:05 packer-builder-xenserver-iso: 2019/07/04 10:45:05 Skipping attach of 'floppy_vdi_uuid' 2019/07/04 10:45:05 packer-builder-xenserver-iso: 2019/07/04 10:45:05 Attached VDI 'c7539353-38a0-4325-a416-4ed5acba7b3f' 2019/07/04 10:45:05 packer-builder-xenserver-iso: 2019/07/04 10:45:05 Skipping attach of 'isoname_vdi_uuid' 2019/07/04 10:45:05 packer-builder-xenserver-iso: 2019/07/04 10:45:05 Attached VDI '919b8244-75df-430f-b13f-b45f06012a5b' ==> xenserver-iso: Step: Start VM Paused ==> xenserver-iso: Step: Set SSH address to VM host IP ==> xenserver-iso: Set host SSH address to '10.20.0.36'. ==> xenserver-iso: Step: forward the instances VNC port over SSH 2019/07/04 10:45:07 ui error: ==> xenserver-iso: Unable to get VNC port (is the VM running?): Process exited with: 1. Reason was: () ==> xenserver-iso: Unable to get VNC port (is the VM running?): Process exited with: 1. Reason was: () 2019/07/04 10:45:08 packer-builder-xenserver-iso: time="2019-07-04T10:45:08+02:00" level=error msg="Encountered an API error: Failure [VBD_NOT_UNPLUGGABLE OpaqueRef:1fbe5015-b162-4d19-8e94-c1192d009e55]" 2019/07/04 10:45:08 packer-builder-xenserver-iso: 2019/07/04 10:45:08 Detached VDI '919b8244-75df-430f-b13f-b45f06012a5b' 2019/07/04 10:45:08 packer-builder-xenserver-iso: time="2019-07-04T10:45:08+02:00" level=error msg="Encountered an API error: Failure [VBD_NOT_UNPLUGGABLE OpaqueRef:35d0a789-34d5-4d81-b2ae-0eb0919df8dc]" 2019/07/04 10:45:08 packer-builder-xenserver-iso: 2019/07/04 10:45:08 Detached VDI 'c7539353-38a0-4325-a416-4ed5acba7b3f' ==> xenserver-iso: Destroying VM 2019/07/04 10:45:08 packer-builder-xenserver-iso: time="2019-07-04T10:45:08+02:00" level=error msg="Encountered an API error: Failure [VM_BAD_POWER_STATE OpaqueRef:3e1d981e-a6f6-4c05-bb09-d3cc2b454cd2 paused, suspended, running halted]" ==> xenserver-iso: Destroying VDI 2019/07/04 10:45:09 packer-builder-xenserver-iso: 2019/07/04 10:45:09 Trying to destroy VDI... ==> xenserver-iso: Destroyed VDI 'ubuntu-16.04.6-desktop-amd64.iso' ==> xenserver-iso: Deleting output directory... 2019/07/04 10:45:09 [INFO] (telemetry) ending xenserver-iso 2019/07/04 10:45:09 ui error: Build 'xenserver-iso' errored: Build was halted. 2019/07/04 10:45:09 machine readable: error-count []string{"1"} 2019/07/04 10:45:09 ui error: ==> Some builds didn't complete successfully and had errors: Build 'xenserver-iso' errored: Build was halted.

2019/07/04 10:45:09 machine readable: xenserver-iso,error []string{"Build was halted."} 2019/07/04 10:45:09 ui error: --> xenserver-iso: Build was halted. ==> Builds finished but no artifacts were created. 2019/07/04 10:45:09 [INFO] (telemetry) Finalizing. ==> Some builds didn't complete successfully and had errors: --> xenserver-iso: Build was halted.

==> Builds finished but no artifacts were created. 2019/07/04 10:45:10 waiting for all plugin processes to complete... 2019/07/04 10:45:10 /home/trochej/bin/packer-builder-xenserver-iso: plugin process exited `

build config:

cat ubuntu.json { "builders": [ { "type": "xenserver-iso", "remote_host": "xenbuilder", "remote_username":"root", "remote_password":"password", "iso_url": "./packer_cache/ubuntu-16.04.6-desktop-amd64.iso", "iso_checksum_type": "md5", "iso_checksum": "5416371cc0e990871746ddaac89f1a5e", "headless": true, "boot_wait": "10m", "ssh_username": "root", "ssh_password": "password", "ssh_wait_timeout": "1h", "shutdown_command": "echo 'packer' | sudo -S shutdown -P now", "disk_size": 61440, "tools_iso_name": "guest-tools.iso", "platform_args" : { "cores-per-socket": "1" }, "boot_command": [ "<esc><esc><enter><wait>", "/install/vmlinuz noapic ", "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ", "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ", "hostname={{ .Name }} ", "fb=false debconf/frontend=noninteractive ", "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ", "keyboard-configuration/variant=USA console-setup/ask_detect=false ", "initrd=/install/initrd.gz -- <enter>" ] } ] }

This is in one LAN, no firewalls between, I can ssh as root using password in the build file, Xen Server version: 8.0 packer version: 1.4.2 go version: go1.12.5 linux/amd64 xenserver-iso latest from master

kirannhegde commented 5 years ago

Hello @madwizard I tend to use the repository at : https://github.com/ctlam/packer-builder-xenserver. There is a fix for this issue in this repository. Hopefully that should get you unblocked. You will need to build the plugins yourself from this repository before you can start making use of the fix.

Hope this helps.

Regards, Kiran Hegde

ddelnano commented 3 years ago

I also wanted to mention that I've been developing a fork that fixes this issue as well (https://github.com/ddelnano/packer-builder-xenserver/). My fork also has pre-built binaries and uses the latest packer so it would be easy to get setup with.