My thoughts on Slackware, life and everything

Alien Pastures is now powered by Hugo, Forgejo, Artalk and Sveltia

Hugo logo

After lots of testing and dry-runs, I have finally decided that it is time to say goodbye to Wordpress as the Content Management System (CMS) for the Alien Pastures blog.

As of today, my site content is managed in a private Git repository on the Slackware Community Forge, which is powered by Forgejo. I will edit my posts using Sveltia, directly in the Git repository, and the power of Forgejo’s workflows launches Hugo in a Docker container to re-generate the static HTML for my blog every time I publish a post.

And finally, an Artalk server will manage the comments on my blog via a separate local Docker container.

Leave comments and suggestions down below in the comments section please :-)

Heads-up: Alien Pastures blog will become Hugo-powered

I have been playing with the idea of leaving Wordpress behind as the content publishing platform for my Alien Pastures blog.
Wordpress is great software and it's versatile and offers a wealth of plugins that allow the blog owner to do all kinds of nice stuff. For me it was the ideal solution at the time when I wanted to create a blog and was looking for something self-hosted but also self-contained (the whole blog in one single directory). I was not sure if I would be able to keep running it on the server where the blog was born, therefore something like Wordpress CMS combined with a SQLite file-based database backend was perfect.

That was 16 years ago, and the blog moved servers, grew a lot in content and it uses a proper MariaDB backend now. But it puts a strain on the servers where I host(ed) it; the stable Slackware versions (first 14.2, then 15.0) have become stale and Wordpress started requiring versions of PHP and MariaDB that were not available for the Slackware version I was using... also the blog increasingly needs protection from scammers, spammers, AI-bot-scrapers and hackers; it needs performance tweaks to deal with server load and executing the interpreted PHP code in which Wordpress is written, and there are security vulnerabilities discovered in Wordpress and its plugins all the time.

When today I had to upgrade the Wordpress code and a good ten plugins again because of a un-authenticated Remote Code Execution (RCE) vulnerability, accompanied by stern warnings to "backup your database first!", I knew that my research would ultimately pay off.

I decided to move forward with an experiment I have been conducting for a while. My future blog pages will all be static HTML. Nothing is interpreted, nothing is vulnerable other than potentially Apache or Slackware itself, and I will use a Docker container for a part of the new setup.

That setup is based on a new (private) git repository which will hold my blog's content after it has been converted from Wordpress syntax into Hugo syntax and layout. Hugo is a static site generator, written in Go. How that will work with this git repository?

  • I run a converter on a full export of the Wordpress blog (that's a single XML file containing everything except the media files) to generate a collection of static HTML pages that will become the "legacy" part of the new blog.
  • In a private repository on the Slackware Forge I will store the Hugo framework defining the layout of my blog, the theme for my blog (a Hugo port of the GPL-licensed Wordpress theme 'Hemingway' by Anders Norén which I currently use), the converted legacy (Wordpress) content plus the Sveltia in-browser editor which I will be using to write and publish new articles. Sveltia can read the repository's full content and can also write to that repository.
  • Since a Hugo-generated static web site does not know the concept of a comments section because that goes against the static page concept, I will run a self-hosted Artalk comments server in Docker. My new blog will load the comments below each blog article by asking the Artalk server for them over a trusted connection, protected by Docker secrets.
  • When someone posts a comment, it is held in a moderation queue, unless that someone (the combination of nickname and email address) already has an earlier approved comment, in which case the comment will automatically be approved by a moderator bot within the minute. This moderation plugs into an Akismet anti-spam service just like I have right now on the Wordpress blog. It will prevent me from having to deal with a hundred spam comments per day.
  • When I make a change to the repository (updating the blog layout, adding a new theme, whatever) this triggers a Forgejo CI workflow in git. Those triggers are very similar to Github runners if you use CI on Github (or any other git platform). The Forgejo runner starts a Docker image which contains Hugo; Hugo fetches the repository content, renders the lot into static HTML pages and packs the whole set into a registry package.
  • A cron job on the blog server polls the Forge for updated site content packages every two minutes, and pulls that package when one becomes available. It unpacks the tarball (it's nothing more than that), checks if the sha256 checksum is correct and then refreshes the blog's content - the pages which you are seeing.
  • When I want to write or update an article, I launch Sveltia (via a hidden URL on the blog), login to the Slackware Forge and start writing.  When I click "publish", Sveltia will commit my article to the private repository, triggering the CI workflow, and two minutes later the new article is online.
    When I save an article in Draft, then Sveltia commits the article in a temporary git branch; any branch except "main" will never trigger the CI workflow, so you will never see my drafts by accident :-)

There's a lot of moving parts in that setup, and it is not as straight-forward as Wordpress; but it is a good learning experience into Git workflows. Also, the constituent parts (except for the free tier of the online Akismet anti-spam service) that I deploy locally are not tied to any kind of commercial entity and fully open source. And it's a hundred percent safe solution.

And... you may have noticed that I wrote the above plan in great detail. That is because I have all of this already running as a staging server while I debug this new setup, remove the kinks and tweak everything to my liking. Feel free to look and click around, post comments if you want, but know that all of that will be wiped again when I make the switch. Also the content of that staging server is frozen to the moment when I did the last content conversion. This new post will not appear there.

Have a look at https://hugo.slackware.nl/ and tell me when you find bugs. I need some time for an actual cut-over and I am not yet completely happy with the Sveltia editor setup, so Wordpress will remain the blog's CMS for a while.

The hugo-builder repository on the Slackware Forge on the other hand, is open to anyone who is curious to start experimenting with Hugo themselves; it contains the code that generates the Docker image used by the aforementioned CI workflow.
I added a subdirectory 'workflow-example' which contains a copy of the actual CI runner that I am using for the new Alien Pastures blog. You can copy that into your own repository and rename the directory to '.forgejo'; you'd also have to do some small modifications and define some variables and secrets in your Forge account to make it work for your own future Hugo website.

Daylight Saving Time frustrations

I have a confession to make :-) For years I faced the annoyance that my laptop would not follow the one-hour timeshift when the Daylight Saving Time would change from Summer- to Wintertime or back. I had to manually fix the time for years. My servers are fine always. I never took the time to find the root cause and fix this.
Today I had enough of it and dug into the issue until I found the root cause.

So what is happening?

My laptop’s hardware clock (RTC) is set to localtime instead of UTC. Combine that with the laptop being switched off (and not using NTP) when the DST switch happens and you get my symptoms. How is that?

The RTC only stores a wall-clock value. It has no idea whether that value is CEST or CET. Slackware tracks how to read it in /etc/hardwareclock, which says either "UTC" or "localtime". In localtime mode, rc.S reads the RTC at boot with hwclock --hctosys --localtime, and rc.6 writes the system time back with --systohc at shutdown.

And that results in roughly these events happening this weekend:

  • Saturday 22:00 CEST: I shut down the laptop. The rc.6 script writes “22:00” into the RTC. That means 20:00 UTC.
  • DST switches from Summer- to Wintertime while I am sleeping and the laptop is off.
  • Sunday morning: The laptop is still off but the RTC is battery-powered and has kept ticking. It would show, say, “10:17”. It is still counting in CEST, so that is really 08:17 UTC, which is 09:17 CET.
  • I pour coffee and boot the laptop: hwclock asks the timezone database how to read “10:17” today. The answer is CET (UTC+1), so it sets the kernel to 09:17 UTC.
  • Result: the system clock is now off by an hour in UTC. It displays 10:17 CET while the real time is 09:17 CET.

In spring the same thing happens in the other direction, and the laptop ends up an hour behind. Then - like every time - I correct it by hand, the corrected value gets written to the RTC at the next shutdown, and the mistake is baked in for another six months.

Why is my server not suffering the same fate? Any one of the following would be enough, but my LAN server runs an NTP daemon and is never powered down:

  • Its RTC is set to UTC, so a stored value means the same thing at any time of year.
  • The machine runs ntpd, which corrects the clock after boot anyway.
  • It is not powered off, but instead keeps running through the DST switch. When it is running, the kernel handles DST through the zone file, and the next shutdown writes a correct local value.

A laptop is then of course the worst case: it is often powered off over the weekend of the switch, and it often has no NTP running at boot either.

To fix this:

  1. First, correct the system clock (the laptop must have internet connectivity)
    # ntpdate pool.ntp.org
  2. Write the now-correct time to the RTC, as UTC
    # hwclock --systohc --utc
  3. Tell Slackware's 'rc.S' and 'rc.6' scripts to treat the RTC as UTC from now on
    # echo "UTC" > /etc/hardwareclock

You can then verify the result: a "date -u" command should match the real UTC calue and hwclock should agree:
# date; date -u; hwclock --show

The order matters. If you write the RTC before correcting the system clock, you store the wrong hour, just in UTC this time. The command 'hwclock --utc' also updates the last line of '/etc/adjtime', so hwclock itself and Slackware’s /etc/hardwareclock will agree.

An additional detail to fix: my laptop's time was a few minutes off to start with. This drift happens naturally over time when your computer does not sync to an atomic clock from time to time. To keep the drift away, I enabled the NTP daemon and configured it properly.
Add these two lines to /etc/ntp.conf:

pool pool.ntp.org iburst
restrict source nomodify notrap noquery

Make the rc script executable and start it manually (on next boot, Slackware will do that for you):
# chmod +x /etc/rc.d/rc.ntpd
# /etc/rc.d/rc.ntpd start

Wait a few minutes and then use the 'ntpq' command to verify that your local NTP daemon is syncing with an online timeserver:

# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 europe.pool.ntp .POOL.          16 p    -   64    0    0.000   +0.000   0.000
*mc02.root.proje 124.216.164.14   2 u   40   64    1   23.229   -2.486   4.368
+82.67.200.13    192.168.6.8      3 u   39   64    1   38.737   -2.392   3.693
+172-232-208-229 80.192.165.246   2 u   43   64    1   35.452   -7.052   4.751
+178.239.19.57 ( 10.1.105.4       2 u   42   64    1   26.853   +0.143   2.254

The line prefixed with an asterisk '*' shows the actual server your local daemon is syncing to; the ones prefixed with the plus sign '+' are considered good candidates to switch to when needed.

Note that the '/etc/ntp.conf' file in Slackware does not have 'pool' examples, only 'server' examples. You really want to configure a pool of timeservers in order to be resilient against outages. The two lines shown above are essential additions to this file; you don't have to edit anything else.

I learnt something this morning that I should have learnt a long time ago... I hope it helps other people who visit here in future, looking for answers to the same question.

HOWTO boot from a full-disk encrypted Slackware and only enter a passphrase once

The documentation about disk encryption which is part of Slackware allows you to boot your Slackware computer from a LUKS-encrypted partition containing the root ('/') filesystem, but it still requires you to keep an un-encrypted '/boot' filesystem on a separate partition.
Recent Grub versions in Slackware have the capability to let the bootloader read information from a LUKS-encrypted volume. That is the key (pun intended) to configure your Slackware computer with full-disk encryption; meaning that all of your partitions and filesystems can be LUKS-encrypted. Even though Slackware's own documentation does not mention this, it is trivial to configure, essentially it needs a single line in "/etc/default/grub" - see step (4) at the end of this article.

The sequence in a regular Slackware is then as follows:

  1. Grub will ask for a LUKS passphrase when it starts.
  2. After you enter the passphrase, Grub will read the kernel and initrd files from the LUKS-encrypted /boot directory (which can now be part of the root filesystem and does not have to be on a separate partition anymore) and load these into RAM, then instructs the kernel to boot up.
  3. The kernel will load the initrd image file in turn;
  4. The embedded "init" script will detect that your root filesystem is encrypted. But since it can not talk to Grub, the "init" script needs your help again, and it will ask for a LUKS passphrase - the second time that you have to enter that string manually.

That's a nuisance which can be overcome, Slackware has all the tools on board already. In this article I will show you how.

In short

The basic steps are:

  1. create a new LUKS key - which will be a file, not a passphrase
  2. add that key file to the /boot/initrd-tree directory
  3. tell geninitrd and mkinitrd that we don't want /boot/initrd-tree to be deleted all the time, and that we added a LUKS key in there
  4. tell grub that it needs to load support for LUKS volumes

The outcome is that you are asked only once to enter a LUKS key - by the Grub bootloader.
The details are a bit more convoluted, but the above four steps are what you need to keep in mind.

In detail

The Slackware init script which sits embedded in the initrd image needs a means to unlock your LUKS-encrypted root filesystem. We want that to happen un-attended (avoid typing a passphrase) and we achieve that by using an embedded LUKS key which we copy into the initrd image. We must have added this key to the LUKS header of the encrypted volume first (using "cryptsetup luksAddKey", see below).

OK, let us start with step (1): creating a LUKS key file - using "dd" and "urandom"!
The command results in what is essentially a 2 KB file filled with random data, and we're going to tell LUKS that this random sequence of bytes should be accepted as a key to unlock the LUKS encryption layer.
# dd bs=512 count=4 if=/dev/urandom of=/root/cryptkey.bin
# chmod 600 /root/cryptkey.bin
# cryptsetup luksAddKey /dev/your_luks_partition /root/cryptkey.bin

That "your_luks_partition" needs to be changed into the actual device name of your own LUKS-encrypted partition. Something like "nvme0n1p4" or "sda1".
When you run the "cryptsetup luksAddKey" command, you will be prompted to provide a LUKS passphrase that is already present in the LUKS header of the partition - for instance the passphrase you entered when you created the volume. If you enter the correct string, then cryptsetup will add your 2 KB of random bytes to the LUKS header as a new encryption key. LUKS2 can store 32 keys, so you should have room to spare.

Step (2) tells us to add this key file to the initrd image. We can't modify that image file directly, so we copy the key file into the directory "/boot/initrd-tree/" instead. When mkinitrd runs it will pack that complete directory, with everything in it, into a new "/boot/initrd-<kernel_version>.img" file.

I wrote a small script "extract_initramfs.sh" with which you can easily extract the contents of an existing initrd image into a new directory. Let's download and install it:
# cd /usr/local/sbin
# wget http://www.slackware.com/~alien/tools/extract_initramfs.sh
# chown +x extract_initramfs.sh
# ln -s extract_initramfs.sh create_initramfs.sh

Let's then add this key to the initrd-tree. Since Slackware's geninitrd default action is to delete the "/boot/initrd-tree" directory after an initrd image has been created, we change that default to "keep that directory please" (see further down) but to prevent confusion when our new configuration runs for the first time, let's simply extract the most recent existing initrd image to get a "/boot/initrd-tree" populated.
# ls -l /boot/vmlinuz-*.img |tail -1
# extract_initramfs.sh -h
# extract_initramfs.sh /boot/initrd-<your_kernel_version>.img /boot/initrd-tree/
# cp /root/cryptkey.bin /boot/initrd-tree/

For step (3), make sure that your "/etc/default/geninitrd" contains this line. If the current value is "true" then change it to "false":

AUTO_REMOVE_INITRD_TREE=false

In "/etc/mkinitrd.conf" ensure that "CLEAR_TREE" and "LUKSKEY" exist and have the shown values - this instructs the "mkinitrd" command to never delete the "/boot/initrd-tree" directory and also tells the init script where to find the LUKS key when it needs it during boot (note that it says "/cryptkey.bin" because init searches it from the root of the extracted initrd image):

CLEAR_TREE="0"
LUKSKEY="/cryptkey.bin"

Why do we need to keep that /boot/initrd-tree instead of allowing it to be deleted? The geninitrd default is to delete the directory to save space, every time you install or upgrade a kernel-generic package. Makes sense, right?
Well no! Simply because we are going to add our LUKS key file in there and we don't want to lose it during the next kernel upgrade.
When geninitrd creates an initrd image file (through an invocation of "mkinitrrd"), it copies all (and only those) kernel modules into "/boot/initrd-tree" that are required to mount the root filesystem. When that directory is never deleted,  old kernel modules are staying behind. To prevent the initrd image file to bloat with useless old kernel modules we remove the kernel modules that belonged to the older kernel, prior to running "mkinitrd".

Geninitrd supports a "pre-install" script that allows us to do exactly that. Copy this text into a new file, inside directory/etc/geninitrd.d/pre-install/, and name it something like "remove-kmods-from-and-install-lukskey-to-initrd-tree.sh" (the name really does not matter).
Then make the script executable:
# chmod +x /etc/geninitrd.d/pre-install/remove-kmods-from-and-install-lukskey-to-initrd-tree.sh

#!/bin/bash
# To prevent the initrd to bloat with old kernel modules,
# we remove them prior to running mkinitrd.
rm -rf /boot/initrd-tree/lib/modules/*

# And to be safe, copy the LUKS key into the tree every time:
cp -a /root/cryptkey.bin /boot/initrd-tree/

Step (4) finally, makes Grub aware of LUKS encrypted volumes.
Check "/etc/default/grub" and make sure that this line is present - it enables Grub to load kernel and initrd from a LUKS-enrypted filesystem:

GRUB_ENABLE_CRYPTODISK=y

Summarizing

You see, that was not really a lot of work! All the building blocks are already part of Slackware-current (to become Slackware 16.0), it just needs a bit of configuration.
Every time you install a new kernel, these scripts will ensure that the LUKS key stays inside the generated initrd image. When your computer boots, Grub will ask you once for a LUKS passphrase so that it can load kernel and initrd files into RAM, but the rest is automatic.

I hope this helps! Eric

Slack Book revitalization effort - collaborators wanted

Once upon a time there was the Slackware Linux Essentials Book. Written by the original Slackware team members Chris Lumens, David Cantrell, and Logan Johnson. The "First Edition" was released in 2000 as a paper edition.
Regulars from the Usenet newsgroup alt.os.linux.slackware launched The Revised Slackware Book Project to completely overhaul "The Book" under a GPLv2 license. This community edition was then published online,  as The Second Edition in May 2005 at http://slackbook.org/ . There was an aborted attempt to rewrite the Revised Book in 2012, which can still be found at https://slackbook.org/beta/ , with the license changed to Creative Commons Attribution Share and Share-Alike.

During the 21 years that followed the release of the Revised Slackware Book, its contents have effectively not been touched, and instead the Slackware Documentation Project came into existence at https://docs.slackware.com/ . The Slack Docs Wiki carries an internal version of the revised Slackware Linux Essentials (the original XML sources were converted to Dokuwiki syntax), at https://docs.slackware.com/slackbook:start

A little while ago, Bruno Russo, a well-respected member of the Brazilian Slackware community, reached out with the news that he was working on a conversion from the Revised Book's XML sources into MarkDown, which is a lot easier to read or edit, and renders in browsers directly. He requested a Forge account and under that account he has published a git repository containing the Slack Book in MarkDown: https://forge.slackware.nl/brunorusso/slackbook

Today Bruno revealed his project to the wider international audience, posting a message on https://www.linuxquestions.org/questions/slackware-14/slackbook-migrating-from-xml-to-markdown-call-for-contributors-4175767590/ and also on his personal blog: https://brunorusso.com.br/posts/working-on-the-new-version-of-the-slackbook/ .

These messages are meant to pique the curiosity of fellow Slackware users. Because this project is not about the MarkDown conversion per se. Bruno has started a full rewrite of the Book, adding chapters and bringing existing content to the state of Slackware today.
This is a huge undertaking, and Bruno wants you to help him. This should become a new community project to bring a re-vitalized Slackware Linux Essentials book into the world. New Slackware users need good structured guidance and this project will cater to that.

I hope some of my readers are now feeling the enthusiasm to contribute your knowledge to the greater good. Please contact Bruno and see what you can do!

Good luck, Eric

« Older posts

© 2026 Alien Pastures · Entries feed

Theme based on Hemingway by Anders Norén — Up ↑