-
Notifications
You must be signed in to change notification settings - Fork 35
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
How to create box from vagrant cloud #24
Comments
Sorry, the vagrant package command is not support for now. (#4) |
got it , thanks for the quick response |
I put some basic step here. |
Sorry , but I mean how to vagrant up from an existing box on vagrant cloud ➜ test_debian vagrant init generic/debian10 |
Your way is the right way. You can use an existing box. |
May I know how to fix it? then I could raise a merge request to you |
Please try the same config in https://github.com/ppggff/vagrant-qemu/wiki/buster64-on-x86_64 The basic steps to debug this problem:
For this Debian issue, I didn't dig too much. It works after adding a VGA device. Maybe Debian needs a VGA device, or maybe there is another root cause. Please let me know if you find it. : ) |
Sorry but I'm the user use mac M1 |
Have you tried it? Since your target box is a x86_64 box, it should work. (without |
Is there a way to have vagrant-qemu emulate the libvirt provider for pre-existing boxes that require libvirt? I'm trying to develop Mastodon on Apple M1 machine. Mastodon's Vagrantfile requires
This is even after I added the following section in the Vagrantfile as suggested by vagrant-qemu README:
I have filed an issue with Mastodon but on Apple M1, if vagrant-qemu emulates libvirt, then it would solve the problem for all projects with existing Vagrantfile that requires boxes with libvirt only. |
I discovered that VirtualBox now has a Developer Preview build for Apple M1/M2 hosts. However, this doesn't actually work for me as the machine created by vagrant with ubuntu/bionic64 box gets aborted. Even if that were to be fixed, the performance will likely be terrible. These comments are explanatory:
And,
So, it would really be valuable for vagrant-qemu to support libvirt boxes like ubuntu/bionic64 because so many developers now use Apple M1/M2 machines. |
JFYI, below is the packer HCL template to make an usable qcow2 image from the upstream Debian 11 arm64 This is not a box but still can be used with the following config in vagrant_root = File.dirname(__FILE__)
config.vm.provider "qemu" do |qemu|
qemu.qemu_dir = "/opt/homebrew/share/qemu"
qemu.image_path = "#{vagrant_root}/deb11-arm64.qcow2"
end It should be easy enough to adopt this approach to Ubuntu and other distros. qemu-deb11-arm64.pkr.hclpacker {
required_plugins {
qemu = {
version = ">= 1.0.7"
source = "github.com/hashicorp/qemu"
}
}
}
variable "iso_url" {
description = "Base ISO URL to build the image from"
type = string
default = "https://cloud.debian.org/images/cloud/bullseye/20221108-1193/debian-11-genericcloud-arm64-20221108-1193.qcow2"
}
variable "iso_checksum" {
description = "Base ISO checksum"
type = string
default = "file:https://cloud.debian.org/images/cloud/bullseye/20221108-1193/SHA512SUMS"
}
variable "qemu_firmware" {
description = "Path to look for qemu firmware in"
type = string
default = "/opt/homebrew/share/qemu/edk2-aarch64-code.fd"
validation {
condition = fileexists(var.qemu_firmware)
error_message = "The qemu_firmware value must be a valid path."
}
}
variable "vagrant_user" {
description = "User name to create"
type = string
default = "vagrant"
}
variable "vagrant_passwd" {
description = "vagrant_user password"
type = string
default = "vagrant"
}
locals {
instance_data = {
instance-id = "iid-local01"
}
cloud_config = {
disable_root = true
growpart = {
mode = "auto"
devices = ["/"]
}
// follow https://developer.hashicorp.com/vagrant/docs/v2.3.2/boxes/base#default-user-settings
ssh_pwauth = true
users = [
{
name = var.vagrant_user
plain_text_passwd = var.vagrant_passwd
lock_passwd = false
shell = "/bin/bash"
sudo = "ALL=(ALL) NOPASSWD:ALL"
ssh_authorized_keys = [data.http.vagrant_public_key.body] // vagrant insecure key
},
]
}
}
# Insecure vagrant public key as recommended here https://developer.hashicorp.com/vagrant/docs/v2.3.2/boxes/base#vagrant-user
data "http" "vagrant_public_key" {
url = "https://raw.githubusercontent.com/hashicorp/vagrant/main/keys/vagrant.pub"
}
source "qemu" "deb11_arm64" {
iso_url = var.iso_url
iso_checksum = var.iso_checksum
iso_target_extension = "qcow2"
disk_image = true
shutdown_command = "echo 'packer' | sudo -S shutdown -P now"
ssh_username = var.vagrant_user
ssh_password = var.vagrant_passwd
firmware = var.qemu_firmware
use_pflash = true
skip_resize_disk = true
format = "qcow2"
disk_compression = true
accelerator = "hvf"
machine_type = "virt"
qemu_binary = "qemu-system-aarch64"
disable_vnc = true
headless = true
qemuargs = [
["-cpu", "host"],
["-serial", "file:{{ .OutputDir }}/{{ .Name }}-serial.log"],
]
cd_label = "cidata"
cd_content = {
"meta-data" = jsonencode(local.instance_data)
"user-data" = "#cloud-config\n${jsonencode(local.cloud_config)}"
}
}
build {
sources = [
"source.qemu.deb11_arm64",
]
} |
@nileshtrivedi There are some solutions:
Notes:
|
You might want to try https://app.vagrantup.com/perk/boxes/ubuntu-2204-arm64 |
Hello,
How could I create box for vagrant-qemu , for example debian OS?
The text was updated successfully, but these errors were encountered: