Minimizing I/O when migrating from Virtualbox on Veracrypt to Proxmox on ZFS

I’m moving large-ish (half-TB or larger) files between hosts. It’s important to avoid extra copies in this workflow, since each pass over one of the larger files to read the whole thing (and there are several of them) takes hours. I managed to decrypt VM disk images, transform them from one disk image format to another, copy them from one host to another, calculate SHA-256 hashes on both sides to verify data integrity, compress and encrypt them on the destination, and to display a progress bar, all without any additional copies. One big block-device read on the source end and one big block-device write on the destination end is all of the disk I/O that’s happening.

See below for how I did this.

Continue reading “Minimizing I/O when migrating from Virtualbox on Veracrypt to Proxmox on ZFS”

Another virtue of the 2010-2017 13″ MacBook Air family: easily replaced main battery

If you weren’t already convinced that the 13″ MacBook Air of the 2010s (specifically, the form factor that started in 2010 and ended in 2017) was one of the greatest laptops ever made, allow me to heap additional praise on it now.

The process of replacing the built-in battery with a new one is very easy: Unscrew and remove the bottom cover, unplug the battery cable, unscrew and remove the old battery. Insert the new battery and secure it with screws, plug it into the motherboard, replace the bottom cover and secure it with screws. That’s it. This is only a tiny bit harder than swapping removable batteries in a Thinkpad was, back in the late 1990s when pretty much every laptop had removable batteries.

iFixit has the instructions and the replacement battery part, which can optionally be ordered with a repair kit that includes the weird pentalobe screwdriver tip and a teeny T5 torx tip, with a screwdriver body that can use them.

Solved: Ubuntu 20.04 update makes boot time increase by 4 minutes

I’m doing software development on an Ubuntu 20.04 VM running on my MacBook Pro via Parallels Desktop 17. I recently noticed that the “Software Update” app in the Ubuntu desktop machine was saying there were a lot of things to update, which makes sense since I just created this VM a couple of months ago via a fancy Ansible playbook, and I haven’t gotten around to updating it until yesterday.

Well, after the update, it started taking a really long time to boot. There were two places where it hangs for 2 minutes for no apparent reason, meaning that the boot process is about 4-1/2 minutes long.

I’ve figured out what happened and found a workaround, but I’ll mention a few of the things I looked at along the way since they’re sort of interesting and may be relevant if your issue is similar but not caused by the same thing.

Continue reading “Solved: Ubuntu 20.04 update makes boot time increase by 4 minutes”

I wrote a brute-force solver in Ruby for the combination-lock puzzle

I wrote a brute-force solver for the “Can you crack the lock code?” / “Can you open the lock using these clues?” puzzle.  Apparently there are a few slightly different versions:

On Puzzlebrain.com, rule 5 contains 7-8-0.

On Puzzlersworld.com, rule 5 contains 8-7-0.

In the one I saw (in a friend’s Facebook post), Rule 5 contains 3-8-0.

The puzzle states that for a 3-digit combination lock, where each
digit is a value between 0 and 9, the following clues are known
about certain combinations:

6-8-2 “One digit is right and in its place”
6-1-4 “One digit is right but in the wrong place”
2-0-6 “Two digits are right, but both are in the wrong place”
7-3-8 “All digits are wrong”
3-8-0 “One digit is right but in the wrong place”

It has been years since I last wrote Ruby code professionally, but I
really enjoyed using it, so I decided to dust off my rusty Ruby
skills today and write a concicse, fairly idiomatic program to
brute-force a solution to this puzzle.

Here it is: https://github.com/JamieFlournoy/Lock-Puzzle-Solver/blob/master/lockpuzzle.rb (There are instructions in the top of the code for how to run it on your computer or in a browser-based Ruby interpreter.)

If you’re curious about the different versions of rule 5, you can edit the code to try those different variations. In fact, why not try commenting out the code where it tests rule 5, to see what the results are when rule 5 doesn’t apply at all? ;)

OTP codes from Mac not working due to Mac clock running fast

I’m a fan of Time-based One-time Password, aka TOTP, as a means of Two-factor authentication. I’m also a fan of the 1password password manager, which I have set up to sync between my various devices: a laptop Mac, an Android phone, and an iPad. A nice feature of 1password is that it will act as an OTP authenticator, if you store the TOTP secret (either copy-pasted as text, or scanned as a QR code that decodes to a URL containing the same text) alongside your password info. So if I’m lying in bed with only my iPad nearby and I need an OTP code to log into something, I don’t have to get up and grab my phone to get it from Google Authenticator. (I do also have the OTPs in Google Authenticator though.) More importantly, this means that none of my devices is a single point of failure; if my phone is stolen or dies, I can still get into stuff because I have the secrets synced to multiple devices, encrypted in transit and at rest by the password manager.

But, this all stops working when your Time-based OTP is generated on a Mac with a clock running over a minute fast!

Continue reading “OTP codes from Mac not working due to Mac clock running fast”