Debian packages may seem simple to generate using the many bundling tools out there, but it is much more involved than that. There are policies and procedures in place before stuff can get into Debian, including how the package is made, what it must include, and more. This article aims to cover the stuff prospective contributors to Debian should know that other resources miss.When I started, I didn't know a lot of this and had to learn a lot along the way. Hopefully what I've put together here will make it easier for the next person that comes along.
Find the right thing to work onPackages are the bread and butter of Debian, so it may be the first place you look at. There are two ways to go: adopting or helping out with an existing package, or introducing a new package.Outside of packaging, contributing to Debian's infrastructure is also very much welcomed and appreciated, especially as a lot of it is decades old. Some examples include Lintian (Debian package linter), DAK (archive software), and distro-tracker (package info tracker), and there are many, many other projects in need of help.If you are a native speaker of any non-English languages, you may want to also consider helping translate stuff. Everything from the installer to mentors.debian.net to package descriptions needs volunteers to translate.This article mainly focuses on the packaging side of things.
Working on an existing packagewnpp.debian.net lists packages that need help with maintenance.The most useful thing you can do as someone interested in packaging is to help with an existing package. You can either:
Help other maintainers on an existing package. Maintainers will publish Request for Help (RFH) bugs asking for assistance to maintain a package. Some packages are so unruly that help is welcome even when not asked (e.g. Docker).
Adopt an orphaned package. An orphaned package is one where the previous maintainer could not continue maintaining it for whatever reason, and so it needs a new maintainer (or deletion). These are indicated by Orphaned (O) bugs. Request for Adoption (RFA) bugs are similar, as they mean the maintainer is about to orphan the package.Some orphaned packages are effectively abandoned, being both unmaintained upstream and having no users in Debian, but many maintainers will choose to orphan these packages rather than remove them. Keep this in mind when looking through the list.
By the way, this is how I started contributing to Debian! With the help of a Debian Developer, I adopted kitty, and to this day I continue to maintain it.
Introducing a new packageMany people opt to start their Debian contribution journey through producing a new package for the Debian archive. Unfortunately, many people do not do this properly or try to use Debian as a dumping ground for their own software, so here is a general checklist to see if something belongs in Debian:Repology shows an overview of a package across Linux distributions.
How established is the software, and is it still maintained? The longer a project has been around while continuing to be actively maintained, the more likely it is to continue to be maintained in the long-term.
How many people use the software? Hundreds? Thousands? How many people will benefit from the software being packaged and included in the Debian archive?The point of packaging something for Debian is to make it easier for the existing userbase to install the software. For instance, as a user you generally expect notable software like Firefox and Vim to be available with a single apt install, and it would be weird if you had to hunt down binary tarballs or build these from source.
Do any other Linux distributions package the software? If yes, that's a good indicator it belongs in Debian as well. You can check this on https://repology.org.
Does the software introduce new or unique functionality not found in any other software currently present in the archive? It's okay if it doesn't, but there would be a much stronger case for a new package if the answer is yes.
Does the software have generally stable releases and proper versioning? If it doesn't, it's going to be a whole lot harder to create and maintain a package for it, considering Debian is a distribution that releases snapshots of software every 1-2 years with nothing but security updates for stable.
You also need to keep in mind that you should be prepared to maintain the software throughout the lifetime of the next Debian stable. Debian is not a rolling release distro. You cannot upload new versions of software to stable. The only thing you can upload to stable are fixes that meet the stable release team's criteria, and security fixes via the security archive, which you sometimes have to cherry-pick and backport if upstream does not provide them. And Debian packaging is not a one-off task; you should be ready to look after the package long-term, which consists mostly of updating the package in unstable for new upstream releases and fixing bugs.Many people miss the memo. They bring their "revolutionary" app that they threw together (often vibe-coded) in a weekend and try to get it added to Debian. Project members mostly won't upload such packages; as a result, more useful packages may be drowned out. At the time of writing, I estimate around half of the open Request for Sponsorship (RFS) bugs is this kind of toy software with little to no real users.If you've made something, great! Feel free to package it, but distribute it in your own external repo. Not everything belongs in Debian, and no Debian Developer has an obligation to sponsor and upload your package. Services like GitLab, and Forgejo (Codeberg) also have built-in repository features that let you easily create an external apt repository.When looking at software that could potentially be packaged, also consider the amount of effort you may have to spend investigating licensing status and compiling copyright information. This is covered a bit later in this article.
Become familiar with Debian packagingNow, you probably don't need read the Debian Policy and Debian Developer's Reference from cover to cover, but you should familiarise yourself with Debian packaging and the key infrastructure involved. Look at the important bits in the Policy and Developer's Reference.Check out this list of packaging manuals and this introduction to packaging on mentors.debian.net for some additional material. There are also some great manual pages like deb-control(5), deb-src-control(5) (from dpkg-dev), debian-watch(5) (from devscripts), and dh(1) (from debhelper) describing some of the packaging files in detail. You can read these with the man program or at https://manpages.debian.org.Look at other similar packages and pay attention to how they were made. Ask questions when you're unsure, people are always willing to answer on the debian-mentors mailing list and IRC channel.Once you get a rough idea of how a Debian package works, it will feel natural working through packaging files.By the way, you can read a lot of these documents offline: manpages can obviously be installed and read on your own machine, but the debian-policy and developers-reference packages (from unstable) will allow you to read the policy and reference offline as HTML in their respective directories under /usr/share/doc/.
Git-based packagingPeople have many opinions on how to create a package, but by far the most popular is the GBP format for packaging in a git repo.GBP stands for git-buildpackage, the tool behind this workflow, based[2] loosely on the DEP-14 proposal. Here, the upstream code is placed in an "upstream" branch (this is what goes in the .orig.tar.xz tarball), and the Debian-specific packaging work is placed in a "debian" branch (this is what goes in the .debian.tar.xz tarball).Many people have different ideas of what these branches should be called: upstream vs upstream/latest, debian/latest vs debian/unstable vs debian/sid. It generally doesn't matter though as the end result will be the same either way.Using a git repo for your packaging rather than just a DSC makes it easy to see and review the changes you've made, and allows others to easily get the package source with full history and contribute (when located in a permissive group on Salsa like debian/ or one of the many teams).It goes without saying that you should maintain proper commit hygiene by separating changes into multiple commits, having meaningful commit messages, and avoiding force pushing whenever you can.Commit messages do not need to have explanations like other projects may expect, but feel free to add one if you think it will help whoever is looking at your changes understand what's going on.Keep in mind that you can and should use the gbp-dch-style meta tags, which are Gbp-Dch, Thanks, and Closes, documented in the gbp-dch(1) manpage:
Gbp-Dch: ignore will not include your commit in the generated debian/changelog when gbp dch is executed.
Gbp-Dch: full will include the extended description of your commit as well in the generated debian/changelog when gbp dch is executed.
Thanks: John Doe will add a thankyou to the person named in the generated debian/changelog when gbp dch is executed. Useful when a commit is related to a bug report, patch or other useful contribution from someone else.
Closes: #123456 will add the relevant (Closes: #123456) in the generated debian/changelog when gbp dch is executed, to close one or more (comma-separated) bugs in the Debian Bug Tracker when the package is uploaded.This is the most important one, and should always be used even when not using GBP in an alternative workflow. Most groups on Salsa, including debian/, have webhooks that will send an email to bug reports and tag them as pending if a commit using this meta tag is pushed, which is great for notifying people that a fix is ready and about to be uploaded.Note: Don't bother trying to add Closes: to your "Initial packaging" commit description; there is no need and debian/changelog should already close it in your initial packaging work.
Team maintenanceMore and more packages are being moved into "team" maintenance with weak package ownership, over the traditional single-maintainer model with strong ownership. This allows everyone to help maintain a package through team uploads, rather than relying on the same people to remain active.When it makes sense, you should try to maintain your package in a team, especially as it will have other contributors familiar with the topic or language that may be able to spot issues in your package others may miss.Most packaging teams fit into two categories:
Language teams - these are teams that package software exclusively written in a specific programming language, and usually also maintain the toolchain for that language as well. Examples include the Go team, Python team, and Rust team. Many of these teams also have their own tooling to make packaging easier for these languages, like dh-make-golang and debcargo.
Topic teams - these are teams that package software related to a certain topic or project, usually by contributors very interested in that topic. Examples include the Med Team, the Electronics Packaging Team, and the Debian Vim Maintainers.
Language-specific libraries like golang-*-dev packages should almost always be maintained in a language team, and packages centered around a project like Vim or Treesitter should be put in the related team if it exists. For all other cases, it is completely up to you. It usually does not matter which team you put it in, as long as you put it in a team, as you get the same benefits. Keep in mind, many teams have certain policies and guidelines for how packages within them should be maintained, so make sure to check that.If you're maintaining stuff outside of a team, you should consider adding yourself to the LowThresholdNmu list to indicate that you are happy for people to follow a relaxed non-maintainer upload process when it comes to these packages.
Compiling copyright information Upstream sometimes adds files taken from other projects, which must be documented in debian/copyright.Every Debian package must include copyright information. In the packaging source, this is in debian/copyright, and this ends up being installed under /usr/share/doc/<package>/copyright on Debian systems.This is important for a variety of reasons, some of which are:
It establishes that the software is compliant with the Debian Free Software Guidelines (when in main).
In the case of packages in the contrib and non-free archive areas, it helps people running mirrors or creating installation media (like install USBs) determine which software they are allowed to redistribute.
It helps people working in enterprise settings produce a Software Bill of Materials (SBOM).
It provides a consistent source of licensing information for software installed on your system so that you, as the end user, don't have to hunt down this information yourself.
All new packages should follow the machine-readable debian/copyright specification to produce a consistent, complete copyright file that covers every file in the source package.As a result, this can mean a lot of work hunting down copyright and license information, especially for large software projects. In fact, you will often spend more time on the debian/copyright file than the rest of the package combined when working on Debian packaging.There are a range of copyright review tools to make your life easier when doing this work. Some of the highlights are:
licensecheck - tool to try to detect the license of files passed to it
licenserecon - uses licensecheck to compare detected licenses against those in debian/copyright and shows you the differences
scan-copyrights - generate a preliminary copyright file using licensecheck, useful for finding stuff that got missed
When the licensing status of a file is unclear, you may have to ask the upstream author to clarify. Note that if something has no license (e.g. upstream does not specify a license at all for their project), it is considered "all rights reserved" and cannot be distributed in Debian.Some projects will have vendored copies of some or all of their dependencies. When this is the case, you need to remove as much as possible and make the package use the libraries provided in Debian instead, as this is a Debian policy requirement (more info on this wiki page on embedded copies). Additionally, you may need to remove non-DFSG-compliant parts of upstream's source to ensure the package is DFSG-free. Both of these are done via repacking, which involves:
Specifying the Files-Excluded field in debian/copyright, preferrably with a Comment as well on why it is being repacked.
Modifying the tarball retrieved from upstream to remove these files. Some people do this by hand, but it is better to use either mk-origtargz (from devscripts) to do this when you already have a tarball, where it will read and use Files-Excluded (refer to it's manpage), or uscan, which will download a new tarball using your debian/watch file and then run mk-origtargz on it.
Adding a +dfsg (repackaged for DFSG reasons) or +ds (repackaged to remove vendored copies or other reason) suffix to the upstream version. This will appear in the name of the repackaged tarball (e.g. foo_1.2.3+ds.orig.tar.xz), and in the upstream part of the Debian version (e.g. 1.2.3+ds-1, where 1.2.3+ds is the upstream part). If you end up repacking the same version multiple times, you can add a numeric suffix (e.g. +ds2) to indicate this.
Also make sure to check if your package source contains binary files like images and PDFs, and to figure out if they have separate copyright and licensing status. Some of these files have their copyright information embedded within them. Of course, you can ignore build artifacts, as long as they are cleaned and rebuilt during package build.
Build and check your packageYou should build your package in a clean unstable environment to ensure that your Build-Depends pull in all the required packages from the unstable repos. The best tool to do this is sbuild, which builds your package in an isolated unshare-based environment and allows easily running lintian and autopkgtest as well; this is the same tool used by the Debian build daemons (buildd) once your package is uploaded.There is a great sbuild page on the wiki containing setup instructions and many useful tips.There are many quality-checking tools available to catch common and not-so-common issues with your packaging. Using the sbuild configuration that the wiki page suggests, after each build it will automatically run:
Lintian: static Debian package checker that analyses the outputted files (.deb, .dsc, .changes)
Autopkgtest: tests your package as installed on a testbed system if your package defines them
Piuparts: checks your package cleanly installs, upgrades and removes (useful for checking custom installation and removal scripts)
You should always check the output of these tools and ensure they pass. Debian Developers use these same tools when reviewing your packaging.If you are able to and when it makes sense, you should also install the package onto your own system and check everything works correctly. Even if a package builds successfully, it may not actually work when installed.Unless your package only produces Architecture: all packages, you may want to also check that it cross-compiles correctly. You are probably either reading this on an amd64 or arm64 device, so you can easily cross-compile to the other architecture using the --host option with sbuild. Ability to cross-compile is not a policy requirement, but it will be raised as a bug against your package if it fails to do so.Adding on to that, if your package is not straightforward and it produces packages on multiple architectures (usually Architecture: any), you may want to also check that it compiles on all of Debian's release architectures (aka. official ports). You can do this using virtual machines (QEMU is probably the easiest), but if you can't do this for whatever reason (like your computer being too weak to run a VM or the long package build time), also note that Debian Developers have access to porterbox machines that can be used to check your package before upload.
Find a sponsorNew contributors cannot upload to and manipulate the Debian archive directly. Rather, they need a Debian Developer to do so on their behalf after reviewing all their work; this person is called the "sponsor".If you are planning to maintain your package within a team, check if they have their own guidelines or policy for finding a sponsor, as this will likely be quicker than the traditional RFS process outlined below. For instance, in the Go team, sending an email to the mailing list is much better, especially since usually multiple packages need to be uploaded at once.Outside teams, the usual method is to upload your package to mentors.debian.net, and then file a Request For Sponsorship (RFS) bug to ask for a sponsor. The mentors website has an overview and very clear instructions on properly filing an RFS and finding a sponsor. Properly formatted RFS bugs go a long way.When filing the RFS bug, make sure you follow the template exactly. Deviating from it or sending a misformatted email is one of the quickest ways for your RFS to be both ignored by humans and missed by automated tools, so double check that it actually has everything needed. Ensure each of these fields is filled correctly:
Package name: This is the name of the source package set in debian/control.
Version: The version of the package you want the sponsor to upload, usually the latest version in debian/changelog.
Upstream contact: The contact info you put in the Upstream-Contact field in debian/copyright. This can be a name & email or a URL (e.g. to upstream's issues tracker).
URL: The homepage of upstream's website, usually from the Homepage field in debian/control.
License: List all the licenses present in debian/copyright, comma-separated.
Vcs: The URL to your Git repo containing your packaging, which should be on salsa.debian.org and be set up accordingly in the Git-buildpackage format.
Section: The value of Section in debian/control for the source package.
Adding notes or comments to the end of the RFS message is fine, but make sure the rest of it follow the right format.Things to keep in mind include:
Do not file multiple RFS bugs, for any reason. If you have reuploaded your package or made a change, you can send a follow-up to the same bug.
If you want to change the name of your RFS (e.g. following a change in the name of the package), modify the tags or anything else, you can send commands via email to the Bug Tracking System (BTS).
Your RFS bug will only be closed if the package is uploaded or someone decides your package should not be uploaded.
Do not change the Package: field at the top of the email from sponsorship-requests, this tells the BTS that your bug report should be filed against sponsorship-requests and not some package in the archive.
The Severity: field at the top of the email should be "wishlist" for new packages, "important" for updates fixing Release-Critical (RC) bugs, and "normal" for everything else.
Skipping the bug and sending an email directly to the debian-mentors mailing list is a great way for your RFS to be ignored, especially since automated tools will not be able to pick it up.
Format the bug's title correctly. It needs to be RFS: name/version [ITP/ITA/RC/NMU] -- short description. Again, this is helpful for automated tools when they try to figure out what your RFS means. Examples include:
RFS: qiv/3.0.4-1 [ITA] -- Quick image viewer
RFS: wattsi/0.0~git20251112.d8caa36+dfsg-1 [ITP] -- Preprocessor for the HTML Standard
Now, when filed properly, an interested sponsor may come along and review your package, then either upload your package or send you feedback to iterate on before that. Ensure you watch for responses to your RFS and respond promptly.Note there is no obligation for anyone to upload your package, and that anyone can review your package but only Debian Developers can upload it for you.The Lintian output given by the Mentors website was usually right, but at the time of writing the website is using an outdated version of Lintian, so many of the hints it gives are incorrect. For the most up-to-date output, it's best to run Lintian from unstable on your own machine (which sbuild does for you).
Next stepsIf your package is new to Debian, it will head to the NEW queue for manual review. Here, the DFSG team primarily checks that the package is compliant with the Debian Free Software Guidelines and is suitable for "main", but also check for mistakes in debian/copyright and obvious/major packaging issues.Once your package is uploaded, whether new or existing, and you are named maintainer, you are in charge of looking after it, including new upstream version uploads to unstable, bug fixes, and security fixes. This mostly involves updating and cherry-picking fixes from upstream, but occasionally it gets interesting and you need to dive into the packaging to figure out what's going on and fix the issue.You should try to work towards becoming a Debian Maintainer at the very least in order to easily maintain packages long-term. As a DM, you can be granted upload permissions on a per-package basis for your existing packages so that you don't have to rely on sponsors forever. Having this goal can also appeal to sponsors.Have fun packaging!
(Opinion) What I look for in an RFSThis is not definitive, but I usually scan for these indicators:
Upstream and the packager being the same person is usually a red flag for a low-quality package. Exceptions can be made when it makes sense and this would actually be a benefit, but this is rare.
Properly formatted BTS bug, which shows ability to follow a simple guide.
The software existing in other Linux distros is a good sign.
Packaging VCS should be up-to-date, located on Debian Salsa, and follow Git-buildpackage / DEP-14 format. Deviations should only occur for a good reason. Only experienced packagers should really be experimenting with alternative Git styles like dgit-maint-merge etc.
I can understand what it does just from the package's full description, without having to go to upstream, since this helps me gauge whether I am interested in sponsoring the package. This is not always the case, since packages sometimes come through of a technical nature (usually kernel-related or maths/science packages) where I wouldn't be able to understand no matter how hard I try.
Updates to existing packages and adoptions (ITAs) are easier to sponsor than new packages since it doesn't have to go through the NEW queue and does not need to justify its addition to the archive.
Common misconceptions about Debian
Debian Developers and Debian Maintainers speak for themselves, not for the project. They are just people who happen to have some permissions in the project.The only official way to put forward the position of the Debian Project as a whole on a particular issue is through a General Resolution as per Debian's constitution. Other official sources include those maintained by the Publicity Team delegates, such as Debian News and Bits from Debian.Also note that delegates for a certain team can speak on behalf of that team. In this case, they usually get consensus within that team before making such statements.
The only formal, official "teams" in Debian are those delegated by the project leader, listed at https://www.debian.org/intro/organization.Debian does not have a "legal team", the debian-legal mailing list is for discussion about licensing.There is no "Debian Team", it's just a bunch of contributors working together to deliver a quality collection of packages. Packaging teams are informal, as they are not delegated; rather, they are people working on a certain category of packages under one roof.
Keep in mind contributors are all volunteers, with most not getting paid to work on Debian. Debian is owned by a non-profit and relies on donations, rather than a company like Ubuntu and Canonical. The Debian constitution explicitly states that no contributor is obligated to do anything.
There is a new project coming to Open Source Software land these days: OpenAGPS. It is not yet 100% functional, but we are working on it. It is not fully operational, yet, but we are on it.
Let me introduce OpenAGPS to you...
The Situation Today
The domain of assisted geo location services has been left to a few big tech providers. When using GPS on mobile devices, most of us send info on our approximate device location (based on cell tower IDs seen by our devices around us) mostly to Google's SUPL service in order to facilitate a faster GNSS/GPS lock on the satellites flying above us.
Without assistance, retrieving a GNSS/GPS lock on sufficient satellites includes "finding" those satellites and once found retrieving data (in bytes/sec) from them. In some regions, this leads to waiting periods of up to 45 minutes, before a mobile devices has gained a lock on sufficient satellites (3 or more).
In Assisted-GNSS/GPS, "other" information (such as cell tower IDs) gets used to estimate what GNSS/GPS satellites are currently passing over one's location. With AGPS, the mobile devices retrieve information via a so-called SUPL server, containing two details: a list of potential satellites above and their dataframes. Esp. providing those dataframes over the device's internet connection (and not via the GNSS/GPS receiver downloading it from the satellite itself) speeds up the lock-on process of the mobile tremendously (several seconds to a few minutes).
However, for this mechanism to work, your device will share your IMSI (although not needed for AGPS), a list of cell towers around you and their signal strengths with the provider of the SUPL service, revealing your approximate position. In total, this allows SUPL providers to re-identify each mobile device and create motion profiles of each such device (and its owner). If the SUPL service is hosted by one main provider (i.e. Google SUPL), there is a lot of valuable information available to them for free that they can commercialize.
Currently, there is only one mitigation method available to hide one's location info from the SUPL server(s) at e.g. Google: using a SUPL proxy server implementation (available as OSS, provided by and used in e.g. GrapheneOS). A SUPL proxy still depends on the big tech service provider(s) for SUPL as it merely proxies SUPL requests from mobile devices through to the proprietary SUPL services, at e.g. Google, but the mobile device is being camouflaged behind the SUPL proxy in use.
The OpenAGPS Teaser
OpenAGPS, on the contrary, will be a fully independent implementation from proprietary service providers, and it will refrain from collecting and commercializing end users data. It will be driven by individuals of the OpenAGPS community. There will likely be one central service that the OpenAGPS project plans to host and operate (the Porygon frontend/backend, OpenAGPS's GNSS Almanach service), but except from that SUPL servers can be self-hosted by individuals, companys or other communities. The requesting mobile devices' IDs will be hidden from the Porygon server (like with existing SUPL proxy implementations), so that the only centrally operated component (the Porygon Almanach server) does not know who is requesting what geo position information (and thus cannot collect such data, neither derive info about where requesting devices are located).
In addition, with a large OpenAGPS community, it is imaginable (in theory) that there will also be multiple central Almanach servers available on the internet (with parallel networks of base stations attached to each GNSS Almanach server).
Checkout the OpenAGPS architecture schematics and our website/documentation to learn more.
Collecting Satellite Data
The OpenAGPS project is not simply a software that admins/users can install, it needs kind of a huge and global community to operate/host/house its base station network.
The challenge with providing a community-driven AGPS service on the internet is that up-to-date (real-time!) GNSS/GPS satellite position data is not available for free download. Almanach data can be obtained per region from various organisations, but then their datasets are often days to weeks old, thus too outdated. GNSS/GPS satellites are not geo-stationary, they circulate around the planet. Their position is dependent on the current date-time. A globally spanning network of GNSS/GPS base stations will do the trick here. We will need a community that harvests the needed satellite data in real time and makes it available through the Porygon Almanach server to all OpenAGPS users.
The OpenAGPS project will depend on at least one community member every ~40-50 km to operate a so-called OpenAGPS base station: These base stations are stationary, need to run 24/7, and they will harvest GNSS/GPS statellite data information from the satellites above in real-time and share this data with the (central) Porygon server, continuously. The Porygon server will create a timestamp-dependent "map" of all seen satellites and extrapolate locations between base stations' Almanach data updates.
Help making OpenAGPS a Success: Host a Base Station
To make OpenAGPS a success, we need volunteers who are willing to host (actually: house) an OpenAGPS base station at their home or work place (or both). Users will only be able to use their self-hosted OpenAGPS SUPL server with their mobile devices (instead of e.g. Google SUPL), if we manage to establish sufficient coverage with those base stations in the area of interest, so that the OpenAGPS Almanach will get populated with sufficient satellite position data.
If you'd like to host/house such a base station, please get in touch and check the docs.
Support this project by Co-Funding it
If you realize that you have an interest in this project and would like to improve your level of digital sovereignty in your government, organization, at your home, etc. then consider sending financial support to the project. If you want to support us, please get in touch with Raoul Kramer at BetaBreak or Mike Gabriel at Fre(i)e Software GmbH. If you are a software developer and would like to contribute to OpenAGPS, also get in touch and let us meet at FOSDEM 2027.
Credits
A huge thanks to the NLnet Foundation for funding this project's bootstrap phase. Follow-up funding has been applied for, so please keep fingers crossed!
The Chinese author Cixin Liu [1] is most known for his book The Three Body Problem and it s sequels. One of the main plot elements in the book is that every species in the universe is cool with genocide and willing to commit genocide as a preemptive strike against any star system found to contain intelligent life.
It s not unreasonable to think that some planets may be by run societies like that, if one star system in 10,000 had a technological society and one society in 10,000 is run by depraved autocratic governments that would make 1,000+ planets in our galaxy that are run by genocidal groups!
To think that every single society wants to commit genocide at every opportunity says a lot about every person who makes such claims. If you believe that everyone wants to do something then it must be something you really want to do. If there s something you really don t want to do then you will be able to imagine a system of government where the majority of citizens vote against doing it.
Even in the more horrible parts of human history there hasn t been a genocide comparable to destroying and entire star system, genocide is usually based on slavery and large scale armed robbery. To just commit large scale genocide with a side effect of destroying valuable resources without any investigation or attempts at negotiation just based on fear of others is an extreme that I don t think humans have reached in history.
The Daleks are portrayed as a perverse extreme of xenophobia but even with the low budget SciFi trend of depicting aliens as mostly having a common belief system they managed to show some Daleks going against their system from time to time. Cixin Liu is a very talented writer but his attitude towards genocide has caused him to write SciFi with a major plot point that s not great by Dr Who standards.
Overall his short stories are much better than the three novels he is most known for. But he shows his ass in some of them too. One notable example is a short story where a significant plot point is declaring a right to sex (for men) which involves government sponsored sex workers. A right to sex conflicts with a sex workers right to refuse sex for a potential client who is undesirable in some way. Regardless of opinions on whether sex work should be permitted I hope that the vast majority of voters in every jurisdiction can agree that sex workers shouldn t be forced to do things that they don t want to do.
Some writers like George Orwell create deliberately fictional scenarios that they hope to inspire opposition to bad ideas, I m sure that many proposed laws have failed to get enacted after being described as Orwellian . But describing a fictional horror situation as inevitable is a way of driving support for such things. It s particularly noteworthy when written by a citizen of a country that s involved in genocide.
A possible counter argument would be but he is living in a repressive country and can t oppose his government . But when Herg (the author of the Tintin graphic novels) was threatened about the consequences of writing another book like King Ottokar s Sceptre [2] he didn t write books in favour of authoritarianism, he just avoided the topic by writing about visiting the moon instead. I don t think that people living in China now should be expected to publicly oppose evil things done by their government, but when they go out of their way to support such things it s their choice and we should note that they made that choice.
I m not saying that people shouldn t read his work as his short stories are definitely worth reading. But the Three Body Problem series really isn t that good, he prevented many potentially interesting situations from happening by having every interaction between different species be based around genocide or the potential for it. Being a horrible person also made him a less capable SciFi author.
Epic just announced the upcoming version 2 of their Linux implementation of Easy Anti-Cheat. It s based on using the Linux eBPF security module to monitor what s happening, and then a bunch of extra infrastructure to make sure this can t be bypassed. The core part of this is requiring secure boot be enabled (ensuring that modified kernels can t be used), using measured boot to verify that secure boot is enabled and which keys are used (to prevent you from just signing your own modified kernel), and then doing remote attestation, a mechanism where the TPM generates a signed copy of the boot measurements and passes that off to a server which verifies it came from a real TPM, verifies that you have secure boot enabled and are using the right keys, and presumably then allows you into the game.
This is all fine as long as you can prove that the measurements provided are real, and that s actually a lot harder than you might think. First, we can simply make up our own quote signed with our own key and say that it came from a TPM. This is avoided by every TPM having an Endorsement Key (or EK) and an associated certificate, with that certificate being signed by the TPM vendor. If you have a list of all the legitimate TPM vendors and their CA keys, you can verify that the measurements came from a real TPM. Easy enough. So we need to get the measurements from a real TPM, and the one on our motherboard contains the measurements that were generated by the firmware and bootloader, and we can t reset those at runtime without resetting the TPM, which oh huh there s actually nothing stopping us from doing that at runtime, as long as we have access to the hardware. Many desktop boards have the TPM on a small plugin module with a standard pinout that includes a reset pin. Simply short that to ground briefly and the TPM is back in its initial state, and userland can write whatever measurements it wants to it. Boot a modified kernel which lies to the eBPF code? As long as you replay the expected log values from a boot with secure boot on and a trusted kernel, the TPM will still happily provide a legitimate set of measurements that ll satisfy the checker.
What if the TPM is less accessible, either because it s mounted directly to the motherboard or it s inside the CPU or chipset? That s going to be trickier. But here s the thing. The quote needs to come from a TPM, but not necessarily the TPM on your motherboard. TPMs these days are usually connected via the Serial Peripheral Interface, usually referred to as SPI. Microchip make a USB to SPI bridge, and there s a Linux driver. Wire one of those up with an appropriate header and you can plug in an easily available TPM module intended for plugging into a motherboard, and now we tell the kernel to ignore the motherboard TPM and make /dev/tpmrm0 point at the USB one and program it with a set of trusted measurements and once again everything is going to look just fine (yes obviously the eBPF code can look for this, but we re running a modified kernel so we can just lie to the eBPF code).
Remote attestation on PCs just doesn t work that well in environments where you can t associate a specific TPM with a specific system, which is basically everywhere except enterprises. But maybe that doesn t matter and cheaters wouldn t be willing to spend the $20 or so it d take to produce one of these things? That would seem somewhat surprising, but it s not impossible. And obviously any server-side cheat detection that triggers could then block that specific TPM, meaning they d need to go and get another TPM, and maybe that ends up being enough to discourage people from bothering. From a practical level, this may be sufficient. But at a technical level? It s not great.
Review: Ties That Bond in Gretna Green, by Linzi Day
Series:
Midlife Recorder #3
Publisher:
Linzi Day
Copyright:
February 2023
ISBN:
9798376517017
Format:
Kindle
Pages:
616
Ties That Bond in Gretna Green is a self-published fantasy novel
and the third book in the Midlife Recorder series. As with the previous
book, it picks up almost immediately after Painting the Blues in Gretna Green. Day calls the genre
paranormal women's fantasy, and that sounds about right to me.
There is an intervening short story that you can get by
joining Day's mailing list (along
with an epilogue to the first book and to this book). I don't think it's
that important, but there are frequent references to it at the start of
this novel that become somewhat annoying if you haven't read it.
Valentine's Day is fast approaching. This the busiest day of the year for
the part of the Recorder's job that Niki already knew how to do: marrying
people. She performed marriage ceremonies in her previous job before her
inheritance, and she loved that work despite her awful boss. Performing
marriages in the Gateway sounds even more rewarding, but the sheer number
of couples and the political complications from the first two books create
logistical problems she has to solve first.
Also, the remaining member of her staff held over from her grandmother's
time has returned from vacation to discover that Niki has upended most of
what she thought she knew about the job. Time for Niki to apply what she
learned from the change management training her old boss forced her to
attend and then ignored! (If you just groaned, rest assured that Day
somehow makes this work, although she clearly has a higher opinion of
corporate training than I do.)
This plot was more to my taste than Painting the Blues, mostly
because Niki seemed on top of the problems and didn't postpone looking at
them for half the book. There is more of the management competence porn
that readers have come to expect of the series, a few more revelations
about Niki's magic, more mysterious manifestations and the first mention
of a prophecy, and a few political developments. As always, the pacing is
exceptional. These books grab me and pull me along, page after page, often
robbing me of sleep because I find them nearly impossible to put down.
Ties that Bond (and to some extent the last book) looked like it
was going to introduce a romantic subplot, and I was preparing to be
annoyed by it because I did not like the man in the subplot at all. I
won't spoil how it works out in this book, but I will say that Niki
surprised me and showed more sense than I thought the author was
telegraphing. This is not the first time that Day has surprised me with
what I thought was foreshadowing that did not turn out how I expected,
usually for the better. If she can keep that up, it's a nice effect (if a
bit unbalancing) and adds to my desire to read just one more chapter.
The way the world-building of these books is structured continues to
intrigue me. Day gets away with some problems that I think would be more
noticeable in other books thanks to the excellent pacing (no time to ponder
the world-building, we're on to the next crisis!) and the tight
third-person perspective. Niki is not a detail person, to say the least,
but she does keep returning to bits of world-building and poking at them a
bit harder, which gives Day repeated opportunities to shore up ideas that
felt shaky and dubious at first glance. Still, this is not a book that
prizes deep logical consistency or full exploration of the ramifications
of a bit of magic. You have to be willing to go along with the ride and
not think too hard.
For example, Niki can see bonds between couples and judge their strength.
This is apparently a long-standing power of the Recorder's line (she was
able to do that before she became the Recorder), and part of her
responsibility in these weddings is to check the bonds of the couples.
This leads to some well-handled scenes where she diagnoses a problem or
resolves a conflict because she can magically see the true relationship
structure.
Everyone in the book just takes this power in stride. This is wild to me!
This ability would completely upend half of society if you fully worked
out its ramifications and could find people other than Niki with the same
ability. Even if one assumes that a bond only forms over time and can't be
sensed in the early stages of a relationship (something the book never
establishes), can you imagine the implications of having an infallible
oracle that says at a glance whether a marriage will work (permanently,
the book strongly implies)? The implications for how to structure
marriage, for family planning, for psychology and psychiatry, for how to
structure dating, even for living arrangements and housing markets? This
is not a small world-building detail, and yet it's treated more like part
of Niki's characterization than like a foundation of society.
I think some of this all-vibes world-building may come from the general
new-age feel to how magic works. Day makes a grab-bag of random magic
canonical in this world: psychic lie detecting abilities, auras, chakras,
premonitions, and other bits of the sort of spiritualism that tends to be
heavily marketed to middle-class women. I have that niggling feeling that
one sometimes gets in SF that a lot of this is in the world-building
because the author believes it's partly real (see, for instance, psychic
powers and the Dean drive in 1960s science fiction). If one believes that
psychic powers and various bits of mysticism are true in our world, one
has already developed the rationalization mechanisms to explain away their
almost total lack of influence or impact on how the world is structured.
If one then introduces them into a true fantasy world, one may not notice
how many implications that should have for how society is structured,
since one is used to believing magic exists but has no significant
implications.
I could be entirely wrong about this analysis, and maybe it's a bit unfair
to Day. I should also be clear that this is not a complaint, just a point
of fascination to me when I think back over one of these books after I
finished it. There is a glut of fantasy out there that's constructed like
an engineering problem or that goes deep into politics or social theory,
usually written by people with strong opinions but not a lot of training
in real sociology. One of the joys of self-published books is that you
occasionally get something that assembles genre conventions in a way that
feels odd and delightfully strange. What if, in addition to dimensional
gates and overwhelming protean power invested in a true heir, all the
magic sold by the local Tarot and crystal store was also true? Sure, why
not! If the pacing is good and the story is grabby, it works for me.
It does seem worth attaching a warning for the folks who need scientific
reproducibility and explored implications in their world-building, though.
If you're the sort of reader who is bothered by political boundaries and
economic systems that match our world despite the existence of magic, this
series may cause you problems.
This continues to be a grabby, highly entertaining story of a woman who
finally gets to run her own small business the way that she always thought
the business should be run after years of working for an awful manager,
except that her business is total magical power over an interchange point
between dimensions, she's the chosen one, and the setting is a high
fantasy world with prophecies and gods. If that sounds appealing, don't
start here, but I highly recommend giving Midlife in Gretna Green a try. The series seems to be holding up.
Followed by a short story epilogue available by joining Day's mailing
list, an optional novella (maybe novelette) published in Spilling
the Tea in Gretna Green, and then Seeing Red in Gretna Green.
Rating: 7 out of 10
Welcome to the August 2026 report from the Reproducible Builds project!
In our reports, we try to outline the most important things that we have been up to over the past month. As a quick recap about what problem our project intends to solve, whilst anyone may inspect the source code of free software for malicious flaws, almost all software is distributed to end users as pre-compiled binaries. The motivation behind the reproducible builds effort is to ensure no flaws have been introduced during this compilation process by promising identical results are always generated from a given source, thus allowing multiple third-parties to come to a consensus on whether a build was compromised or not.
In this month s report, we cover:
New updated SBOM specification from CISA.gov
CISA, the Cybersecurity and Infrastructure Security Agency of the U.S. government published some the joint guidance entitled Minimum Elements for a Software Bill of Materials (SBOM), which updates and supersedes the baseline 2021 version covered in previous editions of these reports.
Whilst the PDF is worth skimming, the interesting changes include that the specification now mandates standard cryptographic hashes: unlike earlier standards that allowed hash omission or manifest-only parsing, hashes must be computed from the output. This is is important for reproducible builds, as it ensures the recording of the metadata required to demonstrate the shipped software matches the build output precisely where applicable. In addition, where the top-level only dependency limitation that was present in the 2021 version has been removed in favour of complete coverage with no minimum depth. That is, SBOMs are expected to reflect all linked libraries, vendored dependencies and other build-time inclusions.
The basic idea behind bootstrappable builds is to create a system that can be built without relying on pre-built artifacts. Can we go from zero to the modern day without having to just assume the existence of these already-built-for-us artifacts? The classic recipe for yogurt requires some yogurt to start the process, which is like how we normally build a C compiler today we start with an existing C compiler binary. You might think about making sourdough bread with your grandmother s starter brought over from the old country; we re basically making C compilers with Dennis Ritchie s starter carried over from Bell Labs .
The reason I like the idea of making reproducible builds work is that I think it can be done in such a way as to not require any work on the part of the producer of a distribution (which is a technical term for sdists or wheels, i.e., the people who upload stuff to PyPI), and thus make reproducible builds very low-friction for people to opt into supporting. []
Brett goes on to outline What s missing from the specs and how reproducibility might be visible on PyPI to consumers:
Assuming all of this comes to pass and we record the where the source code is that went into a distribution and the software used to make the distribution, how do we make it useful to people? Does every person who cares about having a secure supply chain have to rebuild everything they use themselves? Is there some way for even people who don t care about this stuff to benefit? []
Distribution work
In Debian this month, 23 reviews of Debian packages were added, 28 were updated and 27 were removed this month adding to our knowledge about identified issues. A number of issue types have been updated as well, such as the addition of a new toolchain issue related to python-traitlets [], and the note for an existing issue related to texi2html was updated as well [].
Lastly, Bernhard M. Wiedemann posted another openSUSEmonthly update for their reproducibility work there.
Unreproducible builds under EROFS filesystem fixed
Martin Pitt reported on Fosstodon that they had identified an issue where the mkfs ( make filesystem ) command for the EROFS (Enhanced Read-Only File System) subsystem of the Linux kernel did not have sorted extended file attributes, leading to reproducible builds.
Thankfully, Martin also reported that they had fixed this in a commit to the kernel which order[s] each inode s xattrs by name so that images stay reproducible . []
Tool and documentation development
diffoscope is our in-depth and content-aware diff utility that can locate and diagnose reproducibility issues. This month, Chris Lamb made a number of changes, including preparing and uploading versions 327, 328 and 329 to Debian. In particular, he ensured that diffoscope did not require python3-guestfs in the autopkgtests on 32-bit architectures in order to fix Debian bug (#1144372) []. Colin Watson made an additional change, handling a potentially missing openssh-client package when running the autopkgtests [], and Jochen Sprickerhof made a similar change to cope with missing cpio and qemu-img functionality [] whilst also updating the XML comparator to be considered when comparing SVG images [].
Yet again, there were a number of improvements made to our website this month as well. For example:
Chris Lamb added draft for a Gothenburg summit-related news article. [][]
Lastly, a large number of commits were pushed comprising an interview with Reproducible Builds developer Jochen Sprickerhof to be published within the next week. [][][][][][][]
Six new scholarly papers
Jens Dietrich, Spencer Sun, Tim W. White and Behnaz Hassanshahi (the result of a collaboration between Victoria University of Wellington and Oracle Australia published a paper this month entitled No Snake Oil: Verifying Python Package Builds. Drawing on the metaphor of snake oil , that is, a fake or ineffective medicine or solution sold with exaggerated claims of curing or fixing everything, the authors write that
Two tools that are designed to automate [PyPI] rebuilds and run them at scale are macaron and oss-rebuild. We study 12,180 popular releases from PyPI and find that the byte-for-byte equivalence rate is generally low. We analyse the reasons why they produce different wheels, and find that equivalence between the original and rebuilt wheels can often still be established, preserving most of the guarantees users expect from rebuildable releases. We present and evaluate daleq4py, a tool to establish the equivalence of Python wheels through the kernel of a normalisation function that is based on provenance-preserving datalog rules. Experimental results show that daleq4py substantially expands the set of rebuilds that can be accepted as equivalent.
pose a persistent threat to opensource software. Known attempts to inject such backdoors into widely used projects through malicious commits, tampered release packages, or compromised third-party dependencies, were stopped only by luck and manual review. Existing Continuous Integration (CI) pipelines cannot detect these attacks, and downstream binary analysis tools require substantial manual effort. In this work, we present Lily, an automated approach that strengthens open-source development and release processes against backdoor injection. Lily integrates a backdoor detection mechanism into (1) CI pipelines to block malicious commits, and (2) release vetting workflows to prevent tampered releases or compromised dependencies from entering large ecosystems, such as Linux distributions.
The full PDF can be read online.
Ranindya Paramitha and Laurie Williams of North Carolina State University along with Christian K stner of Carnegie Mellon University published a paper this month with the title of The Software Supply Chain as a Market for Lemons: A Multivocal Review of Trust Signal Collapse. (A lemon in American English, is a vehicle that turns out to have several manufacturing defects .) Their abstract is as follows:
Practitioners evaluating open-source dependencies rely on cheap trust signals, e.g., stars, download counts, and contributor activity, as substitutes for direct code inspection, assuming those signals reflect genuine trustworthiness. Prior work has documented individual signal gaming, but the landscape of collapses across all dependency-adoption signals, as well as the ecosystem s response, remains unexplored. The goal of this study is to aid software practitioners in understanding the reliability of dependency adoption trust signals, such as download counts and contributor activity, by conducting a multivocal review of 252 Google Search sources and 870 Reddit threads.
Worryingly, after their review, the authors conclude that cheap trust signals collapse under three simultaneous forces: adversarial manipulation, gaming techniques indistinguishable from legitimate behavior, and non-adversarial AI-driven inflation.
The full PDF of the paper is available online.
Julien Malka, Aman Sharma, Martin Monperrus, Stefano Zacchiroli and Th o Zimmermann published a paper this month on Trusting-Trust Attack against an Entire Linux Distribution through Binary Manipulation:
Ken Thompson s trusting-trust attack, in which a compromised compiler backdoors the programs it builds and reproduces the backdoor in subsequent rebuilds of itself, is widely regarded as a threat specific to compilers. We show that it is not. We construct a complete trusting-trust attack around GNU strip, an ordinary build utility that neither inspects nor generates source code, using only manipulations of finished ELF files.
Scarily, in the authors example, a single tampered strip in the binary seed implants a payload that propagates from one generation of strip to the next and survives into the final standard environment after the seed leaves the dependency closure [ ] without failures and backdoors .
A full PDF of the paper is available for download online.
Mehdi Keshanimm, Amirhossein Rahmati, Mohammad Hossein Aref and Abbas Heydarnoori published a paper that is currently under review at Emperical Software Engineering titled AROMA+: A Study of Factors Affecting Reproducible Builds in the Maven Ecosystem. (Maven is a/the build automation tool used for Java projects.) In their paper, the authors note that
[ ] reusing external software in a project presents a security risk when the source of the component is unknown or the consistency of a component cannot be verified. The SolarWinds attack serves as a popular example in which the injection of malicious code into a library affected thousands of customers and caused a loss of billions of dollars. [ ] Our research aims to support [reproducibility] efforts in the Maven ecosystem through automation. We investigate the feasibility of automatically finding the source code of a library from its Maven release and recovering information about the original release environment. Our tool, AROMA+, can obtain this critical information from the artifact and the source repository through several heuristics and we use the results for reproduction attempts of packages on Maven Central.
[A]rtifact verification requires more than deterministic builds: a verifier must also recover the source state, build environment, dependencies, and build instructions that produced the artifact. Decentralized-build ecosystems make this difficult because artifacts are produced through heterogeneous tools, maintainer-controlled workflows, and fragmented metadata. As a result, it remains unclear how often artifacts in these ecosystems can be independently verified. This paper studies artifact verifiability across four popular decentralized-build package ecosystems. We define an independent verifier model that relies only on registry-derivable metadata and an artifact comparison model with tiered equivalence levels. We implement these models in an Artifact Verification Pipeline and use it to measure artifact verifiability across the target ecosystems.
The authors conclude that beyond build determinism, verifiability is limited by missing source and build metadata, implicit release transformations, and unconventional build practices .
A PDF of their paper can be reviewed online.
Patches
The Reproducible Builds project detects, dissects and attempts to fix as many currently-unreproducible packages as possible. We endeavour to send all of our patches upstream where applicable or possible. This month, we wrote a large number of such patches, including:
My Debian contributions this month were all sponsored by Freexian.
You can also support my work directly via Liberapay or GitHub Sponsors.
Personal note
This month, my Dad unexpectedly passed away after a short illness. As a result I obviously got less work done than usual, and I still have a lot to take care of (since I m the executor of his will, as well as helping with funeral arrangements) while grieving and generally having less focus and energy. Having routine work to do is one of the ways I cope with this sort of thing, but all the same, I hope people will bear with me and maybe remind me if I seem to be dropping the ball on something you especially need.
LLM vote
[Content note: strong opinions.]
I voted in General Resolution: LLM usage in Debian. My vote was pretty much the opposite of what ended up winning, so I m quite disappointed. My personal opinion is that LLMs are cognitive hazards to their users that impose ecological costs far out of proportion to their utility at a time when the world absolutely cannot afford them. When the impossible economics of the large commercial models are finally allowed to catch up with reality, I expect there to be significant macroeconomic consequences, and that people who have become dependent on them will have problems; and who knows what the copyright situation on their output really is. I m not convinced that local models are better enough on these axes to be worth the costs.
Debian s direct contribution to all that will be negligible on a global scale, and even the most radical proposals in the GR didn t expect that we could do much about upstreams that have gone all-in on LLMs. Even so, I d hoped that my fellow developers might be more willing to lean on our position in the free software ecosystem to make at least a moderately radical statement. Instead, we ve at best presented an undistinguished fence-sitting position to the world, and further entrenched the idea that humans can reliably do a good job of reviewing the output of tools that are designed to produce output plausible to humans. I certainly don t trust my own code review skills that far.
Since I ve never voluntarily used an LLM (not counting LLMs being foisted on me by things like search results, support chatbots, or incoming pull requests, regardless of whether I asked for them), and don t intend to for the foreseeable future, I doubt this will change much for me in terms of the way I work. The winning option is a very weak one that imposes no new requirements on developers, which means that it also does nothing to stop me continuing to reject LLM-generated material from Debian bug reports and merge requests in my areas of responsibility. I know this probably won t do much to satisfy people who have decided that Debian is slop now, but it s the best I can do.
OpenSSH
I finally landed the GSS-API key exchange package split in our OpenSSH packaging. Here s the NEWS entry:
I fixed a flaky autopkgtest.
I upgraded from 10.4p1 to 10.5p1, which was a good test of keeping openssh and the new openssh-gssapi source package in sync.
PuTTY
I upgraded from 0.84 to 0.85.
Python packaging
New upstream versions:
The version treadmill continues: we ve just finished dropping Python 3.13 as a supported version, so now we ve started working on enabling Python 3.15 as a supported version. Maximiliano Curia has been very helpfully driving this. I didn t get as much done here as I d have liked (see the top of this post), but I fixed a couple of packages:
This August, I accomplished what I wanted for many years: I deleted the last cgo
dependency in Debian Code Search! This was made possible by Go s recently
introduced SIMD support, because now we can implement the TurboPFor integer
compression format as efficiently more efficiently, in fact, by using the
newer AVX512 instruction set! as the reference implementation.
Background: Why does DCS need a fast Integer Codec?
Debian Code Search (DCS) is a search engine that allows searching all the Open
Source source code within Debian, with either literal search expressions or
regular expression search queries.
A search engine uses an inverted index: a map from term to documents containing
the term. Each document is typically represented most efficiently by using an
id, so the index consists of many lists of document ids.
When searching, it is important to quickly decode these lists to answer the
search query. However, there is a point of diminishing returns where the
decoding speed, even though it can still be measurably improved quite a bit, no
longer influences the overall query duration.
From 2012 (its inception) to 2019, Debian Code Search used to use a small index
format, and queries were fast because the index was kept entirely in RAM. In
2019, I implemented the new index
format, which adds an
on-disk positional index. For literal queries (78.2% of DCS queries), querying
the positional index on disk is faster than querying the non-positional index in
RAM.
The efficient encoding of the TurboPFor format makes it possible to fit such an
index on a mid-sized Hetzner server, which I rent with two 1 TB SSD disks. The
optimized decoder of the C TurboPFor library is what made decoding fast at query
time.
If you want to dive deeper into the algorithm, see this blog post from February
2019:
Use a C library via cgo so gcc or clang compiles
SIMD code. Debian Code Search used to use the
powturbo/TurboPFor
C library via cgo for the last 7 years.
The C TurboPFor library has served us well, but Debian Code Search was always
intended to be a project using Go, so I would prefer it if I did not have any C
code in the project.
Go 1.26 (released in February 2026) introduced the simd/archsimd package:
Go 1.26 introduces a new experimental simd/archsimd
package, which can be enabled by setting
the environment variable GOEXPERIMENT=simd at build time. This package
provides access to architecture-specific SIMD operations. It is currently
available on the amd64 architecture and supports 128-bit, 256-bit, and
512-bit vector types, such as Int8x16 and Float64x8, with operations such
as Int8x16.Add. The API is not yet considered stable.
Go 1.26 Release Notes
For my 2019 TurboPFor analysis, I implemented goturbopfor, a native Go
teaching decoder (without any SIMD),
because I find Go code easier to follow than C code, especially optimized C
code. My implementation was intentionally not optimized so that the code was
easier to study.
The TurboPFor format/algorithm has a vector-optimized part: bitpacking comes in
a scalar variant (bitunpack32) and a vector variant
(bitunpack256v32),
where the vector variant is used for full blocks (256 values) and the scalar
variant is used for remainder blocks (< 256 values).
When Go 1.26 was released, I used Claude Code to explore whether my native Go
decoder s bitunpack256v32 function (for the vertical vector layout) could be
implemented using Go SIMD, and the answer was yes, it was possible and it was
faster than without SIMD, but not quite at the level of C TurboPFor. If you let
Claude Code try for long enough, it eventually finds enough optimizations (about
10) to match C performance.
I don t want to vibe-code Debian Code Search, though, so I figured I would find
some time to review the SIMD code at some point and see if I could implement
something similar myself.
Before I found enough time and motivation to complete said review, I discovered
that to not regress real-life query performance by more than 10 to 100
milliseconds (which seems acceptable), I don t actually need to add SIMD code to
my teaching decoder at all; it would be sufficient to reduce allocations in my
teaching decoder and specialize it per bit width.
Encouraged by the possibility of using the optimized native Go decoder in Debian
Code Search, I explored whether I could also implement a native Go encoder so
that I could get rid of the C TurboPFor dependency entirely. The answer is yes,
it is doable in a few days, and it isn t even that much slower: Go is at 76% of
C, see Debian/dcs commit
e920dc7.
The goal I set myself at that point was to see if I could learn enough SIMD to
optimize the native Go encoder such that its performance would match how DCS
uses C TurboPFor (via cgo).
Beating C TurboPFor was possible in 2-3 commits (SIMD and bit width
specialization). To my surprise, Claude Fable 5 pointed out that the encoder s
block scanning could be done more efficiently using a technique called
positional popcount, and that is another 2x speed-up!
To be clear: I am not saying the Go compiler beats C here. Certainly, the C
compiler can also produce fast AVX512 code and can be used to implement
positional popcount. When comparing apples to apples, i.e. backporting the
AVX512 kernels and positional popcount technique to C TurboPFor, Go benchmarks a
little slower at 1.4x C.
This spectacular result (much faster than what DCS had before) got me curious
how far I could push the decoder with SIMD after all. I ended up
matching/exceeding the cgo version here, too!
The rest of this article explains a few classes of optimizations I encountered
along the way.
Starting Point
When I wrote my goturbopfor teaching
decoder, I named its functions to
match the upstream C TurboPFor library, but now I want to get away from names
like p4ndec256v32 they make sense from the TurboPFor perspective, but for
Debian Code Search, we can use cleaner names.
Before writing any code, I audited how DCS uses integer compression /
decompression.
API design: BlockEncoder, BlockDecoder and streaming
In Debian Code Search, we have the following usage patterns:
Partial Indexing: When a new package (or package version) enters Debian,
all of its (text) files are indexed. If the hello-2.12.3-1
package (hypothetically) contained
only hello.c with printf("hello!\n");, we would assign document ID 1 to
hello.c and store in the partial index that trigrams pri, rin, int,
ntf, etc. are all found in doc 1 (hello.c).
Full Index Merging: The many thousands of partial index files (for each
Debian package) are combined into a small handful of large index files: When
searching, it would be expensive to consult thousands of indexes. To merge
multiple partial index files into one larger index (which can then be
efficiently queried), we need to re-encode the partial index files: what used
to be document ID 1 in the partial index might be document ID 2531 in the
full index.
Querying (searching): When users enter search queries, these queries need
to be answered as quickly as possible. The relevant entries in the full
indexes are decoded (in parallel).
For reading the index, we do keep the decoded uint32s fully in memory, so we
only need DecodeN(input []byte, output []uint32) (read int), a function that
reads len(output) values (uint32) from input and returns how many bytes it
consumed.
For writing the index (both in partial indexing, and when merging), keeping the
entire index in memory is prohibitively expensive, so we need a streaming API,
for decoding and for encoding.
Ultimately, I converged on the following API:
packagepforenctypeBlockEncoderstruct// scratch buffers can go here// EncodeBlock encodes len(vals)<=256 uint32s into dest (one TurboPFor block).func(*BlockEncoder)EncodeBlock(dest[]byte,vals[]uint32)[]byte// EncodeN calls EncodeBlock in a loop.func(*BlockEncoder)EncodeN(dest[]byte,vals[]uint32)[]bytetypeStreamEncoderstructbeBlockEncodervals[256]uint32// scratch buffers// if full, you need to call [EncodeBlock]func(*StreamEncoder)Add(valuint32)(fullbool)// EncodeBlock must be called after all data was [Add]ed.//
// Write the returned buffer to file or send it over the network;// it is only valid until the next [EncodeBlock] call.func(*StreamEncoder)EncodeBlock()[]byteifse.n==0returnnil// turn an extra EncodeBlock into a no-op//
This API (the decoder works similarly) allows us to process data in TurboPFor
format without any memory allocations. The types are not safe for concurrent use
by multiple goroutines. The zero value is ready to be used. For the streaming
API, the result only stays valid until the next call.
Initial Implementation
Before we can optimize anything, we need a working decoder and encoder. The
decoder already exists: my goturbopfor teaching decoder. Next up, I needed an
encoder.
Writing a TurboPFor encoder has a delightfully simple starting point: You can
encode all values at bit width 32, in little endian, at which point you only
need to add a one-byte TurboPFor block header every 256 values and you re done:
Of course, this is a terribly inefficient compressor, so after the first commit,
the real work starts: implement each block type until the compression matches
the original C TurboPFor implementation (same output file size), or in other
words: do the reverse of the decoder.
The TurboPFor bitpacking block type (bitpacking implementation
commit)
encodes a bit stream of variable bit width (where the bit width is in range
0 bitWidth 32) in little
endian byte order. By scanning all
values and choosing the smallest bit width that allows representing all
values, this technique saves disk space (compresses).
The bitpacking with exceptions block type (bitpacking with exceptions
implementation
commit)
determines two bit widths: one for values, the other bit width for encoding
exceptions. This allows choosing a lower bit width (that does not cover all
values) compared to the bitpacking block type. A bitmap encodes whether a
value has an exception or not.
The bitpacking with VB exceptions block type (bitpacking with VB
exceptions implementation
commit)
is a variant which does not use an exception bitmap and encodes exceptions
using a variable byte integer encoding. This is more efficient when there are
few exceptions (less than 20) or the exceptions are very different in bit
width compared to the other values.
Lastly, the constant block type (constant implementation
commit)
stores just one value on disk. This is useful for all-zero or all-one blocks,
for example.
I found it interesting to realize that the main work of the encoder is to scan
the input values and choose the optimal block type, whereas the actual encoding
itself is cheap in comparison.
At this point, we can look at
performance
and see that the Go encoder is at 76% of the C encoder.
In all honesty, I could have probably stopped here, but now that the milestone
of a viable replacement was reached, I got curious to see how far it would be
possible to push the encoder (how much work to reach C speeds?) and afterwards,
the decoder, too.
Setup
The microarchitecture level: set GOAMD64
The microarchitecture of a CPU determines which instructions it provides, and
that includes not just SIMD instruction sets (like AVX2), but also other useful
instructions like LZCNT (Leading Zero Count), which can be used to implement
math/bits.Len32 more efficiently, which
the TurboPFor encoder needs to call on every input value to determine the ideal
bit width.
Let s walk through how to set the microarchitecture level when using Go on
64-bit x86 (x86-64).
Go uses the GOARCH environment
variable to configure the target
compilation architecture, and I am using the value amd64 to select 64-bit x86
(AVX2 and AVX512 are instruction sets found on x86-64 CPUs). With
GOARCH=amd64, the architecture-specific variable
GOAMD64 configures the
microarchitecture level for which to compile and Go 1.18 introduced these 4
different levels:
GOAMD64=v1 (default): The baseline.
Exclusively generates instructions that all 64-bit x86 processors can execute.
GOAMD64=v2: all v1 instructions,
plus CMPXCHG16B, LAHF, SAHF, POPCNT, SSE3, SSE4.1, SSE4.2, SSSE3.
GOAMD64=v3: all v2 instructions,
plus AVX, AVX2, BMI1, BMI2, F16C, FMA, LZCNT, MOVBE, OSXSAVE.
GOAMD64=v4: all v3 instructions,
plus AVX512F, AVX512BW, AVX512CD, AVX512DQ, AVX512VL.
In 2026, I generally recommend compiling with GOAMD64=v3 so that functions
like bits.OnesCount8 are
compiled into intrinsics
(POPCNT)
instead of using a lookup table.
For Intel CPUs, setting GOAMD64=v3 means your programs will only start on
Haswell CPUs (2013) or newer; for AMD CPUs that means Zen 1 (2017) or newer.
In this specific case (DCS), I am even compiling with GOAMD64=v4. The v4
microarchitecture level requires AVX512, which means AMD Zen 4, Zen 5 or newer
(Intel s story is complicated). Luckily, both my main development PC (Zen 5)
and the Debian Code Search server (Zen 4) are recent enough. Setting
GOAMD64=v4 has little effect on Go 1.27 itself: the only change is that maps
use one less instruction (VPBROADCASTB instead of PSHUFB). But compiling
with GOAMD64=v4 allows us to move one more feature check from runtime to
compile time, see SIMD build tags.
It makes sense to set the microarchitecture level in your benchmark setup so
that you don t measure the slow fallback implementations. I use export GOAMD64=v4 in my Makefile.
Benchmarking setup
Go s built-in testing package contains support for
benchmarks which are written in
functions of the form func BenchmarkXxx(b *testing.B). The simplest way to run
such benchmarks is go test -bench=., but I ended up configuring a few
convenience make targets, which write results to bench.txt and compare
against baseline.txt (the previous commit s results, usually), using the very
useful benchstat tool.
GOTEST=go test# -count=6 gives p 0.002 in benchstat:
# https://pkg.go.dev/golang.org/x/perf/cmd/benchstat
BENCHFLAGS=-run=^$$ -bench=. -benchtime=200000x -count=6# use taskset -c1 to always pin to the same single core,
# avoiding accidental scheduling on different cores on
# mixed-core CPUs like the Ryzen 9 9950X3D.
TASKSET=taskset -c 1BENCH=$(TASKSET)$(GOTEST)$(BENCHFLAGS).PHONY: all test bench bench-baseline bench-relative
all: test
bench: test
$(BENCH) tee bench.txt
# Compares compression ratio between C and Go implementation
benchstat -col /impl -row '/n /vals' -filter '-/impl:go-stream .unit:(encoded-bytes)' bench.txt
# Compares performance between C (cgo) and Go implementation
benchstat -col /impl -row '/n /vals' -filter '.unit:(Mval/s)' bench.txt
bench-baseline: test
$(BENCH) tee baseline.txt
bench-relative: test
$(BENCH) tee bench.txt
benchstat -filter '-/impl:go-stream .unit:(encoded-bytes)' baseline.txt bench.txt
benchstat -filter '/impl:go .unit:(Mval/s)' baseline.txt bench.txt
The encoded-bytes and Mval/s units are custom metrics I am reporting from
the various sub-benchmarks, which are arranged
such that I can filter / report them with benchstat.
The main encoder (and decoder) benchmarks compare 3 different implementations
(cgo, Go, Go with the StreamEncoder API) with a number of benchmark
cases
that are designed to cover the different block types and contain a similar mix
of values as what we see in Debian Code Search:
// reportMetrics adds Mval/s and encoded-bytes metrics to all benchmarks.funcreportMetrics(b*testing.B,nint,nencodedint)b.ReportMetric(float64(nencoded),"encoded-bytes")b.ReportMetric(float64(b.N*n)/1e6/b.Elapsed().Seconds(),"Mval/s")// BenchmarkEncode/n=<N>/vals=<testcase>/impl=<c go go-stream>//
// e.g. BenchmarkEncode/n=2048/vals=one-constant/impl=go-streamfuncBenchmarkEncode(b*testing.B)for_,tc:=rangeallBenchCases()n:=len(tc.vals)b.Run(fmt.Sprintf("n=%d/vals=%s",n,tc.name),func(b*testing.B)b.Run("impl=c",func(b*testing.B)b.ReportAllocs()varencoded[]bytebuf:=make([]byte,turbopfor.EncodingSize(n))forb.Loop()encoded=turbopfor.P4nenc256v32Buf(buf,tc.vals)reportMetrics(b,n,len(encoded)) )b.Run("impl=go",func(b*testing.B)b.ReportAllocs()varbeBlockEncodervarencoded[]bytebuf:=make([]byte,0,turbopfor.EncodingSize(n))forb.Loop()encoded=be.EncodeN(buf,tc.vals)reportMetrics(b,n,len(encoded)) )b.Run("impl=go-stream",func(b*testing.B)b.ReportAllocs()varseStreamEncodervarencodedintforb.Loop()encoded=0for_,val:=rangetc.valsifse.Add(val)encoded+=len(se.EncodeBlock())encoded+=len(se.EncodeBlock())reportMetrics(b,n,encoded) ) )
CPU counters: perf
Go has included excellent performance tooling for many years, see the
Profiling Go Programs blog post (2011) for an
example of how to use pprof, a sampling profiler. This profiler can help track
down which part of a program runs slow, or where memory allocations happen.
Once you identified the slow part of a program, how do you know why it s slow?
To learn more about the specific bottlenecks your program encounters, you can
consult your CPU s hardware performance
counters. For
example, you could check the branch
predictor counters to see if
your program is slow due to a high number of branch mispredicts.
On Linux, the perf tool is the best way to access the CPU hardware performance
counters. A good starting point for working with perf is the documentation on
Top-down analysis with the perf
tool , which describes the
optimization method that Intel established.
In my Makefile, I set up two perf targets:
# GOTEST and TASKSET like shown in the earlier benchmarking setup section:
GOTEST=go test -pgo=encode.cpuprof
TASKSET=taskset -c 1PERFBENCHFLAGS=-test.bench='Encode/n=2048/vals=debian-mix/impl=go$$' -test.benchtime=200000x
# Use perf(1) to capture AMD IBS (the equivalent to Intel PEBS)
# PipelineL1 is roughly equivalent to Intel TopdownL1
perf:$(GOTEST) -c
$(TASKSET) perf stat -M PipelineL1 ./pforenc.test -test.run=^$$$(PERFBENCHFLAGS) sudo perf record -F 4999 -e ibs_op// --call-graph fp ./pforenc.test -test.run=^$$$(PERFBENCHFLAGS) sudo chmod 644 perf.data
# 488281 iterations 2048 values = 1.000e9 values, so counter/1e9 = per value.
perf-per-value:$(GOTEST) -c
$(TASKSET) perf stat -x, -e cycles:u,instructions:u,branches:u,branch-misses:u ./pforenc.test -test.run=^$$ -test.bench='Encode/n=2048/vals=debian-mix/impl=go$$' -test.benchtime=488281x 2>&1 >/dev/null awk -F, ' printf "%-16s %6.2f /val\n", $$3, $$1/1e9 '
The perf-per-value numbers are high level numbers that indicate how much work
the implementation is doing. Reducing the number usually increases speed.
To see the counters for each instruction (and source code lines), I use make perf, followed by perf report. A quick shortcut is perf annotate, which
directly shows the hottest function.
Optimizations (scalar)
Let s first see how far we can get without reaching for SIMD instructions.
(The examples are not necessarily in commit order, but cherry-picked for clarity.)
Profile-Guided Optimization (PGO)
PGO stands for Profile-Guided Optimization and is a feature that Go introduced
as a preview in Go 1.20 (released in February 2023) and shipped as ready for
general production use in Go 1.21 (released in August
2023).
The idea is to capture a CPU profile that records where your program spends most
of its CPU time, which you then provide to the Go compiler to give it more data
to make better decisions.
Most importantly, this way the Go compiler can inline functions much more
aggressively than its usual heuristics allow,
which does have a measurably positive effect in my series of optimization
commits. Another optimization that a PGO profile allows the compiler to do is
conditional devirtualization but
our TurboPFor code does not use any interfaces.
My strategy is to enable PGO before doing any other optimizations, so that we
have the full inlining budget available that PGO gives us, and can measure the
effect of other commits clearly.
Surprisingly, turning on PGO actually decreases our
performance
(-13% geomean), but a closer investigation reveals that we just got unlucky. Let
me explain.
Aside from inlining and conditional devirtualization, PGO also influences
alignment: The Go compiler sets PCALIGNMAX(64, 31) on the first block of a
loop (the loop body ) for all loops in hot functions (per the PGO profile),
i.e. Go will insert up to 31 bytes of padding to make the block land on a
64-byte boundary. Documentation like AMD s Software Optimization Guide for the
AMD Zen5 Microarchitecture (2024,
#58455) explicitly recommends aligning hot loops that way:
[ ] for hot loops, some further knowledge of trade-offs can be
helpful. Because the processor can read an aligned 64-byte fetch block every
cycle, it is suggested to either align the start of the loop to the beginning
of a 64-byte cache line [ ]
Indeed, when compiling with -gcflags=all=-d=alignhot=0 to disable the
alignment, performance remains as good as without PGO. How can the padding hurt
more than help? The answer is: It s not the padding itself! It s a side-effect
of the padding moving instructions to different addresses.
In the unlucky arrangement, a macro-fused CMPQ+JGE instruction pair now ends
up exactly on a 32-byte boundary. However, the Go compiler ensures fused
branch sequences must never cross or end at a 32-byte boundary to fix Intel
erratum
SKX102
(discussion: Go issue #35881) by
inserting NOPs.
This NOP padding, unlike the loop alignment padding, is not free; these extra
instructions slow down our otherwise dispatch-bound loops.
Because the commits after the PGO enabling commit change the code, this unlucky
situation is avoided for the rest of the optimization series (by chance).
Reducing memory allocations
Memory allocations are quite expensive, at least in comparison to
encoding/decoding integers, so I followed my usual strategy of first reducing
memory allocations as much as possible.
In my goturbopfor teaching decoder, whenever the code needed a scratch buffer,
it would allocate it right then and there with make():
// p4dec32 decodes one block of TurboPFor-encoded 32 bit intsfunc(d*decoder)p4dec32(input[]byte,output[]uint32)(readint)// switchblockTypecaseblockBitpackingExceptions:bx,input:=input[0],input[1:]n:=len(output)exmap:=inputnex:=0// number of exceptionsfori:=0;i<n;i++ifexmap[i/8]&(1<<uint(i%8))!=0nex++input=input[(n+7)/8:]exceptions:=make([]uint32,nex)input=input[bitunpack32(input,exceptions,bx):]input=input[d.bitunpack(input,output,b):]fori:=0;i<n;i++ifexmap[i/8]&(1<<uint(i%8))!=0output[i]+=exceptions[0]<<bexceptions=exceptions[1:]returnbefore-len(input)
The Go compiler can turn make(T, n) calls into stack allocations, if n is
known at compile-time. But, in this case nex is not known at compile-time. We
can verify that Go calls into the runtime (runtime.makeslice) by dumping the
object code (assembly) with source annotated (-S):
An easy speed-up was to avoid allocations through
reuse
(in goturbopfor). In the DCS pfordec package (with the improved
API design), I ended up with a vals [256]uint32 field in the StreamDecoder
type, which brings us from 773 Mval/s to 858 Mval/s on the debian-mix:
Aside from the speed-up, avoiding memory allocations is generally nice in
benchmarks because it removes the garbage collector from the equation and makes
it less likely that your benchmarks get other processes OOM-killed on the same
machine.
Generics for bit width specialization
In general, we want to make it easy for the compiler to understand as much as
possible about our algorithm. Consider this bitpack implementation:
Let s think through what determines the iterations and control flow this
function uses:
The number of input values (vals), but not their actual value.
The bit width to pack into (bitWidth).
With a bit of careful rearrangement, we can provide the compiler with both, a
fixed number of input values (say, 32), and a bit width, both known at compile
time. Why is this worthwhile? Because we can manually unroll the loop, let the
compiler eliminate much of the repetition and get much faster compiled code as a
result!
Let s first fix the number of input values to 32 and rewrite the loop to
calculate the position offsets within dest instead of changing dest on each
value (with AppendUint32):
funcbitpack32Unrolled(dest[]byte,vals*[32]uint32,bitWidthint)// only one bounds check for 32 valuesdest=dest[:4*bitWidth:4*bitWidth]mask:=uint32(1<<bitWidth-1)varaccuint64varhave,posint// Manually unrolled loop starts here.// Each iteration is identical except for the vals[x] index.acc =uint64(vals[0]&mask)<<havehave+=bitWidthifhave>=32binary.LittleEndian.PutUint32(dest[pos:pos+4],uint32(acc))pos+=4acc>>=32have-=32// vals[1] .. vals[30] elided for brevity// Each loop iteration is 8 lines of Go code, so for 32 input values,// bitpack32Unrolled contains 8*32 = 256 lines of code.acc =uint64(vals[31]&mask)<<havehave+=bitWidthifhave>=32binary.LittleEndian.PutUint32(dest[pos:pos+4],uint32(acc))pos+=4acc>>=32have-=32// have == 0; for all bitWidths
Next, we want to specialize not just for 32 input values, but also for each of
the 32 bit widths.
Can we do better than hand-copying bitpack32Unrolled 32 times (= 8192 lines of Go code)?
Yes, we can use Go generics to help us with the code generation!
In Go, array types like [4]byte (not
slices like []byte!) contain the length of the array as part of their type,
meaning [1]byte (an array of length 1) is a different type than [2]byte.
Instead of passing the bit width as a function parameter, we can declare 32
different types (one for each bit width) and recover the bit width (at compile
time!) from the type system:
typebitWidthTinterface[1]byte[2]byte[3]byte[4]byte[5]byte[6]byte[7]byte[8]byte[9]byte[10]byte[11]byte[12]byte[13]byte[14]byte[15]byte[16]byte[17]byte[18]byte[19]byte[20]byte[21]byte[22]byte[23]byte[24]byte[25]byte[26]byte[27]byte[28]byte[29]byte[30]byte[31]byte[32]bytefuncbitpack32Unrolled[TbitWidthT](dest[]byte,vals*[32]uint32)varzeroTbitWidth:=len(zero)// known at compile timedest=dest[:4*bitWidth:4*bitWidth]// make cap known at compile timemask:=uint32(1<<bitWidth-1)varaccuint64varhave,posint// Manually unrolled loop starts here.// Each iteration is identical except for the vals[x] index.acc =uint64(vals[0]&mask)<<havehave+=bitWidthifhave>=32binary.LittleEndian.PutUint32(dest[pos:pos+4],uint32(acc))pos+=4acc>>=32have-=32// vals[1] .. vals[31] elided for brevity
When we instantiate bitpack32Unrolled[bitWidthT] with all 32 different types
([1]byte, [2]byte, , [32]byte), the compiler substitutes the bitWidthT
type parameter and produces 32 copies of the function, which we can find in our
compiled executable with names like
github.com/Debian/dcs/internal/turbopfor/pforenc.bitpack32Unrolled[go.shape.[12]uint8]. The
shape of a generic type is based on its memory layout, so a shape for
[1]byte must be different than the shape for [2]byte.
Because the bitWidth is now known at compile time, the Go compiler can
generate close to the optimal machine code for each bit width, which we can
confirm using go tool objdump.
The code is branchless (after the one bounds check per 32 values) and aside from
the loads and stores (from/to memory) consists only of shifts and bit
operations, all with constant operands:
Now we need to actually call bitpack32 from the general bitpack function:
funcbitpack(dest[]byte,vals[]uint32,bitWidthint)[]byteifbitWidth==0returndest// no payload, sparse block with only exceptionsiflen(vals)>=32size:=4*bitWidthforlen(vals)>=32existing:=len(dest)dest=slices.Grow(dest,size)[:existing+size]bitpack32(dest[existing:]/*append*/,(*[32]uint32)(vals),bitWidth)vals=vals[32:]mask:=uint32(1<<bitWidth-1)varaccuint64varhaveintfor_,val:=rangevalsacc =uint64(val&mask)<<havehave+=bitWidthforhave>=32dest=binary.LittleEndian.AppendUint32(dest,uint32(acc))acc>>=32have-=32forhave>0dest=append(dest,byte(acc))acc>>=8have-=8returndestfuncbitpack32(dest[]byte,vals*[32]uint32,bitWidthint)switchbitWidthcase1:bitpack32Unrolled[[1]byte](dest,vals)case2:bitpack32Unrolled[[2]byte](dest,vals)case3:bitpack32Unrolled[[3]byte](dest,vals)case4:bitpack32Unrolled[[4]byte](dest,vals)case5:bitpack32Unrolled[[5]byte](dest,vals)case6:bitpack32Unrolled[[6]byte](dest,vals)case7:bitpack32Unrolled[[7]byte](dest,vals)case8:bitpack32Unrolled[[8]byte](dest,vals)case9:bitpack32Unrolled[[9]byte](dest,vals)case10:bitpack32Unrolled[[10]byte](dest,vals)case11:bitpack32Unrolled[[11]byte](dest,vals)case12:bitpack32Unrolled[[12]byte](dest,vals)case13:bitpack32Unrolled[[13]byte](dest,vals)case14:bitpack32Unrolled[[14]byte](dest,vals)case15:bitpack32Unrolled[[15]byte](dest,vals)case16:bitpack32Unrolled[[16]byte](dest,vals)case17:bitpack32Unrolled[[17]byte](dest,vals)case18:bitpack32Unrolled[[18]byte](dest,vals)case19:bitpack32Unrolled[[19]byte](dest,vals)case20:bitpack32Unrolled[[20]byte](dest,vals)case21:bitpack32Unrolled[[21]byte](dest,vals)case22:bitpack32Unrolled[[22]byte](dest,vals)case23:bitpack32Unrolled[[23]byte](dest,vals)case24:bitpack32Unrolled[[24]byte](dest,vals)case25:bitpack32Unrolled[[25]byte](dest,vals)case26:bitpack32Unrolled[[26]byte](dest,vals)case27:bitpack32Unrolled[[27]byte](dest,vals)case28:bitpack32Unrolled[[28]byte](dest,vals)case29:bitpack32Unrolled[[29]byte](dest,vals)case30:bitpack32Unrolled[[30]byte](dest,vals)case31:bitpack32Unrolled[[31]byte](dest,vals)case32:bitpack32Unrolled[[32]byte](dest,vals)
Encoding remainder blocks is quite a bit faster (full blocks use the vertical
layout anyway):
This performance win comes at the cost of binary size increase. In this case,
the .text section (executable code) grows by about 20 KB and the .gopclntab
section grows by another 26 KB. Definitely a price I am very willing to pay, but
the case might not be as clear in all circumstances.
Optimization: Bigger strides with SIMD
Even without reaching for SIMD instructions, a TurboPFor implementation can be
made faster by making it work bigger strides. Take this code from the
goturbopfor teaching decoder which counts the number of exceptions by checking
if each value s bit is set in the exception bitmap:
caseblockBitpackingExceptions:bx,input:=input[0],input[1:]n:=len(output)exmap,input:=input,input[(n+7)/8:]nex:=0// number of exceptionsfori:=rangenifexmap[i/8]&(1<<uint(i%8))!=0nex++exceptions:=d.scratch[:nex]
We can use the bits.OnesCount64
functions to count ones bits in the exception bitmap, 64 values at a time. For
remainder blocks, the rest is processed 8 values (1 byte) at a time:
i:=0for;i+8<=n/8;i+=8xm8:=binary.LittleEndian.Uint64(exmap[i:])nex+=bits.OnesCount64(xm8)for;i<(n+7)/8;i++xmb:=exmap[i]// Clear the bits which do not belong to the exception map:ifrem:=n-i*8;rem<8xmb&=1<<rem-1// Go compiles OnesCount32 into an intrinsic,// but not OnesCount8, so we convert to uint32:nex+=bits.OnesCount32(uint32(xmb))
OnesCount64 uses a 64-bit register. For comparison, AVX2 SIMD instructions use
256-bit registers (= 8 uint32) and AVX512 SIMD instructions use 512-bit registers.
In the following sections, we will first set up our build tags for conditional
compilation to use a trivial SIMD instruction, then walk through an AVX2 and
AVX512 SIMD kernel.
SIMD build tags
Let s assume we have the following scalar code:
constant.go:
To increase throughput, we can use AVX2 instructions if they are available on the CPU on which the program runs, i.e. using runtime dispatch. We ll first rename fillConstant to fillConstantScalar (it s now the fallback path):
constant.go:
Next, we ll supply two different implementations (constant_nosimd.go and constant_amd64.go), the latter of which is selected when compiling for GOARCH=amd64 with GOEXPERIMENT=simd (the latter will hopefully be dropped in a later version of Go). The nosimd variant just dispatches to the fillConstantScalar, which will likely be inlined:
The constant_amd64.go variant assigns the hasAVX2 global variable by doing a CPUID check and then jumps to the scalar fallback if !hasAVX2, i.e. the CPU is too old:
//go:build goexperiment.simd && amd64packagepfordecimport"simd/archsimd"varhasAVX2=archsimd.X86.AVX2()funcfillConstant(output[]uint32,valuint32)if!hasAVX2fillConstantScalar(output,val)returnval8:=archsimd.BroadcastUint32x8(val)i:=0for;i+8<=len(output);i+=8val8.StoreArray((*[8]uint32)(output[i:i+8]))// use the scalar implementation for the last <= 7 elementsfillConstantScalar(output[i:],val)
We can go one step further by conditionally compiling const hasAVX2 = true
when GOAMD64 is set to v3 or higher (i.e. the amd64.v3 build tag is
set). As a practical example from Debian Code Search, we currently need the
following checks / dispatches:
In regular (non-SIMD) bitpacking, integers are stored on disk one after
the other, padded to a full byte, as a byte is the smallest addressable unit
when reading data from disk. For example, if you bitpack only one 3 bit int,
you will end up with 5 bits of padding.
SIMD bitpacking works like regular bitpacking, but processes 8 uint32
little-endian values at the same time, leveraging the AVX instruction
set. The following
illustration shows the order in which 3-bit integers are decoded from disk:
The scalar implementation uses an array of 8 uint64 to process 8 values at a
time:
funcbitunpack256v32(input[]byte,dest[]uint32,bitWidthint)(readint)mask:=uint64(1)<<bitWidth-1orig:=len(input)varbitsuintvaracc[8]uint64// accumulator: current+next bitsforop:=0;op<len(dest);ifbits<uint(bitWidth)// read 8 more uint32sfori:=range8acc[i] =uint64(binary.LittleEndian.Uint32(input))<<bitsinput=input[4:]bits+=32fori:=range8dest[op]=uint32(acc[i]&mask)op++acc[i]>>=bitWidthbits-=uint(bitWidth)returnorig-len(input)
The SIMD version also processes 8 values, but without a for i := range 8 loop!
One difference is that we no longer have the luxury of using uint64 for acc
(holding rest and current bits); because AVX2 registers only fit 8 uint32 (not
8 uint64). Instead, we split acc into rest8 and cur8.
funcbitunpack256v32(fullinput[]byte,fulldest[]uint32,bitWidthint)(readint)dest:=fulldest[:256]ifbitWidth==0clear(dest)return0n:=32*int(bitWidth)input:=fullinput[:n]// tell the Go compiler how long the input ismask8:=archsimd.BroadcastUint32x8(uint32(1)<<bitWidth-1)bitWidth8:=archsimd.BroadcastUint32x8(uint32(bitWidth))varbitsuintpos:=0// var acc [8]uint64varrest8archsimd.Uint32x8varcur8archsimd.Uint32x8forop:=0;op<256;op+=8ifbits<uint(bitWidth)// read 8 more uint32s// acc[i] = uint64(binary.LittleEndian.Uint32(input)) << bitsnext:=archsimd.LoadUint8x32(input[pos:pos+32]).ReshapeToUint32s()pos+=32// input = input[4:]cur8=rest8.Or(next.ShiftAllLeft(uint64(bits)))// acc[i] >>= bitWidthrest8=next.ShiftAllRight(uint64(uint(bitWidth)-bits))bits+=32elsecur8=rest8// acc[i] >>= bitWidthrest8=rest8.ShiftRight(bitWidth8)// dest[op] = uint32(acc[i] & mask)cur8.And(mask8).Store(dest[op:op+8])bits-=uint(bitWidth)returnn
The SIMD version benchmarks about 3x as fast as the scalar version.
Another significant speedup is to use generics for bit width
specialization for this SIMD kernel so that
bitWidth becomes a compile-time constant and the compiler can generate better
code.
Positional Popcount
For my TurboPFor encoder, I implemented the same techniques as described above:
These changes are sufficient to roughly match the cgo performance, but then
Claude Fable 5 found another 2x speed-up on top of that!
The key observation is that once encoding blocks is fast, the preceding step of
scanning the input values to decide which block type to use becomes the
bottleneck. Here is the encoder s main encode function, which first does one
pass over the input values (scan) and then prices all different block types at
all relevant bit widths (requires fast access to the scan histogram):
func(be*BlockEncoder)encode(dest[]byte,vals[]uint32,layoutblockLayout)[]bytevarstatsstatsscan(&stats,vals)// gathers statistics from every value in valsbitWidth:=bits.Len32(stats.or)ifstats.or==stats.andreturnbe.encodeConstant(dest,vals,bitWidth)n:=len(vals)// bitpacking is the default, unless we find a more efficient block type.bestType:=blockBitpackingbestB:=bitWidthbest:=priceBitpack(n,bitWidth,layout)// Walk from high bitWidths to low: to break ties, we prefer// the encoding with fewer exceptions (for faster decoding).forb:=bitWidth-1;b>=0;b--// up to 32 iterationsnex:=int(stats.cnt[b])size:=priceBitpackExceptions(n,b,bitWidth,nex,layout)ifsize<bestbestType=blockBitpackingExceptionsbestB=bbest=size// Over-approximate the number of VB bytes.vb:=nex+// exceptions using 1, 2, 3, 4, or 5 VB bytesint(stats.cnt[b+7]+// exceptions using 2, 3, 4, or 5 VB bytesstats.cnt[b+14]+// exceptions using 3, 4, or 5 VB bytesstats.cnt[b+19]+// exceptions using 4 or 5 VB bytesstats.cnt[b+24])// exceptions using 5 VB bytessize=headerBytes+headerExBytes+payloadBytes(n,b,layout)+vb+nexifsize<bestbestType=blockBitpackingVBExceptionsbestB=bbest=sizeswitchbestTypecaseblockBitpacking:returnbe.encodeBitpack(dest,vals,layout,bitWidth)caseblockBitpackingExceptions:returnbe.encodeBitpackExc(dest,vals,layout,bestB,bitWidth-bestB)caseblockBitpackingVBExceptions:returnbe.encodeBitpackVBExc(dest,vals,layout,bestB,int(stats.cnt[bestB]))default:panic("BUG: bestType not implemented")
I ll show you a slightly shortened version of scan, the function which is the bottleneck:
typestatsstruct// cnt[n] = how many values where bits.Len32(val)>n,// i.e. how many exceptions are required for bitWidth=n.// Padded so that cnt[b+24] is always in bounds.cnt[32+24]uint32funcscan(output*stats,vals[]uint32)for_,val:=rangevalsforb:=rangebits.Len32(val)output.cnt[b]++// b bits are not enough to store val
Let s consider the following 3 example values to understand the resulting cnt:
input
input (bin)
bits.Len32
23
0b0000010111
5
5
0b0000000101
3
666
0b1010011010
10
The resulting cnt exception count histogram would contain (cnt shortened to c):
c[0]
c[1]
c[2]
c[3]
c[4]
c[5]
c[6]
c[7]
c[8]
c[9]
c[10]
3
3
3
2
2
1
1
1
1
1
0
In words, this means that at bit width 10, we could encode all the values
without any exceptions.
But most values do not need 10 bits, so a bit width of 5 would be more
efficient, but requires storing one exception. Encoding at bit width 4 requires
2 exceptions, and so on.
The scan function above is intentionally kept simple for illustration. We can
make it faster by moving the per-bit-width loop outside the per-element
loop.
The fast version still needs about 12 instructions per value. With SIMD, we can
reduce this to by 8x to only 1.5 instructions per value!
The trick: smear masks enable positional popcount
The trick is to turn each input value into its smear mask (imagine taking the
first 1 bit and smearing it across the remaining positions). Here are the smear
masks for our example:
input
input (bin)
bits.Len32
smear mask
23
0b0000010111
5
0b0000011111
5
0b0000000101
3
0b0000000111
666
0b1010011010
10
0b1111111111
Turning a value into its smear mask is computationally cheap:
Go implements BitLen(x) (functions like bits.Len32) by calculating 32 - LZCNT(x). We can calculate the smear mask of a value with ^uint32(0) >> LZCNT(x), i.e. starting with a 32-one-bits mask and shifting it by the number
of leading zeros.
Now, to obtain e.g. cnt[4], we can count the 1 bits at bit position 4 of all
input values.
The POPCNT instruction counts bits very efficiently, but it counts one bits
within a register, so it counts rows, not columns. Counting columns is called
Positional Population Count.
I found the following papers that describe positional popcount with SIMD:
Positional Popcount: a visual explanation
To understand the AVX512 implementation of positional popcount, I found it most
helpful to visualize an AVX512 register (512 bits, i.e. 64 bytes). The graphic
below uses the Uint64x8 layout, meaning it divides the register into 8 lanes
of 64 bits (= 8 bytes) each.
This illustration shows the whole process: how uint32s are loaded into an
AVX512 register (all 4 of its bytes, in sequence) and where we end up, i.e. the
32 positional popcounts:
Let s break down this process into its individual steps.
First, we turn each loaded value into its smear mask as explained above.
The VPOPCNTB vector instruction calculates POPCNT (1 byte) of 64 bytes at
once, but first we need to shuffle the bytes inside the register: in load
order, we have a full uint32 (4 bytes), followed by another uint32, per
lane. First, we permute the bytes (VPERMB) such that all the first bytes of
each value end up in one lane ( transpose the bytes ):
Next, we transpose the bits using the GF2P8AFFINEQB instruction, which
sounds scary but turns out to be quite flexible for bit manipulation of all
kinds. The GF2P8AFFINEQB instruction is also the star of the show in Go s
Green Tea Garbage Collector (2025). Here is the
bit transpose, shown in the AVX512 register layout (see below for a different
layout):
I found it easier to understand the transpose step when arranging the 8 bytes of
lane 0 from top-to-bottom (instead of left-to-right), because then it looks like
a 90 degree clockwise rotation:
Now we can use VPOPCNTB to count the bits in all 64 bytes at once:
After all loop iterations (processing 16 values each) are done, we add the two
groups (first 8 values, second 8 values) to obtain the 32 exception counts:
Positional Popcount: Go SIMD
Here is the Go code that implements what I described visually above:
funcscanSIMD(output*stats,vals[]uint32)ones16:=archsimd.BroadcastUint32x16(^uint32(0))// 16 32-one-bits masksshuffle:=archsimd.LoadUint8x64Array(&scanShuffle)units:=archsimd.LoadUint8x64Array(&scanUnits)varaccarchsimd.Uint8x64idx:=0for;idx+16<=len(vals);idx+=16v:=archsimd.LoadUint32x16(vals[idx:idx+16])// Replace all values with their smear masks.smear:=ones16.ShiftRight(v.LeadingZeros()).ReshapeToUint8s()// Transpose: shuffle the bytes, then transpose the bits.matrices:=smear.Permute(shuffle).ReshapeToUint64s()transposed:=units.GaloisFieldAffineTransform(matrices,0)// Popcount 64 bytes at once into the accumulator.acc=acc.Add(transposed.OnesCount())// Store the accumulator into output.cnt:// Widen the two groups of byte counts to uint16 lanes (so that// 128+128 = 256 fits), fold them into cnt[b] for b=0..31,// then widen again to the uint32 lanes of output.cnt.sum:=acc.GetLo().ExtendToUint16().Add(acc.GetHi().ExtendToUint16())sum.GetLo().ExtendToUint32().Store(output.cnt[0:16])sum.GetHi().ExtendToUint32().Store(output.cnt[16:32])// scalar tail for the 0..15 remaining valuesfor_,val:=rangevals[idx:]forb:=rangebits.Len32(val)output.cnt[b]++
Go even faster?
The SIMD optimizations I showed above beat the cgo TurboPFor library that Debian
Code Search used before. When comparing apples to apples, i.e. backporting the
AVX512 kernels and positional popcount technique to C TurboPFor, Go benchmarks a
little slower at 1.4x C.
Could we make my Go TurboPFor implementation even faster, to truly match the C
speed?
Yes! But also no. Let me explain:
We could use more SIMD instructions to remove all code that still processes
one value at a time. For example, in my encoder s encodeBitpackVBExc
function. Or we could price all bit widths concurrently in encode. Or in
the decoder s exception apply code path.
But all of these SIMD instructions
make understanding (and changing) the code harder, so I am cautious regarding
which ones I introduce.
A big part of the performance gap is due to Go s bounds
checks. While it costs
performance, bounds checking is great for safety, so I will not turn off
bounds checking. The Go compiler eliminates a number of bounds checks when it
understands it s safe to do so. One optimization avenue could be to make the
prove pass in the Go compiler smarter to eliminate more bounds checks.
When doing mid-stack inlining (proposal
#19348)
(2017), Go sometimes needs to put NOP instructions into the binary so that
it can attach inlining markers. For dispatch-bound functions, these extra
NOPs can measurable slow down execution.
The Go compiler currently allows specifying the architecture (GOARCH=amd64)
and microarchitecture (GOAMD64=v3), but not a specific CPU architecture
(like AMD Zen 4). Therefore, CPU-specific workarounds for one vendor affect
all the generated code. The specific one I encountered in my code is that the
Go compiler emits XORL CX,CX before every POPCNT to break a
false-output-dependency from the Intel Sandy Bridge Skylake era, which is
unnecessary on AMD Zen CPUs.
I suspect that Go intentionally does not offer this level of customizability.
After all of the above points are addressed, what remains is better code
generation in specific cases. To illustrate what I mean, consider the example
of incrementing a loop variable, where Go re-derives an index every time:
Go: POPCNTL; ADDQ DI,CX; LEAQ (base)(CX*4) (3 instructions)
clang: popcnt; lea rax,[rax+4*rdi] (2 instructions)
Depending on the specific case, improving the compiler might be easy or
prohibitively complex. Often, such improvements are hard to measure conclusively.
Conclusion
Go s SIMD support makes available in Go code without having to resort to cgo
or assembly a powerful part of modern CPUs which allows speeding up the kind
of computation that TurboPFor needs by an order of magnitude!
I found it very valuable to use a coding agent (Claude Code, with Opus 5 and
Fable 5 in this case) to help with the many tedious parts of such performance
work (and still it took me weeks!). The LLM can read objdump output much faster
than I can, can see patterns and correlations I might never identify, never
becomes frustrated after a compiler error or runtime panic, and never runs out
of patience to run one more experiment, as long as I give it measurable and
reachable goals.
The performance of the SIMD code which one can get from the Go compiler is
pretty close to what a good C compiler like clang provides. The CPU performance
counters show value decoding speeds of 7 instructions/cycle (IPC) on a machine
where the maximum is 8 IPC.
To me, SIMD support is a very welcome addition to Go.
As a Debian developer, I have had to cast a vote for the General Resolution named LLM usage in Debian (progress report here). This was not an easy task for me
It s a good thing that the vote is secret so that people are not scared of voting according to their own beliefs. I have Debian friends on the whole spectrum of opinions that are represented here, and I hesitated twice on sharing my own thoughts for fear of alienating my relationship with them. But in the end, we all make efforts to respect the opinions of those who are not thinking like us, and it s precisely that willingness to work together towards a solution that is acceptable by the majority that makes Debian so strong. So here s the train of thoughts that I followed to cast my vote.
The difficulty for me was to reconcile the political statement that I want to make and my desire for this vote to not be (too) divisive for the Debian community, and to make sure we are not putting off newcomers with choices that might be hard to stand by in the long term.
So let s be clear : if I had a magical wand to make AI and LLM disappear, I would use it for that purpose, since at this point in time I don t believe that the benefits outweigh the costs that the AI race is inflicting on us. If I were a political decision-maker, I would forbid the construction of new data centers unless they also build renewable energy infrastructure to cover for their additional energy consumption. I would also legislate so that AI companies have to document what material they used to train their models, and I would forbid scraping for that purpose, and build ways for those companies to buy copies of properly-sourced training data. That is to say, I don t like the way LLM are built by the players in that market, I m pretty scared of the ecological impact of what those players are doing, and I m certainly worried about the long term effect that LLM will have on society as a whole.
Nevertheless what brought me to Debian is the ability to experiment and contribute to something useful with cool technologies, and as a computer scientist, the potential of LLM done right is hard to ignore. Given what we have seen already, I expect that LLM will empower (a part of) the next generation to learn IT, computing and even Debian packaging. Completely refusing the use of LLM is likely to make it harder for us to attract new contributors. In fact, we have already seen people inside Debian that would likely stop contributing if they are now forbidden to use LLM. I know there are likely others that will quit Debian if we accept it too, but I hope we can find a middle-ground where such persons can decide that LLM are not welcome in the small corner of Debian that they are in charge of
In the end, I decided that answering clearly the question Shall we accept LLM contributions ? was more important than making the political statement about the current state of affairs in the AI landscape, both because I believe that Debian statements have a negligible impact on policy-makers, and because historically Debian has grown by staying close to technical excellence and relatively far from politics, except when it comes to the way we handle people. And as much as I care about climate change, I don t see how bringing this up in the context of a Debian statement is helping its cause.
More concretely, it gives the following ranking (in decreasing order of importance):
B, D: those two choices are the clearest to express Yes we should accept LLM contributions and still acknowledge concerns about the way AI is built today
F, H: those two choices do not forbid LLM usage but discourage their use and clearly voice the concerns
E: this choice is basically the statu-quo and fails to acknowledge the concerns, but it does not forbid LLM usage
None of the above
G, A, C: those choices forbid LLM usage in various ways
I don t know what option will win, but assuming that LLM-assisted contributions are allowed, I believe that it would be helpful to have further statements to clarify a few things:
Even if Debian as a whole doesn t want to ban LLM-assisted contributions, each maintainer or each team shall be free to forbid LLM assisted contributions in the parts of Debian that they are maintaining
We should discourage usage of LLM provided by players with unethical behaviors (not sure if there are good players but well )
After ranting and railing about LLMs or "AI" as the optimists (or
accelerationists?) call it, I figured it might be important to
be a little more honest about my use of LLMs and how I think about it
more practically in the world.
The Debian vote context
This is not a coming out. I am not using LLMs on a daily basis, and
this blog is, again, written out of my cold dead hands in a dying
world, with over-engineered hardware and (to a certain extent, hi
Emacs!) software, powered by 100% green energy built on stolen land.
There is a vote going on in Debian. If you're unfamiliar with it,
you can catch up at LWN. So far I've essentially said "LLM is
bad" which is not a very balanced or useful opinion. Obviously, people
are using LLMs, sometimes unknowing or unwillingly, and we need to
take that into account. Furthermore, there has been many different
blog posts on Debian planet about this. Some that I found
balanced, good summaries, even if I didn't fully agreewith
them, at least some did the basic civil service of being
short. But others were just not only Wrong but also so long
that I couldn't finish that I just had to write something.1
This is not an explanation of the ballots, nor how I will vote. This
vote is Debian's failure of framing that debate in a reasonable way:
we have 8 options on the ballot with many duplicates. We have failed
to do the hard work of summarizing and aggregating options into a
meaningful set. I doubt the final vote will represent a readable
position we can rally around.
I have not read the twomonths of debates on the topic
either. Normally, before voting, I take a cursory look at the debate
to see points of view I might have missed. But in this case, it will
just make me sad, add noise, and I'm already pretty sure on where I
stand on this.
So let me describe how I use LLMs and how I think they fit in our
work, as computer engineers and hobbyists.
My LLM use
Debian Packaging
An astute reader has pointed out that I maintain a package in
Debian made to use Anthropic. It's actually multiple packages:
As I previously explained in response, I am not entirely
comfortable with this work: it's a compromise. In fact, I first
uploaded llm to the contrib section of Debian, where we keep
software that depends on other non-free software, but I was told that,
since yt-dlp was in main, llm belonged there as well.
So I moved it to main, alongside similarly controversial tools
like llama.cpp or the python-openai library.
OpenAI and Anthropic usage
An important part of my work is technology watch. I keep tabs on
thousands of (new and old) software projects, follow news, and
generally try to keep my skills up to date. It's a pretty impossible
race, especially as I grow older, but I still think I'm doing the
right choices in my job.
Testing large language models is part of that work. At first, I was
using ChatGPT's web interface, but it was annoying to copy-paste
things into a browser, so I looked for different interfaces.
For a while I tried gptel, a "simple, extensible LLM client for
Emacs" but I found it kind of terrifying. Giving a LLM control over an
Emacs buffer seems like a security nightmare, so I stopped doing
that.
So I use the llm command-line tool to talk to Anthropic's API. I
started that in the summer of 2025, when I bought 20$USD of API
credits. Before that, I paid for a ChatGPT subscription and then
OpenAI credits, which expired and sent me over to Anthropic, which
seemed then to have better ethics.
As it turns out, Anthropic is also happy to work for the US military
(which is a big red line for me). Anthropic also won't let you talk
about the genocide in Gaza, it is destroying physical books,
and is blackmailing us to use their product for security
coverage.
Needless to say, Anthropic and "Claude" are not my friends, but they
seem like the lesser evil in current "frontier models". So I have
renewed, a couple of weeks ago, another 20$USD of API credits with
Anthropic.
Actual prompts and responses
So what does 20$ give you at Anthropic anyways? What am I using LLMs
for and how?
The neat thing with llm is that everything is logged in a sqlite
database, so there are some answers that are easy to get:
> llm logs status
Logging is ON for all prompts
Found log database at /home/anarcat/.config/io.datasette.llm/logs.db
Number of threads logged: 7
Number of turns logged: 12
Number of legacy conversations: 543
Number of legacy responses: 970
Database file size: 9.61MB
That is 10MB of logs, with about a thousand prompts.
My logs go back to 2024-03-07, a little over two years ago, and
include a mix of Anthropic and OpenAI responses. I used it more in
2024 than 2025, and if the trend continues, I will have used it less
in 2026 again:
It looks like about 10 prompts per month right now, down from a peak
of about 60 per month in 2024. It's pretty difficult to analyze those
actual logs to get more patterns and I won't run the prompts through a
model again to process them.
How I'm using models now
At first, I was using it partly for benchmarking model's capabilities,
like Simon Willison does with his pelicans, clearly not trusting
its output. But I was impressed by the capacities of the Claude Opus
4.5 model when it wrote this script in January. Impressed, but
also scared: it's the first time I felt I could delegate the entirety
of my programming to a model. Just run the code, if it works, it
works, right?
So what do I use it now? As an example, here are the 10 last prompts
in my history:
there is now Claude 5, and a fable model, maybe you know about it?
impress me
not impressive, i already know all of this
chat
in postfix, i have a 300k mailing that happens regularly here. normally, it delivers within about...
is there a way i could have drained the maildrop queue faster without removing the milter?
the problem was that rspamd was timing out on the FUZZY_CALLBACK check. how do i disable that?
how do i disable all spam checks? i just want rspamd to add dkim signatures
how do the default_destination_concurrency_limit and initial_destination_concurrency settings int...
mic check
The first one was me trying to confirm which model I am using, which
is not always obvious when going through the whole llm stack I've
been using. The following two are an attempt at seeing what the model
is capable of and I was "not impressed", to which Claude answered that
I have a "high bar", which, fair enough.
The chat is me failing to use a command line, which shows that
perhaps I need to readjust that "high bar", again.
The next five are a rather embarrassing debacle in a large Postfix
mailing that went sideways, and where I couldn't find an actual
Postfix expert of my level to help. The fabled Claude Fable 5 answered
rather correctly, but dangerously, that I could empty the queue by
disabling the non_smtpd_milters. What Fable (and myself) did not
realize is that the milter was also adding DKIM signatures, so while the
mailing was expedited, it was done without those precious signatures,
which got us promptly blocked at Gmail. We have recovered since, and,
thanks to the model and reading the Postfix manual for the
hundredth time, that pickup(8) is single-threaded and that we
needed to review the architecture of that mailing (and our spam
filters) a bit. Many tickets ensued.
The last one is a test I did to make sure my last uploads of
llm-anthropic and its dependency worked correctly.
Note that the above excludes 5 questions I asked Anthropic while
writing this article, where I asked for synonyms and "what nanometer
scale are arduino processors built from? how is an arduino CPU
printed?", a question which Wikipedia furiously evades providing a
good answer.
Those prompts are pretty typical of my LLM use: I'm testing the models
to see if they work at all, but also, out of desperation, I fire off a
prompt after I fire off questions to colleagues or search engines (in
that order). It's often weird edge cases like the Prometheus query
language, Python's matplotlib, LaTeX, Elisp, optimizations, and so on.
I use models for translation a lot. Being fully bilingual, it is
common for me to think of a word in French or English and fail to find
exactly the right word for that in the other language. Models help
with that, and are also useful to find synonyms. Those are low-token
uses that seem pretty innocuous to me, but I realize the irony of this
after writing about the tower of
Babel.
What I am not using models for
I am not using models to write prose.
I am not using models to read prose. If it's generated with LLMs, I
stop reading.
I am not using models to write code, with the exception of that single
Python script above.
I am generally not using models to review code, with exceptions. If
I get stuck on a hard problem, I might feed a piece of code to the
model. I repeatedly fed asncounter into Claude to try to fix a
performance regression I had introduced. It found micro-optimizations
that taught me a thing or two about Python's internal implementations,
but overall, it was mostly a waste of time. This was in June 2025, so
perhaps now models would fare better. I have not tried again.
I am not using LLMs to do Debian packaging. When I can, I manually
review the diffs of packages I upload into Debian, still, by hand.
I do this for the reasons outlined in The Four Horsemen of the LLM
Apocalypse, because I refuse to be
complicit in the:
aggressive and illegal scraping of the servers I steward
world-wide computer hardware shortage (making it, by the way,
nearly impossible to run presumably clean local models) and the
attack on our job conditions (also discussed in
The people vs the AI overlords)
death of copyright and free software
complication and enshifitication of everything, and the
destruction of our communities
the imperialist Nerd Reich that wants to take over the world
Like I reluctantly use Intel computers, I do fire off a prompt. But
I still hold on to the dream that we can build communities of
practice that hold human knowledge collectively and not offload
that as a utility to some megalomaniac billionaire.
Their LLM use I am forced into
So that's me. Clearly, I'm going against the grain here. Everywhere I
look, I see LLM-generated code and projects. Slop and botnets have
flooded the web.
I use Wadamesh, clearly vibe-coded, because it's the best
graphical interface for MeshCore that runs on portable devices. I wish
it was made by a human, in a community I could participate in, but it
isn't, and I don't.
I package the above llm toolset, which is more and more
vibe-coded, but I still review the diffs. And I have to say: I
trust Simon here. The code is verbose as hell, feels overengineered,
and llm feels slow, but it generally works, and Simon is still at
the gate.
The Anthropic SDK is another thing entirely. The 0.91.0 to 0.120
upload, for example, was nuts:
I explicitly did not review that entire diff. It feels like there's a
lot of garbage there to just have a shim between a proprietary API and
Python. But this is the hand I've been dealt.
Larger projects LLM use
LLMs are being used in the Linux kernel, Firefox, rsync, Rust, and
other places. I don't feel good about this, particularly in Rust, but
they at least made a decent policy. I am glad GCC made a policy
against LLM contributions and I support the human Emacs
project.
We need to have a set of foundational tools that are "clean" in the
sense that they are built upon a community of people that understand
how they are built.
Maybe that's naive or even impossible. The Linux kernel and GCC, in
particular, are massive projects that have long grown past the scale
of a single person's understanding. But the theory was that a
community of humans can understand collectively.
Now we seem to be throwing up our hands and giving up on
that community. That LLMs will just fix the problem, whatever it
is. But we're all just one rug pull away from being completely
incapable of managing those projects. The argument there is that we'll
just switch to local models, but no one is actually doing that.
All I see is people use local models as a corner case
(for privacy) or as in theory, but in reality, everyone uses the
centralized frontier models right now. We just can't fallback.
We're in the same situation we were, a decade or two ago, when
Microsoft decided it would kill free office alternatives by making
Office free for non-profits. It worked: thousands, if not millions of
schools, community groups and individuals stopped looking for
alternatives (including free software but also "piracy") for Office
and embraced what seemed like a generous offer.
Now Microsoft pulled the plug and Over 170,000 Nonprofits Lost All
Their Data.
I'm afraid the rug pull on LLMs will be much worse: never mind that
Linus won't be able to use his tireless helper to fix obscure kernel
bugs; we're looking at a collapse of the economy so large that we are
already talking about bailing out the companies responsible.
In a sense, the most striking thing about the Debian vote is it has
actually no option to completely refuse upstream LLM contributions. It
seems the community has taken it for granted that it's now impossible
to build Debian entirely without LLMs. We lost the battle even without
a fight, it seems.
A plea for small
If it has really become impossible for us to manage the complexity we
have built, maybe it's time to stop and think about what we're doing
in the first place. We're struggling to even bootstrap our
current toolchain!
This is one of the things I like the most about working on the mesh:
it's low tech, small Arduino devices that is built with decades-old
semiconductor processes that is understandable by human
beings.
Maybe the answer lies more in single-purpose devices like those
communicators and simpler multi-purpose computers than what we have
now, which is what the permacomputing movement is about.
Small is beautiful, let's scale it down.
and yes, I'm sorry this has gotten this long, I hope you will
forgive those 3000 words.
For human developers, using coding LLMs magnifies their difference in skill levels.
I am one that rarely thinks things are always black and white. Back in March, I wrote Artifial Intelligence: Shades of Gray. Since then, I ve had more of a chance to experiment with LLMs myself. I also happen to work for an employer that is taking a very pragmatic approach to LLMs: teams and individuals use it as they see fit, but if they are causing considerable expense, they have to justify it.
In various settings, I have seen the egregious examples of AI slop we all know about. As I wrote in March, I have seen it both waste more time than it saves, and save a ton of time.
I have come to see that, as a tool, it is most valuable when it is running under the supervision of an experienced engineer. It is at its worst when it has no such supervision; the vibe coding and other low-quality slop we see.
A coding agent is like a junior developer or research assistant. When properly supervised, they help projects move along more quickly by letting a senior developer focus on the more difficult, less mundane aspects of the project. But one couldn t expect a junior developer to consistently deliver high-quality code and architecture on their own.
Let s put a pin in this idea and look at the story in Debian.
LLM use in Debian
There is a vote happening in Debian around the use of LLMs. In typical Debian fashion, there are 8 options to choose from, many of them similar. Most of these proposals acknowledge there are different types of tasks done in Debian, but the proposals don t differentiate between them well. Let me do so here. These are some of the LLM-relevant tasks people in Debian perform:
Packaging upstream software for Debian (by far the largest task)
Writing Debian-specific code (eg, apt or the Debian installer)
Maintaining Debian infrastructure (build systems, for instance)
Writing documentation and translations
I m going to focus my remarks here on packaging upstream software for Debian, since this is by far the most time-consuming developer task project-wide.
It matters to our users that we get this right, and packaging quality is one of the things that sets Debian apart from other distros. Packaging things for Debian requires knowledge of some specific tools, such as debhelper, that aren t widely used anywhere else. In most cases, it is fairly rote time-consuming work. In other words, by its design, it requires people with senior-level skills to do grunt work.
I can t overstate how massive a burden this grunt work is. I maintain some packages for Go and Rust. By Debian policy, all of those packages dependencies must also exist as Debian packages, and be used to build against. When upstream adopts a newer version of some library, it can unleash cascading dependencies that can take hours to sort out. Worse, the Rust team and the Go team use entirely different ways of managing packages (Go uses one Git repo per package, while Rust has a monorepo with specialized scripts to import Cargo packages and generate Debian ones). On top of that, we can t just modify things like usual; we have to use quilt. And on top of that, I m also a backports maintainer, so all the work (and usually even more) has to be done there also.
Now let s pull on that pin from the earlier conversation. This is exactly the kind of scenario that a well-supervised coding LLM is most effective in. I could see a seasoned developer saving hours, maybe even days, by turning over the mundane tasks of managing trees of cascading dependencies over to a coding tool and verifying and directing the process. (Yes, I have been using em-dashes for years; LLMs have copied people like me, not the other way around! This post was not written with any AI assistance.)
Actually, this is almost a dream scenario for a coding assistant. The result is time-consuming to formulate but easy to review, which is the opposite of the way these things often go.
I can assure you with 100% certainty that humans aren t adding a lot of value in this process. It would be wrong to believe that a human is carefully reading every line of code in dozens of updated or new library packages. The problem set is too big, the time too short, and the code too varied and complex.
Coding agents seem to be most effective when there are strong test suites that they can test changes against. Debian builds, especially of modern packages, tend to have this property. Many packages have test suites that are run during build. And, if the package builds in an isolated environment (and especially if its downstream dependencies do also), then there is a decent chance that it s fairly correct. Maybe needing some manual tweaking here and there, but generally a successful build is a reasonable indicator.
You can argue that it would make more sense for Debian to just include dependencies in source packages, along with some version information to support security rebuilds, and I d tend to agree with you. But we are where we are. This would be one of the more significant leaps forward in developer productivity, but it complicates things like copyright reviews.
Where are LLMs run? What is the environmental impact?
Most of the proposals seem to make the assumption that LLMs must always run in some large, hosted datacenter. As I noted in my March article, I have had credible results on even an older GPU running on solar power.
That said, it is undeniable that LLMs are fueling a datacenter boom, and this in turn is producing a significant new demand for resources. Most notably for the global scale: electricity, which is sometimes generated using carbon-emitting technologies.
Bill McKibben, who has been a leading voice in the fight against climate change since the 1980s, has made some interesting points recently: he s noted that solar power is the fastest kind of generation we can build, and a number of large AI companies are investing heavily in solar, even to the point of fully offsetting new datacenter s needs. On the other hand, he s also noted that some companies are buying inefficient and dirty gas turbines. It is decidedly a mixed bag. The heavy investment in solar can have knock-on positive effects for infrastructure. Obviously, not every picture here is rosy. This analysis doesn t touch on the real land and water use situation, either.
On the other hand, if an LLM allows me to do in an hour what I would have done in a day, that s a day of not heating or cooling the work area generally not sustaining a human for the purpose of writing code for Debian. HVAC energy consumption dwarfs my GPU, and I d imagine probably also the slice of LLM energy used.
Holistically, I would have to conclude the picture is mixed. It is possible to use LLMs in a pretty green way, and also in a pretty dirty way.
Assuming Conditions Never Change
A flaw in most of these proposals is they assume that the conditions at this present moment will always hold. In fact, that the conditions at the present moment will not continue is something both AI cheerleaders and AI skeptics agree on.
For instance:
Ed Zitron has done a ton of research into the financing side of AI, and has concluded that the current model is unsustainable and headed for a significant bubble burst. I m not positioned to personally evaluate those claims, but if that happens, what is the result? Perhaps it is a steeply increasing cost of inference for the frontier models, slower pace of training/evolution for them, etc.
In a recent episode of Oxide and Friends, Simon Willison discussed the open weight models that are now available. They have been making remarkable strides in efficiency and capabilities, to the point where $50,000 of hardware can now run high-end open weight models with capabilities that are at least in the same ballpark as the American frontier models. This puts running high-end models locally squarely within reach of universities and small- to medium-sized businesses, with power requirements that can be met with standard commercial solar and wind installations.
The lack of nuance in the more restrictive proposals is particularly concerning. Proposal A doesn t allow the use or assitance of LLMs . So it bans my solar-powered GPU. It bans using LLMs to find security issues. It bans all sorts of things that don t seem to be ban-worthy, alongside the things that do. And it codifies it in the very hard-to-change social contract.
That proposal, and some like it, seem to imply that all LLM output is bad. I grant you that AI slop is a real and legitimate concern, and many Open Source projects have to deal with it. On the other hand, we have all seen first-hand how the security of the Linux kernel has benefited dramatically from AI analysis. It is certain that black hats are using these tools. If we refuse to use modern security tools, our security will be compromised (and what is the environmental and social impact of THAT?)
I find the statement Generative AI is characterized by producing output of a nature that would ordinarily be produced and consumed by humans to be particularly interesting. The same was once said of compilers.
The Real Concerns
You might think from reading this that I am some AI cheerleader. I m not. I share the ethics of the FLOSS movement, and have for decades. I abhor the power and lack of ethics that many big names in the field are running with at the moment. I ve had to put up Anubis on this blog, for instance.
I have personally experienced the effects of AI slop, especially at review time. This is a real problem, though I don t think the more draconian policies are likely to help (the looser you must disclose stand a fighting chance, but I m not sure they would help, either.) Done poorly, AI threatens developer burnout by overwhelming them with poor code and verbose but useless explanations. Done well, AI can help prevent developer burnout by automating tedious and low-value tasks.
Shouldn t our goal be that humans submit work to Debian, using tools they prefer, and take responsibility for it? Does it matter if someone uses ed, vim, emacs, or vscode? If they use LSP or just run gcc manually? I d say we benefit from the diversity. Wouldn t we be better off to benefit from the diversity here, and judge work as we always have: on its merits, not what tools were used to create it?
Fundamentally, a GR is a long and arduous process. It s not easy to reverse later. Amending the Social Contract is even longer and more arduous (I should know; I may have been the first one to try). The LLM landscape is fast-moving. None of us can really predict where it will be in a year. Will the current market leading companies even still exist? Will it be at all credible to refuse to use AI-assisted security tools? What is the most effective way to deal with AI slop? What level of utility will we be able to achieve with models run locally?
Some of these proposals would make sense if drafted in some way short of a GR, which would allow more maneuverability as the landscape changes.
Brief analysis of the options
Considering the proposals:
Proposal A: seeks to amend the social contract, which I am opposed to for reasons already laid out above. It names some real concerns about AI that I agree with, but implies that all LLM uses and models are guilty of the problems, which is not the case with all of the claims. It also sets us behind the curve on security and stability by forbidding the use or assistance of those tools, even if run by others. It requires us to ignore reports of actual security bugs, or correct fixes, if those reports were generated with the assistance of an LLM, which I find to be absolutely untenable.
Proposal B: This is the AI with accountability approach. It notes the real concerns with LLMs without painting with an overbroad brush. It strikes me as level-headed and sensible.
Proposal C: It paints with an over-broad brush and makes some non-binding requests. Then it winds up largely like proposal B, though while it is worded more strongly, has fewer binding requirements (for instance, it lacks proposal B s prohibition on transmitting sensitive information to untrusted providers)
Proposal D: Seems broadly similar to proposal B, an AI with accountability approach. I m not really clear why we need both.
Proposal E: Largely the status quo. It is like proposals B and D in that it says humans are accountable for their contributions. It encourages disclosure of LLM use, but does not mandate it. Like proposal B, it prohibits disclosing sensitive information to third-party AI services. Note that both proposals B and D have an appropriate nuance: a local model is fine, a third-party one is not.
Proposal F: This seems really similar to proposal E. I m not sure why we have these two.
Proposal G: Disallows the output of generative AI as direct contributions to Debian. This is something of a weakened proposal A; it doesn t seek to amend the social contract, nor does it ban all use; it simply bans the use as a direct contribution.
Proposal H: Ban due to climate impacts. How is this even an argument is disrespectful to reasoned conversation. I have already noted that LLMs can be and are used in ways that are not climate-harming. It explicitly contains no binding requirements at all, and is effectively a rant. While I agree with the sentiment that climate change is an urgent problem, and that some LLMs are exacerbating it, I disagree with that all LLM usage does so and therefore disagree with the conclusion.
In favor of nuance
I find that black-and-white thinking is almost always something to be avoided. I see it too often. I see it in politics, I see it in our software, I see it in discussions around AI. Are there deeply unethical things happening in AI? Absolutely. Are they doing some impressive things? Also yes.
We have accepted this nuance in other areas. For instance, almost all the hardware Debian runs on has closed-source hardware, and has components manufactured or assembled in countries with some of the worst human rights records on the planet. I m not saying this is a great state of affairs. It is something we should speak up about and act upon. But the worse state of affairs would be no Debian because the hardware is impure .
Yesterday, I uploaded Term::ANSIColor v6.0.0-TRIAL to CPAN for early
testing. This release will raise the minimum required Perl version to
5.12, dropping support for Perl 5.8 and 5.10. When I did the same with
podlators a couple of years ago, it upset a few people and one of them
asked me to make this sort of test release in the future. Hopefully this
will help.
I have not run the normal release machinery and haven't archived this
release in the normal places, since I intend it to be transient. It's only
on CPAN, where people can retrieve it for testing. Once v6.0.0 is
released, few traces of this TRIAL release will be left. This doesn't
appear to be how other people use the TRIAL mechanism, but it felt more
comfortable to me. If I have to make substantial changes, I'll consider
changing my approach.
I plan on turning this into the v6.0.0 release in about a month or two,
hopefully with only documentation changes.
Term::ANSIColor is a "very upstream" core module with a lot of
dependencies, and CPAN (unlike some of the archives that followed it, such
as PyPI) doesn't support conditionally retrieving packages based on the
current Perl version. This release may therefore be disruptive for people
who are still trying to support Perl 5.8 and 5.10, since CPAN installation
tools may attempt to install an incompatible Term::ANSIColor version. I'm
sad that this will be the result, since I know some people still care
about those versions.
I'm pressing forward with updating my Perl modules anyway, though. I
realized that honoring other people's desire for stability to such a
degree that I was unable to use Perl features added more than 15 years ago
was destroying my motivation to work on these Perl modules at all. So I've
decided on a very slow and gradual approach where I'm going to keep
pushing the minimum supported version forward but try to give people a lot
of warning.
Personally, I think it's time to let ancient versions of Perl go and
follow the
Lyon Amendment about supported Perl versions. When we're talking
installing new modules for software released more than 15 years ago, we're
talking about special limited environments and retrocomputing more than
what I would consider routine software maintenance. Those tasks should
expect to need different tools and a different workflow so that they can
pin historical versions. Since this isn't something I'm personally
interested in, my willingness to expend time and energy to assist is
limited.
As you can probably tell, I still feel nervous about pressing forward in
this way, but I think this is the approach that lets me continue to enjoy
maintaining these Perl modules. It's been 29 years for Term::ANSIColor,
but I still enjoy fixing bugs in it and putting out a new release from
time to time, particularly if I can clean up the code a bit each time I
touch it.
While many Western democracies seem to be in a state of decay and are no longer the safe, civilized and prosperous countries they once were, there are still some European countries that are governed well. One of those that stand out is Estonia.
Estonia is probably most well known for multiple software companies that originated from there, such as Wise, Bolt, Pipedrive and Skype. The government itself is also famous for being early in issuing government IDs with an embedded smart chip for online authentication already in the 1990s. Via the national portal at eesti.ee all residents can access extensive eServices ranging from viewing their health benefits to filing taxes.
Estonia has also been running an e-Residency program since 2014, where they issue digital ID cards to foreigners, making it easy for them to remotely log into the government portals and for example, establish businesses, file annual reports and so forth. Note that the e-Residency is not a path to physical residency. Estonia does, however, have a separate Digital Nomad visa program that makes it easy for non-EU citizens to also physically establish themselves in Estonia, assuming, of course, you meet the criteria, which includes, among others, a minimum monthly income of 3960 from outside Estonia. EU citizens naturally have free mobility inside the EU and can simply get an apartment and register as a resident in Estonia if they so choose. And there are plenty of reasons to do so.
Estonians value health, education and entrepreneurship
I moved to Estonia about one and a half years ago. In my observations Estonia strikes me as a country that values health, education (in particular programming and natural sciences) and entrepreneurship highly.
I don t know how Estonians achieve it, but they look pretty fit and rarely obese. Estonia has rye bread and sauna in their culture just like Finland, and in addition the flat terrain and well-planned bike routes and extensive network of parks (and pull-up bars everywhere) seem to create an environment where it is easy to live in a healthier way. The consumption of processed foods and candy also seems relatively low among Estonians.
The gym chain MyFitness also seems to be present everywhere. Even the Tallinn airport has a calisthenics workout station right at the departure gates, which anyone is free to use while waiting for their flight to take off. One of the top longevity influencers in Europe, Siim Land, is Estonian.
Estonians also seem to value the school system highly. The government has been actively raising teacher pay and has a stated goal of reaching 120% of the national average by 2027. The students are also expected to value the education and respect their teachers. According to the TALIS 2024 survey (OECD s international teacher survey), Estonian teachers spend significantly more time on actual teaching and learning and waste less time on interruptions or keeping classroom order compared to the OECD average. This is among the highest rates internationally, meaning they spend relatively little time on maintaining order or dealing with disruptions. While the international education benchmark PISA scores have been dropping globally, Estonia has consistently been climbing the ranks in past decades. In the latest PISA study (from 2022), Estonia ranked number one in Europe for reading, mathematics and science. In the overall results, Estonia ranked seventh globally, only behind countries such as Japan, Korea and Singapore.
Valuing entrepreneurship is evident in how the taxation system is set up in Estonia. Famously, in Estonia, companies can defer taxes on annual earnings and reinvest all of their profit in growing the company. Taxes are due only later, when paid out from the company, for example as dividends. For individuals, receiving dividends from any Estonian or foreign company is tax-free as long as the company paying dividends already paid corporate tax on the same income.
The tax system is also very simple. For all individuals, all types of income, including salary and capital gains, are always taxed at a flat rate of 22%. This removes the incentive for anyone to try to convert income into different types, setting up holding company structures and other optimizations as there is no gain. All entrepreneurs can simply focus on growing their business and forget extra bureaucracy. There is also no marginal tax rate cliff to stop working at everyone is encouraged to always try to produce as much value as they can. A simple tax system is also reflected in the fact that anyone can easily read all tax rules that apply to individuals in plain English on the Estonian tax authority website, and one does not need to hire any accountants simply to file taxes.
Estonia also has a very straightforward investment account system: any person can freely open a self-directed investment account at any brokerage at no extra cost and report it as such to the tax authority, and then use it to save for an apartment, retirement, or other purposes, and defer all income taxes until withdrawal. There are no caps or time limits, and all residents are encouraged to save and invest as much as they can and thus take responsibility for their own wealth accumulation.
It seems that culturally Estonians respect people who are active and progress in their careers and businesses more than in other countries. Unlike in Finland, successful people are admired and living on government welfare is not romanticized. At the same time, the government benefits are less generous so people can t live comfortably on them and, for example, many of the asylum seekers Estonia accepted have since left on their own initiative to other European countries in search of better benefits.
Low crime, high trust
Another thing that strikes me when walking the streets of Tallinn is that there are no drug addicts, beggars, thugs or the like. The difference compared to, for example, Vancouver (where I lived previously) is stark. In public buildings, people leave their coats and bags hanging in the lobby while visiting. Private houses and apartment block yards are not fenced. In my building, I noticed people even leave their bikes unlocked in the bike shed. I have also seen the staff of a coffee stall in a shopping mall going for a break and leaving everything unattended, not worrying that anyone would take anything while the staff is away.
This is not just my personal experience. According to the Numbeo crime index, Estonia has one of the lowest crime rates in the world. Also, comparing drug and property crime stats, for example, Finland has twice as much crime per capita, and places like Vancouver in Canada almost five times more.
I don t have any clear explanation for why crime is so much lower in Estonia, but some suggest that higher social cohesion and lower levels of welfare contribute to people standing to lose more if they behave antisocially. Compared to Finland, Estonia also more readily jails repeat offenders, and those who are put on trial will experience a swifter court process thanks to simplified legal processes and more efficient governance.
Moving to Estonia: quick checklist
Moving to Estonia is very easy for any EU citizen, in particular if your work is not location-dependent (e.g., remote work or an online business) and you are simply looking for the cleanest and safest environment to live in.
First, check into a hotel in Tallinn, check out various neighborhoods to figure out what area you like (my favorites are Kalaranna, Kalamaja, Noblessner and Volta) and start browsing available apartments in English at kv.ee. Most professionals speak fluent English, so there should not be any difficulty in reaching out to people by email or phone.
The next step is to buy a local prepaid SIM card at e.g., an R-Kiosk or a convenience store as signing up for other matters later on will require an Estonian phone number. Once you have an apartment and e.g., signed a rental agreement, you can register in the population registry online.
After that, you have proof you are a local resident with an address and telephone number in Estonia. With local resident status, you can go to the police station to get a local ID card. Don t bother scheduling an appointment, just go to the Tammesaare police station in Tallinn, take a queue number and wait. Once it is your turn, they will guide you on how to use the photo booth, fingerprint registration device, and file your application. A few days later you will receive an email confirming whether your application was accepted, and after a few more days, you will get another email notifying you that your ID card has been printed and is available for pick-up at the same location. This will also be your first practical experience of how fast and efficient the government in Estonia is.
Once you have the local ID card, you can use the smart card feature to log into all the government eServices and sort out the rest of the relocation process, such as registering tax residency and getting a family doctor.
How did Estonia evolve to be like this?
After Estonia regained its independence after the fall of the Soviet Union in 1991, the first elected government in 1992 was led by a very progressive 31-year-old Prime Minister Mart Laar, who managed to set up some very good policies and laid the foundation of a society that has evolved well in the decades since. Estonia was very lucky to have people in power in the 1990s who didn t simply copy what other Western countries were doing, but who tried to think about things from first principles and create Estonia s own model for efficient and fair governance. As a post-Soviet country, the population had also been vaccinated against overly socialist and unrealistic ideals, and everyone had a healthy distrust of the government s ability to solve problems and emphasis was placed on people s liberty to work for themselves as they best see fit. The improvement in living standards over the past 35+ years has also been witnessed by the population, and voting behavior supports keeping the country on the same trajectory.
General living standards still continue to improve as the nominal wage growth sits at around 6%, clearly above the annual inflation rate of about 3%. In 2026, the Estonian economy is expected to grow about 2.4%, which is faster than the EU average. The growth in Estonia is not the result of any accounting tricks - Estonia is part of the euro and can t print its own currency, nor has it been funding the public sector with excessive debt. With a 24% debt-to-GDP ratio, Estonia consistently ranks as one of the most responsibly managed countries among advanced Western economies.
As wages in Estonia soon catch up with the EU average, and higher defence spending has forced the government to raise taxes in recent years, the economic growth that Estonia has enjoyed for 35+ years since it exited the Soviet Union might slow down a bit in future years. The policies that fueled this growth in living standards, however, are likely to stay.
The tiger leap
There is one specific government policy in Estonia s history that I think should be highlighted in particular. Estonia was very progressive by announcing the Tiigrih pe (Tiger Leap) program in 1996 with the goal of equipping all schools with computers and teaching all students the basics of programming. This surely had a large influence on why Estonia has so many successful software companies, why the government eServices are so mature that even neighboring countries like Finland are striving to copy the Estonian government s IT architecture called X-road.
The Tiigrih pe project was originally suggested in the mid-1990s by Toomas Hendrik Ilves, then ambassador of Estonia to the United States, Canada and Mexico, and later President of Estonia in 2006 2016. While he was a psychologist by education, he was also a self-taught amateur programmer and used his political influence to promote sensible adoption of information technology in both Estonia and the EU.
The history of Estonia has several prominent figures who were not lawyers by profession but engineers, scientists and historians who were very practical in their political decisions, which I think is now reflected in how government processes were formed.
The video below shows how the Estonian government advertises itself and what values they choose to highlight:
Should other countries adopt policies from Estonia?
Of course, not everything is perfect in Estonia either. The fertility rate of 1.16 in Estonia is very low. This trend is present globally, but in Estonia it is way below the EU average. Also, the service culture is something that needs to improve in Estonia. While services are in general fast and efficient, the attitude of people working in cafes and stores does not reflect a willingness to fill in gaps if the standard process falls short, nor are visitors actively made to feel welcome as individual humans, but are treated as mere process inputs.
However, many of the things listed earlier I think should be studied by policymakers elsewhere. Societies are complex systems and there is of course no guarantee that copying a single policy to another country with different ethnicities, history and ingrained culture would lead to the same policy outcomes. But considering that Estonia is a small country without favorable geography and no natural resources, and that it started out from a place of total chaos, low economic activity and high crime in 1992 to rise to what it is now in 2026, the success it has seen is surely largely a result of good policies, governance and culture that other countries can and should mimic.
The Player of Games is political space opera and the second book in
the shared Culture setting. As with most Culture books, the reading order
is not particularly important. It won the 1989 Locus Award for best
science fiction novel and sometimes competes with
Use of Weapons as the consensus best
Culture novel.
This review is a re-read and yet another experiment in how to re-review a
book. This time, I decided to write a full second review with substantial
spoilers so that I can talk in more detail about the book. If you want to
avoid spoilers, or just want to see how my thoughts have evolved from my
first reading, see my original review from
2005.
Gurgeh plays games. He is probably the best strategy game player in the
entirety of the galaxy-spanning Culture. He has written papers on game
theory, won innumerable major championships, and is a celebrity in the
circle of like-minded aficionados.
Gurgeh is also bored and in the middle of the Culture equivalent of a
mid-life crisis. As the story opens, he's vaguely unsatisfied and adrift,
unenthused by his normal activities, and searching vaguely for something
that will break through his ennui. He is caught by surprise by the thrill
he gets from a moment's misunderstanding in which an opponent suspects him
of cheating, which sets him up to be (apparently) clumsily blackmailed by
a deeply unpleasant drone named Mawhrin-Skel.
SPOILERS BELOW. If you have not read this book, consider stopping
here and instead reading my original no spoiler
review.
The first hundred pages of The Player of Games is a slow, somewhat
plodding introduction to Gurgeh, his social circle, and life in (one part
of) the Culture. I remember being fascinated by this part the first time I
read this book. It was only the second Culture novel I read and the first
set in the Culture proper, so the world-building underlying this odd
post-scarcity utopia on a vast intelligent habitat with sentient drones,
complex privacy rules, endless cocktail parties, and apparently
directionless socialites was intriguingly unlike the other science fiction
I was reading at the time. This time through, I have to admit I was less
impressed.
Gurgeh is not very likable, and his desultory mid-life crisis is a little
boring. None of his friends have enough depth to appear as more than side
notes, in part because Gurgeh doesn't seem to care enough about any of
them to make them interesting to the reader. I've since read seven other
Culture novels, so Banks's cocktail parties hold less charm and I was
impatient for the real action to begin.
These chapters are still important, though, because they establish how
utterly average Gurgeh is. He has one unique talent, a deep affinity with
and obsession with strategy games, and is otherwise a bit of a depressed
narcissist with a few casual relationships, a friend that he barely
confides in, and a comfortable and familiar life. He is not in any way a
hero or a charismatic figure; he just happens to be exceptionally good at
one thing, enough to make him famous among people who care about that one
thing and probably unknown to anyone else apart from the occasional idly
perused news headline. He is the Culture's equivalent of the world chess
champion.
The Contact division of the Culture has a problem. The Empire of Azad in
the Lesser Magellanic Cloud is a nasty, expansionist culture of the sort
that Contact would like to deal with before it causes broader problems.
The Culture's normal approaches are thwarted by an unusual organizing
principle: The empire is built around and takes its name from the game of
Azad, a highly complex strategy game developed over thousands of years.
Azad is the civil service exams, means of political and religious dispute
resolution, selection mechanism for the emperor, and civic religion. Faced
with that oddity, Contact turned to Special Circumstances, the Culture's
more aggressive and less restrained way of dealing with tricky problems.
Special Circumstances, in turn, needs someone who can learn how to play
the game of Azad. They want Gurgeh to take a very long trip.
For all of Gurgeh's dissatisfaction, he's not impulsive enough to take a
five year journey away from his life and everyone he knows just to play a
novel game. Conveniently, Mawhrin-Skel's blackmail resolves this
reluctance.
The game of Azad requires some suspension of disbelief. Banks provides a
few glimpses at the mechanics of the game, but those details are
insufficient to reconstruct the rules, and some of the claims made about
its properties are improbable at best. The best mental model I could build
for it is a strategy or simulation game built around units and territory
control, with supplemental side games used to build up resources for the
main boards, but it's more of a plot device and a set piece than a
world-building invention. The significance of Azad the game is its role in
society: The Empire of Azad believes they have constructed a game whose
complexity so closely models reality that the skills required for success
in the game are precisely the skills required for success in the empire.
The Empire of Azad is wrong, and this is one of the core themes of
The Player of Games. As with many Culture novels, what Special
Circumstances tells Gurgeh is, at best, incomplete. Gurgeh is a refutation
of the basis of belief in Azad; this is why it is important thematically
that he is an average, somewhat unlikable citizen of the Culture whose
only special characteristic is skill at learning and playing games.
Azad is the myth of meritocracy given physical form as a game. It provides
the anchor of the empire for the same reason that societies on Earth place
enormous weight on standardized tests, capitalist success, or public
debates. All societies face the problem of selecting good leaders and
testing opposing beliefs, and all societies attempt to find some form of
shortcut, some set of general principles, tests, or objective metrics used
to select the best person via a process that people consider plausible and
fair. The game of Azad is a paragon of apparently meritocratic process. No
matter who you are or what your background is, if you excel at the game
that, in theory, objectively tests your skills, you are given a position
of power.
In practice, the Empire of Azad is not that naive. Manipulation outside of
the game happens, only some players have the opportunity and resources to
spend years learning the game at a deep level, and only their dominant sex
truly stands a chance in games that matter. But neither is Azad's place in
society a fiction. There is corruption around the edges, and a lot of
people are filtered out before the games begin, but the highest echelons
of society are true believers. The game does decide both rank and policy;
Banks is arguing against a strong form of apparently working meritocracy.
Gurgeh represents a refutation of this meritocracy through the mechanism
that breaks every supposed meritocracy: The map is not and cannot be the
territory. Any objective evaluation criteria is necessarily separate from
what it is trying to measure, and in that separation there is always an
opportunity. Gurgeh has none of the background, training, or mindset
expected for a player of Azad because he could not possibly care less
about any of the things Azad represents to the Empire. What he has instead
is a preternatural skill at games and vast experience with the most
intricate strategy games the Culture, a much larger society, has been able
to devise. He also has both the patience and the resources to devote
himself entirely to learning a game for several years, and past experience
in doing that with other games.
If Azad represents the civil service exams, Gurgeh is the person who has
no interest in ruling but adores memorizing facts and taking tests. The
theory behind the exams is that the skills to pass the exam only come with
the correct mindset to do the job for which the exam is testing. Gurgeh is
an existence proof that this is not always the case.
Banks also uses Azad to show another aspect of the failure of meritocracy:
A society whose rulers are chosen through a competition takes on the shape
of that competition. The Empire of Azad is run by the winners of
competitive games, so the empire is a winner-take-all system of dominance
and status hierarchy. Here, I think Banks lays the point on a little
thick; the empire is an irredeemable hellhole of misogyny, sexual abuse,
slavery, genocide, and military colonialism to a degree that is a bit hard
to justify solely from the game. There is a beautiful turning point about
two-thirds of the way through the book where Gurgeh's face is shoved into
just how vile Azad society is and reconsiders his approach to the
tournament as a result, and I think it may have been a bit stronger if the
morality had been a little less blatant and absolute.
To the extent that Gurgeh has political beliefs, he represents a Culture
flavor of soft liberalism. He has opinions about acceptable and
unacceptable ways to treat people, but he grew up in a utopia and his
opinions are mostly theoretical. When he sees just how vile people can be
outside of that utopia, he is revolted and appalled and redoubles his
efforts to fight that society in the only way he knows how, inside of a
game. This part of the book follows the standard, if enjoyable, plot of a
flawed but fundamentally decent person discovering a true injustice and
becoming enraged at it.
In a lot of books, that would have been where the plot stops. Banks is
doing something more subtle and more interesting, though. Gurgeh wipes the
board with his next challenger, but that soft liberalism eventually proves
inadequate. To learn the game of Azad and to play in the tournament,
Gurgeh has been wrapping himself in Azad culture and its language, and in
that frame of mind he is losing the climactic game of the book. It's only
when he is pushed to think in Marain, the native language of the Culture,
that he understands what is happening in the game and how to defeat
Nicosar, the emperor.
This, on the surface, is a bit too close to the
strong
hypothesis of linguistic relativity to be entirely plausible, but such an
objection would miss the point that Banks is making here. Marain is a
construct, the product of considerable effort within the Culture to match
language to the most nuance and complexity that brains can understand, and
it is a language, one of the most social and collective artifacts a
society can produce. Gurgeh is a remarkable individual with an impressive
talent, but individual skill and achievement can only take him so far. The
critical final piece is the support of societal infrastructure
intentionally built and maintained to help him make better decisions.
Once I noticed that point, I saw it everywhere in the book. The empire
repeatedly attempts to subvert or distract Gurgeh with drugs, pleasure,
politics, or danger, and at each point there is some critical piece of
Culture social infrastructure that blunts the attack. Illicit substances
and forbidden vices are less tempting to someone for whom the illicit has
been demystified by the Culture's gentler approach to rules and
boundaries. Embedded biological mechanisms allow him to divert drugs so
that they don't affect him. At first, it's easy to read this as an
exercise of self-control, but on this re-read I saw how much
behind-the-scenes infrastructure supports Gurgeh's ability to ignore
temptation.
This social support notably does not take the form of some ideological
principle or moral framework. Gurgeh is not a monk or an ascetic, as is
obvious from the first third of the book, and he has no political ideology
to speak of. He is a flawed person with a streak of danger-seeking and
self-aggrandizement, which the Culture exploited to get him involved in
Azad. But through a lot of hard work, technological and social, the
Culture has given him a robust foundation and a set of mental and
biological tools that make him remarkably hard to corrupt. The implication
is that if Gurgeh has that support, so does every other member of the
Culture. It's neither a religion or an ideology; it's well-maintained
infrastructure, complex and nuanced and pragmatic, and composed of
innumerable small solutions to specific problems.
I think the true climax of this book takes place the night before the
final day of the game, in the tower meeting between Gurgeh and Nicosar.
Gurgeh has realized that he's already won; there's nothing Nicosar can do
to salvage the game. He's also seen that the game represents a cultural
conflict and conversation between the Culture and Azad and he's
overwhelmed by the beauty of that communication and sadness that the game
is about to be over. Gurgeh's true passion is the game. It is doubtless
easier for him to be magnanimous because he's winning, but he also loves
the structure of the game itself and what two players can create in a sort
of collaborative competition.
Gurgeh tries to express all of this to Nicosar. It is one of the most
centrist liberal moments I've ever read in a novel, the pure essence of
"reaching across the aisle" or "disagreeing agreeably." Gurgeh has seen
something beautiful, something he's created with Nicosar, a moment of true
communication, and he wants to share it. Surely Nicosar sees the same
thing; surely now that he sees Gurgeh has won, he can appreciate the board
structure, savor the moment, understand the transient beauty of a game
that is about to end and how perfectly it captures the meeting of their
different cultures. That moment does Gurgeh real credit. It's a rare sign
of emotional and spiritual depth in a character who often seems
superficial.
Nicosar meets this outreach with unhinged, furious contempt. He despises
everything Gurgeh represents, everything the Culture is, and the next day
he tries to kill Gurgeh on the board of the game.
It is a devastating critique of liberal tolerance, all the more so because
Gurgeh's attitude and outreach is truly admirable. It is perhaps the most
sympathetic moment that Gurgeh has in the entire book, the moment where
the reader thinks "oh, I get it, I understand what he really cares about."
Gurgeh assumes that Nicosar is not his position or culture, that they have
made a moment of connection that transcends all the awful things he
previously learned about the empire of Azad. That Nicosar, despite being
the emperor of the society that is currently doing so many things Gurgeh
finds repulsive, cannot be as bad as his society. And Nicosar considers
that outreach to be weak, disgusting, and vile, and does everything that
he can to destroy it.
One of the oddest twists of our current moment is the obsession that some
billionaires have with stories that are moral arguments against exactly
what those billionaires are currently doing. The most obvious example is
Peter Thiel, who is obsessed with The Lord of the Rings and has
devoted his life to becoming Saruman, a character who is notably not one
of the protagonists. It's as if something in them recognizes the power of
the story, but some deep shame or narcissism or simple aversion allows
them to completely ignore what the story means.
Elon Musk is obsessed with the Culture novels. He names the SpaceX rockets
following Culture Ship naming conventions and has claimed that one of his
goals is to bring about a Culture-style utopia. And in 1989, years before
anyone had ever heard of him, Banks cast him as the villain of The
Player of Games. There is so much of Nicosar in Musk: the superficial
charm, the limited brilliance (Nicosar is a very good Azad player), the
ambition, the pride, and the vicious, spitting contempt for everything the
Culture represents at every level deeper than superficial materialism. And
Banks is as clear about his opinion of Nicosar as he is about anything in
any Culture novel.
One of the oldest fictional answers to what a society does with people
like Nicosar is the consequences of hubris. By being unable to accept
defeat, by holding a vision of the world so tightly, they become brittle
and unstable and bring about their own collapse. In a broad sense, that is
what happens in The Player of Games with a bit of pushing from
Special Circumstances. By the politics of the game, Nicosar had already
won; the results of Gurgeh's earlier games had already been faked, the
final game had no political consequences, and everyone who knew its true
outcome could be disposed of. Gurgeh's win could have been covered up and
ignored. But Nicosar could not endure the thought that he would be beaten
by someone like Gurgeh, playing Azad the way that Gurgeh was playing it.
Gurgeh had to be destroyed on the board of the game; Nicosar's pride did
not allow any other outcome, even if it meant Nicosar's death.
However, Special Circumstances didn't let hubris be the end of the story.
In the climax of the book, the drone protecting Gurgeh also makes sure
that Nicosar dies. There is a fig leaf of plausible deniability, but it's
so obvious that even the unobservant Gurgeh sees through it immediately.
It's hard to escape the feeling that was Banks's answer to what to do with
people like Nicosar: They cannot live within society, because they will
not live peacefully within society.
I enjoyed The Player of Games as much this time through as I did
the first time, but for entirely different reasons. In my first read, I
focused on the world-building of the Culture, the political machinations,
and the concept of games as conversations between the players. This time,
I was struck by the political commentary just below the surface. Special
Circumstances wanted to resolve the problem of the Empire of Azad without
a military conflict and occupation that would be long, brutal, expensive,
and demoralizing. They found an answer that relied on the diversity of the
Culture. A vast, utopian civilization in which people can pursue whatever
interests make them happy produces innumerable microspecialized oddities,
people with astonishing talents in some small field that only a tiny
fraction of people care about. It produces, in other words, innumerable
keys for locks that you may never encounter, but which are invaluable if
you happen to stumble across that lock.
Gurgeh is not a hero. He is not a paragon of moral virtue, or even a
charming charismatic, He is an entirely average member of an extraordinary
society, the beneficiary of thousands of years of concerted effort at
producing a robust, flexible foundation on which to raise robust, flexible
citizens with a shared sense of basic morality. Those people, by
themselves, do not solve all of life's problems; the structure of Special
Circumstances and its willingness to bend rules in order to maintain them
is the tension and deus ex machina in all of the Culture novels.
But much of the strength of Special Circumstances is that it has an entire
civilization of people like Gurgeh to draw upon when it needs them.
It has those people because the Culture comprehensively rejects
competitive meritocracy, something that some readers of the Culture novels
appear incapable of comprehending.
Rating: 9 out of 10
As is the case for many people working in the security industry, the last
few months of my life have been focused on dealing with people wanting to
use LLMs everywhere. From an enterprise security perspective that s not an
inherent problem - what s more of a problem is that people want those agents
to have access to resources like their calendar and email and so on, and now
we have somewhat non-deterministic agents that seem very enthusiastic to
achieve what you asked whether that s a good idea or not, and we re
combining this with credentials that give them access to sensitive data, and
leaving those credentials on disk where they can be committed into git repos
or exfiltrated to some other service to make use of them on the agent s
behalf or well just any other number of things, at which point your CEO s
email is suddenly readable by everyone and you re having a bad day.
As I mentioned in my last
post, pretty
much every strong mechanism for keeping credentials in place is just not
supported in the wider world. We can imagine a universe where agents use
hardware (or at least hypervisor) backed certificates to obtain credentials
and any that end up leaking are worthless as a result. But, sadly, that s
not an option for most people using existing identity providers. The state
of the art is that you use the device code
flow and a human authenticates and
the token ends up back inside the agent environment and then it proceeds to
do whatever it wants with it and you just hope that you wake up the next
morning without an awful infoleak occurring.
(An aside: I do not like the device code flow as used in enterprise
environments, and I never will. The identity provider doesn t have a real
opportuity to inspect the security posture of the system asking for the
token, and as a result some identity providers will restrict tokens that are
issued in this way. The common alternative of doing stuff using a more
standard flow and having a redirect URI pointing at localhost works fine for
local systems and is a pain for remote ones, even if you can commit crimes
with SSH forwarding. I m going to suggest something that I think is better,
and you are free to disagree)
I m not in a position to get every identity provider and service provider to
change their security posture, so I m somewhat stuck in terms of the tokens
they re willing to issue me - largely either JWTs or opaque access tokens,
with no support for any mechanism of binding that token to an instance. The
token that s going to have to be provided to the remote service is something
I have little influence over. But that doesn t mean I can t influence the
token that lands inside the agent s environment. I can issue a placeholder
token to the agent, and force it to communicate via a proxy that swaps out
the placeholder for the real thing. The worst the agent can do is exfiltrate
the placeholder token, and as long as malicious actors don t have access to
that proxy, it doesn t matter - nobody else can do anything with the
placeholder.
This isn t a terribly novel insight, and it seems like almost everybody has
reinvented this on their own. But a lot of these implementations involve you
somehow obtaining the real token in advance and then pasting that into
something that generates a placeholder that you provide to your agent
environment somehow, and it s all a bit clunky and awkward, and it also
means that you need to deal with something that keeps track of the mapping
between placeholders and real tokens and oh no we ve just invented a secret
store, and if you want this to work at scale and reliably you re just
invented a high availability distributed secret store, and a lot of people
who ve read that are now shaking their heads and reaching for gin. Can we
simplify this, and improve security at the same time? I think we can!
Remember when I said as long as malicious actors don t have access to that
proxy, it doesn t matter ? What if they do? What if they compromise one
machine inside your environment and are then able to email a bunch of
employees and convince their agents to send more tokens back to them and
then delete the email before a human reads it? Now you have someone inside
the wall with access to those tokens, and presumably with access to the
proxy, and now they can be anyone whose agent was gullible enough to think
sending them a token was a good idea. This isn t good!
So, I thought for a while, and I came up with a new idea. We can have a
broker service that obtains credentials for us. We can run that centrally,
away from the agents. A client in an agentic environment can request a
token, and that can result in a URL being generated and the user being
directed to open a URL in a browser and authenticate. When the user
authenticates, the authentication flow redirects the confirmation back via
the broker, and the broker obtains the real auth token. The obvious thing to
do now would be to return the auth token to the client in the agentic
environment, but we don t do that. Instead, we mint a new JWT, and add a new
claim - one that contains an encrypted copy of the token. In the process we
can copy over all the original claims, because those aren t secret - and now
even if the client inspects the token to figure out what access it has,
it ll get a correct answer. We sign the new token with our own signing key,
and pass that back to the client. The client now has a legitimate JWT that
is utterly useless, because the signature isn t trusted by anyone other than
us.
How does it use it? It makes an API request via a proxy, including the new
token in the Authorization: header. The proxy verifies the signature on the
token, and then decrypts the original token and swaps out the fake token for
the real one. The remote API sees what it expects, and everyone is
happy. There s never a real token in the agentic environment, but also we
don t need to store anyting anywhere. The only state is the encryption keys,
and those can be injected into the environment at startup. You need to
scale? Just start more of these processes. You need to support multiple
availability zones? Just start more of these processes in different
places. No persistent data is ever held in the broker or the proxy. You
don t need to care about distributed databases or secret stores.
This felt wonderfully elegant and I felt smug about coming up with a better
idea, and then I went to a bar earlier this week and sat down to read RFC
8705 and the guy next to me
saw that over my shoulder and asked what I was reading and I explained why I
was interested and we talked about agentic identity and then he mentioned
that fly.io had something that sounded very
similar and I read that and gosh yes
it is very similar, so damn you fly.io for stealing my ideas 3 years before
I even had them. Anyway. Now I need to do better.
Remember that there s still a risk around anyone who has access to the proxy
having access to the encrypted keys? We can remove that risk as well. It s
not uncommon for agentic environments to have an identity issued via
something like SPIFFE, at which point they have a
client certificate. You can probably guess where I m going with this. If we
require that an agent present a client cert to the broker when requesting a
token, we can embed a representation of that client cert into the token we
mint. The proxy can then require mTLS for the client connection, and can
verify that the presented certificate matches the one represented in the
token. If it does then whoever s using the token has access to the private
key associated with the environment it was issued to. If we then ensure that
the private keys backing these certificates are either hardware or
hypervisor backed, and as such tied to a specific instance, we now have a
high degree of confidence that the token can only be used in its intended
environment. Even if our identity provider doesn t support RFC 8705, we can.
This is fairly straightforward where you re using a platform where your
identity provider is also the environment that s consuming your tokens, and
more annoying for third parties. The broker potentially needs some amount of
third party vendor knowledge to make that work for everyone. This is even
more the case where login isn t via your identity provider (thanks, github),
but none of this is insurmountable - just annoying. And where vendors issue
opaque tokens rather than JWTs, this still isn t a problem; we can just mint
a new JWT that includes the opaque token as an encrypted claim, and include
the same certificate binding. The opaque token ends up being the thing
that s presented to the third party, but only after we ve verified the mTLS
binding.
In an ideal world none of this would be necessary - someone would spin up a
new agentic environment, a user would prove their identity, and a
certificate embodying that identity would be issued to the environment with
a private key that can t be exfiltrated. That certificate would be
sufficient to obtain new certificates associated with the same private key,
and we could still bind that into mTLS identity. This would be much simpler,
but browsers don t support it, so it s not likely to happen any time soon.
Anyway. Even if we can t have the best thing, we can do better than we are
at the moment, and also it would be lovely if we could standardise on this
rather than have everyone build their own thing. The end.
The Genocidal Healer is the eighth book in James White's medical
science fiction series about the Sector General hospital. As with the rest
of the series, detailed memory of the previous books is not required and
the books could be read out of order if you didn't mind spoilers.
I read this as part of the Orb General Practice omnibus.
Surgeon-Captain Lioren is a Tarlan doctor who was in charge of the medical
response to a newly-discovered civilization. The aliens were suffering
from an apparently universal plague and an ongoing vicious war waged
entirely through hand-to-hand combat, putting them on the edge of
extinction. Lioren rushed the distribution of a possible cure against the
advice of the doctors working on developing it, with catastrophic results.
As The Genocidal Healer opens, Lioren is insisting on a
court-martial in the hope of receiving the sentence it believes it
deserves and was denied: death.
(It pronouns are the convention in the Sector General series for all alien
races and formal discussions, because even someone prone to bouts of
gender essentialism such as White understood the need for avoiding gender
assumptions in a science fiction medical context.)
Predictably, both Sector General and the Monitor Corps that technically
runs the hospital are flatly unwilling to execute Lioren. Instead, he is
assigned as a new apprentice in the psychology department under the
legendary O'Mara, where he is ordered to investigate the psychological
fitness of a senior doctor named Seldal. This leads him to talk to
Seldal's patients, which in turn leads to a challenging set of ethical
dilemmas.
The first five chapters (and more than sixty pages) are the story of
Lioren's trial and a recounting of the events on Cromsag. The series is
full of medical and cultural puzzles like this, and usually I like them,
but I thought this one was less successful. We know the vague (and
horrible) outline of the ending in advance, and the massive simplification
and artificial universality that is required to make this puzzle work is
particularly blatant. A universally infectious disease is more of a
fiction plot than a believable biological concept, and the number of
failures of communication, analysis, and misunderstanding that have to
line up to create White's predetermined outcome were a bit much for me.
Once the story gets past that and into Lioren's psychological work, the
novel improves. Lioren is guilt-ridden and irrational, but also rather
arrogant about his guilt and his concepts of professional responsibility
in a way that I think mostly worked. Most of the novel consists of Lioren
slowly discovering that people like him and enjoy talking to him, much to
his bafflement. In that, it has the gentle kindness and sense of universal
basic decency that is characteristic of this series. There are, of course,
medical puzzles to solve, although this time they are primarily
psychological in nature. Various characters from previous books make an
appearance, but White re-explains their background in sufficient detail
that you don't need to remember (or have read) those previous books.
There are a lot of similarities between this book and the previous one,
Code Blue Emergency. Both feature
nonhuman viewpoint protagonists and amusing descriptions of human facial
expressions from an alien perspective. Both feature protagonists with
overly rigid ethical structures that partly clash with the generally human
policies of Sector General. The Genocidal Healer is a bit more
subtle and nuanced, although a lot of Lioren's psychological evaluation
rests on an ethical difference that I found somewhat unbelievable. This
book, though, tackles a subject the previous book did not: religion. The
treatment isn't horrible, but I have some complaints.
My primary issue is that Lioren, who starts as an atheist, does extensive
research into religion to help a patient and then starts making statements
summarizing the religions beliefs of the majority of known species that
are just... Christianity. As someone raised Christian, I recognized it
immediately as the sort of abstracted Christianity that Christians claim
is universal while completely ignoring the opinions of the adherents of
any other religion.
Key components of this majority galactic religious pattern, according to
Lioren, include an omnipotent and omnibenevolent creator god, a religious
figure who preaches forgiveness and mercy and is persecuted, and emphasis
on redemption. This simply is not some abstract universal religion. This
is just Christianity in disguise. Even in religions that have some of
those elements in their traditions, they do not get the same emphasis and
are not handled the way that Lioren describes them. I therefore found
Lioren's extended discussions of religion rather annoying, since he kept
claiming as relatively universal principles beliefs that are not even held
by the majority of religious adherents on Earth, let alone a wildly
varying collection of alien races with entirely different biology and
societal constructions. It caused a lot of problems for my suspension of
disbelief, on top of the annoyance at this repetition of, frankly,
Christian propaganda.
Lioren goes, from that research, into theodicy (the problem of evil). The
interesting part of this is White's earnest portrayal of a doctor's
approach to societal problems: a desire to find workarounds and patches
and fixes for anything that makes people unhappy, whether medical or
social. It makes sense, given the horrible biologic hands that some of the
aliens in this series have been dealt, that they would question the idea
of a benevolent god, so this philosophical digression is justified in that
sense. But you might guess that a mid-list science fiction author is not
going to say something new about one of the oldest problems in
Christianity, and indeed he does not. Lioren arrives at the standard
handwaving about the unknowability of divine intent, which I found tedious
to read but at least not fatal to the plot.
White, thankfully, doesn't take the religious material too far. The
characters recognize how sensitive of an issue religion is in a hospital,
Lioren never adopts religion fully, and the resolution of the plot is as
much biological as philosophical. White is going somewhere with the
introduction of religion, and although some of the path there annoyed me,
I think the destination worked. White was from Northern Ireland, and
therefore well aware of the drawbacks of religion, and he abhorred
violence (hence Sector General as a setting), so the reader is in better
hands with him than with most authors who might attempt this plot.
I think I know a bit too much about religion to be the best audience for
this entry in the series, and I'm not sure the introductory five chapters
quite worked. But as with all of the other books in the series, this kept
me turning the pages and I'm glad I read it. The Genocidal Healer
probably isn't worth seeking out unless you're reading the whole series,
but if you're enjoying the rest of the series, you'll probably like this
too.
Followed by The Galactic Gourmet.
Rating: 6 out of 10
Debian LTS/ELTS
This was my hundred-forty-first month that I did some work for the Debian LTS initiative, started by Raphael Hertzog at Freexian.
During my allocated time I uploaded or worked on:
[DLA 4500-1] gimp security update to fix four CVEs related to denial of service or execution of arbitrary code.
[DLA 4503-1] evolution-data-server to fix one CVE related to a missing canonicalization of a file path.
[DLA 4512-1] strongswan security update to fix one CVE related to a denial of service.
[ELA-1656-1] gimp security update to fix four CVEs in Buster and Stretch related to denial of service or execution of arbitrary code.
[ELA-1660-1] evolution-data-server security update to fix one CVE in Buster and Stretch related to a missing canonicalization of a file path.
[ELA-1665-1] strongswan security update to fix one CVE in Buster related to a denial of service.
[ELA-1666-1] libvpx security update to fix one CVE in Buster and Stretch related to a denial of service or potentially execution of arbitrary code.
I also worked on the check-advisories script and proposed a fix for cases where issues would be assigned to the coordinator instead of the person who forgot doing something.
I also did some work for a kernel update and packages snapd and ldx on security-master and attended the monthly LTS/ELTS meeting. Last but not least I started to work on gst-plugins-bad1.0
Debian Printing
This month I uploaded a new upstream versions:
Several packages take care of group lpadmin in their maintainer scripts. With the upload of version 260.1-1 of systemd there is now a central package (systemd systemd-standalone-sysusers systemd-sysusers) that takes care of this. Other dependencies like adduser can now be dropped.
This work is generously funded by Freexian!
Debian Lomiri
This month I continued to work on unifying packaging on Debian and Ubuntu. This makes it easier to work on those packages independent of the used platform. I am also able to upload Debian packages to the corresponding Ubuntu PPA now. A small bug had to be fixed in the python script to allow the initial configuration in Launchpad.
This work is generously funded by Fre(i)e Software GmbH!
Debian Astro
This month I uploaded a new upstream version or a bugfix version of:
libplayerone to experimental. For a list of other packages please see below.
I also uploaded lots of indi-drivers (libplayerone, libsbig, libricohcamerasdk, indi-asi, indi-eqmod, indi-fishcamp, indi-inovaplx, indi-pentax, indi-playerone, indi-sbig, indi-mi, libahp-xc, indi-aagcloudwatcher, indi-aok, indi-apogee, libapogee3, indi-nightscape, libasi, libinovasdk, libmicam, indi-avalon, indi-beefocus, indi-bresserexos2, indi-dsi, indi-ffmv, indi-fli, indi-gige, info-gphoto, indi-gpsd, indi-gpsnmea, indi-limesdr, indi-maxdomeii, indi-mgen, indi-rtklib, indi-shelyak, indi-starbook, indi-starbookten, indi-talon6, indi-weewx-json, indi-webcam, indi-orion-ssg3, indi-armadillo-playtypus ) to experimental to make progress with the indi-transition. No problems with those drivers appeared and the next step would be the upload of indi version 2.x to unstable. I hope this will happen soon, as new drivers are already waiting in the pipeline. There have been also four packages, that migrated to the official indi package and are no longer needed as 3rdparty drivers (indi-astrolink4, indi-astromechfoc, indi-dreamfocuser, indi-spectracyber).
While working on these packages, I thought about testing them. Unfortunately I don t have enough hardware to really check out every package, so I can upload most of them only as is. In case anybody is interested in a better testing coverage and me being able to provide upstream patches, I would be very glad about hardware donations.
Debian IoT
This month I uploaded a new upstream version or a bugfix version of:
tl;dr
This is not an official package, it's good enough for me and it might be good
enough for you, confirmed as working in Debian Testing but I don't have a
Stable machine to test there.
You can use my custom repo to install the latest NVIDIA drivers on Debian
Stable, Testing or Unstable (install from Sid repository):
https://deb.debusine.debian.net/debian/r-samueloph-nvidia-ai/
The page above contains the APT sources you need, just add the one for your
release to /etc/apt/sources.list.d/r-samueloph-nvidia-ai.sources, run sudo apt update and install the packages, you might need to disable Secure Boot.
This is not about AI
Discussions about AI are quite divisive in the Free Software communities, and
there's so much to be said about it that I'm not willing to go into in this
blog post. This is rather just me telling people that if they need up-to-date
NVIDIA packages for Debian, they could check if my custom repository gets the
job done.
The AI part is a means to an end, I've been careful to note in the repository
names that the packages were produced with AI to respect people who do not want
to run it for any reason.
RTX 5000 series support
Back in May 2025 I opened a bug
report asking for
the NVIDIA drivers on Debian to be updated to support the RTX 5000 series. The
Nouveau drivers might be good enough for some people, but I need the NVIDIA
drivers because I want to play games and do experiments with open weight
models.
Opening a bug report doesn't guarantee anything, at the end of the day Debian
Developers are volunteers, so if I really wanted the newer drivers, I would
have to do something about it, ideally submitting a merge request.
I briefly looked into the NVIDIA packaging, which involves 3 source packages
(and one extra git repo for tarballs), unfortunately this was going to take
more time and effort than what I was willing to spend.
What I Did
After a few weeks of lamenting that I wasn't running the NVIDIA drivers, I
figured I was willing to put in more effort than I originally thought, just
enough to instruct the Claude Code agent to package the latest releases. I'm
skilled enough with agentic tools that I knew how to use it to save time;
providing a clear instruction on how to build the package and explaining the
packaging layout, then letting the agent iterate until it gets a working build.
The agent was running inside a VM that didn't have any of my credentials.
After a little bit of back and forth, where I was reviewing the changes guiding
the agent into how to fix certain issues, I ended up with a working set of
packages.
Once I installed it on my machine and confirmed they worked, I set up a
debusine repository to make it easier to
install future updates, and let others test it out.
Debusine is analogous to Ubuntu's famous PPA, or Fedora's EPEL, it's a
relatively new project but it has been working fine for this.
Matheus Polkorny helped me test the packages and did spot a few issues which
are fixed now. The Debusine developers were also always quick to respond to my
questions and bug
reports.
How Good Is It?
Short answer: good enough for daily use, but not a substitute for an official Debian package.
The whole point of doing this is because I don't have enough free time to
maintain the package myself. All of this work was done as a volunteer, on my
personal time.
This means I'm trusting the agent to some degree; I review its commits but I
don't go too deep into it, the quality will be dictated by the fact that I'm
a Debian Developer and so by how easily I can spot issues without double checking
everything.
I only have a single machine with an NVIDIA GPU, this machine runs Debian
Testing and so I don't have a way to test the Stable packages. I can do my best
to address problems but at this point there is a risk that new updates break
something.
Installing NVIDIA drivers has always been a bit risky regardless, if you're
comfortable with reverting updates and handling a system without a graphical
interface (in case you end up in a tty), you will be fine.
You will likely need to disable Secure Boot in order to use them, or set up your
BIOS so that a MOK can be used to sign the DKMS modules.
When choosing the version strings for the packages, I was careful enough to
pick something that would sort lower than an official Debian package, meaning
that whenever that same version is packaged in Debian, your system will see it
as an upgrade.
If you have any other methods of installing the NVIDIA drivers on your Debian
system that is working for you, you should likely stick to that.
I have a strong preference for installing them through .deb packages, making
the package sort out configuration changes and dependency updates, besides
handling the DKMS modules.
Ultimately I'm not happy with the amount of difficulty that Debian users have in
installing up-to-date NVIDIA drivers, and I hope this makes it easier for some.
How To Install
Head over to the Debusine page that contains both repos for Trixie (Debian
Stable) and Sid (for Debian Testing and Unstable):
https://deb.debusine.debian.net/debian/r-samueloph-nvidia-ai/
If you are running Debian Testing, then pick the Sid repository.
That page contains the contents of the apt .sources file you need, create the
file /etc/apt/sources.list.d/r-samueloph-nvidia-ai.sources with the sources for your release.
Run sudo apt update and install the packages you need, if you already have a
previous version installed, sudo apt upgrade --update would update them.
If there are no upgrades, meaning you don't have a previous version installed,
then you need to explicitly install them.
If you run into issues in Debian Stable, consider using the Linux kernel package
from the backports repository, if you need an up-to-date NVIDIA driver, you
likely should also be running the backports kernel package (if you can't
upgrade to Debian Testing).
Future Plans
I currently have no means of measuring how many people are using the debusine
repositories, so if you do end up using it feel free to let me know somehow.
I don't know for how long I will keep managing this repository, and how much
effort I will spend, but my machine needs it and for now I will keep it
up-to-date with the latest production-grade NVIDIA drivers.
Review: The Martian Contingency, by Mary Robinette Kowal
Series:
Lady Astronaut #4
Publisher:
Tor
Copyright:
2025
ISBN:
1-250-23703-3
Format:
Kindle
Pages:
390
The Martian Contingency is the fourth book of the mostly-realistic
science fiction alternate history series that began with the novelette
"The Lady Astronaut of Mars" and the
novel The Calculating Stars. It returns
to Elma York as the main character, covering her second trip to Mars after
the events of The Fated Sky. It's
helpful to remember the events of the previous two books to follow some of
the plot.
Elma is back on Mars, this time as second in command. The immediate goal
of the second Mars mission is to open more domes and land additional crew
currently in orbit, creating the first permanent human settlement on Mars.
The long-term goal is to set up Mars as a refuge in case the greenhouse
effect caused by the meteor strike in The Calculating Stars
continues to spiral out of control. Elma is anxious and not looking
forward to being partly in charge, particularly since her position is
partly due to her fame with the public (and connection with the American
president). She'd rather just be a pilot. But she'll do what the mission
needs from her, and at least this time her husband is with her on Mars.
As one might expect from earlier installments of this series, The
Martian Contingency starts with the details and rhythms of life in a
dangerous, highly technical, and mission-driven scientific environment:
hard science fiction of the type most closely modeled on NASA and real
space missions. Given that this is aimed at permanent Mars colonies that
would theoretically have to be independent of Earth, it requires a huge
amount of suspension of disbelief for the premise, but Kowal at least
tries for verisimilitude in the small details. I am not an expert in early
space program technology (Kowal's alternate history diverges into a
greatly accelerated space program in the 1950s and, for example, uses
female mathematicians for most calculations), so I don't know how
successful this is, but it feels crunchy and believable.
As with the previous books, though, this is not just a day in the life of
an astronaut. There's something wrong, something that happened during the
first Mars expedition while Elma was in orbit and left odd physical clues,
and no one is willing to talk about it. Elma is just starting to poke
around before the politics at home go off the rails (again), exacerbated
by a cringe-worthy social error by Elma herself, and she once again has to
navigate egregious sexism and political meddling in a highly dangerous
environment a long way from home.
It is a little surprising that I like this series as much as I do. I don't
particularly care for pseudo-realistic science fiction, although I admit
there is something deeply satisfying about reading about people following
checklists properly. The idea of permanent Mars colonies as an escape from
a doomed Earth is unbelievable and deeply silly, but Kowal locked herself
into that alternate future with "The Lady Astronaut of Mars," which is
still set in the future of all of the books so far. A primary conflict in
each of the books comes from the egregious sexism and racism of a culture
based on 1950s American attitudes towards both, and the amount of progress
Elma can make against either is limited, contingent, and constantly
compromised.
And yet. At its best, this series is excellent competence porn, both in
the spirit of the Apollo 13 movie and for the navigation of social
and political obstacles and idiocy. Elma is highly competent in a
believable and sympathetic way, with strengths, weaknesses, and an ongoing
struggle with anxiety. There is something rewarding in watching people
solve problems and eventually triumph by being professional, careful,
principled, and creative. It's enough to make a good book, even if I am
not that interested in the setting and technology.
As with the rest of the series, this will not be for everyone. You have to
be up for reading about a lot of truly awful sexism and racism without the
payoff of a complete triumph. This is a system that Elma navigates, not
overthrows, and that's not going to be enough for some readers. You also
have to accept the premise of a Mars colony, which in an otherwise hard
science fiction novel is a bit much despite Kowal's attempts to
acknowledge some of the difficulties. But if you don't mind that
drawbacks, this series continues to be an opportunity to read about people
being quietly and professionally competent.
This is not my favorite entry, mostly because Elma makes a rather
humiliating mistake that's central to the plot and has a lot of
after-effects (and therefore a lot of time in the spotlight), and because
there is rather a lot of discussion of sexuality that felt childish to me.
The intent was to try to capture the way people in the 1950s talked about
sex, and perhaps Kowal was successful in that, but I didn't enjoy the
experience. But I still found myself pulled into the plot and happily
rooting for the characters, even though a reader of "The Lady Astronaut of
Mars" has a pretty good idea of how everything will turn out.
If you liked the series so far, recommended, although I doubt it will be
the favorite entry for most readers. If you did not like the earlier books
of the series, this one will not change your mind.
Content notes: Way, way too much detailed discussion of an injury to a
fingernail than I wanted to read, as well as some other rather explicit
description of physical injury. Reproductive health care through the lens
of the 1950s, so, uh, yeah. A whole lot of sexism, racism, and other forms
of discrimination that is mostly worked around rather than confronted.
Rating: 7 out of 10