Notes for January 22-28

This was kind of an OK week, all things considered. Got a lot of fun things done in bits and pieces, plus some writing and tinkering.

Monday, 2024-01-22

Still moderately sick, but puttered about after work a bit:

  • Began moving my ML sandbox to Silverblue. rpm-ostree can be a bit slow, but at least there is NVIDIA-specific documentation and btrfs saves me a little bit of disk space for model storage.
  • Learned (the hard way) that to make it easier for to read large images from slow SMB storage, it can be useful to increase the timeout value from 10 to 40 in the check_connection section in CIFSPlugin.pm (inside /usr/share/perl5/PVE/Storage).
  • Wrote a little prototype script to control VMs using MQTT by spoofing the HomeAssistant discovery protocol as “spoken” by Tasmota devices:
import paho.mqtt.client as mqtt
from time import sleep
from datetime import datetime
from json import dumps
from logging import basicConfig, INFO, debug, info, warning, error, critical, getLogger

basicConfig(level=INFO, format='%(asctime)s %(levelname)s %(message)s')
log = getLogger(__name__)

vm_sets = {
    1: [103, 107]
}

vm_status = {}

all_vms = list(set([item for sublist in vm_sets.values() for item in sublist]))

def on_connect(client: mqtt.Client, userdata: any, flags: any, rc: int) -> None:
    log.info("Connected with result code "+str(rc))

def on_message(client, userdata, msg) -> None:
    log.info(msg.topic+" "+str(msg.payload))

def on_publish(client, userdata, mid) -> None:
    log.info("Message "+str(mid)+" published.")

def setup_client(host: str="home.lan", port: int=1883, keepalive: int=60) -> mqtt.Client:
    c = mqtt.Client()
    c.on_connect = on_connect
    c.on_message = on_message
    c.on_publish = on_publish
    c.connect(host, port, keepalive=keepalive)
    return c 

def update_vm_status() -> None:
    now = datetime.now().isoformat()
    for vm in all_vms:
        vm_status[vm] = {"Time":f"{now}","POWER":"ON"}

def report_vm_status(c: mqtt.Client) -> None: 
    for vm_set in vm_sets.keys():
        for vm in vm_sets[vm_set]:
            log.info(f"Reporting status of VM {vm} in set {vm_set}")
            c.publish(f"proxmox_{vm}/tele/HASS_STATE", dumps({"Version":"0.1","Module":"Proxmox VE"}))
            c.publish(f"proxmox_{vm}/tele/STATE", dumps(vm_status[vm]))

def setup_entities(c: mqtt.Client) -> None:
    for vm in all_vms:
        c.publish(f"homeassistant/switch/proxmox_{vm}/config", dumps({
            "name": f"Proxmox VM {vm}",
            "stat_t": f"proxmox_{vm}/tele/STATE",
            "avty_t": f"proxmox_{vm}/tele/LWT",
            "pl_avail": "Online",
            "pl_not_avail": "Offline",
            "cmd_t": f"proxmox_{vm}/cmnd/POWER",
            "val_tpl": "{{value_json.POWER}}",
            "pl_off": "OFF",
            "pl_on": "ON",
            "uniq_id": f"proxmox_{vm}",
            "dev": {
                "ids": [f"proxmox_{vm}"]
            }
        }))
        c.subscribe(f"proxmox_{vm}/#")

def main():
    client = setup_client()
    client.loop_start()
    setup_entities(client)

    try:
        while True:
            update_vm_status()
            report_vm_status(client)
            sleep(10)
    except KeyboardInterrupt:
        client.loop_stop()
        client.disconnect()

if __name__ == "__main__":
    main()

The idea here is that I want to be able to control VMs from my phone (Homebridge can see these devices via an MQTT plugin), and that turning on some VMs should automatically shut down others (e.g., I don’t want to run two VMs that require my GPU all the time). I was a bit surprised that doesn’t have a cluster-wide way of doing this (you need to iterate through all the nodes to find the VMs you want), but I can live with that limitation for now.

Tuesday, 2024-01-23

Began another round of calendar battleships and pass-the-spec at work. Didn’t have much time for anything else, but:

  • Put together my .
  • Printed a few parts I needed for a build and noticed that I am still getting Y axis shifts on my KP3S Pro, so to cool the Y stepper didn’t fix things. Added to my backlog for when I next disassemble the printer.
  • Upgraded my to Sonoma 14.3. This will turn out to be relevant two days later.

Wednesday, 2024-01-24

Yak shaving day on and off work.

  • Spent a while looking at a binary with Ghidra. Learned a ton.
  • Found out (again the hard way) that apparmor and LXC behavior with flatpaks is different in LXD and in .

LXD pre-configures a lot of the constraints in a smarter way, and right now I can’t really use flatpaks inside some LXC containers that worked in LXD for years, which is something to investigate further. Running more VMs just for the sake of being able to use flatpak feels like cheating at this point.

Thursday, 2024-01-25

Stupefyingly busy day. I’m not sure how I managed to get anything done at all.

  • Received a new RK3588S SBC to test (a youyeetoo R1), a replacement battery for my office UPS and a pair of T8 Z-axis screws for my Prusa.
  • Started printing replacement parts to swap out the entire Z-axis assembly (thank goodness for open source designs).
  • Discovered there is a pipewire-module-xrdp package in the works, which I should be using instead of pulseaudio going forward.
  • Managed to hard crash using inside a VM, which is a first for me.
  • Noticed a weird issue with my where the backlight would start flickering at the edges whenever there was patterning or specific shades of grey on my screen (it became absurdly noticeable during my 9PM meeting with the US)

Since the monitor is barely two and half years old, this annoyed me to no end. Completely removing power or switching color profiles (I like DCI-P3) would seemingly fix it, but the flickering came back after a while.

Friday, 2024-01-26

Quieter day, managed to steal away some time in the morning to fiddle with my monitor’s settings a bit more:

  • Disabling Eco mode didn’t really fix it (neither did changing resolutions), but, weirdly enough, “downgrading” the connection to DisplayPort 1.2 did, so I very strongly suspect this is related to the macOS Sonoma 14.3 update and the way it handles DisplayPort 1.4 (it wouldn’t be the first time Apple has broken something display-related in upgrades).
  • Looked at Google Play Pass out of () curiosity as to the state of affairs in the Android ecosystem.
  • Come early evening, started disassembling my Prusa to replace the Z-axis assembly. Fitting everything back together required a little tweaking and settling in the parts with a heat gun, but I managed to get it done and tweak the Z-axis rotation in before calling it a night:
My KPS3 Pro prints absolutely beautiful parts.

Re-leveling the bed and gantry, though, was a right pain.

Saturday, 2024-01-27

Yay, weekend. Did a bunch of useful stuff:

  • Cleaned up the office a bit, before proceeding to completely nullify any benefits of that strangely futile exercise.
  • Replaced my office UPS battery. I had forgotten how incredibly annoying its coil whine is while charging, so that’s probably why I failed to check the battery for so long.
  • Fiddled with the youyeetoo R1 a bit, got it to boot into the EMMC into a Chinese language version of Debian, and then proceeded to break the install. I’ll have to re-flash it with a proper image later.
  • Began designing a case for it while I wait for a few additional parts to arrive (yes, it’s going to have a completely over the top SSD as well).
  • Upgraded on the Prusa and re-calibrated resonance compensation:
great vibes
The two new Z-axis screws are a massive addition to the overall frame, so these look quite unlike the original charts.

Sunday, 2024-01-28

Office hermit day, spent tinkering with CAD and electronics.

  • Rewired my electronics desk to make room for a semi-permanent LCD display and a few other things.
  • Spent an hour wrestling with and its absurdly counter-intuitive UI, because I need to design an LCD panel case and thought it would be a “simple” thing to do. Tried as well on a whim, but it is even worse.
  • Had a quick go at modeling the back connectors of the youyeetoo R1 board in :
not much to look at yet
The board has a lot more connectors, but these are the ones I need for the moment for the case design.
  • Caved in and bought BetterSnapTool because even though it is buggy (editing previously created zones doesn’t stick for me), it is still the closest thing to FancyZones on macOS.

So far, I’ve had no more flickering issues with the LG, so yes, I am still suspicious of the macOS update.

This page is referenced in: