The Shining Path of Least Resistance

LeastResistance.Net

Archive for the ‘linux’ Category

Building Chef on the BeagleBone Black

Posted by mattray on October 20, 2016

chef-logoI wanted to get Chef running on my BeagleBone Black running Debian, using the full-stack Omnibus builder they use for their packages. While ARM is not a supported platform, the open source community had already done a lot of work getting it ready. The first step was to get the build toolchain in place, so I followed the instructions from https://github.com/chef/omnibus-toolchain. I had to make 1 small fix (already merged), but here’s how I got omnibus-toolchain installed:

sudo apt-get install autoconf binutils-doc bison build-essential flex gettext ncurses-dev libssl-dev libreadline-dev zlib1g-dev git libffi6 libffi-dev ruby ruby-dev
sudo gem install bundler
git clone https://github.com/chef/omnibus-toolchain.git
cd omnibus-toolchain
sudo bundle install --without development
sudo bundle exec omnibus build omnibus-toolchain
sudo FORCE_UNSAFE_CONFIGURE=1 bundle exec omnibus build omnibus-toolchain

Note the FORCE_UNSAFE_CONFIGURE=1, there was a bug in gtar that I didn’t debug.

Luckily Carl Perry already had an ARMHF Chef 12.8.1 build available for bootstrapping.

After installing the package locallly

dpkg -i /tmp/chef_12.8.1%2B20160319051316-1_armhf.deb

I did a chef-client run remotely

$ knife bootstrap 192.168.0.11 -x debian --sudo -N beaglebone
Creating new client for beaglebone
Creating new node for beaglebone
Connecting to 192.168.0.11
192.168.0.11 -----> Existing Chef installation detected
192.168.0.11 Starting the first Chef Client run...
192.168.0.11 Starting Chef Client, version 12.8.1
192.168.0.11 resolving cookbooks for run list: []
192.168.0.11 Synchronizing Cookbooks:
192.168.0.11 Installing Cookbook Gems:
192.168.0.11 Compiling Cookbooks...
192.168.0.11 [2016-10-13T07:53:21+11:00] WARN: Node beaglebone has an empty run list.
192.168.0.11 Converging 0 resources
192.168.0.11
192.168.0.11 Running handlers:
192.168.0.11 Running handlers complete
192.168.0.11 Chef Client finished, 0/0 resources updated in 14 seconds

The next step was to get the omnibus cookbook in place to use my machine as a builder. After sorting through the dependencies and getting it uploaded, I had to make 1 small change to disable grabbing the omnibus-toolchain because I had already built it locally. Once that was in place, it was a matter of sudoing to the omnibus user, downloading the Chef source and running

. load-omnibus-toolchain.sh
cd chef/omnibus
bundle install --without development
bundle exec omnibus build chef -l debug

And approximately 3 hours later I had a new chef_12.15.27+20161013214455-1_armhf.deb which worked great once installed.

root@beaglebone:/home/omnibus/chef-12.15.27/omnibus/pkg# dpkg -i chef_12.15.27+20161013214455-1_armhf.deb
Selecting previously unselected package chef.
(Reading database ... 82288 files and directories currently installed.)
Preparing to unpack chef_12.15.27+20161013214455-1_armhf.deb ...
Unpacking chef (12.15.27+20161013214455-1) ...
Setting up chef (12.15.27+20161013214455-1) ...
Thank you for installing Chef!

I’ll continue to refine the build process and follow along with new releases of Chef. Now I can move on to the next more important piece, which is actually using the box. Feel free to download it: chef_12.15.27+20161013214455-1_armhf.deb

Advertisements

Posted in chef, linux | Tagged: , , , | 1 Comment »

Installing Debian 8.6 on a BeagleBone Black

Posted by mattray on October 14, 2016

1996-01I’ve finally had practical reason to get the BeagleBone Black out of the drawer and start using it as an home server (more later). It’s a nice, quiet little machine with 512 megs of RAM and a 1ghz ARM CPU. I followed the instructions from https://beagleboard.org/getting-started to connect to it via the serial port over USB, which allowed me to connect to the web server on the included OS. Turns out I didn’t really need to do this, all I needed to do was flash my microSD card and install Debian on it.

For more in-depth Linux notes, I referred to http://elinux.org/Beagleboard:BeagleBoneBlack

I downloaded the latest Debian stable “Jessie” build for ARMHF from here. That image turned out to be a bit bloated with X and desktop tools, so I switched to the “IOT” image. I flashed the image onto a 32 gig microSD card with Etcher for OSX, which was quite painless.

Debian on the BeagleBone Black

Next I popped the microSD card into the BeagleBone and rebooted into Debian. I was able to connect to the serial console over USB with instructions from here. For my instance, the command was

screen /dev/tty.usbmodem1413

I changed the debian user password away from the default and plugged in a network cable.
Once it was on the network I could SSH to it, I probably didn’t need to use the serial console at all if I’d just looked for the IP address off the router.

I copied over my SSH key so I wouldn’t need to use my password when logging in.

scp ~/.ssh/id_rsa.pub debian@192.168.0.11:~/.ssh/authorized_keys

Next I did an apt-get update; apt-get upgrade to get the latest bits and then shut it down.

I plugged directly into the router and powered via the USB port, since it’s meant to be an externally-accessible bastion box.

Final touches

I also needed to make sure we used the whole microSD, so I followed these instructions:

cd /opt/scripts/tools/
git pull
sudo ./grow_partition.sh
sudo reboot

I checked the list of timezones and set mine to Sydney.

timedatectl list-timezones
sudo timedatectl set-timezone Australia/Sydney

and finally

apt-get install emacs-nox

Now it was ready to use.

Posted in geekery, linux, Uncategorized | Tagged: , | 1 Comment »