ugly surprises with raspbian buster and external file systems


A while back I wrote about adding an SSD to a Raspberry Pi 4 and modifying /etc/fstab so that it would automatically mount when it booted. This is different than having it automount through /media/pi, since that type of automount only occurs after the OS is fully up and then scans for attached devices, such as those on USB. For nearly all use cases you can’t tell one from the other. But for those very few use cases where you need the kernel to mount the attached storage device before the rest of the system comes up, you need to define it in /etc/fstab.

That wasn’t a problem with Raspbian Buster up until just recently. Before that time, I had an entry for my SSD in fstab that started out like this:

/dev/sda1 ...

It worked just fine, until one day after a recent update that included the kernel, it didn’t. No warning that this was going to happen, none at all. After the update and subsequent reboot, the Raspberry Pi refused to boot, and instead dropped me into a prompt waiting for me to log in as root to fix the problem. Oh, wait, root is disabled by default in Raspian, so that just put me in an endless boot loop.

It took two attempts rebuilding a minimal boot micro SDXC before I finally figured out what was happening. Fortunately, that second micro SDXC card was a new one with a minimal Raspbian system, so it didn’t take too much effort to see that adding the entry to /dev/sda1 was causing it to fail to boot. Fortunately for me I have other Linux systems (my ten-year-old Samsung R580 running Ubuntu 18.04.04 came to the rescue) that allowed me to mount both micro SDXC cards, edit fstab and remove the entries. Once removed, both micro SDXC cards booted just fine in the Raspberry Pi 4.

Once I got back in I enabled root with ‘sudo passwd root’ and gave it a password. Now, if I have a problem where a Raspbian boot failure wants to dump me into the root account in single user mode, I can actually log in at that point.

The other problem was getting the USB SSD to mount. Here’s what I did to fix that. But first, a tiny bit of background.

The kernel in Raspbian buster uses what’s now known as a PARTUUID to identify a storage device instead of the old school device name in /dev. To find out what that PARTUUID is, you have to run this command at the command line in a terminal window:

pi@rpi4-4-01:~ $ sudo blkid
/dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="69D5-9B27" TYPE="vfat" PARTUUID="d9b3f436-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="24eaa08b-10f2-49e0-8283-359f7eb1a0b6" TYPE="ext4" PARTUUID="d9b3f436-02"
/dev/sda1: LABEL="SSD" UUID="ad89d540-a007-4d0a-887b-0b0dbefe3e8e" TYPE="ext4" PARTUUID="937a0120-01"
/dev/mmcblk0: PTUUID="d9b3f436" PTTYPE="dos"

Since I already know the label on my SSD is “SSD” it’s quickly identifiable in blkid’s output. Copy the PARTUUID at the end of the entry, and use that in the fstab entry for the drive, like so:

PARTUUID=937a0120-01 /ssd ext4 defaults,auto,users,rw,nofail,x-systemd.device-timeout=30 0 0

Note that the quotes are not added to the entry. Also note all the flags I use, especially the shortened timeout (systemd.device-timeout=30) to shorten the wait during boot in case the SSD isn’t plugged in. The default is 90 seconds.

The primary reason I want the SSD mounted is because that’s where I put swap. In /etc/dphys-swapfile I add the following line:

# where we want the swapfile to be, this is the default
#CONF_SWAPFILE=/var/swap
CONF_SWAPFILE=/ssd/swap

I want my swap on the SSD because testing has shown the SSD is an order of magnitude faster than the boot micro SDXC. I use the Raspberry Pi 4’s as development and native build machines, rather than set up an emulation and cross-compile tool chain on my Mac. Believe it or not, it’s a lot simpler the way I have it set up. This is a decent compromise that doesn’t require me to put the entire OS on the SSD and then configure the Raspberry Pi to boot off the SSD. There are some significant problems with that, such as the Rasberry Pi 4 wasn’t set up to do that for quite some time after its release, and the fact that once configured that way, you can’t go back. So I put swap on the SSD, then cd onto a work area on the SSD and develop and build away.

This all gets back to the bigger question: why did this change, and when did it change? I use the same type of setup, and the same SSD, on the Jetson Nano, and it’s running a tweaked version of Ubuntu 18.04.04, complete with the Ubuntu graphical desktop. The fstab entry for that is the regular device entry, /dev/sda1.

Oh well. I just keep reminding myself that this is just a hobby, and I’m retired.

walking with my dad into his future

Lost

I traveled to Atlanta this past weekend to visit my 87-year-old parents and to spend quality time with them. As a newly-minuted retiree I now have far more time to make such trips and for longer periods of time. Which isn’t to say I’ve not been up to visit before now, but with the restrictions of work and other issues in Florida, it made scheduling to visit more complicated and the trips much less frequent than they probably should have been.

And now I’m in the midst of watching my father fall to dementia. My uncle, his younger brother, died from Alzheimers in the early 2010s. My uncle’s fall was swift and brutal, less than two years from diagnosis until his death. Now my father appears to be in its grips, although his progression is slower. There are periods in which it seems to be abated, such as this visit. Or so it seems to an outsider looking in. My mom is his caregiver and has the unenviable task of watching over him constantly as well as watching him…

My mom isn’t alone in this. My brothers and sister are living in Atlanta, and all of them lend a hand, especially my older brother and my sister. And my sister is very close to my mom (just like my daughters are with my wife), so there’s that. Buy my mom misses me very much, as does my dad. And when I travel up to visit I do odd jobs around the house for her, and she sits and talks with me while I work. Before I left I set up out iPhones so that my mom can “see” me with the Find My app, and I can keep an eye on her and my sister back up in Atlanta. My mother found solace in watching me travel down Marta from Doraville back to the airport, and then saw I’d made it back home to Orlando. I text and email and talk to her constantly, but Find My seems to give her that little bit of extra comfort that she can see and reach out to a specific location. Where I’m at isn’t abstract anymore.

My dad when he was 78

Over the years while he’s been in retirement I’ve made the trip up to visit my parents. I have a photo from January 2012 that is a reminder of what he once was.

This photo shows him smiling and happy, especially to see me. He loved me very much (he loved us all equally) and he was always glad to see me when I came home. We were upstairs in his home office at the time and I was talking to him about the Olympus E-P2 with the 45mm f/1.8 lens, and as I was demonstrating it I just lifted the camera up and grabbed this quick photo. Nothing planned. Later we went into Conyers and walked around taking photos like a couple of tourists.


That’s my father with his Olympus E-300 and kit zoom. My father was always the avid photographer, going back to when I was a little kid. He got me hooked on photography, helping me get my very first 35mm camera, a Yashica Electro 35 rangefinder. Later in the 1970s he used nothing but Olympus, starting with one of the first OM-1 film cameras to be sold in Atlanta. Over time he purchased every version of the OM series, from 1 to 4, along with a number of lenses and the Olympus flash kit. He was pretty good photographing orchids, which he raised in his greenhouse out back. Back around 2015 he gave me one of his last OM purchases, an OM-4T. I have it in on of my bookcases, kept carefully clean. I pretty sure it still works, even as old as it is. But I’m afraid to take it out for fear I might damage it, or worse, loose it.

That greenhouse is still out back, but it’s a shadow of its former self. My older brother still tries to keep it up, but where it once was crammed full of beautiful orchids, it now is pretty empty, and most of the pots that once held many an orchid are empty and piled up in back of the greenhouse. My dad doesn’t go into it any more, and hasn’t for some number of years. The path from the house to the greenhouse entrance, while quite short, is steep and difficult for him to navigate without fear of falling.

This year is going to be far different than any other up to this point in time. I have no idea where the journey will end, and refuse to think on it too much. But the keywords for 2020 living are going to be focus, calm, and supportive. Most importantly, providing as much strength as possible for the family, especially my mom and dad. Especially my mom.