So simply joining an existing mastodon instance is not enough for you, you want control? Set up your own! The official documentation has a page about that, including listing a bunch of specialised hosting providers that will do this installation bit for you. But we like the more difficult road with the rewarding learning curve around here. Make sure you get get your linux box prepared, and we'll get into setting up a mastodon instance on local hardware, running linux, without docker, and without cloud storage.


  • Step 1; Get to installing mastodon

  • Details )


  • Step 2; Get to customising mastodon

  • Details )


  • Step 3; Should you set up an instance for other people?

  • Details )
    I had recently setup a Plex server on a Raspberry Pi 4 (Model B - 4GB RAM). It was working well, but the disparity in the weight of the small Pi, and that of the SSD drive, not to mention the surprisingly stiff cables, meant it would go flying all over the place. So when I saw the cool case in the Pi SSD Media Server tutorial I knew I was going to give it a go.

    Well reader, this is a great project, I love the results, but straight up, I haven't encountered this many 'mistakes'/omissions in an Adafruit tutorial before. Never fear, for here is my 'study' guide, born of my suffering, so you don't have to.

    Details )


    Fully assembled case, mainly black with green side panels and handle, showing the display, displaying the following details of the Raspberry Pi inside; plexpi. IP: 192.168.0.158. CPU: 35.0'C. Mem: 113/3787 MB 2.98%.

    Pi case, build complete, powered up and display displaying info
    Photo by [personal profile] chebe

    Let's Encrypt's root cert expired the end of September just gone.

    For the first time since then I tried running an old python script on a Raspberry Pi. It failed with an all too familiar error message. In both python3, and with curl.

    I never see these errors in my browser (because Firefox is great like that). Even when I didn't have the certs on my site fully configured it didn't matter because Firefox had the necessary root and intermediate certs.

    So I tried curl on my Windows machine, and it worked, no errors. Okay, it's not the configuration of my site. It's the Raspberry Pi. I need to update its cert cache.

    I found most of what I needed here. The certs I want are here. (We'll be picking up local certs, so changing into the same directory is important.)

    sudo mkdir /usr/share/ca-certificates/local
    cd /usr/share/ca-certificates/local
    
    sudo wget https://letsencrypt.org/certs/isrgrootx1.pem
    sudo wget https://letsencrypt.org/certs/lets-encrypt-r3.pem
    
    sudo openssl x509 -inform PEM -in isrgrootx1.pem -outform PEM -out isrgrootx1.crt
    sudo openssl x509 -inform PEM -in lets-encrypt-r3.pem -outform PEM -out lets-encrypt-r3.crt
    
    sudo dpkg-reconfigure ca-certificates


    When prompted choose 'ask'. Mark your new certs with an asterisk, choose 'ok', and wait for it to finish.

    Test by trying that curl command again. All goes well, no more errors!

    Great, let's try that script again. Nope! More errors. Now that our Raspberry Pi has the correct certs we need to update the python certs. Enter an interactive session and find out where it keeps these certs.
    python3
    import certifi
    certifi.where()


    It says '/home/pi/.local/lib/python3.7/site-packages/certifi/cacert.pem'. Let's replace it!

    rm /home/pi/.local/lib/python3.7/site-packages/certifi/cacert.pem
    cp /etc/ssl/certs/ca-certificates.crt /home/pi/.local/lib/python3.7/site-packages/certifi/cacert.pem


    Test by trying that python3 script again. All goes well, no more errors! Hopefully for real this time.
    Previously on dreamwidth:chebe we played with setting up Android on a RaspberryPi 3. Which led us to ordering a RaspberryPi 4. Well friends, it arrived. I installed the LineageOS Raspberry Pi 4 port by KonstaKANG, and set up a few things, like the Play store. It worked beautifully. We're not talking lightning fast speeds, but. it. works. So now to make it usable.

    The screen and case )

    The stand and arrangement )




    My Android control console
    Photo by [personal profile] chebe

    I am fed up of expensive handheld devices (phone, tablet, etc) working great for a year or two, and then slowing down, and down, and becoming unreliable, or having support suspended. I need a more open solution, on which I can install the mandatory Android apps to be able to use the hardware I have purchased that only communicate over bluetooth low-energy. For example, my activity tracker. What do I have to hand?

    At the back of the cupboard I found my old pi-topCEED, which is a Raspberry Pi 3 Model B, with custom hub and accessories (like speakers, breakout boards), together with a display, in a custom case. (Specs here.) I love the form factor. It's just so neat. (No, it's not a touch-screen, but that doesn't stop people from trying.) Just add a mouse and keyboard and you have a full desktop computer set up. It has it's own OS, a flavour of debian, that is very targeted at kids. But I can always install a different OS on a another SD card.

    To run the apps I need Android. I have an old Raspberry Pi. After some searching I found a MagPi issue from when the board was new. It has two suggestions; Emteria.OS and Android Things. I can't install the Play Store on Android Things, so that's out. I tried Emteria.OS. You have to sign up to get a trial download, and full versions need to be paid for, but if you can live with the restrictions this is an option. The install went very smoothly, but it is only Android 7. We must be able to do better.

    So how about an unofficial LineageOS Raspberry Pi port by KonstaKANG? It looks like Raspberry Pi 3 support is topped out at LineageOS 17.1, which is Android 10. I gave it a go and everything goes pretty smoothly. Mostly. I encountered a problem on power up, after the rainbow square appears nothing else happens. I set the magic config.txt settings for the pi-topCEED, but no joy. (I did learn a lot about the various video options along the way though.) Eventually I found the thing I needed in the instructions themselves; I (also?) needed to set the resolution in the resolution.txt file. Then it booted up fine and I was flying. Until I installed the Play Store. Now, the instructions do warn against this, but I had to try it. And, yes. It does work, but it is incredibly, almost unusably slow. So if I really want to make this work I'm going to need to get my hands on a Raspberry Pi 4. Project paused.

    Photographic proof )

    But, even when I get the Raspberry Pi 4, can I use the pi-topCEED custom hardware with it? Turns out no. I would need to have a debian compatible package manager, with which to install the pi-top repos. The future Android Raspberry Pi 4 is not destined for a fancy home in the pi-topCEED. But now I know I can install those repos on Raspberry Pi OS! A nice option to keep the Raspberry Pi 3 occupied.

    Piano LED Visualizer

    2021-Apr-21, Wednesday 06:30 pm
    Every so often I take a fancy to the idea of taking up the piano again. I was going through one of these spells when I came across this project, the Piano LED Visualizer. How could I not give it a go?

    I ordered the suggested Waveshare LCD TFT 1.44" 128x128px, WS2812B LED Strip (144 per metre), 5V 6A power supply, silica tube strip in T0515 for 12mm in 2m length, and iConnectivity mio midi-to-usb cable. (I had a cable already, but thought it wasn't working. Turns out the port labels on my piano are backwards. (If I keep writing it everywhere maybe I'll actually remember next time.)) I already had the Raspberry Pi Zero, and miscellaneous components. As well as a digital piano. Time to get soldering.

    I know the instructions say there's no need to solder, but I did anyway. I used a Pico hat hacker board and soldered the connections on to it. The idea is to wire up the power between the LEDs and Pi as in this article. Checking the pinout that looks like Data out on pin 12, and I used pin 34 for common ground. Then soldered a few connectors/adapters, before seating the Waveshare on top, installing the software, etc.

    At this point it all works, but it's a loose bundle of components, so let's make that case. The instructions really gloss over this part. The case is this model, but it's based off this original case for PinkyPi. Which is where I found the guide that finally told me I needed M2.5 screws, standoffs, and nuts to assemble everything together. (The direction pad button is wonderful, but the other ones did not work for me at all. At least I can still reach the buttons through the opening in the case.)

    I also ordered the midi usb-to-usb adapter needed to try the Synthesia feature, but haven't had a chance to try it out (due to a major mix up in shipping, that the seller was great at getting sorted out, but it took a while).

    Overall the LEDs lighting up next to the key you pressed is neat. And you can set the LEDs to play animations if you just want background lighting, say for a video chat. But the LEDs don't line up well. I don't know if it's just because I got a cheap set of LEDs, but they are off at each edge of the keyboard by a couple of keys. Overall this feels like an early version project, but all the important parts are there. Including the software which is fairly solid. And it's very fun to play with.

    Photos )



    Piano LED Visualizer in rainbow demo pattern
    Photo by [personal profile] chebe

    I have VLC running on a headless system, in the form of the Pimoroni Pirate Radio. You can easily setup the radio station playlist by creating editing /etc/vlcd/default.m3u or /home/pi/.config/vlc/playlist.m3u. But what about adding local files to the Media Library? All the posts assume a graphical interface, so this took a little digging.

    You will want to edit;
    sudo vim /usr/bin/vlcd

    To add on command line options for customisation. If you simply add the paths you want included to the end of the list they'll be included on reboot. But it doesn't get them into the actual Media Library section so instead I just disabled it, and enabled playlist trees for a nice folder structure.

    code )
    When we last left Gizmo they were moving and speaking. But I still wanted to wire up some of the original sensors. So I, eventually, dusted everything off and got started.

    I found, like my pi radio, I couldn't even boot up the pi, so I had to install Raspbian from scratch, and give Gizmo back all their functionality. I also discovered that in the meantime the Speaker pHAT board has been retired, but the library is still up on github.

    Then I could get on with the new work. Only two of the buttons remained, so I followed some tutorials on push buttons for raspberry pi and wired up the tongue button and belly button, with resistors.

    The space between a Furbys eyes contains an IR transmitter, IR receiver, and photoresistor, but I only wanted to use the photoresistor, so I followed a tutorial on light sensors for raspberry pi and wired it up with a capacitor on a mini Lilypad protoboard, because apparently raspberry pis don't have analog input read?!

    Then I shortened all the wires so they would fit inside Gizmo's shell, and trimmed various sticky-out bits on the inside of the carapace. Removed the back pet button lever, and widened the hole, to make room for the power cables to the raspberry pi and the motor shield. Squished all the bits and pieces inside the carapace, screwed everything up tight again. And finally, re-skinned Gizmo.

    Photos )



    Gizmo re-skinned, front
    Photo by [personal profile] chebe



    I got set up to take footage of the new Gizmo, and demonstrate how I am the real monster, when I noticed that Gizmo would speak, but no longer moved. Witness for yourself.



    I despaired. I re-opened Gizmo again. Noticed a strange chemical smell. I disassembled and rebuilt the gear mechanism itself, three times, in case there were bits of thread or plastic lodged somewhere. Another wire to the motor broke off (most of the original wires broke at some point during the build) and I resoldered it. Then I tried to test my work, and found that once again the raspberry pi wouldn't boot. I went back over my photos, followed the links from the first post to other peoples documentation on what the insides should be like in case I messed something up. And then I noticed it. Gizmo's left eyelashes are partially melted. Gizmo's left eye is where the original motor lives. Combined with the chemical smell, I realised something is very broken. Whether it's the motor itself, or the worryingly attached capacitors, I don't know. Maybe at some point I will conduct an autopsy and try to salvage parts. But right now I'm just feeling very dispirited. I'm sorry Gizmo, it almost worked.

    Part 1 | Part 2 | Part 3 | Part 4 | Part 5

    Pi Life, part two

    2020-Jul-11, Saturday 01:47 pm
    In Pi Life, part one I only got as far as making my raspberry pi functional again through upgrade. Now on to the script I want to put on it.

    After doing a project, and writing it up, I am usually too lazy to tweet my own blog posts, so I wrote a little python script to scrape my RSS feed and post a link to the most recent post to twitter. (For people who don't use RSS.)


    Step Two; create twitter app entry and get access tokens

    This part seems to change constantly, so here are some posts I used to help me along the way;
    https://www.digitalocean.com/community/tutorials/how-to-create-a-twitter-app
    https://iag.me/socialmedia/how-to-create-a-twitter-app-in-8-easy-steps/
    https://code.tutsplus.com/articles/creating-a-twitter-oauth-application--net-16614


    Step Three; create python script

    Assuming you have python3 already;
    pip3 install tweepy
    pip3 install feedparser
    pip3 install bs4
    pip3 install lxml


    And because BeautifulSoup can't seem to find lxml this way;
    sudo apt-get install python3-lxml

    Create a python script something like this (the exact code will depend on the structure of your RSS);
    code )


    Step Four; deal with errors

    My main error happened when I wanted to get an image used in a post. My images are self-hosted, Let's Encrypt signed. And the python3 libraries were not happy;
    ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)

    Now you can just turn off verification;
    response = get(img_link, verify=False)
    But you still get an annoying warning message.

    I tried so many different ways to try and fix this. This is the only thing I found that worked.

    First, go to Let's Encrypt Certs and save the Intermediate, Active, cross-signed cert. Remove the .txt suffix. Verify this cert fixes the error for you with;
    curl https://your_website --cacert /path/to/lets-encrypt-x3-cross-signed.pem
    If no errors, all good.

    Now, in python;
    import certifi
    print(certifi.where())


    Mine returns /home/pi/.local/lib/python3.7/site-packages/certifi/cacert.pem
    Edit this file, append everything in lets-encrypt-x3-cross-signed.pem to the end. (Leave a comment telling yourself what you did for future.) Save and exit. Rerun the tweeting python script.


    Step Five;

    Glory in the lack of errors/warnings. And automatically created tweets, I guess.

    Pi Life, part one

    2020-Jul-10, Friday 11:10 pm
    I often find myself between computers and/or OSes, but I have a script I want always available, so it has to live on a separate device, meaning not my computer. Until I get around to finishing up my Gizmo I guess that means my Pimoroni Pirate Radio.

    Step One: Update Pi Radio

    Um. Why isn't my password working? Okay then. Take SD card from Pirate Radio, reformat. Use shiny new Raspberry Pi Imager to install 'Raspberry Pi OS Lite' directly from computer. Put SD card in Pi, attach keyboard and monitor. Power on.

    Add wifi details to wpa_supplicant.conf, reboot, sudo apt-get update, sudo apt-get upgrade, sudo apt-get install vim, sudo vim /etc/hosts, passwd to change password, sudo raspi-config to enable ssh.

    Then following instructions here to turn the pi into a radio; curl https://get.pimoroni.com/vlcradio | bash, reboot when prompted.

    But, not everything has installed, see, at the end of the long install script it says;
    The VLC Radio installer
    does not work on this version of Raspbian.
    Check https://github.com//
    for additional information and support


    Hmm. Not entirely useful. So, checkout the git project;
    git clone https://github.com/pimoroni/phat-beat.git
    cd phat-beat/projects/vlc-radio
    ./setup.sh
    and reboot when prompted. Warning, radio will auto-play, quite loudly, don't do this late at night. But at least it's working again.

    For usage/updating see git project.

    Re-enable spoken ip address functionality, turn off, remove keyboard and monitor, turn on, and ssh in.

    The default playlist is now /etc/vlcd/default.m3u. Edit it to recreate station playlist. Or create /home/pi/.config/vlc/playlist.m3u, which is checked for existence first.

    Okay, so now I'm back to where I started, and haven't managed to do anything I wanted to yet. Yup.