RSSAmplifier

Blog

Ian's Notes

Recent content on Ian's Notes

ivdl.co.zaRSS feed ↗96 posts

Latest posts

Setting up Wake-on-LAN on Ubuntu 26.04

This post assumes that: The target host is running Ubuntu 26.04 The source host is running MacOS with Homebrew installed Preparing the target host Find the interface (usually ethernet) you want to wake on. This is usually something like eth0 or enp8s0 . Also find the IP and MAC address. Create a SystemD unit to enable Wake-on-LAN (WoL) on boot: sudo vim /etc/systemd/system/wol.service Make sure to…

About

I am a Senior PostgreSQL Engineer at Adyen. Prior to this, I was employed as a Senior Mission Critical engineer and Tech Lead at Conclusion Mission Critical, with a focus on highly resilient PostgreSQL clusters. I have a background in computer science, high performance computing and machine learning. This has guided my career interests towards profiling and tuning, and fault tolerant architecture.…

Newly attached LVM disk not detected on Linux

If you’re switching disks while the machine is running, the LVM bits might not be detected when the disk is added. Here’s a couple of commands you can use to rescan for the device, and then activate it manually. If your device is /dev/sdc , then run: lvmdevices --adddev /dev/sdc Now you can run the scans to see your physical volumes, volume groups and logical volumes: pvscan vgscan…

WordPress: failing loopback requests and forbidden REST API

If you see both of these errors, make sure that your /etc/hosts file contains a line for your domain name, pointing towards localhost, for example: 127.0.1.1 ivdl.co.za

Creating a Swiftbar plugin for Forticlient VPN connections with 1Password integration

This script does the following: Provides a Swiftbar plugin with connect/disconnect options 1Password integration to fetch the VPN password AppleScript popup to request the one time pin Set up passwordless sudo : Edit the sudoers file: sudo visudo Change `%admin ALL=(ALL) ALL` to `%admin ALL=(ALL) NOPASSWD: ALL` and save and exit. Install the dependencies We’ll use Homebrew for this: brew…

Dynatrace DQL tidbits - Part 1

Introduction Generally, DQL works with entities and time series metrics. In Part 1, we’ll start by having a look at entities, and how to view their properties, and filter them. In Part 2, we’ll look up adjacent entities (e.g. hosts and their processes) and time series metrics, how to split them, and how to retrieve their adjacent entities as well. This will allow you to combine metrics…

Multiline grep for indented lines in log files

The regex in this post, explained via Regex101 Some applications can log multiple lines per log entry. PostgreSQL is a good example, when statement logging is turned on. Here’s a bare bones example with log_statement set to all : 2025-06-23 22:00:00.000 CEST [6316] LOG: statement: select * from t where t is not null; If, for example, we wanted to grep for all statements executed by process…

RHEL DNF: None of the providers can be installed

If you see a message like the following when running dnf update : Problem: package gcc-8.5.0-24.el8_10.x86_64 from @System requires libgomp = 8.5.0-24.el8_10, but none of the providers can be installed - cannot install both libgomp-8.5.0-26.el8_10.i686 from rhel-8-for-x86_64-baseos-rpms and libgomp-8.5.0-24.el8_10.i686 from @System - cannot install both libgomp-8.5.0-26.el8_10.i686 from…

Crucial P310 M.2 NVMe drive not detected on ASUS AsRock B450 Steel Legend: A three step fix

Source In my case there were three matters preventing the drive from being detected: The BIOS version was too old The socket was not set to be recognised as a PCIe device (this requires a beta BIOS version) The drive was seated in the M2_1 socket instead of the M2_2 socket. The ASUS motherboards are terrible 1 , 2 for M.2 drives. Forums and Reddit are littered with complaints of M.2 drives not…

A quickstart guide to setting up a C development environment on Vim

![](/wp-content/uploads/2025/03/vim.png) ![](/wp-content/uploads/2025/03/logo.png) This guide is for Mac, but the tools are platform agnostic, so you can adjust them to your environment. I'm assuming you have Vim 9 or newer, and Homebrew installed. Install LLVM: $ brew install llvm Then check that clangd exists: $ which clangd /usr/bin/clangd Now make a directory for the language server plugin on…

Chaining sudo on SSH to run PostgreSQL queries and dumps remotely

Photo by Kvistholt Photography on Unsplash It is common to run some commands via the postgres account as it is the de facto PostgreSQL super user. This means that if you’re running these commands remotely, you’ll need to chain sudo: ssh pg-host sudo -i sudo -u postgres ... If you’re in charge of the system, you can allow direct sudo -ing to the postgres user, but often that is…

Copying a file that requires sudo access from a remote host via SSH

Instead of copying (i.e. via scp or rsync ), you can sudo cat the remote file, and pipe it (since pipes cross the SSH boundary) to a local file: ssh <remote host> sudo cat <remote path> > <local path> For example: ssh example.com sudo cat /etc/shadow > shadow-copy.txt Happy copying!

Firefox has built-in vertical tabs now

Last year, Mozilla announced that they&rsquo;re developing native vertical tabs for Firefox, and that it&rsquo;s available in the Nightly release channel. Since then, despite generally keeping up with things, I hadn&rsquo;t seen any more news. Turns out, if you look at the bug tracker, they&rsquo;re still actively working on it. But it works fine, and you can switch it on with an about:config flag…

Remove DisplayLink icon from Mac OS menu bar

This does not have an impact on the functionality, and frees up space in the menu bar for other things. Open a terminal, and run the following: defaults write com.displaylink.DisplayLinkUserAgent ShowMenuBarIcon 0 Restart DisplayLink. The icon will no longer appear, but you can still use the software.

PostgreSQL: unrecognized configuration parameter lc_collate

If you run either of the following queries on PostgreSQL 16 or higher: SHOW LC_COLLATE; SELECT CURRENT_SETTING('LC_COLLATE'); You&rsquo;ll see the following error message: ERROR: unrecognized configuration parameter 'lc_collate' The LC_COLLATE parameter was removed in PostgreSQL 16.0 : Remove read-only server variables lc_collate and lc_ctype (Peter Eisentraut) § Collations and locales can vary…

Radeon RX 7800 XT OC stuttering frames on Linux: a couple of fixes

Power management Some Radeon cards have aggresive power saving profiles switched on by default. Here&rsquo;s a quick guide cobbled together from other sources on how to change the default to a more aggressive GPU clock ramp-up power mode to reduce stuttering in games on Linux: Set the power profile for the GPU using a udev rule, by adding the following lines to a new file called…

CPU temperatures missing from lm-sensors on Linux

Working sensors! If you&rsquo;re seeing no or very limited temperature and voltage sensors in Linux, it is likely that you need to make sure the right kernel modules are loaded at boot. In my case, on my ASRock B450M motherboard, I could only see GPU temperatures. For this guide, I&rsquo;m assuming Ubuntu 24.04, but you can find the package names online for your distro. The fix is as follows:…

Pretending to be PostgreSQL: Part two - responding to queries

*Masquerading as the elephant in the room* Introduction In Part 1 we implemented the server handshake in Python. With our subterfuge now established, we&rsquo;ll go ahead and respond to requests. Last time, we stopped short of responding: $ psql -h 127.0.0.1 -p 5433 psql (16.4 (Ubuntu 16.4-0ubuntu0.24.04.2), server 15.1) Type 'help' for help. postgres=> select 1; postgres=> Today, we&rsquo;ll…

A quickstart guide to CloudNativePG on Ubuntu and Mac OS

Photo by Namukolo Siyumbwa on Unsplash Running CloudNativePG (CNPG) allows you to run a replicated PostgreSQL cluster with similar characteristics to a production employment on your personal machine. This is convenient as you can rapidly deploy and destroy clusters as needed within one or two commands. This is an opinionated guide - it takes away the guesswork of things like &ldquo;which Minikube…

Where does the name Vondelpark in Amsterdam come from?

Photo by Rita Candeias on Unsplash Having moved to the Netherlands a while back and spending some time in Amsterdam, I was wondering about the origin of the name of the most famous park in the Netherlands, Vondelpark. The Amsterdam Municipality website has a very brief blurb about Vondelpark, which, rather unhelpfully, does not note where the name comes from 1 . Wikipedia offers a somewhat more…

PostgreSQL streaming replication characteristics on UNLOGGED tables

Ever wondered what happens if you switch an UNLOGGED PostgreSQL table to LOGGED while replication is active? Probably not, but now that you&rsquo;re here you might as well find out. Photo by Timelab on Unsplash – WAL shipping in action? This is a bit of a rabbit hole, so let me explain. In brief: streaming physical replication ships the WALs from the primary to the standby servers. The…

Upgrading from PostgreSQL 16 to 17 installed with Homebrew, on an Apple Silicon Mac

Photo by Caterina sanders on Unsplash &ldquo;You know what&rsquo;s weird? Day by day, nothing seems to change, but pretty soon&hellip;everything&rsquo;s different.&rdquo; – Bill Watterson Note : if you need the upgrade steps for version 15 to 16, you can find them here , and if you need the steps for 14 to 15, you can find them here . Upgrade steps These steps assume you have installed PostgreSQL…

The quickest way to update all fields in a Microsoft Word document on Mac

The standard way of updating all fields on Windows is to select all and press F9. The advice I found for Mac was the same, but didn&rsquo;t work for me. Turns out there&rsquo;s an easy way - if you change the print options in preferences to tick &ldquo;Update fields&rdquo; and &ldquo;Update links&rdquo;, everything will update when you open the print dialog. So you can just press ⌘ + P to open it,…

An OpenSSL oneliner to check the expiration of your PostgreSQL server (or pooler) certificate

Rather than checking the expiration of the certificate on disk, we&rsquo;ll connect to the server and get the live certificate instead. If the live certificate expires earlier than the one on disk, you&rsquo;ll likely need to reload (not restart) the PostgreSQL server. We&rsquo;ll be using the openssl binary, since PostgreSQL already requires it, so you don&rsquo;t need to install dependencies to…

Quicker recovery from PgPool-II defunct process state during a PostgreSQL backend failover

During a PostgreSQL backend failover, you might find that PgPool-II becomes unresponsive, and that a process listing shows one or more PgPool-II processes as being <defunct> : postgres 3683365 0.0 0.0 0 0 ? Z Jun11 0:00 [pgpool] <defunct> postgres 3683366 0.0 0.0 0 0 ? Z Jun11 0:00 [pgpool] <defunct> postgres 3683367 0.0 0.0 0 0 ? Z Jun11 0:00 [pgpool] <defunct> postgres 3683368 0.0 0.0 0 0 ? Z…

Using hyphens in hostnames on Ansible

Normally Ansible doesn&rsquo;t allow for the following: --- webservers: hosts: web-01 web-02 Instead of using the hyphen in the YAML host key, you use the inventory name as an alias, and then have the actual hostname in the ansible_host field for SSH purposes: --- webservers: hosts: web01: ansible_host: web-01 web02: ansible_host: web-02 You can still access ansible_host from your hostvars in your…

Apple TV remote no longer controls Samsung TV volume: A quick fix

If it has worked up until this point, there&rsquo;s no need for re-learning remote settings (either on the TV or the Apple TV). The fix is obscure but simple: Hold the TV and volume down buttons on the remote simultaneously for ten seconds: When you release the buttons after ten seconds, the Apple TV will pop up a notification indicating that the remote has reconnected. With that done, you can…

Connecting to PostgreSQL using Oracle SQL Developer with different database and user names

Let&rsquo;s assume you have a username user_a , with a database name database_a . If you were to enter the user credentials and click on the Choose Database option, you&rsquo;d get a message stating: Failure -FATAL: database 'user_a' does not exist With the option to not choose the database now, it might appear that you cannot proceed any further, but it turns out you can use the Hostname setting…

Fixing Ansible SyntaxError: future feature annotations is not defined

Version 2.17 of Ansible was released on the 20th of May 2024. This version deprecated support for Python 3.6 1 , which is the default version of Python that ships with RHEL 8. If you upgrade to Ansible 2.17 on your machine and try to execute a playbook on a RHEL 8 target, you&rsquo;ll see the following error, among the full stack trace: SyntaxError: future feature annotations is not defined The…

Essential, open source Mac apps

These are the apps I install on every new Mac, and this post serves as my personal reference list (as with many other posts on this blog). It&rsquo;s likely that Rectangle will be replaced by the built-in window tiling functionality in the upcoming Sequoia release, but for now it remains indispensable. All of these apps are open source. Most screenshots are from the original sources. Karabiner…

Achieving a 100x speedup of DELETEs on PostgreSQL

&ldquo;How did it get late so soon?&rdquo; Photo by Murray Campbell on Unsplash Performance I recently had a query from a colleague regarding a slow DELETE query on PostgreSQL. On the face of it, it was simple enough. It had no CASCADE , and they were only deleting a few records at a time using a subquery (in the absence of a LIMIT for DELETE ). This small batch approach was working, but it was…

Estimating the disk space needed for a VACUUM FULL on PostgreSQL

Photo by Jandira Sonnendeck on Unsplash If you find yourself in the position where you need a full vacuum, you&rsquo;re probably already looking at the number of dead tuples to have reached that conclusion. The trouble is that bloated tables and (nearly) full disks tend to go hand in hand. In this case, you might be wondering: how much disk space do I need to complete a full vacuum? Let&rsquo;s…

PgPool-II: Unable to get session context

If you&rsquo;re successfully authenticating with PgPool-II, but receive the following message: Unable to get session context It means that you&rsquo;ve likely not specified the correct connection database. Double check the host-based access control configuration, and make sure that the user is authorised to connect to the database you&rsquo;re specifying. If you haven&rsquo;t specified a database,…

A room with a view of the PostgreSQL autovacuum

Peeking into the janitor&rsquo;s closet Photo by Richard Jacobs on Unsplash Tuning the PostgreSQL autovacuum concerns a delicate balance between the kind of workloads running and the performance characteristics of the system. In short, it boils down to making sure that the autovacuum triggers when it is supposed to, and is able to complete its work, without interrupting the workload imposed by the…

Synchronising a PostgreSQL identity sequence with the contents of the table

If you find that, for some reason, an INSERT with a sequence value fails with a duplicate key error, you need to resynchronise the sequence value with the contents of the table. For a given table table1 , with an identity column called identity_id (with a corresponding sequence), you can run the following to update the sequence to match the highest value already existing in the column + 1. SELECT…

Beware of EuroDNS

On the 8th of April, I requested a transfer of this domain from Gandi.net to EuroDNS, following the recent-ish changes Gandi made to mailbox services, and wanting to avoid future issues arising from the takeover of Gandi.net. The transfer succeeded, but the EuroDNS dashboard showed that a DNS update was pending. I thought this was concerning as the transfer was already registered and I received a…

Spoegwolf - Sterre

Die lirieke is nêrens elders korrek ingelees nie, dus skryf ek dit hier op. sit weg my kitaar en sluit die kroeg jaag die mense weg ek&rsquo;s moeg gespeel ek het lank gewag vir dit wat verlore is ek moet nou huis toe laai die kar en sluit die boot sit vir Fokof aan daai bitter soet dis net als te veel om alleen te voel ek moet nou huis toe dalk kom ek terug na daai bries laat op Ryneveld jou…

Ansible node unreachable

&ldquo;No one is ever satisfied where he is.&rdquo; – Antoine de Saint-Exupéry The classic issue with an unreachable Ansible node is that SSH authorisation is either not configured or configured incorrectly. In such a case you&rsquo;ll see the following: TASK [Gathering Facts] ********************************... fatal: [<machine>]: UNREACHABLE... Make sure that you can connect as the correct user,…

The infinitely patient vacuum - a case study of what happens when the PostgreSQL VACUUM never completes

Timeouts? What timeouts? Photo by YoonJae Baik on Unsplash I was recently called into a situation where the same query was running on three different environments, but one environment was running considerably slower than the other two. I requested an extended EXPLAIN of the query on all three environments, along with the output of pg_locks and pg_stat_activity on the troublesome environment, for…

Detecting VMWare vMotion migration events on Linux virtual machines

&ldquo;There&rsquo;s never enough time to do all the nothing you want.&rdquo; ― Bill Watterson While vMotion migrations are not explicitly logged on Linux VMWare guests, there is a log message which correlates with these events. The message is logged to /var/log/vmware-vmsvc-root.log , and looks as follows: ToolsDaemonTcloReceiveVixCommand: command 62, additionalError = 17 It is worth noting that…

PgPool-II: Degenerate backend request for node_id is canceled because failover is disallowed on the node

PgPool raises the following error when attempting to run <a href="https://www.pgpool.net/docs/latest/en/html/pcp-detach-node.html">pcp_detach_node</a> : ERROR: degenerate backend request for node_id: 0 from pid [5307] is canceled because failover is disallowed on the node This occurs if you have DISALLOW_TO_FAILOVER set as the backend flag. Set the flag to ALLOW_TO_FAILOVER instead, and…

You need not meander to the truth

&ldquo;It&rsquo;s still magic even if you know how it&rsquo;s done.&rdquo; – Terry Pratchett There&rsquo;s a litany of shortcuts when it comes to technical work. Stack Overflow, Google Quick Answers (the answer boxes and Q&As on search result pages), various LLM-based services and others promise that you no longer need to read lengthy pieces of documentation. You can just enter a question, and…

Pretending to be PostgreSQL: Part one

On perpetrating protocol mimicry It's surprisingly tricky to decide where to put a moustache on an elephant Introduction Today we&rsquo;ll have a look at the PostgreSQL message flow, and implement a minimum workable server in Python. The aim for part one is to implement the handshake successfully to the extent that psql sees us as a PostgreSQL server, and have a look at what else would be needed…

Demystifying HTTP with Telnet

To most developers, interacting with an API endpoint via HTTP(s) is something they&rsquo;ve always done via libraries written by other people. Sometimes they get a little bit more exposure by having a look at the requests and headers in their browser&rsquo;s developer tools, or when they submit a POST using curl. Are you one of those developers? Let&rsquo;s have a look under the hood this time.…

What do Norway and Namibia have in common?

The flags of Namibia and Norway, respectively These two countries have inherited a curse. Namibia is affected more than Norway, but that might change with time, as systems get more clever. Their curse is one of misguided data processing. The ISO 3166-1 alpha-2 standard contains two-letter country codes. For the United States, it is US , and for South Africa, it is ZA , for example. These codes…

PostgreSQL and HikariCP: Connection marked as broken

“Begin at the beginning," the King said, very gravely, &ldquo;and go on till you come to the end: then stop.” If your logs contain the following message: HikariPool-1 - Connection marked as broken because of SQLSTATE(08006) You have an invalid connection to the PostgreSQL server. It may have been closed due to a network interruption, or PostgreSQL (or an intermediary like PgBouncer or PgPool) may…

Adding a reload verb to a SystemD unit file

Consider the following, fairly standard Gunicorn unit file: [Unit] Description=gunicorn daemon Requires=gunicorn.socket After=network.target [Service] User=www-data Group=www-data WorkingDirectory=/var/www/app ExecStart=/var/www/app/production/bin/gunicorn \ --access-logfile - \ --error-logfile - \ --workers 3 \ --bind unix:/run/gunicorn.sock \ app.wsgi:application [Install]…

PostgreSQL replication: LSN has been already streamed, forwarding to LSN

Changes made to the schema definition on the primary will not automatically reflect in the secondary. This results in messages like these in the PostgreSQL log: LOG: 1BAD/7B63ABC0 has been already streamed, forwarding to 1BAD/7B695078 You can read the explanation for this in the source code , briefly: /* * It might seem like we should error out in this case, but it's * pretty common for a client…

Monitoring PostgreSQL logical replication using Telegraf, Prometheus and Grafana

Querying the primary We can query pg_stat_replication , and map the documented strings to numeric values – Prometheus uses numeric metrics, we&rsquo;ll map them back to strings in Grafana: SELECT slot_name, application_name, client_addr, CASE WHEN state = 'startup' THEN 1 WHEN state = 'catchup' THEN 2 WHEN state = 'streaming' THEN 3 WHEN state = 'backup' THEN 4 WHEN state = 'stopping' THEN 5 WHEN…

Telegraf: [inputs.disk] Collection took longer than expected

After a recent NFS issue I saw the following warnings in my Telegraf logs, and the disk metrics stopped being collected: W! [inputs.disk] Collection took longer than expected; not complete after interval of 10s The usual advice is to just increase the collection interval to give it more time to complete. This is generally not good advice, since there&rsquo;s no reason why such a collection should…