{"id":13582595,"url":"https://github.com/tylert/packer-build","last_synced_at":"2025-04-05T21:11:11.585Z","repository":{"id":29905066,"uuid":"33450785","full_name":"tylert/packer-build","owner":"tylert","description":"Packer Automated VM Image and Vagrant Box Builds","archived":false,"fork":false,"pushed_at":"2024-03-07T23:20:23.000Z","size":3059,"stargazers_count":301,"open_issues_count":1,"forks_count":73,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-03-29T20:07:50.415Z","etag":null,"topics":["ami","aws","debian","kvm","packer","qemu","ubuntu","vagrant","virtualbox"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"javaee/cu-ri","license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tylert.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-04-05T18:35:23.000Z","updated_at":"2025-01-26T05:20:14.000Z","dependencies_parsed_at":"2024-09-25T00:31:06.777Z","dependency_job_id":null,"html_url":"https://github.com/tylert/packer-build","commit_stats":{"total_commits":917,"total_committers":7,"mean_commits":131.0,"dds":0.009814612868047967,"last_synced_commit":"b4a08102d1e39db5f97dc02525c7c805592f5804"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tylert%2Fpacker-build","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tylert%2Fpacker-build/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tylert%2Fpacker-build/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tylert%2Fpacker-build/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tylert","download_url":"https://codeload.github.com/tylert/packer-build/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247399885,"owners_count":20932880,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ami","aws","debian","kvm","packer","qemu","ubuntu","vagrant","virtualbox"],"created_at":"2024-08-01T15:02:52.140Z","updated_at":"2025-04-05T21:11:11.564Z","avatar_url":"https://github.com/tylert.png","language":"HCL","readme":"packer-build\n============\n\n\nWhat does this do?\n~~~~~~~~~~~~~~~~~~\n\nThese Packer templates and associated files may be used to build fresh Debian\nand Ubuntu virtual machine images for Vagrant, VirtualBox and QEMU.\n\nThe resulting image files may be used as bootable systems on real machines and\nthe provided preseed files may also be used to install identical systems on\nbare metal as well.\n\n\nWhat dependencies does this have?\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThese templates are tested semi-regularly on recent Linux (Debian and/or\nUbuntu) hosts using recent versions of Packer and Vagrant.  All testing is\ncurrently done on systems that have amd64/x86_64-family processors.\n\nThe VirtualBox and QEMU versions used for Linux testing are normally the\n\"stock\" ones provided by the official distribution repositories.\n\n* REQUIRED:  Packer_ (Packer_download_) 1.8.3 or newer\n* REQUIRED (if not using VirtualBox):  QEMU_ (KVM_) 3.1.0 (Debian 1:3.1+dfsg-8+deb10u4) or newer\n* REQUIRED (if not using QEMU):  VirtualBox_ (VirtualBox_download_) 6.1.6 r137129 (Qt5.11.3) or newer\n* OPTIONAL:  Vagrant_ (Vagrant_download_) 2.3.0 or newer\n\n.. _Packer:  https://www.packer.io/\n.. _Packer_download:  https://releases.hashicorp.com/packer/\n.. _QEMU:  https://www.qemu.org/\n.. _KVM:  https://www.linux-kvm.org/page/Main_Page\n.. _VirtualBox:  https://www.virtualbox.org/\n.. _VirtualBox_download:  http://download.virtualbox.org/virtualbox\n.. _Vagrant:  https://www.vagrantup.com/\n.. _Vagrant_download:  https://releases.hashicorp.com/vagrant/\n.. _vagrant-libvirt:  https://github.com/vagrant-libvirt/vagrant-libvirt\n\nEven though Packer supports QEMU as an officially-supported provider, Vagrant,\nfor some reason, does not.  The 3rd-party plugin named \"vagrant-libvirt_\"\nprovides the missing QEMU support for Vagrant.  We are unable at this time to\nverify this fact due to the following errors encountered while trying to run\n\"vagrant up\"::\n\n    Error while connecting to libvirt: Error making a connection to libvirt URI qemu:///system?no_verify=1\u0026keyfile=/home/whoa/.ssh/id_rsa:\n    Call to virConnectOpen failed: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory\n\nIt may be possible to correct this error by installing the\n`libvirt-daemon-system` package on Debian.\n\n\nTODO Items\n~~~~~~~~~~\n\n* Fix the boot commands in the Ubuntu cloud-init UEFI templates (non-UEFI ones work fine)\n* Find out if partman-crypto will allow passphrase-crypted\n* Continue investigating best way to handle non-interactive encrypted images (dropbear, likely)\n\n\nUsing Packer Templates\n----------------------\n\nXXX FIXME TODO THIS SECTION NEEDS TO BE REWRITTEN ONCE THE HCL TEMPLATES ARE WORKING!!!\n\n* https://www.hashicorp.com/blog/using-template-files-with-hashicorp-packer\n\n\nUsing Vagrant Box Files\n-----------------------\n\nA Vagrant box file is actually a regular gzipped tar archive containing...\n\n* box.ovf - Open Virtualization Format XML descriptor file\n* nameofmachine-disk1.vmdk - a virtual hard drive image file\n* Vagrantfile - derived from 'Vagrantfile.template'\n* metadata.json - containing just '{ \"provider\": \"virtualbox\" }'\n\nAn OVA file is actually a regular tar archive containing identical copies of\nthe first 2 files that you would normally see in a Vagrant box file (but the\nOVF file may be named nameofmachine.ovf and it *must* be the first file or\nVirtualBox will get confused).\n\nTo use a locally-built Vagrant box file without a dedicated Vagrantfile::\n\n    vagrant box add myname/bullseye \\\n        build/2038-01-19-03-14/base-bullseye-1.0.0.virtualbox.box\n    vagrant init myname/bullseye\n    vagrant up\n    vagrant ssh\n    ...\n    vagrant destroy\n\nIn order to version things and self-host the box files, you will need to create\na JSON file containing the following::\n\n    {\n      \"name\": \"base-bullseye\",\n      \"description\": \"Base box for x86_64 Debian Bullseye 11.x\",\n      \"versions\": [\n        {\n          \"version\": \"1.0.0\",\n          \"providers\": [\n            {\n              \"name\": \"virtualbox\",\n              \"url\": \"http://myserver/vm/base-bullseye/base-bullseye-1.0.0-virtualbox.box\",\n              \"checksum_type\": \"sha256\",\n              \"checksum\": \"deadbeef\"\n            }\n          ]\n        }\n      ]\n    }\n\nSHA256 hashes are the largest ones that Vagrant supports, currently.\n\nThen, simply make sure you point your Vagrantfile at this version payload::\n\n    Vagrant.configure('2') do |config|\n      config.vm.box = 'base-bullseye'\n      config.vm.box_url = 'http://myserver/vm/base-bullseye/base-bullseye.json'\n\n      config.vm.synced_folder '.', '/vagrant', disabled: true\n    end\n\nNOTE:  You must ensure you disable the synched folder stuff above or you will\nencounter the following error::\n\n    Vagrant was unable to mount VirtualBox shared folders. This is usually\n    because the filesystem \"vboxsf\" is not available. This filesystem is\n    made available via the VirtualBox Guest Additions and kernel module.\n    Please verify that these guest additions are properly installed in the\n    guest. This is not a bug in Vagrant and is usually caused by a faulty\n    Vagrant box. For context, the command attempted was:\n\n    mount -t vboxsf -o uid=1000,gid=1000 vagrant /vagrant\n\n    The error output from the command was:\n\n    mount: unknown filesystem type 'vboxsf'\n\n* https://github.com/hollodotme/Helpers/blob/master/Tutorials/vagrant/self-hosted-vagrant-boxes-with-versioning.md\n* http://blog.el-chavez.me/2015/01/31/custom-vagrant-cloud-host/\n* https://www.nopsec.com/news-and-resources/blog/2015/3/27/private-vagrant-box-hosting-easy-versioning/\n\n\nMaking Bootable Drives\n----------------------\n\nFor best results, you should use the Packer QEMU builder \"kvm\" accelerator when\ntrying to create bootable images to be used on real hardware.  This allows the\nuse of the \"raw\" block device format which is ideal for writing directly\ndirectly to USB and SATA drives.  Alternately, you may use \"qemu-img convert\"\nor \"vbox-img convert\" to convert an exiting image in another format to raw\nmode::\n\n    zcat build/2038-01-19-03-14/base-bullseye.raw.gz | dd of=/dev/sdz bs=4M\n\n... Or, if you just want to \"boot\" it::\n\n    qemu-system-x86_64 -m 768M -machine type=pc,accel=kvm \\\n        build/2038-01-19-03-14/base-bullseye.raw\n\n\nOverriding Local VM Cache Location\n----------------------------------\n\n::\n\n    vboxmanage setproperty machinefolder ${HOME}/vm\n\n\nDisabling Hashicorp Checkpoint Version Checks\n---------------------------------------------\n\nBoth Packer and Vagrant will contact Hashicorp with some anonymous information\neach time it is being run for the purposes of announcing new versions and other\nalerts.  If you would prefer to disable this feature, simply add the following\nenvironment variables::\n\n    CHECKPOINT_DISABLE=1\n    VAGRANT_CHECKPOINT_DISABLE=1\n\n* https://checkpoint.hashicorp.com/\n* https://github.com/hashicorp/go-checkpoint\n* https://docs.vagrantup.com/v2/other/environmental-variables.html\n\n\nUEFI Booting on VirtualBox\n--------------------------\n\nIt isn't necessary to perform this step when running on real hardware, however,\nVirtualBox (4.3.28) seems to have a problem if you don't perform this step.\n\n* http://ubuntuforums.org/showthread.php?t=2172199\u0026p=13104689#post13104689\n\nTo examine the actual contents of the file after editing it::\n\n    hexdump /boot/efi/startup.nsh\n\n\nUsing the EFI Shell Editor\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nTo enter the UEFI shell text editor from the UEFI prompt::\n\n    edit startup.nsh\n\nType in the stuff to add to the file (the path to the UEFI blob)::\n\n    FS0:\\EFI\\debian\\grubx64.efi\n\nTo exit the UEFI shell text editor::\n\n    ^S\n    ^Q\n\nHex Result::\n\n    0000000 feff 0046 0053 0030 003a 005c 0045 0046\n    0000010 0049 005c 0064 0065 0062 0069 0061 006e\n    0000020 005c 0067 0072 0075 0062 0078 0036 0034\n    0000030 002e 0065 0066 0069\n    0000038\n\n\nUsing Any Old 'nix' Text Editor\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nTo populate the file in a similar manner to the UEFI Shell method above::\n\n    echo 'FS0:\\EFI\\debian\\grubx64.efi' \u003e /boot/efi/startup.nsh\n\nHex Result::\n\n    0000000 5346 3a30 455c 4946 645c 6265 6169 5c6e\n    0000010 7267 6275 3678 2e34 6665 0a69\n    000001c\n\n\nCaching Debian/Ubuntu Packages\n------------------------------\n\nIf you wish to speed up fetching lots of Debian and/or Ubuntu packages, you\nshould probably install \"apt-cacher-ng\" on a machine and then add the following\nto each machine that should use the new cache::\n\n    echo \"Acquire::http::Proxy 'http://localhost:3142';\" \u003e\u003e\\\n        /etc/apt/apt.conf.d/99apt-cacher-ng\n\nYou must re-run \"apt-cache update\" each time you add or remove a proxy.  If you\npopulate the \"d-i http/proxy string\" value in your preseed file, all this stuff\nwill have been done for you already.\n\n\nInstaller Documentation\n-----------------------\n\n* https://www.debian.org/releases/stable/amd64/\n* https://ubuntu.com/server/docs\n\n\nOther\n-----\n\n* https://github.com/elasticdog/packer-arch/blob/master/arch-template.json\n* http://www.preining.info/blog/2014/05/usb-stick-tails-systemrescuecd/\n* https://5pi.de/2015/03/13/building-aws-amis-from-scratch/\n* http://www.scalehorizontally.com/2013/02/24/introduction-to-cloud-init/\n* https://julien.danjou.info/blog/2013/cloud-init-utils-debian\n* http://thornelabs.net/2014/04/07/create-a-kvm-based-debian-7-openstack-cloud-image.html\n* http://ariya.ofilabs.com/2013/11/using-packer-to-create-vagrant-boxes.html\n* http://blog.codeship.io/2013/11/07/building-vagrant-machines-with-packer.html\n* https://groups.google.com/forum/#!msg/packer-tool/4lB4OqhILF8/NPoMYeew0sEJ\n* http://pretengineer.com/post/packer-vagrant-infra/\n* http://stackoverflow.com/questions/13065576/override-vagrant-configuration-settings-locally-per-dev\n* http://jackstromberg.com/2012/12/how-to-export-a-vm-from-amazon-ec2-to-vmware-on-premise/\n* https://docs.aws.amazon.com/cli/latest/reference/ec2/create-instance-export-task.html\n* https://github.com/jpadilla/juicebox\n* https://github.com/boxcutter/ubuntu\n\n\nUbuntu Live Server\n------------------\n\n* https://beryju.org/blog/automating-ubuntu-server-20-04-with-packer\n* https://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html\n* https://cloudinit.readthedocs.io/en/latest/topics/network-config.html\n* https://github.com/hashicorp/packer/issues/9115\n* https://github.com/vmware/cloud-init-vmware-guestinfo\n* https://nickcharlton.net/posts/automating-ubuntu-2004-installs-with-packer.html\n* https://packetpushers.net/cloud-init-demystified/\n* https://wiki.archlinux.org/index.php/Cloud-init\n* https://wiki.ubuntu.com/FoundationsTeam/AutomatedServerInstalls\n* https://www.virtualthoughts.co.uk/2020/03/29/rancher-vsphere-network-protocol-profiles-and-static-ip-addresses-for-k8s-nodes/\n* https://www.whiteboardcoder.com/2016/04/cloud-init-nocloud-with-url-for-meta.html\n\nTo re-engage cloud-init after it has been used::\n\n    sudo rm -f /etc/machine-id\n    sudo cloud-init clean -s -l\n\n\nUsing a Headless Server\n-----------------------\n\nIf you are using these scripts on a \"headless\" server (i.e.:  no GUI), you must\nset the \"headless\" variable to \"true\" or you will encounter the following\nerror::\n\n    ...\n    ==\u003e virtualbox: Starting the virtual machine...\n    ==\u003e virtualbox: Error starting VM: VBoxManage error: VBoxManage: error: The virtual machine 'base-bullseye' has terminated unexpectedly during startup because of signal 6\n    ==\u003e virtualbox: VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MachineWrap, interface IMachine\n    ...\n\n\nOffical ISO Files\n-----------------\n\n\nDebian_\n~~~~~~\n\n.. _Debian:  https://www.debian.org/\n\n* Testing;  http://cdimage.debian.org/cdimage/weekly-builds/\n* Stable;  http://cdimage.debian.org/cdimage/release/current/\n* Oldstable;  http://cdimage.debian.org/cdimage/archive/latest-oldstable/\n* Oldoldstable;  http://cdimage.debian.org/cdimage/archive/latest-oldoldstable/\n\n\nUbuntu_\n~~~~~~\n\n.. _Ubuntu:  https://www.ubuntu.com/\n\n* Released;  http://releases.ubuntu.com/\n* Pending;  http://cdimage.ubuntu.com/\n\n\nDistro Release Names\n--------------------\n\n\nDebian_releases_\n~~~~~~~~~~~~~~~\n\n.. _Debian_releases:  https://en.wikipedia.org/wiki/Debian_version_history#Release_table\n\n* ? (16.x);  released on 2031-??-??, supported until 2036-06?-01\n* ? (15.x);  released on 2029-??-??, supported until 2034-06?-01\n* Forky (14.x);  released on 2027-??-??, supported until 2032?-06?-01\n* Trixie (13.x);  released on 2025-??-??, supported until 2030?-06?-01\n* Bookworm (12.x);  released on 2023-06-10, supported until 2028-06-01\n* Bullseye (11.x);  released on 2021-08-14, supported until 2026-06-01\n* Buster (10.x);  released on 2019-07-06, supported until 2024-06-30\n\nDebian releases seem to occur every 2 years around mid-year and usually receive\nsecurity support for 3 years and long-term support for 5 years.\n\n\nUbuntu_releases_\n~~~~~~~~~~~~~~~\n\n.. _Ubuntu_releases:  https://en.wikipedia.org/wiki/Ubuntu_version_history#Table_of_versions\n\n* C? C? (31.10.x);  released on 2031-10-??, supported until 2032-07?-01\n* B? B? (31.04.x);  released on 2031-04-??, supported until 2032-01?-01\n* A? A? (30.10.x);  released on 2030-10-??, supported until 2031-07?-01\n* Z? Z? (30.04.x LTS);  released on 2030-04-??, supported until 2035-04?-01 (ESM 2040-04?-01)\n* Y? Y? (29.10.x);  released on 2029-10-??, supported until 2030-07?-01\n* X? X? (29.04.x);  released on 2029-04-??, supported until 2030-01?-01\n* W? W? (28.10.x);  released on 2028-10-??, supported until 2029-07?-01\n* V? V? (28.04.x LTS);  released on 2028-04-??, supported until 2033-04?-01 (ESM 2037-04?-01)\n* U? U? (27.10.x);  released on 2027-10-??, supported until 2028-07?-01\n* T? T? (27.04.x);  released on 2027-04-??, supported until 2028-01?-01\n* S? S? (26.10.x);  released on 2026-10-??, supported until 2027-07?-01\n* R? R? (26.04.x LTS);  released on 2026-04-??, supported until 2031-04?-01 (ESM 2035-04?-01)\n* Q? Q? (25.10.x);  released on 2025-10-??, supported until 2026-07?-01\n* P? P? (25.04.x);  released on 2025-04-??, supported until 2026-01?-01\n* O? O? (24.10.x);  released on 2024-10-??, supported until 2025-07?-01\n* Noble Numbat (24.04.x LTS);  released on 2024-04-25, supported until 2029-05-31 (ESM 2034-04-25)\n* Mantic Minotaur (23.10.x);  released on 2023-10-12, supported until 2024-07-01\n* Jammy Jellyfish (22.04.x LTS);  released on 2022-04-21, supported until 2027-04-21 (ESM 2032-04-21)\n* Focal Fossa (20.04.x LTS);  released on 2020-04-23, supported until 2025-04-23 (ESM 2030-04-23)\n\nUbuntu releases traditionally-occur twice a year--in April and October.  LTS\nreleases typically come out in April and receive standard support for 5 years\nand Extended Security Maintenance for 10 years.  Non-LTS releases typically\nseem to receive standard support for 9 to 11 months with no extended security\nmaintenance.\n\nExtended Security Maintenance (ESM_) support for LTS releases is available to\nindividuals on \"up to 3 machines\" or up to 50 machines for\nofficially-recognized Ubuntu community members_.\n\n* Bionic Beaver (18.04.x LTS);  released on 2018-04-26, supported until 2023-05-31 (ESM 2028-04-26)\n* Xenial Xerus (16.04.x LTS);  released on 2016-04-21, supported until 2021-04-30 (ESM 2026-04-23)\n* Trusty Tahr (14.04.x LTS);  released on 2014-04-17, supported until 2019-04-25 (ESM 2024-04-25)\n\n.. _ESM:  https://ubuntu.com/security/esm\n.. _members:  https://wiki.ubuntu.com/Membership\n","funding_links":[],"categories":["HCL","Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftylert%2Fpacker-build","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftylert%2Fpacker-build","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftylert%2Fpacker-build/lists"}