Skip to content

libvirt: packer won't start qemu with the default json files in Ubuntu 20.04 #746

Open
@MeatBunny

Description

@MeatBunny

This isn't really a trouble ticker per-say, more of a way to document some problems I ran into with the libvirt version of DetectionLab in Ubuntu 20.04 that prevented Packer from building the boxes.

Hopefully some internet stranger won't have to go through all the ass pain that I did to figure it out.

The first is that without setting the display to none, qemu-kvm won't even fork off from packer for some unfathomable reason. Second, there's some problem in packer or qemu-kvm implementation of cURL that it doesn't like underscores in http links. Making the below changes allowed me to build the boxes and only run into the normal weirdness that comes with running libvirt as a hypervisor.

diff --git a/Packer/windows_10.json b/Packer/windows_10.json
index e214577..5073506 100644
--- a/Packer/windows_10.json
+++ b/Packer/windows_10.json
@@ -124,6 +124,10 @@
         [
           "-drive",
           "file={{ user `iso_url` }},media=cdrom,index=2"
+        ],
+        [
+          "-display",
+          "none"
         ]
       ],
       "floppy_files": [
@@ -190,11 +194,11 @@
   ],
   "variables": {
     "iso_checksum": "sha256:9ef81b6a101afd57b2dbfa44d5c8f7bc94ff45b51b82c5a1f9267ce2e63e9f53",
-    "iso_url": "https://software-download.microsoft.com/download/pr/18363.418.191007-0143.19h2_release_svc_refresh_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso",
+    "iso_url": "/path/to/18363.418.191007-0143.19h2_release_svc_refresh_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso",
     "autounattend": "./answer_files/10/Autounattend.xml",
     "disk_size": "61440",
     "virtio_win_iso": "./virtio-win.iso",
     "autounattend_virtio": "./answer_files/10_virtio/Autounattend.xml",
     "packer_build_dir": "./win10"
   }
-}
\ No newline at end of file
+}
diff --git a/Packer/windows_2016.json b/Packer/windows_2016.json
index d9eff1a..30550da 100644
--- a/Packer/windows_2016.json
+++ b/Packer/windows_2016.json
@@ -120,6 +120,10 @@
         [
           "-drive",
           "file={{ user `iso_url` }},media=cdrom,index=2"
+        ],
+        [
+          "-display",
+          "none"
         ]
       ],
       "floppy_files": [
@@ -179,7 +183,7 @@
     }
   ],
   "variables": {
-    "iso_url": "https://software-download.microsoft.com/download/pr/Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO",
+    "iso_url": "/path/to/Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO",
     "iso_checksum": "md5:70721288BBCDFE3239D8F8C0FAE55F1F",
     "disk_size": "61440",
     "autounattend": "./answer_files/2016/Autounattend.xml",
@@ -187,4 +191,4 @@
     "autounattend_virtio": "./answer_files/2016_virtio/Autounattend.xml",
     "packer_build_dir": "./win2016"
   }
-}
\ No newline at end of file
+}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions