hashicorp / packer

Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.
http://www.packer.io
Other
14.99k stars 3.33k forks source link

OSX building Ubuntu 18.04 with QEMU finishes but "no bootable device" #6896

Closed jbsmith86 closed 5 years ago

jbsmith86 commented 5 years ago

Packer version: 1.3.1 Platform: OSX high sierra Template:

{

  "builders":

  [

    {

      "type": "qemu",

      "qemuargs": [[ "-m", "4096M" ]],

      "iso_url": "http://cdimage.ubuntu.com/releases/18.04.1/release/ubuntu-18.04.1-server-amd64.iso",

      "iso_checksum_url": "http://cdimage.ubuntu.com/releases/18.04.1/release/SHA256SUMS",

      "iso_checksum_type": "sha256",

      "output_directory": "output_ubuntu",

      "shutdown_command": "sudo shutdown -P now",

      "disk_size": 6000,

      "format": "qcow2",

      "headless": true,

      "http_directory": "httpdir",

      "http_port_min": 10082,

      "http_port_max": 10089,

      "ssh_host_port_min": 2222,

      "ssh_host_port_max": 2229,

      "ssh_username": "ubuntu",

      "ssh_password": "password",

      "ssh_port": 22,

      "ssh_wait_timeout": "1000000s",

      "vm_name": "ubuntu18.qcow2",

      "net_device": "virtio-net",

      "disk_interface": "virtio",

      "boot_wait": "1800s",

      "boot_command":[]

    }

  ]

}

I can download and build a new ubuntu 18.04 image however once it finishes, qemu cannot boot the output qcow2 image, even if I remove all boot commands. I've tried numerous things, reinstalling grub and making sure the drive has the boot flag and it still doesn't boot. I just get the message "no bootable device" on kvm and also "no bootable device" running the output as a disk image with packer. The device identifier is /dev/vda and I am using an LVM drive on the entire volume with default setup settings. This template and all the boot commands worked perfectly fine in Ubuntu 16.04

rickard-von-essen commented 5 years ago

Please only use GitHub Issues for reporting bugs and feature requests. Do not ask for general help here. Use IRC #packer-tool on Freenode or the mailing list for that.

See https://www.packer.io/community/

If you are describing a bug or a feature request please reopen and try to add some more details to make it clearer.

rickard-von-essen commented 5 years ago

Your template is wrong. Please ask on the mailing list.

jbsmith86 commented 5 years ago

Template works fine with raw, breaks in qcow2 seems to be a bug imo

jbsmith86 commented 5 years ago

This template is essentially what is on the qemu example https://www.packer.io/docs/builders/qemu.html

rickard-von-essen commented 5 years ago

Your template have a empty boot_command. Unfortunately the example in the docs is not functioning, we have already fixed that but the update hasn't been deployed yet.

hbokh commented 5 years ago

@jbsmith86 I have somewhat of an identical issue and found that adding

"skip_compaction": "true",

to the "builders"-section of the JSON-file helped me out. Building a Debian Jessie amd64-box, not Ubuntu.

However the result is a significant bigger image! 1.1G for file debian-8.11.libvirt.box And unpacked, 3.8G: file box.img: QEMU QCOW Image (v3), 68719476736 bytes

Tested with my yet unpublished version of Packer - see #6955. Might be related to the handling of things in QEMU 3.0.0 too.

ghost commented 4 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.