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

Shutdown command failed: remote command exited without exit status or exit signal #89

Open
va-h opened this issue Aug 10, 2017 · 0 comments

Comments

@va-h
Copy link

va-h commented Aug 10, 2017

Hi,

I tried to create an Debian Stretch Config based upon the provided Centos Example, but no matter what I try packer doesn't seem to recognize the shutdown command.

I tried
/bin/sysctl poweroff
/sbin/shutdown -h now
/sbin/shutdown -P now
/sbin/halt

it doesn't make a difference. Except for /bin/sysctl poweroff which reduces the Log by following error

==> xenserver-iso: Unable to detach VDI 'ae55962b-0e2e-42c2-af3f-7f0cbde8803d': Could not find VBD for VDI 'OpaqueRef:cdb8d3c5-f016-6930-e953-e57eade7dd12'

which I guess is caused by already unmounting the iso when brought down with the other commands.

Log

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://localhost/iso/debian-9.1.0-amd64-netinst.iso
==> xenserver-iso: Starting HTTP server on port 8000
==> xenserver-iso: Step: Upload VDI 'debian-9.1.0-amd64-netinst.iso'
==> xenserver-iso: PUT 'https://xe.local/import_raw_vdi?session_id=OpaqueRef%3Ad977d153-07b5-faee-beb0-235bf2dfe52e&task_id=OpaqueRef%3Abc4666ba-c8dd-41bd-0b3a-0eae3439f8b4&vdi=OpaqueRef%3Acdb8d3c5-f016-6930-e953-e57eade7dd12'
==> xenserver-iso: Step: Create Instance
==> xenserver-iso: Created instance 'e3a41b4d-972a-cd93-090b-6803c23c5dbb'
==> xenserver-iso: Step: Start VM Paused
==> xenserver-iso: Step: Set SSH address to VM host IP
==> xenserver-iso: Set host SSH address to '10.0.0.3'.
==> xenserver-iso: Step: forward the instances VNC port over SSH
==> xenserver-iso: Creating a local port forward over SSH on local port 5900
==> xenserver-iso: Port forward setup. 5900 ---> 127.0.0.1:5908 on 10.0.0.3
==> xenserver-iso: Unpausing VM e3a41b4d-972a-cd93-090b-6803c23c5dbb
==> xenserver-iso: Waiting 10s for boot...
==> xenserver-iso: Connecting to the VM over VNC
    xenserver-iso: Using local port: 5900
    xenserver-iso: Found local IP: 172.16.0.99
==> xenserver-iso: Typing boot commands over VNC...
==> xenserver-iso: Finished typing.
==> xenserver-iso: Step: Wait for VM's IP to become known to us.
    xenserver-iso: Got IP '192.168.88.254' from HTTP request
==> xenserver-iso: Got IP address '192.168.88.254'
==> xenserver-iso: Not using SSH port forwarding
==> xenserver-iso: Waiting for SSH to become available...
==> xenserver-iso: Connected to SSH!
==> xenserver-iso: Step: Shutting down VM
    xenserver-iso: Executing shutdown command...
==> xenserver-iso: Shutdown command failed: wait: remote command exited without exit status or exit signal
==> xenserver-iso: WARNING: Forcing hard shutdown of the VM...
    xenserver-iso: Successfully shut down VM
==> xenserver-iso: Unable to detach VDI 'ae55962b-0e2e-42c2-af3f-7f0cbde8803d': Could not find VBD for VDI 'OpaqueRef:cdb8d3c5-f016-6930-e953-e57eade7dd12'
==> xenserver-iso: Step: export artifact
==> xenserver-iso: Getting XVA https://xe.local/export?uuid=e3a41b4d-972a-cd93-090b-6803c23c5dbb&session_id=OpaqueRef:d977d153-07b5-faee-beb0-235bf2dfe52e
==> xenserver-iso: Download completed: packer-debian-9-x86_64-xenserver
==> xenserver-iso: Destroying VM
==> xenserver-iso: Destroying VDI
==> xenserver-iso: Destroyed VDI 'debian-9.1.0-amd64-netinst.iso'
Build 'xenserver-iso' finished.

==> Builds finished. The artifacts of successful builds are:
--> xenserver-iso: VM files in directory: packer-debian-9-x86_64-xenserver

Config

{
  "builders": [
    {
      "type": "xenserver-iso",
      "remote_host": "xe.local",
      "remote_username": "root",
      "remote_password": "xAjX0MgPi1zWbZyGKtFG",
      "boot_command": [
        "<esc> auto url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/debian9-ks.cfg <enter><wait>"
      ],
      "boot_wait": "10s",
      "disk_size": 10000,
      "http_directory": "http",
      "iso_checksum": "151c200204d2930aa74e92c9884d7b613296e7bf",
      "iso_checksum_type": "sha1",
      "iso_url": "http://localhost/iso/debian-9.1.0-amd64-netinst.iso",
      "vm_other_config": {
          "conversionvm":"true"
      },
      "network_names": [
          "ext_bond"
      ],
      "output_directory": "packer-debian-9-x86_64-xenserver",
      "shutdown_command": "/bin/systemctl poweroff",
      "ssh_username": "root",
      "ssh_password": "vmpassword",
      "ssh_wait_timeout": "10000s",
      "ssh_no_proxy": true,
      "expect_disconnect": true,
      "shutdown_timeout": "3m",
      "install_timeout": "30m",
      "vm_name": "packer-debian-9-x86_64",
      "vm_description": "Build time: {{isotime}}",
      "vm_memory": 512,
      "tools_iso_name": "guest-tools.iso"
    }
  ],
}

Preseed File

d-i debian-installer/locale string de_DE.UTF-8
d-i keyboard-configuration/xkb-keymap select de
d-i keyboard-configuration/toggle select No toggling
d-i netcfg/choose_interface select auto
d-i netcfg/dhcp_timeout string 60
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain
d-i netcfg/wireless_wep string
d-i hw-detect/load_firmware boolean true
d-i mirror/country string manual
d-i mirror/http/hostname string ftp.de.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string
d-i passwd/root-password password vmpassword
d-i passwd/root-password-again password vmpassword
d-i passwd/user-fullname string vh
d-i passwd/username string vh
d-i passwd/user-password password vmpassword
d-i passwd/user-password-again password vmpassword
d-i clock-setup/utc boolean true
d-i time/zone string Europe/Berlin
d-i clock-setup/ntp boolean true
d-i partman-auto/method string lvm
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto/choose_recipe select atomic
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman-md/confirm boolean true
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i apt-setup/non-free boolean true
d-i apt-setup/contrib boolean true
tasksel tasksel/first multiselect standard, ssh-server
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i grub-installer/bootdev  string default
d-i finish-install/reboot_in_progress note
d-i preseed/late_command string \
    sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/g' /target/etc/ssh/sshd_config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant