Git Product home page Git Product logo

d2vm's Introduction

d2vm (Docker to Virtual Machine)

Language: Go Go Reference Chat

Build virtual machine image from Docker images

The project is heavily inspired by the article and the work done by iximiuz on docker-to-linux.

Many thanks to him.

Status: alpha

asciicast

Supported Environments:

Only building Linux Virtual Machine images is supported.

Starting from v0.1.0, d2vm automatically run build and convert commands inside Docker when not running on linux or when running without root privileges.

Note: windows should be working, but is totally untested.

Supported VM Linux distributions:

Working and tested:

  • Ubuntu (18.04+) Luks support is available only on Ubuntu 20.04+
  • Debian (stretch+) Luks support is available only on Debian buster+
  • Alpine
  • CentOS (8+)

Unsupported:

  • RHEL

The program uses the /etc/os-release file to discover the Linux distribution and install the Kernel, if the file is missing, the build cannot succeed.

Obviously, Distroless images are not supported.

Prerequisites

osx

Linux

  • Docker
  • util-linux
  • udev
  • parted
  • e2fsprogs
  • dosfstools (when using fat32)
  • mount
  • tar
  • extlinux (when using syslinux)
  • qemu-utils
  • cryptsetup (when using LUKS)
  • QEMU (optional)
  • VirtualBox (optional)

Getting started

Install

With Docker

Note: this will only work if both the source context (and Dockerfile) and the output directory are somewhere inside the directory where you run the command.

docker pull linkacloud/d2vm:latest
alias d2vm="docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock --privileged -v \$PWD:/d2vm -w /d2vm linkacloud/d2vm:latest"
which d2vm

d2vm: aliased to docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock --privileged -v $PWD:/d2vm -w /d2vm linkacloud/d2vm:latest

With Homebrew

brew install linka-cloud/tap/d2vm

From release

Download the latest release for your platform from the release page.

Extract the tarball, then move the extracted d2vm binary to somewhere in your $PATH (/usr/local/bin for most users).

VERSION=$(git ls-remote --tags https://github.com/linka-cloud/d2vm |cut -d'/' -f 3|tail -n 1)
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$([ "$(uname -m)" = "x86_64" ] && echo "amd64" || echo "arm64")
curl -sL "https://github.com/linka-cloud/d2vm/releases/download/${VERSION}/d2vm_${VERSION}_${OS}_${ARCH}.tar.gz" | tar -xvz d2vm
sudo mv d2vm /usr/local/bin/

From source

Clone the git repository:

git clone https://github.com/linka-cloud/d2vm && cd d2vm

Install using the make, docker and the Go tool chain:

make install

The d2vm binary is installed in the $GOBIN directory.

which d2vm

/go/bin/d2vm

Generate shell completion

The d2vm program supports shell completion for bash, zsh and fish.

It can be enabled by running the following command:

source <(d2vm completion $(basename $SHELL))

Or you can install the completion file in the shell completion directory by following the instructions:

d2vm completion $(basename $SHELL) --help

Converting an existing Docker Image to VM image:

d2vm convert --help
Convert Docker image to vm image

Usage:
  d2vm convert [docker image] [flags]

Flags:
      --append-to-cmdline string   Extra kernel cmdline arguments to append to the generated one
      --boot-fs string             Filesystem to use for the boot partition, ext4 or fat32
      --boot-size uint             Size of the boot partition in MB (default 100)
      --bootloader string          Bootloader to use: syslinux, grub, grub-bios, grub-efi, defaults to syslinux on amd64 and grub-efi on arm64
      --force                      Override output qcow2 image
  -h, --help                       help for convert
      --keep-cache                 Keep the images after the build
      --luks-password string       Password to use for the LUKS encrypted root partition. If not set, the root partition will not be encrypted
      --network-manager string     Network manager to use for the image: none, netplan, ifupdown
  -o, --output string              The output image, the extension determine the image format, raw will be used if none. Supported formats: qcow2 qed raw vdi vhd vmdk (default "disk0.qcow2")
  -p, --password string            Optional root user password
      --platform string            Platform to use for the container disk image, linux/arm64 and linux/arm64 are supported (default "linux/amd64")
      --pull                       Always pull docker image
      --push                       Push the container disk image to the registry
      --raw                        Just convert the container to virtual machine image without installing anything more
  -s, --size string                The output image size (default "10G")
      --split-boot                 Split the boot partition from the root partition
  -t, --tag string                 Container disk Docker image tag

Global Flags:
      --time string   Enable formated timed output, valide formats: 'relative (rel | r)', 'full (f)' (default "none")
  -v, --verbose       Enable Verbose output

Create an image based on the ubuntu official image:

sudo d2vm convert ubuntu -o ubuntu.qcow2 -p MyP4Ssw0rd
Pulling image ubuntu
Inspecting image ubuntu
No network manager specified, using distribution defaults: netplan
Docker image based on Ubuntu 22.04.1 LTS (Jammy Jellyfish)
Building kernel enabled image
Creating vm image
Creating raw image
Mounting raw image
Creating raw image file system
Copying rootfs to raw image
Setting up rootfs
Installing linux kernel
Unmounting raw image
Writing MBR
Converting to qcow2

You can now run your ubuntu image using the created ubuntu.qcow2 image with qemu:

d2vm run qemu ubuntu.qcow2
SeaBIOS (version 1.13.0-1ubuntu1.1)


iPXE (http://ipxe.org) 00:03.0 CA00 PCI2.10 PnP PMM+BFF8C920+BFECC920 CA00



Booting from Hard Disk...

SYSLINUX 6.04 EDD 20191223 Copyright (C) 1994-2015 H. Peter Anvin et al
Now booting the kernel from SYSLINUX...
Loading /boot/vmlinuz... ok
Loading /boot/initrd.img...ok
[    0.000000] Linux version 5.4.0-109-generic (buildd@ubuntu) (gcc version 9)
[    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz ro root=UUID=b117d206-b8
[    0.000000] KERNEL supported cpus:
[    0.000000]   Intel GenuineIntel
[    0.000000]   AMD AuthenticAMD
[    0.000000]   Hygon HygonGenuine
[    0.000000]   Centaur CentaurHauls
[    0.000000]   zhaoxin   Shanghai

...

Welcome to Ubuntu 20.04.4 LTS!

[    3.610631] systemd[1]: Set hostname to <localhost>.
[    3.838984] systemd[1]: Created slice system-getty.slice.
[  OK  ] Created slice system-getty.slice.
[    3.845038] systemd[1]: Created slice system-modprobe.slice.
[  OK  ] Created slice system-modprobe.slice.
[    3.852054] systemd[1]: Created slice system-serial\x2dgetty.slice.
[  OK  ] Created slice system-serial\x2dgetty.slice.

...

Ubuntu 20.04.4 LTS localhost ttyS0

localhost login: 

Log in using the root user and the password configured at build time.

localhost login: root
Password:


Welcome to Ubuntu 20.04.4 LTS (GNU/Linux 5.4.0-109-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

This system has been minimized by removing packages and content that are
not required on a system that users do not log into.

To restore this content, you can run the 'unminimize' command.

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

root@localhost:~#

Type poweroff to shut down the vm.

Building a VM Image from a Dockerfile

The example directory contains very minimalistic examples:

cd examples

ubuntu.Dockerfile :

FROM ubuntu

RUN apt update && apt install -y openssh-server && \
    echo "PermitRootLogin yes" >> /etc/ssh/sshd_config

Build the vm image:

The build command take most of its flags and arguments from the docker build command.

d2vm build --help
Build a vm image from Dockerfile

Usage:
  d2vm build [context directory] [flags]

Flags:
      --append-to-cmdline string   Extra kernel cmdline arguments to append to the generated one
      --boot-fs string             Filesystem to use for the boot partition, ext4 or fat32
      --boot-size uint             Size of the boot partition in MB (default 100)
      --bootloader string          Bootloader to use: syslinux, grub, grub-bios, grub-efi, defaults to syslinux on amd64 and grub-efi on arm64
      --build-arg stringArray      Set build-time variables
  -f, --file string                Name of the Dockerfile
      --force                      Override output qcow2 image
  -h, --help                       help for build
      --keep-cache                 Keep the images after the build
      --luks-password string       Password to use for the LUKS encrypted root partition. If not set, the root partition will not be encrypted
      --network-manager string     Network manager to use for the image: none, netplan, ifupdown
  -o, --output string              The output image, the extension determine the image format, raw will be used if none. Supported formats: qcow2 qed raw vdi vhd vmdk (default "disk0.qcow2")
  -p, --password string            Optional root user password
      --platform string            Platform to use for the container disk image, linux/arm64 and linux/arm64 are supported (default "linux/amd64")
      --pull                       Always pull docker image
      --push                       Push the container disk image to the registry
      --raw                        Just convert the container to virtual machine image without installing anything more
  -s, --size string                The output image size (default "10G")
      --split-boot                 Split the boot partition from the root partition
  -t, --tag string                 Container disk Docker image tag

Global Flags:
      --time string   Enable formated timed output, valide formats: 'relative (rel | r)', 'full (f)' (default "none")
  -v, --verbose       Enable Verbose output

sudo d2vm build -p MyP4Ssw0rd -f ubuntu.Dockerfile -o ubuntu.qcow2 .

Or if you want to create a VirtualBox image:

sudo d2vm build -p MyP4Ssw0rd -f ubuntu.Dockerfile -o ubuntu.vdi .

KubeVirt Container Disk Images

Using the --tag flag with the build and convert commands, you can create a Container Disk Image for KubeVirt.

The --push flag will push the image to the registry.

Complete example

A complete example setting up a ZSH workstation is available in the examples/full directory.

Internal Dockerfile templates

You can find the Dockerfiles used to install the Kernel in the templates directory.

TODO / Questions:

  • Create service from ENTRYPOINT CMD WORKDIR and ENV instructions ?
  • Inject Image ENV variables into .bashrc or other service environment file ?
  • Use image layers to create rootfs instead of container ?

Acknowledgments

The run commands are adapted from linuxkit.

d2vm's People

Contributors

adphi avatar buahaha avatar cyrinux avatar dependabot[bot] avatar sazzy4o 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

d2vm's Issues

luks support

depends on:

steps:

  • encrypt root partition: cryptsetup luksFormat --batch-mode --verify-passphrase --type luks2 $ROOT_DEVICE $KEY_FILE
  • open it: cryptsetup open -d $KEY_FILE $ROOT_DEVICE $ROOT_LABEL
  • mount /dev/mapper/$ROOT_LABEL instead of $ROOT_DEVICE
  • close it when done: cryptsetup close /dev/mapper/$ROOT_LABEL

syslinux / Initramfs:

  • Alpine:
    • in /etc/mkinitfs/mkinitfs.conf: add cryptsetup to features and re-run mkinitfs
    • in /boot/syslinux.cfg append to the kernel cmdline:
      • change root to root=/dev/mapper/$ROOT_LABEL
      • add cryptroot=UUID=$ROOT_PARTITION_UUID
      • add cryptdm=root
  • Debian
  • Ubuntu
  • CentOS

Work done in #30

d2vm run fails with VBoxManage/QEMU

When I try to run "d2vm run vbox ubuntu.vdi" it gives me the error: "Cannot find management binary VBoxManage: exec: "VBoxManage": executable file not found in $PATH", but I updated my .bashrc file with export PATH=$PATH:/usr/bin/VBoxManage. I tried the same thing building and running an image with QEMU and I got the same thing. I did the set up from docker and everything seemed fine during installation. Any ideas why the run command might fail?

Windows d2vm support

Theoretically this should be possible as container images run using hyper-v on consumer editions of windows.
Assuming this is PR welcome

How to use a VM image as an EC2 instance?

Followed these steps to attempt to use the image as an EC2 VM:

aws iam create-role --role-name vmimport --assume-role-policy-document file://trust-policy.json

cat trust-policy.json
{
   "Version": "2012-10-17",
   "Statement": [
      {
         "Effect": "Allow",
         "Principal": { "Service": "vmie.amazonaws.com" },
         "Action": "sts:AssumeRole",
         "Condition": {
            "StringEquals":{
               "sts:Externalid": "vmimport"
            }
         }
      }
   ]
}
aws ec2 import-snapshot --description "example image" --disk-container file://container.json

cat container.json
[
    {
        "Description": "Example image originally in QCOW2 format",
        "Format": "raw",
        "UserBucket": {
            "S3Bucket": "raw-images-debo-test",
            "S3Key": "ubuntu-debo.raw"
        }
    }
]

steps to build and push image:

d2vm build -f Dockerfile -o ubuntu-debo.qcow2 d2vm/examples/full

qemu-img convert ubuntu-debo.qcow2 ubuntu-debo.raw
aws s3 cp ubuntu-debo.raw s3://raw-images-debo-test
aws ec2 import-image --description "My test VM" --disk-containers file://containers.json

# to check progress
aws ec2 describe-import-image-tasks

neither of the steps of importing the snapshot or importing the image worked.

Error on VirtualBox image

When running :

d2vm build -p MyP4Ssw0rd -f ubuntu.Dockerfile -o ubuntu.vdi .
Building docker image from ubuntu.Dockerfile
Inspecting image d2vm-4dca598b-8f4d-4c6e-b6c2-c36d145dcb2a
No network manager specified, using distribution defaults: netplan
Docker image based on Ubuntu 22.04.1 LTS (Jammy Jellyfish)
Building kernel enabled image
Creating vm image
Creating raw image
Mounting raw image
Build failed
Unmounting raw image
Failed to unmount
Error: losetup --show -f /tmp/d2vm/834629c7-f718-4d96-bbea-c7890c7a1a09/disk0.d2vm.raw: stdout:  stderr: losetup: cannot find an unused loop device
 error: exit status 1

I am running this inside an Ubuntu VirtualBox with a Windows host

Document dependencies

d2vm/builder.go

Line 402 in 43f2dd5

for _, v := range []string{"mount", "blkid", "tar", "losetup", "parted", "partprobe", "qemu-img", "extlinux", "dd", "mkfs"} {

Linux:

  • util-linux
  • udev
  • parted
  • e2fsprogs
  • mount
  • tar
  • extlinux
  • qemu-utils

osx:

  • qemu-utils

Running d2vm behind proxy

My system is behind proxy and it fails to convert image, so I added http_proxy and https_proxy in ubuntu.Dockerfile to make it work.
Is there any other way to make it work?

The file /dev/loop0p1 does not exist and no size was specified

Thanks for the great work on this! I am running into the same error reported in #13, but didnt see a solution in there.

This happens regardless of the approach I take, using docker, building from source, binaries, and with and without sudo.

Here is the output I get using the docker instructions in the readme.

 $ docker pull linkacloud/d2vm:latest
latest: Pulling from linkacloud/d2vm
Digest: sha256:52dc3afa3cba9da925e9a8d7d6a487b82e31742d27cfca0490d441fe82d0d446
Status: Image is up to date for linkacloud/d2vm:latest
docker.io/linkacloud/d2vm:latest

$ alias d2vm="docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock --privileged -v $(pwd):/d2vm -w /d2vm linkacloud/d2vm:latest"

 $ d2vm convert ubuntu
Using local image ubuntu:latest
Inspecting image ubuntu
No network manager specified, using distribution defaults: netplan
Docker image based on Ubuntu 22.04.1 LTS (Jammy Jellyfish)
Building kernel enabled image
Creating vm image
Creating raw image
Mounting raw image
Creating raw image file system
Build failed
Unmounting raw image
Failed to unmount
Error: mkfs.ext4 /dev/loop0p1: stdout:  stderr: mke2fs 1.45.5 (07-Jan-2020)
The file /dev/loop0p1 does not exist and no size was specified.
 error: exit status 1

And here is the verbose output

Using local image ubuntu:latest
Inspecting image ubuntu
$ docker image build -t os-release-ubuntu -f /tmp/d2vm/4fb21713-22a0-47aa-abbf-6d0fa7fbbc8a/osrelease.Dockerfile /tmp/d2vm/4fb21713-22a0-47aa-abbf-6d0fa7fbbc8a
#1 [internal] load build definition from osrelease.Dockerfile
#1 sha256:3964a2a4e71ae4002c89256656aa4c2a2533e5166b5856b1cc41e6a616d14a52
#1 transferring dockerfile: 114B done
#1 DONE 0.0s

#2 [internal] load .dockerignore
#2 sha256:d6e455fd32bde387fcf0efa1a558ee6cbeb6d901c8d2fed088e9b5aa569658ee
#2 transferring context: 2B done
#2 DONE 0.0s

#3 [internal] load metadata for docker.io/library/ubuntu:latest
#3 sha256:8c6bdfb121a69744f11ffa1fedfc68ec20085c2dcce567aac97a3ff72e53502d
#3 DONE 0.0s

#4 [1/1] FROM docker.io/library/ubuntu
#4 sha256:0a5f349eacf4edfd2fc1577c637ef52a2ed3280d9d5c0ab7f2e4c4052e7d6c9f
#4 CACHED

#5 exporting to image
#5 sha256:e8c613e07b0b7ff33893b694f7759a10d42e180f2b4dc349fb57dc6b71dcab00
#5 exporting layers done
#5 writing image sha256:b5a1ffdbe367c0c8500ec75486f2b3d084a2fe958c4e5fadc5cb725bb3bae580 done
#5 naming to docker.io/library/os-release-ubuntu done
#5 DONE 0.0s
$ docker image rm os-release-ubuntu
Untagged: os-release-ubuntu:latest
Deleted: sha256:b5a1ffdbe367c0c8500ec75486f2b3d084a2fe958c4e5fadc5cb725bb3bae580
No network manager specified, using distribution defaults: netplan
Docker image based on Ubuntu 22.04.1 LTS (Jammy Jellyfish)
Building kernel enabled image
$ docker image build -t 4fb21713-22a0-47aa-abbf-6d0fa7fbbc8a -f /tmp/d2vm/4fb21713-22a0-47aa-abbf-6d0fa7fbbc8a/ubuntu /tmp/d2vm/4fb21713-22a0-47aa-abbf-6d0fa7fbbc8a
#1 [internal] load build definition from ubuntu
#1 sha256:bb8119a8d01f073a5b6fa37983ef59c183e9117c9574aeefc26cc0bb7c78b6ec
#1 transferring dockerfile: 644B done
#1 DONE 0.0s

#2 [internal] load .dockerignore
#2 sha256:f4c4f2e400d86ec089b85ecc3d7606a65b488053fb3761268fdb0dd88ad3a761
#2 transferring context: 2B done
#2 DONE 0.0s

#3 [internal] load metadata for docker.io/library/ubuntu:latest
#3 sha256:8c6bdfb121a69744f11ffa1fedfc68ec20085c2dcce567aac97a3ff72e53502d
#3 DONE 0.0s

#4 [1/5] FROM docker.io/library/ubuntu
#4 sha256:0a5f349eacf4edfd2fc1577c637ef52a2ed3280d9d5c0ab7f2e4c4052e7d6c9f
#4 DONE 0.0s

#6 [3/5] RUN systemctl preset-all
#6 sha256:d9bd256ae49570708a270aaa0a94221aa8ab503e71644bbdb3b54a48b1afdba6
#6 CACHED

#7 [4/5] RUN apt install -y netplan.io
#7 sha256:971803d10f5ea1ee18cd4750ac3134e5ce89760d833bf5162418b416f554405b
#7 CACHED

#5 [2/5] RUN apt-get update -y &&   DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends   linux-image-virtual   initramfs-tools   systemd-sysv   systemd   dbus   isc-dhcp-client   iproute2   iputils-ping
#5 sha256:0bccb225dc3e39aa44cb1966adf4d6884bf314ec2c068a3246bdd2628bafe256
#5 CACHED

#8 [5/5] RUN mkdir -p /etc/netplan && printf 'network:\n  version: 2\n  renderer: networkd\n  ethernets:\n    eth0:\n      dhcp4: true\n      dhcp-identifier: mac\n      nameservers:\n        addresses:\n        - 8.8.8.8\n        - 8.8.4.4\n' > /etc/netplan/00-netcfg.yaml
#8 sha256:9376b75d64382b03230d99424609058e67c77754ecee3fcd964bdc02ef8e57f4
#8 CACHED

#9 exporting to image
#9 sha256:e8c613e07b0b7ff33893b694f7759a10d42e180f2b4dc349fb57dc6b71dcab00
#9 exporting layers done
#9 writing image sha256:c38c8a335bffad48ee0f07a5856e27f71ac4db07d267edca84475a288cc838be done
#9 naming to docker.io/library/4fb21713-22a0-47aa-abbf-6d0fa7fbbc8a done
#9 DONE 0.0s
Creating vm image
Creating raw image
$ parted -s /tmp/d2vm/4fb21713-22a0-47aa-abbf-6d0fa7fbbc8a/disk0.d2vm.raw mklabel msdos mkpart primary 1Mib 100% set 1 boot on
Mounting raw image
$ partprobe /dev/loop0
Creating raw image file system
$ mkfs.ext4 /dev/loop0p1
mke2fs 1.45.5 (07-Jan-2020)
The file /dev/loop0p1 does not exist and no size was specified.
Build failed
Unmounting raw image
$ umount /tmp/d2vm/4fb21713-22a0-47aa-abbf-6d0fa7fbbc8a/mnt
umount: /tmp/d2vm/4fb21713-22a0-47aa-abbf-6d0fa7fbbc8a/mnt: not mounted.
$ losetup -d /dev/loop0
Failed to unmount
$ docker image rm 4fb21713-22a0-47aa-abbf-6d0fa7fbbc8a
Untagged: 4fb21713-22a0-47aa-abbf-6d0fa7fbbc8a:latest
Deleted: sha256:c38c8a335bffad48ee0f07a5856e27f71ac4db07d267edca84475a288cc838be
Error: exit status 1

Bare metal support

Absolutely love the idea of scripting the installation of my distro though docker.
This could especially be useful when attempting to run a immutable base distro which uses containers for applications.
Bare metal support would be highly appreciated!

CentOS Stream 9 build failure

any clues as to the problem here? It's looking for repo configs that do not exist:

[stuart@vulcan]~% d2vm convert registry.xyz.com/pe/platform:latest -o test.qcow2
Using local image registry.xyz.com/pe/platform:latest
Inspecting image registry.xyz.com/pe/platform:latest
Docker image based on CentOS Stream 9
Building kernel enabled image
Error: docker image build -t ab500c7d-ef6b-4012-b554-5c1781d46db9 -f /tmp/d2vm/ab500c7d-ef6b-4012-b554-5c1781d46db9/registry.xyz.com_protocol-pe /tmp/d2vm/ab500c7d-ef6b-4012-b554-5c1781d46db9: stdout: Sending build context to Docker daemon  3.584kB
Step 1/6 : FROM registry.xyz.com/pe/platform:latest
 ---> 4f46cc6167a1
Step 2/6 : USER root
 ---> Running in 4432ffaa6169
Removing intermediate container 4432ffaa6169
 ---> 9646c3d19f94
Step 3/6 : RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* &&     sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
 ---> Running in 31ec456c9280
sed: can't read /etc/yum.repos.d/CentOS-*: No such file or directory
 stderr: DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
            Install the buildx component to build images with BuildKit:
            https://docs.docker.com/go/buildx/

in the container:

[root@control]# ll /etc/yum.repos.d/
total 32
drwxr-xr-x. 1 root root  194 Jun 25 23:09 .
drwxr-xr-x. 1 root root 3156 Jul  9 15:11 ..
-rw-r--r--. 1 root root 4245 Mar 20 17:57 centos-addons.repo
-rw-r--r--. 1 root root 2600 Mar 20 17:57 centos.repo
-rw-r--r--. 1 root root 1142 Aug 17  2023 epel-cisco-openh264.repo
-rw-r--r--. 1 root root 1552 Aug 17  2023 epel-testing.repo
-rw-r--r--. 1 root root 1453 Aug 17  2023 epel.repo
-rw-r--r--. 1 root root  174 Jun 25 23:09 google-chrome.repo
[root@control protocolEngine]# uname -r
6.0.12-100.fc35.x86_64
[root@control protocolEngine]# cat /etc/centos-release
CentOS Stream release 9
[root@control protocolEngine]# yum repolist enabled
repo id                     repo name
appstream                   CentOS Stream 9 - AppStream
baseos                      CentOS Stream 9 - BaseOS
epel                        Extra Packages for Enterprise Linux 9 - x86_64
epel-cisco-openh264         Extra Packages for Enterprise Linux 9 openh264 (From Cisco) - x86_64
extras-common               CentOS Stream 9 - Extras packages
google-chrome               google-chrome

thanks!

sparsecat-linux-amd64 missing

Running go install ./cmd/d2vm produces:
cmd/d2vm/run/util.go:35:12: pattern sparsecat-linux-amd64: no matching files found

The related file in util.go contains:
//go:embed sparsecat-linux-amd64

A potential reason why that is not found is due to the .ignorefile which contains
/cmd/d2vm/run/sparsecat-linux-amd64

That causes git to not include that file/folder

Could you please add it to the repository, or did I miss something on the structure?

MacOS: The file /dev/loop0p1 does not exist and no size was specified.

Running this command:
% sudo ~/go/bin/d2vm build -p 0 -f Dockerfile -o nutek-linux.vdi .

Leads to this error:

Building docker image from /in/Dockerfile
Inspecting image d2vm-cdc6670a-be2d-4db5-9d50-7d1414cad66b
No network manager specified, using distribution defaults: ifupdown
Docker image based on Kali GNU/Linux 2022.3
Building kernel enabled image
Creating vm image
Creating raw image
Mounting raw image
Creating raw image file system
Build failed
Unmounting raw image
Failed to unmount
Error: mkfs.ext4 /dev/loop0p1: stdout:  stderr: mke2fs 1.45.5 (07-Jan-2020)
The file /dev/loop0p1 does not exist and no size was specified.
 error: exit status 1

There is no mkfs.ext4 on MacOS

% which mkfs.ext4
mkfs.ext4 not found

Add option to disable root password creation

We may not want to create a password for the root account.
We could either:

  • change the default behaviour to not create a password if none is given to the --password flag (BREAKING CHANGE)
  • add a flag to disable root password, e.g. --no-password (preserve command line API compatibility)

alpine: replace manual init services configuration with the empty `/etc/.default_boot_services` file

see init script:

https://github.com/alpinelinux/mkinitfs/blob/224826dcee28425a81bae099ade87fad797a5674/initramfs-init.in#L642-L669

if [ -f "$sysroot/etc/.default_boot_services" -o ! -f "$ovl" ]; then
	# add some boot services by default
	rc_add devfs sysinit
	rc_add dmesg sysinit
	rc_add mdev sysinit
	rc_add hwdrivers sysinit
	rc_add modloop sysinit


	rc_add modules boot
	rc_add sysctl boot
	rc_add hostname boot
	rc_add bootmisc boot
	rc_add syslog boot


	rc_add mount-ro shutdown
	rc_add killprocs shutdown
	rc_add savecache shutdown


	rc_add firstboot default


	# add openssh
	if [ -n "$KOPT_ssh_key" ]; then
		pkgs="$pkgs openssh"
		rc_add sshd default
	fi


	rm -f "$sysroot/etc/.default_boot_services"
fi

What to copy to /usr/local/bin/?

After installation with make build-dev, what folder is supposed to be copied to usr/local/bin/? The whole root of the project?

I am getting Command 'd2vm' not found

Build fails when trying to build .vhd

Issue

from the documentation:
d2vm build [context directory] [flags]

Flags:
-o, --output string The output image, the extension determine the image format, raw will be used if none. Supported formats: qcow2 qed raw vdi vhd vmdk (default "disk0.qcow2")

but when trying to build a .vhd the build fails with

d2vm build . --verbose --password Test12345678 --output agent-image.vhd
...
qemu-img convert /tmp/d2vm/9a280bb5-8871-46bd-8c92-1f817e9c5334/disk0.d2vm.raw -O vhd /tmp/d2vm/9a280bb5-8871-46bd-8c92-1f817e9c5334/disk0.vhd
qemu-img: Unknown file format 'vhd'

Cause

The underlying qemu-img convert argument is vpc not vhd

see https://docs.openstack.org/image-guide/convert-images.html

Side note

it would be nice to be able to use additional options for qemu-img convert etc:

qemu-img convert agent-image.qcow2 -O vpc agent-image.vhd -o subformat=fixed,force_size

alpine 3.17.0: busybox-initscripts: unable to select packages

/ # apk add busybox-initscripts
fetch https://dl-cdn.alpinelinux.org/alpine/v3.17/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.17/community/x86_64/APKINDEX.tar.gz
ERROR: unable to select packages:
  busybox-initscripts (no such package):
    required by: world[busybox-initscripts]

see [3.17] Rework device manager handling, split busybox-initscripts:

Accordingly, the busybox-initscripts package will be dropped, with remaining openrc scripts moved to busybox-openrc, busybox-mdev-openrc and busybox-extras-openrc. The busybox-mdev-openrc package will provide dev-openrc.

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.