Setting up a mirror for postmarketOS pmaports on Arch Linux

Running a mirror for postmarketOS is fairly simple, and it allows you to alleviate some pressure from the main pmaports mirror if you're installing from pmaports often... Not to mention you'll almost certainly experience a rapid speed-up in downloading from it (compared to the official mirror) if your mirror is local/close.

I set up my mirror on Arch Linux, so the info below is specific to systemd. However it could easily be adapted to crontab or something similar.

The actual synchronization is handled by a systemd timer that fires every hour, and runs a systemd service.

The timer:

Description=Hourly sync with the postmarketOS binary repo



And the service::

Description=Sync with the main postmarketOS binary repo

ExecStart=/usr/bin/rsync -rh --progress --delete rsync:// /srv/http/postmarketos/
Description=Hourly sync with the postmarketOS binary repo

Pay special attention to the destination for rsync, in this case it's /srv/http/postmarketos, you may want to have it elsewhere.

Enable the timer:

$ sudo systemctl enable postmarketos-mirror.timer

You can trigger the service manually:

$ sudo systemctl start postmarketos-mirror.service

I run this mirror behind nginx, here's the server fragment I use to set that up (adjust server_name and the ssl_certificate/ssl_certificate_key accordingly):

server {
        listen 80;
        listen 443 ssl http2;
        ssl_certificate /etc/ssl/ansible/;
        ssl_certificate_key /etc/ssl/ansible/;

        ## Check if this certificate is really served for this server_name
        if ($host != $server_name) {
                return       444;

        location / {
                root   /srv/http/postmarketos;
                autoindex on;

SSL isn't really required for the mirror, and mine is available over http too, but I have it as an option since it's dead simple to set up and maintain.

On removing a stubborn square tapered bottom bracket

I recently acquired enough quality parts to upgrade my road bike's drivetrain from 9 speed to 10 speed. It couldn't have come at a better time too, my old bottom bracket was starting to get that hallmark 'coffee grinder' sound to it.

Of course the old bottom bracket was more difficult to remove than every online tutorial would have you believe. The hosts of these videos must be some of the strongest people alive, or they're working with some perfect setup where the bottom bracket was installed minutes before and has never been used. You know what I am talking about.

In the real world, bottom brackets are a pain in the ass to remove. The area that the bottom bracket tool has to grip the bottom bracket is often shallow, and tool slippage is a real challenge. It can do things like damage threads in the frame (or so I've heard, I've luckily never accomplished this), and cause you to accidentally grind your knuckles on things (I wish I were going off of rumors on that one.)

I figured out a neat trick with my particular bottom bracket tool to remove the old square tapered bottom bracket using no extra parts, except for a washer added for good measure. Here are all the parts you need:

The bolt is the dust cover bolt from the cranks, that screws directly into the threads at the end of the square taper. The bolt is long enough to reach the threads with enough room to spare, even when inserted into the tool. I added a washer because the diameter of the bolt head is just barely larger than the tool opening, and I didn't want it to pop off unexpectedly when I was giving it my all. If the bolt isn't long enough, find one that is with the same threading as the original bolt!

Don't get too crazy tightening the bolt, I just used my hand to tighten it. The goal is to have the tool held tight to the bottom bracket. With the tool securely fastened to the bottom bracket, it's time to get to wrenchin':

After cleaning off the threads in the frame, it is now ready to accept a new bottom bracket!