pmeerw's blog

Tue, 30 Sep 2025

Lenovo X13 firmware update on Linux

It's easy, just run sudo fwupdmgr get-updates followed by sudo fwupdmgr update. The system needs to be on AC power to perform the update.

posted at: 22:07 | path: /configuration | permanent link

Fri, 26 Sep 2025

Easy DKIM/DMARC setup for multiple domains

It's possible to just list multiple domains in opendkim.conf which will all get signed with the same key indicated by KeyFile and Selector (as pointed out here).

# Sign for example.com with key in /etc/dkimkeys/dkim.key using
# selector 'mail' (e.g. mail._domainkey.example.com)
# hacky, multiple domains, all share the same key and the same DNS setup
# so we also need mail._domainkey.bla.net and mail._domainkey.blub.org DNS records
Domain                  example.com, bla.net, blub.org
KeyFile                 /etc/dkimkeys/example.com.key
Selector                mail

A more complex way with individual mappins is described here.

A good way to test the setup is appmaildev.com's DKIM Test.

posted at: 10:10 | path: /configuration | permanent link

Sun, 21 Sep 2025

Debian PostSRSd update woes

Debian unstable recently updates the PostSRSd to 2.0.11-1+b1, breaking stuff:

  1. new postfix configuration required (and pointed out in the NEWS)
      sender_canonical_maps = socketmap:unix:srs:forward
      sender_canonical_classes = envelope_sender
      recipient_canonical_maps = socketmap:unix:srs:reverse
      recipient_canonical_classes = envelope_recipient, header_recipient
    
  2. apparmor changes required (or should apparmor be dropped?)
      /etc/postsrsd.conf r,
      /var/spool/postfix/** rwk,
    

posted at: 11:00 | path: /configuration | permanent link

Thu, 21 Aug 2025

Controlling IKEA smart home stuff with Python

IKEA has some smart home products: Zigbee light bulbs, a temperature sensor, several remote controller, and -- most importantly -- the Dirigera hub which allows to control the devices via an app or REST API. The hub supports the matter standard and lacks technical documentation (it has USB-C for power supply, an Ethernet plug and expects to local network with WiFi). A Python package, dirigera, is available.

First step is to generate a token (JWT) to enable access to the API, which requires pressing the "Action" button on the hub.

posted at: 18:05 | path: /projects | permanent link

Tue, 27 May 2025

Memory allocation performance under Wine, mimalloc to the rescue!

We have a significant workload (> 50k CPU hours per year) on AWS EC2 instances running a Windows program. Since Linux instances are cheaper and easier to maintain (think Docker), we tried to get that Windows application running using Wine. A native Linux port is unfortunately not feasible, since the application depends on some closed-source libraries.

Initial benchmarks were not encouraging:
PlatformRuntime
Windows 11479 s
Linux 6.122636 s
Linux/Wine being 5 times slower.

Wine offers nice logging/tracing abilities by setting the environment variable WINEDEBUG=+relay,+heap. This revealed far too many calls to heap allocation functions. Since the application is statically linked against the C runtime, Wine's heap allocation function may be less optimized than the original Windows function or require more overhead. Also perf top points to Wine's heap_allocation_block function.

mimalloc is a general purpose memory allocator with excellent performance. For statically-linked programs, it is possible to override the global C++ new and delete operators by just #including mimalloc-new-delete.h in one source file.

Benchmarks for the same program/workload as above, statically linked with mimalloc:
PlatformAllocatorRuntimePeak Memory
Windows 11default479 s12.6 GB
Windows 11mimalloc v3.0.3438 s12.2 GB
Windows 11mimalloc v2.2.3440 s12.9 GB
Linux 6.12default2636 s14.3 GB
Linux 6.12mimalloc v3.0.3crashN/A
Linux 6.12mimalloc v2.2.3435 s12.4 GB
Mimalloc v3.0.3 seems to be a tad faster than v2.2.3 and on Windows it reduces runtime by about 10 % and peak memory allocation by about 2 GB. On Linux/Wine, the improvement is dramatic, the runtime is en par (or slightly faster) than on Windows. Note: CPUs were AMD Ryzen 9 5900X and AMD Ryzen 5 5600G on Windows and Linux, resp.

The crash on Linux with mimalloc v3.0.3 is probably related to issue #1087 and due to the new page-map feature having trouble with low addresses of memory allocations (which Wine provides) -- looking forward to a fix!

posted at: 12:46 | path: /programming | permanent link

Made with PyBlosxom