Git Product home page Git Product logo

packer-qemu-templates's Introduction

NOTE: The templates are mostly unmaintained. I do, however, merge MRs. Reach out if you interested in taking over. Kind regards, Jakob

Introduction

The packer-qemu-templates provides Packer templates for unattended building of relevant virtual machine images in the qcow2 format for use with KVM.

In addition, all templates for use with Vagrant, through vagrant-libvirt, are configured to let Packer create a Vagrant box through the libvirt post-processor.

More info: https://aarhusworks.com/2014/08/26/unattended-installation-of-vm-images-with-packer.html

Status

Currently the project includes templates for Ubuntu, CentOS, Debian and Windows. In other words, the OSes of the VMs I and the other contributors use on a day-to-day basis.

Feel free to contribute more:-)

Usage

Build qcow2 image

Go into the relevant template directory and run packer build on the relevant json file.

$ cd windows
$ packer build -var-file windows.json windows-2012-R2-standard-vagrant.json

Templates names that ends with vagrant automatically creates a vagrant box.

Add the box to Vagrant

$ vagrant box add box/windows-2012-R2-standard.box --name windows-2012-R2-standard

Init vagrantfile

$ mkdir project && cd $_
$ vagrant init windows-2012-R2-standard

Start machine

$ vagrant up

Get IP of machine

$ vagrant ssh-config

Acknowledgements

packer-qemu-templates's People

Contributors

abbbi avatar aidanharris avatar andrijapanicsb avatar bryant1410 avatar cerih avatar devjatkin avatar dragoscirjan avatar dschaper avatar electrocucaracha avatar evasdk avatar gregjan avatar kiview avatar menedev avatar philippt avatar rustamkulenov avatar scottpas avatar sooslaca avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

packer-qemu-templates's Issues

Waiting for ssh to become available

Host: Ubuntu Server 16.04

Ran the packer build -var-file=ubuntu1604.json -var headless=true ubuntu-vagrant.json with headless option as it was giving Qemu stderr: Could not initialize SDL(No available video device) - exiting error

But after that getting waiting for ssh to become available.

Debian version bump.

The cdimage.debian.org repo no longer has 8.3.0, they are on 8.6.0. Would be happy to PR a change up with the new image location and the checksum if that's what's needed to bump the versions.

Kindly run the needful "packer fix"

Expected: your templates work.
Actual: your templates are out-of-date but it is easy to fix.
Reproducing:

$ packer build -var-file=ubuntu1804.json ubuntu.json
Error: Failed to prepare build: "qemu"

1 error occurred:
	* Deprecated configuration key: 'iso_checksum_type'. Please call `packer fix`
against your template to update your template to be compatible with the current
version of Packer. Visit https://www.packer.io/docs/commands/fix/ for more
detail.
$ packer fix -var-file=ubuntu1804.json ubuntu.json > foo.json
$ mv foo.json ubuntu.json
$ packer build -var-file=ubuntu1804.json ubuntu.json
... skip ahead ...
==> qemu: Gracefully halting virtual machine...
==> qemu: Converting hard drive...
Build 'qemu' finished.

==> Builds finished. The artifacts of successful builds are:
--> qemu: VM files in directory: output-ubuntu1804

Ubuntu 18.04 Invalid URL

STEPS

sudo apt-get install packer
git clone https://github.com/jakobadam/packer-qemu-templates.git
cd ubuntu
packer build -var-file=ubuntu1804.json ubuntu-vagrant.json

ACTUAL RESULTS

qemu output will be in this color.

==> qemu: Retrieving ISO
    qemu: Error downloading: Error making HTTP GET request: 404 Not Found
==> qemu: ISO download failed.
Build 'qemu' errored: ISO download failed.

WORKAROUND

sed -Ei 's/(.*)(ubuntu-18.04.2)(.*)/\1ubuntu-18.04.4\3/' ubuntu1804.json
sed -Ei 's/("iso_checksum": ")(.*)(",)/\1e2ecdace33c939527cbc9e8d23576381c493b071107207d2040af72595f8990b\3/' ubuntu1804.json 

Why is vagrant stuff in the ubuntu.json file?

Hoping I can just ask a quick question while I debug my problem.

I notice that lots of vagrant-related things are in the ubuntu.json file. For example, that file appears to execute scripts\vagrant.sh (which may or may not be causing my problem). Why would that be in ubuntu.json as opposed (or in addition) to ubuntu-vagrant.json? Maybe I'm missing some variables or keywords that control a vagrant/non-vagrant execition path through that file?

Debian 8 install and IPv6 issue leads to DNS fail

Not really an issue specific to this repository, but I have not personally experienced this other than when installing Debian using Packer with qemu and its use of this particular type of network device.

I will write up the changes after an opportunity for other perspectives.

Whether you experience this will depend on your own qemu user networking support for ipv6.

Debian 8 network installation can acquire a site-local address from qemu, and if so, it then installs rdnssd which overwrites /etc/resolv.conf with a useless IPv6 DNS address (by default fec0::3)
In /var/log/installer/syslog you will find..
Jan 13 13:09:47 apt-install: Queueing package rdnssd for later installation
This will overwrite /etc/resolv.conf on reboot and cause failure of shell update/package scripts.
Solutions:

  1. Override user network definition in json to force ipv4 only (see added -netdev option). rdnssd does not get installed as result.
"qemuargs": [
    [ "-netdev", "user,hostfwd=tcp::{{ .SSHHostPort }}-:22,id=user.0,ipv4"],
    [ "-device", "virtio-net,netdev=user.0"]
 ]
  1. Install resolvconf package which is recommended when rdnssd is installed normally (but not when inserted by the installer in this case) which will allow many programs to "manage" /etc/resolv.conf. In preseed.cfg edit pkgsel to add it.
    d-i pkgsel/include string openssh-server resolvconf

  2. Disable/remove rdnssd if it was installed when resolvconf was not, e.g. in preseed.cfg

d-i preseed/late_command string \
  if [ -x "/target/sbin/rdnssd" -a ! -x "/target/sbin/resolvconf" ] ; then \
    in-target systemctl disable rdnssd.service ; \
  fi

See also this Debian bug

windows 10 stuck at waiting for winrm

fedora 25, packer 0.12.1

packer build windows-10-enterprise-vagrant.json

seems fine until it hits this,
Typing the boot command over VNC...
Waiting for WinRM to become available...

and then its just stuck there.

Windows 2012 R2: Can't login with vagrant keys anymore

Logging in with pub/priv keys is unsuccessful:

$ ssh -vvv [email protected] -i ~/.vagrant.d/insecure_private_key
...
debug1: Trying private key: /home/jakob/.vagrant.d/insecure_private_key
debug1: key_parse_private2: missing begin marker
debug1: read PEM private key done: type RSA
debug3: sign_and_send_pubkey: RSA dd:3b:b8:2e:85:04:06:e9:ab:ff:a8:0a:c0:04:6e:d6
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug2: we did not send a packet, disable method
...

On the sshd side the windows application log says:

"Authentication refused: bad ownership or modes for directory
/cygdrive/c/Users/vagrant"

get 'Qemu failed to start' error

$ ~/packer build -var-file=ubuntu1404.json ubuntu-vagrant.json 
qemu output will be in this color.

==> qemu: Downloading or copying ISO
    qemu: Downloading or copying: http://releases.ubuntu.com/14.04/ubuntu-14.04.5-server-amd64.iso
==> qemu: Creating floppy disk...
    qemu: Copying files flatly from floppy_files
    qemu: Copying file: http/preseed.cfg
    qemu: Done copying files from floppy_files
    qemu: Collecting paths from floppy_dirs
    qemu: Resulting paths from floppy_dirs : []
    qemu: Done copying paths from floppy_dirs
==> qemu: Creating hard drive...
==> qemu: Starting HTTP server on port 8450
==> qemu: Found port for communicator (SSH, WinRM, etc): 4282.
==> qemu: Looking for available port between 5900 and 6000 on 127.0.0.1
==> qemu: Starting VM, booting from CD-ROM
==> qemu: Overriding defaults Qemu arguments with QemuArgs...
==> qemu: Error launching VM: Qemu failed to start. Please run with PACKER_LOG=1 to get more info.
==> qemu: Deleting output directory...
Build 'qemu' errored: Build was halted.

==> Some builds didn't complete successfully and had errors:
--> qemu: Build was halted.

==> Builds finished but no artifacts were created.

My system is Centos 7.

Sudo misconfigured on debian

according to vagrant doc, vagrant should be able to sudo command on behalf of other users.

The config line should be:
vagrant ALL=(ALL) NOPASSWD: ALL
in debian/scripts/vagrant.sh it's:
vagrant ALL=NOPASSWD:ALL

some ansible role like ANXS.Postgresql use this feature and will fail on box generated with current template.

Post-processor failed: Unknown libvirt domain type: tcg

Hi,

I'm trying to build ubuntu 16.04 vagrant image forvagrant libvirt.
The only change I made was adding:
ubuntu1604.json:

"version" : "1",
"headless": "true"

as I'm building on a server. The build fails with the following reason:

==> qemu: Gracefully halting virtual machine...
==> qemu: Converting hard drive...
==> qemu: Running post-processor: vagrant
==> qemu (vagrant): Creating Vagrant box for 'libvirt' provider
    qemu (vagrant): Copying from artifact: output-ubuntu1604/ubuntu1604
Build 'qemu' errored: 1 error(s) occurred:

* Post-processor failed: Unknown libvirt domain type: tcg

Any help will be much appreciated:)

Cheers,
qmacpit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.