DO MORE WITH LINUX TODAY! Build a Pi Zero 2 server Create a low-cost NAS Encode better video
The #1 open source mag
Swap your filesystem and keep your data secure
BUILD A Pi-POWERED
MEDIA CENTRE Store and stream your videos, music and photos with a feature-rich, Linux entertainment system!
Monitor and enhance your PC the easy way!
Improve location data results from IP alone
GAME OF LIFE
Recreate the classic simulation in Python
Discover how Linux got to power the fastest systems
LXF January 2022
Create a pro-level audio workstation Set up a custom RSS news scraping service Relive the eight-bit days of the Oric-1
LAPTOP BAG OFFER!
SUBSCRIBE NOW! Page 16
Intel Core i9 12900K
Intel was never going to lose its performance crown for long, so Jacob Ridley introduces the new CPU king.
Discover if Firefox-fanatic Jonni Bidwell can be won over by water signs, debloating and a privacy boost.
Edge for Linux
Will Edge find space in the Linux browser market, just because Mayank Sharma thinks Microsoft has done a good job?
If there’s a scale for the complexity of power distros, Mayank Sharma has found one at the lower end of the spectrum.
Ltd Os 0.9
Blinded by the distro’s spruced-up desktop, Mayank Sharma failed to notice its lowly version number, and other shortcomings.
Ubuntu Touch OTA-20
MEDIA CENTRE Start 2022 off right with Jonni Bidwell’s outrageous media centre, powered by Pi, Kodi and just a few too many LEDs. Turn to page 32 and get building!
Jonni Bidwell once again delights at being able to use hardware that people (not me!– Ed) told him to throw away ages ago.
BUILD A Pi-POWERED
Andy Kelly really doesn’t want to go back to the LXF Test Chamber, but The Management are quite insistent…
Video conversion tools
If you get your codecs mixed up with your coding, a graphical video conversion program may make your life easier. Neil Bothwick tests five of the best.
4 LXF284 January 2022
Peak performance Linux
Mike Bedford takes a look at the world’s fastest supercomputers, and investigates why Linux empowers all the top 500 highperformance computer systems.
CONTENTS Pi USER
Raspberry Pi news
Mere mortals rely on USB drives to transfer files, but Shashank Sharma craves for convenience and security. Thankfully, the right tool is just a command away...
Introduced by Brian Corteil. Android 12, Arducam camera and Pi 4 overclock.
Pop!_OS (Pi Edition)
Les Pounder loves pop. pop music, fizzy “pop” and popcorn. But does he love this?
Adafruit Cyberdeck Bonnet
STACER: System management
Les Pounder creates multi-level games with Scratch 3, oh and evil space hippos.
Build a Pi-powered NAS
Nick Peers takes a deep dive into a tool that aims to be a one-stop shop for all your system maintenance and monitoring needs on your Linux desktop.
Les Pounder adds the latest wetware and gets ready to hack the Matrix.
Scratch multi-level games
Les Pounder puts a daffodil in his lapel and enters his rather spacious blue phone box to once again take us back to the 1980s when eight-bit systems ran the world.
Mats Tage Axelsson explains how it’s just a Pi, a bank of disks and OpenMediaVault.
Run a Pi Zero 2 Fediverse server
We go boldly where no man has gone before, well David Rutland has – into the Fediverse with just his trusty Pi Zero 2.
QTRACTOR: Build a music studio
Recreate the famous Game of Life 90 Mihalis Tsoukalos discusses Python sets and shows how to implement the classic Game of Life in Python.
Accurate IP-based geolocation
LXF SERVER: Fresh RSS
BTRFS: Changing filesystems
REGULARS AT A GLANCE 6
Man uses Linux and the world loses its mind at system76, Canonical bring Ubuntu to M1 Macs, GitLab suffers serious security issue, Valve recommends Manjaro KDE for Steam Deck and Zink is finally good.
Get your monthly dose of Linux and open source, save money and get a gift!
Find out where your drive space is going, checking on your not-so-bad blocks, backing up a phone to a Pi, disable a touchpad and understanding Dmesg.
Hey Linux got a lot better while I was away, MX Linux needs more praise, upgrade to new Mint and PDF editing made easy.
Skirting the lines of legality David Rutland scrapes all the news that’s good to read direct to his own server and then starts dodging the copyright lawyers.
Tim Armstrong introduces us to the GeoIP Network, an open-source IP address localisation solution using Python that’s better than what went before!
Feeling musically creative? Michael Reed looks into how to build a Linux-based home studio using free software that could be applied to any type of music.
It’s well-supported, reliable and packed with modern features. Michael Reed investigates what it takes to make use of the Btrfs file system.
TOP OF THE FOSS 66
Get hold of previous Linux Format editions.
Get Linux Format shipped around the globe.
Alexander Tolstoy isn’t forcing up the price of FOSS by restricting access to it, just look at this little lot he’s giving away: Audacity, Pscircle, Edotool, Quickemu, USB Imager, GtkStressTesting, Key Mapper, Sonic Robo Blast 2, NumptyPhysics, Js-dos and Larynx.
Hillary Clinton’s self-hosted mail server didn’t do her presidential campaign much good. Let’s see how Jonni Bidwell’s fares (not at being president, that is).
January 2022 LXF284 5
Got a burning question about open source or the kernel? Whatever your level, email it to email@example.com invaders Q Space My 1TB SSD is at 37 per cent full.
It seems to be more full than expected. Is there a GUI program, or command line for terminal, that I can use to see the size(s) of files listed, instead of having to check the size of each folder individually with the mouse? The only program that I can think of that may be taking up a lot of space is my Thunderbird mail, as it saves/ archives many years’ worth of emails. However, upon checking the invisible folder .thunderbird, it’s only 3.5GB Perhaps there’s another folder that Thunderbird saves all the past emails in? Michael
You don’t say which distro or desktop you’re using, but for KDE there’s Filelight and for GNOME there’s Disk Usage Analyser. Both do a similar job, showing your directories grouped by space usage and enabling you to drill down to find exactly where the space hogs are located. If you prefer the terminal, we recommend ncdu, which performs a similar job. It shows all the files and directories in the path you give it, or the current directory, sorted by size. Select a directory to obtain a breakdown of its components and so on. All programs have options to delete the files you don’t like the size of – use this feature with care!
Filelight will show where all your disk space has gone. The home directory really needs a clear-out!
Run one of these if you only want to check your home directory, but you will have to use sudo if you want to check the entire drive. There are a couple of points and options to bear in mind, particularly when checking a whole filesystem. Pass the -x option to ncdu to prevent it descending into other filesystems. This is essential when running it on / because it will otherwise spend ages trawling through virtual filesystems like / proc and /sys and even longer searching any mounted network shares. Another thing to watch out for are files hidden from view by mounted filesystems. Say you have a network share at /mnt/ backup to which your daily backups are sent and one day it’s not mounted. The backups will be sent to /mnt/backup on /, but they won’t be visible when you check because the network filesystem is mounted over them. There’s an easy way to deal with this with these commands as root: $ mkdir -p /mnt/tmp $ mount / /mnt/tmp --bind $ ncdu -x /mnt/tmp
By bind mounted / to another location, all of its content is visible there because no other filesystems are mounted on top of it. Once you’ve finished checking, just unmount the bind mount. $ umount /mnt/tmp
This should find the culprit(s) – our money is on Downloads or .cache.
Neil Bothwick can diagnose a printer problem from a 1,000 paces.
needn’t be bad Q Bad If a HDD has bad sectors, does this mean the HDD should be thrown out? If I format the HDD in the ext3 format, does it keep information about which sectors are bad and avoids using them? Also, which Linux tool can scan a HDD and look for bad sectors? Stefanie Dreher
Not necessarily. No hard drive is perfect; bad sectors are a fact of life. Modern drives have spare sectors and automatically remap them to cover bad sectors as they occur, so you shouldn’t need to do anything. As far as the operating system is concerned, there are no bad sectors, but you can check on them using smartctl, which reads the SMART diagnostic data from the drive. $ sudo smartctl --all /dev/sda | less
This reads all SMART data from the given drive and pages it through less, so you can read it. Press / in less to search for “bad” to read the bad block count. As long as this figure is stable, you should be okay, but run a SMART self-test to play safe: $ smartctl -t long /dev/sda
This will start the long self-test and give you an estimate of how long it’ll take. The test runs in the background and you can still use the computer. When the time is up, run $ smartctl -l selftest /dev/sda to see the results. There is a badblocks command in Linux that will create a software map of blocks for your filesystem to use. Unless you have a very good reason you should be using ext4 rather than ext3. However, because the drive maps bad blocks out of sight of the operating system, if this shows more than a trivial number then your drive is already past any safe limit. Of course, whatever smartctl or badblocks may say about your drive, you should have all important data backed up.
my Pi Q Phoning I have a Raspberry in my home network with Jellyfin installed, and I have a library for my mother’s pictures and videos. I’ve had this constant complaint
January 2022 LXF284 11
SUBSCRIBE Save money today!
Sign up today and get your YOUR GIFT! WORTH £90
iss out, Don’t m e now! ib subscr
STM MYTH Laptop Bag Features
The STM Myth Laptop Bag is an extraordinarily spacious carrier with cutting-edge contemporary features and a handsome collection of sophisticated tailoring.
Durable and water repellent Air-channel back panel and yoke Integrated lumbar support CableReady enables charging on the go with hidden cables Impact protection isolates your laptop from the ‘bump zone’ TPU-coated webbing and handles Handy dedicated earbud pocket Large 28-litre capacity – fits most 15-inch laptops
www.magazinesdirect.com/lin/a12e Call 0330 333 1113 and quote A12E 16 LXF284 January 2022
Save money today! SUBSCRIBE 1
1,000s of DRM-free PDF back issues and articles! Get instant access back to issue 66 (May 2005) with tutorials, interviews, features and reviews. At linuxformat.com
! DON’T MISS s ar ye Includes 5 & r se U x nu of Li Developer issues
CHOOSE YOUR PACKAGE! ANNUAL PRINT EDITION
13 issues of Linux Format in print over 12 months by Direct Debit
ANNUAL PRINT + DIGITAL EDITION
PLUSSA! VE ! Only 47%
13 issues of Linux Format over 12 months in print and digital by Direct Debit
NOT FROM THE UK?
Turn to page for more grea67 subscriber t deals!
DIGITAL EDITION ONLY
13 issues of Linux Format in digital by Direct Debit
Terms and conditions: Offer closes 31 March 2022. Offer open to new UK subscribers only. Pricing is guaranteed for the first 12 months and we will notify you in advance of any price changes. Please allow up to six weeks for delivery of your first subscription issue (up to eight weeks overseas). Your gift will be delivered separately within 60 days after your first payment has cleared. Gifts only available to subscribers on the UK mainland. Gift not available with a digital subscription. The full subscription rate is for 12 months (13 issues) and includes postage and packaging. If the magazine ordered changes frequency per annum, we will honour the number of issues paid for, not the term of the subscription. For full terms and conditions, visit www.magazinesdirect.com/terms. For enquiries please call: +44 (0) 330 333 1113. Lines are open Monday-Friday 9am-5pm UK Time or e-mail: firstname.lastname@example.org. Calls to 0330 numbers will be charged at no more than a national landline call, and may be included in your phone provider’s call bundle.
1) Only available to www.magazinesdirect.com subscribers
PLUS: Exclusive access to the Linux Format subs area!
January 2022 LXF284 17
ROUNDUP Video conversion toolsSO YOU DON’T HAVE TO! WE COMPARE TONS OF STUFF
Roundup Avidemux 2.7.6 Curlew 0.2.5 1.4.2 Shutter Encoder 3.0.16
HandBrake VLC 3.0.16
Neil Bothwick now has one fewer reader’s question for Answers to deal with: how to encode video.
Video conversion tools If you get your codecs mixed up with your containers, a graphical video conversion program may make life easier. Neil Bothwick investigates.
HOW WE TESTED… This is one of those areas in which performance isn’t a key deciding factor. Not because video transcoding doesn’t need much CPU horsepower – it most certainly does! The reason is that most of these programs use the same backend software. They’re about making the process more easily accessible to the masses – those of us who don’t consider reading a FFmpeg man page the best way to spend an evening. So we looked at not only the range of features available within each program, but how easy they were to access. If all you want to do is reformat a video so you can watch it on your Android tablet during a long journey, then you really just need a button that says Do That. However, there are also times when you require more control over a particular processing task, so we looked at how that was available with the various programs.
26 LXF284 January 2022
he old saying “one of the nice things about standards is that there are so many of them” has never been more true than when applied to video encoding. There are so many combinations of container, video codec, audio codec, bitrate and resolution, and that’s without considering the myriad of other parameters that can be used, that it becomes an area where only experts dare to tread. One look at the man pages of FFmpeg or MEncoder – the two most popular command line encoders – will have your head spinning.
What we need is an easy-to-use graphical interface that enables you to choose the main options with a few mouse clicks and takes care of the details for you. This month’s Roundup features five programs that all do that to a greater or lesser extent. Whether you want to transcode video for watching on a mobile device or want to back up your DVDs to your media centre, there’s something here that can do the job. If you want more from a video converter, some the these programs will give you more, plenty more in some cases. There’s something for everyone.
Video conversion tools ROUNDUP
Input and output formats handled The heart of the matter: what can you convert into to what else?
ne key aspect of video encoding software is the range of formats it can handle, both input and output. Most of the programs score well in this area when reading from files, but only VLC and Handbrake offer easy reading from optical discs. Shutter Encoder has a DVD Rip function, but it didn’t seem to do anything beyond throwing out a Java error. Encoding options are a lot more varied. Most of these use FFmpeg for the actual processing and FFmpeg has a lot of options as well as several filters. It also means that they can support all of the input and output codecs that FFmpeg handles. The question with GUI programs that try to make transcoding more accessible to non-gurus is how much of this do you expose to the user? Avidemux offers a choice of video and audio codecs as well as a number of container formats. Configuring output can be as simple as selecting a quality level or enabling the advanced options for detailed control. Filters for processing or resizing the video are also available. When you have a configuration that and you’re happy, you can save it for future use. Avidemux also has a limited number of preset output formats. VLC offers a similar choice of output formats, but without the more advanced control options of Avidemux. This may be a good or bad thing, depending on your requirements. Handbrake has a lot of conversion options, but it also comes with many output presets that set all the parameters for a
When it comes to processing video, having preset outputs to suit your requirements makes life a lot easier.
particular type of conversion. There are presets for all sorts of media hardware as well as web and general desktop formats. If the list is not all you need, you can create your own presets, or tweak one of the existing ones. For such a simple-looking program, Curlew has quite a few options in its advanced settings. Shutter Encoder allows a fair bit of configuration and has a reasonable number of preset output functions. It, and to an extent Avidemux, occupy the middle ground between the flexibility of Handbrake and the simplicity of VLC and Curlew. However, while all can adjust bit rate or quality, codecs used and so on, only Handbrake and Shutter Encoder enable you to select a different resolution for the resultant video.
VERDICT AVIDEMUX 6/10 SHUTTER ENCODER 6/10 CURLEW 6/10 VLC 7/10 HANDBRAKE 9/10 The right output format is more important than having many to choose from.
Processing with filters
Do you want to process the video while you’re converting it? Fmpeg can do more than decode a video from one format and encode it in another. Between those two steps it can apply a range of filters to the video. So how do these GUIs handle filters? Avidemux has a separate filters list, split into categories, from which you can add and configure filters. Avidemux doesn’t provide options for cropping and scaling in its standard functions, so it’s good to see that these operations can be performed with filters. Shutter Encoder doesn’t give direct access to the FFmpeg filters, but it does provide a selection of processing functions – mainly those most applicable to the program’s primary intended use as part of a video-editing workflow. HandBrake also has a decent number of filters available, but not the full FFmpeg set, although some of those are already implemented elsewhere in the program, such as image scaling and cropping. The filters are mainly aimed at cleaning up video with operations such as deinterlacing, noise removal colour smoothing and image sharpening.
Avidemux gives access to FFmpeg’s extensive range of filters, with descriptive help for each one.
Curlew doesn’t make FFmpeg’s filters available in the GUI, apart from basic crop and fade options. VLC doesn’t even have that – it’s purely format conversion. In addition to filtering, VLC, HandBrake and Shutter Encoder are able to add subtitles to your video, although you’ll have to create the subtitle files yourself.
VERDICT AVIDEMUX 8/10 SHUTTER ENCODER 6/10 CURLEW 2/10 VLC 3/10 HANDBRAKE 6/10 Filters either make up a program’s basic functions, or for enhancing videos.
January 2022 LXF284 27
BUILD A Pi-POWERED
MEDIA CENTRE Start 2022 off right with Jonni Bidwell’s outrageous media centre, powered by Pi, Kodi and just one too many LEDs.
ver since there have been Raspberry Pis people have been making media centres out of them. Even the original Pi, thanks to its VideoCore SoC, was able to play 1080p content smoothly, 256MB of RAM notwithstanding. Media centre distros quickly sprang up to exploit this and for a time using your Raspberry Pi as a media centre was seen, rather unfairly, as an unimaginative thing to do. Media players on Linux have a rich history (and MPlayer is still going strong), but the first to make it on to the Pi has its roots on the original Xbox in the early
32 LXF284 January 2022
2000s. Apart from being a platform for playing Microsoft’s Halo, this console was very popular with homebrew enthusiasts, since (thanks to easily exploited buffer overflows in popular titles) they could be made to run unofficial titles. One such title was the Xbox Media Player, which in 2008 (underlining that by then it was much more than just a player) became XBMC (Xbox Media Centre). This application found its way to the Raspberry Pi by way of the RaspBMC distribution, put together by then high-school student Sam Nazarko and released not long after the Pi itself.
Today, thanks in part to threats from Microsoft, XBMC is known as Kodi. RaspBMC has a new name, too: OSMC (Open Source Media Centre), reflecting the fact that builds are also available for Vero and first-generation Apple TV devices. Kodi can be installed on just about anything running Linux. It works great as a desktop tool (even on Mac and Windows), but if you’re looking to make a dedicated media player out of it then it makes much more sense to deploy a tailor-made distro for that use case. OSMC is a great choice, but by far the most common Pi-based multimedia distro is LibreELEC.
Pi-powered media centre
Kodi academy New versions of Kodi and LibreELEC are out, but only for Raspberry Pi 4 users (for now)… ibreELEC was forked from OpenELEC, which began life in 2009 as a minimal Linux flavour for running XBMC. This also found its way to the Pi very soon after the latter’s inception. In 2017, though, the project was abandoned and most of the developers joined the LibreELEC project. LibreELEC describes itself as Just Enough OS (JEOS) to run Kodi and strategically times its releases to coincide with those of the latter. Kodi 19, codenamed Matrix, was a big release and in late August 2021 this was incorporated into LibreELEC 10.0.0. Since then there have been a few point revisions of both. When we wrote this feature, we used LibreELEC 10.0.1 with Kodi 19.3. By the time you read it, it’s likely that newer editions will be available.
We were a little shocked that older Pis, anything other that the Pi 4 in fact, were not currently supported on LibreELEC 10, and indeed that the Pi Zero and original Pi won’t be supported in any future release. It’s perhaps the kind of thing you should check early in the planning stages. Fortunately, and big thanks to the Pi Foundation, we had in our possession an 8GB Pi 4 which we can confirm works beautifully with LibreELEC 10. (I’d like that Pi back now, please – Eben). By the time you read this LibreELEC 10 will be closer to supported on the Pi 2 and 3. For now, you can happily run LibreELEC 9 on earlier Pis – the interface and functionality is much the same. In fact, the last and most colourful part of this feature currently only works there. See the box (right) for more on LibreELEC 9.2 and Kodi Leia. There are a few reasons for this high hardware bar, the most pressing of them being that Pi graphics drivers (and those of many other small ARM devices) in LibreELEC are undergoing a major rewrite. Previously, each build would incorporate the required vendor kernel, other proprietary weaponry and some ugly patches to get accelerated graphics working with Kodi. This was an ad hoc process and since Kodi 19 no longer supports most of these proprietary methods, they’ve been removed in LibreELEC 10. Instead, the goal is for all platforms to use uniform display and decoding methods by way of the GBM (Generic Buffer Management) and V4L2 (Video for Linux 2) APIs. This will enable all builds to run on a mainline kernel without any ugly hacks. Besides those changes, the plugin system has been upgraded to Python 3.
This means that any addons still based on Python 2 won’t work. All of the official Kodi addons have been updated, but third-party ones (including many nefarious ones used to access pirate content) have not. Python 2 add-ons are automatically disabled by the upgrade, so if you rely on any of these it’s worth holding fire on LibreELEC 10 until such time as they are updated.
In very little time you’ll be able to access your media, as well as stream it from proprietary services such as these.
LIBREELEC 9 Usually LibreELEC development focuses on the latest release, but last year saw a rare point release (9.2.8) to the previous edition. This happened due to changes in the Widevine DRM used by Netflix and many other streaming services, which all stopped working on LibreELEC 9 until the new library was properly accommodated. We know that many readers haven’t got a Raspberry Pi 4 yet and we didn’t want to alienate them, so we’ve done our best to make sure everything we cover here mostly works on the hardware and software iterations of yesteryear. Indeed, you’ll need to run the previous version on a Pi 2 or 3 if you want to recreate our glorious ambient screen lighting. The only major discrepancy we found is that Netflix (and possibly other Widevine-reliant services) fall back to software rendering with the new Widevine service. Because the add-on tricks Netflix into playing at 1080p (using the same trick as the popular browser plugin), this places undue pressure on the Pi 3’s CPU, leading to stuttering and audiovisual desynchronisation. For a smoother experience limit the Netflix app’s playback to 720p by right-clicking the add-on and selecting Settings. In the Expert settings panel scroll down and you’ll see the option to limit the stream resolution. The Pi 4 has no problem decoding 1080p in software: the load average was barely above 1.0, as opposed to on the Pi 3 where it was well above 3.5 (and as such, close to CPU-saturation).
January2022 LXF284 33
TUTORIALS Scratch games
Create multi-level Scratch games Les Pounder creates multi-level games with Scratch 3. He also needs to defeat hostile, hungry space hippos before they consume the Earth! he evil space bats have formed an alliance with the cruel space hippos and we need to blast them back to their home world! Okay, in reality this is a simple space shooting game with a twist. It has two levels of fun and scores that vary depending on the level. So let’s save planet Earth! Scratch 3 should come pre-installed on your Raspberry Pi OS image, but just in case it is missing you can be installed from the main menu, under Preferences>Recommended Software. Scratch 3 is found in the Programming category – place a tick in the box and click Apply to install. Once installed, Scratch 3 can be found in the main menu under Programming. Open Scratch 3 (on first start Scratch may take a little while to open). We’re going to assume that you have an understanding of how to code with Scratch. If not, we covered the basics in previous issues.
OUR EXPERT Les Pounder is associate editor at Tom’s Hardware and a freelance maker for hire. He blogs about his projects and adventures at bigl.es.
Stay on target
YOU NEED Raspberry Pi 3/4/400 The latest Raspberry Pi OS Get the code here: https:// scratch.mit. edu/ projects/ 588488388
We start the game by deleting the cat sprite, then hover the mouse on the blue cat icon in the bottom right of the screen and select Paint. We need to draw a new sprite using Scratch 3’s vector graphics editor. Specifically, we’re after a crosshair to tell us where to fire. This is a simple circle with lines drawn from top to bottom, and left to right. Position the centre of the crosshair slightly off the centre of the page, otherwise our crosshair will get in the way of our shots. Click Code to edit the code for the crosshair sprite. First we need when green flag clicked from Events, then go to Sensing and connect set drag mode to draggable to the previous blocks. Change draggable to not draggable . From Control drag a forever loop and connect it to the previous block. Inside the loop place go to random position from Motion. Change random position to mouse-pointer . Click the green flag and you’ll see the crosshair follows the pointer. Press the red button to stop. Click the cat icon to insert a new sprite. We chose Hippo 1 because it has a flying animation. Click the Hippo sprite. From Events drag when green flag clicked and place it in the coding area. Next from Motion drag set rotation style and connect it to the previous block. Change the rotation to left-right . From Control drag a forever loop, and inside the loop place next costume ,
44 LXF284 January 2022
First space bats, now space hippos! It’s your task to save everyone on planet Earth before the four-legged creatures get hungry!
which is found in Looks. Finally, from Motion add if on edge bounce . The loop will animate the hippo’s wings and force it to bounce off the edge of the stage. Drag another when green flag clicked and forever loop into the coding area. Inside the new forever loop we first place set size to 10% from Looks, and from Operators we drag pick random 1 to 10 and place it over the 10%. Change the values to read 50 to 100%. Next go to Motion and drag go to random position and glide 1 secs to random position . Lastly, we drag wait 1 seconds from Control and place another pick random 1 to 10 , changing the values to 1 to 5. Now our hippo flies randomly around the screen. From events drag when this sprite clicked to start a new code sequence. From Sensing connect set drag mode to draggable to the previous block. Change draggable to not draggable . From Control drag an if.. else block to create a test. From Operators drag __ = __ and place it in the hexagon shape of if..else . From Sensing drag backdrop# of Stage and place it in the first __ and in the second type 2. This checks if we’re on level one or two. If we’re on level two then the score goes up in 20 point increments. Create a Variable (Variables) and drag Change my variable by 1 and place it inside the if section. Change my variable to Score and change 1 to 20. Drag
TUTORIALS Network storage
OPENMEDIAVAULT Credit: www.openmediavault.org
Build a Pi-powered network storage device You can have your own high-end NAS device without breaking the bank, but Mats Tage Axelsson explains how it’s just a Pi and a bank of disks. e’re pretty sure that your home network has plenty of devices attached to it. Ensuring files are backed up for all these devices, or sharing files between them, might be more tricky than you’d care to admit. That’s okay, you’re among friends here. A neat solution to such problems can be found by attaching a NAS (network attached storage) to your network. On it, you can store large media files, backups and other files of importance. You could use memory sticks, external drives and the cloud, but with some projects it makes more sense to store them at home and have them available to all the devices in your home. It may seem more logical to set up a file server. Remember, though, that you may need to use several types of protocols for communicating with different devices that are used for different purposes. For example, backing up your files is hugely different from sharing media files across different devices. You will also have an array of operating systems working over your network. Sure, you may run Linux everywhere, but most of us are still trying to force Windows and MacOS out of our consumer devices. Not to mention the operating systems on Smart TVs and smartphones – though many of these can be Linux based.
OUR EXPERT Mats Tage Axelsson is working hard to avoid work and save money, which is tricky when computing plays such a large role in his life.
A not so NASty business
Armbian has a comprehensive list of hardware that it supports. When looking for the correct image, use the list to download a NAS image for your hardware.
For serious computing, a NAS is what you need… but it also needs to be a small, low-powered device you can put under your desk or in your closet. Few people will be interested in having an expensive, costly-to-run rack server buzzing away in their closet. A dedicated NAS is normally relatively expensive. Having started as an enterprise solutions, finding a cheap dedicated NAS isn’t easy. Storing data this way is something that businesses do with their most valuable data, so they’ll require the best and are willing to pay for it. Home-based Linux users may not have such a grand budget, and may just have a Raspberry Pi and a USB cable or two. Many hobby projects exist where you can obtain tips on what works and what does not. To make the most of a storage system, your other systems need to easily access it. The obvious methods are SFTP, SMB, DAAP Media Server and rsync. Setting
46 LXF284 January 2022
If your experience of using dd is limited, consider using Balena Etcher to flash your image to the SD card.
all these up individually is a hassle, but you can get a total solution in the form of OpenMediaVault. These standards are all about different ways of sharing files. Samba (SMB) comes from the Windows way of doing things, so servers need to support it. In your home, you probably have both Linux and Windows. The ones that have always been the “Unix standard” are the secure file protocol SSH and rsync. We hope you’re familiar with Remote Sync – it’s a great way of copying files. It even supports copying on the same computer. As the name implies, it synchronises your files so when you make alterations to a file, only the changes are copied. The DAAP Media Server is the Apple standard for its media – useful if you also run Apple products. Anyone reading this should already know that the Raspberry Pi comes in many shapes and sizes. You also know that you need to make a choice depending on what you want to do with your next project. The model board you need will vary with the expected load of the system. In some cases, you may want to beef it up a bit since you can add a Nextcloud (see LXF280) server on the machine for extra functionality. With this said, you can also have a Raspberry Pi Zero. It’s a good choice for storing sensitive data. The SubZero memory stick project is one of those projects. (https:// bit.ly/lxf284subzero) This is an interesting application, but most people will get a box and a few cables and hook
TUTORIALS Social networking
Run a Pi Zero 2 W social Fediverse server We go boldly where no man has gone before… well, David Rutland has, into the Fediverse with just his trusty Raspbery Pi Zero 2 W. he idea was simple. We sat around a table in the socially distanced (by about 400 miles) Linux Format-distributed HQ looking at the specs of the new Raspberry Pi Zero 2 and someone said, “I bet you could run a half decent social media server off that.” “You’re on," said the editor. “I want 1,500 words by the first half of next week.” It was a couple of hours later when it was discovered that the launch day specs – eagerly repeated in almost all online publications – were not quite right. The Raspberry Pi OS would not have a 64-bit kernel on the £13.20 Pi Zero 2… at least, not for a while. Undeterred, we discovered a workaround that enabled us to use a second Raspberry Pi (a 4B in this case) to assist in getting the 64-bit version of Ubuntu server up and running. The idea is simple: load an SD card with the relevant OS, bang it in the 4B to complete installation, run updates, and then return your newly prepped card to the Zero. In total, it took about an hour. With working 64-bit hardware balanced precariously atop the couch, it was time to decide what sort of shortlived social media enterprise we wanted to run. Ideally, we wanted something fast, which wouldn’t use up too many resources. Remember that for all of its quad-core glory, the Pi Zero 2 is a cheap bit of kit and will not perform as well as an entire rack at Amazon HQ. After a couple of days perusing the forums and, of course the Awesome-Selfhosted list on Github, we eventually settled on Hubzilla, which we’re reliably informed reflects the idealistic and friendly nature of early social networks before they were monetised and their users ruthlessly exploited by the founders. Each server can run in isolation or federate with the countless other servers scattered across the globe. But here’s the rub: setting up the Pi Zero, installing dependencies including Apache2, PHP and MariaDB and the actual Hubzilla software takes a long time. It could have been our substandard Wi-Fi connection, SD write speed or another factor beyond our control, but it took easily the better part of a weekend, multiple SD card flashes, more than a dozen cups of tea and an amount of frayed nerves before we were in a position to visit our shiny new Hubzilla hub. To save our readers the trouble and frustrations we went through, we have prepared an image – based on
OUR EXPERT David Rutland used to have a fine head of hair until he tried running a server off his new Pi Zero 2 W. Now he looks like this.
If you feel like your feed isn’t updating quickly enough and you’re left out of conversations, it’s because cron is set up to check for new posts every 10 minutes. Change this with sudo crontab -e.
50 LXF284 January 2022
When no users are actively on Hubzilla and you’re not following anyone, your Pi Zero 2 will use surprisingly few resources.
the new Ubuntu-Server 21.10 – which you can flash to an SD card and configure with minimum fuss. Alternatively, you can follow the install instructions here: https://zotlabs.org/help/en-gb/admin/ administrator_guide.
The easy way…
Download the image from files.lxf.by/hubzilla_ubunt_ server_pi_zero.zip, unzip it, and use either dd or Balenaetcher to write it onto a 16GB SD card. Navigate to / writable/etc/netplan on the card and nano 10-rpiethernet-eth0.yaml. Substitute in the SSID of your home Wi-Fi network and your password. Then run sudo netplan apply . Eject the card, plug it into your Pi Zero 2 and make a cup of tea while it boots and connects to your network. You’ll want to know the local IP address of the zero, so log into your routers admin panel and look for an entry named ubuntu. Log in over SSH with ssh email@example.com and when prompted for the password, enter secretpassword . You should probably change that at the first opportunity. You’ll note that we’ve given the image a 2GB swap file. Without one, we noticed that once set up and idling, around 370MB of the available half gigabyte of installed RAM was in use. That wouldn’t do at all and running anything even remotely strenuous could leave our Zero with zero memory. As much as you may appreciate the play on words, we assure you that you wouldn’t enjoy it
IN-DEPTH Linux supercomputers
LINUX AT THE PEAK OF PERFORMANCE
Mike Bedford explores the world’s fastest supercomputers to find out how Linux came to power every top 500 high-performance computer. wice each year, in June and November, the world’s fastest 500 supercomputers are revealed. Eagerly anticipated by the high-performance computing (HPC) community, the Top500.org list paints a picture of computing at the top end, and the difference from run-of-themill PCs is stark. Perusing lists from the list’s 28 years highlights various trends, including one that will be of particular interest to Linux Format readers. From the dominance of Unix in the early days, a remarkable change has taken place more recently. After making its first appearance in 1998, Linux was powering the majority of the top 500 computers by 2004, it became universal in 2017, and it has remained the only operating system used in the planet’s top supercomputers ever since. Why is Linux the dominant operating system in high-performance computing? That’s a question we aim to answer here as we take a look at the history of Linux in
52 LXF284 January 2022
supercomputing. We can’t talk about the upper echelons of computing without also talking about the hardware, though, so be prepared for your jaw to drop as we also highlight some facts and figures about the world’s fastest calculating machines.
Linux’s super debut
In 1998, almost a quarter of computers in the Top500 list were manufactured by supercomputer specialist Cray Research, and the remainder of the list was dominated by big-name supercomputer manufacturers such as HP, IBM, NEC and Fujitsu. In other respects, though, highperformance computing in the late 1990s exhibited some considerable diversity. Back in the 90s we saw machines empowered by a wide range of processor families including Sun SPARC, MIPS and IBM POWER in similar numbers, with DEC Alpha and HP PA-RISC also being represented. In marked contrast, over 90 per cent of all machines in the most recent list use x86 processors that aren’t
too different from that those power run-ofthe-mill PCs. Even in the 1998 list, though, several supercomputers used chips that were also found in desktop PCs, albeit topend machines, and this brings us to the Avalon Cluster, which made its debut to the Top500 list in June of that year. That machine was very different to most of the planet’s fastest computers. It wasn’t built by a specialised supercomputer manufacturer, but by a team at the US government’s Los Alamos National Laboratory. Not only that, it was also put together using off-the-shelf DEC Alpha-based desktop PCs as its fundamental building block. Specifically, it was constructed from 68 PCs, each containing one single-cored 531MHz DEC Alpha EV56 processor, yet it demonstrated a performance of 19.3Gigaflops, thereby gaining it in a place in the Top500 list. Admittedly, it only entered the list at 314th place, but it broke new ground in performance-per-unit-cost, as a result of its hitherto unimaginably low
Effortlessly transfer files across computers Mere mortals use USB drives to transfer files, but Shashank Sharma wants convenience and security. Luckily, the right tool is just a command away… he biggest downside to using USB drives for transferring files between machines is their size limitation. At least, until you leave the USB drive on a bench in the park, or a coffee table. That’s when you realise that security is the bigger issue. This is why file transfer utilities are so popular. Most provide a convenient mechanism to share files across machines. Croc is one such command-line utility, with an impressive feature set. Unlike many file-sharing utilities that only support transfer of files between machines on the same network, Croc enables you to transfer files to any internet-capable machine. Not only that, the utility boasts of end-to-end encryption, and supports resuming partial or incomplete file transfers.
OUR EXPERT Shashank Sharma is a trial lawyer in New Delhi and an avid Arch user. He’s always on the hunt for affordable geeky memorabilia.
You’ll have to install Croc on both machines before you can use it to transfer files. Released under the MIT licence, the cross-platform utility can be run on Windows, BSD and Mac, apart from Linux distributions. Most Linux distribution don’t carry Croc in their software repositories, but the installation is still fairly straightforward. The project provides ARM, as well 32-
The installation script installs the latest available version of Croc in the /usr/local/bin/ directory.
and 64-bit Deb packages apart from source tarballs. If you already have Go installed on your distribution, you can also build Croc from source, but the easiest way to install it is with the official installation script. Open a terminal and run the curl https://getcroc. schollz.com | bash command. The curl utility fetches the installation script, which is then executed by bash. A key advantage that Croc has over other similar tools is that it can be used without involving port forwarding.
TRANSFERRING FILES TO MOBILE DEVICES WITH QRCP Even though Croc supports a variety of architectures and operating systems, if you wish to transfer files between a computer and a smartphone, your only options are to either use a USB cable or worse still, email the files to yourself. Thankfully, a smarter and more convenient solution is available. Qrcp works by binding a web server to the sender machine’s IP address along with a random port number. Next, it generates a unique QR code that provides the relevant information. You need only read the QR code on your
56 LXF284 January 2022
mobile device, which will then automatically take you to the decoded URL. The web server automatically stops once the download is completed. Head over to the project’s GitHub page (https://github.com/claudiodangelis/ qrcp) and download the latest source tarball and place the extracted qrcp file in a directory in $PATH, such as /usr/ local/bin. To transmit a file, run the qrcp filename command on the sender machine. Qrcp will generate a QR image as well as provide a URL such as
http://192.168.0.15:33773/send/qb2d. On the mobile device, use a QR code scanner, such as Google Lens, and scan the QR code. Then tap on the decoded URL that’s displayed on the screen, and the transfer will begin automatically. You can similarly transmit files from the mobile device. First, open the terminal on the recipient machine and run the qrcp receive command. This will again generate a QR image, which you must scan on your mobile device. This opens a file browser, which you can use to select the files you wish to transmit.
TUTORIALS System management
STACER Credit: https://oguzhaninan.github.io/Stacer-Web
Enhance your Linux system management Nick Peers takes a deep dive into a tool that aims to be a one-stop shop for all your system maintenance and monitoring needs. ystem monitoring tools are priceless. They provide an at-a-glance view of your PC’s health and performance, usually in the form of graphs and lists, spanning such areas as CPU, memory network and hard disk usage on the hardware side, and running processes and services on the software side. Ubuntu offers its own tool in the form of System Monitor, which you can open via the Launcher’s search tool. This provides three simple views: Processes, Resources and File Systems. The most graphical of these is Resources, with a mixture of line graphs and pie charts revealing CPU, memory (including swap), and network activity. The File Systems tab provides an at-aglance view of all your mounted drives along with their capacity, file system type and available free space.
OUR EXPERT Nick Peers loves tweaking his system, then having to undo said tweaks to get his system working again.
MONITOR YOUR SYSTEM WITH STACER 6
Main menu Switch between Stacer’s tools using the collection of graphical buttons on the left of the program window.
System Info This area of the interface gives you a summary of key parts of your system – including the current kernel release.
Main dashboard Receive updated stats on CPU, memory and system disk performance via these speedometer-like icons.
Network performance View current upload/download rates, together with how much data has been transferred in the current session.
Resource history Click the graph icon to switch to the Resources view, which provides historical data of system resource usage.
Menu bar icon Click here to quickly jump to different parts of Stacer, using section titles to guide you rather than icons.
58 LXF284 January 2022
The Processes tab is the most powerful of the three. Not only can you monitor all running processes, but you can also access details about each, plus view processes in relation to each other using a hierarchical tree, which helps to trace child processes to their parents. In addition, you’re able to control processes from here too: right-click a process to reveal options to stop, continue, end or even kill it. It’s also possible to change a process’s priority. By default, most processes are given equal priority, but if one starts slowing your system down you can try and rein it in without killing it by rightclicking it in System Monitor, then choosing either Low or Very Low from the Change Priority sub-menu.
System Monitor on steroids
System Monitor is a useful tool, but it does lack a few key features. There’s no handy overview of your system as provided by the About section in Settings, for example, and there’s no way to monitor or manage services. If you’re in the market for a more powerful alternative, the good news is that it exists in the form of Stacer (https:// oguzhaninan.github.io/Stacer-Web). Stacer takes pretty much everything from System Monitor along with elements of other tools – both graphical and command-line – to provide you with a one-stop shop for most of your system management and monitoring needs. For example, it pairs the information provided by System Monitor’s Resources and File Systems tabs with the About section of Settings to detail key stats such as hostname, distribution, Kernel release and CPU model. It also throws in a host of useful – and related – tools, from tools for managing startup programs and services to a clean-up utility and even a selection of tools for tweaking the Gnome desktop. Sadly, development has stalled on Stacer over the past couple of years, but it still works perfectly in Ubuntu and the lack of development does mean the latest build (1.1.0) can be installed directly through Ubuntu Software via snap in Ubuntu 20.04 or later. The homepage also lists instructions for installing Stacer via its own repo, but be warned: it only contains files for older Ubuntu releases, including 16.04 LTS and 18.04 LTS. If you don’t want to use snap or the repo, click Other Packages beneath these instructions to
TUTORIALS Emulate the Oric-1
EMULATION Credit: https://github.com/TomHarte/CLK
How to emulate an Oric 8-bit computer he 1980s home computer scene was such an important time in our (GenX) lives. Intel was yet to make its mark in the UK, and we still favoured Commodore, Sinclair and Amstrad machines. In 1982 the Cambridgeshire-based Tangerine Computer Systems released its Oric-1. This was a 1MHz MOS Technology 6502 CPU powered 8-bit computer that came with either 16 or 48KB of RAM. It was designed and priced to compete with Sinclair’s Spectrum. The Oric-1 and the ZX Spectrum shared one design trait: an awkward keyboard. Where the ZX Spectrum used “dead flesh” rubber keys, the Oric-1 used small, thin plastic keys that were a typist’s nightmare. This issue was later fixed in 1983 with the introduction of the Oric Atmos, essentially an Oric-1 with a better keyboard and improved BASIC ROM. It also saw the release of a number of peripherals; a printer, disk drive and modem were initially promised for the Oric-1. The Atmos has the better keyboard, but the Oric-1 has a charming design aesthetic. With the ever-rising cost of retro hardware, emulation has become the most popular means to relive the past. For the past 18 month we at Linux Format have covered the most popular machines, and a few of those niche machines that “your cousin or mate at school” had and no-one knew about. The 1980s saw so many machines that you would be forgiven for missing out on some hidden gems, and the Oric machines are just that. We took an Oric-1 for a spin via an emulator and enjoyed our time learning about the rich range of games and a competent BASIC coding experience.
CREDIT: CarbonCaribou, CC BY SA 3.0, https://commons.wikimedia.org/wiki/File:Oric1.jpg
Les Pounder puts a daffodil in his lapel and enters his surprisingly spacious blue police box to once again take us back to the 1980s…
OUR EXPERT Les Pounder is associate editor at Tom’s Hardware and a freelance maker. He blogs about his hacks and maker projects at bigl.es.
Having trouble finding the “ key on the Oric? We did this key is mapped to the # key on a UK keyboard. US keyboard layouts have the key in the “correct” place.
Emulating an Oric
To emulate an Oric-1 and Oric Atmos we need to use Clock Signal by Thomas Harte (https://github.com/ TomHarte/CLK). Clock Signal is an impressive emulator that does away with complex configuration. Instead it uses drag and drop to load ROMs and images. Clock Signal can emulate the Oric-1 and Oric Atmos, but you’ll also notice that it can emulate quite a number
62 LXF284 January 2022
The Oric-1 is a striking computer. It looks like a white ZX Spectrum, and the keyboard looks just as uncomfortable to use. But under the hood is a solid 1980s architecture.
of other machines: the Apple II, Amstrad CPC, ZX80/81 and even an Atari ST. To install Clock Signal on Ubuntu we used a pre-built Snap image. This image should work on other distributions that support Snap, but if not then Harte has the source on their Github page and this can be compiled for your machine. To install Clock Signal using a Snap, open a terminal and type the following, then press Enter: $ sudo snap install clock-signal
Clock Signal can now be launched via your Applications menu, or in our case by typing Clock Signal into the Gnome Shell search box. When Clock Signal opens you’ll find multiple machines listed under tabs. Scroll to the right for Oric and select the Oric-1 model and then click Start Machine, located in the bottom right of the window. Next, Clock Signal will tell us that we need basic10.rom in order to start the emulator. Optionally we can also use a colour rom, but this is barely used and not essential for emulation. Drop your basic10.rom on to the window and the Oric-1 will boot to a familiar BASIC interpreter. The interpreter also works as a means to load tapes and floppy disks – something that we shall later cover. If you’re more interested in the Oric Atmos, then you’ll need to select that machine and then click Start
ISSUE 283 December 2021
ISSUE 282 November 2021
ISSUE 281 October 2021
In the magazine We pit Ubuntu against Fedora to see which is the better Gnome-based distro. Five filesystems are put through their paces, we show how to run a Ghost blog, code a Galaxian-style shooter in Python, and use Okular to edit PDF files with ease.
In the magazine Linux and Windows can work in perfect harmony – find out how in our eight-page guide. We share files across a network without the need for protocols, emulate the Tandy TRS-80, control the Pi’s GPIO with Scratch, and create our own server.
In the magazine Discover how to customise the Mint 20 desktop with our in-depth feature. We explore virtual private servers, assess five open source art programs, build a Pi-powered pinhole camera, recreate pseudo-3D racing games and emulate the Atari 800.
DVD highlights Ubuntu 21.10 and Devuan 4.0 “Chimaera” (both 64-bit only).
DVD highlights Zorin OS 16 Core, Finnix 123, Lakka 3.4 and LibreELEC 10 (sadly all 64-bit).
DVD highlights Mint 20.2 “Uma” and Elementary OS 6.0 “Odin” (both 64-bit).
ISSUE 280 September 2021
ISSUE 279 Summer 2021
ISSUE 278 August 2021
In the magazine As Linux hits 30 years, we show how the kernel became a worldwide phenomenon. We take a look at terminal browsers, plus show how you can make your mark in desktop publishing, build a Pi Nextcloud server and run Linux distros from yesteryear!
In the magazine Find out how to use your Raspberry Pi to stream video to the world. Elsewhere, we compare five office suites, diagnose and solve Linux problems, emulate the Acorn Electron, set up a virtual network, design circuit boards and manipulate date with Pandas.
In the magazine Want a faster, better server? We show you how to set up some of the best server distros around. We also cover desktop virtualisation, running a mobile second screen, emulating the Altair 8800, multitasking in Python and web-app security.
DVD highlights Pop!_OS 21.04 (64-bit), and classic Linux distros (32-bit, unsurprisingly).
DVD highlights Rescue kit (CloneZilla, System Rescue and Rescuezilla, plus Zorin OS Lite.
DVD highlights Bodhi 6.0 and Lubuntu 21.04 (both 64-bit) and AntiX 19.4 (32-bit).
To order, visit www.magazinesdirect.com Select Single Issues from the tab menu, then select Linux Format. Or call the back issues hotline on 0330 333 1113 or +44 (0)330 333 1113 for overseas orders.
Quote the Product code shown above and have your credit or debit card details ready 66 LXF284 January 2022
READING IN THE USA?
UK readers turn to p16
Don’t wait for the latest issue to reach your local store – subscribe today and let Linux Format fly straight to you. Faster, cheaper and with DRM-free archive access!
3 GREAT WAYS TO SUBSCRIBE
Print, digita l-only, and print+d igital bundles!
From $132 For 13 issues
REST OF THE WORLD From $132 For 13 issues
From €93 For 13 issues
IT’S EASY TO SUBSCRIBE!
Call +44 0330 333 1113 Lines open Monday-Friday, 9am-5pm, UK time
January 2022 LXF284 67
TOP OF THE FOSS Mail-in-a-Box
MAIL-IN-A-BOX Hillary Clinton’s self-hosted mail server didn’t do her presidential campaign much good. Let’s see how Jonni Bidwell’s fares…
68 LXF284 January 2022
don’t want their customers’ machines turning into spam-spewing zombies, and generally block SMTP connections to home users unilaterally. You could try asking your ISP not to do this, but they’re unlikely to listen. In fact, they might start asking you awkward questions about what on earth you are doing. Mail servers also need to be online all the time, otherwise mail may go undelivered. We certainly wouldn’t count on our ISP having 100 per cent uptime, so we hit up our favourite server shop Mythic Beasts and arranged ourselves a dual vCPU VPS with 2GB of RAM. We also paid for a bit of extra storage space, because you never know when that will come in handy. Besides the cost of the (virtual) hardware, you’ll absolutely need to have a domain registered upon which to set up email. Dynamic DNS (e.g. duckdns.org)
SpamAssassin, DNS, Nginx… it’s a wonder MIAB doesn’t need a bigger box.
Credit: Mail-in-a-box/CC0 1.0
eople often say that email is hard. At one stage it was considered too hard to be the subject of a standard four-page tutorial. By the time you’ve explained Postfix, Dovecot, chromalisting, MX records, DMARC and DKIM there’s not really much room left to describe everything else. And there’s a lot of everything else. But that doesn’t mean it’s necessarily ‘hard’, just complex. A good elucidation of this can be found at https://bit.ly/lxf284mail. One ‘turnkey’ offering is called Mail-in-a-Box (https:// mailinabox.email), which doesn’t use containers. Instead, it’s meant to be installed on a single-purpose machine whose only job is to be an email server. Unlike lots of things featured in this magazine, MIAB is meant to be not at all configurable, beyond of course setting domain names and mail aliases. Sure, you can SSH into it and mess with the (many) configuration files, but as soon as the system updates these will all be overwritten. MIAB is currently based on Ubuntu 18.04, which might seem (with Ubuntu 22.04 LTS not too far away) a little old. But it’s still supported until 2023, and we’ll probably see a seamless upgraded to Ubuntu 20.04 over the coming months. You don’t need much in terms of resources to run your own mailserver. An entry-level VPS will be fine, the docs recommend at least 512MB of RAM, but you might have to sacrifice a couple of features (namely Spamassassin and ClamAV) with that amount. Unlike almost every other ‘self-hosted’ software we feature, you almost certainly can’t run a mail server using your home internet connection. ISPs (rightly)
TUTORIALS Music studio
Set up a music studio using Qtractor
Don’t miss next issue, subscribe on page 16!
Feeling creative? Michael Reed looks into how to build a Linux-based home studio using free software that can be applied to any type of music. his issue we’re going to build a software-based studio using Qtractor (www.qtractor.org), a powerful open source DAW (digital audio workstation). Qtractor is particularly strong when used as a MIDI sequencer. If the term MIDI (musical instrument digital interface) doesn’t mean anything to you, don’t worry. Essentially, MIDI enables you to record every note that makes up a piece of music as a series of numbers. These numbers represent the exact time that the note was struck, it’s velocity (volume) and the duration of the note. MIDI also specifies the cables and signals needed to connect computers to instruments. Next month, we’ll
OUR EXPERT Michael Reed once created a MIDI loop that was funky with a capital ‘F’.
DISCOVER THE QTRACTOR INTERFACE 5
The Linux sound systems
6 The Transport bar. Move the position cursor around the arrangement, and start and stop playback and recording with these tape machine-style controls. Further along are the current tempo and time signature.
The Tracks area Track name and other information is shown here. Double-click this to edit.
Files area. 3 A list of all the ‘clips’ used in the current arrangement. There’s a tab to switch between digital audio and MIDI clips.
70 LXF284 January 2022
delve further into Qtractor’s audio recording and manipulation facilities, which are fairly decent as well. MIDI became popular upon its introduction in the early 1980s because computers at that time weren’t powerful enough to generate high-quality sounds, but they could reliably send MIDI notes to synthesisers. These days, most musicians have moved over to software synthesisers (‘soft synths’), available in the form of plugins. If you look at old footage of electronic bands in an 1980s studio, you can often spot dozens of keyboards lining the walls. However, these days, it’s not uncommon to see an electronic musician producing hits with just a laptop, a MIDI keyboard and some monitor speakers. That sums up what we’re going for in this case. We’re going to set up a system with a MIDI sequencer that can control software synths. It’ll be useful if you’ve got a MIDI keyboard to plug into the setup, but you don’t need one to start having a play around with the software. These examples will assume that you’re using the builtin sound facilities of your desktop or laptop computer, but it’s worth considering getting hold of a dedicated USB audio interface for improved quality, particularly if you’re recording instruments and vocals and for critical listening. If you’re only creating music using software synths, then the quality of your audio interface has no effect on the sound quality of the final piece of music because everything is mixed in the digital realm.
The Arrangement area. Move clips around and cut and paste them in this area to define your arrangement. Double-click a clip to edit it.
The Navigation window. This gives you an overview of your current arrangement, and you can use it to move around.
The Messages window. Reminding us that this is a native Linux application we’re dealing with! This keeps us abreast of any errors that crop up and is useful for diagnosing problems.
We’ll start at the beginning, with the Linux sound systems themselves. ALSA (advanced Linux sound architecture) is the underlying driver that interfaces with the soundcard itself. The problem is that only one piece of software can address a sound card at a time using ALSA. PulseAudio was created to address this limitation, and it can mix together the output from applications such as music and video players, and web browsers. JACK (jack audio connection kit) is the main system that Linux-based musicians are interested in, and the vast majority of Linux music applications can take advantage of it. Like PulseAudio, JACK makes it possible for multiple programs to address the soundcard simultaneously. But that’s just the beginning of what it
TUTORIALS RSS reader Part Three
Don’t miss next issue, subscribe on page 16!
Set up and configure a custom RSS news feed
Deftly skirting the lines of legality, David Rutland reveals how he’s able to scrape all the news that’s good to read direct to his own server. ack in the early 2000s, RSS was the coolest gimmick in town. It was a way to get the latest headlines from your favourite blogs without needing to wait for your dial-up connection to load the complete webpage at 14.4kbps. A short snippet of text and a headline would let you know which Geocities sites had been updated, and independent bloggers would proudly syndicate their stories to other members of their webring to scroll in an endless ticker-tape parade across the screen. The garish displays are long gone (thankfully), but RSS is more powerful than ever, and in part three of our virtual private server (VPS) series, we’ll show you how you can use RSS to avoid trackers, blast past paywalls and ensure that your very own VPS is the only site you need to visit. These days 65 per cent of the world digests news online and many use an aggregator built into their phones and completely under the control of someone else. Whether it’s Google, Facebook or Apple, your reading habits are valuable, and the metrics of what you choose to click can be monetised. We don’t like that idea and, for some reason, we have the feeling that you’re not entirely comfortable with it, either. For a technology that was birthed in the previous millennium, it may surprise you how widespread the RSS protocol is. Practically every site you visit today will have an RSS feed. From the BBC news pages to the latest acquisition by Future – via Reddit and your favourite cyberpunk fanzine – most web publishers pour out a torrent of unfiltered headlines, links, and a couple of paragraphs to let readers know what to expect should they choose to click through. These juicy titbits are usually contained in an XML file, which is usually pretty easy to find on the main site. In most cases, they’re automatically generated by the CMS or site generator, without the site owners even knowing they exist. They’re sad, neglected things, and are rarely categorised: a veritable firehose of news, opinions and, well, garbage.
OUR EXPERT David Rutland is far too busy to fill out this bio, so you’ll have to imagine that he has some exotic hobbies – chainsaw juggling, say.
Some sites don’t have RSS feeds at all. It’s rare but true. In these cases you can usually generate a feed based on elements in a particular page using the feed generator at https:// createfeed. fivefilters. org. It’s fairly intuitive, but unless you pay for a subscription, your generated feeds are limited to five items.
The price of temptation
Should you choose to digest your headlines via RSS, the temptation to click through can be overwhelming. The snippets, intros and excerpts offer just enough to catch
74 LXF284 January 2022
Adding filters for individual feeds means that you can keep your reader free of clutter and unwanted SEO spam.
your interest and edge your mouse or finger closer to the link. Of course you don’t need us telling you that the internet is a dangerous place. Those same sites that seek to entice you in with witty one-liners, awesome alliteration and titillating titles contain third-party tracking code. This will stalk you across the internet, and enable bad actors to build a profile on you with more detail than you want your spouse, mother or children to be aware of.
We’re a paranoid bunch here at Linux Format. We like to do our reading without someone looking over our shoulders, recording how long we looked at each article, which pictures we found particularly interesting, and then figuring out how they can use that information to sell us stuff. You know what else we don’t like? Paywalls. Sure, it’s easy enough to pop open each news story from a soft-walled site in a new private tab (thereby setting the cookie counter to zero), but then you have to click through the dull old GDPR consent dialogues. Again. And so we were delighted beyond belief when we discovered FreshRSS. It’s a self-hosted RSS aggregator that will pull down entire articles to your VPS (Virtual Private Server) for you to peruse at your leisure. It cuts past cookie-based access paywalls, and keeps tracking code out of your browser. Best of all, anyone who monitors what sites you connect to on your mobile
TUTORIALS Change your filesystem
BTRFS Credit: https://btrfs.wiki.kernel.org
Safely swap your filesystem to Btrfs The Btrfs filing system is well-supported, reliable and packed with modern features, so Michael Reed will show you how to make good use of it. trfs is a filing system (see Roundup LXF283) that can be used as an alternative to the more commonly known ext4. You might think it’s risky to entrust all of your data to a relatively unknown filesystem, but in fact the Btrfs project was started in 2007, and it’s the default filesystem in some of the major distributions such as Fedora and SUSE Linux. So, it’s regarded as stable, and in fact, Btrfs has a lot of features that are designed to increase the safety of file storage. Having said all that, for all of the potential advantages, there isn’t anything extra that you have to learn for normal, day-to-day use.
OUR EXPERT Michael Reed is so taken with Btrfs that he wishes he could install it into his life and snapshot and rollback every time he does something embarrassing.
Tab completion is your friend. Let’s say you want to list all of the subvolumes attached to the root partition. You could accomplish it by typing sudo btrfs subvolume list / or sudo btrfs sub [tab] l [tab] /. At each stage, pressing Tab lists all of the potential next commands.
Butter my FS
Why switch over to Btrfs? Well, unlike the ext4 filesystem, it uses ‘copy on write’ file storage, which opens up a number of intriguing possibilities. For instance, you can make a snapshot of your root filesystem, make some changes, decide you don’t like the results and then roll everything back to how it was originally. You could even make a massive change such as adding a different desktop environment and then back out of it later on. This might sound like snapshotting within a VM, and that’s because it offers the same freedom to experiment. You can also make snapshots of other subvolumes, such as the one containing your home directory, or you could apply snapshotting and rollbacks to server-related files. You can also work with individual files and directories. Think of all of the times that you’ve had to work on a copy of a file while preserving the original file. Under Btrfs, a clone acts just like a copy of a file, and that’s what it appears to be. However, initially, no matter how big the file is, the clone takes up practically no extra disk space. It’s also created almost instantly. The filesystem only begins to store extra information on the hard disk when you start making changes to that copy. For example, on a Btrfs volume, you can type code cp --reflink example.txt example_old.txt , to create a copy of the file example.txt. Notice that the code --reflink endcode option is an addition to the standard Linux copy command. However, unlike a regular copy of a file, this new file takes up practically no space until you start making changes to it. This applies to massive files such as virtual machines and video files. So, it’s
78 LXF284 January 2022
Examine your history of system snapshots in the Timeshift GUI, and browse the files from that snapshot by right-clicking a snapshot.
possible to, almost instantly, make a copy of a large file such as a virtual machine file, make some changes and then swap everything back if you don’t like the outcome. As we said, you don’t have to know much technical stuff to start using Btrfs. If you can install Linux to a Btrfs-formatted partition, then you can install Timeshift using the package manager and start making use of full system snapshots and rollbacks from a GUI. If you’re not quite ready to fully commit to a Btrfs system yet, many of the techniques that we’ll look at could be applied to working with Btrfs volumes that have been added to an existing system. If you want to play around with Btrfs and learn what it can do, you might want to install it into a virtual machine (VM) while following this tutorial.
Butter up Ubuntu
We’ll assume that you have some familiarity with installing Ubuntu to begin with. That way, we can just concentrate on the differences when making it a Btrfsbased installation. With that in mind, follow the normal Ubuntu installation procedure. Options such as language selection and normal and minimal installation stay the same as usual. The page where we do something different is called Installation Type. As ever, be aware that, if you’re doing this on real hardware, you could easily wipe partitions. In other
THE BEST NEW OPEN SOURCE SOFTWARE ON THE PLANET
Alexander Tolstoy is touring the world and ticking off the hottest of picks to do one at a time.
Audacity Pscircle Edotool Quickemu USB Imager GtkStressTesting Key Mapper Sonic Robo Blast 2 NumptyPhysics Js-dos Larynx AUDIO EDITOR
Audacity Version: 3.1 Web: www.audacityteam.org his is the first major Audacity release since this open source project was acquired by Muse Group, the owner of MuseScore and the Ultimate Guitar website. After the uproar and controversy over the new owner’s plans to integrate an opt-in telemetry module into Audacity, Muse Group reversed its course and left everything intact – with the exclusion for new features and fixes, of course. That’s exactly what ignited our interest for Audacity 3.1, the amazing, feature-rich and leading waveform editor for Linux. Despite all the rumours, there are no obvious privacy issues, and the software is still GPL-licenced. Most of the recent improvements are addressed to those who use multi-track projects in Audacity. And so we have new clip handles, smart clips and playback looping. Smart clips are especially great because they can be trimmed non-destructively by dragging the upper edge of a clip. Drag the edge back and the audio contents are revealed again! If you master a complex audio composition made up of several individual tracks, for which you need to manually cut, trim or shift their fragments, then you’ll quickly notice the benefits of this new Audacity release. Clip handling is now much improved, which will save a lot of your time. There are smaller changes here and there too, such as the long-awaited fix for the Audacity inner volume control that used to change the systemwide volume, the new button for detecting the format of the audio being imported, and more. Those who prefer to use the direct ALSA output will also benefit from a more stable application. The interface also feels a little different thanks to the output audio device selection menu that’s available right from the main toolbar, and a different default waveform display. If you’re writing music or creating podcasts, postprocessing voice recordings or whatever else with Audacity, the new version is a welcome update. The project is definitely going in the right direction: introducing great new features and fixing old bugs.
Audacity is the number one waveform editor and recorder for Linux, and beyond.
EXPLORING THE AUDACITY INTERFACE... 1
5 Main playback controls These are the usual set of buttons for playing and recording sounds, together with the brand new Loop button.
sound. This will help your project to stand out and feel more professional.
Fine-grain control over samples Enables you to manipulate individual samples within the same audio track. Have fun with the non-destructive editing!
Select with better precision Audacity makes it possible for you to work with selections with superb accuracy, right down to fractions of a second.
Extra tools for better results Use the Envelope, Zoom, Select and Draw tools for achieving precise edits and local volume adjustments. Master multi-track projects Combine several tracks to develop a rich
January 2022 LXF284 83
CODING ACADEMY CODING ACADEMY Game of Life
Recreate the famous Game of Life Mihalis Tsoukalos casts a light on Python sets and shows how to implement the classic programming exercise the Game of Life in Python. veryone loves 2D cellular automaton, to explore this exciting subject we’re going to use Game of Life as our working example. This isn’t to be confused with The Game of Life, the family board game that was first produced in 1960 and is still going strong today. So, let’s begin by explaining how Game of Life the non-board game edition works! Before we start you can get the code packs for this tutorial from the LXF Archive here: https://bit.ly/lxf284code. Game of Life doubles up as both a programming exercise and an introduction to theoretical mathematics and computer science (don’t let that put you off! – Ed), but in this tutorial we’re only dealing with the former. Although it might not seem it, the game is Turing Complete, which means that its data manipulation rules can be used to simulate a Turing Machine (see LXF271). We’ll look at this in more detail later in the article. Game of Life can have various states, depending on the initial state of the board. Given an initial state, Game of Life doesn’t require any extra input from the user. Put simply, once it has an initial state, Game of Life can operate on its own with the help of its rules.
OUR EXPERT Mihalis Tsoukalos iis a Systems Engineer and a Technical Writer. He is the author of Go Systems Programming and Mastering Go, 3rd edition. You can reach him at www. mtsoukalos.eu and @mactsouk.
This shows some stable patterns that might appear in Game of Life. The stability of a pattern depends on the rules. In the case of the square that comprises four cells, no cell dies because each cell has three living neighbours.
The patterns of life
Game of Life works by creating patterns. The figure (below) shows an example of patterns in the Game of Life, that displays living and dead cells. It uses black for living cells and white for dead cells, which is the colouring scheme used throughout this tutorial. Once you’ve read the rules of Game of Life, you’ll understand why not all black and white cell combinations are allowed. Hint: when a living cell has too many neighbours, it’s going to die! Bear in mind that there are two kinds of patterns: those that are changing and keep repeating; and patterns that are stable,
90 LXF284 January 2022
This screenshot shows the Python code of initial.py as well as its output when randomly producing two 8x8 boards.
which means that they’re not being updated. Game of Life involves Set Theory, which is a mathematical area that works with sets. Set Theory isn’t axiomatically related to every Game of Life implementation, but it’s good to know about it. Mathematically speaking, a Set is a collection of distinct objects that don’t necessarily have the same type (duplicates aren’t allowed in sets) that are called Elements or Members. The elements of these sets can be of any data type .They include characters that you’re allowed to use to compose a string for a custom language; possible states of an automaton; or the permitted transitions of a Turning Machine. In Python, you can define a set in two ways. First, using the built-in set() function and second, using curly brackets. The following code excerpt from cs.py shows how to define four set variables in Python: s1 = set(“linuxformatlinux”) s2 = set([“l”,”i”,”n”,”u”,”x”,”x”])
CODING ACADEMY IP geolocation Part One!
Don’t miss next issue, subscribe on page 16!
Accurate, open source IP-based localisation Tim Armstrong reveals GeoIP.Network, an open source IP address localisation solution using Python that’s better than what went before! eing able to reliably identify the physical location of an IP address is an important element for a lot of online activities. From ecommerce stores needing to calculate the correct sales taxes (or import regulations) to detecting fake social media accounts, knowing where visitors to your website are coming from is all vital information. Whatever your reasons, you’re left with two questions: how do you find out this information from an IP address; and can you trust the accuracy of the source? Most GeoIP (the industry jargon) services are slow at updating their databases, and are incredibly secretive about how they get their information. While some providers (like Maxmind) enable you to download a version of its database periodically, this tends to be its least accurate data and is rarely updated. Its goal is to push users to its API products that it claims to be significantly more accurate than its free offering. While the competition in this space is improving, and the prices of such services are coming down, an ongoing independent study out of the Technical University of Munich (TUM) has shown that these commercial databases are up to 63 per cent incorrect. GeoIP.Network takes a different approach to IP localisation. It’s 100 per cent open source, and is so transparent about how it collects its data that this tutorial will even guide you through of the fundamentals. This means that if there’s an error in the data or the code then it can be corrected far more easily. In this tutorial, you’ll learn the basics of how GeoIP. Network works and how to use the free public access API to generate a map of visitors for your website.
OUR EXPERT Tim Armstrong is a former lead engineer turned developer advocate specialising in networking, software development and security.
Internet governance organisations like the RIPE NCC, ISOC and the IETF provide and support a wide range of open source, research, and open-data projects. If you need a project for CS class start here.
Mapping to locations
In broad strokes, GeoIP.Network follows a similar approach to the research being done at TUM, and uses a “hints-based” algorithm to bootstrap the database. From there it uses measurements from thousands of probes spread all over the globe to refine the results. The “hints” are made up of publicly available primary data sources such as the IRR (International Routing Registry) which is a large database maintained by ISPs all around the world.
94 LXF284 January 2022
Opening up the generated example.html file in a browser should reveal this location detail on the world map.
These primary sources contain information such as the intended country for those IPs, or which ISPs are directly connecting to each other. While not always accurate, ISPs tend to keep this relatively up to date, so it serves as a good base for the next phase. This database of IPs and approximate regions is then fed into a cleaning process that removes any inaccurate records. The filter validates the locations by pinging the IP addresses from the countries that they’re expected to be in. If the latency is significantly slower than expected for that country, then the record is rejected. The cleaned data is what is initially shown by GeoIP.Network. From this point, when GeoIP.Network receives enough requests for a specific IP address it triggers the refinement process. The refinement process is particularly interesting because it makes use of a stochastic-progressive algorithm (something you’re more likely to find in the graphics pipelines of major visual effects studios). While there’s a more detailed breakdown of this algorithm over at https://blog. plaintextnerds.com, essentially it makes a guess based on the bootstrapped data. It then uses probes around that estimated region to refine the estimate, which is then used to reduce the search area for the next probe selection until the number of available probes drops below a useful threshold.
will be on s Tuesday ale 11 Januar y 2022
The #1 open source mag Future Publishing Limited, Quay House, The Ambury, Bath, BA1 1UA Email firstname.lastname@example.org EDITORIAL Editor Neil Mohr Technical editor Jonni Bidwell Art editor Efrain Hernandez-Mendoza Art studio Catherine Kirkpatrick, Fraser McDermott, Andy McGregor Operations editor Cliff Hope Group editor in chief Graham Barlow Group art director Jo Gulliver Editorial contributors Tim Armstrong, Mats Tage Axelsson, Michael Bedford, Neil Bothwick, Matthew Hanson, Jon Masters, Nick Peers, Les Pounder, Michael Reed, David Rutland, Mayank Sharma, Shashank Sharma, Mihalis Tsoukalos, Alexander Tolstoy Cover illustration magictorch.com Raspberry Pi is a trademark of the Raspberry Pi Foundation. Tux credit: Larry Ewing (email@example.com) and The GIMP.
ATTACKS The complete guide to avoiding ransomware, blocking malware attacks and general nasties.
Explore the GNU Guix System and embrace a pure GNU-OS free of proprietary source, binary blobs and other unspeakables.
Build a networking lab
Experiment in complete safety by setting up a virtual network of computers and letting your code rip through it!
We bang on about how you need to back up all your data, but at least we’ll offer you the best solutions to do just that!
ADVERTISING Commercial sales director Clare Dove firstname.lastname@example.org Senior advertising manager Lara Jaggon email@example.com Head of commercial – Technology Dave Randall firstname.lastname@example.org Account director Andrew Tilbury email@example.com INTERNATIONAL LICENSING Head of Print Licensing Rachel Shaw Linux Format is available for licensing and syndication. To find our more contact us at firstname.lastname@example.org or view our content at www.futurecontenthub.com. NEW SUBSCRIPTIONS & BACK ISSUES Web www.magazinesdirect.com UK 0330 333 1113 World +44 (0) 330 333 1113 EXISTING SUBSCRIPTIONS Web www.mymagazine.co.uk UK 0330 333 4333 World +44 (0) 330 333 4333 CIRCULATION Head of newstrade Tim Mathers PRODUCTION AND DISTRIBUTION Head of production UK & US Mark Constance Production project manager Clare Scott Senior ad production manager Jo Crosby Digital editions controller Jason Hudson THE MANAGEMENT Chief audience and ecommerce officer Aaron Asadi MD, tech specialist Keith Walker Head of art and design Rodney Dive Design director Brett Lewis Commercial finance director Dan Jotcham Printed by Wyndeham Peterborough, Storey’s Bar Road, Peterborough, Cambridgeshire, PE1 5YS Distributed by Marketforce, 5 Churchill Place, Canary Wharf, London, E14 5HU www.marketforce.co.uk Tel: 0203 787 9001 Linux® is the registered trademark of Linus Torvalds in the U.S. and other countries. GNU/Linux is abbreviated to Linux throughout for brevity. Where applicable code printed in this magazine is licensed under the GNU GPL v2 or later. See www.gnu. org/copyleft/gpl.html. All copyrights and trademarks are recognised and respected. Disclaimer All contents © 2021 Future Publishing Limited or published under licence. All rights reserved. No part of this magazine may be used, stored, transmitted or reproduced in any way without the prior written permission of the publisher. Future Publishing Limited (company number 2008885) is registered in England and Wales. Registered office: Quay House, The Ambury, Bath BA1 1UA. All information contained in this publication is for information only and is, as far as we are aware, correct at the time of going to press. Future cannot accept any responsibility for errors or inaccuracies in such information. You are advised to contact manufacturers and retailers directly with regard to the price of products/ services referred to in this publication. Apps and websites mentioned in this publication are not under our control. We are not responsible for their contents or any other changes or updates to them. This magazine is fully independent and not affiliated in any way with the companies mentioned herein. If you submit material to us, you warrant that you own the material and/or have the necessary rights/permissions to supply the material and you automatically grant Future and its licensees a licence to publish your submission in whole or in part in any/all issues and/or editions of publications, in any format published worldwide and on associated websites, social media channels and associated products. Any material you submit is sent at your own risk and, although every care is taken, neither Future nor its employees, agents, subcontractors or licensees shall be liable for loss or damage. We assume all unsolicited material is for publication unless otherwise stated, and reserve the right to edit, amend, adapt all submissions. All contents in this magazine are used at your own risk. We accept no liability for any loss of data or damage to your systems, peripherals or software through the use of any guide. Notes: Sorry about the DVD, but think of the saved mountain of plastic! We are committed to only using magazine paper derived from responsibly managed, certified forestry and chlorine-free manufacture. The paper in this magazine was sourced and produced from sustainable managed forests, conforming to strict environmental and socioeconomic standards. The manufacturing paper mill and printer hold full FSC and PEFC certification and accreditation.
Future is an award-winning international media group and leading digital business. We reach more than 57 million international consumers a month and create world-class content and advertising solutions for passionate consumers online, on tablet & smartphone and in print.
Easy password management
Online or offline, we look at a password solution that will work for everyone and is free and open source, of course! Contents of future issues subject to change – we’ll be too busy panic buying for Christmas!
98 LXF284 January 2022
Future plc is a public company quoted on the London Stock Exchange (symbol: FUTR) www.futureplc.com
Chief executive Zillah Byng-Thorne Non-executive chairman Richard Huntingford Chief financial officer Penny Ladkin-Brand Tel +44 (0)1225 442244