fogbound.net




Thu, 16 Jan 2025

Backups

— SjG @ 10:34 am

So, computer folks always talk about the 3-2-1 strategy of backups: have three copies of your data, stored on two different types of media, with one geographically separated. They also like to repeat slogans like “if you have one backup you have no backups.”

For years, I’ve relied on Time Machine, the backup system Apple includes with their operating system. It not only provides a backup, but it keeps multiple versions of files, so if you, for example, accidentally clobbered your book manuscript by searching and replacing a badly-chosen term but didn’t notice for a week, you could go back to the version you had backed up last week. I felt like I was doing a pretty good job of securing my data: I back up onto an external drive at home, and I also back up on an external drive at the office, a little over 1km away. These external drives are encrypted, so if someone were to break into either place and swipe a drive, they’d have the hardware but not my data.

A few years ago, I also added another layer of redundancy: an encrypted cloud backup. I hadn’t liked the cloud backup services I’d seen before, because all of my files would be on someone’s machine where I had no control over them. A screw-up on the part of a system administrator somewhere could make my files available to the open internet! However, a bunch of new services started offering encrypted backups, where the encryption happens locally and the service doesn’t have view into your files other than it’s a big chunk o’ data (more on this later).

To make a long story short, I tried a few services, and went with Backblaze (disclaimer: that’s an affiliate link, I get credits if you follow it and subscribe. You can always avoid that by going directly to https://backblaze.com).

Fast forward a few years. A friend who’s not particularly computer savvy needed help with some IT stuff. They had an external hard drive connected to their machine and used Windows backup, but the process had silently failed a year before. In diagnosing and fixing this, I also convinced them to pay for and use cloud backups.

This friend lost their house and everything in it during the wildfires last week. Among the long list of things that they didn’t have time to grab before evacuating was that backup hard drive. Cloud backups to the rescue! I was able to download all their files for them.

The surprising scope of the fires also brought one thing into sharp focus: my original strategy of “one backup at home and one at the office” is really insufficient. One kilometer’s not far enough away! Having a remote backup somewhere is an important part of backup plans.

I mentioned above that encrypted cloud services like Backblaze have no visibility into your data. This is not completely true. If you use their encryption scheme, the data is encrypted on your local machine before the data is transmitted over the network. So it’s true in normal operations that there’s no way for them to see the contents. However, when you use their interface to restore files, you need to give them your encryption key so they can identify which file(s) you wish to restore. That means the data is (at least temporarily) decrypted on their servers. When I did a full restore of my friend’s files, I provided the key and they generated a zip file for me to download. That zip file was not encrypted. They say it’s on their server for only a seven days, and I don’t have any reason to distrust them.

I want my data encrypted when it’s backed up because I have financial information like account numbers, etc, that could be abused. That these could exist as clear-text on someone else’s server for short periods of time is not ideal, but it’s also a pretty minimal threat. That being said, if you are involved in journalism, political activism, or other activities where your information could impact people’s lives, this may not be the best solution.


Sat, 7 Dec 2024

Mysterious Crossword

— SjG @ 4:05 pm

In the so-called Golden Age of Detective Fiction, there was a group of four or five writers considered the Queens of Crime: Margery Allingham, Agatha Christie, Ngiao Marsh, Dorothy L. Sayers, and Josephine Tey. Christie gets most of the glory in the US due to the Hollywood adaptations of her novels, but recently I’ve been reading through Sayers’ Lord Peter Wimsey and Montague Egg mysteries.

Anyone who has read Christie (even the modern, bowdlerized versions) knows they’re chock-a-block with racism, classism, and antisemitism, and, sadly, Sayers suffers from this as well. Unlike Christie, Sayers brings to bear her Oxford education, so her novels and short stories contain frequent allusions to and excerpts from writers ranging back into classic Greece and in a variety of languages. Like Christie, the plots are convoluted with any possible suspects and countless red herrings.

In her 1925 short story, “The Fascinating Problem of Uncle Meleager’s Will” (originally published Pearson’s Magazine, volume 60), Sayers includes a full crossword puzzle that Lord Peter Wimsey and his associates must solve to locate the referenced will. Normally, I let this kind of story just wash over me. I don’t try to solve the murder and I don’t try to analyze the clues. But in this case, I thought I’d try to solve the crossword.

Of course, British crosswords are different than the NY Times style with which I’m more familiar. Furthermore, the number of classical references quickly overwhelmed me. I wasn’t able to complete it. But maybe you will? I took the layout, clues, and solution and laid them out in a convenient PDF for your puzzling pleasure.

Filed in:

Tue, 3 Dec 2024

PHP’s “boolval”

— SjG @ 1:24 pm

Everyone loves to dump on Javascript because of stupid things like [] == ![]; // -> true. Some languages are much better at this. But PHP is not among them. I found the following not quite what I would have expected:

boolval("1");   // returns true
boolval("0");   // returns false
boolval(1);     // returns true
boolval(0);     // returns false
boolval("00");  // returns true
boolval("0.0"); // returns true
boolval(0.0);   // returns false

Mon, 2 Dec 2024

Docker Desktop on Intel Macs

— SjG @ 12:59 pm

I had a database corruption event happen in a Docker container, one result of which was that the container was completely wedged and unusable. I spent a lot of time removing containers and images and recreating them, only to have the same problem. In my case, the symptom was I’d create a new MySQL database, and operation would be fine, until part way through a bulk data import or heavy query, and the database would crash and the container would get into an unusable state again. Docker didn’t yield anything in the log, but MySQL showed corruption:

2024-11-27T22:35:38.182396Z 8 [ERROR] [MY-013183] [InnoDB] Assertion failure: os0file.cc:2899:dir_fd != -1 thread 140305764447808
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
2024-11-27T22:35:38Z UTC - mysqld got signal 6 ;
Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.
BuildID[sha1]=511ab47ad6d5dfd73d58eea5860b1c9c9a97ce07
Thread pointer: 0x7f9ad4000fc0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 7f9b7b3febc0 thread_stack 0x100000
/usr/sbin/mysqld(my_print_stacktrace(unsigned char const*, unsigned long)+0x41) [0x15af021]
/...

Once this problem occurred in a container, the database wouldn’t be start-able, often complaining about being unable to update permissions on /var/lib/mysql/mysql.sock.

Eventually, with much futile searching, I found this posting and switched Docker Desktop away from using VirtioFS to using gRPC FUSE for sharing the filesystem between the container and the host machine. This seems to have resolved the issue. I can load big databases again, and heavy transactions work in my development environment again.


Sun, 24 Nov 2024

Holding on to Hardware

— SjG @ 11:19 am

My cousin sent me a box of old photos that she had inherited from her mother. It turns out that my mother and her mother would send photo albums to one another throughout the late 1960s and into the early 1980s.

Many of these pictures are interesting to me, and I’d like to digitize them. The average online service wants between $0.65 and $1.25 to scan a print without doing touchup. I’ve used services to scan negatives in the past, but I have an old phot scanner and I have digital cameras that I could use to take photos of the prints.

The prints are degraded to various degrees and many are not really flat, so my first thought was to put them under glass and photograph them. I set up a rig to do that, but it was pretty finicky. Lighting to prevent reflections isn’t easy (I’m space-constrained by boxes of old junk in my office). The prints are many different sizes, and positioning each one took a lot longer than I wanted to spend on it. I don’t really need these in 12 or 24 megapixel detail, plus my macro lens is old and introduces some distortion.

So I decided to use my old Epson Perfection Photo 3170 from … ulp … 20 years ago. It’s USB-A and my current M1 MacBook only has USB-C ports, but I have plenty of USB-A to USB-C adapters for this kind of situation. I plugged the scanner into my M1 MacBook, but it was not recognized. I downloaded a new driver from Epson, but it wouldn’t install, giving me the helpful message “You can’t open the application “EPSON Scan Installer” because this application is not supported on this Mac.” Is that because it’s Intel code and I can’t run drivers in emulation? I have no clue.

I tried downloading VueScan, which is widely recommended for scanners where the driver is no longer provided, but it couldn’t see the scanner either. Mysterious. I’m beginning to think it’s something to do with the hardware itself. It used to work. Had the scanner died from sitting neglected?

I dug through one of those aforementioned space-constraining boxes of junk, and got out my Intel-based MacBook Pro from 2011. I powered it up, plugged the scanner in, and Image Capture immediately recognized it. So I’m scanning on the old machine.

Image Capture under old Mac OS is a little annoying, but I can scan 4 photos at a go into 32-bit TIFF files. I’m only scanning at 600dpi, so I’m getting roughly 6 megapixel scans of these photos. I considered scanning at a higher resolution, but the time and effort and storage involved didn’t seem to be worthwhile. I may regret this someday.

Anyway, here’s a birthday cake I decorated for my best friend Charlie back in March of 1978.