A New Laptop, a Vue Switch, and a Session Proxy That Misbehaves

Most of this week went into unboxing and configuring a new ThinkPad T14s AMD, which explains the shorter update. Once the machine was running, I also moved a bit of front-end code from Stimulus.js to Vue.js, and started chasing down an issue with the Go-based SSH proxy that fronts my dev VMs.

Reinstalling, Not Upgrading

My usual setup workflow is fairly ritualistic at this point, having done it three or four times over the last few years. The core idea is to copy the entire home directory over to the new machine so all configuration comes with it, and to always reinstall the OS from scratch rather than upgrading in place. I tried breaking the upgrade rule once this year and it failed so spectacularly that I'm not tempted again.

On the old computer, before packing it away:

  1. Back up the home directory with cd /home; sudo tar -cf - bork | pv | /media/the_drive/homedir.tar; the pv step is essential because the copy takes a while and I want a progress bar.
  2. Dump the package manifest with sudo dpkg -l > /media/the_drive/packages.

Then on the new machine:

  1. Install Ubuntu LTS with disk encryption, letting the installer take over the whole drive.
  2. Restore the home directory with cat /media/the_drive/homedir.tar | pv | tar -xf -.
  3. Review the dpkg -l output manually and pick out the packages that are still needed, writing them into a file like to_install. This is a deliberate step since the old machine tends to accumulate packages I no longer need.
  4. Install with cat to_install | sudo xargs apt install.
  5. Fill in whatever was missed over the next few weeks as it comes up.

I used to keep home on a separate partition to make reinstalls easier, but stopped doing that for reasons I can no longer recall. This approach is not claiming to be optimal, just reliable for me.

First-Day Laptop Gripes

The usual crop of new-machine issues showed up: closing the lid doesn't suspend yet, vim configuration is slightly off, and the desktop's top bar looks wrong. Also on the list is a Yubikey Nano I picked up, hoping to set up PAM so sudo no longer needs a password. The vendor's instructions are not working for me, so I used the opportunity to learn a little about PAM and bought Michael Lucas's Pam Mastery book for the debugging context. It got me better error output, but the root cause is still unknown.

Trading Stimulus for Vue

One actual code change this week: my site was using a little Stimulus.js, and I wasn't happy with how conditional visibility is handled. Showing or hiding a div based on state meant manually fiddling with CSS classes, e.g. this.pendingDiv.classList.add('hidden').

Since Vue.js handles that declaratively and I already had some experience with it from smaller projects, I switched over. It feels like a better fit.

SSH Proxying Trouble

While testing the newly written Vue code, it turned out the front end was fine but the back end had a problem. My setup for proxying SSH connections to VMs looks like this:

  • A Rails app starts one gotty process per SSH connection, each on its own port.
  • A second, roughly 100-line Go proxy accepts requests at /proxy/SSH_CONNECTION_ID and forwards them to the correct gotty port.
  • That proxy looks up the port by hitting an endpoint in the Rails app.

The whole arrangement is messy and flaky: gotty processes occasionally do not start cleanly, there is no real process management, and I'm permanently worried about them dying. Fixing that architecture is next on the list.