Some Bits: Nelson's log

110 posts in 2024

Adobe malware with Chrome cooperation

The fuck is this?

Adobe somehow managed to install itself as an extension in my web browser giving itself permission to read and change all your data on all websites. Without my consent or cooperation. And Chrome just allowed it.

Fortunately some other part of Chrome was like “hold up, that’s not right” and warned me about it. But only after it was installed. Again, the fuck is this?

Meanwhile, the essential security and ad blocking software I rely on is being crippled by Chrome, ostensibly for security reasons. They allow Adobe to do this bullshit and don’t allow me to let uBlock Origin do the same thing even when I explicitly install it.

This is where I remind you that Adobe software, in particular Acrobat, has been responsible for more security intrusions in web browsers than pretty much any piece of software out there.

The current Adobe Acrobat on Windows is just awful btw. They invented some new UI toolkit that doesn’t look like any other Windows app. It also doesn’t work, the process of trying to save a file to a directory is particularly awful.

Why is this possible?

Update: a friend who used to work on Chrome commented that this is a long-standing challenge with Chrome. The Windows browser allows other apps to install extensions by dropping a folder or file in the right place. That makes sense, there’s lots of scenarios where that’d be a good idea. So Chrome may be doing the right thing here. My only quibble is the UI could be clearer, maybe “Adobe attempted to install this extension, would you like to allow it?” The way it is written now looks like it was fully installed even though as a disabled extension, it wasn’t really.

Adobe though, they can fuck right off. Acrobat is so aggressive about subverting your Windows machine. It’s gotten worse in Windows 11 now that Microsoft has made file associations so difficult. The legitimate freeware I want doesn’t really install itself as a file handler correctly but Adobe of course is paying a whole team of geniuses finding new ways to worm its way into your operating system.

Google Timeline shutdown, data preservation

Google Timeline is one of my favorite lesser-known products, a detailed place by place diary of everywhere I’ve been with my phone for the last eight years. Unfortunately they are shutting down the web product and replacing it with a mobile-only product. The deadline is December 8, in five days. I’ve been putting off figuring it out until now. These docs were helpful as was this article and this one.

Update: after some evaluation, the new mobile product is fairly nice. It’s a comprehensive thing inside Maps, it’s not an afterthought. It does have reasonable data export. When I first wrote this post I was cranky at the change and my view has softened some since.

Migrating to new Timeline mobile

The first thing I did was use Google Takeout to download all my old timeline data from the web application. A timeline-only archive was fast, just a few minutes, and a 50MB download. It contains a lot of data but what I wanted most was the single JSON file with my GPS history in it. (The rest of it are the semantically analyzed files: very useful but not as cool).

The other thing I did was to migrate to Google Timeline on my phone. That’s the only option now, and it’s not as good as the old web application. But it’s what they have.

The migration was relatively simple. Once I disabled my Private DNS ad blocker, that is, with it enabled the app would not get past one stage of the signup process. No error, just a refresh.

To set up mobile Timeline you have to launch Google Maps on your primary phone, find your way to the Timeline part of the app, and run through a setup wizard. It asks some questions about your preferences. Then it says it will download all your data and it’s done. (This is the part that Private DNS was breaking.) Afterwards it gives a summary of the options you picked, here’s mine:

I’m unclear on whether it really copied all my data over. It said it’d only download a couple MB, not the 50MB+ compressed the takeout had in it. I do see old trips of mine over the years so some data copied over. My guess is it only kept the semantic tracks, not the detailed point by point logs.

The new Timeline mobile product looks pretty nice in general. It’s got an easily browsable list of old trips, just like the webapp had. Too bad it’s confined to my tiny phone.

Once I finished the migration the web application no longer works for me.

Exporting data

I cannot find any data export option in the new mobile Timeline product. I’ve asked a question on the help forums. I fear Google may have removed this feature. If so, I am very unhappy about that.

To export your mobile Timeline data, in Android Settings (not Maps) go to Settings > Location > Location Services > Timeline > Export timeline data. This option was not available for me at first after setting up mobile Timeline, I had to reboot my phone and then it appeared.

The export is a single file named Timeline.json. Mine is about 15MB (compare 800MB for the Google Takeout). The data does seem complete, it goes back 8+ years just like my old web Timeline data did. It’s a different format though. The meat of it is in a section called semanticSegments, see some examples here. It looks to be a hybrid of analyzed data with place IDs etc and then some raw GPS coordinates. I think it’s not as fine grained as the old web Timeline export but am not sure.

There is also a backup system for timeline data that operates separately from the rest of Android backups. You have to enable it separately within the Maps app under Timeline. But I think those backups can only be used to restore a phone, there’s no way to get at the data in them.

Thoughts on location tracking

I love location tracking. I have a continuous record of where I’ve been for some 12 years. I built a whole location tracking product. It’s so powerful having an automatic diary and travelogue! And Google Timeline’s semantic analysis is great, they do an excellent job turning a random string of lat/lon pairs into a story like “you went to Venice, went to this museum, spent two hours at this restaurant”. I love being able to review my history like that.

Google didn’t build this timeline product out of the kindness of their own heart. They did it to justify their advertising surveillance of users. Because as nice as it is for me to remember where I went shopping three years ago in Dublin, it’s way more valuable to Google to know that for many of their users. The bargain was they’d also make that data available to us, the users, as a form of transparency and quid pro quo. It felt reasonable to me.

Now the bargain has enshittified. Google is still doing just as much surveillance as always, moreso now that ad networks have sprawled and grown. There’s probably 20 location vendors who know where I am most of the time thanks to trackers in Chrome, the Android ecosystem, and its various apps. It’s not great but we’ve been living this way a few years now with some abuses but also some advantages. But now Google has weakened one of the best of those advantages, the Timeline web application. Update: not entirely fair, the new mobile app does seem like a serious product.

MuOS on Anbernic

I’m still tinkering with my Anbernic RG35XX, a remarkable cheap retro gaming handheld. This time around I’m looking at muOS, the most popular third party firmware. It’s a Linux distribution with emulators bundled up and a decent simple UI. It has pretty good hardware compatibility with the console, stuff like Bluetooth is said to work.

The installer takes a long time but when it finishes you’re left with a tidy system. Here’s what’s on the SD card after install

Number  Start (sector)    End (sector)  Size       Code  Name
   1           73728           90111   8.0 MiB     EF00  spare
   2           90112          155647   32.0 MiB    EF00  boot-resource
   3          155648          188415   16.0 MiB    EF00  env
   4          188416          319487   64.0 MiB    EF00  boot
   5          319488         8708095   4.0 GiB     EF00  rootfs
   6         8708096       124735484   55.3 GiB    0700  roms

More or less like the Anbernic stock OS with a bewildering array of tiny partitions related to system booting. Sensibly they put the roms on the last partition where it can be resized easily. One nice thing about muOS: when you install it, it resizes that partition to use up the rest of your SD card. The popular tiny-best-set-go collection of ROMs is about 8GB, so you can fit a full capable retrogaming system with ROMs in a 16GB SDcard.

Surprisingly that ROMS partition isn’t empty after installing the stock muOS distribution. But I don’t think it has any copyrighted games in it. It’s got 3.7GB of stuff in it though. Not sure what all is there, it looks like stuff RetroARCH needs like emulation libraries, music files, shaders, some cheats.

The root filesystem is 1.3GB. The core system seems to be based on busybox. I don’t see any evidence of apk though, so maybe not Alpine. Something custom? No systemd either, no surprise. /opt has openssh, java (?!), and a big directory for openssh with bloated things like tailscaled, syncthing, and rclone in it. Useful software but not quite in keeping with the tiny core. Odd hybrid, I wonder if it’s documented.

It seems to work to unpack the Tiny Best Set into the ROMS directory on muOS and have a bunch of playable games. No need to use the second SD slot.

Google Pixel vs. screen casting

Roku has a nice feature where you can easily mirror video from your Android or Apple phone or tablet right to your TV. Super easy from my Samsung tablet: just launch “Smart View”, select the Roku on your LAN, and off it goes. There’s some nice extra UI for mirroring vs second screen, etc.

None of this works on my Pixel phone. I launch “Cast” and it just sits there, not finding any devices, no feedback why.

I was guessing it was some sort of networking gremlins until I asked an AI. Turns out this is just Google screwing over its customers on its flagship Android phone. Details here

Rokus accept casting via Miracast and Apple Airplay. Google dropped Miracast from its Pixel phones in 2013 in order to push its own Chromecast protocol.

Thanks Google! That anti-trust action can’t happen fast enough.

I’ve never really read about Miracast before. It’s a widely adopted standard, basically “HDMI over Wi-Fi”. Seems to work great. Shame Google crippled their phones to not support it. I did find some Miracast apps on the Play Store but there’s a bunch of them, they all look dodgy, and they all want to charge me a surprising amount of money. So I’ll just stream from my Samsung tablet that works.

I was already holding off upgrading to another Pixel phone, here’s another reason to switch over to Samsung. The Android on my tablet is quite nice.

Anbernic firmware options

Still tinkering with this retrogaming handheld, an Anbernic RG35XX-H. Curious now about firmware options. Sources include here (out of date) and here and here and this AI answer.

  • Stock Anbernic firmware. Mostly running RetroArch, presumably does a good job with hardware drivers. My specific model is downloadable here. Latest seems to be dated 2024-10-18. I think the version that shipped with my device is 2024-01-12. (I updated and it seems nicer, more consistent UI.) One thing I’m clear about is whether there are 64 bit versions. The version that shipped is 32 bit.
  • MOD4, the stock firmware modified with things like an FTP server, NTP to set the clock, etc.
  • cbepx-me mods, another modified stock firmware.
  • Knulli, a fork of Batocera, an OS popular with the RPi crowd. The FAQ says it’s forked because of a license issue with closed source kernels. I couldn’t even find a Batocera download for the RG35XX. Koriki is another Batocera fork you see mentioned sometimes, made to be smaller / lighter.
  • muOS. Another full featured custom system, not sure what distinguishes it from the others. It looks like a pretty solid product though and folks on Reddit like it. Said to boot fast.
  • GarlicOS, so called to remind people of OnionOS, a firmware for a different retrogaming device. More info here. It’s.. medium sized, if I can say that? 250MB for the rootfs. Comes in 32 and 64 bit versions. The install instructions make it sound like you put it on top of the stock firmware, huh.
  • MinUI with an emphasis on being minimal. Quite small, 60MB for the whole thing (with extras) compared to 2GB for some others. Somewhat limited set of emulators for consoles. It installs on top of the Anbernic firmware.

Broadly speaking the firmware is doing two things.

  1. Booting and device drivers and basic system stuff. Also enhancements like network support, customizability of the UI, etc.
  2. A series of emulators. RetroArch is king here but there’s others.

I can imagine a lot of room for experimentation with usability, convenience features like networking, etc. Seems like a fun and vital area of hackery.

Update: a little poll on Reddit has MuOS as the popular choice by far.

Anbernic default OS

I got an Anbernic RG35XX H, a remarkable inexpensive retrogaming handheld computer. Apparently it’s an Android device at its core but it ships with an OS and GUI that is entirely about launching game emulators. And it’s really a Linux system. I hope to customize or at least upgrade the software, maybe starting with this guide.

The device was shipped to me with a 64 GB MicroSD Card that booted. Mostly it runs RetroArch and it had a wide variety of ROMS preloaded. Here’s what’s on it.

The card has six partitions:

Number  Start (sector)    End (sector)  Size       Code  Name
   1           73728        96542719   46.0 GiB    0700  Roms
   2        96542720        96608255   32.0 MiB    0700  boot-resource
   3        96608256        96641023   16.0 MiB    0700  env
   4        96641024        96772095   64.0 MiB    0700  boot
   5        96772096       113549311   8.0 GiB     0700  rootfs
   6       113549312       121063423   3.6 GiB     0700  UDISK

Partition 1, Roms, is a FAT filesystem. With a bunch of presumably unlicensed ROMs on it, naughty naughty. There’s 45 different systems here! There’s 700 ROMs for Atari 2600, for instance, although they stop at the letter H. 466 for GBA but the whole alphabet is represented. So a sort of demo collection but not carefully curated. Other big directories under Roms include bios, anbernic/bezels, and save. That save directory includes save games created by emulated ROMs I had run.

Partition 2, boot-resource, is a FAT filesystem. It contains a few images in BMP format for battery state, a boot logo, etc.

Partition 3, env is a mystery. File just says it is “data”. The first few bytes include what looks like Linux kernel command line parameters. Probably part of the boot chain.

Partition 4, the Boot, looks like a “Android bootimg”. It doesn’t have a filesystem I can boot. Maybe these tools would help.

Partition 5, the RootFS, is an ext4fs that has an ARM32 Ubuntu 18 (!) system. Presumably this is the OS for Anbernic. The directory /mnt/vendor seems to have all the interesting game related stuff in it.

  • vendor/deep/retro is the biggest software package, it’s RetroArch.
  • vendor/deep also contains PPSSPP (PSP), openBOR (side-scrollers), and drastic (Nintendo DS)
  • vendor/bin/game has what look like a bunch of emulators in it, 32 bit ARM executables.
  • vendor/ctrl looks like shell scripts for the Anbernic system, things like mounting SD cards or configuring CPU parameters.
  • vendor/oem/version.ini is handy, it tells me 20240112.

Partition 6, the UDISK, is an ext4 filesystem. It’s basically empty but has stuff called dmenu and save in it.

Hacking Proxmox boot process (ZFS)

I’m upgrading my main Proxmox home server from a single SSD with ZFS to two SSDs mirrored in ZFS. Some discussion here. The simple thing is just to reinstall Proxmox new but I’m going to try to do it in-place first. Either way requires careful backups.

The docs on changing a failed boot device are the in-place process I’m following. More or less. It boils down to “set up the new disk in ZFS, then run proxmox-boot-tool to make it bootable”. The blessing process is complicated. Booting with ZFS is always tricky. And Proxmox is rumored to have a special thing where it installs boot loaders on all mirror devices for redundancy. I want that with my new drive! This post is me learning about how it all works.

Summary: this worked very well and is simpler than imagined. Also Proxmox is remarkably well documented. Hurray!

How is Proxmox booting now?

A year ago Proxmox installed something that made it boot from ZFS. Works great. What’s it doing? The challenge is Proxmox has three different ways of booting and I’m not sure which mine is. These docs on using the boot tool are helpful. Some other useful docs here. I should just plug in a monitor and look at the boot process but no, I’m stubborn. The docs say proxmox-boot-tool status will show you the current boot method but the output is not illuminating.

System currently booted with uefi
4B96-7CDC is configured with: uefi (versions: 6.5.13-6-pve, 6.8.12-1-pve, 6.8.12-2-pve)

Yes, it’s UEFI, I knew that. But is that GRUB? Something else? Looking around for advice in docs and from Phind I got some other ideas to try, looking at the EFI boot options:

# efibootmgr -v
BootCurrent: 0002
Timeout: 1 seconds
BootOrder: 0002,0003,0001,0004,0005
Boot0001* UEFI:CD/DVD Drive BBS(129,,0x0)
Boot0002* Linux Boot Manager HD(2,GPT,55f108de-abfa-4dad-b478-641a6d640390,0x800,0x200000)/File(\EFI\SYSTEMD\SYSTEMD-BOOTX64.EFI)
Boot0003* UEFI OS HD(2,GPT,55f108de-abfa-4dad-b478-641a6d640390,0x800,0x200000)/File(\EFI\BOOT\BOOTX64.EFI)..BO
Boot0004* UEFI:Removable Device BBS(130,,0x0)
Boot0005* UEFI:Network Device BBS(131,,0x0)

So that says it’s “Linux Boot Manager”, which is systemd (why doesn’t it say so?). Other docs I read suggest ZFS systems boot from a whole Linux system installed in the ESP. That may involve systemd too. In any case it probably does not involve GRUB. I finally hooked up a monitor and rebooted and saw a menu but it didn’t quite look like GRUB. I did see a message go by about EFI Boot Stub.

Bottom line: I think I’m booting with Linux Boot Manager which involves systemd and a Linux kernel on the ESP partition. Not GRUB.

It’s possible to inspect the boot stuff. It’s on partition 2, the ESP partition in a VFAT filesystem. It has stuff in it like EFI/BOOT/BOOTX64.EFI, EFI/proxmox, and loader/entries.

Identifying the disks

/dev/nvme1n1 is my existing Proxmox boot drive, a zpool with just the one disk in it. I want to add /dev/nvme0n1 to the pool and make it a mirror. But there’s many ways to name a device on Linux and you want a stable name. (Fun fact: the drives on 0 and 1 have swapped between reboots without me changing the hardware.) What’s best?

zpool status -v rpool tells me the status of my existing one disk pool.

        NAME                               STATE     READ WRITE CKSUM
        rpool                              ONLINE       0     0     0
          nvme-eui.002538b22140b542-part3  ONLINE       0     0     0

What is that EUI string? That’s another name for /dev/nvme1n1p3, the “Extended Unique Identifier”. A 64 bit ID, different from the UUIDs, serial numbers, and other identifiers I’ve used before.

I first found this same name with this query: udevadm info --query=all --name=/dev/nvme1n1. But I don’t really know what that tool is. Simpler is ls -l /dev/disk/by-id/ | grep nvme, which shows that nvme-eui.002538b22140b542-part3 is (currently) a symlink to nvme1n1p3. That I understand. So I looked for what linked to nvme0n1 and found that nvme-eui.002538bc3140272b-part3 is the name for the new SSD’s partition 3.

Adding the ZFS mirror disk

OK, time to do surgery on my machine. I am more or less following this guide.

Step 1: clone the partition table to the new disk. sgdisk /dev/nvme1n1 -R /dev/nvme0n1. After doing this the new disk has the same layout as the old one. blkid will show the partitions. (Although confusingly blkid doesn’t show filesystem types: fdisk showed they were labelled as VFAT etc, just like the original disk.) However the UUIDs of each partition are the same too which is not good, we’ll change that soon.

Step 2: give partitions unique UUIDs. sgdisk -G /dev/nvme0n1. Partitions are the same but now they have new IDs.

Step 3: attach the new SSD to the pool. zpool attach rpool nvme-eui.002538b22140b542-part3 $nvme-eui.002538bc3140272b-part3. Why attach and not add? (Edit: add expands storage, attach mirrors it.) Not sure but that’s what Phind told me to do. This pauses a couple of seconds and then returns. zpool status -v rpool shows what’s going on. The ZFS docs suggest that “attach” is a special thing that only directly mirrors devices. I would have guessed zpool add would have been the command to use but that seems to be a more general purpose thing for other configurations with vdevs and maybe RAID-Z.

  pool: rpool
 state: ONLINE
status: One or more devices is currently being resilvered.  The pool will
        continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
  scan: resilver in progress since Sun Oct 27 19:49:41 2024
        114G / 114G scanned, 2.24G / 114G issued at 2.24G/s
        2.31G resilvered, 1.97% done, 00:00:49 to go
config:

        NAME                                 STATE     READ WRITE CKSUM
        rpool                                ONLINE       0     0     0
          mirror-0                           ONLINE       0     0     0
            nvme-eui.002538b22140b542-part3  ONLINE       0     0     0
            nvme-eui.002538bc3140272b-part3  ONLINE       0     0     0  (resilvering)

Just a bit later it reports resilvered 116G in 00:01:02 with 0 errors on Sun Oct 27 19:50:43 2024. Nice! These SSDs are fast.

At this point the ZFS stuff is all done. The system reboots fine. I did a zpool scrub for good measure and it reported no errors. I’m now getting most of the benefits of ZFS mirroring for data integrity. However there’s still only one boot device: if that fails, I’ll have to recover with some other boot media.

Installing boot stuff on the new disk

Proxmox has extra stuff for making boot more durable. proxmox-boot-tool manages it. See docs here.

Step 1: I verify that the new disk doesn’t have a boot ESP partition. Device names have changed on me after I rebooted, so /dev/nvme0n1p2 is the original bootable partition. /dev/nvme1n1p2 is the new one.

# old=/dev/nvme0n1p2
# new=/dev/nvme1n1p2
# mount $old m
# ls m
EFI  loader
# umount m
# mount $new m
mount: /tmp/m: wrong fs type, bad option, bad superblock on /dev/nvme1n1p2, missing codepage or helper program, or other error.
       dmesg(1) may have more information after failed mount system call.

Step 2: format the ESP on the new disk. proxmox-boot-tool format $new. After this there’s a brand new VFAT filesystem on the partition, it is empty.

Step 3: get Proxmox to install its boot process on the new disk as well as the old. proxmox-boot-tool init $new. This copies all the kernels, etc to the new disk and enrolls it so updates should be written to it. After running this both disks have nearly identical boot partitions.

Step 4 (option): refresh. proxmox-boot-tool refresh. Just a sort of verification thing, shouldn’t be necessary, but it writes the kernels again to all enrolled disks.

Rebooting

It works! On reboot it just loads like nothing’s changed.

In the BIOS I now see more EFI boot options. Linux Boot Manager is now on both disks, other entries are also doubled. The EFI boot menu is totally rewritten and has two extra entries.

# efibootmgr -v
BootCurrent: 0000
Timeout: 1 seconds
BootOrder: 0000,0002,0003,0004,0001,0005,0006
Boot0000* Linux Boot Manager    HD(2,GPT,63a5e06a-3206-4a55-957c-0878a2275a8c,0x800,0x200000)/File(\EFI\SYSTEMD\SYSTEMD-BOOTX64.EFI)
Boot0001* UEFI:CD/DVD Drive     BBS(129,,0x0)
Boot0002* Linux Boot Manager    HD(2,GPT,55f108de-abfa-4dad-b478-641a6d640390,0x800,0x200000)/File(\EFI\SYSTEMD\SYSTEMD-BOOTX64.EFI)
Boot0003* UEFI OS       HD(2,GPT,55f108de-abfa-4dad-b478-641a6d640390,0x800,0x200000)/File(\EFI\BOOT\BOOTX64.EFI)..BO
Boot0004* UEFI OS       HD(2,GPT,63a5e06a-3206-4a55-957c-0878a2275a8c,0x800,0x200000)/File(\EFI\BOOT\BOOTX64.EFI)..BO
Boot0005* UEFI:Removable Device BBS(130,,0x0)
Boot0006* UEFI:Network Device   BBS(131,,0x0)

The real question is what happens if the boot disk fails. Will the system still boot? In theory yes, if you have ZFS mirrors and Proxmox’ magic boot setup. I don’t want to pull the M.2 drive in my machine to test it so I don’t know if it works. There’s two genuine looking boot partitions both listed in the EFI boot menus so I think odds are good.

Things that cause hangs in Proxmox boot / shutdown

I love how Linux has (mostly) fast reboots, 10 seconds or less. So I’ve noticed some slow reboots, a minute or more, that are annoying. What’s happening?

One challenge: when you tell Proxmox to reboot it shuts down all the Proxmox PVE stuff like the Web GUI. That happens immediately. It also asks all the guests to also shut down (maybe at the same time) but that takes longer. Only now the UI is gone so you can’t see what’s happening. I only got some insight by staring at a console plugged in and then reviewing logs.

Another awkward thing: the “shut down all guests” task has no timeout from Proxmox. If one of your guests refuses to shut down I think Proxmox doesn’t reboot, just stays in a mostly-dead state. (Edit: maybe not, the docs mention a 180 second default timeout.) That makes sense in a high availability environment but is not great for my home single server. I don’t think this has ever bitten me but I have everything plugged in to an Internet power switch for just this eventuality.

Slow VM shutdown for a Linux guest

One thing I noticed is shutdowns sometimes take a minute+. The culprit is my big work VM takes forever to shut down Why? It NFS mounts a disk from an NFS server that’s running on the Proxmox host itself. So if the NFS server shuts down first, the client has a hard time unmounting it. (A weakness of NFS). The unmount does eventually time out after 90 seconds and the shutdown proceeds, but it’s a problem.

The root cause here is me running an NFS server on the PVE host: that’s not a great idea. But there’s a similar possible problem if the NFS server is in one guest, the client in another. Proxmox doesn’t do any sort of dependency inference itself although you can manually configure it. At least you can make a guest dependent on another guest, you can’t make it dependent on a rogue NFS server you installed on PVE itself.

I don’t have a fix for this now. I’m working on moving the NFS server to a guest, will revisit then.

Slow boot of Proxmox

Another problem I had started after I added a USB disk as storage, then unplugged it. On boot Proxmox waits to mount that disk again. It times out after 90 seconds. Fair enough but awkward.

Doubly awkward is it kept happening after I had removed the USB disk from the list of storage options. The disk is no longer referenced, why are we waiting? Turns out the mount job was left enabled. That may be a Proxmox bug? I manually disabled it with systemctl disable mnt-pve-extbackup.mount.

IPv6 for first time (Ubiquiti USG, Starlink)

I finally decided to enable IPv6 on my Starlink network. And it seems to work? Ran into a lot of confusion with Ubiquiti Unifi OS, maybe also my Windows client. Still tinkering but some notes. Highlights of things I learned:

  • Prefix Delegation Size: 56
  • Prefix Delegation ID: 1
  • Try an Android phone first as a test client
  • Reboot Windows before it will work with IPv6

The big question is: what’s going to break now that I’ve enabled this? I think all my devices are now magically IPv6 and I just can’t wait to find out what changes. I enabled this because Starlink’s CGNAT means I often get blamed as if I’m a bot, maybe the IPv6 sites will work better. Already anticipating Youtube TV or Netflix or something pitching a fit though.

Starlink ISP

Starlink operates DHCPv6 and hands out /56 addresses. These are rumored to be dynamic and changing at least occasionally: Starlink doesn’t promise fixed IPs for residential users. Given they move me between Seattle and Los Angeles POPs with some regularity I’m not entirely surprised they aren’t maintaining a dynamic routing infrastructure for all users. (There’s a business level service with static IPs.)

Starlink didn’t initially offer IPv6. And for awhile they did but had some problems with their DHCP implementation. Internet searches often find old out of date info. Starlink does now document they offer IPv6. Also more info in this FAQ.

Unifi OS router

I had a hell of a time making sense of what my Ubiquiti Security Gateway (USG-3P) was doing. Some notes.

USG Internet configuration

The first part is getting the USG router to talk to the IPv6 Internet. The main configuration for this is in Settings / Internet / Primary (WAN1). You have to set “Advanced” to “Manual” and then enable “DHCPv6”. Also you have to type in a “Prefix Delegation Size”. 56 works for Starlink and most ISPs, that means you get a /56 address allocation from DHCP. That’s a very large address space.

There’s no indication this configuration works when you do it. The Unifi web UI still shows “IPv6 Address” as blank. If you log in to the USG command line and run ip a or ip 6 a, nothing will show up, it looks like there is no IPv6 address assigned to eth0 (the WAN). Well not entirely: you’ll find an address like fe80::e263:daff:fec4:19ff/64 which is the link-local address, but not an routable Internet address.

The way I realized it was working was running grep dhcp6c /var/log/messages on the USG shell. That shows me a message about IA_PD prefix which contains the actual IPv6 lease assignment from Starlink. Yay! Starlink’s block seems to be 2605:59C0::/28, customers are getting a /56 block from there.

The other way I realized it was working was running ping6 2001:4860:4860::8888 in the USG shell to ping Google DNS via IPv6. Actual IPv6 packets! There’s a traceroute6 that is fun to try too.

The confusing thing is my router still has no IPv6 address assigned to the WAN. Apparently this is expected. ip route is no help for how things are working either. But ip -6 route does show a route for default via fe80::200:5eff:fe00:101. I presume that fe80 address identifies the Starlink dish or the ethernet port it’s plugged in to. I can’t ping6 it, maybe it doesn’t make sense to ping a link local address.

Anyway, the router is on the IPv6 Internet. Now what about the rest of my clients on my LAN?

USG LAN configuration

Once the router is talking to the IPv6 Internet, the other part is convincing the DHCP server the router is running to give out IPv6 addresses to clients. This setting is in Settings / Networks / Default. There’s an IPv6 button. You set the radio button to “Prefix Delegation” to enable it. You’re also forced to set a “Prefix Delegation ID”, a decimal number. I still have no idea what this really means but the number “1” seems to work. Update: this explanation seems right. I’m given a /56 block from the ISP but internally I’m using a /64 subset. The extra 8 bits are the prefix deligation ID: I chose 01. That probably explains why my IPv6 address block given by Starlink has a :de00 in it but my machines have :de01: in the address, the 01 I picked was ORed in.

Note there’s an “Advanced” box. I left that to Auto which means it does SLAAC address assignment which is the simple thing you probably want.

After this is configured there is no indication in the Unifi web UI that it worked. But clients doing DHCP will now get v6 addresses if they ask for them. See below for testing clients.

The part of IPv6 I don’t understand is exactly how exposed my network is. AFAICT every device on my LAN is now potentially globally routable with a unique IPv6 address. So what’s keeping me safe? I think the answer is the default IPv6 firewall rules that Ubiquiti has but I really ought to learn more about that. (Update: yes, default firewall rules are “allow inbound traffic associated with existing connections that were made outbound” followed by “drop everything else”. That’s similar to the implicit firewall of IPv4 NAT routing. This port scanner plausibly confirms that my LAN machines have all their inbound ports filtered.)

Client: Android

My Pixel phone seems to work with IPv6 with no effort at all. https://test-ipv6.com/ shows 10/10 everything working. Various “what is my IP” services all show an IPv6 address. All just happened automatically, no reboot or reconfiguration required. Sadly this was the last client I tried but I should have tried it first.

Client: Alpine Linux

I fired up a quick Alpine VM to manually test IPv6. The default installer doesn’t enable IPv6, you have to add it with iface eth0 inet6 auto to the networking config. But doing that everything else works flawlessly. I can ping Google DNS via IPv6. curl https://api6.ipify.org shows me my IPv6 address. Nice!

Client: Windows

So those two clients were easy. Unfortunately the very first client I tried was my Windows 11 desktop. Once I enabled IPv6 the networking interface picked up an IPv6 address via DHCP. Two of them actually, both in 2605:59c8. One of them actually works! From a DOS command line I can ping my router’s IPv6 address. And from the router I can ping6 the one working Windows address.

However nothing else worked. I couldn’t ping Google DNS via IPv6. The browser test at https://test-ipv6.com/ didn’t work, shows nothing at all. Neither did the test at https://whatismyv6.com/.

I finally gave up and rebooted. And presto, now IPv6 is working fully on my Windows machine.

Client: Ubuntu 23.04 VM

An existing workhorse Linux box I had just started working fine on IPv6, no reconfiguration required. May have not started working until I happened to reboot it.

Client: Proxmox Virtual Environment

My Proxmox server does not seem to have IPv6 enabled by default. The docs indicate IPv6 is supported so it’s probably something with how I configured the server with a static IPv4 address at setup. Guest VMs can access IPv6 no problem (see above), not sure about containers. The default bridge (vmbr0) has some IPv6 stuff I didn’t configure so it probably won’t work. Actually a little confused, since that bridge is also used for the VM networking.

Sharing files from Chrome OS to Android tablet

Challenge today: share two 3GB video files from my Chromebook to my Samsung tablet. So many ways, none of them reliable.

  1. USB try 1. Plug in tablet. Popup says “access via Linux? Android?” I chose Linux, probably a mistake. Could never find the device in Linux. It’s there via lsusb but no appearance of file access. Maybe have to mount via command line?
  2. USB try 2. Plug in tablet. Nothing happens. Try several times.
  3. USB try 3. Reboot Chromebook. Plug in tablet. Device shows up in Files immediately! Drag file to copy, says “preparing” for one minute+, then shows an error
  4. USB try 4. Unplug, replug. Try copying again. Get instant error.
  1. WiFi try 1. Launch Solid Explorer on tablet, run its FTP server. Install ftp command line client in Linux. Vaguely remember binary and mput commands like it’s 1994. It seems to work but will take 15 minute. Stalls when one device goes to sleep. No clear way to resume.
  1. Bluetooth try 1. Try Quick Share for first file. This kinda just works?! It’s slow, 10+ minutes, but it copies the file to and seems to be robust even if the device goes to sleep.
  2. Bluetooth try 2. Try Quick Share for second file. Gives error. No diagnosis available, just “try again”.
  3. Bluetooth try 3. Reboot both devices. Try Quick Share. Seems to work.

All that is just to get the file over to Android somehow, somewhere. The other challenge is working around how Android has slowly eroded the idea of a filesystem with general purpose access. Solid Explorer works as a file browser through some hack / special permission that lets it browse things. VLC can access things in Downloads reasonably reliably. Fortunately Quick Share put things in a folder named Downloads / Quick Share, so that wasn’t too bad.

I tried using Google to figure out how to do this and found a bunch of outdated advice that didn’t work. Also tried various AIs that suggested various hilarious non-working options, including things like running Android Debugger.

Why is this so bad? Does no one want to copy their photos from their phone to their Chromebook? It’s really dumb the USB doesn’t work. For some reason tablets and phones don’t show up as a normal USB storage device but instead use some weird mobile device system that’s awkward AF.

More on Doze Stopper

I learned some more about Doze Stopper, the app that seems to be fixing my delayed notification problems on my Pixel phone (Android 14). (Previous discussion.)

First, some observations from using it:

  • Notifications are no longer delayed. Problem fixed?!
  • One drawback: the app prevents scheduled Do Not Disturb mode
  • It doesn’t seem to disrupt battery life much if any

Second, some notes on how it works:

  • The app is using alarms to interrupt Doze mode.
  • Alarms during doze are delayed by a few minutes. This delay seems configurable in the app, I have it set to 5 minutes, the current minimum. So maybe my notifications are delayed by a few minutes still? I haven’t observed that.
  • The app also receives push notifications, I think to enable the alarm.

It’s a pretty minimal app but it seems very good to me. I’m excited I found it.

The lack of battery impact makes me wonder why Google is fooling around with delayed notifications at all. I only get a few notifications a day because I carefully disable everything that’s spammy. Maybe it’d be worse for a normal phone?

Or maybe dozing notifications is just a bad idea that Google could remove from Android. When it was introduced years ago Android had all sorts of background activity consuming battery. Over the years they’ve cracked down on background processing and on network connectivity and maybe the platform is in a place where they could re-enable instant notifications.

One other mystery: Firebase has an option for high priority notifications that should get through even when Doze is active. So why aren’t messages from important apps like Gmail or Signal getting through? Maybe they’re just not setting the important bit? That’d be silly if so.

Home security cameras: Eufy + Frigate

For years I’ve wanted some lightweight private home security cameras. I’m not too worried about security but it’s reassuring to be able to see video of the house when you’re not home.

I’ve come to really like Eufy cameras. The basic $30 indoor WiFi camera (plus a cheap microSD card) works great with their mobile app. Out of the box you get something that detects motion (including people vs animals) and stores video of events and alerts you on your phone. Also a quick live view browser. Firewall traversal works fine.

There’s no fee for all this service, the caveat being that you are live streaming video clips off of the camera’s storage in your house. There’s a cloud video storage option too if you’re worried about a clever thief disabling your camera (I am not). But what I like about this setup is Eufy isn’t storing video remotely at all. They’ve had a couple of privacy kerfuffles like not disclosing adequately that a still image is briefly uploaded to a cloud server if you have it taking snapshots and sending them to your phone. But they seem like well-meaning mistakes, not total failures (Wyze) or a not-private design by default (most consumer products).

Honestly the Eufy product is good enough on its own that may be all I need. The last piece I have to set up is geofencing so it doesn’t operate when we’re home. I think it supports everything I need (using your phone to detect when you’re home) but I haven’t used it yet.

Frigate

Still, what could one do with more software? Thanks to Aneel on Mastodon I learned about Frigate, an open source video recorder. It works with live continuous cameras and does fancy motion detection, etc and gives you a nice web display of live video and events. It seems quite sophisticated too with advanced, customizable detection algorithms, video area masking, etc. Also cool: it can use Intel QuickSync or a Coral TPU (!) for hardware acceleration of tasks.

I gave it a 15 minute try using a tteck script to install and run it on Proxmox. Got it up and running pretty quick although the hand-edited YAML file feels like a bit of a throwback. You enable an always-on RTSP feed from the Eufy camera and then configure Frigate to connect to it. The tteck scripts nicely set up Intel CPU acceleration for me already although I did have to do some extra bits to enable it and to enable recording.

It seems to work well. It’s a very nice product, the UI is impressive. Monitoring one camera the container is using 20% of a i7-12600k CPU and some tiny fraction of GPU. About 1GB of RAM. I imagine that multiplies with more cameras but this can run on a pretty low powered Intel machine.

I don’t know if I’m going to keep using Frigate or not. I still think the Eufy product does most of what I want. And I don’t love the idea of all this video using up WiFi bandwidth and CPU when nothing is happening. Makes me wonder if there’s some other open source software that can use the intermittent RTSP feed Eufy also offers only for motion events. But if I wanted to customize the object detection or do more fancy video analysis, Frigate definitely seems like a nice tool.

mqtt:
  enabled: false
cameras:
  sf4:
    ffmpeg:
      hwaccel_args: preset-vaapi
      inputs:
        - path: rtsp://usernamepassword@192.168.0.252:554/live0
          roles:
            - detect
            - rtmp
    detect:
      width: 1920
      height: 1080
      fps: 5
    record:
        enabled: True

detectors:
  ov:
    type: openvino
    device: CPU
    model:
      path: /openvino-model/FP16/ssdlite_mobilenet_v2.xml
model:
  width: 300
  height: 300
  input_tensor: nhwc
  input_pixel_format: bgr
  labelmap_path: /openvino-model/coco_91cl_bkgr.txt
version: 0.14

Starlink adds an NTP server

This is very cool: Starlink’s dish now has an NTP server serving GPS time. That should be highly accurate. If they implemented it right, it’s going to be your best source of time short of specialty hardware you installed yourself. Certainly better than anything you’ll get from the Internet. See discussion here.

The server advertises itself as stratum 1. Thta’s a bold promise of high accuracy but is appropriate for a GPS receiver. It also means most NTP clients will prefer it as the time source to anything from the Internet. Which seems right to me.

(FWIW, I’ve synced hosts with chrony for years now over Starlink using the default Ubuntu pool config. Despite the high jitter Chrony does a good job synchronizing, it estimates it’s got accurate time to within 2ms despite 50ms of root delay. )

I added the server a few minutes ago and my machine is already syncing to it. Will update new stats after it has run awhile.

Update 1

3 hours later and it’s definitely running nicely. Here’s a graph of root mean square offset, a measure of clock accuracy. Over the last month, setting clocks over Starlink Internet with the Ubuntu pool got me an RMS of about 275µs ... Now it’s more like 100 µs since using Starlink. Here’s a graph of the last 24 hours, the line is where I switched to Starlink’s clock.

Honestly I’m surprised at how well chronyc synced time over Starlink Internet. The servers are all 40-80ms away varying every few minutes, a huge amount of jitter. I think chronyc has special algorithms to estimate that kind of thing.

Also impressed with how Starlink has improved. A year ago, before the latency improvements, my RMS averaged 427µs. Here’s a graph of the RMS for the last two years, mostly on Starlink ISP.

Honestly all this stuff is astonishingly good timekeeping. 1ms accuracy with consumer parts and slightly wonky Internet connections. It’s nice now to have access to GPS time though!

Update 2

running for about 24 hours now and doing well. One issue with Dishy as a time server is it often reboots around 3am. Mine rebooted last night and while Chrony coped it definitely threw off time accuracy. The offset went from under 100µs to fluctuating between -1ms and 2ms. The RMS had converged as low as 30µs (very impressive) but reset to 800µs after the 3am reboot. Oddly I don’t see any evidence Chrony gave up on syncing to the clock entirely, but the root delay to it stopped being a steady 2ms and spiked up to 4ms for a couple of hours after the reboot. All of this is well within the bounds of an NTP client to cope but is an example of how it’s not quite as good as having a fully dedicated GPS time receiver. OTOH it’s free!

Some stats after a few hours

chronyc> tracking
Reference ID    : C0A86401 (192.168.100.1)
Stratum         : 2
Ref time (UTC)  : Tue Sep 17 20:16:58 2024
System time     : 0.000011511 seconds slow of NTP time
Last offset     : +0.000012743 seconds
RMS offset      : 0.000090009 seconds
Frequency       : 30.078 ppm slow
Residual freq   : +0.000 ppm
Skew            : 0.121 ppm
Root delay      : 0.001979256 seconds
Root dispersion : 0.002787174 seconds
Update interval : 512.1 seconds
Leap status     : Normal
chronyc> sourcestats
Name/IP Address            NP  NR  Span  Frequency  Freq Skew  Offset  Std Dev
==============================================================================
alphyn.canonical.com       48  28   13h     -0.020      0.111  +2013us  3097us
prod-ntp-3.ntp1.ps5.cano>  55  28   15h     -0.080      0.080    +66us  2833us
prod-ntp-4.ntp1.ps5.cano>  18   8  293m     +0.090      0.651  +2919us  3553us
prod-ntp-5.ntp4.ps5.cano>  64  30   18h     -0.053      0.069   +946us  2962us
ntp3.radio-sunshine.org    64  35   18h     -0.082      0.054  -2298us  2382us
rn5.quickhost.hk           18   8  310m     +0.075      0.326  +2550us  1875us
LAX.CALTICK.NET            34  22  569m     +0.051      0.100   +934us  1678us
time.cloudflare.com        24  17  413m     +0.103      0.153  +1269us  1407us
192.168.100.1              15  10  103m     +0.000      0.118   +173ns   167us

Vault: towards my own NAS

Working on rationalizing my file storage now that I’m in a Proxmox universe. The idea here is to put all my important stuff on a NAS VM running the following services:

  • NFSv4
  • Samba
  • Syncthing
  • Restic with BackRest

I’ve got a basic cut at it working (other than Samba) and it seems good. Some notes on what and why.

Contents

What am I storing on the NAS? Very little right now, but the plan is:

  • 14GB of source code. Most of this never changes and it’s mostly small files although some 1GB data blobs sneak in occasionally.
  • 7GB of Windows Documents. Random stuff here but it’s helpful to sync and backup.
  • < 1GB of files on mobile devices. I use Syncthing to get stuff off my Android devices.
  • 4TB of Media archives. NFS and SMB mounted locally. No Syncthing, no backups. Right I am manually rsyncing them occasionally to the second house. I may migrate this to backups (local only, Backblaze is expensive) and Syncthing.

Access over the Internet

The challenge here is I want my files accessible over the Internet, because I have two houses. My house with Starlink is 50ms away from the house with the server (and Sonic fiber). NFS and Samba are only good for LAN access. Those network file systems sorta work over the Internet but it’s slow and awful.

So instead I’m using Syncthing to maintain a working copy of files on my local machine. That makes my setup a lot like what Dropbox or other cloud drives is doing. I’ve done it for years with important stuff including all my source code and it’s worked fine. A key thing here: I am almost never modifying files in two places at once. Syncthing has a conflict resolution system for that but it’s a little primitive.

I’m using Tailscale for now to access the Syncthing server on the vault. That shouldn’t strictly be necessary.

Storage medium

Where are my files stored? On virtual disks that Proxmox provides. Those virtual disks are allocated on a ZFS pool that Proxmox maintains. That way the NAS VM doesn’t need to use ZFS directly, instead it just puts an ext4 filesystem on the virtual disks and it’s simple.

It’s a little weird that ZFS doesn’t see the individual files and the NAS is unaware of the ZFS pool status. But it turns out almost all the advantages of ZFS operate at the block level. Proxmox creates the virtual disk as a ZFS dataset, a block device, and ZFS will happily snapshot and compress and checksum and self-heal those blocks for me. There are a few filesystem-level ZFS features (like ACLs) but I don’t really care about them, so not having them in the NAS is no big loss.

The other option would be to pass through raw disk devices to the VM and let it run a ZFS pool itself. That’s more like what a TrueNAS setup does.

Still on the fence about what physical media I’ll use. So far I’m doing it on a single SSD in the Proxmox server. I think a pair of spinning disks with mirroring makes sense for the media archive but might be a little slow for the NFS clients accessing the source code.

I’m using Restic (with Backrest) for two sets of backups. One of everything to local disk, an extra disk in my Proxmox server. (See this pattern). One leaving out the media archives to Backblaze.

Product design

So far I’m at the “hack config files” stage of building this out. And that’s fine. Backrest and Syncthing already offer Web GUIs. I’d like to streamline the NFS and Samba configs so I don’t have to keep re-referencing the same disk volume over and over in several config files but eh, whatever. I could imagine making this into an actual product other people could use but it’d take a lot of configuration and testing. The VM might also make a good NixOS project.

Why not Cockpit for a GUI? It might actually be a good idea, I’ve never tried it.

Why not TrueNAS or OMV? Partly because I don’t like either very much. Also because neither supports Restic or Syncthing. You can install them in the VM but it’s kind of a kludge and really, I’m OK just managing NFS and Samba myself. TrueNAS can also manage a ZFS array which would be a different storage solution than what I’m doing.

As always with hacker projects there’s a lot niceties of monitoring and alerting I should be doing but haven’t set up yet. At least Proxmox ZFS will tell me if something catastrophic happens to the data.

Wrinkles

One problem with any NAS is managing file ownership. The POSIX file model is very clear for ownership and permissions. But SMB kind of screws that up. And so does Syncthing: it really wants to run as a single non-root user. (Although it has some support for multiple owners). For now I’m going to stick with POSIX files but they’re all just owned by me. That’s a good match for my data. OTOH I am allowing NFS clients to be root on the server, so maybe I can do more when Syncthing isn’t involved.

NFS still sucks for clients when the server fails. I’m mounting with noauto,x-systemd.automount,x-systemd.idle-timeout=60,soft,timeo=15,retrans=2 which first of all, lol, why aren’t the defaults adequate? And x-systemd really? But it seems to work; if the server is down the client will throw an error in under a minute.

Setup details.

The Vault VM is set up to use two vCPUs and 2GB of RAM. There’s a 4GB disk for the system volume (including 0.5GB of swap) and then as many user data volumes as I want.

I’m running Debian 12 on the VM with just the basics installed: nfs-kernel-server, samba, syncthing, backrest. The system seems to be using an actual 400MB of RAM, very little. I think the most RAM-hungry thing is Restic, it likes to do a lot of housekeeping when de-duping backups etc. It might make sense to give more RAM to the NAS just for it to cache files its serving.

Right now I’m mounting the datasets on virtual disks into /mnt/UUID, big ugly names. Then I have a second fstab entry to bind mount from /mnt/UUID to /export/friendlyname. Trying to reference the datasets everywhere else with the /export name.

Some specifics:

  • /etc/interfaces: modified to add 192.168.240.* subnet for sharing within Proxmox
  • /etc/fstab: edited to mount disks into /mnt and bind mount into /export
  • /etc/exports: individually names each /export filesystem so NFS will send them
  • /etc/default/nfs-kernel-server was modified to be NFSv4 only. Debian has some docs on this but they seem to be badly out of date.
  • Backrest config is mostly in ~root/.config/backrest, also the systemd unit file. The GUI manages that.
  • Syncthing runs as user nelson via systemd user (with loginctl linger enabled so it runs without me being logged in). The GUI manages configs, they are stored in /home/nelson/.local/state/syncthing

Doze Stopper, a fix for Android notifications?

I’m testing a new fix for delayed notifications in Android and so far (24 hours) it’s working well. See also this Reddit post I made.

The fix is a free Google Play store app called Doze Stopper. There’s little explanation what the app does but judging by the logs what it’s doing is setting an alarm for itself every 5 minutes, then doing something to wake up from Doze mode. The timestamps on the logs don’t quite make sense though.

I’ve deliberately left my phone idle as much as I can for about a day now, then tested it every few hours with a notification from Gmail or Gotify. The notification always appeared within 30 seconds or so. Also the Messages webapp connects immediately now. In the past often those tests would fail: notification wouldn’t appear, messages wouldn’t connect. But this is hard to test reliably!

Didn’t notice any significant downside in battery life. Left the phone off the charger overnight for 10 hours and it went from 100% to 74%, about typical from before running this app.

Update Sep 15: left it running for 24 hours with no charging. Phone went from 100% to 44% which is roughly the same as it would without Doze Buster. Can’t measure precisely but it’s definitely not killing the battery. Also notifications keep working, Gotify notification shows up immediately after an hour+ idle. Some Gmail notifications may not be coming through immediately, not sure what’s up with that.

Update Sep 17: still seems to be helping a lot. It does seem to disrupt Do Not Disturb mode though. I have DND scheduled every night but in the morning I find it’s not enabled on my phone when it should be. I did a test now and DND was disabled sometime between 8 and 16 minutes after a schedule turned it on. I wasn’t watching closely, but there were no log events in Doze Stopper the first 10 minutes: my guess is the alarm or disabling doze is also turning off DND. There is a DND setting for “Alarm can override end time” but I want that enabled for my own alarms!

Note, the developer has a second app called Doze Buster that also does the same thing but apparently for older versions of Android. It’s a little confusing, none of this is well documented.

Setting up Gotify with Proxmox

Continuing my search for some sort of notifications infrastructure, I set up Gotify to use with Proxmox and other services like BackRest so I get messages in a central place from my servers when things go wrong. I don’t love Gotify but it’s what works with Proxmox so I’ll start there.

The goal here is to get https://example.com/gotify/ working both for the Web GUI and as an endpoint for Gotify clients including a message destination and the mobile app. I used to use Tailscale but it’s nice to have the Gotify server on a publicly accessible address. It looks designed to be secure for that.

Step 1: install Gotify as an LXC container in Proxmox with the tteck script. This ships with no config file but the defaults are reasonable (you configure passwords and stuff in the GUI). Note that means no SSL support. Gotify actually has reasonable SSL including Lets Encrypt integration but I didn’t use it.

Step 2: use Caddy as a reverse proxy to forward to Gotify. Not necessary but useful for my setup where I have a public Caddy server brokering access to other stuff. The Caddy config is a bit fiddly but is well documented here. Caddy has to strip the URL prefix so Gotify doesn’t see it.

Step 3: configure a new application in Gotify and make note of the token.

Step 4: in Proxmox go to Datacenter > Notifications and add a new target. Paste in your token. The URL will look something like https://example.com/gotify. Note the lack of trailing slash: if you leave it in both Proxmox and Gotify are dumb about it and you get a confusing error. Press “Test” to verify the messages get through.

While I’m here... looking for a good solution to get notifications in Gotify from emails. There’s a zillion SMTP-to-Gotify gateways out there that obviate the need to have actual working mail delivery. This one looked promising on last review, simple and updated recently. I haven’t tried it. It doesn’t seem to have any sort of authentication so a bit worried it’ll collect spam if you run it on a public address.

Update: a quick test shows smtp-gotify works fine for email. I built it as a Go program and then just ran the binary, configured via a few environment variables. The Dockerfile in the project helped figure it out. The simple way to use it is set it as you SMTP host to send mail to. Which I’ve forgotten how to do simply in random Linux machines, need to read up on it.

Persistent connections failing: tn3270 and TradeStation

I have a weird networking problem with persistent sessions that I think may be related to Starlink but I’m not sure. Informed troubleshooting advice welcome.

My partner uses a Windows machine running a couple of particular network apps. One is the TradeStation app, a commercial program that gets constant updates of stock prices, many times a second. Another is Host on Demand, a clunky Java app that provides tn3270 terminal sessions. It’s a little like ssh or telnet but its own thing.

The problem is both applications mostly work but their connections break many times a day. They reconnect immediately but it’s manual and disruptive. The TradeStation connection should be long lived and with frequent traffic. Host on Demand sessions are mostly idle although we have configured keep-alives.

FWIW my own computers don’t see any problems, but I don’t use that software. I run long-lived ssh connections all the time and they’re fine. I just tested with netcat and can keep a TCP connection open for over twenty hours to a server sending a short message every 15 seconds. So I don’t have a general problem with persistent connections.

Here’s the kicker: the disconnects only happen in the house with Starlink. He also uses the same software in a place with a fiber ISP that has no problems. Both places have a Ubiquiti router I configured, nothing unusual. Sometimes he uses a VPN with Starlink and still sees disconnects but fewer of them. This makes me think it’s something special about Starlink that’s causing the issue.

My first thought was our IP address changing on Starlink but that only happens every couple of days, not many times a day. A second thought is maybe whatever session state Starlink’s CGNAT is keeping is expiring? But my ssh sessions are fine. Maybe Starlink has something special to protect ssh but not other long lived sessions? Seems unlikely.

Another possible theory is he’s connected via WiFi in the problem house. The WiFi is quite reliable, Unifi characterizes it as 100% excellent and it’s less than 1 packet lost in 10,000 when pinging the LAN. But I can’t fully rule it out.

Welcome any informed ideas on how to figure out what’s going wrong. I’m not certain it’s actually Starlink to blame here. I wish I knew more about the apps that are failing and why they may be different from my ssh or netcat. I’ve tried using a packet sniffer but didn’t see anything clearly wrong.

Reddit discussion

I posted this on Reddit and got almost no engagement. One reply that suggested some TN3270 alternatives and one good idea, which is to run the netcat client on the Windows machine and see if it works.

backrest GUI for restic

I’ve been using Restic for backups for most of a year now. It’s terrific. But Restic is a bit of a low level tool, using it requires some fiddly config files and setting up cron jobs, etc. There are a bunch of frontends to Restic that turn it more into a user product. I’ve been using resticprofile but don’t love it, it’s confusing and awkward.

Backrest is new bae. Turns out I want a web GUI for this kind of thing, who knew? It has a very nice and simple structure for configuring Restic. You create repositories, then you create plans. There’s good GUIs for configuring things like retention policies, cron schedules, etc. It runs persistently to provide the web GUI and takes care of launching restic as needed and making things happen.

Remarkable number of grace notes too. I love that every configuration screen has an option in the GUI to show it as a JSON file, making it easy to keep track of what’s actually happen. Also it has remarkably good live web updates. Not just showing you a job is running but specific status output updated once a second to see, say, how many files of the backup have been completed so far.

It’s just a really nicely developed product.

Using a simple USB disk for Proxmox backups

Trying a delicate thing here. I have a USB disk I want to write backups too. Mostly I want to back up precious data from a Proxmox guest system (an OpenMediaVault VM with user files, backups written to it with rsync and restic). I also want Proxmox to write backups of guest systems to it. There’s a bunch of ways to do this.

I decided to complicate it by having a constraint of simplicity. It’s important to me that the USB disk with the backups be as simple and ordinary as is realistic. That means no ZFS, no QEMU virtual disks, no weird partitioning. I want the USB disk to be as simple as possible so someone could plug it in to Linux box and get the files off it.

The solution I landed at was to use GPT partitions and ext4 filesystems. There’s a 1TB partition for Proxmox, it will connect it to storage as type “directory” and write backups to it. And there’s a 10TB partition for the OMV VM to write backups to with software running in the VM. It seems to work!

Preparing the disk partitions

This is all generic Linux stuff. I used gdisk on the PVE host to partition the disk. I just used fixed partitions: I didn’t use LVM or something to make the partitions more flexible. I also didn’t use any Proxmox tools to set up the storage because they all seemed complicated or unsuitable.

1TB Proxmox backup partition

This part’s also pretty generic Linux. I made a filesystem with mkfs.ext4 /dev/sdd1. Then I edited /etc/fstab on the PVE host to mount it:

UUID=6ad88c2a-3a59-4d8f-a887-344e69c6711d /mnt/12tb-backup-usb ext4 defaults,nofail,x-systemd.device-timeout=15s 0 2

I don’t love this part, I’d rather not customize Proxmox config files. But this seems unavoidable, Proxmox doesn’t have a managed GUI for “just mount this partition for me”. The fstab works fine, I’ve done something similar on another server for most of a year.

Once I mounted the new filesystem I used the Proxmox GUI to add a new Storage named “usbbackup” of type “Directory” and pointed it to /mnt/12tb-backup-usb. Now Proxmox’ backup systems will write backups to it. Yay!

10TB OMV partition

This part is trickier. Conceptually it’s not hard: I just pass through the disk partition to the VM for it to use. But it’s a little weird.

First thing is finding the partition. I don’t want to name it /dev/sdd2 on the Proxmox host because that could change. I finally figured out it has a more stable name in /dev/disk/by-partuuid/. Not /by-uuid/ which you normally use, that’s for filesystems and we don’t even have one yet, we want the partition.

There’s no way in the Proxmox GUI to pass through a partition to a VM guest. It’s got a great GUI for creating virtual disks or passing hardware devices. Fortunately there’s docs on how to do it with the command line. The command I used is:

qm set 101 -scsi2 /dev/disk/by
-partuuid/14db8691-9229-407f-bb55-a693c1a92f70,iothread=1,backup=0

Note I added options for iothread=1,backup=0. That matches the other virtual disks that Proxmox created for me, and I think those are good choices. (More efficient I/O and don’t include the disk in Proxmox backups.) Here’s what my virtual drives look like in the GUI afterwards. The other two disks are QEMU images Proxmox manages for me.

With this done the 10TB partition /dev/sdd2 that Proxmox has now looks like /dev/sdc in the OMV VM. Note there’s no partition number, as far as the VM knows that device is a whole disk and not just a single partition. But I don’t want to make a partition table in that /dev/sdc. I think you can nest GPT partitions but that complicates things.

So instead I just ran mkfs.ext4 /dev/sdc inside the VM to turn the whole (virtual) disk into a filesystem. Then it shows up in /dev/disk/by-uuid and OMV can also mount it and use it via the GUI. I probably could have used OMV to create the filesystem, for that matter.

As an extra test I also shut down the OMV VM and then mounted the partition temporarily on the Proxmox host. Just to verify I could read the files. A real test would be to take the drive to a different computer entirely but that would require me driving somewhere to touch it.

I love how flexible all these systems are. Also appreciate being able to mix my old school sysadmin knowledge with some modern virtual systems stuff. It’s all quite productive.

Moving $HOME from one WSL to another with local rsync

I’m installing a new WSL system, essentially a Linux VM. I want to move my 13GB of home directory files over. WSL doesn’t provide any easy way to do this. You can export and import a whole virtual disk. You can tar up your home directory and copy it just like you would any other Linux box. And you can use WSL’s various strange mounts (including 9P) but those will be slow and screw up persmissions.

The way I settled on was running an rsync daemon from the command line.

The client send command in the source WSL instance is the easy part. The only strange thing here is “localhost” as the destination. WSL’s networking magic means that two separate Linux instances apparently share “localhost”. They probably share it with the Windows host, too. (The ::xfer in the destination looks magic too; see below for the server config file that defines it.)

rsync -az --info=progress2 --port=12345 ~ nelson@localhost::xfer

The server side to receive things is trickier. Launching the server is easy enough. I just ran this as root, was running into problems with changing group ownership as a normal user

rsync --daemon --config=rsyncd.conf --no-detach --address=localhost --port=12345

All the real work here is in rsyncd.conf. Here it is:

pid file = /tmp/rsyncd.pid
lock file = /tmp/rsync.lock
log file = /tmp/rsync.log

[xfer]
path = /home/nelson/xfer
comment = xfer
read only = false
list = true
uid = nelson
gid = nelson
auth users = nelson
secrets file = /home/nelson/secrets.txt

I didn’t check this too closely, an AI generated it for me. It seems to work. It’s possible all my files got chowned and chgrped to nelson but in this case (my home directory) that’s ok.

The one gotcha is secrets.txt. The contents are simple, I just made it nelson:p for the insecure plaintext password “p” (you have to have some password). But that file has to be only readable by the user running rsync. Otherwise auth won’t work but the error message won’t tell you why.

telegraf ping in unprivileged LXC containers

Quick hint for solution for pinging in native mode from telegraf in an LXC container:

setcap cap_net_raw+ep /usr/bin/telegraf

I use telegraf to run pings for monitoring networks. You can run it in a tiny Alpine LXC container in Proxmox. But there’s a permissions issue with unprivileged containers that results in status code 2 being logged to Influx and errors like these for native pings and exec pings:

Aug 18 22:32:00 influxdb telegraf[865]: 2024-08-18T22:32:00Z E! [inputs.ping] ping failed: permission changes required, enable CAP_NET_RAW capabilities (refer to the ping plugin's README.md for more info)

Aug 18 22:38:00 influxdb telegraf[896]: 2024-08-18T22:38:00Z E! [inputs.ping] Error in plugin: host "192.168.68.1": exit status 2 - /usr/bin/ping: socktype: SOCK_RAW
Aug 18 22:38:00 influxdb telegraf[896]: /usr/bin/ping: socket: Operation not permitted
Aug 18 22:38:00 influxdb telegraf[896]: /usr/bin/ping: => missing cap_net_raw+p capability or setuid?

What great error messages, whoever wrote that deserves a peer bonus. It’s almost enough to solve the problem! Turns out LXC containers are locked down and by default can’t manipulate raw packets. But ping needs to be able to do that. The solution is to give the binary doing the pinging the raw network capability:

setcap /usr/bin/telegraf cap_net_raw=ep

You can verify it took with getcap /usr/bin/telegraf. If you need exec pings you can make it work with setcap /usr/bin/ping cap_net_raw=ep

Here’s the weird thing. Root inside the container isn’t trusted. So why can root inside the container elevate the privileges of an executable in the container? Why does the hypervisor allow that?

The other weird thing: /usr/bin/ping in the container does not have this capability set in my Debian installs. But ping works anyway, you can ping from the container in a shell as root. However if telegraf tries to ping using that same binary, it doesn’t work.

I suspect the issue is telegraf is not running as root inside the container, it has its own user. Indeed, sudo -u telegraf ping 8.8.8.8 gives an error (unless you set the capability). I still don’t understand why root inside the container is trusted though. I must not understand what “untrusted ” really means in LXC.

Another USB failure (OWC enclosure)

Ugh, right after writing a big blog post about how I’d made a reliable USB storage array, it failed. I was making a backup with Restic from the RAID array to another USB disk and both disks in the RAID failed. The simple kernel reset didn’t work either. So ZFS suspended the pool and everything broke. A reboot took 10 minutes but it’s all back and I don’t think I lost any data. But ugh, now I don’t trust this hardware.

The problems start when a read command from UAS fails on drive sdc. 30 seconds later the kernel resets the device, at the same time there’s a read error from the other drive sdb. It’s at this point everything breaks. The reset doesn’t work and so the devices are both taken offline. That causes I/O errors that ZFS notices and it suspends the pool immediately.

Just after the pool is suspended both disks come back online with new device names (sdd and sde). But ZFS doesn’t just magically assume these are OK. 122 seconds later the kernel notices some tasks have been blocked and complain.

I don’t see any errors in journalctl in the VM guest that’s using this ZFS pool. Unfortunately the kernel logs didn’t persist after a reboot so I can’t check there. It looked like the backup process was still gamely trying to run, it wasn’t even in Device Wait, but I’m not sure.

I think I might have been able to recover from the command line with zpool clear or the like. But I figured rebooting Proxmox would be simpler. That took 10 minutes after I pressed the button on the Web GUI. There’s about 6 minutes of shutdown in the logs as it’s timing out on various things that are unhappy their disk went away. Then there’s an unexplained 4 minute gap from the last log line written during shutdown to a new log line for the kernel coming up again. Afterwards the reboot went smoothly, stuff was working again in 15 seconds or so.

Very frustrated. Particularly that in this case the kernel reset didn’t work: with previous USB errors things mostly recovered. It’s like the whole USB enclosure just failed. Which is actually quite a plausible explanation.

Update Sep 7: three weeks later I haven’t seen another error from these disks. Mostly just light use but I’ve taken two full backups, one with rsync and one with restic (the thing that triggered the error before). I’m running restic with a single CPU thread and read concurrency 1, so it doesn’t hit the disk as hard.

I don’t know what conclusion to draw from this. We’re going to keep using the disks in the USB setup for now. But if I ever set up another serious ZFS array I won’t use USB for it. Common wisdom it’s a bad idea and I’ve now had enough problems I respect it.

USB drives for Linux servers

A summary of what I’ve learned using USB drives to make a little NAS server with Linux.

The serious guides will tell you “don’t use USB for storage”. They’re probably right: USB adds an extra layer, the SATA/USB interface. And those chipsets seem pretty flaky, the last thing you want in a storage system. With most of the hardware I tested the Linux kernel would throw errors every 30 minutes or so and reset the device.

OTOH it mostly seems to work and not corrupt data. I finally found an enclosure that hasn’t thrown an error (yet).

Update: lol, not an hour after publishing this I got a failure from the enclosure I thought was good. A Restic backup (which is read intensive) triggered the failure. It didn’t even reset correctly, so the disks went offline and ZFS suspended the pool. ARGH!

If you have a SATA or Thunderbolt interface by all means use that instead. Related: Host Bus Adapters. But if USB is all you got, here’s some notes.

Drive types

I’m focusing here on spinning 3.5″ drives, Western Digital Red Plus. These drives are the best inexpensive option for storage that’s cheap and big. Sequential throughput is pretty good on these, at least 100MBytes/s. SSDs are great but are 3-4x the price for the size. 2.5″ spinning drives are also nice but max out at 5TB. Also they use SMR media which has weird performance and reliability issues. 3.5″ drives still come in CMR.

Enclosures

The enclosure takes a 3.5″ SATA disk and gives you an interface: USB, also maybe eSATA or Thunderbolt. Small enclosures are simple and take a single disk. Bigger enclosures allow you to plug in many drives with a single USB cable. They often include a hardware RAID chipset you probably won’t use (JBOD is preferred for ZFS). If you put it in JBOD mode Linux will see multiple separate hard rives on a single USB interface.

Enclosures provide power via a separate transformer (do not rely on bus power for 3.5″ drives.). I’ve heard that the quality of the power supply varies significantly and matters a lot: a power blip screws things up. I don’t know more about it. One nice thing about 2.5″ drives is they can be bus powered, simplifying things. If you don’t need big fast storage consider 2.5″.

Many enclosures don’t provide power again if there’s a power outage. They have a stupid pushbutton you have to physically press to turn it back on. Look instead of enclosures with rocker switches that come on automatically.

Enclosures also provide cooling. Cheap ones are just aluminum boxes with passive radiating. That seems OK for one disk but not many, I saw temperatures up to 55°C with two disks in a Yottamaster. The OWC enclosure I’m using has a small fan that makes a huge difference, max temperature like 36°C.

The big problem is finding a reliable enclosure. I spent a lot of time stress testing enclosures and found the older USB 3.0 ones from Yottamaster and SABRENT had kernel errors. A newer 3.1 enclosure from OWC seems more reliable, it is my preference now.

USB versions

USB 3.0 provides 5Gbps or 625MByte/s, much faster than a spinning disk. So any 3.0 interface is fine for a single disk in terms of throughput.

USB 3.1 and 3.2 can provide 10Gbps or 20Gbps. That shouldn’t matter for a single disk or really even two in an enclosure. OTOH I saw some evidence that two 5Gbps separate enclosures was twice as fast as a single 5Gbps enclosure with two disks, not sure what that means. I didn’t test with 10Gbps or 20Gbps links.

However, there’s a theory that newer chipsets are more reliable, that some of the bugs in older systems have been worked out. So I’m going to avoid USB 3.0 enclosures and favor those that offer USB 3.2, or at least 3.1. Even better is eSATA, Thunderbolt, or USB4. If you have an interface on your computer for those you should use them instead of USB.

Cables

USB cables matter! It’s very easy to use a crummy cable and only get 480Mbits/s instead of 5000. The quick advice is “look for a blue connector”. Use lsusb -t to verify the speed you’re getting. Be particularly wary of C-to-A cables, a lot of them are really for charging and are slow for data.

UAS vs usbstorage

usbstorage is the old Linux kernel module for USB disks. My older 2.5″ drives are using it. It seems fine.

uas is the new Linux kernel module for newer USB disks. UASP is basically SCSI and should perform better. Linux will use this module automatically if the drive supports it.

usbfs turns up on Proxmox if you pass through a USB device to a guest. I have no idea what it does, nothing seems mounted with it.

SMART

USB devices are supposed to support SMART but it’s kind of tricky. I need to do more research on this.

My old usbstorage drives work out of the box with SMART. With my newer UAS devices smartctl complains /dev/sdc: Unknown USB bridge with some enclosures. The quick hack is to run smartctl -d sat, which will probably work. There’s a more elaborate thing where you teach the SMART software about your drive type but I haven’t tried it.

Performance

Long story short how is USB performance? Pretty good, I think for sequential reads and writes I can get close to the spinning disk speeds. 100-150Mbytes/s, at least. Random access is slower of course and I saw some confusing results that depended on buffering. The final RAID mirror setup I have can do about 20MBytes/s read, 14MBytes/s write with an aggressively random access pattern. I don’t know whether USB is adding significant overhead or not.

FIO stress test of NAS options

This blog post is a very long record of my testing of a disk array. I’m building a cheap NAS with 2 USB disks (8GB, 5400RPM) in a ZFS mirror configuration plugged in to an N100 MiniPC with 5Gbit USB links. I’m trying several enclosures: a Yottamaster dual bay, two SABRENT single bays, and an OWC dual bay. My main goal here is to find a reliable enclosure. (Spoiler: it’s the OWC.)

I’m running everything on Proxmox. Most of my tests are with Proxmox managing a ZFS pool and creating a virtual disk it passes in to an OpenMediaVault VM (aka OMV). Then I CIFS/SMB mount the disk back on the Proxmox host for further testing. I also did a bit of testing with TrueNAS in a VM where Proxmox just passes the USB disks in as devices for TrueNAS to manage a pool on.

Conclusions

  • Two of three USB enclosures generate kernel errors. Under heavy load there will be a command failure followed by a USB reset about every 30 minutes. In all cases the system recovers and it looks like no data is lost.
  • The OWC enclosure generates no kernel errors. It is also the lowest temperatures.
  • Throughput is wildly variable, sometimes transfers stall. I assume it’s buffering.
  • Network filesystems buffer even if you set various modes telling them not to.
  • TrueNAS seems to have better throughput than OMV. I didn’t test carefully.
  • TrueNAS is unusable with the Yottamaster enclosure, too many errors. It sort of worked with the SABRENT. Didn’t try the OWC.
  • The Yottamaster enclosure is unsuitable. Doesn’t turn itself on after a power outage, also not adequate cooling.
  • The SABRENT enclosures are OK. I don’t love having two power supplies. There were a few more errors in my testing but maybe that was just bad luck.

Decisions

  • I’m going with the OWC enclosure.
  • I’m going to stick with Proxmox ZFS and OMV for the NAS. There’s evidence TrueNAS performs better but I’m nervous about its complexity. Also feeling burned after the bad first experience with the Yottamaster enclosure although that’s probably the USB device’s fault.

The test job

I’ve been enjoying learning fio, the disk throughput tool, mostly because it has very good docs. Which means not only can I read them but the AIs can too. Phind gets it wrong sometimes though so I’m mostly hand-crafting my own fio setups now.

I cooked up a job file (see below) which I’m using as a small stress test as I try different USB hardware and ZFS / virtualization / network file system configurations. My main goal here is to run it for a long time to see if the disks fail in some way, also to measure temperature. I’m less worried about the actual throughput although it’s interesting.

The job file defines a job against a 1GB file. Random reads and writes of blocks from 4k to 1M. Up to 16 in parallel (io_depth), direct I/O enabled. (Note direct=1 means O_DIRECT which doesn’t actually work over a network file system. Oops.) I’m running two jobs in parallel for 15 minutes.

In general I’m seeing throughput of about 28MB/s both read and write, maybe 130 IOPS. That’s whether native on the ZFS machine, through VM disk, or through SMB to the VM disk. (Presumably seek time is dominating.) Not very fast but this is a random access test on a spinning disk. (Sequential gets up to 250 MB/s).

Weirdly I’m seeing more like 100MB/s with an SMB network mount. I’ve chalked this up to me not understanding caching in network file systems. Details below.

Here’s my results from several hours of testing. fio was run on Proxmox natively (which owns the ZFS pool), then on a OpenMediaVault VM (OMV) which gets a virtual disk from Proxmox, then from the Proxmox host itself that has SMB mounted the share from OMV. I also did a few tests with a different configuration: TrueNAS managing the two USB disks directly as USB devices and exporting over SMB.

Measurements

Tests with various enclosures, then some extra scenarios with the OWC enclosure.

OWC results

The hardware is a Mercury Elite Pro Dual, USB 3.1 at 5GBit, UAS. This device can do RAID bit I have it in JBOD mode, “IND”. PITA to get the disks installed, the mechanical design is not great, but it seem sturdy and has a little fan. It also advertises USB 3.1 (5Gbit) and there’s a theory that newer USB revisions imply newer, better chipsets.

Smartctl requires -d sat to work.

Max temperature: 34°C, the fan really helps. The disks are pretty noisy, the enclosure does nothing to dampen the sound.

No errors from the kernel! Haven’t seen a single UAS error after several hours of testing, unlike the other enclosures.

Throughput

  1. Proxmox ZFS native run 1: 21.0MiB/s read, 13.0 write, 97 IOPS.
  2. Proxmox ZFS native run 2: 21.4 read, 13.6 write.
  3. OMV: read 24.9 write 13.6, 109 IOPS
  4. SMB client of OMV run 1: read 122 MiB/s, write 66.5 MiB/s, 552 IOPS.
  5. SMB client of OMV run 2: read 133 MiB/s, write 72 MiB/s

The ZFS native test seems pretty slow at 21/13, it’s the slowest of the three enclosures I tried. Although that’s not that much slower than the Yottamaster dual enclosure test at 28/18. hdparm -t (a simple sequential test of a single drive) shows 210MB/s, so it’s not totally broken.

Yottamaster results

Yottamaster PS200U3. One dual disk USB enclosure at 5Gbit USB 3.0, UAS.

smartctl works out of the box on Proxmox, needed -d sat in TrueNAS.

Max temperature: 52°C. Noisy too.

Kernel errors: while testing over about 90 minutes I got one driver reset of a read command.

Throughput

  • Proxmox ZFS native: read 28MiB/s, write 18MiB/s, 131 IOPS.
  • OMV run 1: read 27MiB/s, write 15MiB/s, 122 IOPS. (Had a reset!)
  • OMV run 2: read 28MiB/s, write 16MiB/s, 127 IOPS.
  • SMB client of OMV run 1: read 98MiB/s, write 53MiB/s, 443 IOPS.
  • SMB client of OMV run 2: read 104MiB/s, write 55.7MiB/s, 470 IOPS.

SABRENT results

Two single disk SABRENT EC-KSL3 USB enclosures at 5Gbit USB 3.0. UAS. I’ve been using a third one of these for a week+ with good luck.

smartctl requires -d sat in Proxmox

Temperatures: 41. Quietest of the three.

More errors, but throughput looks good. While testing got an ugly UAS reset in the VM fio run. From the first error it took 54 seconds before a reset came through. OTOH it didn’t seem to affect throughput. Only one disk got reset, don’t know what ZFS does about that. A second reset during the SMB mount test, again not hurting throughput. Weird.

I also got a new kind of error I’ve not seen before, maybe related to erasing blocks? This error doesn’t end up in the SMART log.

[Mon Aug 12 01:28:06 2024] sd 1:0:0:0: [sdd] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_OK cmd_age=0s
[Mon Aug 12 01:28:06 2024] sd 1:0:0:0: [sdd] tag#0 Sense Key : Illegal Request [current]
[Mon Aug 12 01:28:06 2024] sd 1:0:0:0: [sdd] tag#0 Add. Sense: Invalid command operation code
[Mon Aug 12 01:28:06 2024] sd 1:0:0:0: [sdd] tag#0 CDB: Write same(16) 93 08 00 00 00 00 00 02 fe 90 00 00 09 70 00 00
[Mon Aug 12 01:28:06 2024] critical target error, dev sdd, sector 196240 op 0x3:(DISCARD) flags 0x800 phys_seg 1 prio class 0

All in all 3 kernel errors compared to just 1 with the Yottamaster for the same amount of testing. Feels bad man. The fio verify didn’t find any problems though. I ran a ZFS scrub and it didn’t find any problems.

Throughput

  • Proxmox ZFS native: read 58, write 37, 266 IOPS.
  • OMV run 1: read 60.3 write 33.5 , 270 IOPS. (Had a reset!)
  • OMV run 2: read 59.8 write 33.7 , 275 IOPS (No reset).
  • SMB client of OMV run 1: read 128 MiB/s, write 68.4 MiB/s, 578 IOPS.
  • SMB client of OMV run 2: read 145 MiB/s, write 75 MiB/s, 658 IOPS.
  • SMB client of OMV run 3: read 133 write 68. (Reset)

Note the Proxmox and OMV throughput is better, maybe 2x what I got with the dual bay enclosures. Is that as simple as it being because I’m using two USB ports and two 5Gbit connections? (The max throughput I’ve seen is about 200MB/s or 1.6Gbit, well under a single 5Gb wire, so it’s not as simple as max bandwidth.) OTOH I’ve gotten more errors and more variety of errors. But all the data seems to be correctly being read and written.

TrueNAS tests

In addition to testing enclosures I did a couple of tests with TrueNAS managing the ZFS pool using USB devices passed in from Proxmox. This failed catastrophically with the Yottamaster enclosure, far too many errors. These tests are with the SABRENT. I didn’t try the OWC with TrueNAS.

The main thing I was wondering was what sort of errors I’d see, if any. I saw only one error with three 15 minute runs on TrueNAS, about halfway through a VM test. Write(16) commands failed and it reset about 30 seconds later and seemed to carry on fine.

Throughput

  1. TrueNAS VM run 1: 122MiB/s read, 64 write, 550 IOPS
  2. TrueNAS VM run 2: 137 read, 72 write
  3. SMB client of TrueNAS VM: 138MiB/s read, 76 write, 630 IOPS

I’m less worried about throughput comparisons to OMV, I care most about stability. But compared to the Proxmox ZFS + OMV solution it seems both faster and with less jitter. That is not surprising but should be confirmed more.

SMB and buffering tests

I tried to understand more what was going on with the SMB clients being faster than local writes. It’s definitely related to O_DIRECT and other synchronous writes not being enabled on network filesystems. Most of my tests were with direct=1 in FIO but that doesn’t really mean anything on an SMB mount. Forcing sync writes slows the network tests way down.

I ran some 1 minute tests of different configs on the VM writing to its virtual disk. The FIO test set was 1GB which might fit in caches or might not. I noticed the second time I ran the same test it was much faster, which suggests warming up the caches is a big factor in a 1 minute test.

  1. direct=1, end_fsync=1 (like most tests): 15MiB/s read, 16 MiB/s write.
  2. direct=0, buffered=1, end_fsync=1: 15MiB/s read, 15 MiB/s write.
  3. fio defaults (buffered and no fsync, I think): 13MiB/s read, 13MiB write.
  4. sync=1, fsync=1: 3.2MiB/s read, 3.7MiB/s write.

I can’t make much sense of these local results: even with full buffering I can’t get to the 100MiB/s the disk is capable of. Maybe it’s a virtualization issue, or the client workload being on the disk. The VM has 4GB of RAM allocated which I think should be enough to cache a 1GB working set.

I also re-ran these tests on the SMB host. I ran the first one twice and took the second result.

  1. direct=1, end_fsync=1 (like most tests): 102MiB/s read, 64 MiB/s write.
  2. direct=0, buffered=1, end_fsync=1: 110MiB/s read, 72.9 MiB/s write.
  3. fio defaults (buffered and no fsync, I think): 160 read, 118 write.
  4. sync=1, fsync=1: 3.0 read, 3.3 write.

These results suggest that the network filesystems are caching even in most IO modes that say don’t. That’s fair, it’s a real world result for a network client. Forcing sync and fsync does slow it down as expected.

To be honest, I don’t really understand all of what’s going on here, I don’t know FIO or network filesystems well enough to fully sort this out. Given my main goal was stability testing, eh, I’m OK with my ignorance for now.

Application testing

I did a bunch of real world testing, writing via SMB to the OMV VM with the OWS enclosure.

  1. Linux rsync of a music library: 21MB/s.
  2. Linux dd writing 16GB from /dev/urandom: 70MB/s
  3. dd reading 16GB of random: 182MB/s
  4. dd writing 16GB from /dev/zero: 188MB/s
  5. dd reading 16GB of zeros: 718MB/s
  6. WSL (drvfs) reading 16GB of random: 42MB/s
  7. WSL (drvfs) writing 1GB of random: 39MB/s
  8. Windows explorer reading or writing 1GB of random: 112MB/s

The FIO job file

[stress]
name=stress
description=Nelson small stress test

runtime=900
numjobs=2
time_based=1

rw=randrw
verify=crc32c

bsrange=4k-1M
size=1G

ioengine=libaio
iodepth=16
direct=1
end_fsync=1

Example output (from an OMV VM run)

This run had a kernel reset in the first minute or two.

stress: (g=0): rw=randrw, bs=(R) 4096B-1024KiB, (W) 4096B-1024KiB, (T) 4096B-1024KiB, ioengine=libaio, iodepth=16
...
fio-3.33
Starting 2 processes
Jobs: 2 (f=2): [f(2)][100.0%][eta 00m:00s]
stress: (groupid=0, jobs=1): err= 0: pid=128236: Sun Aug 11 21:42:17 2024
  Description  : [Nelson small stress test]
  read: IOPS=42, BW=13.9MiB/s (14.6MB/s)(12.3GiB/904825msec)
    slat (usec): min=2, max=8473, avg=26.58, stdev=52.04
    clat (usec): min=30, max=8023.4k, avg=158853.13, stdev=208421.15
     lat (usec): min=42, max=8023.4k, avg=158879.70, stdev=208425.03
    clat percentiles (usec):
     |  1.00th=[     66],  5.00th=[    137], 10.00th=[    245],
     | 20.00th=[    742], 30.00th=[   1565], 40.00th=[   3621],
     | 50.00th=[  79168], 60.00th=[ 143655], 70.00th=[ 206570],
     | 80.00th=[ 316670], 90.00th=[ 480248], 95.00th=[ 583009],
     | 99.00th=[ 742392], 99.50th=[ 801113], 99.90th=[ 926942],
     | 99.95th=[1027605], 99.99th=[3439330]
   bw (  KiB/s): min=   24, max=258184, per=47.42%, avg=13000.64, stdev=16851.88, samples=985
   iops        : min=    0, max=  564, avg=38.20, stdev=39.37, samples=985
  write: IOPS=23, BW=8021KiB/s (8213kB/s)(6549MiB/836125msec); 0 zone resets
    slat (usec): min=7, max=3420.8k, avg=343.27, stdev=24216.95
    clat (usec): min=6, max=30381k, avg=292247.93, stdev=1846279.09
     lat (usec): min=58, max=30381k, avg=292591.21, stdev=1846416.62
    clat percentiles (usec):
     |  1.00th=[      70],  5.00th=[     101], 10.00th=[     131],
     | 20.00th=[     192], 30.00th=[     293], 40.00th=[     979],
     | 50.00th=[    5669], 60.00th=[   13173], 70.00th=[   72877],
     | 80.00th=[  183501], 90.00th=[  367002], 95.00th=[  526386],
     | 99.00th=[ 8791262], 99.50th=[17112761], 99.90th=[17112761],
     | 99.95th=[17112761], 99.99th=[17112761]
   bw (  KiB/s): min=    8, max=299704, per=87.37%, avg=13650.88, stdev=19572.55, samples=977
   iops        : min=    0, max=  646, avg=40.49, stdev=45.01, samples=977
  lat (usec)   : 10=0.01%, 50=0.22%, 100=3.47%, 250=12.13%, 500=8.42%
  lat (usec)   : 750=2.49%, 1000=2.13%
  lat (msec)   : 2=7.58%, 4=6.57%, 10=4.21%, 20=4.34%, 50=3.45%
  lat (msec)   : 100=4.07%, 250=19.25%, 500=13.82%, 750=6.52%, 1000=0.65%
  lat (msec)   : 2000=0.08%, >=2000=0.61%
  cpu          : usr=0.51%, sys=0.23%, ctx=44359, majf=0, minf=60
  IO depths    : 1=0.1%, 2=0.1%, 4=0.2%, 8=0.3%, 16=99.4%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.1%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued rwts: total=38221,19954,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=16
stress: (groupid=0, jobs=1): err= 0: pid=128237: Sun Aug 11 21:42:17 2024
  Description  : [Nelson small stress test]
  read: IOPS=36, BW=12.9MiB/s (13.5MB/s)(11.4GiB/904823msec)
    slat (usec): min=2, max=37758, avg=29.45, stdev=218.32
    clat (usec): min=3, max=5053.6k, avg=184087.63, stdev=201615.07
     lat (usec): min=41, max=5053.7k, avg=184117.07, stdev=201618.12
    clat percentiles (usec):
     |  1.00th=[     65],  5.00th=[    135], 10.00th=[    219],
     | 20.00th=[    490], 30.00th=[   1680], 40.00th=[  58983],
     | 50.00th=[ 137364], 60.00th=[ 187696], 70.00th=[ 256902],
     | 80.00th=[ 362808], 90.00th=[ 484443], 95.00th=[ 583009],
     | 99.00th=[ 725615], 99.50th=[ 775947], 99.90th=[ 926942],
     | 99.95th=[1002439], 99.99th=[1635779]
   bw (  KiB/s): min=   24, max=303480, per=48.60%, avg=13324.66, stdev=15923.38, samples=900
   iops        : min=    0, max=  636, avg=36.52, stdev=34.91, samples=900
  write: IOPS=21, BW=7829KiB/s (8017kB/s)(6208MiB/812003msec); 0 zone resets
    slat (usec): min=8, max=23051, avg=172.05, stdev=269.40
    clat (usec): min=4, max=26223k, avg=345496.71, stdev=1929292.62
     lat (usec): min=56, max=26223k, avg=345668.76, stdev=1929294.26
    clat percentiles (usec):
     |  1.00th=[      68],  5.00th=[     101], 10.00th=[     130],
     | 20.00th=[     192], 30.00th=[     269], 40.00th=[     400],
     | 50.00th=[    2409], 60.00th=[   11469], 70.00th=[   33162],
     | 80.00th=[  214959], 90.00th=[  438305], 95.00th=[  591397],
     | 99.00th=[ 9328133], 99.50th=[17112761], 99.90th=[17112761],
     | 99.95th=[17112761], 99.99th=[17112761]
   bw (  KiB/s): min=   16, max=360360, per=91.60%, avg=14312.77, stdev=19145.59, samples=884
   iops        : min=    0, max=  756, avg=39.49, stdev=41.87, samples=884
  lat (usec)   : 4=0.01%, 10=0.01%, 50=0.24%, 100=3.43%, 250=13.62%
  lat (usec)   : 500=11.35%, 750=3.48%, 1000=1.55%
  lat (msec)   : 2=3.97%, 4=2.64%, 10=2.95%, 20=4.05%, 50=3.18%
  lat (msec)   : 100=3.23%, 250=19.75%, 500=17.91%, 750=7.21%, 1000=0.56%
  lat (msec)   : 2000=0.06%, >=2000=0.80%
  cpu          : usr=0.62%, sys=0.19%, ctx=42436, majf=0, minf=58
  IO depths    : 1=0.1%, 2=0.1%, 4=0.2%, 8=0.4%, 16=99.3%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.1%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued rwts: total=33008,17566,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=16

Run status group 0 (all jobs):
   READ: bw=26.8MiB/s (28.1MB/s), 12.9MiB/s-13.9MiB/s (13.5MB/s-14.6MB/s), io=23.7GiB (25.4GB), run=904823-904825msec
  WRITE: bw=15.3MiB/s (16.0MB/s), 7829KiB/s-8021KiB/s (8017kB/s-8213kB/s), io=12.5GiB (13.4GB), run=812003-836125msec

Disk stats (read/write):
  sdb: ios=71241/37679, merge=0/79, ticks=12088873/12617701, in_queue=25410356, util=98.74%

Example output (fast OMV SMB)

stress: (g=0): rw=randrw, bs=(R) 4096B-1024KiB, (W) 4096B-1024KiB, (T) 4096B-1024KiB, ioengine=libaio, iodepth=16
...
fio-3.33
Starting 2 processes
Jobs: 2 (f=2): [F(2)][100.0%][eta 00m:00s]
stress: (groupid=0, jobs=1): err= 0: pid=2695937: Sun Aug 11 22:35:44 2024
  Description  : [Nelson small stress test]
  read: IOPS=145, BW=47.6MiB/s (49.9MB/s)(42.5GiB/913477msec)
    slat (usec): min=2, max=26353, avg=58.40, stdev=206.57
    clat (usec): min=104, max=2047.9k, avg=12816.66, stdev=61461.93
     lat (usec): min=117, max=2047.9k, avg=12875.05, stdev=61461.19
    clat percentiles (usec):
     |  1.00th=[    996],  5.00th=[   2147], 10.00th=[   2769],
     | 20.00th=[   3621], 30.00th=[   4424], 40.00th=[   5407],
     | 50.00th=[   6521], 60.00th=[   7701], 70.00th=[   9110],
     | 80.00th=[  10814], 90.00th=[  13698], 95.00th=[  17171],
     | 99.00th=[ 120062], 99.50th=[ 446694], 99.90th=[ 960496],
     | 99.95th=[1166017], 99.99th=[1484784]
   bw (  KiB/s): min=   33, max=571776, per=100.00%, avg=105476.19, stdev=139877.54, samples=369
   iops        : min=    0, max= 1773, avg=299.33, stdev=402.43, samples=369
  write: IOPS=78, BW=25.4MiB/s (26.7MB/s)(21.9GiB/882111msec); 0 zone resets
    slat (usec): min=8, max=19996, avg=422.84, stdev=490.09
    clat (usec): min=120, max=4478.9k, avg=20844.50, stdev=104407.14
     lat (usec): min=145, max=4479.4k, avg=21267.34, stdev=104398.63
    clat percentiles (usec):
     |  1.00th=[    570],  5.00th=[   2376], 10.00th=[   2966],
     | 20.00th=[   3884], 30.00th=[   4817], 40.00th=[   5997],
     | 50.00th=[   7177], 60.00th=[   8717], 70.00th=[  10552],
     | 80.00th=[  13435], 90.00th=[  22938], 95.00th=[  55837],
     | 99.00th=[ 270533], 99.50th=[ 505414], 99.90th=[1535116],
     | 99.95th=[1954546], 99.99th=[4076864]
   bw (  KiB/s): min=  116, max=588064, per=100.00%, avg=111529.76, stdev=145498.82, samples=361
   iops        : min=    0, max= 1835, avg=319.26, stdev=420.92, samples=361
  lat (usec)   : 250=0.15%, 500=0.39%, 750=0.33%, 1000=0.28%
  lat (msec)   : 2=2.62%, 4=19.68%, 10=49.18%, 20=21.19%, 50=3.53%
  lat (msec)   : 100=1.01%, 250=0.79%, 500=0.38%, 750=0.21%, 1000=0.13%
  lat (msec)   : 2000=0.13%, >=2000=0.02%
  cpu          : usr=1.78%, sys=1.96%, ctx=161455, majf=0, minf=61
  IO depths    : 1=0.1%, 2=0.1%, 4=0.2%, 8=0.3%, 16=99.4%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.1%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued rwts: total=132944,68929,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=16
stress: (groupid=0, jobs=1): err= 0: pid=2695938: Sun Aug 11 22:35:44 2024
  Description  : [Nelson small stress test]
  read: IOPS=144, BW=51.0MiB/s (53.5MB/s)(45.5GiB/913651msec)
    slat (usec): min=2, max=23315, avg=57.89, stdev=177.90
    clat (usec): min=101, max=1961.1k, avg=12840.81, stdev=60523.78
     lat (usec): min=124, max=1961.2k, avg=12898.70, stdev=60523.08
    clat percentiles (usec):
     |  1.00th=[   1057],  5.00th=[   2212], 10.00th=[   2966],
     | 20.00th=[   3949], 30.00th=[   4752], 40.00th=[   5669],
     | 50.00th=[   6587], 60.00th=[   7767], 70.00th=[   8979],
     | 80.00th=[  10814], 90.00th=[  13566], 95.00th=[  16909],
     | 99.00th=[ 113771], 99.50th=[ 480248], 99.90th=[ 926942],
     | 99.95th=[1098908], 99.99th=[1434452]
   bw (  KiB/s): min=   11, max=535318, per=100.00%, avg=116860.38, stdev=139385.70, samples=352
   iops        : min=    0, max= 1606, avg=310.24, stdev=377.85, samples=352
  write: IOPS=77, BW=27.3MiB/s (28.6MB/s)(23.6GiB/884188msec); 0 zone resets
    slat (usec): min=6, max=26990, avg=438.46, stdev=504.53
    clat (usec): min=132, max=2040.9k, avg=17837.66, stdev=67499.86
     lat (usec): min=162, max=2041.4k, avg=18276.12, stdev=67487.74
    clat percentiles (usec):
     |  1.00th=[    668],  5.00th=[   2704], 10.00th=[   3556],
     | 20.00th=[   4686], 30.00th=[   5669], 40.00th=[   6783],
     | 50.00th=[   7963], 60.00th=[   9241], 70.00th=[  10945],
     | 80.00th=[  13566], 90.00th=[  21365], 95.00th=[  46924],
     | 99.00th=[ 204473], 99.50th=[ 387974], 99.90th=[1019216],
     | 99.95th=[1434452], 99.99th=[1769997]
   bw (  KiB/s): min=   82, max=585474, per=100.00%, avg=126777.70, stdev=149747.38, samples=347
   iops        : min=    0, max= 1630, avg=335.09, stdev=397.89, samples=347
  lat (usec)   : 250=0.12%, 500=0.35%, 750=0.31%, 1000=0.27%
  lat (msec)   : 2=2.34%, 4=14.81%, 10=53.90%, 20=22.06%, 50=3.49%
  lat (msec)   : 100=0.93%, 250=0.67%, 500=0.31%, 750=0.21%, 1000=0.15%
  lat (msec)   : 2000=0.09%, >=2000=0.01%
  cpu          : usr=2.50%, sys=2.06%, ctx=165105, majf=0, minf=58
  IO depths    : 1=0.1%, 2=0.1%, 4=0.2%, 8=0.4%, 16=99.3%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.1%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued rwts: total=132204,68715,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=16

Run status group 0 (all jobs):
   READ: bw=98.6MiB/s (103MB/s), 47.6MiB/s-51.0MiB/s (49.9MB/s-53.5MB/s), io=88.0GiB (94.5GB), run=913477-913651msec
  WRITE: bw=52.7MiB/s (55.2MB/s), 25.4MiB/s-27.3MiB/s (26.7MB/s-28.6MB/s), io=45.5GiB (48.8GB), run=882111-884188msec

Accessing a Proxmox guest in ZFS from a rescue disk

Testing disaster recovery: what if my Proxmox server dies and I need to get data from a VM disk stored in it in ZFS? The simple thing is to boot Proxmox and use it to recover. But what if I don’t want to use Proxmox to get at my files? It’s possible, at least in theory, using generic ZFS and QEMU tools. I tried this and it seemed to work.

(An aside: I harshly unplugged my ZFS pool disks while Proxmox was running, then plugged them in later. Proxmox didn’t handle this very well, I ended up having to reboot the Proxmox server and then everything was back with no drama.)

Part 1: import the ZFS pool

The first step is to get the ZFS pool online in a rescue environment.

  1. Boot systemrescue-zfs on some computer.
  2. Plug the drives from your ZFS pool into the rescue machine
  3. Run lsblk to see that the drives are present.
  4. Run zpool import to see a list of pools. Your Proxmox pool should be there. Proxmox creates rpool on install, you may have others.
  5. Run zpool import -f poolname to import the pool.
  6. Run zfs list to see what the pool has in it

At this point any normal filesystems in Proxmox are mounted somewhere in the filesystem and you can cd to their directories, copy them as files, etc.

Part 2: access the QEMU virtual disks

I’m after data that’s in a guest virtual machine’s disk. And those aren’t stored in normal files. Instead they are stored in ZFS datasets with funny names like rpool/data/vm-100-disk-1. They are in QEMU disk image format. (I think raw, not qcow2, but I am not certain.)

There’s several options for what to do next. You could zfs send the data somewhere safe. In Proxmox you could access the virtual disks with the qm command line tool. There’s probably a way to use qemu-img dd to get your data. But here in systemrescue-zfs I’m going to mount it via a network block device.

I’m a little out of my depth here but I bashed my way into getting access like this

  1. cd /zvol. In here is filesystem access to the ZFS datasets (as symlinks to block devices)
  2. Find the virtual disk you want, say vm-100-disk-1
  3. qemu-img info vm-100-disk-1 to see if there’s a plausible disk image there.
  4. modprobe nbd max_part=8 to load a driver for network block devices
  5. qemu-nbd --connect=/dev/nbd0 vm-100-disk-1 to make the QEMU disk available as /dev/nbd0. Note this is the whole disk, not just one partition.
  6. fdisk /dev/nbd0 -l to see the partition table of the virtual disk
  7. mount /dev/nbd0p1 /mnt/hope to mount the partition 1 filesystem as /mnt/hope.
  8. cd /mnt/hope and there’s your stuff!

USB enclosures and Linux

I’m beginning to see why everyone says not to use USB enclosures with Linux. It’s a cursed product category. I’m finding it very hard to find a simple two bay JBOD enclosure that might work reliably. OTOH I’ve been using 2.5″ USB drives with a server successfully for a year+ now, this general concept should work. And I’ve been using a new drive in a SABRENT 3.5″ single disk enclosure successfully. But I’m having a hard time finding 3.5″ enclosures that take more than one disk.

Update 1: see at bottom

Update 2: see this video which talks favorably about newer USB 3.2 enclosures like the Mediasonic Probox.

Update 3: see this Reddit post I made.

Horror stories abound of buggy JMicron chipsets. It’s never quite clear if the reports are real, they’re mostly ranty Amazon reviews. But definitely bad vibes.

I know for sure there’s one big problem with the USB enclosure product category: power restoration. Most of these enclosures will not turn back on when power is restored until you press a button on them box. WTF? Why would you build hardware like that?

Also USB enclosures typically have a low power / idle mode when not used for awhile. I’m OK with it taking a few seconds for the disks to spin up (although it’d be nice to have control over that). But some of them seem to never come back online or start throwing errors.

None of these devices I’ve bought recently work out of the box with smartctl. They aren’t identified correctly. smartctl -d sat works around the problem, sort of. There’s also some way to register the device in a database to teach smartctl about it. This identification thing seems to be a problem with the UAS driver in particular, or maybe it’s the 2022 version of smartctl Debian is installing.

SABRENT EC-KSL3, it works?

I’ve had decent luck for a few days with a SABRENT EC-KSL3, a $30 single disk enclosure. I don’t love the physical toolless design but the interface seems to work with my Linux box running OMV. It’s fanless aluminum which I think is OK for a single disk.

The device has a physical rocker switch for power. I need to test it but I assume that means it will come back on when power is restored. I think it’s gone to sleep a few times but seems to come back every time. I saw a couple of resets from the kernel driver early in trying to use it but have gone most of a day now without a single reset. So good?

The chipset is some sort of JMicron, not sure which.

Yottamaster PS200U3: it doesn’t work?

Much worse first experience with a Yottamaster PS200U3, a $80 dual disk enclosure. The physical design is pretty nice, they even included decent tools and extra screws. No fan and it’s plastic inside, so some question about thermals.

It has pushbutton power you definitely have to press to get it to turn on after a power failure. (Confirmed with support.) But none of that matters because the device is just not working. Ugh!

The chipset is a JMicron JMS56x.

I set it up with TrueNAS and my ZFS array disappeared within a few minutes. At least, TrueNAS can’t find it. Looking at the kernel log I see a whole lot of errors from the UAS driver and attempts to reset followed by giving up on the device entirely.

Whatever the case the disks in this enclosure just do not work with TrueNAS scale. There could be other sources of errors: the disks themselves, or the virtualization in the middle, or maybe TrueNAS. But I’m inclined to blame the enclosure.

Here’s an example dmesg log for errors in TrueNAS for the USB disk. This gets triggered just trying to look at the Storage status page in the web UI. The first line shows a reset at 67 seconds, the rest of it is another problem starting at 300 seconds (errors) and then a rest at 330s. I think these things have a 5 minute idle timeout so that doesn’t even explain it.

[   67.520053] scsi host3: uas_eh_device_reset_handler success
[  300.078621] sd 3:0:0:1: [sdc] tag#6 uas_eh_abort_handler 0 uas-tag 4 inflight: IN
[  300.078642] sd 3:0:0:1: [sdc] tag#6 CDB: Read(16) 88 00 00 00 00 00 00 00 22 20 00 00 00 e0 00 00
[  330.798889] sd 3:0:0:1: [sdc] tag#4 uas_eh_abort_handler 0 uas-tag 3 inflight: IN
[  330.799100] sd 3:0:0:1: [sdc] tag#4 CDB: ATA command pass through(16) 85 08 0e 00 d5 00 01 00 06 00 4f 00 c2 00 b0 00
[  330.814733] scsi host3: uas_eh_device_reset_handler start
[  331.071192] usb 3-1: reset SuperSpeed USB device number 2 using xhci_hcd
[  331.096325] scsi host3: uas_eh_device_reset_handler success

On further testing I can reproduce the problem by trying to open the Storage Dashboard in TrueNAS, it happens even if I try again in just over a minute. My guess is TrueNAS is issuing some commands via UAS that the controller or disks really don’t like and it’s crashing the connection to the drive. Could be a Linux bug, could be a controller bug. I sure hope this problem is isolated to the Yottamaster.

Update

I’m beginning to suspect TrueNAS Scale is the issue. This exact same hardware is doing fine with a ZFS pool built inside Proxmox. I made a 4TB virtual disk and shared it into an OpenMediaVault VM and so far it’s working great. Was able to write a bunch of data and run fio tests with no problem, no errors from the kernel. Also smartctl works out of the box on Proxmox.

Maybe TrueNAS is doing more complex probing on the disk? The TrueNAS docs do say not to use it with USB, so maybe that’s why. I may still try TrueNAS with some different enclosures.

This Proxmox ZFS + OMV solution is not bad. It’s not ideal from a management perspective, I’d rather the NAS VM knew more about the real hardware. But Proxmox is pretty good at that too. And I/O performance as measured by fio is pretty good. Some numbers:

Sequential writes on PVE (direct): 727MiB/s, 186k IOPS. ?!
Sequential writes via NFS: 70.3 MiB/s, 18.0k IOPS.
Sequential writes via SMB: 70.2MiB/s, 18.0k IOPS.

Random writes on PVE: 26.3MiB/s, 6734 IOPS
Random writes via SMB: 18.6MiB/s, 4759 IOPS
Random writes via NFS: 29.1MiB/s, 7458 IOPS

Basically this tells me it’s fast enough. The actual physical disks are probably about 100-150 MiB/s depending on where on the spindle you’re writing. So ZFS is costing us something, and then the network overhead is more, but it’s all reasonably fast for low end hardware.

Clearly that 727MiB/s number is bogus, I guess ZFS write caching. Weird because I have --end_fsync=1. If I add --fsync=10000 it backs off to about 73MiB/s, more plausible.

Samsung SSD firmware updates

This post is a rant about how bad Samsung’s SSD software is. Summary: the ISOs only boot with legacy BIOS, not UEFI. Samsung Magician for Windows is awful.

My 256GB Samsung 970 Evo used to be a system drive, then sat idle, and is now a new system drive replacing the failed one in my BOSGAME. But this new (old) drive is also suspect, I got a scary looking error from the kernel last night

[28863.608367] sd 2:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_OK cmd_age=0s [28863.609453] sd 2:0:0:0: [sda] tag#0 Sense Key : Illegal Request [current] [28863.610523] sd 2:0:0:0: [sda] tag#0 Add. Sense: Invalid command operation code [28863.611537] sd 2:0:0:0: [sda] tag#0 CDB: Write same(16) 93 08 00 00 00 00 00 02 fe 90 00 00 09 70 00 00 [28863.612526] critical target error, dev sda, sector 196240 op 0x3:(DISCARD) flags 0x800 phys_seg 1 prio class 0

So I checked some error logs with nvme and the firmware version with smartctl. I had firmware 1B2QEXE7 but there might be a 2B2QEXE7. There’s no clear way to update firmware from a running Linux system, so looking for options...

Updating from ISO

Samsung makes firmware available as ISO updates. Burn a small USB disk, boot it, update. Only joke’s on me, their ISO images won’t boot on a modern BIOS. Doesn’t seem to work with UEFI at all, secure boot or no. I could get it to boot in legacy mode / MBR, at least in a test VM, but screw that. (BTW the ISO contains a Linux system, lol.)

So I gave up. I pulled the drive and put it in a USB enclosure to update on my Windows machine. Which didn’t work either.

Samsung Magician Windows Updates

Samsung has a consumer management tool called Magician. I thought it used to be pretty good but over the years it has enshittified.

I had a copy of Magician my Windows system already, version 5.0.0.790. Which lies about auto-updates. Also the uninstaller fails to handle the very simple case where the program is running in the foreground.

screenshot claiming 5.0.0 is latest version

The installer is terrible. The 8.1 installer takes most of a minute to put a window on the screen. Which then inquires if I’m a member of a European GDPR country (or Brazil), so I guess this thing is preparing to fully invade my American privacy. (I wonder if Samsung is aware of California law?) Magician installs in the years-deprecated Program Files (x86) directory. It now takes up 677MB of disk space when installed (5.0 was 25MB).

The usability is terrible. You can’t copy and paste, you have to re-type the serial number off the screen. Don’t mix up those 0s and Os! Also it has stupid formatting for the SMART data, but at least here there’s an export button. Temperature in Kelvin? Really?

Also the functionality is terrible. I can’t do anything with the USB drive I’m trying to fix. It seems upset that it can’t mount the filesystem (it’s a ZFS Linux system, no duh.) and it refuses to do anything else with the drive because of that. Not a very useful hardware management tool.

Magician also says another drive is counterfeit, an internal drive I’ve used for seven years to boot Windows. That’s not impossible, but awfully unlikely. This forum thread suggests that Magician has bugs leading to false counterfeits. Either way it locks me out of updating the firmware, and I think I’m two revisions behind. Ugh.

Magician couldn’t do anything with two of three hard drives I tried. Why is so much software is so bad? Do they not give a shit?

Update: I reinstalled Magician and ran it again and now it says the drive is legit, not counterfeit. (Also a Samsung service person looked up the serial and number said the same.) I upgraded the firmware. Revealing another bug: the firmware update says “your computer will be rebooted”. But it’s not, it shuts it down instead which caused a brief moment of panic until I thought to hit the power buttonn

Did I mention Magician has some weird input thing where it blocks my global screenshot hotkey if the window had focus? How do you even do that?!

Back to the ISO

So I tried again to boot the update tool from the ISO image. I failed. First I tried setting my BIOS to legacy boot and boot that way: it didn’t recognize the USB I burned with unetbin according to instructions as bootable. Then I tried using Ventoy to boot it as an ISO. No such luck.

The only thing I’ve seen booting this ISO is Proxmox with the legacy BIOS. I suppose I could pass through the SSD to a virtual machine, maybe via USB, and update that way. But yikes that seems risky.

So I gave up. Not updating this firmware. Thanks, Samsung. Between this mess and the disaster of data loss on 980s and 990s I’m unlikely to buy another Samsung drive.

OpenMediaVault, exFAT, writeable

OpenMediaVault, the NAS, now officially supports exFAT. It’s still a lousy choice for a Unix filesystem.

I had it working with read/write access. But then the write access stopped working. Judging by searches I’m not the first one this has happened to.

I got it working again by manually editing /etc/openmediavault/config.xml and changing the options for the fstab mount to defaults,nofail,fmask=000,dmask=000. Then I ran omv-salt deploy run fstab to regenerate /etc/fstab and rebooted. Now the Unix directory in /srv has everything with permissions 777 (whee!) and SMB users can write. Total mockery of POSIX file permissions but eh, it’s exFAT.

Some other advice from the old days was to use exfat-fuse instead of exfat. I think that’s from when the Linux kernel only could read exFAT, not write it.

The main advice is “don’t use exFAT”. Which fair enough. But it’s nice to pop a USB drive in from a Windows machine or Mac and have it on the NAS.

Proxmox notifications: gotify, email

Proxmox sends emails for important notifications, there’s nice docs. But email sucks in 2024, I have no idea how to get mail like this delivered. The only other option Proxmox supports is Gotify. I wish it had some generic HTTP post or something simple, looks like the Proxmox devs are adding webhook endpoints. ntfy.sh seems popularly requested but can be supported in a webhook. See also apprise and UnifiedPush.

Gotify

Gotify is a little self-hosted server that receives notifications and does things with them. It has very nice docs. Gonna tinker by installing it in an LXC in Proxmox. This server should really be hosted elsewhere, ideally a cloud service, but those seem to start at $9/mo so let’s just hack in a container for now.

Installing was easy with the tteck script. I added tailscale and had to manually wangle the LXC config to allow access to the tunnel device, per usual. With that gotify’s web server was available. The default login is admin/admin.

AFAICT tteck doesn’t install any config script. There’s a systemd unit to start it and the software is in /opt/gotify. I think /etc/gotify/config.yml would be a reasonable place for a config. It actually seems OK with no config file? It must have reasonable defaults, like sqlite3.

Getting Gotify up and running with Proxmox isn’t too hard. You create an application, take the token, then set up a notification destination in Proxmox. I also told Proxmox’s notification matcher to deliver to gotify. Test messages post immediately and are visible in the webapp. The Android app works but I don’t like the design: I want something else connected to Gotify and just delivering push messages to my phone.

I could also use some other delivery options. Deliver to RSS in particular. There’s a bunch of plugins and contrib stuff. No Atom or RSS! There’s a Slack plugin but it’s 5 years old and doesn’t work with modern Slack tokens.

Lots of interesting plugins for receiving notifications too. A zillion RSS receivers. Support for webhooks, yay. Also an SMTP gateway. Also appreciate this reverse proxy so I could use a public IP instead of Tailscale.

I dunno, I’m left thinking the core Gotify message router is pretty good but usability and features are not. The default message view is very limited (no time filtering, doesn’t even show the application). The Android and other delivery options look limited. I’ll keep using Gotify for now because it’s all Proxmox supports but once PVE adds webhooks or something I should re-evaluate.

Email

The default configuration has you specify an Internet email address that root mail should be forwarded to. But they don’t do anything to actually help you get email delivered. The default config will gamely just try to SMTP deliver the mail but of course no modern mail system relays mail from strangers. The mail just disappears into a postfix queue until it times out.

How about local delivery? I first tried making root’s forwarding address root, the empty string, root@localhost, or other variants. None worked: either invalid or a mailer loop. I then fixed it by removing ~root/.forward. Now postfix will write to /var/mail/root. Not ideal but at least it’s not disappearing.

Another local option is to create a second user account on the PVE host (like “nelson”) and forward root’s mail to it. But I’m trying to avoid that.

Remote delivery should be possible, in the past at least it was possible to get Gmail to relay mail for you if you were authenticated enough. But every time I look at doing that it gets harder. Screw it.

Migrating Proxmox to a new install

After my Proxmox disk failed I managed to clone the disk before it died entirely and boot from it. But that’s temporary hardware, now I want to set up Proxmox again on a new permanent disk, a 256GB 970 EVO I had lying around.

I’ve decided to go for a full rebuild, installing PVE and configuring it as if new. Then restoring all my guests from a backup. There’s a simpler path where you just restore /var/lib/pve-cluster/config.db /etc/hosts /etc/hostname but I kind of want to redo the setup. I did this before in January for a different server. This post is my boring careful notes here on exactly what I did.

Backing up old host

First thing is to back up everything on the old host disk while the old host is still working. I stopped all the guests and did a full backup of every single one. This is the precious data, what I’ll be restoring.

Second is to back up /etc and /var/lib/pve-cluster/. Note that /etc/pve is special and backed by a live-mounted database in pve-cluster. I’m backing up the stuff in /etc/pve as if they were normal files (for future diffing) and taking a backup of the database with sqlite3 config.db ".backup 'config.db.backup'.

After shutdown I’m going to unplug the old host disk for safekeeping, if things go badly I can use it to restore. Note it’s awkward to read the files on it because after you install a new Proxmox you end up with two ZFS pools named rpool that both want to mount to /. zpool import -d -R should help with that but I found it tricky. Instead I’ve backed up the files I want to read to the backup disk.

Installing new Proxmox PVE server

Do the regular Proxmox install from USB. There’s very few options there, I love how simple the Proxmox installer is. But this is what I did:

  1. ZFS RAID0 as the filesystem, with the one internal SSD
  2. United States, UTC timezone, US English keyboard
  3. Password and email as nelson@monkey.org even if I never have set up outgoing mail
  4. Hostname gvpve. Verify IP address is correct (thank you DHCP).

Improving Proxmox install

These are my generic customizations to any new Proxmox install

  1. Add my ssh key to ~root/.ssh/authorized_keys. Don’t disturb the key for root PVE made!
  2. Run the tteck helper script “Proxmox VE Post Install” and accept all defaults. This does a few things to make a new install nicer.
    • enable no-subscription repositories
    • disable the nag message
    • disable the high availability services (pve-ha-lrm, pve-ha-crm, corosync)
    • software update to Proxmox (takes a few minutes)
  3. Reboot
  4. Install some useful software. apt install joe sudo avahi-daemon
  5. Install tailscale. Start with tailscale up --accept-dns=false. Disable key expiry in Tailscale console.

Restoring my guests

Proxmox can do all this automatically if you have a cluster, this task just becomes a migration. (Automatic, if you have HA configured.) But it’s nice to do it manually as a recovery exercise.

  1. Plug in the USB disks for backups and USB media and verify with lsblk
  2. Restore /etc/fstab mounts for these disks (look at backup file from old server).
  3. Mount /mnt/backup and /mnt/usb-media
  4. Under Datacenter > Storage, add my Proxmox backup volume
    id: backup, type: Directory, Content: VZDump backup file, Path: /mnt/backup
  5. Remove “backup” as a content for the storage named “local”
  6. Under Datacenter > PVE > Backup, locate the files for the backups I took just before shutting down old host
  7. Restore each one manually (a lot of clicking!). Re-type the guest IDs instead of taking newly assigned ones. Probably unnecessary.
  8. Reboot to start all the relevant guests.

The restores all went pretty well, Proxmox backs up the configuration of the guest as well as the guest’s disk images. For some reason the config for a TrueNAS VM changed, it added back the ISO for the install media. This could actually break the guest although it’s easy to fix. The vmgenid also changed on every VM.

Finishing up

  1. Add my Influx DB as a system metrics server
  2. Create a new backup job on Proxmox
    All guests, 9am, keep 6 monthly / 4 weekly / 7 daily
  3. Test a manual backup. MISTAKE. The daily retention policy means this manual backup erased the reference backup from earlier today. I’d already used those to restore all my systems, so it’s probably no big deal, but definitely not the right thing to do.

I tried diffing the old server’s /etc/pve (on backup disk) to the new one. Didn’t learn anything really. Lots of differences but most of them are what you’d expect, new security keys. Also missing config files because I looked before I restored the guest hosts. I did spot the config change for the TrueNAS VM though, still puzzled by that.

Proxmox split disk idea

A setup I did not pursue, but seemed an interesting idea.

Proxmox by default installs itself to a disk and takes over the whole disk. You can set it up with ext4 (LVM) or zfs and use that disk usefully for guest disk images, ISOs, backups, etc. But the whole thing belongs to Proxmox.

What if instead you install Proxmox to a small partition, it only needs 16GB. And then allocate the rest as a ZFS pool? That seems like a clean separation. It also means you can use ext4 for Proxmox which might make recovery simpler.

I went down this road, following notes similar to this guy. I told Proxmox to install to 32GB ext4. It creates a partition #3 with LVM. Inside is 3.8GB for swap, 13.6GB for root, and two 11.6GB marked “pve-data”. The rest of the disk is then unused.

So I used fdisk to add a partition of type bf01 (zfs). The next step would be creating a zpool on it, then telling Proxmox to use that as storage for things. But I realized in the end I’d just be replicating more or less what Proxmox does by default with a ZFS install, only with non-standard names and setup for questionable benefit. So I stopped.

There’s something vexing about systems having very capable but unreliable SSDs as their install drives. I want to use that storage better!

Some ZFS exploring, disk recovery

My BOSGAME N100’s boot SSD failed. So I learned some ZFS to recover the files. I don’t think too much important is on this disk. Proxmox has been faithfully backing up system images to another drive and I have no reason to doubt them. But I’d like to rescue the Proxmox system itself, particularly since I don’t remember what all I customized on it (and don’t have a backup).

Summary

This post is more scattered than usual and unlikely to be interesting. This is what I learned:

  • You can boot off a dd clone of the Proxmox ZFS boot disk and it will work fine.
  • My disk failed with random access reads but I could use dd to clone it still. Weird.
  • You can recover the files on a ZFS pool with a system rescue disk. The key command is zfs import which brings the pool online in a new operating system.
  • zpool list and zpool status give you basic info. zdb is useful if you can’t get a pool online
  • Cheap SSDs are not to be trusted.

Lots of details

The big help here was the SystemRescue-ZFS fork. That’s the venerable Linux SystemRescueCD modernized and with ZFS installed for you.

ZFS docs are confusing. There were a bunch written really well by Sun and/or Oracle in the early days. But that was over a decade ago. OpenZFS has good man pages but I’m missing an overall gestalt of understanding the system. And ZFS is complicated, it’s a comprehensive implementation of a lot of data storage concepts.

Claude was a big help for me exploring ZFS. So was this StackOverflow post which has some recovery commands to try. And this recovery book was mildly helpful but is mostly about how to recover from partial failures where your pool still exists. My whole pool is gone because I’m using ZFS on a single disk, shame on me. These Proxmox docs for ZFS are also helpful.

One ZFS concept I’ve learned: ZFS doesn’t really have fsck. It’s constantly fixing itself (hopefully), there’s no big check-the-thing-offline. (scrub is the closest it gets.) A second concept I’m only getting now: ZFS has a notion of “imported” pools, where the ZFS system becomes aware of some storage. It’s a little like mounting a filesystem but it is not just mounting into Unix namespace, it’s also enabling all the access to the pool, datasets, filesystems, etc.

Another key concept: Proxmox creates a ZFS pool called rpool for its system boot disk. That’s what’s not working for me.

Using SystemRescue

SystemRescue is great, and the ZFS fork is perfect for me. Try setfont -d if the console font is too small. Remember that Linux lets you have multiple console windows: Try Ctrl-Alt-F2 to switch to window 2. Even better set a root password and then systemctl stop iptables.service so you can ssh in from a humane terminal emulator.

Cloning the bad disk

I suspected hardware failure so first thing I did once I had the rescue system booted was dd if=/dev/sda of=/dev/sdc bs=1M to do a block by block clone of the disk. This worked with no hitches, suggesting maybe the disk is not entirely gone. I unplugged the backup, that may be crucial since ZFS might be confused by having two copies of the same pool.

Exploring the problem disk with SystemRescue

I booted SystemRescue and first thing I tried was zpool status. It says no pools available. Same thing with zpool list. Um, is that bad? (I’d briefly tried Proxmox rescue too and it said the same thing). So I asked some AIs to go deeper and got to the ZFS debugger. zdb -lu /dev/sda3 does find some ZFS labels and stuff that I need. So the data is there and at least a little ZFS-shaped.

Asking more AIs I learned that you have to “import” a pool: presumably this SystemRescue ZFS system has never heard of this ZFS pool and so didn’t import it. Sure enough zfs import finds my missing rpool. It doesn’t want to import it by default because it wasn’t cleanly exported by some previous system. But I can zfs import -f rpool to force it. Which I have done and it takes an alarmingly long time to respond! What’s it doing? After a couple of minutes it gives up and says cannot import 'rpool': one or more devices is currently unavailable. That’s bad right?

Yes, it’s bad. journalctl has the news. The kernel module ata2, the driver for the SSD, is reporting errors. A lot of them, but the bad ones are failed command: READ FPDMA QUEUED, hard resetting link, COMRESET failed, and eventually ata2: reset failed, giving up. At which point zio and sd 1:0:0:0 start complaining about read errors. Also I have to reboot now, /dev/sda is no longer a working device.

This sure seems like a hardware failure to me! I wonder why the dd worked though? Maybe it’s just random access reads that fail? Or maybe zpool import was trying to write and it’s the writes that are failing? But those errors were triggered by reads... I tried again with zpool import -o readonly... and got the same errors. I think this disk is cooked.

Exploring the cloned image

I took a gamble and tried to import the backup cloned disk image disk. It worked immediately! zpool import -o readonly -d /dev/sdc3 -f rpool. Note I’m using the -d option to specify what device to import from because I think I have two different disk devices with an rpool on them (one of which is offline.) Also that readonly turns out to be a lie.

I think zpool import tries to mount all the filesystems where they were last time. But there was some error about rpool/ROOT/pve-1 not mounting, I assume because it wanted to mount to /. So nothing mounted. I can manually mount other filesystems with zfs mount but I really need pve-1 and it really wants to mount to /.

In theory zpool import -R /tmp/restore should mount everything under /tmp/restore. But I kept getting confusing errors. I finally got the thing mounted by doing zfs set mountpoint=/tmp/rr rpool/ROOT/pve-1. Which mounted it under /tmp/restore/tmp/rr, not what I wanted, but close enough. (Note this edit was permanent, written to the disk, despite the pool being imported readonly. I had to undo it later.)

Anyway all this hackery later and I have access to my files! They are mounted and I can make a backup of my Proxmox boot disk.

Backing up Proxmox PVE itself

One annoying thing about Proxmox is it has no system for backing up Proxmox itself. Everyone says “don’t customize it, just run guests and back those up” and mostly that works but still, it’d sure be nice to have a backup for situations like this.

Here’s a five-year-old gist backup script. The discussion there is more valuable than the script. It backs up a bunch of stuff in /etc one by one. Me, I just took all of /etc.

The Proxmox docs for Recovery are also useful. They suggest backing up /var/lib/pve-cluster/config.db /etc/hosts /etc/hostname.

Big gotcha here: a lot of configs are in /etc/pve. But those aren’t normal files stored in ZFS. Instead that’s a FUSE filesystem Proxmox runs (keyword pmxcfs) so in my non-running system here /etc/pve is empty and my tar got nothing. Those files are backed by a sqlite database in /var/lib/pve-cluster/, as the docs above discuss. With the system offline you can just copy those files. With it online and live something like sqlite3 config.db ".backup 'config.db.backup'" is safer.

Setting up a replacement Proxmox

Now that I have a backup of my files I’ve got several options to bring something back online.

  1. Try jiggling the SSD a bit, maybe it’s just a loose connection? This problem started after I opened the case, maybe I disturbed it. Nope, no such luck.
  2. Try booting off the clone I made. That might Just Work, actually. Probably should make a second clone first. Yep, this worked!
  3. Reinstall Proxmox on clean disk, then follow those recovery notes to do a quick restore. But I have to re-apply whatever other customizations I did myself, too. And manually restore all the guest hosts.
  4. Reinstall Proxmox and just configure it again. May not be much more work than #3.

No matter what I do I should replace that SSD, I’m never going to trust it. Was a cheap one anyway.

New Install

Option 2 worked so I have a working server again. I ran zpool scrub just to be safe and it found no errors.

But I’d like to install cleanly on a new SSD. So I ordered a 1TB WD_BLACK 1TB SN850X based on these reviews. I used to be a Samsung partisan but they really screwed up with the 980s and 990s. There’s an argument that you should just use a tiny scratch drive to install Proxmox on, or maybe a fancy enterprise-grade SSD instead. Eh, I’ll go with this. (No one makes high quality 512GB SSDs anymore!)

I will probably go with option 3 on this new install. Reinstall Proxmox, but then clone the config by copying a few files around. If I’m patient I should do option 4 and change the way some things work on my system. This was the first Proxmox install I did and I could do a cleaner job the fourth time around.

Bonus: Exploring a healthy Proxmox install disk

Before I worked on the bad disk I took a look at what a good disk looks like in ZFS. Here’s some things I learned from a working Proxmox system with no problems. Proxmox is installed to a single 2TB SSD with default ZFS options.

The physical disk is /dev/nvme0n1. Proxmox created three GPT partitions. fdisk tells me nvme0n1p1 is about 1M big and is labelled “BIOS boot”. p1 is 1GB big and is “EFI System”. The rest of the disk is in partition 3 labelled “Solaris /usr & Apple ZFS”. lsblk -o +PARTTYPE will show the GUIDs for the types and that partition 3 is 6a898cc3-1dd2-11b2-99a6-080020736631. Which honest-to-goodness has two meanings in this reference table. (Neither of which are “OpenZFS” or “Linux ZFS”, lol.)

lsblk also shows the SSD partitions and a couple of USB drives I have. And a bunch of /dev/zd* devices, which I gather are device names for ZFS snapshots or datasets or something. Presumably I shouldn’t mess with them.

zpool status shows that I have one pool named rpool, that’s what Proxmox created. It has one device in it, nvme-eui.002538b22140b542-part3, which corresponds to my SSD partition. zpool list shows me a basic status of rpool, how much disk space is free and the like.

zfs list shows me a whole bunch of datasets in ZFS, I think this is the top list of every thing in this pool. Most of these are under rpool/data and are either filesystems (for containers) or disk images (for VMs). But there’s also a few extras that I think are related to the PVE host: rpool/ROOT/pve-1 is the important one, also rpool/var-lib-vz. rpool/ROOT and rpool itself exist but seem pretty empty, mostly there to hold the subdirectory rpool/ROOT/pve-1.

zfs list -t snapshot shows snapshots, just snapshots and not the primary datasets.

mount | grep rpool shows me a bunch of ZFS things mounted in various places. rpool/ROOT/pve-1 is mounted on /, that’s my root filesystem. Most other things are mounted under /rpool and include a bunch of subvolumes for containers filesystems.

zfs get all rpool/ROOT/pve-1 gives me a very deep list of properties for the root filesystem. Not much of interest here but it’s exhaustive.

zdb -l /dev/nvme0n1p3 is a low-level ZFS debugger, it shows the labels on the disk device. I have a single one, “LABEL 0”, with the name rpool, a hostname that matches my PVE host’s name, and a bunch of stuff I don’t understand. Mostly looking at this because it was helpful with the broken disk since zpool wasn’t even showing it.

Linux console fonts are too small

My eyes are getting older and I have big screens: the default Linux console fonts are too small. And I’ve been spending more time than I’d like in consoles lately. Some ideas here for coping.

setfont -d is the quick fix. This will double the size of the current font as a one-off thing.

setfont in general is the tool for changing fonts. But it’s hard to find a nice clear choice for an alternate bigger font, there’s a list of a zillion for different languages. I should go find one good font that’s likely be available on a system and remember its name.

dpkg-reconfigure -plow console-setup works on Debian systems and gives you a nicer chooser.

Some NAS hardware estimates

I’m trying to get an idea of what building a 10TB NAS would cost if you’re on a budget. Options range from plugging in a single USB drive into an existing N100 miniPC running TrueNAS up to a dedicated Synology device.

I’m not an expert on this stuff: comments welcome!

I’m targeting a working set of roughly 10 TB of data. I’m thinking spinning hard drives (HDDs) make more sense. I like SSDs but the speed is mostly irrelevant in a NAS on gigabit ethernet. Maybe SSDs are more durable, but they are 2-3x more expensive. For RAID options I’m considering setups where one disk can fail and we still can operate.

Summary

We can get 10TB usable storage for anywhere from $200 to $1500 depending on how we do it.

Disks: 10TB usable can be done for $210 with a single disk (no recovery). Or RAID recovery with either 4x4TB or 2x10TB. Both RAID options are about $400 for spinning disks. $1300 to go with SSDs.

USB enclosure: about $200 for a four bay enclosure. Not needed if we just do one or two drives on the N100.

Separate PC appliance instead of the N100: about $250-$600, lets us avoid USB, also maybe a simpler commercial solution.

Update: I ordered two 8TB WD Red Plus drives and a Yottamaster PS200U3 two disk enclosure. Basically the cheapest plausible mirrored setup. Total price $400 plus tax (plus the computer to plug them in to). The 10TB WD Red Plus disks are sort of weird. 12TB are OK but noisier and higher power, so starting smaller. Early indications are the Yottamaster is not reliable, having a lot of trouble with USB errors in TrueNAS Scale.

N100 with TrueNAS and spinning disks

Variants of what I’ve set up already, a homebrew inexpensive system. The experts will tell you USB is not suitable for real NAS systems. But I think it could be OK.

10TB Cheapest: a single 10TB 3.5″ HDD on USB to the N100. 10TB is $210.

10TB RAID1 (mirror): two 10TB HDDs on the N100. $420.

10TB RAIDZ1: four 4TB HDDs ($400) in a USB enclosure ($200) connected to N100. $600

N100 with TrueNAS and SSDs

An SSD option. The disks are 3x the cost of HDDs.

10TB RAIDZ1: four 4TB SATA 2.5″ SSDs ($1300) in a USB enclosure ($200) connected to N100. $1500

Synology appliance (no N100)

A third party commercial alternative to building our own NAS on the N100. Not as capable as TrueNAS but easier to understand and support. No USB involved.

10TB RAID1: two 10TB drives ($420) in a DS223 ($250). $670

10TB RAID5: four 4TB drives ($440) in a DS423 ($400). $840

Build our own appliance

To avoid USB we build a little mini-PC with SATA disks in it. This is a rough guess only.

10TB RAID5. four 4TB drives ($400) and a cheap custom mini PC ($500?) $900ish

Extra costs: Local versioned backup drive

I think this is easy, just a local disk to copy stuff to.

16TB: 3.5″ external HDD on USB to the N100. $280

Extra costs: electricity

50 watts works out to 438kWh a year or about $200/year.

SanDisk Extreme Pro: data loss, smartctl

SMART

I have a recently purchased 4TB SanDisk Extreme Pro 55AF, an SSD. (Note SanDisk is a Western Digital brand.) smartctl doesn’t recognize it. I found a workaround for it which is to pass -d sntasmedia to smartctl. Doing that gives plausible output but some stuff looks a bit off (like power on hours). See full SMART output below.

Getting OpenMediaVault to pass this flag is not possible or at least not easy. There’s a remarkably detailed response here which says they want smartmontools to update its database instead. There’s also a suggested workaround which is to add an entry to /etc/smart_drivedb.h but the format for that seems daunting, I didn’t pursue it (yet).

Bad drive?

Unfortunately while researching this SMART problem I learned SanDisk Extreme Pro has been implicated in some serious data loss problems. See here, here, or here for reports. SanDisk has said it’s a firmware issue and put out an update, their tool here says we don’t need an update for this drive (if I have the right serial number). OTOH Tom’s Hardware is saying it’s a hardware flaw. That’s very troubling and knowing all this now I’ll think twice before buying any SanDisk or WD external USBs. Not sure what to do with this disk.

I have seen one problem with this drive, btw. When using hdparm -t to test throughput it reads for 3 seconds. It tests fine, like 800 MB/s. But if I test a second time it tests super badly, like 60 kilobytes/sec, and there’s an error in dmesg saying it had to reset the drive interface. Then the drive seems to work fine again (until I test throughput again.)

Jul 23 17:50:32 nchsomv (udev-worker)[7715]: sdb: Spawned process 'serial_id /dev/sdb' [7754] is taking longer than 59s to complete
Jul 23 17:50:32 nchsomv systemd-udevd[295]: sdb: Worker [7715] processing SEQNUM=2565 is taking a long time
Jul 23 17:50:32 nchsomv kernel: sd 3:0:0:0: [sdb] tag#11 uas_eh_abort_handler 0 uas-tag 2 inflight: IN
Jul 23 17:50:32 nchsomv kernel: sd 3:0:0:0: [sdb] tag#11 CDB: ATA command pass through(16) 85 08 0e 00 00 00 01 00 00 00 00 00 00 00 ec 00
Jul 23 17:50:33 nchsomv kernel: scsi host3: uas_eh_device_reset_handler start
Jul 23 17:50:33 nchsomv kernel: usb 2-1: reset high-speed USB device number 2 using xhci_hcd
Jul 23 17:50:33 nchsomv kernel: scsi host3: uas_eh_device_reset_handler success
Jul 23 17:50:33 nchsomv kernel: program smartctl is using a deprecated SCSI ioctl, please convert it to SG_IO

I’ve only seen this error with a synthetic test, and that via a KVM pass-through USB device. So I just kind of shrugged it off. FWIW we’ve successfully written 1.7TB of data to the disk and read 3.2TB off of it, so it’s not failing all the time. Sure don’t care for this uncertainty though.

Update: I’ve also seen this error now just reading files from the mounted disk (tar cf - . | pv > /dev/null). It’s possible this was related to the disk waking up from a sleep mode. The earlier hdparm failures were very unlikely to be sleep related. Then I was able to read 2.5TB or more off the disk, both streaming (at 400MB a second) and two parallel random access threads. Without a single error.

SMART output

# smartctl -a -d sntasmedia /dev/sdb
smartctl 7.3 2022-02-28 r5338 [x86_64-linux-6.1.0-23-amd64] (local build)
Copyright (C) 2002-22, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Number:                       WD_BLACK SN850XE 4000GB
Serial Number:                      240632803712
Firmware Version:                   624131EX
PCI Vendor/Subsystem ID:            0x15b7
IEEE OUI Identifier:                0x001b44
Total NVM Capacity:                 4,000,787,030,016 [4.00 TB]
Unallocated NVM Capacity:           0
Controller ID:                      8224
NVMe Version:                       1.4
Number of Namespaces:               1
Namespace 1 Size/Capacity:          4,000,787,030,016 [4.00 TB]
Namespace 1 Formatted LBA Size:     512
Namespace 1 IEEE EUI-64:            001b44 8b47193cd2
Local Time is:                      Mon Jul 29 21:55:46 2024 UTC
Firmware Updates (0x14):            2 Slots, no Reset required
Optional Admin Commands (0x0017):   Security Format Frmw_DL Self_Test
Optional NVM Commands (0x00df):     Comp Wr_Unc DS_Mngmt Wr_Zero Sav/Sel_Feat Timestmp Verify
Log Page Attributes (0x1e):         Cmd_Eff_Lg Ext_Get_Lg Telmtry_Lg Pers_Ev_Lg
Maximum Data Transfer Size:         128 Pages
Warning  Comp. Temp. Threshold:     91 Celsius
Critical Comp. Temp. Threshold:     94 Celsius
Namespace 1 Features (0x02):        NA_Fields

Supported Power States
St Op     Max   Active     Idle   RL RT WL WT  Ent_Lat  Ex_Lat
 0 +     9.00W    9.00W       -    0  0  0  0        0       0
 1 +     6.00W    6.00W       -    0  0  0  0        0       0
 2 +     4.50W    4.50W       -    0  0  0  0        0       0
 3 -   0.0250W       -        -    3  3  3  3     3100   11900
 4 -   0.0050W       -        -    4  4  4  4     3900   45700

Supported LBA Sizes (NSID 0x1)
Id Fmt  Data  Metadt  Rel_Perf
 0 +     512       0         2
 1 -    4096       0         1

=== START OF SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

SMART/Health Information (NVMe Log 0x02)
Critical Warning:                   0x00
Temperature:                        34 Celsius
Available Spare:                    100%
Available Spare Threshold:          10%
Percentage Used:                    0%
Data Units Read:                    6,286,318 [3.21 TB]
Data Units Written:                 3,285,119 [1.68 TB]
Host Read Commands:                 62,684,905
Host Write Commands:                33,660,622
Controller Busy Time:               94
Power Cycles:                       803
Power On Hours:                     33
Unsafe Shutdowns:                   8
Media and Data Integrity Errors:    0
Error Information Log Entries:      0
Warning  Comp. Temperature Time:    0
Critical Comp. Temperature Time:    0

Warning: NVMe Get Log truncated to 0x200 bytes, 0x200 bytes zero filled
Error Information (NVMe Log 0x01, 16 of 256 entries)
No Errors Logged

Android notifications are still terrible

I’m still missing Android notifications, Gmail this time. I asked the Claude AI for help. Check out this list of 20 options. Perhaps Android’s product has gotten too complicated? The list isn’t entirely correct and it misses a few (some are hidden in the Gmail app itself, for instance) but it gives a gist.

What are all the settings on Android Gmail that might mean I don’t see a notification for a new email? I want all of them, a comprehensive list.

Here’s a comprehensive list of Android Gmail settings that might prevent you from seeing notifications for new emails. Sorry for bad formatting.

  1. Notifications disabled in Gmail app:
  • Settings > [Your account] > Notifications > Notify for new messages
  1. Notification categories turned off:
  • Settings > [Your account] > Notifications > Manage notifications
  1. Sync turned off for your account:
  • Settings > [Your account] > Sync Gmail
  1. Battery optimization interfering:
  • Device Settings > Apps > Gmail > Battery > Battery optimization
  1. Do Not Disturb mode active:
  • Device Settings > Sound > Do Not Disturb
  1. App-specific notification settings in Android:
  • Device Settings > Apps > Gmail > Notifications
  1. Notification importance set to low:
  • Device Settings > Apps > Gmail > Notifications > Importance
  1. Notification channels disabled:
  • Device Settings > Apps > Gmail > Notifications > [Specific channels]
  1. Gmail app data restrictions:
  • Device Settings > Apps > Gmail > Mobile data & Wi-Fi > Background data
  1. Gmail app battery restrictions:
    • Device Settings > Apps > Gmail > Battery > Restricted
  2. Inbox categories filtering:
    • Gmail app > Menu > Settings > [Your account] > Inbox categories
  3. Priority Inbox settings:
    • Gmail app > Menu > Settings > [Your account] > Inbox type > Priority Inbox
  4. Filters or labels automatically archiving emails:
    • Check filters in desktop Gmail settings
  5. Outdated Gmail app version:
    • Google Play Store > My apps & games > Gmail > Update
  6. Android system notification settings:
    • Device Settings > Notifications > App settings > Gmail
  7. Power-saving mode active:
    • Device Settings > Battery > Power saving mode
  8. Account sync issues:
    • Device Settings > Accounts > Google > [Your account] > Sync account
  9. Airplane mode enabled:
    • Quick settings or Device Settings > Connections > Airplane mode
  10. Poor internet connection:
    • Check Wi-Fi or mobile data connectivity
  11. Gmail storage full:
    • Check available storage in Gmail account

This list covers most settings that could affect Gmail notifications on Android. The exact names and locations of these settings may vary slightly depending on your Android version and device manufacturer.

Would you like me to elaborate on any specific setting or provide more information?

Windows screenshot tools in 2024

It’s 2024 and Windows is still bad at taking screenshots. Actually the built-in Snipping Tool is sort of OK but third party solutions are better. Also my Apple keyboard doesn’t have a Print Screen button so all the defaults are awkward for me.

For years I’ve used Lightshot but the last release was 2009. Then I used ShareX but never liked it’s complicated UI.

Greenshot is my new bae. It’s open source and has a good UI with some attention to usability and simplicity. There’s a simple built-in editor. I could suggest some minor UI improvements but basically it’s fine. The one feature it’s missing is WebP support but I can easily convert manually with File Converter.

Relationship with Greenshot ended. Turns out it has a serious vulnerability over a year old that is actively being exploited. The release hasn’t been updated in 7 years. The developer keeps making noises about wanting to put out a new release but having trouble with signing keys, etc. IMHO it’s irresponsible for them to keep offering the software if they can’t fix it. I regret recommending it.

Flameshot is also nice with a capture UI that looks like the old Lightshot UI. But there is no way to change the hotkey from PrintScreen and the three year bug report discussion left a bad taste in my mouth. In general Flameshot seems to not have quite the usability polish of Greenshot, and since I can’t even launch it with my keyboard I won’t use it.

Flameshot’s last release was 2022. There’s been a lot of submitted improvements since then but no release on Windows.

Debian 12 slow login in Proxmox

On my Proxmox 8.1.10 server if I create a privileged Debian 12 container, logins work but hang for 25 seconds before getting a shell prompt. There’s a good discussion of the problem in this forum post.

The clue was this error in journalctl:
Jul 28 16:43:23 transcode dbus-daemon[98]: [system] Failed to activate service 'org.freedesktop.login1': timed out (service_start_timeout=25000ms)

Looking more closely there’s a bunch of errors in systemd-login saying it can’t start. Kind of amazed I ever get a shell.

Unfortunately the recommended fix of setting ProtectControlGroups=no in the systemd-login definition did not work for me. Tried it, still broken.

The other ideas discussed are an unprivileged container (can’t do) or a nested priviliged container (can’t do). There’s also a mention that Ubuntu has a special patch for systemd preventing this error. I think that’s my next step, try Ubuntu instead of Debian.

Sometimes this computer stuff sucks.

Towards a Proxmox NAS

After trying out OpenMediaVault and TrueNAS I’m still left wanting a good NAS for Proxmox. It seems odd to me that the Proxmox folks don’t have their own product. They’ve got most of the pieces already, and a similar product in Proxmox Backup Service. They also bet heavily on Ceph but that’s a high performance distributed storage system, not a simple SMB or NFS server.

Update: HexOS might be worth keeping an eye on. It’s TrueNAS with usability stuff on top for ordinary users.

Now I’m wondering if I should just roll my own NAS services in a container or VM. I’m kind of doing that already, it works fine. I’m not going to make a fancy GUI for it, I’ve been editing /etc/exports and /etc/samba/mb.conf for 20+ years, why stop now? Although Cockpit and the file-sharing plugin might work?

The key thing here is Proxmox can manage ZFS itself. It seems strange to pass through disk hardware devices to a VM to have a separate kernel manage the disks when Proxmox can do it. So here’s the idea:

  1. Create a ZFS pool in Proxmox for NAS data.
  2. Create datasets for network file shares in Proxmox.
  3. Do not make filesystems or mount the network file shares in Proxmox itself
  4. Install Debian in a VM, maybe with Cockpit as a GUI.
  5. Pass the network file share datasets in as VirtIO-SCSI single disks to the VM.
  6. Configure samba and NFS in the VM to share the disks
  7. Bonus: disks can be shared on a private Proxmox-only bridged network for other guests to access them.
  8. Optional: install syncthing in the VM
  9. Optional: enable Restic backups of the file shares in the VM

The part I’m not entirely clear about is the “VirtIO-SCSI” part. I like the idea that ZFS is in Proxmox. What I don’t know is how good performance is virtualizing it t his way. And you don’t have ZFS-level features available in the VM like snapshots and stuff, you would want to use simple ext4fs or something. (ZFS-in-ZFS is possible but can quickly cause problems.) That’s not ideal, ZFS snapshots (for instance) are great for backups. OTOH you can use Proxmox own backup software for the datasets.

Another option would be to create and mount the filesystems in Proxmox and then pass them to all the guests with virtiofs. You wouldn’t even need SMB or NFS if you aren’t sharing data outside Proxmox! But virtiofs isn’t fully baked yet, Proxmox kinda supports it but not fully.

I’m also not clear if a VM is necessary; you might be able to do this all in a container. In that case you’d make the filesystems and mount them in proxmox, then pass them through with a bindmount.

I think there’s a potential product here, a new NAS operating system. Designed to be used as a VM inside Proxmox with Proxmox managing the storage. Just a small thing to publish network shares. Building a real product is a lot of work though, particularly if you want a GUI.

But maybe I’ll make this VM for myself just as a hack. Honestly I’ve done most of the pieces in different ways already, the difference here is being more systematic with managing the storage in Proxmox. I bet in two hours I could have NFS and Samba fully set up and going.

I wonder if this would be a good NixOS project?

TrueNAS Scale first impressions

After having mixed reactions to OpenMediaVault I thought I’d give TrueNAS Scale a try as a small Network Attached Storage system to run under Proxmox. This is a first time user and a very small test, nothing serious, but I learned something. I set up a single user accessing a single SSD via SMB and NFS.

TrueNAS is a bit confusing as a product. It’s a commercialized evolution of FreeNAS by iX Systems. It is still free and open source. TrueNAS Core was the original product and runs on FreeBSD. It’s being deprecated in favor of TrueNAS Scale running on Linux. So I’m only looking at Scale. Scale used to use Kubernetes to manage services but is migrating towards Docker instead. That’s created some drama with TrueCharts, a third party company that published a lot of popular TrueNAS Scale applications for installation. That’s over now but presumably the Docker ecosystem will substitute.

Compared to OMV, TrueNAS makes a very good first impression as a serious, professional product. It also feels like overkill for a home setup but maybe that’s OK. The docs are quite good, succinct and thorough. I’m having a bit of trouble because the TrueNAS Core docs seem more complete but are just a little out of sync with how Scale works. Scale has its own docs but they seem a little less organized. Still the docs are great. And community support is good, lots of nice answers on Reddit and TrueNAS’ own forum.

The initial setup experience seems faster than it was in OMV, despite TrueNAS having more complex features. Maybe that’s just because I’ve learned more about NAS setups in general, or maybe it’s because TrueNAS is nicely designed.

Fancy features

There’s some interesting advanced features for share types. Like early on you can designate a filesystem as case-insensitive if you’re only using it for SMB. There’s presets for multiprotocol SMB/NFS shares, for write-once-read-many SMB setups, etc. I don’t know if I need (or trust) these but it could be quite useful if they work well.

TrueNAS has elaborate support for creating virtual machines with KVM. It also has containers, and Docker, and Core made good use of BSD jails. I don’t need any of that stuff, that’s what Proxmox is for.

TrueNAS gives you access to ZFS snapshots. And it has cloud backup support. The latter looks more like a “replicate to cloud” feature but in combination with snapshots that could get you versioning. I didn’t explore this but it looks promising.

TrueNAS also has an app store and a bunch of installable apps. Some seem useful to have tightly bound in your NAS: SyncThing or Nextcloud are great. Others I’d rather run in separate Proxmox guests, like Plex or a Minecraft server. Also with the TrueCharts drama the world of community contributed apps is a bit in flux, but I bet that’ll work out. Moving to Docker is a good choice.

Complexity vs. low-spec systems

TrueNAS really wants to be a system for enterprise bullet proof storage. It’s very good at that, if you want to spend $2000+ on a storage array I’m sure it’s your software. But I’m sitting here with a $200 mini PC and a $100 USB drive. Is TrueNAS for me? Sorta, it will work, but it will nag you.

TrueNAS is all-in on ZFS. And it really, really doesn’t want you to lose your data. It really wants at least 2 storage disks and would be very happy to use 8 or more. It is possible to set up TrueNAS using a single disk (technically “striped mode”, but with just 1 disk). But the software complains and warns you at every opportunity that what you’re doing is not safe. Which, fair enough, but for my little home use case really it’s what I want.

On the flip side if you want to have 2 disks and mirror them or have 8 disks and some fancy RAIDz2 setup with a separate log device, TrueNAS totally is the product for you. Which, honestly, is probably a good idea for a real storage array.

There’s a similar nag if you try to use TrueNAS to share a USB drive. It complains “‘SSD’ is consuming USB devices ‘sdb’ which is not recommended.” Again, there’s good reasons for that but it ignores the reality of how good USB has gotten and the value in using consumer hardware for small projects. AFAICT it just complains once and you can ignore it.

I don’t know. Overall TrueNAS still feels like overkill to me. OTOH it’s not that hard to set up and you can run it for a small storage array. So maybe it’s worth it, just ignore the extra complexity you’re not using?

Inside BOSGAME B100 (adding a drive)

My Mini-PC has support for adding a SATA drive so I took a look at what’s involved. Kinda fiddly. Not as nice as the Beelink in this video where the drive cage has a SATA connector already wired to the motherboard. In the BOSGAME instead there’s a tiny 12 pin connector and the computer came with a cable to plug into that with a SATA connector on the other end. There’s a similar looking cable on Amazon so maybe this connector isn’t entirely proprietary but it is unusual. Also fragile.

USB speeds and bad cables

I had a problem where copying from one USB disk to another was slow, averaging 10.5MBytes/s. The source disk seemed fast enough but while the destination should do 100 MBytes/s it was one tenth that. The problem is it was connected with a USB 2.0 cable at 480 Mbit/s. With better cables it goes fast like expected. Still I should be getting 60MBytes/s out of it, or at least over 30.

I discovered every single USB C-to-A cable I have is USB 2.0 and limited to 480 Mbits/s. I diagnosed this with lsusb -t to see the interface speeds (480, 5000, or 10000) and hdparm -t to test throughput (100 MBytes/s or more when working well.)

Good USB 3 C-to-A cables do exist and can do at least 5000Mbits/s but they cost more. I’m going to have to buy some. There’s no easy way to tell a slow USB 2 cable apart from a fast USB 3 cable, but usually the USB 3 Type A cables have blue connectors or are marked SS or SS+ for “SuperSpeed”.

Update: good cables to buy

I bought a bunch of cables on Amazon and tested them. All of these advertise 10Gbps and tested fine at 10Gb/s. They all have blue connectors but only the Monoprice cable has “10 SS” printed on the connector. I did not test the power on max charging.

  • Monoprice USB 3.1 Gen 2 cables. These are my favorite because they are well labeled. Shortest length is 3 feet.
  • LDLrui, a generic USB 3.2 Gen 2 cable. These seem to work fine and come in 1 foot length.
  • Monoprice USB 3.1 Gen 2 adapter. The only adapter I’ve seen that works at SuperSpeed in both orientations, no “flip for super speed”. No idea if that means it can’t do high power charging. Note this adapter is big, much longer than the flip-style.

I also tried this Ugreen “up to 10Gbps” adapter. It’s one of those “flip to act differently” designs that I think are confusing. Also while I could connect at 5Gbps once, mostly it was connecting at 480Gbps no matter which of 4 orientations I tried. I’m returning them.

Lots of detail

Below is a deep dive on my troubleshooting and some theoretical disk speeds for consumer hardware. But first...

Good USB C-to-A cables

The cable matters! For some reason there’s a bunch of bad cheap C-to-A cables and adapters out there. The good ones cost more, should be marked “super speed”, and probably have blue connectors.

SuperSpeed C-to-A cables exist from name brands like Anker or Monoprice. They cost more. I’ve ordered these and these.

SuperSpeed C-to-A adapters are harder to find and are usually female on the USB-A end. But that’s not what I need, I need a male A plug to stick into the A receptacle on the mini-PC. There’s lots of generic adapters in this configuration but precious few name-brand ones. I ordered these from UGREEN and this Monoprice. (There’s also lots of USB 2.0 C-to-male-A adapters but that’s what I’m trying to replace!)

I am curious about this specific C-to-A jack adapter from XAOSUN. It has a strange design, the docs say “The Type-C female port allows you to switch between USB 3.1 speed and USB 2.0 speed with a simple flip of the Type C plug.” Why would you do that?! One reviewer says “Be aware that devices like this support high-speed charging and high-data transport from USB-C to USB-A 3.0 and above are not symmetrical on the USB-C end. One side of the USB-C supports single-lane USB 3.1 Gen 2 data and low-power charging. The other side of the USB-C supports USB 2.0 data transfer and up to 100W 20V 5A charging.” So maybe that’s it? I did notice the name brand C-to-A adapters talked about maxing out at 3A. Maybe they’re trying to fake non-standard 100W charging on a USB-A port which requires weird wiring incompatible with 10Gbit/s data? Anyway “works differently when flipped” sounds like a confusing mess so I’d rather get something that just does high speed data. All my fast charging devices now are USB-C and USB-PD anyway.

Update: almost all C-to-A small adapters have this flip-for-superspeed design. This discussion says the whole concept of C-to-A adapters is problematic.

Disk medium, SATA, and PCIe speeds

Modern spinning disk media can transfer at least 100MByte/s, more like 150 or even more if you have a high performance disk. SSDs are much faster, like 3000MByte/s or more.

Older disks are interfaced via SATA. SATA 3.0, from 2008, is 6 Gbit/s = 750MByte/s. That’s faster than any spinning disk but slower than modern SSDs. New SSDs interface via M.2 / NVME which runs at PCI bus speeds. That’s very fast, even the oldest PCIe 3.0 with 4 lanes is almost 4000MBytes/s. I’m not clear on whether these SATA and PCIe speeds are shared between devices or not. In practice any PCIe interface is fast enough for any SSD and SATA is fast enough for spinning disks but not SSDs.

Bottom line, here’s a low estimate of speeds of typical disks on modern hardware:

  • Spinning disk via SATA: 100MByte/s
  • SSD via SATA: 500MByte/s
  • SSD via M.2: 3000MByte/s

USB 2 and USB 3 speeds

A proper PC connects to the drives directly via SATA or M.2. But mini-PCs often use USB instead and you have a drive enclosure with SATA or M.2 input and USB output. Modern USB enclosures support at least 5Gbit/s (625MByte/s) which is just about as fast as any SATA drive (HDD or SSD) but will limit an M.2 SSD.

USB comes in multiple flavors, this is a good reference. USB 2.0 is “high speed”, ie: slow. It means 480 Mbit/s (60 MByte/s). USB 3.0 dates to 2008 and is 5Gbit/s (625MByte/s). USB 3.1 is 10Gbit/s and USB 3.2 2x2 is 20Gbit/s. Sometimes you see USB 3 stuff advertised as “SuperSpeed” or “SuperSpeed+” but these days it’s more common to just publish the number. Everything in the last 10 years or so should be supporting at least 5Gbit/s on USB 3, 10Gbit/s is common. 20 is rare.

Note these speeds are shared between all devices on the same USB bus. So if you have two drives plugged in to a 480Mbit/s USB bus the max throughput copying from one to the other is going to be 480 / 2 = 240Mbit/s or 30MByte/s (I think?).

Cables also matter. I think USB-A maxes out at 10Gbps, it can’t do the x2 part required for 20Gbps. Older USB-A cables may be limited to 5Gbps. And old, cheap, or bad cables are limited to 480Mbps USB 2. Look for a blue block inside the connector, that’s the branding for at least 5Gbps. Or the words “SuperSpeed” or “SS”.

USB-C is better. I think most USB-C cables are SuperSpeed but there are probably some cheap “charging cables” out there that aren’t.

Unfortunately, mini-PCs mostly still have USB-A ports on them. So you need a C-to-A adapter or cable. That’s where I got in trouble, turns out a lot of those are not SuperSpeed but limited to USB 2 speeds.

I think mixing USB 2 and USB 3 devices on the same bus is OK and that the USB 3 devices can operate at their faster speeds. Not positive though. (Reference.)

Bottom line theoretical speeds from USB:

  • USB 2.0: 60MByte/s, half that if transferring between two drives
  • USB 3.0 5GBps: 625MByte/s
  • USB 3.1 10GBps: 1250MByte/s
  • USB 3.2 2x2 20GBps: 2500MByte/s

In practice USB 3.1 10Gbps is faster than any SATA interface and even 5Gbps is close to SATA speeds. But USB 2.0 is slow, slower even than spinning disks. It is a bottleneck to be avoided.

Cable testing

I decided to try a bunch of cables with a Samsung SSD 860 EVO 1TB SSD in a UGREEN SATA enclosure. It has a USB-C port. The USB interface is 10Gbit/s, the SATA is 6Gbit/s, and this old SSD drive can do about 500MByte/s. The disk is the bottleneck then, but should be capable of 500MByte/s.

With a USB C-to-C connection to the USB-C port on the BOSgame, lsusb -t shows 10000M speed and hdparm -t measures 500MBytes/s. Great! (I also tested a spinning rust 1TB disk at about 90MBytes/s with this same C-to-C cable. Yay!)

With a blue USB C-to-A cable sold with a hard drive as SuperSpeed, lsusb -t shows 5000M speed and hdparm -t measures 410MBytes/s. Still quite good but it’s interesting the C-to-A connection speed is half the C-to-C and that is reflected in actual throughput. In theory 5000Mbit/s should still deliver 500Mbyte/s transfers but in practice, it gets knocked down to 410MBytes/s.

With various other C-to-A cables: cheap ones, fancy Anker ones that are actually USB 2, the good C-to-C cable plugged into a cheap C-to-A adapter, every other cable I tried it connected at 480Mbps. And the drive measured out about 16MBytes/s. Turns out these are all USB 2.0 cables, WTF? They are garbage but I guess they are common because they are cheaper.

I don’t understand why I’m getting 16MBytes/s with USB 2.0 connections and not the theoretical 60MBytes/s. Maybe the Mini-PC’s USB 2.0 implementation is not very good?

Mini PC speeds

I have a BOSGAME B100 I bought in December 2023. The Amazon marketing page picture says the USB-A ports in back are USB3.2 Gen 1*2 and the USB-A ports in front are “USB3.2 Gen 2*2”. (Note this says “*2” which I think means two ports, not the USB x2 double speed ports.) There is also a USB-C port on front. The Bosgame site spec page also says four USB 3.2 ports but it suggests the front ones are the slower 5Gbit/s and the back are 10Gbit/s. Testing confirms this is true: the back ports are 10Gbit/s, the front ports are 5Gbit. But all these ports should be USB 3 and capable of at least 5Gbit/s = 625MByte/s, faster than any 2.5″ SATA disk. (There is also room for an internal SATA drive.)

I also bought a Beelink S12 Pro Mini PC. According to the Beelink sale page it has 4 USB3.2 Gen2(10Gbps) ports. Good! It also has room for an internal SATA drive.

The good disk

The USB disk I was copying from is an old WD Passport I bought in 2012 and use mostly as a backup drive. It is an honest USB 3.0 drive. lsusb -t shows 5000Mbit/s and hdparm -t tests out at about 100MB/s. I get this using either a USB-A port in the front or the back or the BOSGAME. It’s using a short cable with USB-A on one side (colored blue) and Micro USB 3.0 Micro-B connector on the drive side.

The bad disk

Actually no disks are bad. If I connect them with C-to-C cables, they all test at 100MBytes/s. The badness comes from the crappy C-to-A cables, not the disk.

But the destination disk that was slow for my copy is a WD Blue 2.5″ SATA spinning disk in a cheap Orico enclosure. The disk can do up to 150MB/s and the enclosure claims 10Gbps USB 3.2 Gen2 so should not be a bottleneck. smartctl doesn’t show any obvious errors, the drive has 32,000 hours on it but no errors. It should be capable of 150MByte/s. In practice I get 100MByte/s with a good cable.

The test disk

Described above in cable testing: a 860 EVO in a SATA enclosure. Gets 500MBytes/s with a proper cable.

The best disk

I have an SSD in a UGREEN M.2 enclosure that says it does 10Gbits/s via USB-C. (The SSD itself is a 970 Evo that can do 3000MByte/s, or faster than the USB.) So I should get an honest 1250MByte/s with this device. Just for fun I tried it with a C-to-C cable. It connects at 10,000 Mbit/s. hdparm -t shows just about 1000 MBytes/s, or close to the USB speed. The SSD is capable of 3x that speed but that’s too fast for USB 3. In theory I might get double the speed if I could manage a USB 3.2 2x2 connection at 20Gbit/s.

Observed bad copy behavior

Notes from the slow copy using a bad C-to-A cable. I’m using rsync -a --partial --append --progress to copy a 700GB file from one USB disk to another. It’s slow, it copied at 10.5MBytes/second. the rsync outpput:

699,404,892,160 100% 10.51MB/s 17:37:25 (xfr#1, to-chk=0/2)

That’s terrible. Even worst case (both drives on USB 2.0) I should expect nearly three times this speed.

Watching the rsync progress it fluctuates between 20MB/s to as slow as 2MB/s. iotop doesn’t show me anything interesting, this copy is the only major I/O.

Linux diagnostics: USB

The thing that got me started looking at all this in detail was this output from lsusb -t

/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 10000M
    |__ Port 3: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
    |__ Port 4: Dev 3, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M
    |__ Port 6: Dev 5, If 0, Class=Mass Storage, Driver=uas, 480M
    |__ Port 7: Dev 4, If 0, Class=Mass Storage, Driver=uas, 480M
    |__ Port 8: Dev 2, If 0, Class=Wireless, Driver=btusb, 12M
    |__ Port 8: Dev 2, If 1, Class=Wireless, Driver=btusb, 12M

That’s telling me two disks (dev 4 and dev 5) are running at 5000Mbit/s. Good! But two are running at 480Mbit/s. Bad! Even so, I should still get at least 30MByte/s (or more), but something’s not right.

Device 5 is the slow Orico disk I’m writing to. dmesg tells me “usb 3-6: new high-speed USB device number 5 using xhci_hcd”. But lsusb says it’s running at 480Mbit, because of the bad cable.

Device 4 is the 2.5″ SATA SSD in a Ugreen enclosure. Also connected at 480Mbit/s because of the cable.

Note the slow disks are connected with the UAS driver. That should be good, that’s more capable than the older usb-storage driver. These enclosures are newer and support the newer UAS protocol.

Linux diagnostics: hdparm throughput

Not much to say here, just hdparm -t /dev/sdd is a quick test of max throughput on a disk. Something like fio is better for real disk I/O benchmarking but hdparm is useful for seeing if it’s basically working right.

OpenMediaVault first use thoughts

I’m looking for a good NAS system to run inside Proxmox. Proxmox is great at managing disks but doesn’t have anything for SMB/CIFS, NFS, etc. There’s lots of ways to add a NAS as a guest system in Proxmox. TrueNAS is very popular but is complicated and overkill. So I gave OpenMediaVault a try.

OMV is good but not great. My biggest issue is it’s not very professional, particularly when it comes to docs. Also system design. But it is a solid complete product and has a lot of plugins. There’s an active user community but often the advice you find in forum threads is pretty amateurish.

Basic setup is straightforward but has a lot of steps. I found this guide useful. Basically you install OMV. Then to add a share you add a new drive (not the system drive), create a file system, then create shared folders in it. Then you make users (or allow guest access). Then you configure SMB or NFS or whatever to serve the share. By default the system supports NFS, Rsync, SMB/CIFS, and ssh. It all works pretty well and it’s nice having a complete product in a web GUI.

Where things get creaky is extending it. Take backups. There’s no built-in backup system for data drives (a bit of a surprise!) There’s several plugins: rsnapshot, timeshift, borgbackup, ... There’s also a “USB backup” that I can’t find any real docs for. But the description says “Automatically synchronise a shared folder to an USB/eSATA/SAS/SD device” and that leaves me wondering if they’ve confused synchronization for backups.

Another example of sloppiness: the flashmemory plugin, an OMV extra, that replaces directories like /var/log with a folder2ram filesystem so you don’t wear out a flash drive with write amplification. Nice idea! It works fine. But if you look closely it looks like it never automatically syncs the logs to disk, so when you reboot you lose them. Maybe? I tried testing it and got inconclusive results.

I’m also disappointed OMV doesn’t support ZFS. There is support for a plugin, and maybe that works great, but having it not in the core makes me nervous. (The outdated “not for public” docs don’t reassure!) Proxmox supports ZFS great, so one option is to have Proxmox manage the disk pool and pass through virtual disks to OMV instead of hardware devices.

I’m using ext4fs in OMV for now. It also supports btrfs, that’s it’s fancy filesystem, but that’s not the one I’d choose.

OTOH there’s a lot of plugins for OMV and it’s all easy to get working! Some curious omissions: there’s support for S3 and OneDrive for instance, but no generic rclone support which would support so much more. On the good side someone literally started working on a Restic backup plugin today. Does it work? Can I trust it? Probably not!

It’s all just a bit more fast and loose than I want for a store of precious user data.

So now I think I need to try TrueNAS again. I tried it briefly and it felt like overkill. But OMV feels like underkill, so... TrueNAS is really confusing right now though. Their old TruNAS Core FreeBSD product is being phased out with TrueNAS Scale (Debian) taking over. OK, fine. But somehow it has Kubernetes inside it? Also TrueCharts has historically been a big part of the ecosystem with their add-on apps but there’s crazy 🤡 drama there. The whole thing still feels like overkill, particularly when it comes to them having their own hypervisor features.

I just want a nice little web UI wrapper for SMB, NFS, SFTP, and Restic.

I pushed Claude to suggest some less well known products. It came up with Rockstor, XigmaNAS (NAS4Free), EasyNAS, and Openfiler. Also Unraid (not open source but not very expensive) or Nextcloud (does a bunch of other things I don’t need).

Maybe I give up and just run a Debian VM with old fashioned text file configs like we’ve been doing for decades.

OpenMediaVault setup notes

Setting up a little NAS with OpenMediaVault. First time user, my notes on what I did. This guide helped.

VM configuration

  • Make a Proxmox VM with 4GB RAM, 8GB of disk, and 2 CPUs. Legacy DOS BIOS.
  • Add a USB passthrough by device ID for an external disk that’s plugged into the machine
  • Enable qemu-guest-agent (note qemu-ga won’t start and gives a confusing error in the VM without this.)

OMV Installer

Basic Debian installer, mostly just take defaults.

OMV Configuration

Configuration mostly done via OMV’s web UI. Note at first it’s only available via http:, not https:. Default login is admin / openmediavault

  • Apply system updates
  • Change time zone to UTC
  • Change the admin login password
  • ssh: add myself to ~root/.ssh/authorized_keys
  • ssh: Install Tailscale
  • Reboot OMV from the web console

That’s a basic setup. After reboot....

And configuring the storage disk, mostly steps in the Web GUI

  • Storage > Disks: Wipe the disk in the Web UI: I aborted this when it started doing dd if=/dev/zero. But it did something with GPT to the partition table first, so probably a good idea.
  • Storage > Smart: Set up SMART for the external hard drive on USB
  • SSH: apt install hdparm so I can test disk speed (39 MB/s for a slow external drive.)
  • Storage > File Systems: Created an ext4 filesystem on the USB disk. This took a very long time!
  • Storage > File Systems: Mounted the filesystem. It ended up under /srv
  • Storage > Shared Folders: create a shared folder named “test”. Admin and Users are read/write, Others are no access
  • Users: Create a user “nelson” with a password
  • Services > SMB/CIFS > Settings: Enable service, set Workgroup
  • Services > SMB/CIFS > Shares: add the test shared folder I created

And using the disk from a client:

  • On Windows, open \\192.168.3.37\ and type in credentials (after a long pause)
  • On Linux, see the share with smbclient -L //192.168.3.37/
  • On Linux, mount the share
    apt install cifs-utils
    sudo mount -t cifs //server_ip/share_name /mnt/smb_share -o username=your_username,password=your_password
  • The name \\omv\ also works using the hostname omv. Also omv.local resolves as a hostname, Avahi is running.

Beelink N100 boot when power restored

I got a Beelink N100 for a little server. By default if the power is cut, it doesn’t boot again when it comes back on. Annoying for a server!

To enable it, go to the BIOS settings. Under Chipset > PCH-IO Configuration -> State after G3, set that to “S0 state”. There’s screenshots for all this in this Reddit post.

Sure is obscure huh? Why AMI doesn’t have a simple to understand top level setting for this, I don’t know. FWIW PCH is the Platform Controller Hub, the chip (or part of CPU) that controls various parts of a PC system.

PCH defines various power states like “full on” and “soft off”. G3 is “Mechanical OFF”, the name for there being no electricity at all. By default my Beelink goes to S5, which is “Soft Off”. So I’m telling it to go to S0 “Full On” instead after a G3 event.

WSL2, DNS tunneling, and .local names

Just copying the text of a post I made to Reddit. Long story short: if you want .local domain names to work in WSL2, you may have to turn off DNS tunneling.

Query

I’ve got several Linux boxes on my LAN running avahi-daemon. I can connect to machine.local fine on most of my LAN, including my Windows desktop in a web browser or DOS shell. However, my WSL2 system cannot connect to machine.local, it seems unable to resolve mDNS at all.

I tried finding an answer and found several years’ worth of advice, some conflicting. The root cause seems to be WSL2’s complicated networking setup interfering with multicast. Unfortunately I don’t really understand WSL2’s network setup. Is there some easy way to get mDNS resolving working?

Comment I wrote with solution

Setting dnsTunneling to false makes .local names work. I had to restart the WSL2 system as well.

DNS tunneling is described here and the configuration file is described here. There’s also this bug report on GitHub.

Before the change my WSL2 had 10.255.255.254 as the nameserver in the resolv.conf, now it has 172.31.0.1. DNS tunneling is relatively new (from Windows 11 22H2) and “is aimed to improve compatibility with VPNs, and other complex networking set ups”. So maybe turning it off causes other problems. But basic DNS and Tailscale’s Magic DNS are both still working for me and now .local names work too, so I’m happy.

Setting up a new Proxmox server

Some notes on setting up a new Proxmox server for the non-profit I’m helping. There’s almost nothing to do, got to be the simplest install ever. Still a few steps:

Hardware tasks.

  1. Enable BIOS to boot on power restoration
  2. Quick run of memtest from Proxmox boot ISO
  3. Quick run of s-tui from Linux to heat test

Basic Proxmox setup

  1. make a USB installer
  2. boot it and use the graphical install
  3. installer options:
    choose ZFS Raid0 for the simple filesystem on the SSD
    choose UTC timezone
    type a simple to remember root passwrd
  4. after reboot, open web console and set root password to a strong password from 1Password

Root shell customizations

Make as few changes as possible on the PVE itself. But a few are useful, log in with ssh as root.

  1. Add an SSH key to ~root/.ssh/authorized_keys
  2. Run the tteck post install script and accept all its defaults
  3. Run the tteck microcode installer, I picked 3.20240514.1~deb12u1
  4. Install Tailscale
  5. Run pveam update to update the list of templates for containers

GUI customizations

  1. node > System > DNS: update search domain and DNS servers
  2. node > local > CT Templates: pick templates for containers

Android Doze mode vs. notifications

Still trying to understand why my fancy Google Pixel doesn’t show me notifications in a timely fashion. I got some new insight into a possible cause from some Reddit comments: Android Doze mode.

Long story short, Doze is a power saving system w here the phone only wakes up every 15-28 minutes to process things in what they call “a maintenance window”. Normal notifications get delayed too, although there is an option for high priority notifications from apps. There’s no way to configure it with the usual Android settings. There are ADB hacks you can apply (and have to re-apply every reboot): see here or here for detailed discussions and solutions. The key thing is the command dumpsys deviceidle disable.

But Doze has been around a very long time, since Android 6. I only started noticing a problem around a year ago, maybe around Android 13 or 14. Did something change?

I’ve got no problem with low power modes! But they can’t interfere with basic use of the device. It’s particularly vexing for me since my phone spends most of its time sitting on a Pixel Stand at 100% battery, power saving is not my problem. (Which suggests one possible change: Pixels have gotten recent changes in battery charge optimization that means the phone may not realize it has a source of charging power when it’s near 100%.)

Another possible explanation for a change is that high priority messaging thing. It’s hard to imagine but maybe Gmail, Signal, and Messages aren’t getting high priority messages anymore and so don’t wake up? That’d be dumb. But maybe it’s a bug / bad system interaction?

Update: Gmail is definitely not getting reliable updates. Twice today I only got updates when I woke the phone up maually. I have no way of knowing what priority Gmail sends its notifications at but it’d sure be dumb if it weren’t high. Gmail has a zillion options for configuring its notification behavior. Most of them were turned on but “Notify for every message” was off. I’ve turned it on, now to wait a few days to see if it makes a difference. (No immediate improvement, just had more mail not show up as notifications. Even after I woke the phone, still took 30 seconds or more.)

Mostly I’m just tired and cranky about this bug. It’s affecting a huge number of Android users all over the world. It has to be obvious to any Google engineer who uses an Android phone regularly. Do they just think it’s OK? Can’t reproduce it? Don’t care?

This is the point where I’d be the hero who does a lot of testing and figures out the problem himself, finds a fix. But fuck that, I’ve got better things to do and don’t really know enough to tackle this one myself. It’s particularly frustrating because it’s hard to reliably reproduce the problem, mostly I notice when I haven’t seen an email I know I got about once a day. Anyway if I do get the interest to tinker again, things to try:

  • the ADB hacks
  • turn off Google’s battery saving charging, see if it works better on the charging stand.

Update: ntfy.sh

Got some interesting perspective reading ntfy.sh’s docs.

Instant delivery allows you to receive messages on your phone instantly, even when your phone is in doze mode, i.e. when the screen turns off, and you leave it on the desk for a while. This is achieved with a foreground service, which you’ll see as a permanent notification that looks like this: ....

Limitations without instant delivery: Without instant delivery, messages may arrive with a significant delay (sometimes many minutes, or even hours later). If you’ve ever picked up your phone and suddenly had 10 messages that were sent long before you know what I’m talking about.

The reason for this is Firebase Cloud Messaging (FCM). FCM is the only Google approved way to send push messages to Android devices, and it’s what pretty much all apps use to deliver push notifications. Firebase is overall pretty bad at delivering messages in time, but on Android, most apps are stuck with it.

The ntfy Android app uses Firebase only for the main host ntfy.sh, and only in the Google Play flavor of the app. It won’t use Firebase for any self-hosted servers, and not at all in the the F-Droid flavor.

Proxmox / KVM cpu types

When you create a VM in Proxmox it gives you a bunch of options for what CPU to emulate. The right choice is probably “Host” if you’re not using Proxmox’ machine migration features.

I’ve always chosen the default, x86-64-v2-AES QEMU, without knowing why. There’s a zillion options for various small differences in Intel and AMD CPUs, also QEMU virtual processors. Turns out the right setting for me is “Host”. That means no particular emulation, just pass through whatever the hardware has.

It should be more performant but I’m not sure how much. I doubt the emulated CPUs are doing a full interpreter environment, but OTOH they talk about emulating microcode so it has to be at least somewhat complicated. This blog post has some measurements showing Host is 3-10% faster than KVM64.

This is all well documented, see “CPU Type”. The important parts:

Usually you should select for your VM a processor type which closely matches the CPU of the host system, as it means that the host CPU features (also called CPU flags ) will be available in your VMs. If you want an exact match, you can set the CPU type to host in which case the VM will have exactly the same CPU flags as your host system.

Why isn’t this the default? Because it makes migration awkward.

This has a downside though. If you want to do a live migration of VMs between different hosts, your VM might end up on a new system with a different CPU type or a different microcode version. If the CPU flags passed to the guest are missing, the QEMU process will stop. To remedy this QEMU has also its own virtual CPU types, that Proxmox VE uses by default. ... If you don’t care about live migration or have a homogeneous cluster where all nodes have the same CPU and same microcode version, set the CPU type to host, as in theory this will give your guests maximum performance.

With the QEMU CPU, /proc/cpuinfo in the VM shows “QEMU Virtual CPU version 2.5+”. With the CPU type set to “Host” it shows whatever the actual hardware has (ie, “Intel(R) N100”).

I’ve apparently been running one VM as Host for months now with absolutely no problems. I converted the other one from QEMU to Host.

Linux network interfaces can have more than one IP address

Had to re-learn this. Normally a network interface in Linux has a single IP address. But there’s nothing stopping you from adding several.

Adding a second address is as simple as running something like ip addr add 192.168.3.254/24 dev eth0.

Here’s a config I just set up in Alpine in /etc/network/interfaces. Not sure what the netplan equivalent looks like.

auto eth0
iface eth0 inet static
        address 192.168.9.5/24
        gateway 192.168.9.1
        hostname $(hostname)

auto eth0:0
iface eth0:0 inet static
        address 192.168.3.254/24

More details in this Reddit post where I originally tried to make it much more complicated.

A good Claude programming example

I’ve been having such a good time using Claude 3.5 Sonnet to help me program and learn APIs I’m not good at. See this transcript for an example, where Claude walks me through setting up a basic Python command line project, then adds pytest to it, then adds click, then makes it work in VS.Code

I taught myself how to do all these tasks three months ago. But it was a tedious process of finding the right updated docs, then experimenting a lot, and in the end not quite getting it right. A typical pre-AI programming experience. It did only take me an hour or two, and thirty minutes the second time, but still it was tedious.

Claude just magically gives me the answers. Here’s the catch: I’m not certain they’re right. I didn’t review this transcript closely or run the code. I did read it all though, and it is plausible. I am confident I could start with what Claude did for me, maybe fix a few little problems, and have a working thing. But it’s very important an expert programmer still be in the loop, you can’t just trust the code it emits. I’m fine with that, it saved me a lot of time.

What’s remarkable is it gets so many core concepts I learned three months ago right:

  • the file structure with src/hello_world_cli/__init__.py and tests/
  • the contents of pyproject.toml
  • using optional dependencies for pytest, etc
  • the structure of a decent README.md
  • click’s decorators for CLI programs, including an example of a switch
  • the use of CliRunner to test click commands in pytest
  • the need for a __name__ block to make it run under VS.Code debugger
  • it even incremented the tool version number after making changes!

It even taught me some new tricks:

  • using tool.pytest.ini_options to set up paths
  • using hatchling instead of setuptools
  • creating a launch.json file for .vscode

I know that all that’s happening behind the scenes is a very big neural network is predicting token outputs. But what it looks like to me is Claude knows a lot about programming including the use of several complex open source tools. And I can mostly chat with Claude pretending it is intelligent and understands what I’m asking and it will give me useful answers.

The limitation is I asked it precise questions about a relatively basic thing with a whole lot of good code examples and docs on the Internet. It wouldn’t do nearly as well with some more obscure libraries for which there are no good examples. It will have a harder time with more complex code. And it certainly won’t invent new things, Claude is not going to create a new algorithm for distributed consensus or something.

But for basic stuff it sure is a lot better than doing Internet searches and reading through docs and example code myself. It makes programming way more fun for me by eliminating a lot of tedium.

Booting Windows 11 23H2 to Steam Big Picture

I want my new TV gaming PC to boot all the way in to Steam Big Picture with no keyboard required. This is remarkably difficult and all the docs you find are outdated because Win 11 23H2 changed some things. Microsoft really doesn’t want you do this. Partly for good reason (it removes local system security) and partly because they are trying to force you into their monopoly experience.

This worked for me:

1. Log in locally, not with Microsoft account

Settings > Accounts > Your info has a “Sign in with a local account instead”. Turn that on.

Documented here, at least until Microsoft hides the docs again. When I did this I got warned I needed to back up my Bitlocker encryption key first, I guess because ordinarily that’s stored in your Microsoft key. I just removed Bitlocker entirely instead.

2. Re-enable the “no password” UI option

Go in RegEdit to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device and set the value DevicePasswordLessBuildVersion to 0. (Mine was 2).

This is a new thing in 23H2, documented here. If you don’t, the next step won’t work.

3. Enable passwordless login

Run the program netplwiz. Uncheck the checkbox at the top for “Users must enter a user name and password to use this computer”.

Documented here. This doesn’t work in 23H2 if you don’t do step 2 to re-enable it. Why the stupid program name? It started life as the “Add Network Places Wizard”, terminology from Windows 95.

4. Get Steam to start at boot in Big Picture mode

Go to Steam Settings > Interface. Enable “Run Steam when my computer starts” and “Start Steam in Big Picture Mode”.

Documented here. The web has all sorts of complicated docs with registry edits, batch files, replacing the Windows shell, etc... None of that is necessary.

NFS still a tar pit in 2024

I was dorking around with a new NFS server and ran mount testserver:/test /tmp/test on my main computer. Then I turned off the testserver VM and forgot about it. Classic mistake, one I’ve been making occasionally for over 30 years.

The NFS disk in /tmp/test was still mounted on my client machine. And because I supplied no options to the mount command, it was a hard mount by default. Which means anything that accesses /tmp/test will get stuck in device wait, very hard to interrupt. I first noticed this because my restic backups were failing. It tried to back up /tmp/test and got stuck and the backup failed. (Why am I backing up /tmp? Lol.)

The usual fix is to supply some options to the NFS mount so it’s interruptible or has a timeout. Some options to know of: soft, timeo, retrans, intr. My fstab mounts things with this cargo cult set of options: x-systemd.automount,x-systemd.requires=network-online.target,x-systemd.device-timeout=10s. No idea where I got that, not sure it even actually works. Reading docs now I think that 10s timeout is for the initial mount only. ANd why does systemd need to be involved with its own bizarro thing? Who knows.

I also don’t understand why NFS doesn’t have some basic keepalive / server liveness test in its client. Maybe because NFS was originally connectionless and sort of loosey-goosey? I thought NFSv4 made all that much better. Maybe there’s some way to configure it. But the default options on Linux in 2024 are a tar trap.

I tried a bunch of things to unwedge my client. umount -f, which fails. lsof to see what processes had it open preventing the umount, which hangs forever. I finally gave up and just rebooted the NFS client. Awesome.

The underlying problem is network resources are not local resources. Software likes to assume that commands to a hard drive will either succeed or fail, not just hang indefinitely. But with a network filesystem they absolutely can hang. Even with a local one: modern hard drives are complex devices.

First impression of NixOS

I thought I’d give NixOS a spin after chatting with Jeff N. I had a great experience, I went from zero knowledge to a working web server in under two hours. And that includes lots of time writing this blog post, reading Mastodon, etc. And it was fun too!

I got this done mostly by asking Claude to tell me what to do: who has patience to read docs? It’s fun to learn something new this way. Also using this Wiki page and this baby steps tutorial. Julia’s notes are good too.

Update: I did this all as a Proxmox VM. There’s also notes on installing NixOS in a Proxmox LXC container.

Some basic concepts

I’m still trying to work my head around what Nix does. My impression is it’s similar to a Dockerfile or a puppet/ansible script, it’s a config file that creates a working Linux environment for stuff to run in. The difference is Nix has fancy design so everything’s managed, rollbacks are possible, etc.

NixOS is not Nix. Nix is the package manager, NixOS is an operating system built using the Nix package manager. Nix is like apt, NixOS is like Ubuntu.

The master configuration for NixOS and all the things running in it (like a web server) is in /etc/nixos/configuration.nix and has its own syntax. Almost the whole system is configured here. Nix folks have written little shims to take configuration directives from this file and write them into whatever weirdo format the ancient Unix utility might expect. (I hear the sendmail.cf generator is sentient but no one can understand what it’s saying.) You edit configuration.nix, check it into git, etc. You use nixos-rebuild switch to tell the system to implement the changes.

I’m looking at NixOS for a whole system image but there’s also a way to use Nix for your personal user environment that’s broadly similar.

There’s an effort to make bit-for-bit reproducible builds for NixOS which has nice affordances for security. But that’s not the only reason to use NixOS, more a happy side effect.

Install experience

First attempt for an install was with the minimal NixOS ISO (still 1GB!). But they aren’t kidding about minimal, this thing has you running fdisk yourself and leaves you with an unconfigured system. The graphical installer (3.5GBish) partitions a disk and gives you a basic working system when it’s done, so that’s easier.

After the default install the system reboots. 2.7GB is consumed on the hard drive and there’s 89 packages (not counting documentation packages). There’s about 10 processes running other than the kernel and all its threads. They all run out of /nix/store. They include

  • systemd running journald, udevd, oomd, timesyncd, logind
  • dbus-daemon
  • nsncd: a shim for name service (this one?)
  • Networkmanager

That’s a remarkably small system.

/bin and /usr/bin are nearly empty. There’s about 10 directories in my $PATH but much of what I’d expect to find is in /run/current-system/sw/. All the binaries there are symlinks into /nix/store. They’ve been dynamically linked with libraries like libc referencing paths in /nix/store.

NixOS installs a fairly complete Linux environment, at least it has less, bash, rsync, ssh. No sshd, python, or vim though. So why 2.7GB? As near as I can tell there’s a lot of stuff in /nix/store that’s not in my current environment, like a whole install of python3.11. Those binaries seem to work if I run them directly but I’m guessing I’m supposed to configure the NixOS system to officially use them if I want them.

The /nix/store can apparently get very large but there’s ways to manage it. I’m not sure if there’s an easy way to say “prune everything off the disk I don’t actually use” to get the install size down to 100MB or so.

Installing some packages in NixOS

First up, add an ssh server so I can log in easily. That’s as simple as editing configuration.nix to uncomment the line services.openssh.enable = true and then running nixos-rebuild switch to make it happen. The switch takes about 6 seconds. Various docs reference having to configure the firewall or enable password login, I didn’t have to do either with the NixOS GUI install’s defaults. (There’s some magic that allows ssh through the firewall if you enable it.)

I tried a rollback to remove ssh again. Easy as running nixos-rebuild switch --rollback. Apparently nix is keeping a history of what it’s done that it can undo. The rollback kills the sshd so I can’t log in anymore. My active sshd was still running, so I guess it doesn’t kill everything. (That implies many things about just how much state Nix will alter. Files, not memory, is my guess.)

Adding other shell utilities just requires listing them in environment.systemPackages. (Or maybe in a user environment, don’t understand that yet.) Whitespace delimited list. I did “joe git zip unzip” for now. And another rebuild switch and now I have those binaries available.

Final project was a hello world web server. I had Claude do this part for me.

  # Enable Caddy web server
  services.caddy = {
    enable = true;
    configFile = pkgs.writeText "Caddyfile" ''
      :80 {
        root * /var/www
        file_server
      }
    '';
  };

  # Create a simple HTML file
  system.activationScripts.createWebRoot = ''
    mkdir -p /var/www
    echo "<html><body><h1>Hello World from NixOS!</h1></body></html>" > /var/www/index.html
  '';

  # Allow HTTP traffic
  networking.firewall.allowedTCPPorts = [ 80 ];

That all just worked, thanks Claude! The firewall change was necessary: without it Caddy was running but unreachable outside this machine. iptables -L confirms that there is a firewall running (the default for NixOS), the chain nixos-fw seems most relevant. It’s letting in only ssh and http and ICMP ping.

Things to learn about

  • Updating packages from network
  • Scripting creating a new NixOS system from the environment file
  • Per-user Nix config vs system-wide
  • Nix state tracking, how rollbacks work
  • Logging
  • Recommendations for running actual production services in NixOS
  • Pruning disk usage
  • The ecosystem of Nix packages
  • nix-shell
  • WTF a flake is

Thoughts

This experiment was a good experience. Over the years I’ve tried a bunch of ways to automate setting up Linux system environments and gotten very frustrated every time. NixOS I had up and running in an hour and I feel like I could use this for real.

What would I use it for? Not sure, need to think more. I’ve been considering rolling my own NAS, a setup with NFS and Samba and syncthing and restic. I was just going to hand configure it but maybe NixOS would be a nice way to do that in a more managed way. As a VM in Proxmox I guess? Or maybe just an LXC container. Or just as a Nix thing in a general purpose VM, not sure if Nix gives me the separation I’d otherwise use Proxmox for.

I’ve run into some usability warts. nix search does not work as the config file suggests, you have to do some complicated set of flags for “experimental features” (this is apparently fixable but is a bad experience for a newbie!) The configuration that the NixOS installer created throws various warnings when you build with it. But stuff mostly seems to work.

The NixOS docs seem pretty good. I haven’t read them much but Claude has and that works great for queries. When I’ve looked stuff up myself there’s clear explanations for what I’m trying to learn.

I love learning new stuff like this. Claude was a big help.

Another failed Ubuntu 23.04 upgrade

Failed again to upgrade my recalcitrant Ubuntu 23.04 system. I give up and I’m mad at Ubuntu’s EOL policies.

The fun thing is how much some new tools make this kind of thing easier and safer. I had a lot of confidence experimenting thanks to Proxmox and the ability to easy rollback the whole system or restore a backup. I also got a lot further than I thought I would using Claude. These AIs still have a problem that sometimes it confidentally recommends bullshit. But as long as you understand that and evaluate suggestions yourself it’s a lot faster using an AI to find things than searching ordinary docs and forum posts. I tried more things more quickly than I would have without the AI help.

Hacking around GRUB

The problem last time is my system was installed with GRUB referencing a disk in /dev/disk/by-id that no longer exists. When I virtualized the server those IDs got lost. Claude did a great job suggesting various fixes. Some were wrong (like a hallucinated GRUB_DEVICE config) and some were plausible but don’t work (purge and reinstall GRUB). The good suggestion was to use debconf-set-selections to force a reconfig.

echo "grub-efi grub-efi/install_devices select" | sudo debconf-set-selections
dpkg-reconfigure grub-efi-amd64

This forced GRUB to reconfigure the path. It picked /dev/vba1. Not ideal (a UUID path would be better) but should work. And it did! I could reinstall GRUB on my 23.04 system, reboot, the BIOS all seemed happy. Success!

Maybe. After far too much drama upgrading to 23.10 the system then didn’t reboot. It all looked like it worked but the BIOS was no longer happy with what it found for a boot partition. I chickened out at that point and rolled back, gave up.

Ubuntu’s hostile EOL policy

Even though I think I fixed GRUB, I once failed in my attempt to upgrade Ubuntu.

Ubuntu has a clear but obnoxious policy that outside LTS releases, their interim go end of life quickly. 23.04 went EOL on January 25, 2024. The entire lifespan of this release was 8 months and if you don’t upgrade quickly enough, too bad. I’m a little confused why it won’t still let me update to 23.10: it goes EOL in three days. But when I tried I was told “Your Ubuntu release is not supported anymore”. There’s no option to upgrade directly to 24.04 LTS either.

I don’t mind that they EOL releases and don’t offer regular patches. But they really should offer some sort of upgrade path. They kind of do, I’ve upgraded an EOL system once before by hacking the sources.list to point at http://old-releases.ubuntu.com/. But there’s absolutely no tool help for doing that and you are on your own.

This time around I tried just swapping URLs and doing apt full-upgrade. It sure looked like it worked but then the reboot failed, maybe because of a bad update process or maybe because of my weird GRUB situation. Either way, I gave up.

At this point I’m going to give up and use Ubuntu LTS releases only. Which means one release every two years. I guess I’ll use something with rolling releases (Arch or Debian testing) if I need a more updated OS.

And now I’m doubly committed to rebuilding my main home Linux server. I kind of punted on that six months ago when I virtualized it into Proxmox as a whole system. I don’t relish rebuilding it all as lots of little containers but it’s probably a good idea. (Oh joy, now I can update 20 little Ubuntu systems instead of one big one!)

The yearly Ubiquiti UnifiOS disaster

About once a year my Ubiquiti routers give me trouble. I’ve long since stopped asking anything complicated of them like reliable failover or a VPN. I just want it routing packets. This week’s problem is my Unifi Dream Machine, my router/access point in San Francisco. I installed in in late 2020 and to its credit haven’t thought much about it since. Including not doing software updates. (Oops).

Yesterday I tried to upgrade it from version 1.0.10. It went badly, I ended up having to factory reset and rebuild the network configuration from memory. Some notes on that:

Being safer next time

First, how to prevent the mess I found myself in. The main problem is I had no backup of the Network application config. I did have one for the UDM console itself but that doesn’t contain the useful network stuff like wifi SSID, subnet, port forwarding, ... I should have made a backup before doing anything. Modern Unifi systems are backing up to the cloud, maybe automatically, but mine was so old I think I had to have done a manual backup and downloaded it. By the time I thought to do that it was too late.

What went wrong

The update process sucked. It wanted to upgrade itself like six times as it hauled itself forward through versions. Each update took at least 5 minutes, one said it’d take 20 and was more like 45. Each time the Internet connection would go down for a few seconds, twice. Mostly though it looked like things were working.

Until I got to UnifiOS v4.0.6, the current version. That time when it booted the “Network” app that’s most of what I really care about never started. Just spinning, hung in starting. I logged in via ssh to see what was up and couldn’t really figure it out. The mongod was spinning around 100% CPU though. Why Ubiqiuti chose such a weird and unreliable database for this simple application is beyond me.

The Internet is full of advice on how to manually repair corrupted Unifi mongo databases. But I decided to cut my losses and do a factory reset. The appliance said it had a full cloud backup, should be easy right? ha, joke’s on me. That was just a backup of the host OS itself, not the network. After the reset and restore the network was default settings.

I had no network backup. I’m a little confused; the updated Network 8.2.93 app has a manual backup option that downloads a file, but then implies the cloud backup of the console should cover the network too. That didn’t work for me, maybe because the crucial update failed? I was able to do one manual backup of 8.2.93 after configuration. A second one never completed. A third fails immediately. That does not inspire confidence. After a reboot a backup worked.

(I also can’t figure out how to backup the network config on a self-hosted Unifi linux environment running Network 8.0.7. The backup button does not appear under Settings > System. A comment I read online suggests this may be a user permissions problem but I can visually inspect all the settings I want to back up so that seems wrong or dumb. I was finally able to make a backup using the managed utility at https://unifi.ui.com/. I also saw a hint monthly backups were happening and being stored locally, not synced to cloud.)

Rebuilding the network

So I rebuilt the network. Over the years I’ve learned my lesson and keep the router as simple as possible. But I use the non-default 192.168.0.* subnet. Also am forwarding ports for ssh, web servers, tailscale, plex, and syncthing. There’s a lot of fun looking other settings for things like the WiFi radio I didn’t touch.

I had to re-adopt my UAP-AC-Pro access point. In theory my restore for the UDM should have taken care of that. Getting the impression that backup did absolutely nothing useful. At least that’s relatively simple since there’s no significant device configuration. Hold down the reset button on the hardware, then click the “Adopt” button in the webapp.

Some observations

Complaints and disaster aside the latest Network webapp on the UDM is pretty snappy. The old bugs where you’d change something in the config and it wouldn’t take until a reboot seem gone. The app shows lots of interesting things like a visualization of how all your wifi clients are doing. There’s also a neat NetMan mobile app for more wifi testing.

The Unifi network webapp itself is some overgrown dynamic Javascript architecture where page loads aren’t really page loads. It’s perfectly possible to click the “Dashboard” button and see a working new dashboard page even though the router is actually down. Just old data and no immediate confirmation that the router is even up. Really bad choice for a router, as snappy as it may be.

The Dynamic DNS configuration for Afraid has you storing your account password in plaintext. Afraid has long-had a token based authentication mechanism they should be using instead.

By default port 443 is captured by the router itself to get to its own admin page. That’s probably secure, and I think but am not certain it’s not available over the Internet by default. Also you can port forward 443 somewhere else on your LAN if you need. Ubiquiti has a whole remote management API with mobile apps and stuff you’re supposed to use instead of the web server. It’s pretty nice, TBH.

ssh firedrill: patches, fail2ban

Major new ssh vulnerability including a remote root exploit of SSH servers. So far the exploit has only been demonstrated on 32 bit systems and that takes several hours of hammering a race condition. But it’s likely to get worse over time.

The easy fix is to install an update; here’s how to do that in Ubuntu. The openssh release notes are also helpful. They released version 9.8 to fix it. Ubuntu backported that fix to older versions. Unfortunately I have a system stuck at Ubuntu 23.04 which is not getting updates anymore. So I need a temporary workaround.

I went with installing fail2ban. I do not like that system, it’s a gross hack with way too many config options that can completely break your system. But I got it done. The ubuntu fail2ban by default doesn’t ban anything (I think). You copy jail.conf to jail.local and then edit the sshd section to enable it. There’s a bunch of outdated guides, I ended up using the Claude AI to figure it out.

Anyway, end of the day fail2ban scans your ssh log files and creates IP table rules to block aggressive clients. Not a full fix but should make a race condition exploit a lot harder. You can see what fail2ban is doing in the moment with fail2ban-client status sshd or use iptable -L to see the rules it’s creating and removing. Lol, just realized I log in with CGNAT. So some other Starlink user on the same IP address as me could conceivably block me from logging in. Oops.

Another option mentioned in the release is to set sshd’s LoginGraceTime to 0. That means “no limit”, so clients never get dropped if they hang during login. But that now opens you to a DDOS, I think by default sshd allows 100 simultaneous logins and if someone’s trying to exploit the race condition they’d quickly fill all those slots. Not positive.

The last thing I did was look at my bash history to see what hosts I ssh into to make sure they are all updated. Unfortunately you can’t read known_hosts anymore to see where you’ve logged in since the hostnames are hashed. Again Claude AI to the rescue, here’s what it recommended:

history | grep ssh | awk '{for(i=1;i<=NF;i++) if($i~/^[^-].@./) print $i}' | cut -d'@' -f2 | sort -u

I should probably disable ssh entirely on my public interfaces and require tailscale to log in. But despite a year+ of reliability I still don’t fully trust tailscale, what happens if it breaks for some reason and I can’t log in?

Messages for Web unreliable: phone asleep?

I use Google Messages for Web frequently to read my text messages on my Pixel 8 running Android. About half the time I first use it in the morning it can’t connect, despite my phone sitting right next to the computer on the same network at full charge on a Pixel Stand. If I wake up the phone then the web app can connect.

It didn’t used to be like this. Connections worked reliably. Does anyone else have this problem?

I’m wondering if this is related to the long-standing problem of delayed notifications. Overall it feels like Google has made these phones go into such a low power mode that they are no longer connected to a network. So notifications don’t come in and the messages webapp can’t connect. It’s really irritating!

(This is a copy of a Reddit post I made.)

Update: a clue from lower power mode

I managed to reproduce the problem. Messages couldn’t connect. Before I woke the phone I found its IP address in my router and pinged it from the same LAN. Interesting result!

64 bytes from 192.168.3.81: icmp_seq=1 ttl=63 time=234 ms
64 bytes from 192.168.3.81: icmp_seq=2 ttl=63 time=539 ms
64 bytes from 192.168.3.81: icmp_seq=3 ttl=63 time=759 ms
64 bytes from 192.168.3.81: icmp_seq=4 ttl=63 time=8.50 ms
64 bytes from 192.168.3.81: icmp_seq=5 ttl=63 time=293 ms
64 bytes from 192.168.3.81: icmp_seq=6 ttl=63 time=516 ms
64 bytes from 192.168.3.81: icmp_seq=7 ttl=63 time=1240 ms

The phone is online but answering very slowly. After I woke the phone up messages connected and pings got faster. But not consistently and still way more latency than I’d expect on my wireless LAN.

64 bytes from 192.168.3.81: icmp_seq=33 ttl=63 time=110 ms
64 bytes from 192.168.3.81: icmp_seq=34 ttl=63 time=76.3 ms
64 bytes from 192.168.3.81: icmp_seq=35 ttl=63 time=83.4 ms
64 bytes from 192.168.3.81: icmp_seq=36 ttl=63 time=5.29 ms
64 bytes from 192.168.3.81: icmp_seq=37 ttl=63 time=7.93 ms
64 bytes from 192.168.3.81: icmp_seq=38 ttl=63 time=131 ms
64 bytes from 192.168.3.81: icmp_seq=39 ttl=63 time=33.6 ms

So that’s weird. But it’s more evidence of a low power mode that affects networking. OTOH it’s also evidence the phone never goes fully offline, so why can’t messages connect?

Windows gaming PC

On a whim I bought a MinisForum UM690 Pro (Venus), a small form factor PC to use for light gaming on my TV. It’s fairly beefy for a small box, AMD 6900HX processor, Radeon 680M graphics, 32G of RAM. All for $430 on Amazon. More than double what I paid for the N100 server I bought last year but this was the cheapest I could get for what I wanted. My metric here was something with a real GPU, not just integrated. Then I kept bumping up the price a bit to hit the sweet spot of price / performance / newness. I also picked a dual LAN model in case I want to repurpose it as a router.

Hardware

The hardware seems pretty good. My only complaint is that the fan comes on pretty quickly and is not as quiet as I’d like. It’s nothing terrible, not like the vacuum cleaners of old, but it’s definitely not silent. The BIOS makes it look like there’s two fans maybe?

The GPU is OK but not amazing, benchmarks and specs put it at ⅓rd of a Radeon 1080 or 2x a Steam Deck.

At full synthetic load the system pulls about 90W. CPU is at 80°, GPU is at 60°. Fan is noisy but not awful. During normal light use it’s about 30W and the fan is a very quiet hum. 60W playing DRG: Survivor, a light 3d game. Idle is 10W and full sleep mode is 1.5W. It’s not great thermal engineering but it seems to do the job.

Update: the fan is annoying, it seems to come on in short loud bursts instead of a slow steady growth, even under constant load. Unfortunately there’s apparently no way to read or control the fan speed in software. Over on Reddit there are folks complaining and talking about replacing the hardware’s fan with something connected to USB they can control. See here for instance.

I have a beloved Logitech K830 wireless keyboard/mouse that I’m using with it now. Curious about weirdo keyboards like this one: obviously no good for regular typing but enough for pressing a few buttons to log in or launch something. Update: I ordered a Fosmon Mini Bluetooth keyboard.

For games I’m using an old Xbox controller with the unobtainium USB dongle. The pairing is flaky and won’t wake the system from sleep. I gather Xbox controllers are still the best choice for PCs. 8BitDo also makes good controllers for cheaper, I’ve pre-ordered the Ultimate 2C. Note there’s a feeling you’d rather have proprietary wireless because Bluetooth has high variable latency.

Windows 11

Windows 11 sure does not spark joy. There’s so many upsells and manipulations from Microsoft I feel like I’m fighting a war. OFGB is a help with that. I was originally going to reinstall Windows because I wasn’t sure I trusted whatever MinisForum installed but it seems fine. No bloatware at all. It does come with a Windows 11 Home license so that’s a bit of a nuisance, I’d really like Pro so I had remote desktop access. I may yet buy a cheap license key to upgrade.

I had a brief moment of excitement when I flashed the BIOS and it rebooted demanding my BitLocker key. I guess the drive is encrypted? I had no idea what the key might be. Fortunately Microsoft has a thoughtful recovery system, the BIOS displayed a URL to visit and I found my key there in my Microsoft account. All this stuff requires networks and logins of course but these days I just accept that’s the thing.

MinisForum has a nice driver distribution in the support page. Nothing too exotic, mostly it’s just AMD drivers. The only problem I’ve fun into is nothing seems to be able to read the fan speed. Hardly a big deal.

Software

I’m resisting the urge to install too much on this machine. Keep telling myself it’s for games, not a real working machine.

Steam, of course, for games. Its Big Picture mode is really nice. I haven’t yet figured out how to get the computer to boot into this mode, it may not be possible since Windows really wants you to type some sort of login PIN or something when the computer starts. That also means I need to keep a keyboard around, ugh. (“Local only account” I think is the solution for the PIN but I haven’t tried it.) Update: I set up autologin, notes here.

Playnite is an interesting alternative cross-platform game launcher. I gave it a quick try and I think I’ll stick with Steam. Playnite is interesting if you are playing a lot of games from other sources. The UI is pretty databasey though and it lacks Steam’s great “show only controller games” filter. Also doesn’t seem to fully support controller itself although it does in full screen. I do like how it uses IGDB though.

I’ve also installed UltraVNC for remote access. It’s clumsy software but does seem to work. The remote access world has gotten real weird, there’s a zillion different products out there that all seem a bit sketchy. VNC is still alive and well, TightVNC is the other one that comes recommended. RustDesk also looked interesting to me for something new.

Update: RustDesk seems to perform much better over LAN. All of them have bugs, like you can’t reliably resize windows on the remote desktop. (Alt-Space > Size helps with this.)

I installed Controller Companion. It’s a $3 Steam app that lets you use a game controller as a keyboard and mouse replacement. The mouse is great but the on-screen keyboard is clumsy. But it does kind of work and seems useful. It’s nearly abandonware: the last real work was in 2017 and the last update at all was 2020. JoyXOff is a free alternative that had an update in the last year. Steam also can do this itself if you enable Steam Input in desktop (in the controller settings.)

I’m having problems swapping between a running game and other stuff. Big Picture is 2160p and the game is 1080p fullscreen and when I Alt-Tab out of the game, Big Picture is in a window covering the top ¼ only. I think it’s supposed to be full screen though, maybe I didn’t tab to it on top?

I had a maddening problem where games would only run at 1080p 30Hz with vsync turned on. Without vsync they’d run at 120fps, so it wasn’t the GPU not keeping up. Finally figured out Windows had for some reason decided to run the display adapter at 2160p 30Hz, despite all the cables and monitor working fine at 60Hz. Took awhile to figure out: the Very Fancy AMD Adrenaline software that claims to optimize everything never noticed. Neither did Windows, nor Steam.

Passkeys and understability, usability

Watching an expert tech friend of mine struggle to understand why his computer with 1Password was letting him log in magically to a site, I was reminded of this conversation I had with Jessamyn West about passkey usability for ordinary people. Jessamyn is very steeped in tech and does tech support for folks in a rural library. She frequently writes really interesting stories about what her clients have trouble with. A useful touchstone into what the tech experience is like for ordinary Americans. She wrote a whole book about it!

Anyway, I wanted to capture a few of the things she said in response to an earlier blog post of mine complaining about passkeys. Here’s a link to the full Mastodon thread, some lightly edited quotes are presented here:

J: I am sorry you’ve had such a miserable time with passkeys but also kind of happy they are a shit show because they were so clearly going to be tough for people who are not computer system experts, don’t have reliable computer access (so might use a library) or have cell phone access instability. Maybe they’ll slow the roll-out. Thanks for sharing your experience.

N: when the tech works right it should be a much better and more secure experience!

J: Yeah I totally get that for the target audience. I think I get huffy when people have been breathlessly saying “This will solve online security!” when in point of fact it’s going to make it harder for at least one subclass of people for whom internet stuff is already pretty challenging.

N: what does that group of people do now for logins?

J: They usually have passwords that fit the requirements and write them down in books. Some of them don’t have mobile devices and so they’d have to get a phone call at a landline or get a message to their email which maybe they can’t check if they’re not at home. Which makes getting tech-support at the library fairly difficult. A lot of these people only use two factor authentication where it’s absolutely necessary.

Jessamyn has also written about a concept of “device continuity”, the idea that people own a digital device and all the data on it stays intact or is migrated with upgrades, replacements, etc. That’s a luxury not everyone has. Phones break, get lost, stolen. So much of our digital authentication assumes that people have a secure device that they will have access to continuously. Things like passkeys don’t work nearly as well if you don’t have that.

Three AI responses for a search-like query

I’ve been getting a lot of mileage using ChatGPT-style AI as an enhanced search engine. When it works well an LLM gives me a clear useful answer with plenty of followup links. What I like best is the synthesis of the AI reply, the idea the LLM has somehow condensed hundreds or thousands of sources and given me a clear answer with some explanation.

In one example, I asked for a book recommendation.

I’ve never read anything by Mary Renault. What book should I read? I want something fun and enjoyable and with some gay male content.

Phind-70b gives me the best answer. It gives me a conversational reply like talking to a knowledgeable friend. It gives me one specific recommendation with justification for why it’s a good choice. And then it discusses other options. There’s 10 references offered for followup research, two of which are cited explicitly as footnotes.

Bing Copilot’s answer is a little disappointing in comparison. It just gives me 3 direct recommendations with a couple of descriptive sentences. It’s fine as a search engine but not quite a conversation.

ChatGPT-4o’s answer is somewhere in between. It’s also primarily a list answer but it has a lot more descriptive justification. It’s like an email from a librarian with a lot of spare time.

I think all three of these AIs are roughly the same scale / class of thing. Copilot and ChatGPT-4o are both ChatGPT 4. Phind-70b is Llama-70B. I think the main differences are the tuning of the prompts, whatever is happening behind the scenes to tame the demon in its machine prison and compel it to give answers to people. There’s an enormous amount of development in this area right now and it feels very productive.

(I think it’s hilarious Copilot gives me LGBT pride emoji in its answer, concluding with 📚🌈. I see you, queer Microsoft product manager!)

Phind

Based on your interest in a fun, enjoyable read with gay male content, I highly recommend starting with “The Persian Boy” by Mary Renault. This novel is the second installment in Renault’s Alexander the Great trilogy and offers a unique perspective on Alexander’s life through the eyes of Bagoas, a Persian eunuch who becomes Alexander’s lover. The book is praised for its detailed portrayal of historical events, its exploration of love and relationships, and its insightful depiction of cultural and societal norms of the time. Readers have described it as a masterful blend of love story and historical novel, with impeccable research and perceptive writing 1.

“The Persian Boy” stands out for its rich storytelling, blending adventure, romance, and historical insight seamlessly. It provides a deeply personal account of Alexander’s campaigns and his relationships, particularly highlighting the complexities of his bond with Bagoas. This relationship is explored against the backdrop of Alexander’s embrace of Persian culture and the challenges he faced due to racial tensions within his own ranks 1.

While “The Persian Boy” is often cited as a favorite among Renault’s works, it’s worth noting that the entire Alexander trilogy is highly regarded for its historical accuracy and engaging narrative. However, if you’re specifically looking for a book with significant gay male content presented in an accessible and enjoyable manner, “The Persian Boy” is an excellent choice to start with 14.

Copilot

Certainly! Mary Renault is a fantastic choice if you’re interested in historical fiction with gay male content. Here are a few recommendations:

  1. “The Charioteer”: Set in England during World War II, this novel explores same-sex relationships and was groundbreaking for its time. It’s a great blend of romance and historical context1.
  1. “The Persian Boy”: Part of a series based on the life of Alexander the Great, this book effectively outed Alexander and features gay male relationships in ancient times2.
  1. “The Last of the Wine”: Renault’s first novel set in ancient Greece, it’s a bestseller within the gay community and beautifully portrays male homosexuality as a major theme3.

Feel free to choose the one that resonates with you the most! 📚🌈

ChatGPT-4o

Mary Renault is renowned for her historical novels set in ancient Greece, and several of her works contain gay male characters and themes. For a fun and enjoyable introduction to her writing, consider starting with one of the following books:

1. “The Persian Boy”

  • Synopsis: This novel tells the story of Alexander the Great from the perspective of Bagoas, a young Persian eunuch who becomes his lover. The book delves into their relationship and the historical events of Alexander’s conquests.
  • Why Read It: It offers a vivid and engaging portrayal of historical events with a strong focus on the relationship between Alexander and Bagoas. The book is rich in historical detail and provides a deep emotional connection to its characters.

2. “The Last of the Wine”

  • Synopsis: Set during the Peloponnesian War, this novel follows the lives of two young Athenian men, Alexias and Lysis, who develop a deep and passionate friendship that evolves into a romantic relationship.
  • Why Read It: This book is celebrated for its portrayal of the intimate bond between its protagonists, set against the backdrop of a fascinating period in Greek history. It’s a great mix of historical context and personal drama.

3. “Fire from Heaven”

  • Synopsis: The first book in Renault’s Alexander trilogy, it covers the early years of Alexander the Great, his relationship with his mother Olympias, and his burgeoning friendship with Hephaistion, who would become his lifelong companion and lover.
  • Why Read It: This novel is an excellent starting point for those interested in Alexander the Great. It combines historical fiction with the exploration of Alexander’s early relationships and his path to becoming a legendary leader.

4. “The Charioteer”

  • Synopsis: Though not set in ancient Greece, this novel takes place during World War II and follows Laurie “Spud” Odell, a wounded soldier who forms a complicated relationship with two men: Andrew, a conscientious objector, and Ralph, a fellow soldier.
  • Why Read It: This novel provides a modern setting while still exploring the themes of male relationships and love. It’s a beautifully written story about identity, love, and societal norms.

Each of these novels offers a compelling story with rich historical detail and strong, nuanced characters. Depending on your interest in ancient history or more modern settings, any of these would be an excellent choice to start with Mary Renault’s works.

Bonus: Kagi Quick Answer (Claude 3 Haiku)

Based on the available information, I would recommend you start with Fire from Heaven by Mary Renault. This book is the first in her “Alexander the Great” trilogy and is described as following Alexander’s story from boyhood, including his gay relationships. [1]

Several sources mention that if you enjoyed Madeline Miller’s “The Song of Achilles”, which also features gay male characters, you will likely enjoy Renault’s writing as well. [1]

Additionally, Renault’s works are praised for their engaging prose and ability to captivate readers. One reviewer said they were “mesmerized” by the first volume of Renault’s “Alexander Trilogy”, which includes Fire from Heaven. [2]

So in summary, Fire from Heaven seems like an excellent introduction to Renault’s acclaimed historical fiction that also explores gay themes in an enjoyable and compelling way. [1][2]

Simple GeoTIFF overlay map

Spent some time today trying to display a historical aerial photo in a map context. Here’s some notes on using QGIS and Felt.

Someone told me about UCSB’s aerial image archive. It’s remarkable: a large collection of historical aerial photographs, many free of charge. All georeferenced on a tool called FrameFinder and easily downloadable. So I found one from 1952 that covers the area my house is in and wanted to put it on a map. Not too hard but not easy.

Georeferencing

The FrameFinder images aren’t GeoTIFFs, they have no spatial data. So first I used the QGIS georeferencer to get them on a map. The source images are very nicely scanned and taken, I suspect they are true straight down images. Even so I put down about 12 control points on road intersections by reference to Google Satellite imagery. Then I used the Projective transform to warp it; it ended up slightly angling the source image. Important to set the “transparency is 0” option so the border of the warped image doesn’t obscure things!

I wish the QGIS georeferencer were more nicely interactive.

QGIS

With the image georeferenced it was very simple to load it as a layer in a QGIS map. I tried a bunch of different ideas for a base map to reference to. I finally settled on MapTiler’s plugin, their Toner layer is a nicely styled vector map that you can plop on top of a raster image like mine. I customized the symbols: removing most of the polygon fills, turning rivers blue, etc. The result looks OK.

The other thing I did was use the Google Satellite layer in the background. Normally it’s obscured entirely by the older aerial photo but you can easily toggle that off and on to do a quick before-and-now comparison.

An aside: every time I do something new in QGIS I start by just hacking something up loading data from any-old-place, often my browser Downloads folder. Then I have to do extra work to rebuild the project with the files in a permanent place. Would be better to always put all the assets in one place first before working with QGIS.

Felt

I also gave Felt a try, a nice mapping startup. They have a really great tool that makes it easy to make custom maps with some light GIS work and styling. Drop a GeoTIFF on the map, select Roads and Buildings as vector layers on top, and you’re basically done.

Hit a bummer though: everything was looking good and I was ready to share it, then I reloaded and got a big “Paid plan required” overlay. I had hoped something this simple would be in the purview of their free plan but I think maybe adding a single custom image like mine puts me over. Felt a bit like a bait-and-switch, it letting me work for an hour+ before learning I’d have to pay. Not sure this one map is worth paying $30/mo to share but I have a bigger project in mind that would warrant the expense. Felt’s product is really nice and it’s all so fast!

MapWarper

For a third shot I made a version in Map Warper. This worked great. The control point UI in the rectifier is very nice and easy to use. The whole site is so tight, really easy. And there’s a nice preview mode with a simple transparency slider. The site is more of a tool for rectifying TIFFs, I think it’d be neat if it were enhanced to be more of a publishing site itself. That’d imply some hosting and serving costs though.

Something custom?

I feel like there’s room for a very simple “before and after” map webapp that takes a GeoTIFF and displays it against a basemap. With a toggle or slider or lens or something to let you see the old image and what it looks like now. I could probably cobble up something basic in a few hours. Hosting the GeoTIFF is the hard part although if you don’t bother to cut it into tiles it’s not too much. The closest I’ve found is GeoTIFF.io.

Starlink, from LA to Seattle

Starlink has moved me back to Seattle, some two years after June 2022 when Starlink moved my POP from Seattle to Los Angeles. I’m in Grass Valley, CA somewhere inbetween. In the very early days back in January 2022 I was at a POP near Winters, CA; I think that went away when SpaceX consolidated ground operations. Anyway, now my packets go through Seattle again.

The move has hurt bandwidth enormously. Download speeds of 10-70Mbps (average 22), compare 110-267 (average 128) two weeks ago in LA. Those numbers from my hourly Ookla speedtests (graph below), confirmed with a manual browser speed test and a simple remote file copy from my own server. Something is wrong.

UPDATE: these bandwidth reports were wrong. My router had dropped the WAN port down to 100Mbit, I think I have a loose cable. I wiggled the cable and got back to gigabit and my first download test was 220Mbps. Starlink and Seattle are just fine, this is user error. (I should have realized this: the switch to Seattle was around 2023-05-30 22:00 but I was getting fast downloads until 2023-05-31 22:00, a day later.)

Latency and packet loss seem fine though, just the same as before the move. Using Starlink’s gRPC stats my Seattle latency is 25-55ms, mean of 35ms. Drops are very low. Compare 23-93ms, mean of 38ms for an LA period two weeks ago. Starlink’s measured packet drops are about the same, total of 148 (LA) vs 177 (Seattle).

IRTT latency and packet loss monitoring

Unfortunately my own IRTT stats of are no longer valid, or at least no longer the same thing. I’m measuring round trips to a server I run in LA in the same datacenter as the LAX Starlink POP or very very close to it. So that used to be a test of basically Starlink’s infrastructure. Now my latency is much higher because the packets have to go over the terrestrial Internet from Seattle to LA.

I could set up a new IRTT server in Seattle but I will probably just drop the IRTT monitoring project instead. It’s been quite helpful and I’ve learned a lot from it but I don’t know that I’ll learn much new going forward. I’ll keep it running for now, it’s harmless and maybe will be interesting. I turned off my monitoring.

Goodreads data export options

Ever since my Goodreads account loss disaster I’ve been eager to back up all the info on books I have recorded there. Right now I’m motivated to build my own UI for that data so I can search for books more easily. Considering emulating Simon Willison’s dogsheep projects and getting the data into sqlite for Datasette.

Anyway, there’s a bunch of ways to get data out of Goodreads. They’ve changed over the years as Amazon, their owner, makes it less and less accessible. Here’s some options:

My Books > Import/Export. The simplest bulk export. Takes a few minutes and you get a CSV file, one per book in your library. Data includes title, author, ISBN, rating, date read, etc. The data format is a bit funky with columns like "=""0060590297""" or "=""""" but it seems to have most of the data I want in it. (Unfortunately it does not have the number of reviews the book has received, but it does have average rating.)

Account Settings > Settings > Privacy > download request, called a “DSAR” (a GDPR compliance term). This gets you a zip file full of JSON stuff. They say it will take up to a month to prepare the download, last time I did it took several days. There’s a lot of uninteresting stuff here, like a record of every time I opened the Kindle app on my tablet. It’s also not in a convenient format. The review.json contains my reviews, for instance, but the book is only referenced by freetext title: no IDs or ISBNs or the like.

Goodreads API. Hahha, just kidding, it was shut down in 2020 “As part of our overall commitment to continually improve our data management”.

HTML scraping. There’s a bunch of projects and tutorials around scraping data, all at various levels of completeness or abandonment. I had some luck with goodreads-user-scraper: it looks like someone’s maintaining it and it’s oriented around user data, not just scraping stuff for some marketing purpose. But it errored out about halfway through with a 404, not sure if I was throttled or it’s broken. Also none of the data was personal to me other than the list of books, in particular my review text isn’t in the dump.

Note my list is organized around getting a snapshot of your account. Given it takes them up to a month to prepare that a snapshot, it’d be nice to have incremental updates. I think a scraping approach is the only way to do that.

I’m going to start with the CSV and feed it into datasette and see where that gets me. Probably use scraping otherwise, the DSAR looks pretty useless for my purposes.

Datasette import

Quick-and-dirty Datasette notes:

  • install datasette with pip
  • install sqlite-utils with pip
  • sqlite-utils insert goodreads.db books goodreads.csv --csv
  • datasette serve goodreads.db

The schema is messy so I created some views in sqlite to have cleaner output in Datasette

drop view if exists read;
create view read as
select
  "My Rating",
  "Average Rating",
  "Date Read",
  Title,
  Author,
  trim(ISBN13, '"=') as "ISBN13",
  replace("My Review", '<br/>', '
') as "Review"
from
  books
where
   "Bookshelves" in ("", "wont-finish")
;

drop view if exists toread;
create view toread as
select
  "Average Rating",
  "Date Added",
  Title,
  Author,
  trim(ISBN13, '"=') as "ISBN13"
from
  books
where
   "Bookshelves" = "to-read"
;

Promoting a git project to a bare repo

I usually develop on local disk, just git init and start programming. No push or pull, no remote repos. But sometimes I want to get fancy and have a remote repo. I don’t use GitHub or GitLab to host these projects, I just host them myself. But things have changed a bit in the intervening 12 years, here’s the new process.

### Clone existing code into a new bare repo
cd ~/gitrepos
git clone --bare ~/src/blog/static/flourish/ flourish

### Set up origin in the old existing code
cd ~/src/blog/static/flourish
git remote add origin example.com:~/gitrepos/flourish
git push --set-upstream origin main

### Verify things are working as expected
git remote -v
git branch -avv

One subtle thing there... The bare repo is created by cloning from local disk. But then I set the origin back in my working code via an SSH URL. Not strictly necessary in the case where both the bare repo and the working copy are on the same computer but the whole point here is to enable working copies on multiple machines from the same bare repo.

And an extra complication: I have Syncthing synchronizing my ~/src to my various Linux development environments. All behind the scenes, transparently. This can be a little spooky sometimes; if I git commit in one working copy there’s no need to git pull in another working copy because syncthing will sync for me. It’s harmless to git pull and git push in this configuration though, at least as long as I’m not making changes in two places at once.

Starlink: fewer obstructions? Not really.

Interesting change in Starlink: fewer reported Obstructions starting around April 29. But it looks like they just fixed a bug where outages from Reboots were being called Obstructions.

Outages

Here’s a graph of obstruction outages for the last 90 days. It’s a graph of the gRPC outage stats from Dishy, the same thing the mobile app shows.

Sure looks like an improvement! In the past week I’ve had 7.4s obstructions and about 6 minutes of total outages. In a week a month ago I had 176s of obstructions and 386s of total outages.

Unfortunately this improvement seems to just be a recategorization. One cause of Starlink outages is rebooting for firmware upgrades, around 30 seconds a few times a week at 3am. Last month those outages were sometimes categorized as “obstructions”. Now they’re properly marked as “booting”. Here’s a week from last month showing these 3am false “obstructions”: in the most recent graph these now show as “booting”.

Here’s a graph of all the outage types for 90 days all together. You can see the red booting is more common than before.

Packet loss

Unfortunately this lowering of obstructions doesn’t seem to be affecting overall packet loss. Below is a graph of Starlink’s own stats on “drops” for 90 days followed by my own IRTT monitoring which also shows dropped packets.

No clear change, so maybe things aren’t really better. No visible change in the graph and doing the math, last week I had 0.63% packet loss and a week a month ago had 0.50% packet loss. Packet loss might have even gotten worse but I wouldn’t read too much into that without closer look.

Chromebook powerwash / channel downgrade

My Chromebook on the beta channel (v125) has been flaky, the Android and Linux subsystems kept crashing. So I decided to downgrade back to stable channel (v124). That all worked but was tricky enough I’m writing notes. See below for the dream of 1990s computing.

An important concept here is ChromeOS “powerwashing”. That’s basically a full software reset, wipe the whole system (including your local data) and reinstall. It’s a neat feature of Chromebooks, the easy full reset as an important part of the product.

Changing channels

There’s a “Channel” pane in settings with a “Change channel” button. If you use it to downgrade from beta to stable it tells you that you have to powerwash the system (fully resetting it) and reboot. But rebooting doesn’t do anything, neither does manually powerwashing. Turns out you have to click “check for updates” somewhere to get it to download the stable release, then follow that path to install it which results in the reboot and powerwash.

Note that powerwashing is the default way to downgrade ChromeOS and will avoid compatibility problems. But it’s not necessary. There’s a crosh shell command to downgrade without powerwashing. Enterprise-enrolled Chromebooks also have an alternate channel switching method where it doesn’t switch immediately but instead waits a few days / weeks for the stable release to catch up so you can smoothly move from beta to the newer stable without a reset.

But Chromebooks were designed to be safely powerwashable. In theory all your important stuff is stored in Google’s cloud already and a powerwash is painless. How does that work out?

Powerwash: the ChromeOS stuff

After a powerwash it is indeed easy to get your basic Chromebook back to the state it was in. Basically you log in once and Google syncs back over your web browser state, which in ChromeOS is basically everything on the computer. The big hassle is you have to log in again on every website, all your cookies are gone. But in general your Chromebook environment looks the same after a powerwash and login.

Google will force you to once again re-enable ad privacy in the Chrome configuration. Sleazy.

Two things special to me inside ChromeOS, unlikely most people would do this:

  • I had to re-enable the ComposeKey input method as a second keyboard. It was installed but I had to go into settings to make it accessible.
  • I will need to reinstall the Bypass Paywalls Clean Chrome extension. That has to be sideloaded from local files, Google won’t allow such useful stuff in their Chrome addon store.

However, I don’t just use ChromeOS stuff on my Chromebook. I am also a developer running Linux and I use a bunch of Android apps. That’s a little trickier.

Powerwash: Android

Android apps are almost first class citizens in ChromeOS these days. The powerwash restore app will offer to reinstall “your Play apps”, which means Android apps I guess. It reinstalled all the apps I had before on this Chromebook. But then they all have to be re-authenticated and configured. For me that means adding a new device to Tailscale and resyncing Obsidian with their sync service.

Powerwash: Linux subsystem

I also run a Linux container on my Chromebook. ChromeOS has a nice backup and restore system for that. I backed up to a USB drive, powerwashed, restored, and everything was back the same in Linux. Both the Debian image and my /home stuff. The Linux Signal flatpak app even stayed logged in. Couldn’t be easier. (the backup file is called .tini but is mostly just a .tar.gz of the filesystem with an extra metadata.yaml at the front.)

I had to manually re-share my ChromeOS Downloads folder to Linux so /mnt/chromeos/MyFiles/Downloads worked again.

Powerwash: Steam

ChromeOS now has experimental Steam support which basically amounts to a second Linux container. I just reinstalled that which was painless since Steam Cloud stores everything anyway.

The dream of the 90s is alive

There’s a couple of old ideas about computing from the 1990s that are finally sort of to fruition now.

One is the idea of a “thin client”, that the computer you sit in front of has nothing important on it and instead interfaces with what you want on the network. That’s how a lot of stuff works these days with hosted webapps. But we’ve never quite gotten free of your personal computer still being customized. The ChromeOS team put a lot of work into syncing that customization and it mostly is productive although then I messed it up again wanting a local stateful Linux environment. Also authentication is a huge PITA, no one wants to sync the actual login token to the cloud.

The other is the idea of “ubiquitous computing”, that I could access my personal computer environment anywhere I go seamlessly. Again we’re mostly there with modern Internet and cloud based stuff, but there’s still the tricky problem of local state. A simpler login system (like passkeys should be) would go a long way to making the re-authentication easier. And you’ll never completely avoid the reality that having local state on a local computer is faster than something over a network. That’s why I bother with the local Linux machine, for instance.

Simple monitoring for small projects

Just set up some long-overdue monitoring for small projects like my blog and linkblog.

updown.io makes HTTP requests to your server and alerts you if they fail or do not contain expected contents.

healthchecks.io alerts you if an HTTP URL on their server is not pinged in a configurable amount of time. It’s intended for cron jobs; if your job doesn’t load the URL in time you get a warning.

Both are free for initial usage, enough for at least a year of a small project (or more). And low cost beyond that. They’re both professionally made and have been around awhile. I’m impressed with how many integrations they have. Email notification is the default but there’s Slack, SMS, etc as well.

shout-out also to scrutineer.tech which runs a simple RSS feed warning you about upcoming SSL certificate expiration.

Starlink bandwidth over 3+ years

I was surprised in my last post about how I was getting 25 Mbps upload speeds. So that had me looking again at my bandwidth tests since I got Starlink. These are tested with the Ookla Speedtest CLI tool. They are a test of my house’s network connection, so occasionally speeds are slower than real because I’m using the network or I’ve temporarily failed over to my backup ISP (not Starlink). But overall these reflect Starlink performance.

Fine grained graph

The main trend that interest me is in 2023 and 2024, the steady improvement of speeds. Particularly upload speed. This is a great trend to see in your ISP!

It’s also interesting to see those halcyon days of 2021 before Starlink got heavily subscribed. That’s a suggestion of what the maximum radio throughput service is. Service was worse then: more outages, higher latency, more variability. But download bandwidth was same-ish for a lot of this period. Upload has definitely gone up.

Monthly average

The graph above is some fine-grained reporting interval that Grafana selected, probably a few hours per point. The graph below is an average of every 30 days. The same trend is more clearly visible but of course it doesn’t capture the variance.

Starlink 7 days stats April 2024

This blog post contains screenshots of my monitoring dashboards for my residential Starlink node in Grass Valley, CA. Bottom line: the service is quite good these days.

  • Average speeds: 150Mbps down / 25Mbps up
  • Average latency: 36ms
  • Average packet loss: 0.6%

I do a lot of careful client-side monitoring. Used to pay more attention when the service was new and had some problems. But since January 2023 it’s worked very well for me, when their major over-capacity problem was solved at least for my area. And it got better in January 2024 when they started to improve latency. Mostly now I don’t pay attention to it very closely because it works fine.

The downsides are the median packet loss is high enough to matter. And performance is variable, it gets noticeably worse in evenings presumably because of congestion. But it’s pretty good always. FWIW I think Starlink’s behavior is more like a cellular ISP than wired or geosync satellite. Better quality in general than overloaded American cellular but similarly unpredictable packet loss and jitter.

I still have my dashboards and monitors running and they give very detailed client-side views of performance. Here’s screenshots of my 4 separate dashboards, all data for the last week (April 22 to 29). I think this week was mostly unremarkable and typical. First couple are basic ISP monitoring; the other two are more specific and unique to me or Starlink.

FWIW I have a gen 1 Dishy with ordinary residential service.

Ookla speed tests

This graph shows results from hourly speedtests using Ookla’s command line tool. Main results:

  • highly variable download and upload speeds with a mean of 150Mbps down and 25Mbps up.
  • few hours under 20 Mbps download speed

Compared to the old days, overall speeds are better. I used to be more like 100 / 15. Even better, the “hours under 20 Mbps” is greatly improved; that used to be 8 or more hours a day.

ICMP Ping tests

Using telegraf to send 5 pings every 15s to 8.8.8.8 and measure round trip time and packet loss. See below for the better IRTT tests showing similar data; starting here because pings are familiar to everyone.

  • average latency around 36ms
  • 0.58% mean packet loss
  • fairly stable throughout the day but there’s some visible daily pattern

IRTT latency tests

These are much more detailed results using the IRTT tool to test latency and packet loss with UDP packets to a server I run in a datacenter at or very near the Starlink LA POP.

  • 0.61% mean packet loss
  • 36ms mean latency.
  • Several incidents a day of 20% or more packet loss. (You see this pattern in applications too; the network goes away for a few seconds).
  • Clear pattern of higher packet loss during evenings. 30 minute average gets as bad as 2% or so occasionally.

Starlink monitoring

Starlink’s own monitoring data, using their gRPC endpoint to pull data from the dish.

  • two 30s+ outages around 3am. these seem to be related to firmware upgrades
  • 36ms mean latency
  • 0.6% “obstruction fraction”. It’s unclear what the dish reports as obstructions; at least some of it is packet loss unrelated to my antenna. I have a very clear but not 100% perfect view where Dishy is pointed.

Proxmox production container for linkblog

Starting to containerize some stuff that I originally migrated to a VM. My linkblog, for a start. I need a generic Linux environment that’s fairly beefy; libc, not musl. Ideally I’d bake all this into a reusable container but I’m rolling it by hand for now. Here’s my notes.

Container creation

  • Create a unprivileged container with hostname “blogs”
  • Add root password, my SSH key
  • Use the Ubuntu 22.04 (or latest) template. Ubuntu so I can get deadsnakes for Python versions. I’d like latest Ubuntu but can’t because Playwright (the screenshot library I need for the app) only supports LTS releases.
  • 16GB of disk, 4 CPU cores, 16GB of RAM, 1GB of swap. Or more, these are all soft limits so it may be better to set these higher
  • Default networking but enable DHCP instead of static.
  • Consider adding access to vmbr1 for the NFS server.
  • Edit the container options to make it start on boot

Linux configuration

  • Start the container, launch a console, log in as root with password
  • apt update; apt upgrade
  • apt install joe sudo curl avahi-daemon git zip unzip rsync webp sqlite3
  • locale-gen en_US.UTF-8
  • Install tailscale
    curl -fsSL https://tailscale.com/install.sh | sh
  • Shut down container
  • On the Proxmox hypervisor server, modify /etc/pve/lxc/???.conf to give access to tailscale in the container
  • Start the container
  • Log in on console again
  • tailscale up, approve the URL to join the machine. Consider disabling tailscale key expiry in the web console.
  • Use ordinary ssh client to log in as root@ ts.net tailnet name.

(not sure avahi-daemon is working here, I can’t use the .local DNS name I am expecting. I tend to use Tailscale to connect to things anyway.)

Linkblog configuration

Specific to my application, but some generic notes here also about creating a prod environment for anything.

User setup

  • As root, make a user for the project.
    adduser linkblog; adduser linkblog sudo;
  • Log in as linkblog@ with password
  • ssh linkblog@localhost, to create the ~/.ssh directory.
  • create ~linkblog/.ssh/authorized_keys

Linux configuration

  • sudo apt install python-is-python3 python3.10-pip
  • Install Node18 from nodesource

App configuration

  • mkdir ~/prod
  • cd ~/prod
  • rsync -a nelson@sf.somebits.com:~nelson/somebits/linkblog/prod/ .
  • rm -r venv
  • python3 -m venv venv; source venv/bin/activate; python3 -m pip install -U setuptools pip wheel
  • pip install -r requirements.txt
  • sudo venv/bin/playwright install-deps
  • shot-scraper install

Testing and running for real

  • ./update.sh -f
  • cd site-generated; /usr/bin/python3 -m http.server 9191
  • Test HTML load in web browser
  • Push site manually and accept ssh host key.
    ./update.sh -f -p
  • Install crontab entry to run update.sh for user linkblog

Feed2toot for @somebitslinks@tech.lgbt

Separate cron job to update a Mastodon account from the RSS feed. Does not depend on any of the linkblog code, just the RSS feed.

  • As user linkblog...
  • mkdir ~/mastodon; cd ~/mastodon
  • python3 -m venv venv; source venv/bin/activate; python3 -m pip install -U setuptools pip wheel
  • pip install feed2toot
  • copy over the install from the old system. This gets credentials, config, and state.
    rsync -av --exclude=venv nelson@example.com:~/src/mastodon/linkblog-toot/ .
  • run a quick test, should show posting nothing if there are no new stories
    feed2toot -n --debug -c feed2toot.ini
  • Install crontab entry to run go.sh for user linkblog

TODO

  • Package linkblog as a proper Python package so deployment is better
  • Write linkblog code to manage crontab (or at least emit the line)
  • Write linkblog code to run test server

Windows and voice recognition

Looking for typing accommodations while my wrist is giving me trouble. I love how Google Voice recognition works on Android, you’d think that it would be even easier and better on a desktop PC. But the UI doesn’t quite seem to be there.

Update. I originally wrote this post using Windows 10. Turns out Windows 11 has an entire new thing called Voice Access and it’s quite good, just about what I need. I’ve edited the post to reflect all this, but it’s probably a little confusing.

I’m fortunate that I can use both hands still and mousing gives me no trouble, just trying to take some load off my left hand.

Windows 10

Windows 10 seems to have two different systems for voice recognition. There’s an older speech control system that is mostly focused on UI control like opening the start menu or closing windows. It has some speech to text dictation but the language model is terrible and not useful.

There’s also the newer windows dictation accessible via Win-H. It’s dictation only, not really system control, but reasonably good. However the UI’s awkward. Also the language model is not as good as what I get on my pixel eight. But it is usable.

The biggest problem is activating dictation mode. I have to click in the window I want to type in, then click this weird microphone icon that’s hovering in a fixed width window on the desktop. And even then it does not work reliably. I would dearly love to assign the “take dictation” function to something like a hot key or mouse button four. Haven’t found a way to script that. Quick searches make it look like it’s not possible.

I had thought Microsoft put more work into usability. The full speech control system does work, but it’s pretty awkward and is something you would only use if you had no alternative. And the fact it’s basic dictation speech model is no good makes it useless to me. Maybe it’s better in Windows 11? I think the full control Voice Access system is much better.

Windows 11

Microsoft did put more work into usability! Windows 11 is significantly better. The old speech control system that I didn’t like is basically gone. Windows Dictation has been extended to Windows Voice Access and gives you fairly reasonable control over the whole UI.

For my purposes, the most important thing is that the speech to text in the new Windows voice access is much better. The UI is also better. You can basically leave it running all the time, no need to press a button to activate the microphone every time you need it. It doesn’t do anything until you start talking. Then it will just insert what you say as if you typed it. That means I can leave the thing running all the time. And when I have something more extensive to say, I can talk instead of type. (Although it seems like it picks up audio from the speaker so that’s a little annoying if you are playing a video with someone talking.) The speech model is pretty good, other than the automatic punctuation system which I’ve had to turn off. Totally usable though, it’s closer to Google Board speech detection than not.

There’s a good little voice control demo that I ran through and I’m impressed that I could actually use this to control a PC with my voice if I’m patient enough. It works by you speaking voice commands. It has some generic controls for clicking named buttons or narrowing in on a region of the screen to click on. It also has some specific app integration. For instance, “close tab” seems to be something it understands explicitly to close tabs in a web browser. It doesn’t work in Chrome but it works great in Edge. Maybe Edge has extra code to interface with voice access? One drawback is there is some ambiguity. If I start a sentence with the word start or close it may interpret it as a command and not me trying to type those words. There is a dictation only mode but I haven’t figured out how to turn it on (saying “switch to dictation mode” should do it but does not for me.)

Voice In extension

Now I’m wondering why Chrome on desktop doesn’t have voice typing. It seems like it would be easy to build it into the browser. I’m finding some third party hacks like Voice In.

I gave Voice In a try and it seems to mostly work and be a lot simpler trigger than the windows built-in thing. You can bind it to any windows hotkey but in Chrome that means control or alt + a letter. I really want just a mouse button. I probably can use Autohotkey to make that happen. Being a Chrome extension makes it pretty limited but then also probably easier to integrate.

I gave it more of a try and it’s mixed results. The language model these things recognize to is so important. I was writing an email to a friend about gay stuff and it kept missing very basic words that would be common in a gay context but not in some other. Also it has a habit of capitalizing random words like extreme or City. Mostly it just made me wish I could use Google Voice typing model because I am very good at getting what I want to out of it.

Having the extension be Chrome only is a little irritating particularly when I switch to slack. I guess I could run slack in the browser. The free version works reasonably well but really you’re going to pay $60 a year if you use it all the time. It’s not a big problem not having a keystroke to activate, mostly you just leave it active all the time.

Google could absolutely build a good Windows desktop or Chrome product for voice typing. I suspect the market just isn’t big enough for them

Kinesis classic on a modern computer

My RSI is flaring up so I thought I’d fire up my ancient Kinesis Classic keyboard, the one that saved my career 20+ years ago when I first had problems.

The keyboard has an ancient AT keyboard cable. I found it with a PS/2 adapter already attached, those two ports are electrically identical so the adapter is easy. I don’t have a PS/2 to USB adapter around the house but fortunately my 2019 PC still has PS/2 ports on the back. Purple for keyboard! After plugging it in the keyboard lit up but I had to reboot to make it actually work. IIRC that’s a problem with the old Kinesis firmware. It works fine with a second keyboard on USB.

It mostly seems to still work fine. Sometimes keys seem to be repeating when I don’t mean it, like I’ll press x once and xxx is inserted. It’s not frequent though, a missed interrupt maybe? I mostly still remember how to type with it too, I suspect it’ll take a day to adjust (took a week or more the first time).

I can’t find any documentation of the custom remapping I set up long ago. It sounds complicated but the main effect is to move keys more to where they are on a normal keyboard. Here’s what I found I had:

  • Bottom row right hand: all 4 arrow keys in hjkl vi configuration.
  • []{} remapped to bottom row left hand (where left and right arrow were)
  • `~ is moved to upper left (where += is on the Kinesis)
  • += is moved to caps lock
  • Caps Lock is unmapped.
  • Escape is moved to the key marked “delete” on the thumb
  • Delete is on lower left (where ~` is on the Kinesis).
  • The Backspace key sends VK_BACK in windows, a Backspace.
  • The Insert key is default, VK_INSERT.

I also went and found my ancient notes on the keyboard firmware for programming.

Progrm-Ctrl-F10   Reset keyboard memory 

Progrm-Backslash Toggle keyclick mode
Progrm-Hyphen Toggle tones for caps lock, etc.
Progrm-F9-xx Change repeat rate to xx
F1 .5 cps F2 3 cps F3 5 cps F4 7 cps F5 10 cps F6 15 cps
F7 20 cps F8 30 cps F9 40 cps F10 60 cps F11 125 cps F12 300 cps

Progrm-Ctrl-F5 Toggle Dvorak/Qwerty mode

Progrm-Shift-F6 Toggle shift as sticky modifier
Progrm-Ctrl-F6 Toggle control as sticky modifier
Progrm-Alt-F6 Toggle alt as sticky modifier

Progrm-F12 Enter/exit remapping mode

Progrm-F11 Enter/exit macro definition mode
Progrm-F7 Make macro pause for data / End entering macro data
Progrm-F8 Put a half-second delay into a macro
Progrm-F10 Disable/Enable all macros

Shift-Shift-F12 Report firmware version (press both shift keys)

Python packaging, pytest, click, VS.Code

I’m working on my blog engine. I want to package it nicely as a Python package. I also want to be able to run my code from a command line using the click library, and write and run tests using pytest, and be able to do all this with the debugger in VS.Code. I’ve never made my peace with Python packaging, for many many years now I’ve avoided it. Because it’s a mess.

Anyway I just tried again here in April 2024 and more or less succeeded in just an hour or so. This is where I would write clear docs with a github repo with the code but.. nah. I’m not confident it’s right and I don’t understand it well enough to present coherently. But I’ll write up what I learned.

I mostly followed the Packaging Python Projects tutorial which explains the creation of this sample project. Following that gets you a basic Python project which you can install with pip install -e. The key thing here is everything’s driven by the pyproject.toml file. If you are reading any docs that talk about setup.py they are old and outdated; the TOML is the new way.

Some subtleties in the pyproject.toml:

  • My project has dependencies that I specified in the TOML. It depends on pytest and click.
  • I had to pick a build backend; I’m using setuptools as the old non-fancy default.
  • My project has console scripts. You can specify these in entry points or in a scripts section.

Getting click working was not hard. There’s docs for click + setuptools. Note these are in terms of the old setup.py style but translating to pyproject.toml isn’t too hard.

Here’s my source tree for a toy package called “whir”

  • pyproject.toml in the root directory
  • Python code in sys/whir/.
  • src/whir/__init__.py that imports all the public functions, particularly the click commands.
  • src/whir/lib.py is simple library code that other stuff imports.
  • src/whir/main.py contains a main_cli() function that’s a click command. __init__.py imports it so it can be used as a script in pyproject.toml. It also imports the lib code via import whir.lib, not a relative import.
  • tests/test_lib is a pytest function that tests the lib code. It imports it with from whir import lib.

Getting pytest working was not hard either. The default setup worked just fine from a shell. Getting it to work inside VS.Code’s extension for it required adding something to pyproject.toml to get pytest to use importlib, as described here. But now I can just press a button the IDE GUI and all my tests run with a nice display. Yay!

Getting the VS.Code debugger to work with click was tricky. AFAICT there’s no easy way to get VS.Code to invoke a click command. But there’s a hack where you call the click command with string command line arguments inside a if __name__ == '__main__'; then VS.Code can be used to just debug the file and it will work.

Edit: thanks to Claude I’ve now found two more ways to invoke a click command from a function. The intended way to just invoke it is to use main_cli().callback(args): the click decorator adds a callback function to the command function you can use. There’s also a whole library for testing invocation of Click commands, CliRunner, that will mimic a command line call. It sets up a special environment that captures stdout and stderr, can mock up a filesystem, etc. It’s for using in a unit test framework.

Ranting reflection

It all worked pretty straightforwardly! But I have no idea at all how it works. If something goes wrong I won’t understand what is happening or how to fi x it. And the tools are creating little files and shims that get between me and my code. It’s always like this with packaging and build systems and I hate it.

Fix for Android Pixel Delayed Notifications

I’ve had an annoying problem on my phone for two months: notifications would be delayed by many minutes, mostly only showing up when I manually woke the phone. I think I found a fix.

Turn off Adaptive Connectivity. Details in this Reddit post the text of which I will duplicate below.

Update Apr 10: after a few days of trying this I’d say turned it off has helped but not fixed the problem entirely. Updates still don’t always come immediately but they are delayed by just a few minutes now, not 30+. I don’t have solid data on that, just observing.

Update Apr 24: notifications still seem better before but it’s not perfect. Also I’ve since learned about Android Doze, a feature that dates back to Android 6 where the phone goes into a low power Doze mode. It’d cause exactly the delay problem I’ve seen. Some more discussion here. I wonder if something changed recently with the implementation that made the delay much more noticeable?

But first, a rant. This is a supremely irritating kind of problem that shows how frustrating the modern tech support experience is. There was no realistic way to get helpful info from Google about what this bug might be or how to fix it. I don’t know if there’s even any real personalized support path at all, if there is one I assume it’s the usual “turn it off and on again” useless response. Web searches didn’t get me anywhere, in part because Google’s index is awash in spam. The Android docs are not good, Adaptive Connectivity doesn’t seem to be described adequately anywhere. I did finally find my way to Google Issue Tracker which has what looks like a relevant bug entry. But that’s write-only, barely any acknowledgment.

I’m a software engineer! I understand the tech, I’m careful, I’m willing to spend the time providing expert help to reproduce and debug this issue. But I have no way to get through to someone. I guess that’s inevitable given the economics of supporting millions of users. Still irritating for my $1000 flagship phone.

Not for the first time have I wished that shibboleet was a real thing. I did get some really helpful Google engineer feedback on Mastodon after a passkey problem I reported but that was just dumb luck and a particularly friendly Googler, the right person happened to see my complaints.

The Reddit post

Are you getting delayed notifications on your phone? Try turning off the setting “Adaptive Connectivity” (under Network & internet in Android 14). I think that fixed it for me. Also check that “Adaptive Battery” and “Battery Saver” are off.

Two months ago I posted about getting delayed notifications; they’d only show up when I woke up the phone. A popular post, it keeps getting comments from people saying “me too”. Thanks to a hint in this comment I learned about the “Adaptive Connectivity” setting. I’d never heard of it before. But it was turned on; I turned it off and now 24 hours later my phone has been reliably getting notifications the moment they happen.

As a bonus, I think this may have also fixed my problem with the weather app showing me in the wrong location. Sometimes I’d get weather for Los Angeles where my IP address is rather than Grass Valley, CA where my phone is. I’m less certain of it but it’s plausible.

It’s not clear to me what Adaptive Connectivity is supposed to do, I can’t find clear docs about it. I think it may be a Google Pixel only thing? A lot of web pages talk about it only in terms of cellular, 4G vs 5G. I’m on WiFi almost always and still had notification problems. I don’t know what Adaptive Connectivity’s intent is but my experience is in Android 14 it means “break notifications”. My guess is it’s some power saving setting that is having the effect of taking the phone offline.

Note there’s other phone settings that might cause delayed notifications. Adaptive Battery is the big one (I’ve always had it off). Battery Saver mode may disrupt notifications.

Also individual apps all have battery settings. That used to be Unrestricted / Optimized / Restricted and my understanding is Optimized was supposed to let notifications through immediately. The UI for all that just changed in Android 14 QPR2 but I think it functions the same. Most of my apps are set to Optimized and are getting notifications on time.

Bottom line: turn off Adaptive Connectivity and Adaptive Battery if you are having trouble with delayed notifications.

GPSLogger v129 preferences on Android 14

I use Mendhak’s GPSLogger to track my position. It’s a great tool but a little low level, and in particular its files access is a bit confusing because the docs are written in terms of a basic Unix model but Android has virtualized and secured file storage so many times it is hard to find things. (I hate this about Android; it still lets you use files, but it’s very confusing and no longer a visible part of the consumer product.)

My issue now is I want to back up my settings, reinstall the app, then restore the settings. GPSLogger allows for that! It’s a feature called profiles. Basically you get it to write all your settings to a .properties file, then you can restore them later. The question is, where is that file written?

I found the file by mounting my Pixel 8 as a USB drive, then on Windows going to This PC\Pixel 8\Internal shared storage\Android\data\com.mendhak.gpslogger\files. (Actually I found it using Windows file search, which took several minutes). There’s a Default Profile.properties there. Also a temp.properties I explicitly created. You may have to tell GPSLogger to save the profile first.

I can’t find the properties files using the Files app on the Android device itself. Nor Solid Explorer. Presumably these are being hidden or sandboxed by the OS?

The properties file itself is a simple text file with lines like startonbootup=true in it.

This whole path was deleted when I uninstalled the app. (No surprise! Android wipes apps’ saved files in most cases.)

Once I reinstalled the app and saved a profile once the folder was back. Just dropping Default Profile.properties back in the folder didn’t seem to work; the app may not reread that file? I created a new nelson.properties (editing the file first, the profile name is in the properties file). That let me switch to a new Nelson profile with my preferences loaded. There are a variety of other ways documented in the FAQ to load a profile’s file.

Everything seems to work on reboot. GPSLogger starts with the new Nelson profile.

I have GPSLogger storing my GPS tracks to /storage/emulated/0/Documents/GPSLogger. I can see that in Solid Explorer by looking at Internal Storage > Documents > GPSLogger. Syncthing also sees that folder and is syncing it for me. When I reinstalled the app it could no longer write to files there (an error in Log View). I had to re-enable “write all files” permission (GPSLogger prompts you to do this if you change the folder it writes to).

I verified everything’s working after the reinstall, all the way to my syncthing server the data that archives my data.

OpenStreetMap: temporary road closures

I made another complex OSM edit, marking a road closed for construction. Details of the closure are on page 2 here. Nevada Street Bridge (OSM) is closed to cars until Nov 1 2024 or so.

As with all things OSM, how to actually do something this complex is not clear and there are many ways in the free-form schema.

First as a practical matter, serious mapping apps aren’t just relying on OSM for road information. They are pulling road closures from other sources. Google Maps has the closure and is routing around it. The fanciest OSM routing app I know, OsmAnd, does not (yet) know about the closure.

I chose to do the edit the aggressive way. I changed the way from highway=tertiary to highway=construction and construction=tertiary. Ordinarily this is the kind of thing you’d do for a new road being built. But I think it will have the effect I want, I just have to remember to go back and edit it again in November when the road is open. As a bonus I was able to tag it foot=yes which captures that you can still walk through the area, just not drive.

The other option was to just add a Conditional Restriction to the way, as seen here or here. A tag like motor_vehicle:conditional=no @ (2018 May 22-2018 Oct 7). I didn’t do this. One reason is this tag seems mostly useful for tagging permanent things with relative timestamps, like “road closed to cars 8am to 10am evey weekday”. I was also worried that most OSM users don’t process such a complex tag and will default to showing the road open. And finally that date range syntax I pulled as an example is really hinky. The ISO 8601 syntax would be 2018-05-22/2018-10-07 but near as I can tell OSM does not have an ironclad standard to use ISO 8601 for dates everywhere. I haven’t seen ISO 8601 slash syntax for time intervals in any of the docs.

End of the day I just want it to look right on the map. This is good enough.

Update: a day later OsmAnd routes around the closure, I think because it picked up my edit. Both Valhalla and OSRM on the OSM website still show a route through the closed road. I have no idea if they have updated data or not, but I’m guessing not. Update 2: it took most of a week but now the routing on the OSM website bypasses the closed bridge.

City reference map

From page 2 of the newsletter. The blue area is closed.

Passkeys try two

Yesterday I tried using passkeys with Google and had a bad experience. I’ve since found a couple of sources of the problems and worked around them. I will reiterate it’s still all a bad experience, in no way is this product ready for ordinary users to rely on.

Some of my passkey problems may be specific to logging in to Google services. There seems to be something wrong specifically with their server-side authentication implementation, maybe related to the “new login page” they recently launched. I’m having a better experience with other sites. With both GitHub and Adobe I’m able to create a passkey, save it, and use it to log in. Sometimes. Chrome seems to be sending passkey requests to the wrong device.

Some of my problems might also be related to 1Password. It’s in the middle, between the authenticating site and my browser. But I really want passkey requests to go through to Google’s passkey agent on my phone (at least until 1Password works on Android). See below for notes on 1Password; I’ve disabled its passkey support in my desktop browser for now.

The main problem I’ve encountered is which agent I store the passkey on. I have at least four possibilities: 1Password, Windows Hello (on my desktop), my Pixel 8 Android phone, and my Samsung Android tablet. Those latter two are the same data store, with passkeys synced, but separate physical devices. I want to use the Pixel 8 because it’s the most likely to be accessible to me, at least until 1Password works reliably on Android. But it’s seldom the device I’m logging in on, so I’m relying on Chrome / Windows delegation to a nearby device.

Saving a passkey

This is what saving an Adobe passkey looks like. Before I turned off 1Password, Chrome on Windows wanted me to save the passkey in 1Password, that’s the screenshot above left. If I click the little Yubikey looking thing at the top then I get brought to a Windows dialog in the middle: this is asking me to save it to Windows Hello on my desktop, as authenticated with a PIN. If I then click “Use another device” I get the option of using my Pixel 8. That works; the Pixel gets a message (Bluetooth? Internet?), pops up a screen, and I can save the passkey.

Logging in with a passkey

Logging in worked for me, at least once. But as I tried to document this more thoroughly it failed. I finally turned off 1Password’s recommending passkeys in the browser and that seems to have simplified things enough where they work reliably.

That slideshow is the easy seven step process that’s working for me to log in. I believe steps 1 and 2 are Adobe’s website, 3 4 and 5 are all Chrome on desktop, and steps 6 and 7 are Windows. Not depicted: the extra steps for the UI on the phone to actually use the passkey.

Things go really wrong between steps 3 and 4. I say “Use a passkey from Pixel 8” and then the browser sends the request to SM-X800 instead. That’s my Samsung tablet. WTF? Google knows I’m logged in to two Android devices and syncs passkeys to both of them. So in theory either device would work but I have the phone with me always, not the tablet. And it’s wacky that I am prompted for “Pixel 8” and it sends it to “SM-X800” instead. The passkey dialog sometimes shows up on the tablet but when I’ve tried using it it fails (now it’s not even showing up). I can’t find any way to tell Google to use my Pixel 8 exclusively, or preferentially. I asked on Reddit.

So instead of step 4 I do steps 5 and 6 instead, the awkward way to get Chrome/Windows to use another device for a passkey instead of the default. Note the UI stops being Chrome and starts being Windows at step 6. The good news is this does work; the passkey dialog shows up on the Pixel 8, I approve, and I’m logged in.

Mind you this 7 step process is the good case, I have it working reliably and repeatedly. But only after disabling 1Password entirely and only after going through contortions to work around some problem with using the wrong passkey device. Still not sure how that is happening.

Update: really helpful response on Mastodon from a Google engineer saying at least some of what I’m encountering with multiple devices could be a bug in Chrome.

1Password

I’ve only gotten this far by disabling 1Password’s passkey support entirely. It looks like this:

I’m sympathetic to 1Password, it must be very hard to preserve your business when dependent on the platforms of monopolists. I want them to be my passkey store. But until 1Password works on Android I can’t. And the Chrome desktop browser integration on Windows seems to be causing me problems. Not sure if it’s outright bugs or if it’s just some things are simpler without it.

Anyway, here’s the 1Password extension preferences and its confusing array of options for exactly where it will intervene. As you can see I’ve disabled the most obvious passkey part of it. I still see some evidence it’s in the middle sometimes though. I’m really not sure. Some of my testing has been with the extension entirely disabled in Chrome, I’m reasonably sure it’s not involved in those cases.

No landline for a month, is great

A month ago I turned off my AT&T landline and ported the number to NumberBarn. Couldn’t be happier. No more junk calls! Voicemails delivered to my email! It’s great. Can’t believe I wasted $100/mo on that horrible landline for so long.

Numberbarn has been fine. I wish it had more features. I just noticed today they don’t display any names in the caller ID info on the caller log, just the number. (CNAM, they call it). That’s too bad. Often the text info is pretty bogus but that’s a signal of its own kind, legitimate businesses identify themselves.

I don’t get a lot of spam voicemails. Maybe 50% of the 10 or so voicemails in the last month have been spam. 95% of the calls would have been, so that’s a big improvement. I suspect most of the fraud companies just hang up when they recognize it’s an answering service.

Ken pointed out one hassle with not having a landline; we don’t have wireless phones all over the house. Now if I want to call him I have to call his cell phone and hope he didn’t leave it in the kitchen where he can’t hear it. I can think of ways to fix this but they’re all pretty awkward and it’s not that big a deal.

I still have a landline in the other house. We may try porting that number to my ISP; Sonic.net bundles phone service I’ve never used. I’d get rid of the idea of a phone for the house entirely but Ken still likes it there for some reason. At least I can save some money.

AT&T cancelled my account as soon as the number was ported and prorated the last month’s bill without me ever having to ask. So that’s one worry settled.

OTOH AT&T also gave me a nasty little reward for being a customer for so long. A massive data breach dating back to 2021. They’re telling the press they have no idea how this data could have been leaked, not the reassurance their PR person is hoping it is.

Passkeys still awkward in Mar 2024 (Android, Chrome, Windows, 1Password)

Some tech friends surprised me by saying they’re all using passkeys and liking them. I’m still not, despite being very interested in them. Passkeys seem like a failure to me so far. But my friends who are having success with them are all full-in on the Apple ecosystem, that may be why they are having a good experience. I’m using mostly Google and Android stuff and really want 1Password to manage my passkeys.

Update: the notes below are mostly for trying to log in to Google using passkeys. I had a better experience using passkeys for GitHub.

1Password passkeys are a mess.

1Password doesn’t work. I’m not sure it’s their fault. The platform owners (Google, Microsoft, Apple) have all paid lip-service to supporting third party passkey stores but in practice it is clumsy if it works at all. 1Password announced support for passkeys last September, including Android. But here in March 2024 it still doesn’t work. It requires Android 14, which came out only 5 months ago and isn’t on many devices. It also requires Chrome support third party passkeys. Which maybe works? But requires setting a flag in Chrome to enable, and user reports say it may not work well. Disappointing all around and also a clear question for anti-trust investigation IMHO.

The Google passkey experience

Using passkeys in Google (Android, Chrome) is better but doesn’t work reliably. I successfully just created a passkey stored on my Pixel phone, in Google’s store. And then logged in with it using my Windows machine running Chrome. But I had to scan a QRCode to do that, an absurd workflow, despite my phone and my desktop communicating (via Bluetooth?) in the past in some Chrome thing. In theory this desktop/phone integration gets better the second time you need it but instead it just doesn’t work at all; the desktop browser tells me to press a button on my phone but the prompt never shows up on the phone. A similar workflow for Google 2FA is still working so my phone is still able to do some authentication related stuff.

Also I can’t reliably use accounts.google.com to manage my passkeys. Google’s webapp crashes. It might be related to my browser extensions, it works better in incognito mode. Or it’s possible this is something unique to me (I have one of the very first Google accounts ever, created when I worked there before anything launched). Or maybe it’s just broken?

None of this is giving me much confidence in Google managing passkeys.

How about Microsoft?

I also tried creating a passkey stored in Windows Hello to log in to Google using my Chrome browser. This actually works pretty well. But Windows Hello feels rinky-dink and I really don’t want to use it. And at least some part of Windows integration breaks.

Migration

Another huge problem with passkeys is there’s still no story for migrating. If I have a passkey stored on my phone and I get a new phone, can I move the old passkey to another phone? What if I switch from Android to iPhone? Every time I’ve looked they say “migration is a work in progress”.

The practical thing for now is to look at passkeys as ephemeral things you have many of. Your account at Google has many ways to log in: password, proprietary device-based unlock, passkeys. It might have several passkeys. If you get a new phone you’ll just make a new passkey.

Except... what if I use passkeys to log in everywhere? What if I have 100 passkeys on my phone? Do I manually have to create 100 new passkeys, one for every site? That’s ridiculous. But I think that’s where we are today.

Which brings me back to 1Password. They have an excellent story for migration; your authentication lives in the 1Password cloud. Or at least I think they do, I’m not actually sure for passkeys. I can’t test it. Because 1Password passkeys don’t work in Chrome.

Update: it seems Android is storing passkeys in the Google Password Store which you can manage via the Chrome browser. They are synced across devices.

Don’t route me through a river (OSM and fords)

Yesterday Google Maps tried to get me killed, sending me on a route near Grass Valley, CA that had me driving through this flowing creek. OpenStreetMap based maps want me to go that way too.

I’m not the only one Google routes this way. And the ford claims victims. On March 1 2024 someone had to be rescued from this same creek coming from the other side. Back in 2012 too.

Here’s a link to Google Maps routing for the area. And openstreetmap.org’s website. Both show you going over Sharmiden Way which is a ford. During the rainy season the crossing at Wolf Creek is not safe. It’s never really a good route, even if the road is dry it’s still unpaved and awkward. You really would rather go south another half mile to Brewer Road. Which Google offers but only as an alternative.

Nothing in Google’s data seems to indicate they are aware it’s a ford, not a normal road.

Tagging fords in OpenStreetMap

I can’t fix Google. But I can edit OpenStreetMap! Here’s the area in question; the ford is where Sharmiden Way intersects Brewer Road. When I started on this there was no indication the road was unusual at all. So I went and added a notation of the ford. True to open schema form, OSM has several ways to tag fords.

The simple way is to add a single node on the way and tag it ford=yes. I made that edit a couple of weeks ago. The result in the OSM default web map is a tiny blue icon indicating the ford. Not great but at least I can verify the data is on the map.

I made a new edit today, the second fancier way. Which is to create a whole separate way for the ford and tag the whole way with ford=yes. Actually the iD editor wanted to put ford=ford in there but I overrode it because from what I can see ford=yes is more common.

I left both node and way ford annotations in place. Now OpenStreetMap knows about the ford. Will software use that to avoid danger?

OSM routing through fords

Neither of the routing algorithms openstreetmap.org’s website seem to avoid fords. Both Valhalla and OSRM on happily send cars plunging through the swift-flowing creek.

The Android app OsmAnd does have an option (off by default) to avoid fords in routes. And it successfully generates the safer route.

OsmAnd is powerful but it’s really not a user-friendly app. Finding the option to turn off routing through fords it’s like four menu items deep. The map download process is slow and awkward. And the Google Play version of the app wants you to pay for updated maps, otherwise the data is weeks old (which makes testing awkward). The trick for that is to get the F-Droid version which has most of the Pro options unlocked at no cost. Even then you still have to find the extra “Updates” tab to get fresh data, it’s not in the ordinary downloads.

Now I’m curious if any maps avoid this ford. Google Maps can’t, it doesn’t even know the ford is there. OSM based apps now know but only if they’re using fresh data.

I tried Scout Maps, the only OSM app I could find for AAOS, but it still routes me through the ford. They say they use OSM data but there’s no way for me to see how fresh the data is. The app has a way to tell it to avoid unpaved roads but no explicit way to avoid fords.

I got a nice personal message on Mastodon about GraphHopper, a routing service. The default route uses the ford but at least shows a warning about it. And you can customize its algorithm to avoid the ford.

Intel QuickSync GPU transcoding in Proxmox

Notes on video hacking, efficiently transcoding H.264 to H.265 video. I’m updating my old to65 function to work in my new Proxmox environment. The key idea here is to use jellyfin’s build of ffmpeg with Intel QuickSync codecs to transcode video faster. The challenge is making getting a Proxmox guest OS that can use that. Both to set up the container and also to make sure it has the permissions necessary.

The expedient solution I set up was to use a tteck script to install jellyfin. That’s a whole server environment and is overkill but it installs the /usr/lib/jellyfin-ffmpeg/ffmpeg I need. It also sets up the container to access the Intel GPU. The main thing it does is make the container privileged: not ideal (nor necessary) but sure smooths things over. There’s also some entries in /etc/pve/lxc/104.conf for mapping the necessary devices, particularly /dev/dri/renderD128.

Anyway installing with that script is really all I needed. With that my i5-12600K server is transcoding a 1080p video at about 4x speed. Using 40% of one CPU core and intel_gpu_top shows me the Render engine is pegged at 100% (encoding?) with the Video engine also at 20% (decoding?). That’s more or less what I remember doing on the old native hardware, no surprise.

tteck also has a tdarr package. I should try that again; last time I did I couldn’t figure out tdarr’s UI. It’s perfect for what I need but I was scared it’d aggressively transcode all my video files, I really want to only transcode a few things.

Taking over Feditrends

About a week ago I took over the service Feditrends, a link aggregator that shows trending stories on the Fediverse and Bluesky. The project creator (Jackson Palmer) had gotten tired of running it and shut it down a couple of times. I visit it every day so I took it over.

I have no immediate plans to change anything, I want to get some familiarity with what it’s doing and how it’s used first. Personally I use it partly to find interesting links and partly to keep tabs on what the Fediverse is talking about. The current dataset tends towards US news stories. I mostly avoid the mainstream news cycle but I like seeing what folks are talking about.

Taking it over

Taking it over was quite simple. Jackson did a great job releasing the code as open source. I got it running in about 15 minutes of work. It’s very simple, just a few hundred lines of Python code to fetch feeds and generate static HTML. It stores some stuff in a sqlite database. I haven’t looked closely.

Once I had it running locally and pushing to a web server of my own, Jackson just transferred the Namecheap domain name to me. I changed the DNS record and that was that. He also transferred the GitHub organization and the Mastodon account.

Observations

It all seems to run fine on its own. It does not have a lot of users. Feedly reports 22 subscribers, but of course that’s only a small fraction. The whole server is getting only a few thousand requests a day. About 30% of that is for the RSS feed for the main site, another 22% accessing the main HTML page. Maybe 1% of the requests are for the second experimental Bluesky product. I may remove that since I don’t use it and it’s completely separate code.

Feditrends now is pretty much entirely news links. That’s because its data source is Mastodon’s trending links (for example) on about 10 of the biggest English language Mastodon services. Mastodon.social is quite clear these are “News”. I’m not certain but I’ve been told these links are hand-curated, that a moderator has to approve a link to be valid for showing up there. Update: a friend says that the publishers have to be approved but not the links themselves. Also points to the Mastodon code for links.

Earlier versions of Feditrends used to have three tabs: News, Posts, and Hashtags. I’m not quite sure why Jackson narrowed down to just News but I can think of several reasons the other views could be harder to make work well. The code for posts is on GitHub.

Plans

The site could use an About page. With a last updated slug in it.

I never used the RSS feed before. It’s quite noisy, Feedly says it’s like 500 articles per week. I’ve gotten a suggestion to have a feed with fewer links, the Top 10 instead of all trending or something.

I really miss belong.io, Andy Baio’s old trending links service. That worked by watching Twitter accounts of a carefully selected list of 1000+ people for trending links. It’s possible a similar idea would work for the Fediverse but there’s various cultural forces at work that make me wonder if it really would. I should look at the “Trending Posts” data at Mastodon instances again to see if it’s interesting. Or consider my own curated set of accounts to track.

There’s some tinkering I could do to make the production a bit better. All my Proxmox work has paid off though, I got it up and running in an Ubuntu container on my server with simple backups, etc. I’m not sure what’s in the sqlite database and if it’s growing without bound. The static site publisher logs need some attention.

I should consolidate GitHub, right now I’m working in a fork.

I’d like to move the web serving off my own datacenter server and into some hosted solution. It’s so little traffic it’d be cheap or free on Github Pages or Netlify or just some sort of S3-like host or Cloudflare or something. Static sites are so easy to work with! The hard part is I’d like some basic access log info; I don’t want to add tracking Javascript just to get a rough count of visitors. I’m using GoAccess on the Apache logs for now.

Mojibake in RSS feeds for Feedly

I took over Feditrends, which has an RSS 2.0 feed. The feed’s contents are in UTF-8. Feedly doesn’t display them correctly, interpreting the typographical punctuation as ISO-8859-1 nonsense instead.

That mess is supposed to be quotation marks: U+201C “ at the start.

The underlying problem is that neither the feed document nor the Apache2 server specify the encoding. And in the absence Feedly is guessing ISO-8859-1. Odd guess in 2024! This may also be a problem for JSON feeds. Real weird if so, JSON’s default is UTF-8 as is jsonfeed’s recommendation.

The fix I just deployed now for the RSS feed is to add <?xml version="1.0" encoding="utf-8"?> to the start of the RSS feed document. I don’t know if this works yet. Two years ago I discovered it’s hard to test RSS feeds, there’s very few clients to use. And ones like Feedly I can’t force to refresh and display new. So instead I’ll just wait a day and see. Update I think it worked; the U+2019 in this headline displays in Feedly properly as “Ford’s” and looks like a curly apostrophe.

The other fix would be to get the HTTP server to specify the encoding. I suspect that’s what the old server was doing and I introduced a bug when I took over the product. Right now my server is sending Content-Type: application/xml without specifying the byte encoding. Adding a charset=utf-8 to that would be a good idea. But that configuration turns out to be slightly difficult in Apache2. I’ve already got AddDefaultCharset utf-8 in the config but that doesn’t really apply everywhere. Some random LLM recommends adding this to my config:

<FilesMatch "\.xml$">
Header set Content-Type "application/xml; charset=utf-8"
</FilesMatch>

That looks plausible. But I prefer the RSS document itself be self-describing. I’d set it in the HTTP transport too but I hate messing with Apache configs.

Two observations

Apache2 is really not a good web server anymore. It’s never modernized. So configuring Let’s Encrypt is a real mess (smoothed over by certbot). It has strange defaults for a world before UTF-8 and HTTPS everywhere. It’s possible it’ll never support HTTP/3. I only use it because I’ve been using it for, what, 29 years now? It’d be a Project to migrate my existing stuff over. I like Caddy these days as a modern simpler replacement although it lacks CGI support. (Don’t laugh, it’s still useful!).

The word “encoding” is ambiguous. I often say things like “that document is encoded in UTF-8”. But people also say “the feed is encoded in RSS 2.0” or “RSS is encoded in XML”. So many layers of encoding. “Charset” seems to be the better term to mean “is this ISO-8859-1 or UTF-8?” But that doesn’t feel quite right either. Surely Unicode is the set of characters, and UTF-8 is the encoding of that into bytes? Huh.

Notes on 110ppi monitors

I had to help Ken get some new monitors for his desktop. He currently has two 24″ 1920x1200 monitors. He doesn’t want high DPI monitors, good old cheap 110ppi-ish monitors are fine. Here’s what I learned.

PC monitors come in several standard sizes. Here’s some measurements for what’s out there:

24″ monitors 1920x1200 (unusual height)

This is what Ken has now. Most 24″ are 1920x1080.
20.4x12.8″ = 522 sq in (for two)
95 PPI

27″ monitors, 2560x1440

23.5″ x 13.2″ (596.7 x 335.7 mm) = 620 sq in (for two)
110 PPI

34″ Ultrawides 3440x1440

This is what I have now.
31.4x13″ = 411 sq in.
109PPI.

38″ Ultrawides 3840x1600

34.6x14.4″ = 498 sq in.
111 DPI

49″ DQHD 5120x1440

Basically two 27″ monitors glued together
47″ x 13″ = 611 sq in
109PPI.

Resources

Screen size calculator
PPI calculator
Wirecutter 24″ monitors
Wirecutter 27″ monitors

Netflix vs. two houses (Feb 2024)

I just spent 45 minutes getting Netflix to work at the same time in my two houses. I don’t know if it will keep working but I’ll write up what I’ve learned so far. The rules have changed recently as Netflix tries to crack down on account sharing. I don’t even know if what I want to do is allowed anymore.

A key concept here is the “Netflix household” which seems to be defined as “on the same internet connection as this TV”. They don’t explain what “this TV” might mean in a world of many different Netflix clients. Nor do they define “internet connection”: is it WiFi SSID? External IP address? What about VPNs and static routing and IPv6? Is “household” just a synonym for “house with a LAN” or does it encompass a larger notion of a family that might not always be in one building together? Netflix doesn’t make any of this clear.

What is working right now

I followed the instructions for “Using Netflix outside of your home”, “Second home or frequent travel to the same location”. These are frustratingly vague but the nut of it is “From the main place you watch Netflix open the Netflix app or go to Netflix.com on a web browser on your portable device once a month... Then take the same steps when you arrive at your second location to continue watching Netflix without interruption.”

The key thing here seems to be “on Netflix.com on a web browser”. We first tried this using iPad and Android client apps or the Roku client app and things kept not working. However when I watched Netflix first on an Android tablet Chrome tab, then Ken watched it on an iPad tablet Safari tab, suddenly everything started working and we were allowed to watch two shows at the same time in two houses. Once we’d done the browser thing we were able to both watch a show at the same time in the Roku client in two houses. Success! At least, for now. I’m anticipating it breaking.

I have a theory that what’s happened is Netflix is willing to take a look at all the IP addresses that recently tried to use an account. And then accept that they are all part of the same household if you jump through the login / email verification hoops. It also appears that they have a one SSID only policy for wireless devices. I’ll also note we were sent to the evocatively named URL https://www.netflix.com/tv2. Is that for a second TV? Who knows?

What Netflix policy allows

Netflix Standard ($15.49) allows you to watch on two devices at a time simultaneously.

Netflix now only lets you watch in one “household”. What’s a household? “A Netflix Household is a collection of the devices connected to the internet at the main place you watch Netflix.” As I said above this isn’t a very specific definition and I can’t tell if “one family that goes back and forth between two houses” counts as one household or not. The existence of special instructions for “Second home or frequent travel to the same location” suggests what we are doing should be OK.

There’s a bit more specific info on this help page. This part (and the reliance on mobile browser logins) makes me think SSIDs are a key factor: “If you have multiple Wi-Fi networks, we may only associate one with your Netflix Household. If you want to watch Netflix on a device that is connected to a Wi-Fi network using a different ISP account or that has a different external IP address, you may be asked to verify that device as part of your Netflix Household.” Just to complicate things: I have separate WiFi networks in the two houses, of course, but they both share the same SSID.

They also say “We use information such as IP addresses, device IDs, and account activity to determine whether a device signed into your account is part of your Netflix Household. We do not collect GPS data to try to determine the precise physical location of your devices.”

There’s a whole separate flow from Netflix for “I am temporarily at a hotel”. We used that first to get the second house working, and it worked fine for awhile but then it stopped. I think maybe they have a 14 day limit? Interestingly that device no longer had the option of saying I was temporarily there.

Finally Netflix has the option to add an Extra Member to an account. This costs another $7.99 a month and basically creates a new limited account with a separate email and password. It’s not clear whether an extra member is allowed to be in a second house / household / internet connection or not. Also I really don’t want a separate login, that sounds like I’d have to constantly be juggling who is logged in every time I watch TV. I just want two profiles on one account.

ARGH

This is all so maddening and more than once I thought to myself “you know, Plex never hassles me about this when I watch unlicensed copies of Netflix videos”. But I’m trying to be an upstanding citizen and pay for my service. Why does Netflix make it so hard?

I’m sympathetic to their desire to crack down on account sharing. Folks abused the old system quite a bit. I think the restriction that would make sense is “you can’t watch two streams simultaneously from two IP addresses”. Ie: two people could watch different things at the same time in one house, or one person can watch things at any house they want”. Just not two across houses. But I don’t think that’s their model.

I sure wish they defined exactly what their model is in technical enough terms I could understand if what I’m doing is impossible. I tried asking support for help and they seemed even more confused than me.

Landlines and VoIP phone services

I’m fed up with my landline. I pay $100/mo and all I get are fraud calls and politicians asking for money. My Grass Valley number doesn’t even work reliably; crappy wiring and an unreliable AT&T VoIP setup that fails during power outages (in violation of their obligations). It’s long since stopped being POTS over copper.

So I’m doing like the young people do and ditching the landline. But I need the old number to work. So I’m porting it to a VoIP service. The other choice would have been to port to a second number on my cell contract, but I don’t want my cell ringing with scam calls every day.

I picked Numberbarn to port the number to. Other choices were Google Voice or Callcentric. But Google Voice looks creaky and on the verge of being abandoned and also can’t directly port a landline. A friend uses Callcentric but I didn’t try it. Honestly NumberBarn had me with the cute pig logo.

Numberbarn has a nice looking product. It’s clear what their business is: selling phone numbers for marketing purposes, they list vanity phone numbers at $1000 and up. But they have a significant sideline in helping people cheaply park phone numbers they don’t really use. Also simple voicemail, call forwarding, and phone menus.

I was particularly impressed with Numberbarn’s help pages, a set of clear marketing-free descriptions of how to do things you’d want. Their how to port in page is as clear as could be. They have symmetric porting out docs too, an easy process. A sleazy company would try to make it hard to leave their service.

It’s cheap too. $2/mo for basic parking, $6/mo for voicemail, fancy forwarding, menus, etc. I need the voicemail so I’m paying $6. It has a voicemail-to-email but audio only, no text transcription.

Porting

I’m porting an AT&T landline. The process is shockingly simple. I just sent Numberbarn a copy of my phone bill and it was approved nearly immediately, then took three days to actually happen. It happened just as predicted and now the phone is answered by Numberbarn’s voicemail. Easy peasy.

A little surprised by the security of that. Cell phone porting became a big problem with all the hacking of SMS authentication, so they tightened security and added a required PIN to port a number. It looks like anyone with a copy of a landline bill can steal the number. It may be the equivalent of a PIN is just printed on the bill.

Another authentication option was for them to call my number and me to relay a security code. But since my AT&T line isn’t even working at the moment, that was not an option.

Cancelling AT&T

This is going to be the hard part. I’ve already tried the website and a customer support call to cancel and had a terrible experience. AT&T can’t look up that number at all anymore, all they can tell me is that the phone number belongs to “Bandwidth”. I see some hints that Bandwidth may be another name for Numberbarn but I’m not certain.

With any luck AT&T will simply stop billing me now that the number was ported, but I’m not hopeful. I’m now taking meticulous notes for the inevitable PUC complaint.

Update: Numberbarn support replied swiftly and thoroughly and confirmed that Bandwidth is their carrier. Also they suggested AT&T might automatically cancel my bill. Fingers crossed.

Update 2: about a week later I noticed that att.com is showing “Canceled” on my old landline. I can’t find any more information on the website, just a bunch of irrelevant ads in the Notices section, but at least that’s a sign that I won’t be billed for further service.

Pixel 8 system shows out of date information

I have a frustrating problem with my new Pixel 8 phone (running Android 14). The phone often shows out of date information when it’s idle, sitting on my charger at 80% or more battery.

One problem is the weather is wrong. In Grass Valley today it’s currently fully sunny and 43° with a forecast of 47–62. I think my phone is showing me weather in LA instead. That’s where my IP address geolocates too, so it must be a dumb service. My phone knows I’m in Grass Valley with WiFi or GPS location but that information is not getting used.

The other big problem is notifications are often delayed; the Gmail app (for instance) won’t chime when I get a new email until I unlock the phone, when suddenly a flood of notifications arrive all at once.

I think the underlying problem is all the various battery saving tricks that have been added to Android. The “Adaptive Battery” feature definitely can cause delayed notifications, it says so right in the settings, and turning that off helps some. But also the “App battery usage > Optimized” setting. I know to turn that to “Unrestricted” for certain apps (like Syncthing, GPSLogger, etc) but I just went and turned it on for a bunch of core Google services like “Google” and “Android System Intelligence” following this guide. We’ll see if it helps. If the Google system components don’t work in “Optimized” it’s a pretty serious bug, Google should fix that by either changing optimization or else disabling it where it breaks things.

Part of the problem here is how complex Android settings have gotten. Here’s the full list of fixes in a guide I found to fix At a Glance weather

  1. Go to settings -> privacy -> personalize using app data (ON)
  2. Go to Google app -> Profile photo -> Settings -> Location -> Always (ON)
  3. Go to settings -> Apps - > Search for Pixel Launcher -> Battery -> Unrestricted (ON)
  4. Go to settings -> Apps - > Search for Android System Intelligence -> Battery -> Unrestricted (ON)
  5. Go to settings -> Apps - > Search for Google app -> Battery -> Unrestricted (ON)
  6. Go to settings -> Location -> Location -> Permissions -> Google app -> Allow all the time (ON)
  7. Have your location (GPS) always turned on
  8. Go to settings -> Apps - > Search for Google app -> Mobile Data & Data -> Background data (ON) and Unrestricted data usage (ON)

Got that? 8 different places just to make the stupid weather widget display correctly. Which may or may not work, and these instructions are a year out of date. Didn’t work for me; I rebooted and the phone is still showing me LA’s weather.

Even more complex.. the lock screen display of the time and weather isn’t actually configured in Android’s Lock Screen. That’s some other older system lock screen. My Pixel phone is actually using the Google Assistant’s “At a Glance” feature, which is configured separately. Well most of the time; when the phone first boots it’s using the default lock screen. It’s all a big mess.

I should add here my GPSLogger stopped logging reliably. For years I’ve coaxed this thing into running 24/7 getting my location every few minutes, something Android really doesn’t want to let you do. That stopped working two days ago, with 3+ hour gaps of no logging. I’m hoping that was just a temporary thing and restarting it will fix it, but we’ll see.

Android’s been around now, what, 20 years? I guess a bunch of platform cruft and confusion is to be expected. Maybe it’s time for a new OS to rethink everything. Or for some dedicated product manager inside Google to spend two years figuring it out, untangling it all, and coming up with a new rational design that makes all this configuration work well and be comprehensible. That’ll never happen, no promotion in fixing old shit.

Let’s Encrypt / certbot in 2024

I was an early adopter for Let’s Encrypt, back in 2016, then renewed in 2019. Over time I’ve accumulated a lot of cruft in my main web server related to it. To the certbot team’s credit it’s worked all this time with minimal intervention. I was adding a new virtual host domain name and needed to update the certificate, so I looked at it for the first time in a few years.

I was running certbot 1.10 or something; certbot 2.9 is current. So I used apt to remove the certbot packages I’d installed long ago from a PPA. And followed the new instructions to install from snap. This installs an executable in /snap/bin/certbot. It also installs a systemd timer to renew certificates that you can see with systemctl show snap.certbot.renew.timer.

I think I still have some old cruft lying around. /etc/letsencrypt was never purged so the new Snap picked that up, which is a missed blessing. I also have a /etc/cron.d/certbot which will renew, but only if systemd isn’t installed. So I’m just leaving that assuming it’s harmless.

Anyway, certbot reinstalled it’s time to reconfigure certificates. This is as simple as running certbot and accepting the defaults. It generates a single SSL certificate to be used for all the domain names it finds in your Apache configs. It creates Apache2 site config files named *-le-ssl.conf to reference the SSL certificate. Certbot also prompted me to switch from RSA to ECDSA keys. Sure, why not.

Renewal can be tested with certbot renew --dry-run. It seems to process all the files it finds in /etc/letsencrypt/renewal. I have an old one left behind from December for windhistory.com, which I think is no longer used so I removed it. My new one it has chosen to name for logsoflag.com, probably a name it picked years ago. It seems to be used for all my domains.

Another mild naming nuisance: the SSL certificate has Common Name (CN) feditrends.com. That’s one of my 9 domain names. Apparently certbot just picks the first name in an alphabetical list when making a cert for multiple domain names. You can override it but it’s a nuisance, so I’m just going to ignore it.

It all seems to work and honestly took less time to run than to verify what it was doing and write up these notes. I’ve made a reminder on my calendar to check in May a few days before expiration that the renewal worked automatically.

TCL Roku vs Plex subtitles

Finally fixed an annoying problem where Plex subtitles wouldn’t show on my TCL TV (which runs Roku OS).

The solution is in the TCL TV settings, under “Accessibility / Captions mode”. Set it to “Off” (or maybe “On Always”). If you have it set to “On replay” or “On mute” then the subtitles Plex puts in a subtitle stream for the TV won’t display. (I suspect the TCL setting is overriding the stream.) I found this solution here.

There’s a different solution I found on Reddit that no longer seems to work. That has you setting the Plex app settings, to turn subtitles to “Roku captions mode”. Despite the Plex support docs describing this, my Plex app (version 7.14.6) does not have a Settings menu at all.

A third workaround is to tell Plex to “burn subtitles always”. But that has the server transcode the video and render the subtitles into pixels on the video stream. It’s much better to have Plex send a separate subtitle stream and let the TV do the rendering.

PS5 controllers vs Anker USB chargers

For years I’ve been annoyed that Sony Playstation controllers won’t charge when plugged into my high quality Anker USB chargers. They charge fine on the PS5 itself but not an external charger. Turns out this is sort of Anker’s fault, at least according to an informed-sounding reddit post.

It’s a screw up on both sides, Sony and Anker.

The reason the Anker charger won’t charge the PS5 controller is because the Anker does not correctly follow the rules of the USB Type-C specification, which forbids proprietary charging modes, and requires that USB-C chargers present as a USB BC 1.2 DCP (ie, a short between the D+ and D- lines.

The Anker charger presents Apple, Qualcomm, and other proprietary charging modes on D+ and D-. This is Anker’s “PowerIQ” technology, which tries to present a grab bag of random proprietary fast charging modes in an attempt to make the other side happy no matter what.

The Sony controller *requires* BC 1.2 DCP in order to start charging from a charger. This is technically also not spec compliant, as it should start charging from any 5V 1.5A or 5V 3A charger signaled via USB-C...

But yeah... in this case, the PS5 controller doesn’t charge because both sides aren’t following the USB-C spec in their own ways.

So the key protocol here is USB Battery Charging 1.2 Dedicated Charging Port. This spec dates to 2010 and works with old USB A devices. It predates the USB Power Delivery protocol from 2012 that I think is the hallmark of good USB C charging.

For USB BC, the charger simply connects the otherwise unused data D+ and D- lines with a 200Ω resistor and that’s a signal to the device it’s connected to a dedicated charging port. Unfortunately a bunch of other common proprietary devices (Apple, Qualcomm, etc) used D+ and D- in different ways to control charging. Anker supports those under the name “Power IQ” but then that doesn’t do USB BC.

It may be impossible to build a device that reliably supports all these old different weird ways of signaling charging. I’m sympathetic to the argument that in 2024, chargers should no longer be doing out-of-spec stuff for 10+ year old devices. But that’s a product choice that’s not clear. Also Anker is very proud of PowerIQ, back in 2014 or whenever it seemed like quite an innovation.

Sony could sure help by updating to USB PD.

Some more reading here, here, here, here.

Vaguely related; the PS5 DualSense battery is 1560mAh. There’s third party replacements that are 2650 mAh. Details here. My Pixel 8 has a 4575 mAh battery. Anker’s power packs are 5,000 to 40,000 mAh.

Ubuntu 23.10 upgraded: signed GRUB failed

Tried upgrading my main daily driver Ubuntu system from 23.04 to 23.10 and got left with a broken system. Upgrading grub-efi-amd64-signed failed with the error Unknown device "/dev/disk/by-id/*": No such device. I tried hacking around to get it working and failed. Finally reloaded from the Proxmox VM backup I’d thankfully made before trying the upgrade. I filed an Ubuntu bug.

I’m totally guessing here but I think the underlying cause is from when I virtualized the Linux server from physical hardware to a VM. That worked, including Secure Boot and ordinary kernel updates and update-grub, but now upgrading the GRUB packages fails. On the virtual system there really is no /dev/disk/by-id filesystem right now after rebooting back to 23.04. This discussion says that’s working as intended, that virtio devices don’t have serial numbers. I assume my old physical server had entries in /dev/disk/by-id. Those old entries are referenced in the hard-to-find /var/cache/debconf file, which contains the actual configuration options chosen at apt install time. And so now when I go to update the grub package it picks up the old config which is no longer valid.

If my diagnosis is right the fix is to get the working GRUB install to reconfigure itself somehow to use whatever new path is relevant, to stop referencing /dev/disk/by-id. And only then attempt an Ubuntu release upgrade.

Update: I tried just running dpkg-reconfigure grub-efi-amd64-signed. That just prints the error about /dev/disk/by-id missing. That seems like a usability bug; the reconfigure tool should recover gracefully if the configuration is bad. I tried various other methods of convincing apt to reconfigure GRUB but the best I could do was change the menu entries or Linux command line, never change which device it thought GRUB should be installed on.

Update 2: I may have found a fix using debconf-set-selections to reconfigure GRUB. It sort of worked but not entirely.

It’d be awfully nice if the package installer had better error messaging and recovery.

Detailed notes

Some extra details that are poorly edited but I’m capturing anyway.

Looking around on the Internet I found lots of posts about upgrades failing on this package going back to Ubuntu 18.04. Lots of various cargo cult solutions. This one is clearer than most. See also here or here. All of them boil down to forcing apt to remove and reinstall GRUB.

Here’s what I did in my failed attempt to reinstall GRUB after the upgrade had failed.

apt remove --allow-remove-essential grub-efi-amd64-signed shim-signed
apt install grub-efi
update-grub

This succeeded in that it installed a new, unsigned GRUB. But the Proxmox OVMF BIOS refused to boot it. The BIOS had secure boot turned on; turning that off it still refused to boot. Probably what I really should have done was force a proper reconfigure of the signed GRUB install instead. I tried to do that but various methods of reinstalling grub-efi-amd64-signed kept failing on the missing /dev/disk/by-id/. Need to look up how to force a full reconfigure of that package.

Boy do I hate messing with GRUB.

Dump of error logs:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Setting up grub-efi-amd64-signed (1.197+2.12~rc1-10ubuntu4) ...
Unknown device "/dev/disk/by-id/*": No such device
dpkg: error processing package grub-efi-amd64-signed (--configure):
installed grub-efi-amd64-signed package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of shim-signed:
shim-signed depends on grub-efi-amd64-signed (>= 1.191~) | grub-efi-arm64-signed (>= 1.191~) | base-files (<< 12.3); however:
Package grub-efi-amd64-signed is not configured yet.
Package grub-efi-arm64-signed is not installed.
Version of base-files on system is 13ubuntu2.1.
shim-signed depends on grub-efi-amd64-signed (>= 1.187.2~) | grub-efi-arm64-signed (>= 1.187.2~); however:
Package grub-efi-amd64-signed is not configured yet.
Package grub-efi-arm64-signed is not installed.

dpkg: error processing package shim-signed (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
grub-efi-amd64-signed
shim-signed
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)

Here’s the entries in /var/cache/debconf that reference the missing path

Name: grub-efi/install_devices

Template: grub-efi/install_devices
Value: /dev/disk/by-id/nvme-eui.002538b22140b542-part1
Owners: grub-common, grub-efi-amd64, grub-pc
Flags: seen
Variables:
CHOICES = /dev/nvme0n1p1 (1127 MB; /boot/efi) on 2000398 MB Samsung SSD 980 PRO with Heatsink 2TB
RAW_CHOICES = /dev/disk/by-id/nvme-eui.002538b22140b542-part1

Name: grub-pc/install_devices
Template: grub-pc/install_devices
Value: /dev/disk/by-id/nvme-Samsung_SSD_980_PRO_with_Heatsink_2TB_S6WRNS0T220037X
Owners: grub-pc
Flags: seen

This might be the original install log that shows what path was chosen. If so, it gives a choice for an alternate name for the device.

2022-08-09 23:28:45,261 - cc_grub_dpkg.py[DEBUG]: considering these device symlinks: /dev/disk/by-id/nvme-Samsung_SSD_980_PRO_with_Heatsink_2TB_S6WRNS0T220037X,/dev/disk/by-id/nvme-eui.002538b22140b542,/dev/disk/by-path/pci-0000:01:00.0-nvme-1

2022-08-09 23:28:45,261 - cc_grub_dpkg.py[DEBUG]: filtered to these disk/by-id symlinks: /dev/disk/by-id/nvme-Samsung_SSD_980_PRO_with_Heatsink_2TB_S6WRNS0T220037X,/dev/disk/by-id/nvme-eui.002538b22140b542
2022-08-09 23:28:45,261 - cc_grub_dpkg.py[DEBUG]: selected /dev/disk/by-id/nvme-Samsung_SSD_980_PRO_with_Heatsink_2TB_S6WRNS0T220037X

More info on how debian is configured

# debconf-get-selections | grep dev/disk
grub-common grub-efi/install_devices multiselect /dev/disk/by-id/nvme-eui.002538b22140b542-part1
grub-efi-amd64 grub-efi/install_devices multiselect /dev/disk/by-id/nvme-eui.002538b22140b542-part1
grub-pc grub-efi/install_devices multiselect /dev/disk/by-id/nvme-eui.002538b22140b542-part1
grub-common grub-efi/install_devices_disks_changed multiselect /dev/disk/by-id/nvme-eui.002538b22140b542-part1, /dev/vda1
grub-efi-amd64 grub-efi/install_devices_disks_changed multiselect /dev/disk/by-id/nvme-eui.002538b22140b542-part1, /dev/vda1
grub-pc grub-pc/install_devices string /dev/disk/by-id/nvme-Samsung_SSD_980_PRO_with_Heatsink_2TB_S6WRNS0T220037X

Small Linux distributions

Quick notes for further research on small Linux distributions that are none-the-less useful. See also this list of resources.

Components

MUSL is an alternative to GNU libc that is very small. It is a mature product that is actively maintained and used.

Of historical interest: dietlibc and uClibc. I think both are no longer being developed. See also this comparison of library features.

busybox is a set of userspace command line tools built into a small binary. It’s a mature product, widely used.

toybox is a rewrite of busybox with a non-GPL license. It presents itself as a reinvention / improvement as well and looks usable and under development. It’s about 740kb binary (compare 1110kb busybox) but has less implemented in it.

OpenRC, s6, runit are alternative init systems to replace systemd.

Linux distros

Alpine Linux is a MUSL and Busybox distribution. Very mature product and an enormous package database, it’s quite productive. The VM ISO image is 60MB.

glaucus is MUSL + Toybox. Just had their first ISO release recently, it’s 528MB (or 210MB compressed).

OS/1337 is a new project for a MUSL + Toybox Linux distro witih very ambitious binary size goals. No release, not clear if the developer’s enthusiasm will be matched by working code, but it’s got some well articulated ideas.

See projects using MUSL for a list of other Linux distros based on the small libc.

Wikipedia has a roundup of other small Linux distros. Worth splitting the CLI vs GUI distros, also those targeted at small RAM vs not.

What I haven’t found is a good list of really small glibc based Linux distros. busybox for instance still works with glibc, see these Docker images. When I looked at this in December I noticed that the locales and SSL were two major sources of space usage; those can easily be optimized.

Further afield

Beyond Linux from Scratch is a learning exercise, building a working Linux system from sources. Maybe a bit of overlap with Arch in being interesting for a source for ideas of a highly customizable Linux distribution. A stated goal of toybox is to allow building BLFS.

Unikernels are the idea of replacing a generic Linux operating system with a kernel specialized to run a single service as a single user. There’s a bunch of them, OSv is one I’ve read about a few times. NanoVMs are another cut at them; there’s some Proxmox support.

Distroless is one approach to building containers (for Docker) without shipping a Linux distribution inside the container. Makes particular sense for GoLang / Node / Java systems where you basically never interact with the user space tools.

Pixel cases vs Android gestures

Current phone design drives me crazy. They make these beautiful devices that look great in product shots with fancy glass backs. That are so damn slippery you immediately have to put some ugly case on the phone so it doesn’t fly out of your hand. They never show the necessary case in the product marketing shots.

Worse, the trend to slab-of-glass means there’s nothing really for the case to grab on to on the front of the phone. Cases have to have a little rim that extends above the glass. Which then gets in the way when you try to make swipe gestures from the edge of the screen, your thumb hits the raised case edge and misses the edge of the glass. This was particularly bad in the brief trend towards curved glass on the sides so there was no bezel at all.

The swiping is a real usability issue. Android makes heavy use of swipe gestures: from left for back, from right (sometimes) for delete, from the bottom to switch apps. And every single time I tried to do them the case got in the way. The raised lip is a help for protecting the phone, particularly if you drop it on its front, but it makes the phone harder to use.

Anyway, I tried a bunch of cases. Here’s a few.

  • Peak Design: the winner! This case is super thin in front, a very low profile. It’s still raised a tiny bit but so little over the phone it doesn’t get in the way. Unfortunately none of their product marketing shots show the front of the case, probably because they want to downplay the relatively ugly plastic frame that holds it on. But here’s a still from a video I made that shows it.
  • Ringke Onyx: the runner up. It’s cheap and pretty ugly. But there’s cutouts on the sides that help with side swipe gestures, see this shot. Even so the bump on the sides is still annoying enough to interfere. And there’s an enormous raised lip on the bottom which makes swiping up really awkward.
  • Caseology Nano Pop: a disappointment. Raised rim all around, no effort made to accomodate a swipe.

I considered giving up on a case entirely and just putting some sticker on the back so I could still hold it. Something like Dragon Grips. But they are so ugly. I did try ordering a dbrand skin which was a terrible waste of money. The sticker I got is still slippery. And the edgelord marketing extends all the way to customer support, the installation video has a dumb joke where the instructions to align the sticker should have been. I got a condescending response from their support when I asked for help. Screw those guys.

Backing up Proxmox itself

Proxmox has great systems for backing up your guest OSes, VMs and containers. Including their configurations. But it has no affordance for backing up Proxmox itself. Mostly you don’t do much configuration on Proxmox but you do some, it’d be nice to be able to recover it. I finally found some docs on migration and restore hidden in the 7 -> 8 upgrade docs. A summary:

Backup: “all files in /etc”. Specifically named: files in /etc/pve, as well as /etc/passwd, /etc/network/interfaces, /etc/resolv.conf

Restore: /etc/pve/storage.cfg. Firewall configs /etc/pve/firewall and /etc/pve/nodes/<node>/host.fw 

It’s nice they tried but these instructions aren’t complete. At least in my reinstall I also had to pay special attention to jobs.cfg which configured the backup schedule. Also /etc/fstab.

And while I try not to put too much into Proxmox itself I at least need to install Tailscale for access. And an NFS server for one machine (although I may yet move that to a container). Those are outside the scope of the product so backing them up really is my problem.

Proxmox moving to a new server

I migrated my first Proxmox system to a new server. It went very well. Basically you just back up all the containers and VMs, restore them, and Bob’s your uncle. Took under an hour, more because I did a test run installing to an external USB disk first. Really I’m migrating to the same server, I just wanted to switch from btrfs to zfs.

Proxmox backups include not only the guest OS image but also Proxmox’ own configuration. The restore is smart enough to adjust the config to, say, handle that the virtual disk image now lives in ZFS. The only place anything failed is that my VM had a virtual CDROM mounted; the restore still referenced the image via BTRFS. Then again the CDROM didn’t even exist in the new zfs server, I no longer needed it. No big deal: the error message was clear and I could easily edit the config to remove it.

The other hassle was restoring Proxmox itself. There’s no way to back up a Proxmox server, just its guests! I think they’re idea is you’re using a cluster with several servers and so if one fails you just add a new host and have it learn what to do. Still seems like they should have a backup option.

For a small home user it’s good discipline to do as very little on the Proxmox server itself as you can. I made a checklist of things to set up on the new one, here’s a quick list:

  • update repositories and upgrade
  • configure /etc/fstab to mount my disks
  • configure backup disk as new storage type
  • set up guest backup schedule in the GUI (again)
  • add a system metrics server
  • apt install joe sudo avahi-daemon
  • install a user nelson for convenience but try not to use it
  • install tailscale and remember --accept-dns=false

I tried a couple of things to verify the new Proxmox was configured the same as the old without a lot of success. I was hoping that comparing /etc/pve would tell me more, that’s where Proxmox keeps its configs. But mostly it was stuff you’d expect to be different: crypto keys, details related to file system storage. Hard to find meaning in the noise. I was glad to find jobs.cfg though with a record of my backup configuration. (Note that /etc/pve is actually a pmxcfs FUSE filesystem for clusters; the actual truth lies elsewhere.)

Really pleased at how all this was. Virtualization is great! Next time will probably take half an hour at most and most of that time is waiting for disk images to copy around.

Starlink latency improvement

Interesting trend here; starting around the first of the year the latency of my Starlink connection has gone down, as measured by IRTT pings to a server I run at BlueVPS in LA very close to my Starlink’s terrestrial egress.

IRTT latency measurement

I think this effect is real. Comparing the week starting 2023-12-11 to the week starting 2024-01-08, the mean went from 47ms to 39ms. That’s 8ms or almost 20%! I think worst case performance is better too, I can’t quite quantify it but the 99% is a lot less spikey and the maximums are lower. (See graphs at bottom) Looking at data for a year this is a major new change; it was steady at about 47ms for a whole year.

Update: a tweet from the SpaceX CEO: “Significant improvements have been made to @Starlink latency (ping) & many more to come. Target is <20ms.” Guess that confirms what I observed.

I don’t see any corresponding change in packet loss. Averaged about 0.56% packet loss in both weeks.

I don’t have a good way to guess why this might have improved. There’s basically no measureable latency between the first hop I can see after Starlink and my monitoring host at LABlue; I’ve always assumed they’re in the same datacenter. My memory is it was never more than 2-3ms at most.

There’s a similar effect visible in Starlink’s own reported latency number (from the gRPC debug data). That should rule out any question of my IRTT monitoring, Starlink’s own numbers show the same pattern.

Starlink gRPC latency

A simple explanation is improvements to Starlink itself. Either they’ve lowered the latency of their infrastructure or they have more capacity and so my packets are getting buffered less. Possibly the improved 95% performance suggests less buffering but I wouldn’t bet heavily on that guess.

Interesting that it’s a downward trend over a week, not a drop in one day. That suggests it’s maybe a gradual change in capacity rather than a step function change in routing setup.

Here’s detailed graphs of before and after.

Before, 2023-12-11
After, 2024-01-08

And a graph of a whole year:

(For completeness, I should note I changed my IRTT monitoring setup around December 10 when I migrated the server from a physical machine to a virtual machine inside Proxmox. But this change clearly post-dates it. Also if anything the virtualization should cause more latency or packet loss although I’ve seen no evidence of that.

8bitdo SN30 Pro controller vs Steam

I have an 8BitDo Sn30 Pro game controller, a nice little portable Bluetooth / USB game controller that works in various modes. I had some initial flakiness but now it’s working well. The best discussion I’ve found is this Steam forum thread; if you read past all the rude people flaming each other there’s some useful info.

Working with a USB wired connection is easy. Working with Bluetooth seems to work reliably for me, at least right now. But I had to remove and re-add the device in Windows Bluetooth settings at least once, for awhile it was acting flaky.

The first insight is that the 8bitdo controller works in several modes that you can switch between depending on how you turn it on / use it.

  • Start+Y: Nintendo Switch mode.
    Windows sees this as “Pro Controller”, Steam sees this as “Nintendo Switch Pro Controller”. It seems to work pretty well for PC games although Steam may have to remap some inputs for you because few PC games support this directly.
  • Start+B: “Android mode”, which I think is the older DirectInput API.
    Windows says “8Bitdo SN30 Pro”, Steam says “Bluetooth Wireless Controller”.
    Steam made me set up the button mappings, pressing each button in turn. All of them worked except the last share button.
  • Start+X: “Windows mode”, which I think is the newer XInput API.
    Windows says “8Bitdo SN30 Pro”, but gives it a different listing in the Bluetooth devices from the Android mode entry. Steam says “XInput Controller”. Works well but no share button.
  • Start+A: “macOS mode”.
    Windows calls it a “Wireless Controller”, Steam calls it a “PS4 Controller”. The buttons all seem to work as expected.

The second insight is that these modes look like completely different Bluetooth controller entries in Windows. It’s like you own four separate devices depending on which way you turn the controller on. You have to configure each one individually in Windows. (Or pick the one you want and stick with it). I think one time it got confused and that’s why removing the Bluetooth device and re-adding it helped.

I think XInput mode is probably the best choice for most PC games.

There’s a small Star button in lower left on the 8bitdo. This works as a regular button in Nintendo Switch mode. But in XInput mode (and DInput?) this is a Turbo button, if you hold it down with a different button it toggles that input rapidly. In that mode the button itself doesn’t seem visible to the PC. Not a big loss but it means you won’t have a Share button.

One extra quirk: I bought the Switch edition of the SN30 Pro which has Nintendo’s bizarro button layout painted on the controller. So the button at the bottom of the cross on the right says “B”, not “A”. Steam has you identify buttons more by position than the labels so it’s not too big a deal to adapt.

PS: a big raspberry to Sony whose PS5 controllers are prone to stick drift. I used Steam to see the numeric outputs from the device. The stick gives reading from -32767 to 32767 with ideally 0 when at rest, or at least close to 0. My stick regularly jumps between -20000 and 0 with no input at all. I can’t even set a deadzone easily, Steam’s max is 18000. (And mapping 2/3 of the range to 0 is not a great experience anyway.) This flaw is common among PS5 owners. They aren’t cheap at $70.

Installing a Valheim server

Now that I have Proxmox I can easily spin up VMs or containers for things I would ordinarily be suspicious of running on my real server. I’ve been enjoying the game Valheim recently so I ran a server there following these instructions. In detail.

First, I took a detour through Game Server Managers that ended up being a dead end. These are special OS installs optimized for installing game servers, often Linux-based. I was hoping for something with a button to press that said “install Valheim”. I didn’t find anything Proxmox specific. I liked the look of AMP but it’s proprietary. I installed this TurnKey GameServer and tried to get it working but ran into a lot of problems. I finally decided using a manager was adding unnecessary complexity, particularly since I have Proxmox as a VM manager already.

So I installed Debian 12.4 in a VM on Proxmox. Then I followed these instructions for installing Valheim which more or less worked although read the comments on the gist for some updates since the instructions were written. It’s all pretty straightforward except for the use of steamcmd, a new-to-me tool. That’s a command line version of Steam for running servers and the management of authentication, etc is a little opaque. Since these instructions were written Steam has added an anonymous mode for game servers that might be easier.

It all basically just worked. Last thing I had to do was forward port 2456 on my router so I could connect from elsewhere.

Proxmox makes this kind of tinkering a pleasure. I like how I can snapshot a guest OS and try something with a chance of recovery. I also like the full isolation of a VM. I should set up some sort of subnet so that I can install things like this that can’t access my main home LAN. Only it still has to be able to talk to the Internet through the router. That’s tricky but I think Proxmox has some help for doing that.

I’m trying to use Debian instead of Ubuntu for this kind of project. It’s surprisingly different, like it doesn’t use netplan for network config by default. Here’s a list of packages I installed that I’ll probably want in any Debian system:

sudo joe chrony curl screen net-tools avahi-daemon

GRUB alternatives

I’ve never liked GRUB much. I don’t understand it and it makes me anxious. I never have good experiences using GRUB, I don’t want to use GRUB at all really. I want to use Linux. The only time I think about GRUB is when something goes wrong and my system is broken.

Anyway, there’s alternatives to GRUB in the modern UEFI world. EFI itself really was designed to be a boot loader, it’s weird we only use it to boot a second boot loader. Why not boot Linux directly?

One reason is drivers and filesystem support. EFI supports FAT12, FAT16, and FAT32. If you want to put your kernel on a more Linux-native filesystem you need something to load a driver for it in EFI first.

EFISTUB. The option with no extra boot loader. You build the Linux kernel with an option that makes it directly bootable from EFI. There is no boot firmware or OS at all; the EFI BIOS directly loads the Linux kernel. You put the kernel and initial ramdisk in the existing EFI partition, which is probably a FAT32 filesystem. Then you use efibootmgr from Linux to tell EFI about your kernel and the command line options to boot it. This seems remarkably straightforward.

systemd-boot. Yes, systemd also comes with a boot manager, a whole mini-OS. You install systemd-bootx64.efi in the EFI partition as an EFI boot manager. You put an ordinary Linux kernel and init ram disk in a XBOOTLDR boot partition and systemd-boot calls them. You can also have systemd-boot load drivers for devices and filesystems to get to your Linux kernel.

rEFInd (formerly rEFIt). Another boot manager. It has some built-in support for some filesystems and can load drivers. This one boots EFISTUB kernels, not normal kernel images.

So three different boot managers all roughly similar. Or boot the kernel directly via EFISTUB. I’m not sure in practice any of these buy me much over using GRUB. They all seem simpler than GRUB, that seems like a small advantage.

I think all of these are tricky with Secure Boot. One nice thing about GRUB is it has a binary signed by a key that commercial computers already recognizes, no work required. For the other options there’s some magic tool called sbctl that seems to be able to sign binaries so Secure Boot will boot them. There’s a step of “enroll keys”; you create your own your own signing key that you then install in the BIOS as a one time thing. Then with sbctl you can sign any binary. (Here’s some notes on a manual process instead).

With all of these alternatives you need to evaluate what your plan is to getting to a rescue mode or single user if you have to. Honestly for me my plan is usually “boot from USB”, not relying on whatever GRUB has access to. But I think all 3 boot loader OSes have some menu or command line editing. EFISTUB direct is trickier, but maybe the BIOS EFI shell can do.

Now that I have Proxmox set up it’d be easy to create VMs to experiment with this. I wonder if the OVMF UEFI BIOS they offer causes any issues. A quick search doesn’t show any clear guides on how to use alternate boot methods with OVMF but a bunch of suggestions it should work.

For that matter on a virtual machine it’s not clear using UEFI really offers any advantages over the old fashioned MBR-style BIOS. I kinda miss LILO. (IIRC, you could also boot Linux directly from an MBR BIOS with some tricks, but not sure about initial ramdisks.)

ssh attacks

I knew botnets testing ssh passwords was a thing but I didn’t realize it was this bad. Here’s one minute for my home server which I need to be able to ssh into.

Jan 11 01:14:00 tt sshd[294770]: Failed password for root from 98.97.59.56 port 27496 ssh2

Jan 11 01:14:09 tt sshd[294773]: Invalid user ftp from 212.70.149.150 port 62358
Jan 11 01:14:13 tt sshd[294773]: Failed password for invalid user ftp from 212.70.149.150 port 62358 ssh2
Jan 11 01:14:22 tt sshd[294789]: Failed password for root from 43.159.32.231 port 44228 ssh2
Jan 11 01:14:40 tt sshd[294795]: Failed password for root from 127.0.0.1 port 44192 ssh2
Jan 11 01:14:46 tt sshd[294816]: Failed password for root from 35.194.181.153 port 54910 ssh2
Jan 11 01:14:49 tt sshd[294818]: Failed password for root from 165.22.51.149 port 35608 ssh2
Jan 11 01:14:52 tt sshd[294838]: Failed password for root from 180.101.88.236 port 13566 ssh2
Jan 11 01:14:54 tt sshd[294838]: Failed password for root from 180.101.88.236 port 13566 ssh2
Jan 11 01:14:57 tt sshd[294838]: Failed password for root from 180.101.88.236 port 13566 ssh2

There are 97,354 of these attempts in five days, or a rate of once every 5 seconds.

The simple protection is to disable root login in sshd. I’d rather not deal with the requests. Some folks run ssh on an unusual port; that’ll at least cut down the traffic. fail2ban is also a popular solution but I’ve never liked how it works. Scanning logfiles? Really? And what if it blocks my legitimate logins somehow?

Here’s the top 20 users other than root being probed. Passwords really are a terrible form of authentication.

    796 admin

601 user
505 ubuntu
389 debian
238 test
147 oracle
92 ftpuser
88 postgres
72 deploy
67 git
66 mysql
59 hadoop
51 guest
47 student
47 es
47 centos
46 dev
44 test1
43 www
42 pi

Proxmox disk wear

Does Proxmox 8.1 wear out my disks? Maybe. A fairly idle Proxmox server is writing 40GB a day and I think most of that is wasteful. My SSD will last 10+ years at that rate but maybe I can make it better. So I looked more closely and in the end concluded most of the write activity is related to the guest operating systems I’m running, not Proxmox itself. Proxmox alone is writing about 50KB/second of data.

Wear is a concern with consumer SSDs; even a high end Samsung 980 Pro is rated for only 600 TB of writes for a 1TB drive. (Enterprise SSDs are 3x that or more.) It should be enough for an ordinary home server not doing a whole lot but a misbehaving system could make things bad. There’s several kinds of misbehavior with different solutions.

The Proxmox subreddit is full of posts like this or this with people noting high wear on their SSDs. The discussions are muddled. Someone says “it’s a problem!” and several people immediately respond “not a problem for me”. Inevitably someone says “buy an expensive enterprise SSD you fool”. Out of that noise I’ve found some pattern: Proxmox can write a lot of data.

Measuring disk writes

How do you measure the problem? The easy way is to use the Proxmox GUI to look at “Disks” for the host; the last column is “Wearout”. That’s current state of use and comes from SMART data. (Or should; my cheap N100 server doesn’t have the info.) Take a look, you may be surprised! I haven’t run Proxmox long enough to really know, my old Ubuntu server was running for a year+ without Proxmox and is only at 1%.

You can also get more insight by setting up system metrics on Proxmox. That has it export data to an Influx database when you can then visualize with Grafana.

More hands-on, you can measure write load with various Linux IO tools. Good old iostat is one way, ZFS has its own version of that:

$ zpool iostat

capacity operations bandwidth
pool alloc free read write read write
---------- ----- ----- ----- ----- ----- -----
rpool 72.4G 1.74T 28 21 1.91M 727K

That tells me the ZFS pool on my SSD has averaged 727KB a second since the last reboot. Watching zpool iostat 60 for minute-by-minute reports it’s averaging about 500KB a second on both Proxmox hosts I have. That’s about 40GB a day or 16TB a year. That still gives me decades before the device wears out. But it seems pretty wasteful, what’s doing all that writing?

Another tool is iotop or pidstat -d which show per-process IO stats. fatrace is also interesting, it gives you a log of file access.

Guest system write load

A simple explanation for the writes is the VMs or Containers running as guests on Proxmox may be writing to (virtual) disk, doing real work or writing logs. That’s got nothing much to do with Proxmox.

Proxmox has a nice tool for understanding disk I/O in guests; a graph right there in the GUI.

On my BTRFS machine the graph above tells me the Ubuntu VM guest is writing about 200KB/s. Another graph shows only one of the three containers has sustained writes, it says about 15KB/s. FWIW if I stop just the containers the iostat on the hypervisor goes from 500KB/s to 350KB/s, suggesting the three containers are writing 150KB/s between them. If I then also shut down the VM it saves another 300KB/s. The numbers don’t quite add up but I’m willing to believe that most of the disk writes are things the guest systems are doing. The Proxmox host itself is only writing 50–100KB/s, a small enough number I can ignore it.

On the ZFS machine where I measured 500KB/s writes, the VM itself says it was writing about 100KB/s. That still leaves 80% of the write load coming from the Proxmox hypervisor and maybe a mystery. Or maybe not, like I said the numbers don’t always add up.

Write amplification

A systems problem, write amplification is when writing (say) 1GB of application data results in a lot more than 1GB of write operations on the disk. Pathological systems can have 100x write amplification, a real problem. There’s various possible causes for this, I don’t really understand it.

On a simple test using iostat and dd I verified that writing 100MB of data from /dev/urandom in a VM resulted in about 100MB actually being written to the ZFS pool. Careful how you test; if something’s compressing the actual write might be less than the application data.

I think write amplification is a particular concern with ZFS depending on what RAID configuration you choose. Particularly if you run ZFS in a guest on a virtual disk backed by a physical ZFS pool. The VM itself can also be relevant, see zoned-storage for instance in QEMU. One drawback of virtualization is you’re so far removed from the hardware that things can get out of hand quickly.

Proxmox itself

On to the real question, does Proxmox itself write too much to disk? I’ve got a measurement that it’s only 50–100KB/s. Still, why that much? The Internet is full of advice on how to make Proxmox write less; this guide is particularly good.

The suggestion I was hoping would work is stopping services related to clusters if you only have a single node. The usual suggestion is to stop four: pve-ha-crm, pve-ha-lrm, pvesr.timer, and corosync. Of those only the two pve-ha services were even running. Stopping them didn’t really change the write load.

Another suggestion is to install log2ram and use that for /var/log instead of the real disk. Which could be a nice solution but you lose your logs in case of a hard system crash. Along those lines I’ve used tmpfs before for temporary directories. It helps as long as no one is expecting /tmp to be big.

Another recommendation is to change the vm.swappiness property; apparently Proxmox preemptively starts swapping things to disk when RAM is just 60% full. I don’t have any swap configured so that’s not going to change anything. Memory thrashing to swap could very quickly overwhelm an SSD.

File access details on Proxmox

I tried using iotop, pidstat -d, and fatrace to better understand what was going on. iotop is hard to read or possibly useless because ZFS or BTRFS themselves dominate the reports. pidstat -d is similar to iotop but different packaging. fatrace is a neat tool, and new to me. It shows which files are being written over the whole system. Sadly not how much are being written. Also it can’t show writes to a ZFS volume like my VM is stored on, since those aren’t files.

Shutting down all guests I’m left with proxmox itself. I’m still at 50KB/s or so, it’s hard to be sure exactly. fatrace tells me disk writes go to the following places:

  • pmxcfs: /var/lib/pve-cluster/config.db-wal. This is the PVE High Availability stuff I talked about turning off earlier. Even with those two services turned off there’s still some writes there.
  • pvescheduler: /var/lib/pve-manager/pve-replication-state.lck. Something related to a replication feature I’m not using. There are instructions on how to turn this off but they don’t seem to apply to modern versions.
  • pvestatd: /var/log/pve/tasks/.active.lock. Presumably an important part of PVE’s task scheduler.
  • pvestatd: /var/lib/rrdcached/journal/rrd.journal... Guessing this is the database for the nice graphs in the UI.
  • tailscaled: /var/lib/tailscale/tailscaled.log?.txt. Tailscale writes data briefly to its own log before pushing it to journalctl and removing it. This discussion has some notes about moving or disabling it. It seems to be about 30 writes a minute, 100 bytes at a time.

So that’s that. Most of my writes are coming from guests. Proxmox could be a little more efficienct, so could tailscaled, but what it’s doing now is not awful. And the amount of writes isn’t significant enough to worry about my disk lifespan.

Kiwix libraries for offline Wikipedia

It’s still hard to set up offline Wikipedia on Android with Kiwix. Fortunately the app is getting updates again after the year+ mess. The new app works well and you can download ZIM libraries in the app and they work fine. But getting the full 100GB Wikipedia is difficult to impossible from their downloader.

Here’s what I did to download the ZIM file to my PC, then copy it to the phone. These steps may require the phone be in developer mode; that’s safe in Android and is not the same as rooting the phone.

  1. Choose a ZIM file. I picked the 101.6GiB wikipedia_en_all_maxi_2023-11.zim
  2. Download the ZIM file on your PC.
    I used this torrent which came from their library. (Note browsing and linking this site is awkward). Another option is a direct HTTP download from their site.
  3. Launch the Play Store Kiwix app on your phone and use the app to download something small, like the top 100 articles. The goal here is just to get a storage folder created.
  4. Mount the phone via USB on your PC.
  5. On the PC, go to the directory
    Pixel 8\Internal shared storage\Android\data\org.kiwix.kiwixmobile\files\Kiwix
    You should see the small ZIM file that you installed in step 3 there.
  6. Copy the big ZIM file you downloaded into the directory
  7. Launch the Kiwix app and choose Library. You should see your new file.

Reddit is full of people saying they did this and it did not work. I’m not sure what’s going on. Maybe developer mode helps?

If the above steps don’t work, it’s recommended you uninstall the Google Play Store version of Kiwix and sideload a download from Kiwix itself. This has extra capabilities the Play Store won’t allow, including file access.

Another option is to install the Kiwix PWA, a fancy web page that works like an offline application. For some confusing reason PWAs on Android (which are not reviewed) can access your entire filesystem even if individual apps (which are reviews) can’t. That’s Google’s fault. Kiwix has been developing their PWA a lot recently. I haven’t really tried it.

The underlying problem here is Android keeps ratcheting up platform security and has slowly eroded the principle that apps can access files. I would hope nothing would stop this direct USB transfer but I don’t know anymore. I have other apps that can still access the filesystem, like SolidExplorer. Maybe Google gives them an exception that Kiwix can’t get?

Choosing a ZIM file

Kiwix has made it very hard to find the ZIM file for Wikipedia. The product usability is really bad.

It seems the ZIM libraries come in the following flavors:

  • Mini: summary sections only with pictures
  • Maxi: full articles with pictures
  • Nopic: full articles without pictures
  • ???: no videos (almost all of them seem to be this but there’s exceptions.)

If you search for “Wikipedia” in the mobile app, you get a bunch of special interest things like “Ray Charles Wikipedia”. If you weed through those you can finally find actual Wikipedia. But the labels are (currently) wrong. For instance the screenshot at right shows 4 different versions of the top 100 articles. But one is mislabelled: that 14.1MB one does not contain videos. I think it’s actually wikipedia_en_100_mini_2023-12.zim which is only the summary section of each article, but has pictures.

In theory you can use the Google Play store app to download the full 100GB Wikipedia all in your phone. Nice! Assuming you can make that download work reliably on a phone, that is. But in practice I literally can’t find that ZIM file in the downloader, it’s like it’s hidden. The closest I could find was the 56GB all nopic.

BTW these files are huge for a phone! If you want something smaller try wikipedia_en_top_maxi_2023-10.zim. That’s 50,000 articles at 6GB. I do think it’s worth getting the full maxi with pictures; very useful in offline situations.

Kiwix also has a new Library webapp which lets you view the ZIM files in your browser. It seems like a nice idea! But again, the usability is terrible. What’s the difference between these 4 libraries in the screenshot below? Other than the size.

I feel bad picking on an open source project like Kiwix. But the product has had these usability problems for years now. They get funding from Wikipedia, maybe it’s not enough.

QEMU virtual disks: clearing unused blocks

How do I get Proxmox VM backups to back up actual data and not disk blocks that were written once but no longer used?

Update: the answer for me was to enable the “Discard” option in the hardware options for the VM disk. That’s documented here in the Proxmox manual and for some unknown reason the default is off. After enabling this, trim in the guest OS propagates up to the storage; running fstrim -va in the guest resulted in the ZFS volume in the hypervisor dropping from 167G used to 64G used. This works with VirtIO block devices although next time I set up a VM I’ll still prefer using VirtIO SCSI. (On the other machine which I created with a Clonezilla clone it dropped from 69G to 24G. I wonder if Clonezilla cloned all the blocks even when they weren’t being used.)

Update 2: I also had to add the discard option in fstab for my ext4 filesystem. It’s not the default. I think it may be the default for btrfs and other file systems, not positive.

I ran into a funny problem today. The Proxmox backups of my main Linux VM were taking a tidy 56GB, about as much data (compressed) as there actually is on the 2TB virtual disk. Then I accidentally created a 100GB file (all of Wikipedia in ZIM format). I removed it, df shows its gone. But now a VM backup is taking 156GB. Presumably it’s backing up all the unreferenced blocks that were deleted but still have data on them. I suspect the QEMU clones I started with weren’t copying unused blocks.

You can see how much space ZFS has reserved for a virtual disk like this

root@sfpve:/home/nelson# zfs get used rpool/data/vm-100-disk-1
NAME PROPERTY VALUE SOURCE
rpool/data/vm-100-disk-1 used 167G -

I want that 167GB to be more like 67GB.

I tried using trimfs in the VM guest but it didn’t do much. It’s not clear the trim command ever makes it to the hypervisor host OS. Anyway, fwiw: /: 35 GiB (37617963008 bytes) trimmed. Right after a reboot I ran it again and got /: 139.2 GiB (149456355328 bytes) trimmed, but the second time it was back to 35 GiB. I have no idea what any of this means.

The Proxmox docs have details on how to make trim work in VMs get through to the host OS. They require the virtual disc be of type virtio-scsi and unfortunately I created the VM with a virtio-block. Apparently the SCSI storage type is the more modern and capable one. Also note this wiki page is 4 years old and I can’t quite tell if it’s really relevant now.

virt-sparsify is a QEMU tool for removing unused blocks from an unmounted virtual disk image, see here for more details. This looks perfect for what I need. But it’s not installed by default and installing it includes bringing in all of X11 in Debian, so I’m reticent. Also it requires operating on a file and Proxmox stores VM disks in block storage as a ZFS volume.

That same old Proxmox wiki page also has another solution; just use qemu-img convert to copy the virtual disk and you’re done. The qemu tools seem to be filesystem aware and smart about avoiding unreferenced blocks, I suspect I benefitted from that when I first created the VM disk by cloning my physical disk. But again this requires operating on files and Proxmox has them the disk image as a volume.

This discussion has some notes on using qm disk instead of qemu-img to operate on disk images; it’s able to work with volumes as well as files and presumably is just calling qemu-img to do the real work. I think it’d be as simple as using import to create a new disk that’s a clone of the existing one.

My fear with any of these methods is that they might change the block IDs or device names on my Linux guest and then it won’t boot. Updating /etc/fstab is easy enough but updating Grub is harder. (See my notes here, section “Fix the block IDs”).

The current state is not awful; backups are taking 3x as long and 3x the space as they should, but they all still work. But the problem will only keep getting worse. I think I’ll let it go for now but if I come back to this, ideas to try:

  • Switch to virtio-scsi for the VM and enable the trim command. See if that fixes it.
  • Make a qm disk import clone of the VM disk image and see if the new one is smaller. I can test that entirely with zfs get.
  • Clone the VM disk image to a file and use qemu-img or virt-sparsify to fix it.

Proxmox and data management

Still loving Proxmox but I’ve run into one product limitation: it doesn’t really have a good way of sharing filesystems across guest operating systems. If you want a disk managed by Proxmox to be available in a VM, or to share files between VMs, you pretty m uch have to use a network filesystem like NFS or CIFS (Samba). And Proxmox doesn’t run those itself servers. It seems like a gap in the product.

Proxmox has a fantastic system for managing storage for itself. You have your choice of filesystems but it really wants you to use ZFS. And it uses ZFS great. You can hand Proxmox a bunch of disks and it’ll set up ZFS, create ZFS datasets for container filesystems and volumes for VM disks, etc. It’s very nice.

But if you want to make, say, your home directory as a filesystem and share it to several VMs you’re on your own. There’s a bunch of ways to do this. What I’m doing now is I just make it a normal filesystem (or ZFS dataset) in Proxmox. Then I export them with an NFS server on the Proxmox hypervisor server and NFS mount the filesystem in VM guests. With all the overhead and (virtual) network awfulness NFS implies. Container guests have it easier than VMs, they can access the filesystem more or less directly with a bind mount.

The bummer here is I have to install and manage the NFS server manually on Proxmox. It’s easy enough to set up an NFS server as a Debian package but now I’m outside the Proxmox product, it has zero support for it. Same goes if I chose to use Samba for CIFS instead. For that matter Proxmox GUI doesn’t know about bindmounts for containers either although it’s easy enough from the Proxmox CLI, they even document it.

There’s fancier possible setups. One interesting possibility is to install TrueNAS in a guest VM in Proxmox. And use that as the NFS server with its management GUI. But then how does TrueNAS access the disks? The simple way would be to make a big virtual disk for the TrueNAS VM (backed by ZFS on the Proxmox hypervisor) and use it. But.. yuck! You lose most of the advantage of TrueNAS managing physical disks. The other choice would be to not use the physical disks at all in Proxmox and just pass the hardware through to the VM and let TrueNAS manage them. I may yet end up setting that up.

Another option coming is virtiofs. That’s a way for a hypervisor to share filesystems to a VM without a network filesystem. I think it’s pretty fully baked in Linux now but not quite ready in Proxmox.

A third option fully supported by Proxmox is Ceph, a distributed storage system. I haven’t looked at it, Ceph seems far too big and complicated for my needs.

The NFS server on the Proxmox hypervisor is working OK with me. Mostly I hate how abstracted it becomes, how far removed a disk write on a Linux VM is from what the actual hardware is doing. Performance went to shit yesterday on my system when I moved a 100GB file from a virtual disk in a VM via NFS to a physical disk. The VM’s IO response went to multi-second latency. Load average on the proxmox server went to 9 as a bunch of nfsds sat there hanging in device wait. To be fair, the disk copy happened at max speed so it did complete reasonably but it sure reminded me of the cost of all these abstractions and virtualization.

tailscale, Magic DNS, proxmox, and LXC

Frustrating interaction. tailscale MagicDNS breaks LXC under Proxmox. The solution is to start tailscale with --accept-dns=false on the Proxmox server. This is well documented by Tailscale but I missed it. In detail...

I have tailscale installed on the Proxmox hypervisor host, with MagicDNS enabled. If I start an LXC container then DNS doesn’t work at all in the container’s guest operating system.

The underlying issue is how tailscale does MagicDNS, how it answers DNS queries to supply its own answers for your hosts at *.*.ts.net. On Linux it does this by rewriting /etc/resolv.conf setting nameserver 100.100.100.100. The details of how it does this are complex because so many other things on a modern Linux box are also trying to overwrite that file. (Yes, systemd is involved). But it seems to work fine on the Proxmox server.

What doesn’t work is MagicDNS inside an LXC container. When you launch LXC it seems to start with a copy of whatever /etc/resolv.conf is in the Proxmox host. (Every time; if you reboot the container it gets a new copy.) So if tailscale is running it can pick up that 100.100.100.100 nameserver. Unfortunately the LXC guest operating system does not have access to that IP address (nor to any of your tailnet, it shouldn’t!) So DNS doesn’t work.

The simple fix is to turn off tailscale on the proxmox server: tailscale down. But it’s nice to have tailscale to access the server! If you run tailscale up --accept-dns=false then there’s no MagicDNS on the Proxmox server and /etc/resolv.conf is left alone. This setting seems to be sticky, it’s persisting even though I didn’t edit any config files.

Another option the docs mention is writing a /etc/.pve-ignore.resolv.conf file in the LXC container’s filesystem. That’s part of a general mechanism to have Proxmox not overwrite files in LXC guests.

Restic for backups

I finally have a better backup solution: Restic. This project has emerged as the open source favorite for backups. It’s easy to see why: it’s very capable and a very professional product. Don’t be put off by the scary 0. version number: there’ve been releases for seven years now. And it seems really solid.

For many years now I’ve relied on rsnapshot for backups. It’s nothing fancy but is straightforward. But it basically requires you have root access on both the source machine and the backup server. (rsnapshot stores actual copies of your files, complete with timestamps and owners). And it’s slow and creaky and, well, time for something new.

Restic is very fancy. The underlying repository datastore slices your files up into 1MB blobs and storing them in a sort of content-addressable store. Everything is encrypted and indexed by the SHA256 hash of the data. That makes verification, deduplication, etc straightforward and fast. The downside is the backup format is entirely opaque; you need the restic binary to work to restore files. (It is documented, but far too complicated to easily reimplement.) The upside is it is very efficient.

The product packaging is fantastic for open source. It ships as a single self contained Go binary. The docs are terrific including a quickstart that gives a vey good experience. It supports a wide variety of backup server types from local disk to sftp to cloud providers (or rclone if you want to do your own thing). There’s good tools for inspecting backups, verifying them, restoring them (including a FUSE mount). Also a first class tool for removing old snapshots. The tool gives a lot of confidence.

restic runs really well and fast. I can back up 50GB of my data to 38GB in the repo in about 6 minutes, about the speed the disk runs at (and this over NFS). An empty incremental takes just 10 seconds.

The one thing missing is some usability for system integration; you’re left writing your own shell scripts and cron jobs to use it. Fortunately there’s a CLI frontend called resticprofile which helps with that stuff, driven by a simple config file. It’s not quite as clean a product as restic itself but it has good docs and seems to work well. And what it does is not mysterious, it’s just invoking restic, so I’m not as concerned about the niceties.

Edit: another option for managing restic is backrest, a web GUI. Update Aug 2024: finally gave this a try, it is very nice.

It’s a real pleasure to use a nicely built open source tool like restic.

Update 2: offsite backups

I’m using Backblaze now for offsite backups. It seems to work OK and is fast and cheap ($6/TB/mo with no minimum. plus extra for bandwidth if you use much.) Was fairly straightforward to get working with Restic. Configuring the bucket is a bit tricky; I turned off encryption (restic is encrypted already) and file retention.

I tried SFTP briefly to a small server I have. It was very slow, like 6 minutes for 2GB (or less). To be fair my server is slow.

Update: system backup config

Here’s the fairly simple resticprofile config I’m using to back up my main Linux system. It backs up to local disk once an hour and keeps old dailies, weeklies, monthlies, and yearlies on a reasonable schedule. The only subtle thing here is I’m backing up in two separate jobs, once for my home filesystem and once for the system root.

version = "1"

[global]
  ionice = true
  nice = 5
  scheduler = "crond"
  restic-binary = "/usr/local/bin/restic"

[default]
  repository = "local:/mnt/backup/restic"
  password-file = "/usr/local/etc/restic/password"

# Everything but my home directory

[root]
  inherit = "default"
[root.backup]
  source = [ "/" ]
  exclude = [ "/home/nelson", "swap.img" ]
  one-file-system = true
  schedule = "*-*-* *:37:15"
  schedule-permission = "system"
  schedule-log = "/var/log/restic.log"
[root.retention]
  keep-hourly = 24
  keep-daily = 7
  keep-weekly = 4
  keep-monthly = 60
  after-backup = true

# My home directory

[home]
  inherit = "default"
[home.backup]
  source = [ "/home/nelson" ]
  one-file-system = true
  schedule = "*-*-* *:07:15"
  schedule-permission = "system"
  schedule-log = "/var/log/restic.log"
[home.retention]
  keep-hourly = 24
  keep-daily = 7
  keep-weekly = 4
  keep-monthly = 60
  after-backup = true

Making a private subnet for Proxmox guests

I want a second private subnet just inside my Proxmox host, for the guests. Main immediate reason is I want to export an NFS filesystem with root access from proxmox to guests but I’m too lazy to set up Kerberos. I trust my LAN but not quite that much; I don’t want any dumb device in my house to be able to be root here. So I set up a second bridged subnet just for Proxmox guests.

By default Proxmox sets up a bridge vmbr0 connected to the LAN of the Proxmox server itself. Guest VMs can just use that interface (often named ens18 in the guest) like it was an ordinary ethernet, do DHCP to get an address, route packets to the Internet via it. it’s very convenient. Mine is configured on 192.168.0.0/24.

But it’s pretty easy to set up a second bridge. The manual is quite thorough but not quite a cookbook. I used the GUI to do it.

First, on the Proxmox server, I used the Network config to add a new bridge named vmbr1. (I set an advanced option that’s not visible, mtu 9000.)

Then, in the hardware definition of the VM, I added the bridge there.

Finally in the Ubuntu VM’s Netplan configuration, I set up a static config. vmbr1 seems to be called ens19 in the VM:

network:

version: 2
ethernets:
ens19:
addresses:
- 192.168.240.2/24

Proxmox will live reload the server config if you press the button. I forgot how to reconfigure netplan in Ubuntu so I just rebooted. And it all worked: now the two hosts can talk to each other on 192.168.240.0/24 addresses without involving the ethernet LAN at all. Now I can configure the NFS server and client to use those addresses instead and have some extra isolation.

I’m not certain what would happen if a malicious actor gained access to my physical ethernet and then started trying to talk to the supposedly private 192.168.240.0/24 subnet. I think they wouldn’t get very far, since none of my hosts have the bridge connected to the ethernet? But I haven’t tested it. I’m not worried about that aggressive of an attack, mostly just trying to prevent accidents.

As a bonus I configured the MTU on the bridge to be 9000. This is an often-recommended setting for NFS performance, I think because NFS itself will use up to 8KB data packets for things.

Update

This has been working well for me. I did some simple testing of performance in August 2024. First, the network interface itself:

  • 0.15ms ping latency
  • 50Gbits/s iperf3 throughput

So the virtual network is plenty fast. I don’t know how to test actual I/O throughput properly for an NFS server. I did a simple fio command an AI suggested and came up with a number of about 1.12GiBytes/s which is 10x faster than the spinning disk that’s being served. The NFS daemon on the server got to about 15% CPU while doing it.

My conclusion is “fast enough for anything I’ll do”. It’s more than double the speed of a good SSD plugged in locally, so I don’t think the networking inside Proxmox is a huge problem. At least for max throughput, not sure about lots of little file operations.

# fio --name=test_network_throughput --ioengine=libaio --rw=read --bs=64k --numjobs=1 --size=100m --runtime=60 --time_based --end_fsync=1 --direct=1 --filename=./testfile.fio

test_network_throughput: (g=0): rw=read, bs=(R) 64.0KiB-64.0KiB, (W) 64.0KiB-64.0KiB, (T) 64.0KiB-64.0KiB, ioengine=libaio, iodepth=1
fio-3.33
Starting 1 process
test_network_throughput: Laying out IO file (1 file / 100MiB)
Jobs: 1 (f=1): [R(1)][100.0%][r=1161MiB/s][r=18.6k IOPS][eta 00m:00s]
test_network_throughput: (groupid=0, jobs=1): err= 0: pid=975385: Fri Aug  9 16:37:31 2024
  read: IOPS=18.4k, BW=1149MiB/s (1204MB/s)(67.3GiB/60001msec)
    slat (usec): min=2, max=803, avg= 3.97, stdev= 1.38
    clat (usec): min=16, max=4110, avg=50.14, stdev=13.62
     lat (usec): min=35, max=4114, avg=54.12, stdev=13.82
    clat percentiles (usec):
     |  1.00th=[   40],  5.00th=[   43], 10.00th=[   45], 20.00th=[   46],
     | 30.00th=[   47], 40.00th=[   48], 50.00th=[   49], 60.00th=[   51],
     | 70.00th=[   52], 80.00th=[   53], 90.00th=[   56], 95.00th=[   61],
     | 99.00th=[   81], 99.50th=[   92], 99.90th=[  143], 99.95th=[  165],
     | 99.99th=[  375]
   bw (  MiB/s): min= 1016, max= 1373, per=100.00%, avg=1148.65, stdev=42.11, samples=119
   iops        : min=16266, max=21978, avg=18378.44, stdev=673.71, samples=119
  lat (usec)   : 20=0.01%, 50=56.83%, 100=42.80%, 250=0.35%, 500=0.01%
  lat (usec)   : 750=0.01%, 1000=0.01%
  lat (msec)   : 2=0.01%, 4=0.01%, 10=0.01%
  cpu          : usr=1.55%, sys=9.94%, ctx=1102796, majf=0, minf=27
  IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued rwts: total=1102756,0,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=1

Run status group 0 (all jobs):
   READ: bw=1149MiB/s (1204MB/s), 1149MiB/s-1149MiB/s (1204MB/s-1204MB/s), io=67.3GiB (72.3GB), run=60001-60001msec

Making peace with journalctl

Journalctl is systemd’s much-maligned replacement for syslogs. Crusty old nerds like me are mad it’s not just a text file. But the binary format actually has a lot of advantages, you can efficiently do simple time and metadata queries. I also like the color pager it gives you. Now that I’ve learned a bit about the journalctl tool I like it more.

journalctl -b
Entries since last boot. Solves the big problem of journalctl spamming you with useless crap from months ago. journalctl -b -1 will show you the boot before this one.

journalctl -n 100
Last 100 entries

journalctl --since '3h ago' --until '2h ago'
Time slicing. The since and until format is defined in systemd.time(7).

journalctl -u chrony or journalctl -t chronyd
Entries matching a unit name or syslog identifier

journalctl -g chrony
Entries whose contents match a grep expression. Note this does not match the displayed text of the metadata, it’s not the same as grepping a syslog.

journalctl -p 4
Level warning or more serious. The levels are the same as old syslog.

journalctl -r
Reverse order.

journalctl -e
Jump the pager to the end (like pressing G).

journalctl -n 100 -f
Display the last 100 entries and keep scrolling new entries forever

journalctl --vacuum-time=7d
Erase all logs more than a week old. Useful for making disks smaller.

journalctl --dmesg
Emulate dmesg, only showing kernel messages (but in a different format).

usermod -aG systemd-journal nelson
Anyone in group systemd-journal can run journalctl without being root, at least on Debian. Note this includes the ability to modify the journal.

The big thing missing is negative filters. I want to show all log entries that are not from the spammy sshd and cron units. Can’t really do it.

You can still do journalctl | grep of course. There’s also a JSON output format you can manipulate with jq or the like.