Shaving Yaks, I Mean Lint

It’s been a while, I am a little bit sick, and a little bit antsy, so y’all know what that means. Yes, a new hobby to take up all my time another blog post!

So much has happened such a I last wrote, there is a whole additional person in my house now, but I’m not quite ready to write about that. I mean, I’m not sure I am entirely ready, period. Regardless, it is a joyful and difficult time. Between all these life events I’ve managed a little bit of tinkering and a few little updates to the home network, so let’s dive straight into it.

New Baby, New Server, New Services

As you may be aware I’ve traditionally had quite a few VMs, baremetal servers and other ephemera kicking around the web, but recent increases in costs, changes in cloud services ToCs and general overhead has led me to consolidate and localise much of my digital empire. So, the other new child in the house is this little fella:

It’s not much but it is enough for what I need without breaking the bank or my power bill, key specs are:

  • Intel i3-13100
  • 32GB DDR4 (would’ve liked ECC, but y’know, $$$ [Asrock pls 🥺])
  • Two 512GB SSDs in RAID1 with btrfs (we’ll see how long my daliance lasts)
  • Ubuntu Server 22.04

First time in a long while I’ve not built a server which uses ZFS, but it looks like Ubuntu has deprecated official support of it as a boot filesystem which is a dang shame. I mainly want btrfs for snapshot support while I play around with some alternative service management options but I’m not enamoured with the quality of the docs so far.

Anyway, what did break the bank was ballooning my NAS capacity, which is sitting at a healthy 62TB right now. Now, not all of that is critical, I can re-source most of my… Linux ISOs from primary sources, but I still have around 4TB of data which needs to go offsite for backups. With Google’s (and now Dropbox’s) dropping of UNLIMITED drive capacity I need to consider some alternatives as well as pruning what I consider to be critical data. Most likely it’s going to be Backblaze. For the rest of the extended family they live in iCloud now. It was either that or permanent loss of my sanity.

Now, before this new server I’ve never really mucked around much with docker and containerisation. The closest I’ve gotten is with LXCs on Proxmox, and I never really saw the point of adding this intermediate layer and all the additional complexity of networking and volumes et al. After experimenting a bit and making my life easier by using Portainer I can kinda see the appeal now, especially compose stacks. With a week of tinkering most of my services are now self-hosted and summarised with this delicious dashboard:

Pretty slick, eh? It’s even passed the spousal approval test of being used by them. I’ve recently added a few new services which I need to place onto the dashboard, so what you see here is not the current state of the nation. Overall I’m happy with my new network and hosting setup. Just don’t ask me about managing container updates, yet.

Routing and Cloudflare

As a quick note I don’t think I’ve mentioned I’ve transitioned away from UniFi for routing and now run a virtualised pfSense router on Proxmox and a whole lotta VLANs. Using some mildly cursed adapters I’ve wrangled two network cards onto a mini-ITX system I had laying about, which are passed through for pfSense. I still have UniFi for my switches and APs, at which it does a perfectly cromulent task.

For some of my home services I’ve got direct access with Nginx through my public IP, but in my docker adventures I’ve tried out Cloudflare tunnels, and I must say I am very impressed with how slick it is. For now I’m using it for some low traffic sites I host for friends and family, but it will definitely be an option in future for things I want to expose to the public net.

Neatest Self-Hosted Service

Whenever my partner lectures at the University there is inevitably an explosive growth their usage and manipulation of PDFs, which usually leads to me having to do some merging and compression. I used to have a little stack of ps2pdf scripts running on WSL and watching a network share in which they would just plonk all their files, but a much more elegant solution is Stirling PDF. A quick little docker-compose and it’s happily running on the home network. If you need to do a lot of PDF manipulations I really do recommend it.

USB-C Non-Compliance

Now for something completely different. There is nothing that quite grinds my gears like non-compliant USB-C devices. USB-C, like The One Ring, promises one connector to rule them all, unfortunately, like The One Ring, it is also cursed. Case in point, this over-priced, ostensibly “USB-C” rechargeable lint shaver:

It will only charge when you use a USB-A to USB-C cable, it will not charge from any standard USB-C charger or port. Why is this? In short, non-compliance to the standard. In longer, keep reading.

USB-C, like most great standards, was built by committee and rests upon a slowly decomposing corpus of backwards compatibility and features forced in at the last second. If you ever feel like taking some mild psychic damage, take a look at the USB-C and PD spec docs. Yeah, it’s more than 1000 pages, have fun.

Before we continue, let’s step back to how ol’ USB-A delivers power (specifically 2.0). You get 500mA at 5V, that’s it, but you don’t have to do anything special to use it, just tap straight into the positive and negative lines. Want more? Tough luck, the host will shut you down, unless it’s post 2007, in which case if the host device supports it, you can put some resistors on the data lines which will let the host provide you with up to 1.5A at 5V. This is the best that USB 2.0 can do. USB 3.0 offers some trivial improvements, but USB-PD with USB-C is where the juicy business starts.

A proper USB-C PD port is basically a programmable PSU which, as of the latest revision, supports seven voltages from 5 to 48V up to a maximum current draw of 5A. That’s a lotta juice, so how does the USB-C host decide what to provide? Well, this is where it gets complex as the 800+ page standard implies. A USB-C port has two CC pins (one for each side) which checks what it is connected to and what it should supply. This starts with an analogue process which checks for pull-down resistors on the device side, 5.1kΩ to be exact. If the CC pins are not connected, a USB-C upstream device will not provide any power whatsoever. If they are connected, the downstream device will assess the voltage over these resistors to determine what is the maximum current draw that the upstream device can support at 5V. This sounds complex, but it gets complexer. A digital handshake can supersede the analogue first step to negotiate higher voltages and current supply as needed.

Luckily jellybean ICs which cost literal cents do all this for you in cheap consumer hardware. Cheap ICs which the manufacturer of the abovementioned lint shaver decided to skip. If we take a look at the connector, it has the bare minimum needed to negotiate for power, it has a ground pin, a CC pin, and VBUS+ pin (this is mirrored on the other side as required for rotation support). They even skimp the second ground pin on each side, but that shouldn’t be too much of a problem.

What is a problem is that the CC pins are left floating, happily connected to nothing at all. This means that any USB-C power adapter will never supply any power whatsoever to recharge this thing. I would love to show how I fixed this by soldering some pulldown resistors to the floating pins, but wouldn’t you know I’m fresh out of 5.1k resistors of any type. Sigh. Next time.

Worklife

I’m ostensibly a senior data scientist now. It seems nice, but I need to get my feet under me after very extended leave, and doing weird things with PowerBI and SQL seems to be thing for that right now. What isn’t helping is a semi-persistent respiratory issue I’ve been having the last few weeks, I’m even back on inhalers but that didn’t stop this workweek from being cut short.

I’m quite happy to have gotten a relatively clean break from product owner responsibilities, I like to think it’s a testament to things I helped put in place with the team but ultimately it was a group effort. Regardless, it is still nice to help that team from time to time when they have some gnarly product issues.

Last Bytes

That’s about it for now. I still need to get around to reviewing the Zephyrus G14, but just accept for now it’s real good and I use it a lot. Oh, I also finished my home solar power install, but that’s a story for another time.

P.S. If you don’t know what a lint shaver is, either you have made a wonderful new discovery or your life is sadly lacking in woollens.