Putting old Raspberry Pis to good use

Update to this post

I put my Raspberry Pi2 to use by installing Retropie on a functioning SD card.

The issues I mention below were most likely due to failing/corrupt sd cards.

Why use a Raspberry pi at all?

They're great devices for learning a different operating system when all one is used to are either Windows or Apple's Osx.

I got my first pi in 2015, a pi 2b.

My main machine was an Acer laptop at the time running Windows 7.

I remember using putty and Win32 Disk Imager(had to look this name up) to write the Raspbian Wheezy image to the sd card I had at the time.

They're also great to experiment on, install this, enter this shell(bash, python) or whatever.

If you mess up the OS, you can always just write a new Raspbian image to the card and restart.

Times change

Over time, I moved to Debian on my acer laptop and started using Debian Jessie on it.

Then in 2016, I got a desktop and ran Debian Sid for a while. Then testing, and stable when Stretch got released in 2017.

Kernel 4.9+ was really required to run the AMD polaris cards I bought in late 2016 and early 2017(rx 460+480).

After using the Pi2b+ for a while, I got a second Pi3b, also running Raspbian.

They ran a couple of things for me in my lan between 2015 - early 2019, running Squid, Nginx, Dokuwiki, Dnsmasq and a couple other things I can't remember.

I was really satisfied with both Pis, however I was dumb enough to buy the starter kits for both on Amazon.

I ended up spending a lot more money than I should have.

Also turns out the Sandisk Ultra sd cards I got were not so ultra great after all.

Putting them to good use again in late 2019

Because it's black friday tomorrow, I've been thinking about buying stuff that I would end up regretting anyway.

Then it occurred to me, why not use something that I already have.

I already have 4 Intel machines on my Lan doing various things, but I have nothing to monitor them.

So I thought, using one or both of the Pis could be used for something great.

Rummaging through boxes and cables

To get the 2 Pis working again, I'd need:

  • 2 ethernet cables
  • 2 micro-usb power cables(5v@2.5A are recommended)

I had no issues with getting ethernet cables, I've got plenty of them.

However, I was having problems with finding power cables that are good enough for the Pis.

Reading around on various forums, sites and raspberrypi.org, it seems people recommend using a power cable that supplies 5v@2.5A.

I found one of the PSU that with one of those starter packs, and it was rated 5.0v@2.0A(Vilros AC adapter, model: XHY050200LBCW).

The second PSU I've got that would be good for a Pi is my phone charger.

So temporarily, I powered up both Pis, started them both with Raspbian Buster.

My Pi3 works fine with Buster and I'll be using to monitor my other machines.

My Pi2 had several issues.

With two SD cards, load average would spike to 10-12 while doing a apt-get update & upgrade combo.

On the third card, on first boot it would fail to resize the second partition on the sd card.

On the second boot with the third card, I ran raspi-config to try to resize the partition, however it would also fail.

It would error out, citing a syntax error on line 151.

Since raspi-config is a bash script(2048 lines on buster), I had a look with nano:

sudo nano -l /usr/bin/raspi-config

-l shows the lines with nano.

The relevant section from raspi-config:

 150   LAST_PART_NUM=$(parted /dev/mmcblk0 -ms unit s p | tail -n 1 | cut -f 1 -d:)
 151   if [ $LAST_PART_NUM -ne $PART_NUM ]; then
 152     whiptail --msgbox "$ROOT_PART is not the last partition. Don't know how to expand" 20 60 2
 153     return 0
 154   fi

By looking at this part of the script, I tried to manually run the shell that defined $LAST_PART_NUM.

So when running:

parted /dev/mmcblk0 -ms unit s p | tail -n 1 | cut -f 1 -d:

I would end up getting segmentation faults with parted every time.

There would also be some other issues with the Pi2 that I just ended up shelving it.

To-do for Pi3

What I've already done:

  • erase the pi user
  • setup my user
  • disable root password and ssh login
  • ran my ansible playbook against the pi3

Figure out what monitoring tool to use.

I'll probably try out librenms or zabbix.

If I end up with librenms, I'll have to add snmp to my machines and set up snmp communities, probably with v3.

If zabbix wins, then all my other nodes will get zabbix agents.