Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for building from an existing Vagrant box #869

Closed
aseigneurin opened this issue Jan 31, 2014 · 134 comments · Fixed by #7221
Closed

Add support for building from an existing Vagrant box #869

aseigneurin opened this issue Jan 31, 2014 · 134 comments · Fixed by #7221

Comments

@aseigneurin
Copy link

It's quite complex to build a Vagrant box from an ISO file. You need to know the boot sequence and the preseed. Both of these are hardly readable.

Sometimes, we just need to build a box out of an existing Vagrant box. It would be great if Packer had a pre-processor that would take, in input, a Vagrant box, and would then feed the "virtualbox-ovf" builder. Alternatively, this could be another builder.

That would add the ability to provision a pre-built Vagrant box, then repackage it as a Vagrant box.

Ideally, the Vagrant box in input could be taken from the local context or from a URL (e.g. a box from http://www.vagrantbox.es/).

Does it make sense?

@apetresc
Copy link

+1

@jorisvddonk
Copy link
Contributor

For Virtualbox, you can currently achieve this manually by downloading a .box, extracting its contents (they're just tarballs, optionally gzipped) and then pointing the source_path of the virtualbox-ovf builder to the box.ovf file that was extracted from the tarball.

I agree though that having actual support for Vagrant boxes inside Packer without requiring above workaround would be really useful.

@ryanbreen
Copy link

+1. This would remove a lot of friction from the following workflow: take an existing Vagrant box, update contents, and update deployed box so other users can benefit.

@vampirical
Copy link

+1. Would definitely be convenient to have.

@andreisavu
Copy link

+1

@riedi
Copy link

riedi commented May 21, 2014

+1 - i was also looking for that feature - just want to make small changes to an existing base box.

@tchemineau
Copy link

+1
Agree with @aseigneurin

@ckulla
Copy link

ckulla commented Jul 24, 2014

+1

@CpuID
Copy link
Contributor

CpuID commented Jul 24, 2014

+1

Nathan Sullivan
Sent from a mobile device

On 25 Jul 2014, at 1:29 am, Christoph Kulla notifications@github.com wrote:

+1


Reply to this email directly or view it on GitHub.

@michaelmior
Copy link

+1 Seems like it would be fairly straightforward to do this for VirtualBox boxes as @jorisvddonk suggests. My guess would be most people who want this are aiming to do it for the VirtualBox Vagrant provider anyway.

@peterfox
Copy link

+1 this would make it easier as a lot of the time I just want to take a box and then add simple things like chef etc. rather than do a full install of the OS from an ISO

@Jim-Duke
Copy link

+1

There are issues in that a Vagrant Box is not necessarily intended for the VirtualBox provider and may not contain an OVF/OVA file. But for all those who want this workflow that wouldn't be a problem.

@mattiasholmqvist
Copy link

+1

1 similar comment
@kuboj
Copy link

kuboj commented Feb 17, 2015

+1

@haad
Copy link

haad commented Feb 17, 2015

+1

Ability to skip installation process would be great.

@d3netxer
Copy link

d3netxer commented Mar 9, 2015

+1

1 similar comment
@vladistan
Copy link

+1

@lantrix
Copy link
Contributor

lantrix commented Apr 2, 2015

+1

Consideration to the pre-processor would be what type of vagrant box provider is in use as well; I'm guessing the two most common are VirtualBox and VMWare

@dev-head
Copy link

dev-head commented May 7, 2015

+1 this should happen

@jonyeezs
Copy link

+1

I'm sitting here waiting for a windows update....this takes ages.

I know i should do this during off-peak but sometimes you just need to build a new box. And would be lovely if i don't have to do a windows update from an installation.

@ajmath
Copy link

ajmath commented May 19, 2015

+1

@mwpeterson
Copy link

I started converting an existing Vagrant workflow to Packer so we can also build AMIs. I was very surprised to discover that Packer doesn't support building directly from virtualboxes on Atlas. :(

👍

@amontalban
Copy link

+1

I have a FreeBSD vagrant box that I build from ISO that would be great if I can use it as base box for other Packer generated boxes that uses FreeBSD as base so I can have better build times.

@libertyy
Copy link

libertyy commented Jun 9, 2015

+1

@chirangaalwis
Copy link

+1 for introducing this feature. Will simplify a lot of work.

@jamesla
Copy link

jamesla commented Jan 16, 2018

+1

2 similar comments
@mat-mcloughlin
Copy link

+1

@alaa
Copy link

alaa commented Mar 8, 2018

+1

@lqueryvg
Copy link

I've +1'd this request.
But until this feature is available, what's wrong with @davidkarlsen suggestion ?
I.e. use existing vagrant functionality:

  1. vagrant up (from base .box)
  2. vagrant provision (add your customisations here)
  3. vagrant halt
  4. vagrant package -> create a new .box

Are there any gotchas with this approach ?

@chirangaalwis
Copy link

chirangaalwis commented Apr 14, 2018

@lqueryvg you may want to look into WSO2's product Vagrant box repository [1], which was recently initiated. In this repository, the approach which you have pointed out has been used.

When working on building Vagrant boxes for WSO2 products, we encountered the same issue discussed here and we came up with the same solution. Yet hopefully, this feature would be introduced sooner rather than later.

[1]: WSO2 product Vagrant boxes

@filipelenfers
Copy link

+1

1 similar comment
@rockraft7
Copy link

+1

@hdlim15
Copy link

hdlim15 commented Jul 16, 2018

+1 @KFoxder

@grv87
Copy link
Contributor

grv87 commented Aug 14, 2018

@cornfeedhobo, what did you mean saying that @themalkolm's solution doesn't support variables?
He uses variables in tests, and everything looks OK.

@jarrettj
Copy link

jarrettj commented Nov 8, 2018

+1

1 similar comment
@koaps
Copy link

koaps commented Nov 16, 2018

+1

@Swader
Copy link

Swader commented Jan 8, 2019

5 years after the issue was first opened, let me throw in a +1 as well.

@SwampDragons
Copy link
Contributor

I've implemented an integration for the virtualbox-ovf builder already and for the vmware-ovf one, but I'm not wild about the complexity it adds to the code, and I think this would work better as a standalone builder -- so I'll be working on that next, with the Vagrant team.

I'd love volunteers to test builds once I've got something working.

@koaps
Copy link

koaps commented Jan 11, 2019

I'd love volunteers to test builds once I've got something working.

I'm game

@Swader
Copy link

Swader commented Jan 11, 2019

Also willing to test while in progress, feel free to ping me whenever

@SwampDragons
Copy link
Contributor

I have a rough builder created here

So far thanks to some hardcoding it only works on OSX (I've attached a binary to that PR) but I intend to fix the pathing for linux and windows tomorrow.

I'd love some testing and feedback. Docs changes are included in the PR, and there's a usage example in the PR comments.

@SwampDragons
Copy link
Contributor

Windows and linux builds are now available for the vagrant builder.

@sudomateo
Copy link
Contributor

+1 for this. Also voicing the need/want for this to work via libvirt and not only VirtualBox and VMware.

@SwampDragons
Copy link
Contributor

@sudomateo the new vagrant builder will call out directly to vagrant rather than requiring users to set up the underlying builder; you will have the opportunity to set whichever vagrant provider suits your needs.

@nhojpatrick
Copy link

nhojpatrick commented Feb 2, 2019

packer build \ -var "box_folder=${BOX_FOLDER}" \ -var "box_checksum=${BOX_CHECKSUM}" \ -var "box_password=${BOX_PASSWORD}" \ -var "box_base_mac=${BOX_BASE_MAC}" \ "templates.json"

As this is still open as I just want to take official vagrant boxes, execute some ansible playbooks, then create a new vagrant box or personal usage...

@Adezandee Do you have an updated version as I've just tried with packer v1.3.4 and get this;

Failed to parse template: 14 error(s) occurred:

* Unknown root level key in template: 'checksum'
* Unknown root level key in template: 'checksum_type'
* Unknown root level key in template: 'guest_additions_mode'
* Unknown root level key in template: 'headless'
* Unknown root level key in template: 'output_directory'
* Unknown root level key in template: 'shutdown_command'
* Unknown root level key in template: 'skip_export'
* Unknown root level key in template: 'source_path'
* Unknown root level key in template: 'ssh_password'
* Unknown root level key in template: 'ssh_pty'
* Unknown root level key in template: 'ssh_username'
* Unknown root level key in template: 'target_path'
* Unknown root level key in template: 'type'
* Unknown root level key in template: 'vboxmanage'

@arnaud-dezandee
Copy link
Contributor

@nhojpatrick my original comment was a partial packer file. I just updated it with a complete working example.

@SwampDragons
Copy link
Contributor

@nhojpatrick that functionality will be added when #7221 is merged :)

@ghost
Copy link

ghost commented Mar 29, 2020

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.

@ghost ghost locked and limited conversation to collaborators Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.