CONTRIBUTING.md 2.9 KB

Requirements

To build the images in this repository, you will need:

  • Linux machine to build images
  • Packer

One of:

  • KVM
  • QEMU

or:

  • VirtualBox

Building

When extending the template, the notes in the "Troubleshooting" may be helpful.

cd base/distro/
packer build -parallel=false template.json

Note: when building images that include qemu and virtualbox-iso builders, the -parallel=false is most likely necessary.

In most cases, images only need to be built with one builder. Supported builders are found in the template file. The following example is for building using VirtualBox.

cd base/distro/
packer build -only=virtualbox-iso template.json

This will output images to the dist directory, within the corresponding directory to the template and builder type.

$ tree dist
dist
└── void-x86_64-20171007-qemu
    ├── void-x86_64-20171007.gz     # a compressed raw disk image for sending over the network
    ├── void-x86_64-20171007.qcow2  # a qcow disk image
    └── void-x86_64-20171007.raw    # a raw disk image

Deploying

Preparing the new disk

To deploy a built image, start in the Linode Manager.

  1. Create an ext4 disk on the destination Linode.
  2. Boot into Rescue Mode with the disk in the /dev/sda slot.
  3. From the Lish console, set the root password and enable SSH. If you aren't familiar with the process, there is a guide, here.

Copy the image

Now that the Linode is booted into Rescue Mode and has SSH up and listening, the disk image can be copied to the remote device. This again uses the void image as an example.

There is a helper bin/sync.sh to help with this.

Here is an example. The target IP address needs to be replaced. It has been excluded to avoid copy-paste accidents with dd.

cd dist/void-x86_64-20171007-qemu
../../bin/sync.sh void-x86_64-20171007 123.45.nn.nn /dev/sda

Final setup

  1. Shut down the Linode.
  2. Reset the root password of the disk from the 'Rescue' tab.
  3. Add the disk to a configuration profile which includes a swap disk in /dev/sdb and all helpers disabled.
  4. Boot using the above configuration profile.
  5. Enjoy!

Troubleshooting

To get more verbose output from packer, print the logs to the console.

PACKER_LOG=1 packer build template.json

Provisioning scripts are currently being run with the -x flag. Because of this, all commands that are run during the build step will be printed to the console, and therefore the packer logs. To stop this behavior, just remove the -x from the first line of the scripts, leaving only #!/bin/sh.