Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Sep 2020 21:49:44 -0600
From:      Gary Aitken <freebsd@dreamchaser.org>
To:        FreeBSD Mailing List <freebsd-questions@freebsd.org>
Subject:   packer script for ubuntu that works on fbsd virtualbox
Message-ID:  <b8a146b7-3387-d8b0-69df-ba470b2ee86f@dreamchaser.org>

Next in thread | Raw E-Mail | Index | Archive | Help
I'm having trouble getting packer to produce a ubuntu-18.04.5 that actually
works on virtualbox on my 11.3-RELEASE-p6 fbsd system.  I can create one
using vagrant or from virtualbox itself, but not using packer.  I've tried
using the packer installed via pkg install (1.6.0), and I've also using a
1.6.1 from source.  I thought about trying to build a more recent virtualbox
but the patches in the port are tweaking stuff way beyond my abilities.

Can anyone post a packer .json file to create a ubuntu vm that works?

The VM goes through the initial install process ok, then begins installing
updates.  After update #14 or so, it crashes and reboots, starting the
install process all over.  Again and again.

Using the virtualbox-ose from pkg install (5.2.44).

FWIW, here's the .json file that doesn't work, given the command
   "packer build ubuntu-18-04.json"

{
   "builders": [
     {
       "boot_command": [
         "<enter><wait><f6><esc><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
         "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
         "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
         "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
         "/install/vmlinuz<wait>",
         " auto<wait>",
         " console-setup/ask_detect=false<wait>",
         " console-setup/layoutcode=us<wait>",
         " console-setup/modelcode=pc105<wait>",
         " debconf/frontend=noninteractive<wait>",
         " debian-installer=en_US.UTF-8<wait>",
         " fb=false<wait>",
         " initrd=/install/initrd.gz<wait>",
         " kbd-chooser/method=us<wait>",
         " keyboard-configuration/layout=USA<wait>",
         " keyboard-configuration/variant=USA<wait>",
         " locale=en_US.UTF-8<wait>",
         " netcfg/get_domain=vm<wait>",
         " netcfg/get_hostname=vagrant<wait>",
         " grub-installer/bootdev=/dev/sda<wait>",
         " noapic<wait>",
         " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `preseed_path`}}<wait>",
         " -- <wait>",
         "<enter><wait>"
       ],
       "boot_wait": "10s",
       "disk_size": "{{user `disk_size`}}",
       "guest_os_type": "Ubuntu_64",
       "hard_drive_interface": "sata",
       "headless": "{{ user `headless` }}",
       "http_directory": "http",
       "iso_checksum": "{{user `iso_checksum_type`}}:{{user `iso_checksum`}}",
       "iso_urls": [
         "file:///hd2/Downloads/Ubuntu/ubuntu-18.04.5-live-server-amd64.iso",
         "{{user `mirror`}}/{{user `mirror_directory`}}/{{user `iso_name`}}"
       ],
       "output_directory": "../../builds/packer-{{user `template`}}-virtualbox",
       "shutdown_command": "echo 'vagrant' | sudo -S shutdown now",
       "ssh_password": "vagrant",
       "ssh_port": 22,
       "ssh_timeout": "1000s",
       "ssh_username": "vagrant",
       "type": "virtualbox-iso",
       "vboxmanage": [
         [
           "modifyvm",
           "{{.Name}}",
           "--memory",
           "{{ user `memory` }}"
         ],
         [
           "modifyvm",
           "{{.Name}}",
           "--cpus",
           "{{ user `cpus` }}"
         ]
       ]
     }
   ],
   "variables": {
     "cpus": "1",
     "disk_size": "10000",
     "headless": "",
     "iso_checksum": "3756b3201007a88da35ee0957fbe6666c495fb3d8ef2e851ed2bd1115dc36446",
     "iso_checksum_type": "sha256",
     "iso_name": "ubuntu-18.04.5-live-server-amd64.iso",
     "memory": "1536",
     "mirror": "http://releases.ubuntu.com/",
     "mirror_directory": "18.04.5/",
     "preseed_path": "preseed.cfg",
     "template": "ubuntu-18.04.05-live-server-amd64.iso",
     "version": "TIMESTAMP",
     "vm_description": "packer ubuntu-18.04.5",
     "vm_version": "18.04.5"
   }
}


Thanks,

Gary



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?b8a146b7-3387-d8b0-69df-ba470b2ee86f>