Chef 14.12 ARM on the BeagleBone/Raspberry Pi

Chef

This is a minor update from the previous Chef 14.11 ARM on the BeagleBone/Raspberry Pi.

Overview

The Chef client is packaged with Omnibus, which builds the application and all of its runtime dependencies with the Omnibus-Toolchain. Omnibus is built with Ruby, so the instructions need to start with building Ruby. These instructions follow the Installing Debian 9 on a BeagleBone Black and the Installing Raspbian 9 on a Raspberry Pi Zero, so the Debian machines are ready for use.

Preparation

There are several preparatory steps that need to be done before we get started. As the root user update to ensure the latest packages are installed and install the prerequisites for building Ruby and Omnibus-Toolchain.

apt-get update
apt-get upgrade
apt-get install -y autoconf fakeroot git libreadline-dev libssl-dev zlib1g-dev

Add the omnibus user for performing the builds.

useradd omnibus

Directories and Permissions

If you have previously-installed Chef and omnibus-toolchain packages (perhaps following these instructions), you’ll need to uninstall those and clear out the directories. I’m not dpkg --purging them because I want to continue using their Chef configuration once they have the new chef-client installed.

systemctl stop chef-client
apt-get remove chef omnibus-toolchain
rm -rf /opt/chef /opt/omnibus-toolchain

Create and set permissions on the directories used for the upcoming builds.

mkdir /home/omnibus
mkdir /var/cache/omnibus
mkdir /opt/omnibus-toolchain
mkdir /opt/chef
chown omnibus:omnibus /home/omnibus
chown omnibus:omnibus /var/cache/omnibus
chown omnibus:omnibus /opt/omnibus-toolchain
chown omnibus:omnibus /opt/chef

Ruby 2.6.2

The Omnibus-toolchain is built with Ruby 2.6.2, so as the omnibus user we will install it with rbenv.

sudo su - omnibus
bash

We don’t need documentation for our gems.

echo 'gem: --no-document' >> ~/.gemrc

Let’s install rbenv and add it to our PATH.

git clone https://github.com/rbenv/rbenv.git ~/.rbenv
cd ~/.rbenv && src/configure && make -C src
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

Install the ruby-build plugin to make it easier to manage different Ruby versions.

mkdir plugins
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
rbenv install 2.6.2
rbenv global 2.6.2
eval "$(rbenv init -)"

Omnibus-Toolchain

Now that Ruby is installed, let’s build and install the Omnibus-Toolchain as the omnibus user.

cd
git clone https://github.com/chef/omnibus-toolchain.git
cd omnibus-toolchain
bundle install --without development
bundle exec omnibus build omnibus-toolchain -l internal

Once this build has completed, as the root user remove the working directory and install the new omnibus-toolchain package.

rm -rf /opt/omnibus-toolchain
dpkg -i ~omnibus/omnibus-toolchain/pkg/omnibus-toolchain*deb

There is a bug in the version of tar provided by Omnibus, so let’s use Debian’s built-in version.

rm /opt/omnibus-toolchain/bin/tar

Chef 14.12

With omnibus-toolchain installed, we can reset our PATH and build Chef as the omnibus user.

cd
export PATH="/opt/omnibus-toolchain/bin:$PATH"
wget https://github.com/chef/chef/archive/v14.12.3.tar.gz
tar -xzf v14.12.3.tar.gz
cd chef-14.12.3/omnibus/
bundle install --without development
bundle exec omnibus build chef -l internal

This usually takes several hours on these limited 32-bit ARM machines.

Installing Chef 14.12

Once the builds have completed, as the root user we can delete the working build directory.

rm -rf /opt/chef

Now Chef 14.12.3 can be installed.

dpkg -i /home/omnibus/chef-14.12.3/omnibus/pkg/chef_14.12.3*arm*.deb

Using the new Chef build

From your workstation, you can now knife bootstrap the machine with the ARM build on it and register it with your Chef Server. If you are working with a previously Chef-managed box, you can run chef-client and the machine will continue to use its previous configuration.

Chef 14.12.3 Packages