Giter VIP home page Giter VIP logo

crocodile's Introduction

Crocodile

The Crocodile repository contains everything that a user should need in order to build Windows{x} compressed raw images for tinkerbell.

Note: These images are for the Community and are not part of Equinix Metal Operating System Images.

The repository contains a number of key pieces:

Dockerfile

The Dockerfile contains everything that is needed to build a docker container with everything that is needed to build the Operating System images:

  • Packer
  • Qemu-kvm
  • virtio drivers (needed for Qemu to work with disks)

Host requirements

Minimal

For most OS image builds, all you should really need is Docker on a reasonably modern Linux distro with KVM virtualization support. *Ubuntu docker hosts may need to reboot after ensuring that libvirt-daemon-system is installed prior to running crocodile.

ESXi special requirements

To build ESXi images we depend on special bridged networking provided by libvirt-daemon. To confirm expected bridged networking, ip link show virbr0 should succeed. You will also need to add `--device=/dev/net/tun --cap-add=NET_ADMIN" to your docker commands.

Building our container image

docker build -t croc .

This will take a few mins (depending on the speed of the connection to the internet), and you'll be left with a docker image called croc:latest

Running our croc container

Our newly built croc container can work in two ways, either interactive or can be fully automated.

We will map two directories into our running container:

-v $PWD/packer_cache:/packer/packer_cache - Maps the packer_cache to a local packer_cache folder, this stops ISOs repeatedly downloading.

-v $PWD/images:/var/tmp/images - Maps a local images folder to where the images will be created.

Ubuntu docker hosts may also require the following additional options:

--privileged -it --rm -v $PWD/packer_cache:/packer/packer_cache -v $PWD/images:/var/tmp/images -v /dev/net:/dev/net

Interactive

Without passing anything specific to the container it will default to starting the interactive image building process.

docker run -it --rm \
-v $PWD/packer_cache:/packer/packer_cache \
-v $PWD/images:/var/tmp/images \
--net=host \
--device=/dev/kvm \
croc:latest

This will drop you into the crocodile shell for building your OS:

                          .--.  .--.
                         /    \/    \
                        | .-.  .-.   \
                        |/_  |/_  |   \
                        || `\|| `\|    `----.
                        |\0_/ \0_/    --,    \_
      .--"""""-.       /              (` \     `-.
     /          \-----'-.              \          \
     \  () ()                         /`\          \
     |                         .___.-'   |          \
     \                        /` \|      /           ;
      `-.___             ___.' .-.`.---.|             \
         \| ``-..___,.-'`\| / /   /     |              `\
          `      \|      ,`/ /   /   ,  /
                  `      |\ /   /    |\/
                   ,   .'`-;   '     \/
              ,    |\-'  .'   ,   .-'`
            .-|\--;`` .-'     |\.'
           ( `"'-.|\ (___,.--'`'
            `-.    `"`          _.--'
               `.          _.-'`-.
                 `''---''``       `."
Select quit (1)  when you've finished building Operating Systems
1) quit		   4) esxi6.5	     7) ubuntu-2004   10) windows-2016
2) alma		   5) esxi6.7	     8) windows-10    11) windows-2019
3) arch		   6) esxi7.0	     9) windows-2012

Troubleshooting

In the event that a build is failing then we can debug the issue by adding -e PACKER_LOG=1 to the docker run command.

crocodile's People

Contributors

dlaube avatar elreydetoda avatar jacobweinstock avatar jeremytanner avatar mergify[bot] avatar mmlb avatar nshalman avatar rgl avatar thebsdbox avatar tmus-brett avatar tstromberg 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

Watchers

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

crocodile's Issues

ESXi build failure: "==> qemu: Error getting the bridge virbr0 interface: route ip+net: no such network interface"

Expected Behaviour

Run crocodile per the readme, attempt to build ESXi image, and an image is built.

Current Behaviour

packer errors out with

==> qemu: Error getting the bridge virbr0 interface: route ip+net: no such network interface

Solution

This is due to a lack of a virbr0 bridge interface that libvirt-daemon creates. Installing libvirt on the host resolved that issue for me.
However, then it failed with (after adding -e PACKER_LOG=1 to the docker command line):

2021/04/21 14:10:17 packer-builder-qemu plugin: Qemu stderr: failed to open /dev/net/tun: No such file or directory
2021/04/21 14:10:17 packer-builder-qemu plugin: Qemu stderr: qemu-system-x86_64: bridge helper failed

The only solution I came up with for that issue was to add --privileged to the docker command.

Per the comments below, what is needed is to add --device=/dev/net/tun --cap-add=NET_ADMIN

So, with libvirt installed, ifconfig virbr0 returns expected output, and running:

docker run -it --rm -v $PWD/packer_cache:/packer/packer_cache -v $PWD/images:/var/tmp/images --net=host --device=/dev/kvm --device=/dev/net/tun --cap-add=NET_ADMIN croc:latest

finally worked for me for building ESXi images.

Docker build faild: E: Version '7.74.0-1ubuntu2.1' for 'curl' was not found

user@box$ docker build -t croc .
Sending build context to Docker daemon 364kB
Step 1/10 : FROM ubuntu:hirsute-20210723
hirsute-20210723: Pulling from library/ubuntu
4451f5c7eb7a: Pull complete
Digest: sha256:0d6c1371da7b3f53eab63fa060b375339d883eb6e67ab413ebf77f9eadd6700e
Status: Downloaded newer image for ubuntu:hirsute-20210723
---> bf70ebd2c444
Step 2/10 : RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends ansible=2.10.7-1 git=1:2.30.2-1ubuntu1 qemu-kvm unzip=6.0-26ubuntu1 xorriso=1.5.2-1 curl=7.74.0-1ubuntu2.1 jq=1.6-2.1ubuntu1 && apt-get clean && rm -rf /var/lib/apt/lists/*
---> Running in 3aa9f91217bb
Get:1 http://archive.ubuntu.com/ubuntu hirsute InRelease [269 kB]
Get:2 http://security.ubuntu.com/ubuntu hirsute-security InRelease [110 kB]
Get:3 http://archive.ubuntu.com/ubuntu hirsute-updates InRelease [115 kB]
Get:4 http://archive.ubuntu.com/ubuntu hirsute-backports InRelease [101 kB]
Get:5 http://archive.ubuntu.com/ubuntu hirsute/main amd64 Packages [1791 kB]
Get:6 http://security.ubuntu.com/ubuntu hirsute-security/main amd64 Packages [319 kB]
Get:7 http://archive.ubuntu.com/ubuntu hirsute/universe amd64 Packages [16.8 MB]
Get:8 http://security.ubuntu.com/ubuntu hirsute-security/multiverse amd64 Packages [3640 B]
Get:9 http://security.ubuntu.com/ubuntu hirsute-security/universe amd64 Packages [265 kB]
Get:10 http://security.ubuntu.com/ubuntu hirsute-security/restricted amd64 Packages [255 kB]
Get:11 http://archive.ubuntu.com/ubuntu hirsute/multiverse amd64 Packages [252 kB]
Get:12 http://archive.ubuntu.com/ubuntu hirsute/restricted amd64 Packages [111 kB]
Get:13 http://archive.ubuntu.com/ubuntu hirsute-updates/main amd64 Packages [486 kB]
Get:14 http://archive.ubuntu.com/ubuntu hirsute-updates/restricted amd64 Packages [258 kB]
Get:15 http://archive.ubuntu.com/ubuntu hirsute-updates/universe amd64 Packages [401 kB]
Get:16 http://archive.ubuntu.com/ubuntu hirsute-updates/multiverse amd64 Packages [8165 B]
Get:17 http://archive.ubuntu.com/ubuntu hirsute-backports/universe amd64 Packages [3950 B]
Fetched 21.6 MB in 4s (4962 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
E: Version '7.74.0-1ubuntu2.1' for 'curl' was not found
The command '/bin/sh -c apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends ansible=2.10.7-1 git=1:2.30.2-1ubuntu1 qemu-kvm unzip=6.0-26ubuntu1 xorriso=1.5.2-1 curl=7.74.0-1ubuntu2.1 jq=1.6-2.1ubuntu1 && apt-get clean && rm -rf /var/lib/apt/lists/*' returned a non-zero code: 100
user@box$

My Environment

Debian 11
Docker 20.10.9

"WinRM timeout" when generating Windows install images.

Install image generation process for Windows gets stuck on WinRM waiting on the host. This goes on until 30 minute timeout limit exceeds.

Current Behaviour

2021/04/06 10:05:16 packer-builder-qemu plugin: Connected to VNC desktop: QEMU (tink-windows-2019) ==> qemu: Typing the boot command over VNC... qemu: Not using a NetBridge -- skipping StepWaitGuestAddress ==> qemu: Using winrm communicator to connect: 127.0.0.1 2021/04/06 10:05:16 packer-builder-qemu plugin: Waiting for WinRM, up to timeout: 30m0s ==> qemu: Waiting for WinRM to become available... 2021/04/06 10:05:16 packer-builder-qemu plugin: [INFO] Attempting WinRM connection... 2021/04/06 10:05:16 packer-builder-qemu plugin: [DEBUG] connecting to remote shell using WinRM 2021/04/06 10:06:31 packer-builder-qemu plugin: [ERROR] connection error: unknown error Post "https://127.0.0.1:3903/wsman": read tcp 127.0.0.1:38990->127.0.0.1:3903: read: connection reset by peer 2021/04/06 10:06:31 packer-builder-qemu plugin: [ERROR] WinRM connection err: unknown error Post "https://127.0.0.1:3903/wsman": read tcp 127.0.0.1:38990->127.0.0.1:3903: read: connection reset by peer
This goes on until 30 minute timeout limit exceeds.

Steps to Reproduce (for bugs)

  1. docker run -it --rm
    -e PACKER_LOG=1
    -v $PWD/packer_cache:/packer/packer_cache
    -v $PWD/images:/var/tmp/images
    --net=host
    --device=/dev/kvm
    croc:latest

Select any Windows version.

Your Environment

  • Operating System and version (e.g. Linux, Windows, MacOS):
    Ubuntu 20.04.2 LTS

  • How are you running Tinkerbell? Using Vagrant & VirtualBox, Vagrant & Libvirt, on Packet using Terraform, or give details:
    Running Tinkerbell on a dedicated bare-metal server with CentOS 7

Windows 2019 provisioning step errors

Expected Behaviour

Windows 2019 image builds successfully

Current Behaviour

Build fails after 8 minutes with ansible error

==> qemu: Running local shell script: /tmp/packer-shell2452460422
    qemu:
    qemu: PLAY [all] *********************************************************************
    qemu:
    qemu: TASK [Gathering Facts] *********************************************************
    qemu: Monday 11 September 2023  20:33:21 +0000 (0:00:00.008)       0:00:00.008 ******
    qemu: fatal: [127.0.0.1]: FAILED! => {"msg": "winrm or requests is not installed: No module named 'winrm'"}
    qemu:
    qemu: PLAY RECAP *********************************************************************
    qemu: 127.0.0.1                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
    qemu:
    qemu: Monday 11 September 2023  20:33:21 +0000 (0:00:00.025)       0:00:00.033 ******
    qemu: ===============================================================================
    qemu: Gathering Facts --------------------------------------------------------- 0.03s
==> qemu: Provisioning step had errors: Running the cleanup provisioner, if present...
==> qemu: Deleting output directory...
Build 'qemu' errored after 8 minutes 43 seconds: Script exited with non-zero exit status: 2. Allowed exit codes are: [0]```

## Possible Solution
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
<!--- or ideas how to implement the addition or change -->

## Steps to Reproduce (for bugs)
Build Windows 2019

## Context
<!--- How has this issue affected you? What are you trying to accomplish? -->
<!--- Providing context helps us come up with a solution that is most useful in the real world -->


## Your Environment
Ubuntu 22.04 bare metal host

Additional OS: Fedora

Expected Behaviour

Add support for Fedora Linux.

Current Behaviour

Possible Solution

Fedora 33 and 34 have ISO (for x86) and raw (for arm64) images
available here: https://getfedora.org/en/workstation/download/

Steps to Reproduce (for bugs)

Context

Fedora is known for its quick product lifecycles (every 6 months,
no LTS) and for its latest-and-greatest kernel support. Having
an easy way to provision Fedora would help the testing process
for the newest in Linux tools.

Your Environment

  • Operating System and version (e.g. Linux, Windows, MacOS):

  • How are you running Tinkerbell? Using Vagrant & VirtualBox, Vagrant & Libvirt, on Packet using Terraform, or give details:

  • Link to your project or a code example to reproduce issue:

Sign images

Expected Behaviour

Images are signed in a registry perhaps with cosign.

Current Behaviour

Images come with no signature

Possible Solution

https://github.com/sigstore/cosign is an option

Steps to Reproduce (for bugs)

Context

Your Environment

  • Operating System and version (e.g. Linux, Windows, MacOS):

  • How are you running Tinkerbell? Using Vagrant & VirtualBox, Vagrant & Libvirt, on Packet using Terraform, or give details:

  • Link to your project or a code example to reproduce issue:

ESXi ISO files?

Are the following ESXI ISO URLs intended to be here? Does the license allow for them be used like this?

crocodile/crocodile.sh

Lines 15 to 17 in 1bce370

ESXI67ISO="http://200.131.248.12/ISO/VMware-VMvisor-Installer-6.7.0.update03-14320388.x86_64.iso"
ESXI70ISO="http://arv.asuhu.com/ESXi/VMware-VMvisor-Installer-7.0b-16324942.x86_64.iso"
ESXI65ISO="http://visionnet.com.hk/vmware/VMware-VMvisor-Installer-6.5.0.update02-8294253.x86_64.iso"

Build image failed as Ubuntu 21.04 (Hirsute Hippo) reaches End of Life

Ubuntu 21.04 (Hirsute Hippo) reaches End of Life on January 20 2022
https://fridge.ubuntu.com/2022/01/21/ubuntu-21-04-hirsute-hippo-end-of-life-reached-on-january-20-2022/

The base image in the Dockerfile needs to be updated.

Expected Behaviour

croc:latest can be built successfully.

Current Behaviour

❯ docker build -t croc .
Sending build context to Docker daemon  384.5kB
Step 1/10 : FROM ubuntu:hirsute-20210723
 ---> bf70ebd2c444
Step 2/10 : RUN apt-get update  && DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends    ansible=2.10.7-1    git=1:2.30.2-1ubuntu1    qemu-kvm    qemu-utils    unzip=6.0-26ubuntu1    xorriso=1.5.2-1    curl    jq=1.6-2.1ubuntu1  && apt-get clean  && rm -rf /var/lib/apt/lists/*
 ---> Running in 5d8c9e07d2fd
Ign:1 http://archive.ubuntu.com/ubuntu hirsute InRelease
Ign:2 http://security.ubuntu.com/ubuntu hirsute-security InRelease
Ign:3 http://archive.ubuntu.com/ubuntu hirsute-updates InRelease
Err:4 http://security.ubuntu.com/ubuntu hirsute-security Release
  404  Not Found [IP: 185.125.190.36 80]
Ign:5 http://archive.ubuntu.com/ubuntu hirsute-backports InRelease
Err:6 http://archive.ubuntu.com/ubuntu hirsute Release
  404  Not Found [IP: 91.189.91.38 80]
Err:7 http://archive.ubuntu.com/ubuntu hirsute-updates Release
  404  Not Found [IP: 91.189.91.38 80]
Err:8 http://archive.ubuntu.com/ubuntu hirsute-backports Release
  404  Not Found [IP: 91.189.91.38 80]
Reading package lists...
E: The repository 'http://security.ubuntu.com/ubuntu hirsute-security Release' does not have a Release file.
E: The repository 'http://archive.ubuntu.com/ubuntu hirsute Release' does not have a Release file.
E: The repository 'http://archive.ubuntu.com/ubuntu hirsute-updates Release' does not have a Release file.
E: The repository 'http://archive.ubuntu.com/ubuntu hirsute-backports Release' does not have a Release file.
The command '/bin/sh -c apt-get update  && DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends    ansible=2.10.7-1    git=1:2.30.2-1ubuntu1    qemu-kvm    qemu-utils    unzip=6.0-26ubuntu1    xorriso=1.5.2-1    curl    jq=1.6-2.1ubuntu1  && apt-get clean  && rm -rf /var/lib/apt/lists/*' returned a non-zero code: 100

Possible Solution

Steps to Reproduce (for bugs)

  1. docker build -t croc .

Context

Your Environment

  • Operating System and version (e.g. Linux, Windows, MacOS):
    Linux

  • How are you running Tinkerbell? Using Vagrant & VirtualBox, Vagrant & Libvirt, on Packet using Terraform, or give details:

  • Link to your project or a code example to reproduce issue:

Add Alma Linux support

Expected Behaviour

Add support for Alma Linux, which is a drop-in replacement for CentOS that's under development.

Current Behaviour

PR #7 has some changes, including building a raw file from the distributed ISO,
and putting together a kickstarter script.

Possible Solution

Test against the patches in #7 .

Context

CentOS (classic) is EOL at end of year, so this effort is designed to support
testing and development of an alternative. There may emerge several alternatives
to CentOS and we want to make testing and validation of each of them as
easy as possible.

Your Environment

  • Operating System and version (e.g. Linux, Windows, MacOS):

Alma Linux

  • How are you running Tinkerbell? Using Vagrant & VirtualBox, Vagrant & Libvirt, on Packet using Terraform, or give details:

  • Link to your project or a code example to reproduce issue:

The main Alma Linux repo is at https://github.com/AlmaLinux/cloud-images and the corresponding issue there is AlmaLinux/cloud-images#7

[Feature Request] Create Windows 10/11 image with UEFI support

My worker PC is a most recent model and only has UEFI. It would be great if there is an option to select whether to use UEFI or BIOS in building Windows images.

Expected Behaviour

Windows image built by crocodile can be used on PC with UEFI.

Current Behaviour

No bootable device can be found using the Windows example

Possible Solution

  1. In building croc image, bundle a UEFI firmware
  2. Add UEFI builder for Windows with the firmware
  3. Update autounattend files to create correct partitions and update the install partition as well

Steps to Reproduce (for bugs)

  1. Follow Windows example

Context

Your Environment

  • Operating System and version (e.g. Linux, Windows, MacOS):

  • How are you running Tinkerbell? Using Vagrant & VirtualBox, Vagrant & Libvirt, on Packet using Terraform, or give details:

  • Link to your project or a code example to reproduce issue:

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.