Viewing topic: Geekery

Argon One v2 case fan control with LibreElec 10

I do like my 8Gb Raspberry Pi 4B. With LibreElec installed, it’s an excellent way to have Kodi streaming on a TV. The only trouble is, the case I got with my Pi 4B kit was a lightweight plastic one, and the cables sticking out of the back and side stop it from sitting flat on its shelf by the TV.

So I’ve treated myself to what seems to have become the serious Raspberry Pi case – the Argon One v2. I particularly like it because:

  • It’s relatively heavy so doesn’t tilt off its feet when cables are connected
  • All the ports (except the SD card) are at the back which is much tidier
  • It has a programmable fan and a power/reset switch
  • Although pricier than some cases, it still won’t break the bank.

It arrived in a smart box with a printed instruction booklet in English (not Chinglish!), and a bag containing thermal pads, screws and rubber feet. Nice considering the low cost and the fact that the Pi is a hobbyist computer.

Argon One v2 Hardware installation

Installing my Pi in its new home was fairly easy:

  1. Take it out of the old case
  2. Twist off the 4 heatsinks (the old case didn’t have a fan) while still warm (so the thermal pads are soft)
  3. Use a few cotton buds dipped in anti-COVID alcohol to remove the residue of the thermal pads from the chips that were heatsinked
  4. Follow the instruction booklet. I set the power jumper so that whenever there’s a power failure, it switches on automatically when power is restored (and if you live in the Philippines as well, you’ll almost certainly want to do the same).

After that, I connected everything (I had to switch to a full-sized HDMI cable instead of the micro-HDMI one I had been using) and powered up. No problems – except that the fan was running at full tilt (and full tilt is bloody noisy – it can be heard clearly over 10 metres away).

Happily this can be corrected in software (and this is the whole point of this article). Read on.

LibreElec Software Installation

Argon Forty provides software that lets the operating system control the fan and also the power/reset switch. The primary version of this software is for Raspberry Pi OS (formerly Raspbian), but there is a simpler version available for LibreElec.

To install it, do the following:

  1. In the Kodi UI, install the Raspberry Pi Tools and System Tools here:
    Addons > Install from Repository > LibreElec Addons > Program Addons
  2. Check that you have SSH enabled in LibreElec/Kodi
  3. Reboot your Pi (either via SSH or in Kodi)
  4. SSH in as root
  5. Run the following command:
    curl | bash
  6. Reboot your Pi

Now, you have a new command available to you. In a SSH session, you can enter ./argonone-config to adjust the fan control. When you run the command, it asks you to confirm that you want to override the fan setting, then it asks you if you want the fan always on or not. Simples.

Except it doesn’t work. The fan just keeps running at full speed.

After hitting the search engines, it seems this may be a problem introduced in LibreElec 10 because it uses an updated version of Python. I could be wrong about this conclusion, but that doesn’t matter. What matters is finding a solution.

And I found one – in two parts.

Fixing the lack of control, part 1

Firstly, you have to get the Argon One system service to reference Python at a different location. Here’s how you do it:

  1. SSH in to your Pi as root.
  2. Edit the argononed.service file
    nano /storage/.config/system.d/argononed.service
  3. In that file, there is a line starting with ExecStart. Change that line to read as follows:
    ExecStart=/bin/sh -c ". /etc/profile; exec /usr/bin/python /storage/.config/"
  4. Reboot your Pi.

Now, when you use the ./argonone-config command, the fan will obey. Woot!

But it’s still either full speed or off, all or nothing. We can improve on that.

Fixing the lack of control, part 2

If you do some exploring, you’ll see that argonone-config is actually just the name of a bash script file and you can edit this file. So let’s take a look. If you enter nano argonone-config in the default SSH folder, you’ll see the contents of the bash file, and near the end you’ll see something like this:

if [ "$confirm" != "Y" ]
        echo 90"="100 >> $daemonconfigfile
        echo "Fan off."
        echo 1"="100 >> $daemonconfigfile
        echo "Fan always on."

Let’s focus on those numbers. On each echo line with numbers in it, the first number is the minimum CPU temperature (in celsius), and the second number is the fan speed percentage.

For example, 90"="100 means “When the temperature is 90 degrees or higher, run the fan at 100% speed”.

From checking some online examples, I found that you can provide multiple instructions and they will all be obeyed. For example:

echo 40"="50 >> $daemonconfigfile
echo 60"="100 >> $daemonconfigfile

This means “When the temperature is 40 degrees or higher, run the fan at 50% speed, but when it reaches 60 degrees, run the fan at 100% speed”.

Now, my Pi tends to run at about 42 degrees when idle, increasing somewhat when it’s working harder (and that’s fine – as long as it doesn’t increase by too much).

So after some experimentation I edited the above code block so it looks like this:

if [ "$confirm" != "Y" ]
        echo 45"="5 >> $daemonconfigfile
        echo 50"="10 >> $daemonconfigfile
        echo 60"="40 >> $daemonconfigfile
        echo 70"="70 >> $daemonconfigfile
        echo 80"="100 >> $daemonconfigfile
        echo "Fan is progressive."
        echo 1"="100 >> $daemonconfigfile
        echo "Fan always full speed."

So now, when my Pi is idle (i.e. below 45 degrees), the fan is off. When it starts heating up a bit, the fan kicks in, low speed at first, then progressively higher to cool it more aggressively. It works a treat.

Job done!

The fan’s still a bit noisy even at low speeds, but the only way around that would be to install a better quality one in the case.

And if you want an even more versatile script with additional options, like the one Argon Forty provided for Raspberry Pi OS, you can explore this LibreElec forum post. Lots of juicy coding goodness.

But what about the power/reset switch?

Well, that’s another story.

Sadly, the currently-available LibreElec code for the Argon One v2 case does not allow customisation of the power button. So I’m stuck with the default settings, which are:

  • Short press (<3s): does nothing
  • Long press (>3s): shutdown
  • Very long press (>5s): force shutdown
  • Double-click: restart

But to be honest that’s totally fine for me. These defaults seem very sensible and I’m not sure what I’d change even if I could.


Running Baikal DAV server on a RunCloud VPS

28 Mar 2022 / / /

A proper tech post…

If, like me, you need to keep a calendar and contacts synced between computer (M1 Mac) and phone (Android), have a limited budget, but are not willing to sell your soul or your data to a tech giant in order to do so, your options are limited. Apple iCloud? No. Microsoft Outlook? Nope. Google? Absofuckinglutely not. Zoho? No, I don’t trust them either.

Away from the giants, the best known third party option is Fruux, and I used it for quite some time, but increasingly it throws errors when Apple Calendar tries to sync, and its web interface displays HTTP 500 errors more often than real pages.

Some web hosting companies also offer CalDAV and CardDAV hosting if you use their services, but none of these companies are ones that I would actually trust to keep my data safe and help me if there was a problem (Ionos? Do me a favour…).

Self-hosting options

Now you’re talking.

There are a few possible contenders:

  • OwnCloud – PHP-based groupware, focus is on corporate solutions but self-hosting available
  • NextCloud – Fork of OwnCloud by the original creator, widely used
  • Radicale – Python-based pure CalDAV and CardDAV server (much narrower focus than NextCloud)
  • Baikal (styled as Baïkal for some reason) – PHP-based pure CalDAV and CardDAV server

There may be more but these were the ones I found.

Because I’m a PHP expert with no real experience of Python, that put Radicale out of the running for me. And after reading many comparisons of OwnCloud and NextCloud, it was clear that NextCloud attracts many more self-hosters than OwnCloud.

So, NextCloud or Baikal? One is a complete groupware environment, the other a small, lightweight, focussed solution.

Well, I tried both. Duh.

In fact, and here is a small diversion in the interests of completeness, I tried them both about 2 years ago, and failed to get either one working reliably, which is why I ended up using Fruux for ages.

In NextCloud’s case, I got it installed successfully (I believe I was using Cloudways hosting at the time), but I wanted to make proper use of the groupware features such as file storage, and I couldn’t make it accept any file uploads larger than about 10Mb. No way, no how. Looking back now, I guess it would have been related to this issue, but at the time I couldn’t get NextCloud support to take me seriously. So my assessment of NextCloud was “fuck this for a game of soldiers”.

Then I tried Baikal, but couldn’t get either Apple Calendar or Thunderbird’s Lightning to connect and sync. Since I think this was in 2020, I would have been using Baikal 0.5.x, though I can’t recall precisely.

I figured the “0.” in front of the version meant that Baikal simply wasn’t ready for primetime, and didn’t pursue it further. I found Fruux, which was free for up to 2 devices, so for a while that was OK.

Now, fast forward to 2022, and both Thunderbird and Apple Calendar keep failing to connect to Fruux. Also, as noted above, logging in to Fruux to check if events are getting through often results in HTTP 500 error pages.

So the inevitable thought that crossed my mind (well, inevitable if you’re me) was, “hmm, I wonder if Baikal is better now?”

Setting up Baikal

These days I manage a set of bare-metal VPS servers with RunCloud, which means I have far greater control over everything than when I used Cloudways. I decided that Baikal had to be worth one more try.

So, here are the steps I followed:

  1. Set up a subdomain to use for Baikal (you know, like
  2. Created a new system user in RunCloud.
  3. Created a new empty hybrid webapp (Nginx + Apache) in RunCloud, controlled by the above system user, and added a Let’s Encrypt certificate.
  4. Created a new database + user in RunCloud.
  5. Downloaded and unzipped Baikal 0.9.2.
  6. Read the installation instructions.
  7. Uploaded the Baikal install files to the webspace, and set the application root to point to the html folder in the RunCloud console.
  8. Ran the installer in my browser, choosing the MySQL database option.
  9. Set up a user account in Baikal and tried to connect from my Mac. No joy.

Damn, I thought.

Then I read the installation instructions again, particularly the Nginx Configuration section.

What I had thought was unnecessary code (because RunCloud sets up the virtual host automatically) actually contained a couple of lines that were related specifically to a DAV setup:

rewrite ^/.well-known/caldav /dav.php redirect;
rewrite ^/.well-known/carddav /dav.php redirect;


So I added these two lines to a fresh custom Nginx config file in my RunCloud console. I selected the “location.main-before” priority and called the file “wellknown.conf”.


The Accounts app in Apple System Preferences instantly connected to Baikal – both CalDAV and CardDAV. Note that I used just the basic subdomain name as the server name when connecting (like, no https, no slashes, no path, nothing else).

So I imported my calendar and contacts files and could see the event and contact counts gradually increasing in the Baikal admin console.

Next, I used DAVx5 on my Android phone to connect, which it did without problems.

A simple, satisfactory solution

So, I now have a private online calendar and contacts address book, hosted using open source software on a server that I pay for anyway, and accessible by as many devices as I choose. I can back it up whenever I like, either via exporting in macOS or a complete FTP backup and database dump, and I can restrict access to specific IP addresses in RunCloud if I choose.

Job done.


Free as in beer

19 Feb 2022 / /

I have a complicated relationship with FOSS (Free and Open Source Software) .

I like not paying for things where possible – who doesn’t? It makes my money go further (sometimes quite a bit further). I am also vehement in my dislike of the concept of software by subscription – if I buy something, it should be mine to use forever.

So for many years I have sought out and used free alternatives to the commercial software I would otherwise have had to buy. I use LibreOffice instead of Microsoft Office. Before LibreOffice I used OpenOffice. (Before OpenOffice I used a pirate copy of Microsoft Office like everyone else, but this article isn’t about piracy.)

As someone involved in web development, I also use graphic and design software. Initially because of the massive financial outlay, and later because of their subscription model, I have avoided Adobe software like the plague, and for several years my primary tools have been The Gimp and Inkscape.

But as my need to create SVG illustrations has grown over the last year, I have encountered more and more problems with Inkscape. The user interface is nosebleed-inducingly complex and not at all intuitive, SVGs downloaded from the web often look completely different when loaded in Inkscape, dealing with paths is very fiddly, and it continues to crash with distressing frequency.

Recently I found Inkscape simply couldn’t properly render some SVGs I had to edit, and as I was up against a deadlne, I had to find something else, and it had to be easy to use (no time for a steep learning curve).

So I had a hunt online. After I had eliminated everything that didn’t work on a Mac, everything that needed an account to use (Why? It’s a fucking image editor!), everything that ran in a browser (that’s just silly), and everything on a subscription model (see above), there wasn’t much left. There was the free macSVG, which is just garbage, and there was Affinity Designer, which isn’t free but is quite cheap and there is no ongoing subscription.

I downloaded Affinity Designer and tried it out (10 day free trial), and within 24 hours it had persuaded me to stump up the $50 for a license. Now I use it daily and it’s an absolute joy to use. After that I had to try Affinity Photo and found that it was also light years better than its open-source counterpart (The Gimp), so I’ve bought that as well. I’m saving hours every week in previously lost productivity.

Now, the point of these musings isn’t to advertise Affinity Designer or Affinity Photo, but rather to make the point that, often, you get what you pay for. Or as my wife endearingly says, you pay what you get for.

To put it another way, an application like Inkscape may have a number of talented developers working on it, but if they are not being paid for their work, that means it is not their primary focus, and they cannot be relied on to make improvements or squash bugs in a timely manner. And when an application is mission-critical, that’s often not good enough.

In its favour, free software is generally (though not always) open source, which has the useful attribute of allowing the source code to be audited to ensure it contains nothing malicious, but I’ve come to realise that this in itself isn’t enough to make the free option the best option. I feel this fact is often missed by FOSS purists (you know, the ones who think Richard Stallman is sane).

So let’s hear it for pragmatism. It’s good to save money and have access to source code, but it’s also good to get things done.


Being online in the Philippines

20 Jan 2022 / /

Now that I’ve lived in the Philippines for over three years, I’ve gained a few insights into the ins and outs of getting and staying online.

As an IT consultant, being connected with both computer and phone is kind of essential, as is a reasonable connection speed without download/upload restrictions.

I am (mostly) successful at having a constant connection, but sometimes it’s a real struggle.

When my wife and I first moved here and were living in a hotel, the first step towards being independently online was to get mobile phones with proper postpaid contracts (buying prepaid data is really expensive).

But let’s backtrack a little first. There are two real telecoms companies in the Philippines – PLDT and Globe. Every other telecoms company, brand or provider is piggybacking or white-labelling PLDT and/or Globe. Effectively it’s a duopoly; a cartel of two (and they act like it). The new third provider, Dito, is nowhere near nationwide yet and won’t be for some time.

Data on the go

For mobile, there’s Globe, TM (part of Globe), Smart (part of PLDT), Sun (part of PLDT), etc. We opted for Globe because most of our local contacts used Globe and there are cross-network charges.

It turned out that in order to open a Globe postpaid account (i.e. a monthly subscription contract), you had to have a local credit (not debit) card. And in order to have a local credit card, you have to have a local bank account, though not all local banks offer a credit card straight away.

Now, in order for a foreigner to have a local bank account, that foreigner needs an ACRI (Alien Certificate of Registration) card, which I wouldn’t be able to get for several months because of the type of Visa I was on. You get the idea – A needs B which needs C which needs D and by the time you get to D you’ve forgotten what A is.

Luckily my wife is Filipina so she opened a savings account with a local bank, applied for a credit card, and three weeks (!) later it arrived and we got our mobile contracts set up. Approx $14/month for me (8Gb/month) and $22 for my wife (12Gb/month). Transfer rates are anything up to about 12Mbps, depending on the signal strength. Usually it’s no more than about 7Mpbs.

Three years later we’re still with Globe on the same contracts. That doesn’t mean we’re happy with the service we’ve received; it just means changing is a big hassle and keeping your number when changing provider has only just been made legal. Coverage is spotty in rural areas almost everywhere, and you will get at least one sales call every month asking if you want to upgrade your contract. We learned to block those numbers.

Data at home

As above, your choices are effectively PLDT (Fibre) or Globe (SIM-card-in-a-router), since every other broadband service company is using the PLDT or Globe backbone. However, choosing a smaller local “last mile” company can make sense, since some of them have wholesale contracts with both PLDT and Globe, and when one goes down they can switch their customers to the other.

A smaller local company will also almost certainly have more responsive customer service than PLDT or Globe, though that isn’t saying much. If your PLDT connection goes down, their standard response time for a fix is up to 6 (yes, six) working days.

When we moved to the Philippines, our first house was within reach of Globe and Sky (I think Sky uses the PLDT backbone); PLDT wasn’t an option. Globe would only offer 10Mbps and Sky could provide 15Mpbs, so we got Sky (co-ax cable from a street box into the house).

Later, when we moved house, the new house had a PLDT fibre connection so we took over the contract from the seller. You see, PLDT fibre connections are like gold dust; if the street box nearest your house already has all 8 lines allocated, you could wait years for them to install another box nearby, because they won’t install one unless at least 4 households in that location ask for a connection. And with PLDT offering 25Mbps for the same price as Sky’s 15Mbps, it would have been crazy to give it up. Now, the line has been upgraded and I routinely get over 30Mpbs within the Philippines, though connecting to Europe is still slower, not usually faster than 15Mbps – evidence that PLDT are seriously overselling their infrastructure.

AMUSING NOTE: PLDT provide a router with both wifi and LAN ports – but devices on wifi can’t see devices on the LAN ports and vice-versa. You have to search online for the super-admin password and do some esoteric telnetting into the router to fix it – and whenever there’s a power outage or you reboot the router, you have to apply the fix again. I’m not sure exactly why they have this restriction; I can only assume that it’s because they’re FUCKING ASSHOLES.

Because PLDT is so awful, we tried to get on board with a local provider called Fil Products (they use PLDT backbone but install their own last-mile fibre and don’t cripple their routers), but it turns out that they have the same street box problem – all the lines near our house are taken, and they won’t install another street box until – well, I’m not sure until what. They wouldn’t say.

There’s another local option where you install a microwave antenna on a 10 metre pole and it connects line-of-sight to the company’s tower (where it joins the PLDT backbone) – but their monthly charge is 5 times everybody else’s.

And of course I could buy a SIM card modem like this one and put a 4G data-only SIM into it. Globe do a data-only SIM on a 6 month contract, instead of the 2 year contracts required for a normal voice+data SIM. Where we live right now, though, I’d have to install a bloody big parabolic antenna on a long pole to get decent speeds.

So right now we’re still with PLDT and not at all happy about it.

Situation normal, all fucked up

Now I’ve explained what’s available, let’s add natural disasters into the mix.

In December 2021 a typhoon hit central Philippines. In our area, Globe’s mobile signal for voice and SMS disappeared for several days, and mobile data was unavailable for two weeks. PLDF fibre connections mainly kept going with some shorter outages, but speed was seriously down. And the power was out for over a week anyway, so we would have had to power the router with a generator.

A few days of disruption are to be expected, but things are still bad six weeks later. Somewhere nearby, one or more Globe towers must still be without power, because the mobile signal at home is now only usable in the front garden. And there are still big issues with the PLDT backbone somewhere, because the fibre connection slows to a crawl every evening – way more than usual. There’s no point in calling their customer service, because they wouldn’t have a clue. They understand technical issues about as well as the average hedgehog.

And I haven’t talked about the weekly (sometimes more often) power outages caused by the incompetence and apathy of the local electricity company, which usually rob us of at least 8 hours power a week. These led me to buy a battery-powered inverter, so at least I can run the PLDT router to save burning mobile data during the outages. I also invested in 2 weighty USB powerbanks and a Mac M1 with its amazing battery life.

Still want to be a digital nomad in the Philippines?

To be fair, most of the time I’m connected and online. But the two worst aspects are the lack of real choice of provider, and the appalling standard of customer service at both PLDT and Globe.