Good Morning from my Robotics Lab! This is Shadow_8472, and today, I am going over the new official Raspberry Pi operating system and producing a custom image I can deploy in case I ever need a clean install. Let’s get started!
Raspberry OS Review
BlinkyPie is my Raspberry Pi 3B+ with a Pacman ghost case I printed and finished myself (with help). It’s supposed to eventually host an OpenCV powered feline deterrent system I’m still aiming to deploy some day. Today, I’m starting by installing the new official operating system for all Raspberry Pi’s: Raspberry Pi OS on a fresh MicroSD card.
Installation was fraught with several simple mistakes. My proper procedure is to: 1. Have an empty MicroSD card. 2. Download the OS image (over a WIRED connection) and verify it with its hash. 3. Quarantine the image and SD card on a computer I don’t mind rebuilding (no sdX other than the target SD in an adapter, internal MicroSD is mcblk0). 4. dd the image to /mnt/sdX. 5. Boot the image. 6. If it doesn’t work, lower the bit rate for the dd command (yes, it saved the project this time).
I didn’t skimp on resources this time: I got the full desktop image with recommended software. Long-term, I’m figuring it will be easier to maintain. Since I’ll be using this image over and over several times, I took a day or two to do things like localization settings, a lefty mouse, enabling SSH, and customizing the UI.
I’m looking to move away from using default, non-root accounts. Raspberry Pi OS (I’m just going to call it rPiOS from now on, if that’s okay) and Raspian before it come with one called ‘pi.’ To change it, I had to first enable SSH, log out any and all sessions for the pi user, and change over the account and home directory names — preferably without logging into the GUI as root and creating a bunch of normal user files.
I poked around rPiOS without an agenda for a bit. There was always the games folder I never paid much attention to before, so I checked that out. Of special interest were the collection of simple Python games. They had no fewer than three Tetris clones, a normal one, one with one block pieces, and one with five block pieces, like the original Soviet precursor. The five-block per piece game runs a little fast, so after some time, I realized I’d like to try and slow it down a bit. I also found a “Bookshelf” where you can read up on Pi projects. It also came preloaded with a bunch of programming tools. I know it should be obvious, but rPiOS is built for learning. It has just enough there to be plug and play for a browsing machine, I know the Pi3 chugs a little under watching my church’s Livestream on Sabbath mornings, but it should be more than enough computer for anyone without serious computation needs.
A Small, Custom rPiOS Image
I have to admit, this week’s topic was a node for a much larger project I’ll be covering next week. Suffice it to say, I’m in a position where I may need to reinstall rPiOS several times in rapid succession. That is why I’m making an image file.
Once I had tweaked rPiOS mostly to my liking, I shut it down and brought the card over to my Manjaro Pi 4. dd was not happy with me making backing up my MicroSD to a 1 TB external hard disk for some reason. Everyone helping me seemed sure it was corruption on the MicroSD card. As much as I respect their advice, I can’t help but be skeptical this time. It’s a new card with low usage so far. It boots fine, and I was trying to copy between two devices on the same USB 3 component. I’ll file this away as mystery unsolved for the time being, but for whatever reason, it confused BASH to the point where ls wouldn’t work with relative paths until I changed directories.
I eventually used the internal rPiOS card duplicator and made a physical copy over top my RasPup install. I tested it, and It booted normally. Moving things back over to the original card, I followed a tip I found in this video and used dd if=/dev/sdX | gzip > imageName.gz to make a compressed copy of my pi SD directly on itself. I copied it over the network with scp, and unzipped my image.
Now, many guides on rPi backups invoke partition tools I’m still too scared to touch, especially on a timeframe. That’s why I downloaded and used PiShrink, a shell script available on GitHub that downsizes your Pi images so you’re not saving empty space in storage — or even worse: transmitting it to a friend. Apparently it’s popular for use with RetroPi, a Pi distro for emulating old games.
My MicroSD cards are 32 GB each. My final image is down to 9. If I had more time, I may try again without the default desktop background, since I’m planning on never using it, and I think my custom desktop image is a good chunk of the added size.
Final Question:
What useful finds have you made when looking for something similar?