Linux Format - May 2024 UK

Download as pdf or txt
Download as pdf or txt
You are on page 1of 100

WELCOME

MEET THE TEAM Linux is everywhere


Website trackers put Linux usage at over
4% for the first time. Where do you see Everyone gets excited when the
Linux market share goes up.
Linux use increasing and how do you The interwebs were abuzz that
think things will go in the future? desktop Linux hit 4% (see News,
page 6), never mind the 3% for
ChromeOS (which is Linux) and
whatever makes up the 6% of
Matthew Holder “unknown” operating systems –
I think that as devices such as the Steam Haiku, is that you? It was more or
Deck become more popular, Linux usage less this time last year when the
will increase without the user even knowing same excitement was around
about it. Other areas of growth will be as Linux hitting 3%, up from 2% the
immutable distros become more and more year before. What is going on?
popular and provide a more rock-solid, appliance-like usage. The truth is – and we have talked about this before – Linux is
everywhere now, to the point where even Microsoft, 25 years
on from its Halloween Documents leak, can’t escape and has to
Nate Drake embrace Linux and open source. That’s why we’re looking at
Wine and Proton bridge the gap between how Linux is now embedded inside Windows, how Microsoft
Linux and Windows, not to mention the has created its own Linux distro, and Linux is the most widely
250 million Windows 10 devices that deployed OS on Azure, along with the many open source
can’t be upgraded unless users switch to projects Microsoft contributes to, including the Linux kernel
Linux. I’m happy to occupy the exclusive itself. It’s a staggering turnaround from a corporation whose
4% niche enjoyed by groups like vegetarians and redheads. past CEO proclaimed Linux to be a cancer.
But that’s just further testament to the flexibility and
Nick Peers ingenuity of the kernel and the open source community around
It’s brilliant news that more people are it. This issue we’re covering all areas, from Steam Deck gaming
switching to Linux. I’m guessing these are and running Windows tools through Wine, serving up ebooks
people with older but perfectly serviceable on a shared network system, reliving classic retro computer
PCs who don’t want to buy a whole new systems like the MK14 to streaming video for desktop and
computer just to run Windows 11. Could the gaming around your network and getting the most from AI
trickle become a flood when Windows 10 systems. Along with the usual reviews and a time trackers
reaches end of life next year? Roundup, there’s loads to enjoy with open source.

Les Pounder Neil Mohr Editor


Valve’s Steam Deck has shown that Linux is [email protected]
a viable gaming platform. With SteamOS,
Proton and underlying technologies to
run Windows files on Linux, we have the
opportunity to broaden Linux adoption by
showing we don’t have to give up our triple AAA games.

Subscribe
Michael Reed
Linux makes sense as a gaming platform,
& save!
and that opens many doors. The success of
the Steam Deck helps. There are many office
On digital and print:
scenarios where Linux and a free office suite see page 16
makes more sense than paying for software.
Windows is changing so much, and some people don’t want it.

www.techradar.com/pro/linux May 2024 LXF314 3


SUBSCRIBE NOW!
Page 16

LINUX
REVIEWS

WINDOWS
Join Nate Drake as he explores Linux’s
AMD Ryzen 5 8600G 19 infiltration of Windows. Have
This reasonably priced processor is the
CPU of choice for Chris Szewczyk and his
the barriers between operating
tight budgets. systems truly been broken?
See page 30!

Deepin 23 20
Nate Drake is in too deep with Deepin – is
this Chinese-made distribution a crouching
tiger or a hidden dragon?

CREDIT: Magictorch

ROUNDUP IN DEPTH

KaOS 2024.01 21
Nate Drake seeks to find some order
in KaOS – a distro incorporating the
CREDIT: Getty Images/iStockphoto, AMD

KDE Plasma 6 desktop environment.

Bluestar Linux 6.7.6 22


Nate Drake finds blue is the colour, after
firing up this intuitive and visually stunning
Arch-based distro.
Time trackers 24 The Grapes of Tux 44
Drauger OS 7.6 23 This month, Michael Reed is keeping a Sommelier Jonni Bidwell shows you how
Nate Drake puts this distribution through strict eye on himself and trying to improve to get your pesky Windows applications
its paces – is Drauger a gaming dragon or his work efficiency by investigating time- running on Linux, as he uncorks the latest
just a plain drag? tracking applications. Wine release.

4 LXF314 May 2024 www.linuxformat.com


CONTENTS

Pi USER TUTORIALS

TERMINAL: Vulnerability audits 48


Invulnerable Shashank Sharma has found
that Lynis is the perfect terminal tool for
keeping systems safe.

KAVITA: Stream your ebook library 50


Nick Peers looks at a free tool that enables
Pi news 39 you to collate, read and share your digital
Introduced by Les Pounder, who publications over the internet.
celebrates the Raspberry Pi’s twelfth
birthday. Plus updates from the SBC world. SYSTEMD: It’s startup time, init! 54
Mats Tage Axelsson explains how Linux
takes you from the kernel to a running
system, both today and back in time.

Bambu Lab X1-Carbon


CREDIT: Barnstorm Games, Countdown The Official App, Raspberry Pi Foundation

41
There’s a reason this Bambu is shooting up
all over and Andrew Sink is more than
happy to help it out.

ParrotOS 40 Create smart notifications 42 MOONLIGHT: Home game streaming 60


Les Pounder has watched Hackers at least Les Pounder loves building gadgets with Promising the Sun and the Moon, Michael
12 times and knows all the books. He just the £8 Raspberry Pi Pico W – and some of Reed’s heavenly bodies promise perfect
needs a cool haircut and a RISC laptop. them, like this one, even work. gaming streaming on most PC hardware.

EMULATION: Reviving the MK14 64


Mike Bedford uses emulation to learn
CODING ACADEMY about Sinclair’s first sub-£100 computer,
which predated the ZX80 by three years.
Solve word puzzles 90
Living conundrum Matt Holder discovers OPENSCAD: Clever CAD coding 68
how to use Python to improve his puzzle- Hungarian boy genius Tam Hanna tidies up
solving skills when watching Countdown. his underground bunker’s cigar corner with
a bit of creative 3D printing.
Asteroids collision detection in C 94
Did those pixels touch or just pass by? PROTON: Fix Steam Deck glitches 72
David Bolton demonstrates how to check Despite amazing work, there’s plenty of
collisions with lots of objects on screen. incompatible Steam Deck games – but
fixes are at hand, though not for Neil Mohr.

REGULARS AT A GLANCE ADMINISTERIA

News 6 Subscriptions 16 Administeria 74


This month: Linux love, Plasma 6 premieres, Grab your monthly dose of Linux, save Stuart Burns shares Docker container tips
new Nvidia EULA clause, FreeBSD forgoes money and receive two 64GB USB sticks. and explains why he still loves Ubuntu,
32-bit, and the newest Framework laptop despite his criticism of Canonical.
ships, plus a round-up of some of the latest Back issues 58
distro releases. Get hold of previous Linux Format editions. Collaborate with OnlyOffice 76
Nowadays, online document collaboration
Kernel watch 10 Overseas subscriptions 59 is a must. Kseniya Fedoruk explains how to
Get Linux Format shipped around the globe. set up OnlyOffice DocSpace.
Answers 11
Neil Bothwick learned to count in binary HotPicks 83 ChatGPT masterclass 78
before decimal, which has stood him in Mayank Sharma was bitten by a Want to get more
good stead when answering queries on radioactive download manager, which is from the best-
mounting MP3 players, deleting invisible why he can venture into repos to find known AI service
CREDIT: ChatGPT

files, identifying wrong users, and more. OBS Studio, Moosync, PhotoCollage, on the planet?
Collector, Patool, Warpinator, Croc, S-tui, Barry Collins and
Mailserver 14 FreeDoom, LibreMines and QOwnNotes. Neil Mohr explain
Readers write in with reminiscences and how to make AI
queries, and Neil Mohr shares his wisdom. Next month 98 work for you.

www.techradar.com/pro/linux May 2024 LXF314 5


THIS ISSUE: Linux love Plasma 6 premieres New Nvidia
EULA clause FreeBSD forgoes 32-bit Latest Framework

OPERATING SYSTEMS

Linux is popular!
Linux has long been a favoured OS for servers and embedded
devices but is now increasingly popular for desktop machines, too.
ccording to data gathered by Regardless of the reasons, this raises the
A StatCounter, as of March 2024, Linux
accounts for 4.19% of all desktop
perennial question of whether 2024 (or some
other arbitrary date in the near future) will be
operating systems. This marks an all-time high the ‘Year of the Linux Desktop’.
for Linux desktop adoption. By some measures, this has
Naturally, these figures are nothing already happened. In 2020, for
compared to the Windows market share instance, Chromebook outsold
during the same period (72%) or even Mac OS MacBooks two to one.
(15.46%), but two years ago, Linux desktops According to StatCounter, in
only accounted for around 2% of users. 2024 Android accounts for
Assuming the Linux install base continues to over 71% of mobile operating
double every two years, Redditors have pointed systems – though, admittedly,
out jocularly that we can expect 100% Linux it’s not designed as a fully
adoption some time in 2033, or even sooner if fledged desktop distro.
you count Linux-based ChromeOS. The biggest driver of Linux adoption The Linux desktop market share is
All joking aside, this is a huge leap will most likely be further adoption and currently 4.19%, more than twice
considering that it took Linux over 30 years consolidation of web applications like Microsoft what it was two years ago. It took
30 years to break 3%.
to secure a 3% share of all desktop operating Office and Adobe Photoshop. Since these can
systems, a target it reached in June 2023. be accessed via browsers, users are then free to
There’s most likely a number of factors switch to alternative platforms to access them.
contributing to more Linux desktop users. It’s also likely that continued adoption of
We’ve previously covered how installing Docker containers will allow more widespread
the OS is a good alternative to junking use of DaaS (desktop as a service), meaning
non-TPM-2.0-compliant Windows 10 PCs. Linux will have greater support for proprietary
Sales of the popular Steam Deck handheld, programs. This could make a more convincing
which can run most Windows games in Linux case for Windows and Mac OS users to switch.
flawlessly via the Proton compatibility layer, Still, Linux has quite the mountain to climb,
might partly account for this spike in usage, particularly given the persistent belief that it’s
although it’s unclear how this links through to difficult to set up and use.
website browser statistics.
When reporting this story, other tech outlets
have emphasised Linux’s open source nature DATE LINE
CREDIT: StatCounter

making it ideal for technology enthusiasts. They


also point out the ready availability of user- This raises the perennial question of
friendly distros, such as Ubuntu and Linux Mint.
Still, we could counter that it’s hardly news that whether 2024 (or some other arbitrary
the Linux kernel is open source. Ubuntu has also
been around for almost 20 years. date) will be the ‘Year of the Linux Desktop’.
6 LXF314 May 2024 www.linuxformat.com
NEWSDESK

DESKTOP OPINION

KDE Plasma 6 released VECTOR


The long anticipated upgrade to the Plasma desktop VEXATIONS
has been released with huge improvements.
n 28th February, Plasma 6 (built on
O top of Qt6) was released. One of the
biggest changes is that Plasma now
defaults to the Wayland display server, with
experimental support for HDR. X11 will be Dave Stokes
supported for the foreseeable future and users is a technology evangelist
can still select it upon login. at Percona.
The desktop has also overhauled how it
deals with workspaces. Mercifully for inept Why does MySQL
touchpad users, scrolling via the desktop no not support vectors
longer automatically switches users from in its community edition?
one workspace to another. You can still use Generative AI is the hot
touchpad gestures to summon the new topic in tech. GenAI relies on
overview screen to display and select individual The new Plasma 6 desktop (shown running in KDE Neon) vector data. Yet Oracle has
workspaces, however. The much-loved desktop includes a number of tweaks to the theme and user interface. no plans to support vectors
‘cube’ effect has also returned. in the community edition of
While we’re talking mouse movements, for improve usability, such as for connecting and MySQL. If you want to try out
the first time Plasma now defaults to double- disconnecting devices. vector data with other open
clicking for opening files and folders. (You can On 5th March, KDE released Plasma’s first source components, you
still switch back to single-click if you wish.) point release (6.0.1), which fixes various bugs have the option of MySQL
The desktop still uses a tweaked version of including keeping files and folders visible as HeatWave on Oracle’s cloud
the Breeze theme but now also incorporates a they’re moved between screens. The new service, or opting for another
floating panel by default. It defloats when you’re Overview effect has also been tweaked to allow database entirely.
touching a window, including when said window closing via the top-left hot corner, while a bug The general lack of new
is maximised. has been fixed in the Plasma panel that caused capabilities in the community
Plasma also now ships with a new default it to disappear when users tried to add widgets. edition is likely to force users
sound theme, Ocean, which adds new sounds to https://community.kde.org/Plasma/Plasma_6 to seek alternatives rather
than sign up to an expensive
subscription. This will put
MySQL further behind
options like PostgreSQL that
GRAPHICS already support vector data.

Nvidia moves to block ZLUDA


This is counter-productive
for the MySQL community
and for Oracle. Not having
vector data support in the
Ban on using CUDA translation layers in installed files. community edition will
jeopardise the position of
s more and more applications rely on As commenters point out, it’s not clear if the MySQL in the open source
A the combination of Nvidia and CUDA,
it was inevitable that third-parties
EULA is enforceable. Indeed, Nvidia’s online
licensing terms have forbidden running CUDA-
space. When you can use
PostgreSQL and pg_vector
would try to build on their success. based software on other platforms using as a fully open source option,
There’s already examples of this, such as translation layers since 2021 without taking why pick something else?
ZLUDA, a drop-in replacement for CUDA. The obvious legal action against projects like ZLUDA. There’s already huge
implications of running unaltered CUDA Developers have also pointed out that in interest around MySQL to
applications on non-Nvidia graphics cards order to agree to the EULA, users must first PostgreSQL conversion
could be very serious for the tech giant. install CUDA, so technically programmers could courses, in both the tech and
Perhaps it’s unsurprising, therefore, that simply not reference or use it when creating the personal skills needed to
users wishing to install CUDA 11.6 onwards their own translation layers. be successful. This approach
have to agree to a new clause in the EULA Recompiling existing CUDA programs is also around vector data will only
which states: “You may not reverse engineer, legal. AMD and Intel offer developers a way to encourage more potential
decompile or disassemble any portion of the do this via ROCm and OpenAPI respectively. migration. In the meantime,
output generated using SDK elements for the For now, CUDA has the edge, as ZLUDA we have to wait and see
purpose of translating such output artifacts to doesn’t fully support features like OptiX, but what the community
target a non-Nvidia platform.” Nvidia’s market dominance could reduce in time. does for itself.

www.techradar.com/pro/linux May 2024 LXF314 7


NEWSDESK

Processors in devices such as


OPINION PLATFORMS the first-gen Apple Watch still
use the ARMv7 architecture but
32-bit developers are hard to find.

WINE FOR
WAYLAND FreeBSD moves to kill 32-bit
FreeBSD is deprecating 32-bit platforms; 32-bit binary
support in 64-bit kernels will remain, however.
reeBSD kernel hacker John Baldwin changes in the marketplace. While this initially
Alexandros Frantzis
is a senior software engineer
F has announced that version 15.0 of the
OS is unlikely to support ARMv6, i386
meant supporting i386 systems, this has long
since been superseded by x86_64.
at Collabora. and PowerPC platforms. FreeBSD 16.0 will He also correctly stated that the pool of
almost certainly not support ARMv7. 32-bit developers is shrinking each year, with
2023 was a great year He did reassure readers that it will be only the ARM7 architecture being used in
for the Wayland driver possible to execute 32-bit binaries on 64-bit recent system designs. The FreeBSD team

CREDIT: TechRadar
for Wine. The goal was to FreeBSD kernels and there are no plans to may, however, support 32-bit architectures
move forward from the remove this feature from the stable branch. on a case by case basis.
experimental phase and Baldwin has justified this decision by More information is available via the
make the driver a proper pointing out that FreeBSD has also adapted FreeBSD 14.0 release notes: www.freebsd.org/
upstream component. A to support various architectures based on releases/14.0R/relnotes/.
year later, after several
merge requests, many
people are now already
able to use the latest Wine
release to enjoy some of
OPERATING SYSTEMS LAPTOPS

PostmarketOS Framework 16
their favourite Windows
applications in a completely
X11-free environment.

moves to laptop ships


So far, we have in
upstream basic window
management, such as full-

Systemd
screen, maximisation and
resize, software rendering, Repairable, upgradable
Vulkan support, including
Direct3D through WineD3D/
model costs under $500.
Vulkan or DXVK, and basic Phone OS has tentative
support for HiDPI scaling.
While the recent release
support for Systemd. ince late February 2024, the first
of Wine 9.0 did bring an
experimental Wayland driver, ostmarketOS (abbreviated as pmOS)
S Framework 16 laptops have made
it into customers’ hands. The
our work is far from done.
Our upstreaming efforts will
P is an operating system primarily for
smartphones, based on Alpine Linux.
manufacturer’s claims are bold: from just
$499 for the bare-bones model, you can have
continue in 2024, with a One of the project’s ultimate aims is to support your very own customisable, repairable and
focus on multiple key the mainline Linux kernel on all phones. upgradable laptop.
features including emulation In early March, pmOS took a step further Framework devices largely follow open
CREDIT: PostmarketOS Wiki, Framework Computer Inc

of display mode changes towards this goal by providing a version of the standards, including open source firmware.
through compositor scaling, OS that builds on top of Systemd. The new expansion bay can attach PCIe
OpenGL support, improved At the time of writing, several-proof-of- components such as the AMD Radeon RX
positioning of transient concept images are available and developers 7700S, but this costs an extra $400.
windows (pop-ups, menus are free to build their own version. Although If you want a functioning laptop out of the
and so on) and even more Alpine Linux doesn’t ship Systemd, there are box, prices start at $1,399. Visit https://frame.
window management. currently no plans to move pmOS away from it. work to learn more.
If you’re curious to see
PostmarketOS The Framework 16
what all this progress looks
builds are now offers even greater
like, there are several videos customisability
available using
out there made by people due to supporting
Systemd, even
using the Wayland driver though its PCIe components,
(which is very exciting to parent OS Alpine as well as a
see), so I’ll let those Linux doesn’t reasonable bare-
speak for themselves. ship with it. bones price.

8 LXF314 May 2024 www.linuxformat.com


NEWSDESK

Distro watch
OPINION

FIXING
What’s behind the free software sofa? OFFICE 365
UBUNTU 24.04 LTS
Ubuntu 24.04 LTS Noble Numbat is currently scheduled for release
on 25th April. At the time of writing, we’re working with a daily build
and expect a full review next issue. Nevertheless, we discovered that
Canonical has announced this LTS release will be supported for up
to 12 years, assuming users opt for an Ubuntu Pro subscription. The Ubuntu 24.04 will be Italo Vignoli
Ubuntu installer now defaults to Minimal, but you can still choose Full supported for up to is a founder of LibreOffice and
as well as third-party codecs. Learn more at https://ubuntu.com. 12 years. the Document Foundation.

The European Data


Protection Supervisor
FREEBSD 13.3 (EDPS), the independent
Despite moving away from 32-bit architectures in future versions (see authority for the protection
news story, opposite page), this fourth release of the FreeBSD stable of personal data and privacy
branch is still very much i386 compatible and brimming with updates. within EU institutions and
ZFS has been upgraded to OpenZFS 2.1.14. LLVM and the Clang offices, has issued a press
compiler have also been updated to version 17.0.6. FreeBSD now release stating that the use
ships with OpenSSH v9.6p1 and Sendmail v8.18.1. For a complete FreeBSD 13.3 is of Office 365 violates rules
list of all the new FreeBSD features, pay a visit: dedicated to release in the GDPR, in particular the
www.FreeBSD.org/releases/13.3R/relnotes/. engineer Glen Barber. one regarding the transfer of
personal data outside the EU.
The EDPS has decided
that, by 9th December 2024,
LINUX FROM SCRATCH 12.1 the transfer of data resulting
The Linux From Scratch Project is both a Linux installation and a from the use of Office 365
book that explains how to build a custom Linux system from scratch. to Microsoft and its affiliates
For version 12.1, a total of 43 packages have been upgraded, such must cease and the data
as Binutils 2.42 and glibc 2.39. A number of revisions have also been processing must be brought
made to the book itself to improve readability. The Linux kernel has The LFS book details back within the parameters
been updated to version 6.7.4, too. You can discover more at: how to build a custom defined by the GDPR.
https://linuxfromscratch.org. Linux installation. As expected, the solution
proposed is not to abandon
Office 365 and switch to
LibreOffice – which would
KALI LINUX 2024.01 solve all data protection and
Beloved by penetration-testers everywhere, Kali’s latest iteration, privacy issues – but to
v2024.01, comes with a number of visual tweaks including the intervene in Office 365, with
obligatory manual wallpaper and GRUB boot loader refresh. Kali is the result that the solution
now easier to download as well, thanks to the addition of 32 new will likely be inadequate and
mirrors. As part of the continuing transition to GTK4 apps, the Eye of require further intervention.
Gnome viewer has now been replaced by Loupe. The latest version Kali comes with Of course, the EDPS’s
of Nautilus also considerably speeds up file search times. Find out new tools and a decision should also affect
more at www.kali.org. refreshed theme. institutions in EU countries,
including schools, where
data protection and privacy
issues are even more serious
KDE NEON 20240228 as they affect children. We
This updated build of KDE Neon is still based on Ubuntu 22.04 LTS hope the EDPS will extend
but includes brand new KDE releases including Plasma 6, KDE his decision to EU countries
Frameworks 6 and all programs included with KDE Gear 24.02. Existing as soon as possible to avoid
users can upgrade via Discover. New users can download the latest even greater damage than
ISO or Docker images. There are some bugs in the latest so-called This User Edition of that caused at EU level.
megarelease but developers assure users they’re working on fixing Neon includes all the And we hope this will lead,
them. Read more at https://neon.kde.org. latest KDE releases. at least in some cases, to a
migration from Office
365 to LibreOffice.

www.techradar.com/pro/linux May 2024 LXF314 9


NEWSDESK

Kernel Watch
OPINION
HAPPY
BIRTHDAY!
Jon Masters keeps up with all the latest happenings
in the Linux kernel, so you don’t have to.
inus Torvalds announced Linux 6.8, slated to become the successor to the i915
Jon Masters is a kernel hacker
who’s been involved with Linux
L noting that the development cycle
had been calm over the trailing
driver. For now, you must explicitly enable it.

for over 22 years. couple of weeks, “just as it should be”. The Linux becomes its own CNA
new kernel includes many performance One of the most interesting developments
Canonical (the enhancements under the bonnet. Among came in an email from Greg Kroah-Hartman
company that these are support for variable (multi) sized (Greg K-H), in which he casually observed via a
sponsors Ubuntu) just Transparent Huge Pages (THP), meaning documentation patch, “The Linux kernel project
turned 20. Can you believe that the kernel can now automatically handle now has the ability to assign CVEs to fixed
it? The Linux distro began memory using much larger pages while issues, so document the process and how
life as ‘no name yet’ and allowing multiple different huge page sizes, individual developers can get a CVE if one is not
there were rumours of as opposed to the old-school approach of automatically assigned for their fixes.” CVEs, or
secret meetings in Oxford boot time selection (this is something that Common Vulnerabilities and Exposures, along
to kick it off back in early certain large workloads, such as databases, with an associated CVSS scoring process is
2004. I attended the first will enjoy). The new kernel also removes the industry standard for managing security
ever Ubuntu conference, support for the venerable SLAB memory vulnerabilities and tracking fixes to significant
which was really a large allocator, long since replaced by SLUB. problems. CVE numbers can be issued by CVE
meeting held in the autumn An allocator manages ‘arenas’ of memory for Numbering Authorities (CNAs), of which Linux
of 2004 in Mataro, Spain. I easier data structure allocation. is now one, meaning that other entities can no
recall having a lovely More user-visible changes include longer issue CVEs against Linux.
conversation or three support for Intel’s Trusted Domain The upstream patch adding the Linux CNA is
with Mark Shuttleworth eXtensions (TDX) Confidential Compute opinionated, noting “Over time, CVE numbers
(someone with whom I (CoCo), at least on the host side. This means were very often assigned in inappropriate ways
would later compete when I that (on suitable Intel hardware) 6.8 users and for inappropriate reasons.” The patch talks
joined Red Hat in 2006), can spin up encrypted guest VMs that are about “ongoing abuses” and states that “the
and being impressed by the resistant to attack from a malicious CVE assignment team are overly cautious and
tremendous passion held by hypervisor. Other architectures are in the assign CVE numbers to any bug fix that they
those within the community. process of gaining CoCo support. Another identify”. Reactions were mixed, with a number
It was refreshing to interesting change is the merging of an of distro developers concerned that this could
see a Debian-derived experimental driver with initial support for “DoS the system” (with the sheer number of
‘commercial’ friendly distro Intel’s Xe graphics. This driver can be used CVEs) or “flood” distros with “low quality CVEs
that ended up having legs. on Tiger Lake and newer platforms, and is which have no analysis or scoring”.
Some of us still fondly
remember Progeny Linux,
which was all too short-lived
as an earlier attempt at ONGOING DEVELOPMENT
building a commercial story
with Debian. And in spite of Pasha Tatashin posted “Dynamic Kernel that memory is allocated for every task
my affiliation for all things Stacks”, in a follow-up to a proposal from until it is used, which is useful for very
Fedora, I always had a the LSF/MM Linux Kernel Memory large systems.
healthy respect for the work Management conference. Traditionally, Matthew Wilcox posted “Rosebush, a
that went on within the user applications use a magic stack that new hash table”. Hash tables are very
Ubuntu community, and in automatically grows (usually downward) as common data structures, known for their
particular for good friends functions are called that perform local constant time access properties. As a
like Jono Bacon, who did a memory allocations. This is why you don’t result, hash tables are very widely used,
lot of heavy lifting in the need to do explicit memory management yet not all hash tables are alike. The hash
early years to build for data on the local stack (the kernel is function used to generate indexes and
community (he would later doing it on your behalf). But within the other attributes, such as cache awareness,
go on to write a successful kernel, this is not the case, and so each are critical to good performance at scale.
book on the subject). So, task has a (small – for example, 16K) fixed- Matthew claims Rosebush is cleverly
happy birthday Canonical, size stack. In the new world order, the optimised for cache friendliness. He does
you’re almost old enough kernel stack is still small, but not all of like his fun data structure names.
to drink a toast
where I live.

10 LXF314 May 2024 www.linuxformat.com


Neil
Bothwick
learned to
Got a burning question about open source or the kernel? count in
binary before
Whatever your level, email it to [email protected] decimal.

Q Wrong live user


Until Linux Mint 21.3, the Linux
menuentry “Start Linux Mint 21.3
Cinnamon 64-bit” --class linuxmint {
find $PWD useful; it contains the current
directory that starts out as the directory
Mint live session user is mint and $HOME set gfxpayload=keep from which the script was run.
is /home/mint. But in Linux Mint 21.3, the linux /casper/vmlinuz boot=casper
live session user is linux and $HOME is
/home/linux, though it is mentioned
username=mint hostname=mint quiet
splash --
Q Wherever I hang my @
I recently purchased a Keychron
as mint on the official website. I am initrd /casper/initrd.lz K10 keyboard from the manufacturer’s
confused. How did I go wrong? } site. The advertising said that the
I have tried beta and stable versions of You can see that the username and keyboard was for Windows and Mac,
Linux Mint 21.3 Cinnamon, Mate and Xfce hostname can be specified at boot time and they also had a dedicated Linux user
downloaded from http://linuxmint.com. and default to mint. If you are using a group. This user group is on Facebook,
In all three beta versions and three stable custom setup, make the appropriate and I don’t use Facebook, nor do I intend
versions, the live session user is linux, the changes in your boot menu. If you are to open an account. It is a beautiful
shell prompt is linux@linux and the home booting directly from a copy of the ISO, keyboard to type with, as long as you
directory is /home/linux and $HOME we are at a bit of a loss to see why this don’t want any ‘funny’ characters. The
is /home/linux. There is no mint live setting has changed for your system, @ sign and the euro symbol were very
session user or mint group. I have been but check the menu entry to see what is well hidden. I do some Bash scripts and
using Linux Mint Cinnamon live sessions actually used. When the boot menu is on Python scripts, and it’s a nightmare.
since 2009. Being a frequent traveller, screen, press Tab to see the options used, I was wondering if you are aware of
practically, I live in live sessions. I have and change them if necessary. You can any Linux application that I could use
so many scripts as a mint user. The most also see the options after booting with to remap some of the keys. I tried VIA’s
intriguing factor is the anomaly. I have this terminal command: web portal, but it refuses to play ball on
made some posts on this subject; but I $ cat /proc/cmdline Firefox. Any thoughts?
could not get any answers. Kindly help me You can also mount the ISO image from Sean Millar
solve the mystery. any normal distro session like this:
David Jebastian $ sudo mount -o loop /path/to/linuxmint-
21.3-cinnamon-64bit.iso /mountpoint
A This keyboard uses the hid_apple
driver module, which has a couple
A This is indeed a mystery,
because we just booted a freshly
However, this all raises another
important point. You have hard-coded
of options that affect the layout. The first
sets whether the function keys behave as
downloaded ISO of 21.3 Cinnamon and the username and home directory into normal or whether you need to press the
both the username and hostname were your scripts. A more portable solution Fn key to get that behaviour. You can try
mint. Are you booting from the ISO copied is to use environment variables in your the two options with this command:
to a USB stick or optical disc, or are you scripts. The variables $USER, $HOME $ echo X | sudo tee /sys/module/hid_
using a more customised setup? The and $HOSTNAME contain the username, apple/parameters/fnmode
reason for asking is that the GRUB menu home directory of your user and the Here, X is 1 to require Fn for ‘normal’
specification includes this: hostname of the computer. You may also behaviour or 2 for Fn to give the special
keys. There is also 0 to completely disable
the Fn key, but you wouldn’t normally
want that. Once you know what you want,
make the change permanent by creating
the file /etc/modprobe.d/hid_apple.conf
containing the following:
options hid_apple fnmode=X
Then run:
$ sudo update-initramfs -u
The other option is iso_layout, which
can be 0 or 1. Once again, you can test it
Linux Mint live temporarily with:
distros still boot $ echo X | sudo tee /sys/module/hid_
with the user
apple/parameters/iso_layout
mint, but you
can change this in Make it permanent by adding the
the boot options. following to /etc/modprobe.d/hid_apple.

www.techradar.com/pro/linux May 2024 LXF314 11


ANSWERS

conf and running update-initramfs : Updating through


options hid_apple iso_layout=X your distro’s
There’s a couple more options that you package manager
should not
may like. To see them all, run:
affect things like
$ modinfo hid_apple bookmarks, but
To remap individual keys to suit your you can back them
usage, you can use Xmodmap. First of up anyway.
all, create a configuration for the current
layout with:
$ xmodmap -pke >~/.Xmodmap
Then run:
$ xev -event keyboard
This shows the details of how each key
is seen by X as you press and release it;
you are interested in the keycodes. You
can then edit the ~/.Xmodmap file to
remap keys. It contains lines like:
keycode 13 = 4 dollar 4 dollar EuroSign
A A normal update should not affect
your bookmarks. As with most user-
reinstallation with the latest version. At
the time of writing, that is version 23.10,
onequarter EuroSign specific settings, bookmarks are stored but 24.04 will be imminent by the time
This shows what is returned by the within your home directory and software this is published and that will be a long-
key, first alone and then with the various updates do not touch your home directory. term support (LTS) release. Standard
modifiers. Edit this file, swapping around That is, unless you are downloading releases are supported for only nine
definitions to suit your needs and then Firefox from its website and installing months whereas LTS versions have two
apply the changes with: it in your home directory, which is not years of updates and support, so it may
$ xmodmap ~/.Xmodmap a practice supported by your distro. In be worth waiting for 24.04.
Once you are happy with the setup that case, you may want to back up your Before reinstalling, you should back
you can make this change permanent. Try bookmarks before installing a new version. up your home directory to an external
rebooting and see if your desktop picks up In Firefox, select Bookmarks > Manage device. Then you can copy it back
the .Xmodmap file, some do. If it doesn’t, Bookmarks from the menu (or press once the new version is running. If the
add this line to ~/.xinitrc (create the file if Ctrl+Shift+O). Here you can back up your external device is formatted with a Linux
it does not exist): bookmarks and restore them after an filesystem, such as ext4, you can simply
[[ -f ~/.Xmodmap ]] && xmodmap ~/. upgrade. You can also export bookmarks copy everything across because file
Xmodmap to an HTML file. That file can be imported metadata (permissions, ownership and
This checks for the existence of the into Firefox but also most other browsers; so on) will be preserved. If the device is
.Xmodmap file and loads it if found. There it is an easy way to transfer bookmarks formatted with a Windows filesystem, this
is a graphical editor for Xmodmap, called between browsers. metadata would be lost with a straight
XKeyCaps (www.jwz.org/xkeycaps), However, you are running a seven-year- copy, so you should use a backup program
but it is very old and editing a text file is old version of Ubuntu, one that reached to copy and restore your files.
easy enough. end-of-life some six years ago. That

Ye olde Firefox
means you have not received security or
software updates for almost that long. We
Q Empty not empty
I am trying to delete a directory as
Q How do I update Mozilla Firefox would not be comfortable using such an root, but it won’t go away.
without losing my bookmarks? old system online. Ubuntu does provide $ rm -rf xyz/
I am running Ubuntu 17.04. Would the an upgrade path to update to a newer rm: can’t remove ‘xyz’: Directory not
latest version of Mozilla Firefox run on my version, but it will have problems with a empty
computer? It is 64-bit. seven-year jump – one or two versions $ ls -la xyz
Ian Learmonth is considered safe. Your best option is a $

A QUICK REFERENCE TO… FUSE


The Linux kernel supports commonly used FUSE to be treated as a filesystem, for Windows and Mac OS
many filesystems, both filesystem is probably ntfs- extending the ‘everything is a to manage your files. A
native to Linux and for other 3g, which allows mounting file’ mantra of Linux. FUSE driver for a service
OSes. But there are many and using of Windows NTFS Another popular FUSE allows Linux users the same
more specialised filesystems devices. Yes, there is NTFS driver is sshfs. This uses degree of freedom, more so
and it is unrealistic to expect code in the kernel but the SSH to mount a remote really, as you can use any file
the kernel developers to FUSE driver is preferred filesystem, avoiding the manager you prefer rather
handle them all. Enter FUSE by many. FUSE can also be need to set up Samba or than being limited to their
(Filesystem in USErspace), a used to handle data transfer NFS shares and open ports software. FUSE drivers have
module that allows external protocols, as with MTP. on your router, all with the been written for most of the
drivers to provide filesystem While this is not a filesystem security of SSH encryption. popular cloud services, and
support. This opens a world specification, the FUSE Many cloud storage quite a few you have probably
of possibilities. The most drivers allow an MTP device services supply software never heard of.

12 LXF314 May 2024 www.linuxformat.com


ANSWERS

(https://github.com/hanwen/go-mtpfs).
We have used mtpfs and jmtpfs with
decent success. They are all FUSE
filesystems and work in much the same
way. For example, with mtpfs, run:
$ mtpfs ~/mtp
This mounts the first MTP device
discovered at ~/mtp, or wherever you
choose to mount it. This assumes you
have only one device attached, which is
the usual scenario. If you are a glutton
for punishment and want to work with
multiple MTP devices, something like
simple-mtpfs may be more suitable. With
one device, the operation is the same as
mtpfs. With multiple devices, where X is
the number of the device from the list the
You can access the contents of an MTP device with GMTP, or mount it as a filesystem with a FUSE program. first command gives you, you can do:
$ simple-mtpfs --list-devices
As you can see, ls reports the directory that is not possible, maybe a background $ simple-mtpfs --device X ~/mtp
as empty. I am root, so it can’t be task has locked the file, you can pass the Whichever you use, once mounted you
permissions, so what is going on? PID to kill to force it to close: can access the contents from the terminal
Bradley Howarth $ kill <PID> or your favourite file manager. As all of
If lsof shows the file is still locked, it these filesystems use FUSE, they are all
A There’s a number of possibilities
here. Let’s get the least likely, but
is likely the process locking it has hung
and is not responding to kill’s request to
unmounted in the same way when you are
finished transferring files:
worst, option out of the way first. You terminate, in which case you can force the $ fusermount -u ~/mtp
could be infected by a rootkit that is hiding issue with: If you can’t run these commands as
files in there and has installed a modified $ kill -KILL <PID> your normal user, you could use sudo or
ls to pretend they are not there. The Only use this as a last resort as it check the ownership of the device created
easiest way to check this is to boot from causes an unclean shutdown of the when you plug in the player; you may need
a live distro and use ls from that to check. program. Alternatively, if you can’t to add your user to the relevant group.
This is unlikely, but if it has happened, you be bothered with all that, reboot the There are graphical options – GMTP
should reinstall your distro. computer – a guaranteed, if somewhat (https://gmtp.sourceforge.io) is one – as
Another possibility is filesystem brutal, way of releasing the locks. well as plugins for some file managers.
corruption, which can be checked with Gnome users need to install gvfs-mtp,
fsck. The filesystem needs to be mounted
read-only to run fsck fully, so if this is on
Q Music To Player
I bought a new MP3 player but it
while in KDE you should see your devices
in the Dolphin sidebar, as long as you have
your root filesystem, you need to boot a does not appear in disks and devices on the kio-extras package installed.
live distro to run fsck like this: my desktop. Neither do I see an icon to
$ fsck -f /dev/sda1 mount it. How am I supposed to get my GET HELP NOW!
Replace sda1 with wherever your music on to this hardware? My operating
filesystem resides. A third possibility system is Debian 11. We’d love to try to answer any questions
is that this is a mount point for another Jamie Tyler you send to [email protected], Subscriptions: for magazine issues email [email protected]
filesystem. Even if that filesystem is no matter what the level. We’ve all been
empty, it will not let you delete it, so
umount first.
A Most media devices do not present
themselves as USB mass storage
stuck before, so don’t be shy. However, we’re
only human (although many suspect Neil is
As you now realise, there are many devices these days; they use the Media a robot), so it’s important that you include as
possible causes, but a common and Transfer Protocol (MTP), which is an much information as you can. If something
elusive one is that a deleted file is still extension of the Picture Transfer Protocol works on one distro but not another, tell
locked. If you delete a file that is in use by used by digital cameras. There is support us. If you get an error message, please tell us
an application, that file disappears from for MTP devices in Linux, but we have the exact message and precisely what you
the directory listing but it is still there found it to be a little flaky at times. If you did to invoke it.
for as long as the application is using check the settings menu on your devices, If you have, or suspect, a hardware
it. It is automatically deleted when the you may find an option to use mass problem, let us know about the hardware.
application releases it (or terminates). storage instead of MTP. If you enable Consider installing hardinfo or lshw.
You can find such files with lsof: that, you should see an icon and have These programs list the hardware on your
$ lsof xyz | grep deleted the device mounted when you plug it in. machine, so send us their output. If you’re
This shows any files that have been Otherwise you need to install an MTP unwilling, or unable, to install these, run the
deleted but are still open. The first filesystem driver, and there are several following commands in a root terminal and
element on each line of output is the choices here, including mtpfs (https:// send us the system.txt file, too:
name of the process locking the file, the github.com/cjd/mtpfs), simple-mtpfs uname -a > system.txt
second is its process ID (PID). Knowing (https://github.com/phatina/simple- lspci >> system.txt
what is locking the file, you can go into the mtpfs), jmtpfs (https://github.com/ lspci -vv >> system.txt
application and exit it to release the lock. If JasonFerrara/jmtpfs) and go-mtpfs

www.techradar.com/pro/linux May 2024 LXF314 13


Mailserver
MAILSERVER

WRITE TO US LXF is wrong!


In the password manager article (Roundup,
Do you have a LXF312), it stated that you would still have to
burning Linux-
pay for premium features if you self-hosted
related issue
Bitwarden. Just an update, but if you self-
that you want to
discuss? Write host with Vaultwarden (https://github.com/
to us at Linux dani-garcia/vaultwarden), you get most
Format, Future premium features for free.
Publishing, Vaultwarden still uses the official
Quay House, Bitwarden clients and is a much lighter-
The Ambury, weight installation, better suited to home
Bath, BA1 1UA or servers. Thanks for continuing to put out
email letters@ such a great magazine!
linuxformat.com.
Ken P

Neil says…
Thanks for putting us straight on that one. Come find the distro that some random internet person thinks is best for you!
I’ve not come across Vaultwarden, so that’s
good to know about for the self-hosting types. of years. I’m looking for something that is business
Personally, I’m a big fan of Bitwarden and have no issue class and the budget is around £1,000. The idea is that
paying the $10 yearly fee to help fund it in some way. I the laptop should be suitable for multitasking and
can attest that moving from LastPass was utterly maintaining multiple terminals.
smooth, too, and if anything Bitwarden has a better Currently, I’m working from Ubuntu running on a HP
web interface. And although the Android app could do ProBook 450 G10 with an Intel Core i5-1335U and
with more polish, it’s certainly as good as LastPass. 32GB RAM. We are thinking of switching to Lenovo
Bitwarden is our ThinkPads or the Dell Latitude series, but are open to
go-to choice
for password
We mean business any model and distro that will work well together.
management I’m looking for a Linux distro and a laptop model that is Hava Halime
and protection. stable and will not start having problems after a couple
Neil says…
To be honest, that current laptop is pretty, erm, current.
The processor was only launched early 2023, so it
should barely even be a year old at this point. Not
having tested any of those laptops, it’s hard to officially
recommend anything. We ran an article in LXF313 on
Framework gearing up to provide business-class
laptops – as they’re repairable, that’s an interesting
option, and they support Ubuntu and Fedora. No one
got fired for buying Dell, is a saying, I believe, so have a
look at the Dell models that officially support Ubuntu;
the XPS 13 is the one to go for. Else Canonical runs a
certified programme for Ubuntu that covers Dell, HP
and Lenovo. See https://ubuntu.com/certified/laptops.

Basic sales
I found it interesting that Peachtree accounting started
out in Basic. I can also comment that I once worked for
Helpdex

14 LXF314 May 2024 www.linuxformat.com


MAILSERVER

LETTER OF THE MONTH


the company that is now GameStop. As of 1998 when I
left the company, its point-of-sales system was written COSMAC forces
in a dialect of Basic. I think QuickBasic, but when you The article by David Bolton on Easy 6502 in the LXF312 issue caught
rebooted the system (running MS-DOS, though the my attention. Back in the late 1970s, I was tasked with both learning
Basic variant wasn’t GWBasic), you could observe assembler and writing a data acquisition program for our newly
some messages indicating it was launching some developed eddy correlation environmental flux machine called the
version of Basic to run. Hydra. I had only programmed Fortran up to that point.
Bill I was provided with an RCA COSMAC Microboard Computer
with 8-inch floppy disks using the new RCA 1802 CMOS
Neil says… microprocessor and told I had not much more than six months
It’s always fun to hear people’s experience. If you spot to do it. Assembler programming teaches you not to be sloppy
Linux out in the wild, let us know! in your programming. The whole program took up 16 fan-folded
pages. I even invented a magnetic tab A4-sized tablet that allowed
One distro fits all

CREDIT: CPU collection Konstantin Lanzet, CC BY-SA 3.0, https://commons.wikimedia.org/wiki/File:KL_RCA_1802.jpg


me to stack what was being loaded-unloaded into/from the various
Honestly, I don’t get this obsession with switching data and program registers.
distros every other day! What’s the obsession with The system took sensor readings at 10Hz – we wanted to do it
having to reinstall everything and configure things at 20Hz, but the speed of the processor and what it was being
from scratch – haven’t people got anything better to asked to do meant that even at 10Hz, getting all the data in and
do with their time? processing it took up 95ms of each 100ms cycle. Because of
Sam Roberts that I had to reserve a 100ms cycle at the end of each hourly data
collection and processing period to work out all the various sums,
Neil says… means and variances. This was also our first experience with solid-
Perhaps people like variety? No one’s asking you state memory packs – a 16Kbyte CMOS paperback-sized module
to swap distros, it’s just that some people like to from GK Instruments, Milton Keynes.
experiment, and I’m assuming that many use a virtual You can find the paper here: www.sciencedirect.com/science/
machine to do so, so it’s not actually that disruptive. I article/abs/pii/0168192384900947
came across https://distrochooser.de/en recently, so Colin
you never know, it might help you find a better distro
that you could try. Neil says…
I love it when our readers let us know what they’ve been up to in the
past (and present), so many thanks for taking the time to write in.
David’s going to write a bit more on 6502 down the line; we’ve got a
C-to-6502 assembly compiler in the works.

There’s the odd RCA COSMAC


on eBay but these are pretty rare,
powered by the RCA 1802 from 1972.

We’ve tested the XPS over the years and it remains a solid bit of kit.
[email protected]

www.techradar.com/pro/linux May 2024 LXF314 15


SUBSCRIBE Save money today!

and receive two


64GB USB sticks*
included with every print subscription

Five great reasons


to subscribe:
Carry your data with you on
two handy 64GB flash drives.
Never miss an issue of
Linux Format.
Receive every issue delivered
direct to your door before it’s
in stores.
Save 20% off the regular
magazine price.
NEW! Full digital access to all
prior and future issues when you
subscribe to the print edition.

SUBSCRIBE ONLINE AT
www.magazinesdirect.com/LIN/C79L
Or call 0330 333 1113 and quote C79L

16 LXF314 May 2024 www.linuxformat.com


Save money today! SUBSCRIBE

PLUS: Exclusive access to


the Linux Format subs area! **

1,000s of DRM-free
PDF back issues and
articles! Get instant
access back to issue
66 (May 2005) with
DON’T MISS
! tutorials, interviews,
Includes 5 ye
ars
of Linux User
& features and reviews.
Dev elop
issues
er
At linuxformat.com

CHOOSE YOUR PACKAGE!


Keep your subscription rolling!
PLUS!
New digital PRINT EDITION DIGITAL EDITION
access with print
subscriptions

OUTSIDE
THE UK?
Turn to page
for more grea59
subscriber t
deals!

SAVE!
SAVE!
20 %
30
%

PLUS!
Only Only
£16.75 every 3 months
£12.99 every 6 months
3 issues of Linux Format in print 3 issues of Linux Format in digital
every 3 months, saving 20%! every 3 months, saving 30%!
With gift! Without gift!

Terms and conditions: Offer closes 30th April 2024. Offer open to new print UK subscribers only. 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. Gifts subject to availability. **Access to Linux Format subs area only available
to www.magazinesdirect.com subscribers. 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 email help@
magazinesdirect.com. 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.

www.techradar.com/pro/linux May 2024 LXF314 17


From the best distros to system security, utilities and fun applications,
we’ve rounded up everything you could ever need
REVIEWS
AMD Ryzen 5 8600G
The CPU of choice for Chris Szewczyk and his tight budgets.
f you’re considering putting together a new
SPECS
Socket: AM5
I system on a tight budget, but don’t want to
spend any of the money you do have on
Arch: Zen 4 a current-generation graphics card, AMD’s Ryzen 5
(Phoenix) 8600G may well be the solution for you. The 8600G
Process: TSMC is an affordable six-core variant of AMD’s exciting
4nm FinFET Phoenix range of laptop, handheld and now desktop
Cores: 6 APUs. It doesn’t have the grunt of its more expensive
Threads: 12 sibling, the £320 Ryzen 7 8700G, but it’s still a capable
Cache: 384KB 1080p gaming option that destroys everything else in
L1, 6MB L2, its price range.
16MB L3 This is a six-core offering that’s based on the
Speed: 4.3GHz Zen 4 architecture, but it has several key differences
(5.0GHz boost) compared to its Ryzen 7000-series counterparts. For
Unlocked: Yes instance, the 8600G uses a monolithic die and it’s built
GPU: Radeon on a more advanced 4nm process. It’s also got half the
760M cache of the six-core Ryzen 7000-series CPUs, at
GPU clock: 16MB versus 32MB.
2.8GHz It comes with a base clock of 4.3GHz, a boost
Compute: clock of 5.0GHz and a 65W TDP. That’s not dissimilar Perfect for under-TV gaming and media PCs.
8 units to the Ryzen 5 7600 – and, in fact, its base clock is a
AI: Ryzen AI, surprising 500MHz higher, though the 7600 has a to make the claim that it can play games at 1080p with
16 TOPS 100MHz higher boost clock. Like the 8700G, the medium settings – if your threshold for ‘playable’ is
Display: Up to 4, 8600G lacks PCIe 5.0 support and is configured with 30fps on more demanding titles. Enabling FSR gives
DP 2.1, HDMI a PCIe 4.0 x8 connection for a graphics card. the 8600G a big performance boost.
2.1, AMD The beauty of integrated graphics is that it’s
FreeSync, AI, aye? optional. There’s nothing stopping you from installing
8k @ 60Hz A welcome, if for now untapped, addition to the 8600G your choice of GPU at any time. However, if you are
Mem max: is AMD’s XDNA neural processing unit. As you’ve no planning to buy a discrete GPU at the same time as the
256GB doubt seen and read, AI is all the rage and local AI rest of your system, a 7600 or any one of a number of
Mem speed: processing will potentially become more relevant as Intel 12th, 13th or 14th-Gen options will deliver superior
DDR5 3,600- the software ecosystem matures. Who can say? all-round performance. The 8600G cannot keep up
5,200, two- The integrated Radeon 760M is based on the with the more powerful 7600X. This is a result of the
channel, no ECC RDNA 3 architecture. That puts it a full three combination of the 8700G’s lower TDP, lower long-run
PCIe: v4 generations ahead of the Vega graphics of the clock speeds and halved L3 cache.
20 lanes previous 5000G-series chips. On top of that, the The 8600G is a chip you should buy if you plan to
TDP 65W 760M is clocked 800MHz higher than even the top- make use of its integrated graphics. If not, there are
(45W-88W of-the-range eight-CU AMD Ryzen 7 5700G. On paper, better options available. However, if you care nothing
options) the 8600G is faster. Much faster. for high core counts and transcoding videos every
Given that AMD stopped bundling coolers with its other day, the 8600G makes for an excellent general-
7000-series chips, the inclusion of AMD’s Wraith purpose processor.
Stealth CPU cooler is a nice little value add. It is on
the small side, but the 8600G is not a particularly
demanding chip.
VERDICT
Zen 4 chips are known to run hot. The 8600G never DEVELOPER: AMD
reached 80°C, which is a good result. We did use a WEB: www.amd.com
240mm cooler, which is a bit above the norm for this PRICE: £218
class of chip. The bundled Wraith Stealth would see
temperatures higher than that. FEATURES 9/10 EASE OF USE 9/10
Similarly, the power consumption results are a PERFORMANCE 8/10 VALUE 8/10
bright spot, coming in well under those of the 7600X. If
you factor in the 8600G’s efficiency, it’s a solid option The best value desktop choice with integrated graphics, and
for a small form factor or media PC. with untapped AI co-processor power, too.
The 8600G’s bright spot is its 1080p gaming
performance. Even though it only has two thirds of the Rating 8/10
8700G’s shader count, its performance is good enough

www.techradar.com/pro/linux May 2024 LXF314 19


REVIEWS Linux distribution

Deepin 23
Nate Drake is in too deep with Deepin – is this Chinese-made
distribution a crouching tiger or a hidden dragon?
eepin development began
IN BRIEF
Potential
D way back in 2004 as
Hiweed Linux. Until 2015,
privacy issues it was based on Ubuntu, but since
aside, this is one then, successive versions of the
of the most OS have been based on the latest
visually rich stable version of Debian (in this
versions of case, Debian 12 Bookworm).
Linux you’ll ever The distro is known for its DDE
use, with a host (Deepin Desktop Environment),
of excellent built on the Qt 6 toolkit (updated
home-grown to version 6.6.1 for this release).
programs, such DDE is available in the repos of
as the Linglong distros like Fedora as an alternative
package desktop, which is why you may
manager. have heard of this OS despite its
main user base being in China. DDE (Deepin Desktop Environment) may be resource-heavy, but it has style. It can also
Deepin is wholly owned by be installed in other distros, such as Fedora.
SPECS Deepin Technology, a subsidiary of
CPU: 2GHz Union Tech. The developers follow an irregular release password before configuring your machine, then
Mem: 8GB cycle but aim for four releases per year. prompts you to log in to DDE.
HDD: 64GB Besides a graphically rich home-grown desktop The system also displays a helpful introductory
Builds: x86-64, environment, Deepin boasts its own window manager video (in Chinese) showcasing all the latest features.
i386, RISCV64, (dde-kwin), which for this latest development release English speakers can supplement their knowledge with
ARM64, contains a number of fixes for small bugs, such as one the rather spartan Deepin Manual (available online or
LoongArch64 that previously caused window formatting not to follow via the Deepin launcher). The project also has an
those laid out in system settings. English wiki (https://wiki.deepin.org/en/home).
Deepin 23 also includes the latest version of the Once the desktop loaded, we opened the launcher
OS’s own package manager, Linglong, which includes and were delighted to see that Deepin 23 has switched
an update to allow launching it immediately upon login. from the proprietary WPS Office to LibreOffice (7.4.2).
The system repository itself has also received over We came across claims that Deepin comes with closed
4,000 software package updates (including new source software but this was absent when we checked.
packages). The OS now supports i386, riscv64 and When we fired up Deepin’s App Store, however, we
LoongArch64 architectures. did find some proprietary options, including Google
Deepin’s own File Manager has also been Chrome and Steam. In 2018, this same App Store drew
overhauled, with bug fixes that allow creating folders controversy over the inclusion of statistics software
with spaces at the end of filenames, as well as the that could potentially identify users, but this feature
ability to copy folders directly from the Recycle Bin. has been removed. Daniel Smith, head of threat
Users can also create desktop shortcuts for Google research at Radware, has raised concerns over
Chrome with the relevant website icons. Deepin’s updated statistical analysis service Umeng.
Aside from a slew of its own packages and tools,
according to other online reviews, Deepin comes
preinstalled with proprietary software such as Spotify
VERDICT
and Steam, which may explain the hefty 4.2GB ISO. DEVELOPER: Deepin Technology
Deepin 23 also comes with UoS AI plugins, enabling WEB: www.deepin.org
you to use UoS AI via a free trial account. LICENCE: Mainly GPL
If you do take the time to download the ISO,
Deepin’s own installer is extremely intuitive. The latest FEATURES 9/10 EASE OF USE 8/10
installer also now supports screen interface adaptation PERFORMANCE 7/10 DOCUMENTATION 6/10
for 768p, 1080p, 2K and 4K resolutions. As snazzy and
simple to use as it is, though, sadly there’s no option to A visual masterpiece and incredibly easy to set up. Let down
test Deepin in a live environment. by heavy system requirements and lingering privacy issues.
Post-install, however, we discovered why Deepin’s
interface has received such rave reviews online. The Rating 8/10
system first prompts you to create a user account and

20 LXF314 May 2024 www.linuxformat.com


Linux distribution REVIEWS

KaOS 2024.01
Nate Drake seeks to find some order in KaOS – a distro incorporating
the KDE Plasma 6 desktop environment.
aOS is an independently
IN BRIEF
KaOS is light
K developed distro, though
its design is inspired by
on system Arch Linux. Originally released
resources but as KdeOS in 2013, it has since
offers the best changed its name and follows a
of Plasma. rolling release model.
Bundled apps The OS is designed solely for
are well the x86_64-bit architecture and
selected exclusively uses Qt (currently
(except for an version 6.6.1) as well as the
email client). latest version of KDE.
The OS offers KaOS 2024.01 is the first stable
simple setup release to incorporate the Plasma 6
when it works. desktop environment. It now also
comes with an overhauled version
of the OS’s own Midna theme. The OS’s own Croeso package manager enables you to adjust common settings such as the
SPECS In the runup to release, KaOS desktop background and configure package management.
CPU: 2GHz developers have been shipping all
Mem: 1GB (2GB ported applications from their Frameworks 6 branch advanced text editor, though on first boot we noticed a
suggested) into snapshot ISOs. Most bundled apps are now glitch where the icon was listed twice in the task bar.
HDD: 8GB available as a Frameworks 6/Plasma 6 port. For those Media lovers are also spoilt for choice in KaOS,
(25GB apps that are not ready, Frameworks 5 is still packaged, which bundles not only the Elisa music player but MPV,
suggested) so they can be used in a Plasma 6 environment. Harua and (naturally) VLC.
Builds: x86_64 The display manager can run in Wayland mode, so Under the hood, the OS has been upgraded to
KaOS is closer to being ready to move away from X11. FFMPEG 6. The kernel has also been updated to Linux
If you fire up the 2.7GB ISO, you’ll also note that 6.6.14. KaOS now incorporates Systemd 254.9, as well
setup is handled by the user-friendly Calamares as Python 3.10.13, Util-Linux 2.39.3, IWD 2.13, MariaDB
installer, which now supports automatic partitioning 11 and Postgresql 16.
of popular filesystems like XFS, ext4, Btrfs and ZFS. KaOS also includes the OS’s own ISOwrite, which, as
When we took KaOS for a test spin in a virtual the name suggests, can be used to write an ISO file to
machine, we were also pleased to see the OS can be USB. Unlike previous versions, the tool also offers the
booted in live mode. ability to recover USB sticks used for this purpose.
On first launch, we also had a chance to view the If you want to install extra packages, you can use
built-in Guide, which is well laid out, although some Octopi, a powerful Pacman front-end that KaOS has
of the grammar and spelling is dubious. The online included instead of Plasma’s Discover.
documentation also contains a quaint warning against This is just as well, as despite the presence of
using a dial-up connection to download ISOs. During chat clients like NeoChat and Konversation, there’s no
our tests in a virtual machine, the Calamares installer preinstalled email client. Luckily, you can use Octopi to
crashed when we tried to proceed with install. install popular programs like KMail or Thunderbird.
Staying in live mode, we quickly moved to the
Application Launcher. It’s here we discovered that
given that it’s available as a pure Qt6/kf6 application,
VERDICT
LibreOffice has now replaced Calligra as KaOS’s DEVELOPER: KaOS
default office suite. WEB: https://kaosx.us
If you do succeed with setup, KaOS’s very own LICENCE: Mainly GPL
Croeso (Welsh for ‘welcome’) launches post-install.
Written in QML, this handy tool lets you adjust some FEATURES 8/10 EASE OF USE 7/10
15 commonly used settings, including viewing your PERFORMANCE 8/10 DOCUMENTATION 5/10
distribution info, and select packages from no fewer
than six different groups. From here, you can also Excellent implementation of a pure Plasma 6 environment.
customise your desktop wallpaper – KaOS comes with Setup is simple but documentation needs an overhaul.
no fewer than 31 alternate backgrounds.
Browsing is handled by KDE’s Falkon (v24.01.95). Rating 7/10
From the main desktop, you can also launch the Kate

www.techradar.com/pro/linux May 2024 LXF314 21


REVIEWS Linux distribution

Bluestar Linux 6.7.6


Nate Drake finds blue is the colour, after firing up this intuitive and
visually stunning Arch-based distro.
luestar Linux’s main goal
IN BRIEF
Bluestar offers
B seems to be to provide a
user-friendly version of
a beautiful UI, Arch Linux, on which it’s based.
easy setup and Its SourceForge page puts this in
a whole range more colourful terms, stating it’s
of preinstalled “built with an understanding that
apps. It’s only people want … a solid operating
let down by a system that provides a breadth
lack of official of functionality and ease of use
website and without sacrificing aesthetics”.
documentation. We mention SourceForge as,
Use at your own besides a rather active Facebook
discretion. page, Bluestar stands alone in all
the distros we’ve reviewed so far
in not having a dedicated website.
SPECS This is even more surprising given For now, Bluestar comes with the Latte dock, although upgrade instructions for switching to
CPU: 1GHz that successive stable versions Cairo are available via the project’s Facebook page.
Mem: 1GB have been released since 2016.
HDD: 20GB Still, if you do decide to download the weighty 5GB switched from the rather subdued default to the bright
Builds: x86_64 ISO from SourceForge, you can take the OS for a test Altai wallpaper upon discovering this.
spin in live mode. A lack of documentation makes it Having mastered the application launcher, we
hard to gauge system requirements, though the ones visited the Internet section to discover both the Firefox
listed (left) were adequate to run Bluestar in VirtualBox. and Konqueror browsers come preinstalled. Bluestar
On first boot, users will notice that the desktop also bundles the Thunderbird email client, as well as
environment is KDE Plasma (v5.27.10). Filezilla, Pidgin and the KTorrent client.
We used the Application Launcher to launch the The OS also comes with LibreOffice (v24.2.0), as
Info Center, where we discovered the OS also uses Qt well as the Calibre ebook manager. There’s a number of
(v5.15.12), KDE Frameworks (v5.115.0) and version multimedia apps, including the Amarok music player
6.7.6-arch1 of the Linux kernel. and VLC, though we felt that the inclusion of Gnome
As stunning as the desktop is, Bluestar doesn’t offer CD Master was a little redundant.
a particularly intuitive way to view installed apps. You The OS’s hefty install footprint is further explained
have to move your mouse to a glowing blue bar at the by the presence of both GIMP and Okular for image/
top of the desktop to view the top panel. However, we document viewing and editing.
did manage to find a shortcut to the Application The top panel also contains an icon of Blinky (the
Launcher via hitting the Super key. red ghost from Pac-Man), which you can use to launch
The OS ships with the colourful Latte dock, though the update tool. If you want to install more packages, in
as main developer Jeff notes on the Bluestar Facebook theory you can do this via Octopi (a graphical front-end
page, development on this has been patchy. Luckily, he for Pacman), but in our tests it crashed each time we
offers full instructions on how to switch to the more tried to open it in the live environment.
mainstream Cairo dock using the Konsole terminal.
If you do proceed with setup, this is handled by
Calamares, which unlike plain Arch, offers a much more
VERDICT
intuitive way to automatically partition the hard drive, DEVELOPER: Jeff Hodd
encrypt the system partition and customise the look. WEB: https://sourceforge.net/projects/
Once Calamares launches, you are offered a choice bluestarlinux/ LICENCE: Mainly GPL
of Basic, Desktop, DeskPro and Developer installations.
SourceForge mentions these are “each tailored to the FEATURES 9/10 EASE OF USE 8/10
needs of Linux users” but doesn’t provide clarification. PERFORMANCE 8/10 DOCUMENTATION 3/10
From reading other reviews, it seems these installs are
centred around how advanced users are. For instance, Bluestar is, indeed, easy to use and aesthetically pleasing, but
the DeskPro version includes a live dashboard of a Facebook page will never replace a dedicated wiki.
system usage on the desktop care of Konky.
Speaking of the desktop, Bluestar offers no fewer Rating 7/10
than 40 alternative backgrounds. We immediately

22 LXF314 May 2024 www.linuxformat.com


Linux distribution REVIEWS

Drauger OS 7.6
Nate Drake puts this distribution through its paces – is Drauger a
gaming dragon or just a plain drag?
n Norse mythology,
IN BRIEF
We love the
I draugrs are undead
warriors with a penchant
idea of a for the blood of the living. Skyrim
gaming-specific players will also know they’re a
version of Linux, common foe you encounter when
but Drauger dungeon-crawling, so developer
fails to deliver. Thomas Castleman, a keen player,
Given the named this OS accordingly.
setup/kernel One typo later, Drauger OS was
issues, you’re made available in 2018. It’s based
far better off on Ubuntu LTS (in this case Ubuntu
installing 22.04 Jammy Jellyfish) and is
Ubuntu, then supposedly optimised for gaming.
adding gaming- The main website’s About page
specific is also very clear on what Drauger is
packages not: if you’re thinking of installing The left-hand panel contains launchers for a number of apps, including Steam, Firefox and
yourself. Drauger as your daily driver, you’ll Synaptic. In live mode, this obscures the desktop icons.
be disappointed. There’s no
preinstalled email client, office suite, BitTorrent client is keen to stress that the OS ships only with open
SPECS or any apps you’d need when normally using Ubuntu. source software, although the presence of the Steam
CPU: 1.8GHz Previous versions of Drauger used the xanmod client for Linux seems to contradict this.
(2GHz kernel, which is ideal for gaming, but this iteration Other gaming specific programs include GameHub,
suggested) apparently uses a version that is compiled in-house. Heroic Games Launcher and Lutris. We fired up Lutris
Mem: 1GB (6GB It would be more correct here to say “versions” as and used the search feature to download and install
suggested) Drauger uses kernel 6.2.9 in the live environment but the 1993 shareware version of Doom, which ran, albeit
HDD: 32GB switches to version 6.6.11 once installed. somewhat jerkily.
(128GB Post-install, this triggered a kernel panic in our test Drauger doesn’t seem to assign a dedicated swap
suggested) virtual machine, which we resolved by rebooting and space to the drive during automatic partitioning. After
Builds: x86_64 choosing 6.2.9 from Drauger’s Advanced Boot Options. checking the root drive immediately after installation,
On first login, you’ll notice Ubuntu’s default Gnome we found that instead it creates a .swapfile, which was
desktop environment has been swapped out for Xfce, already almost 12GB. This may account for Drauger’s
along with a dark Nocturn GTK3 theme. We were large install footprint (17GB) – over twice that of our
impressed by the Drauger welcome guide, which walks Ubuntu LTS VM.
you through various sections of the desktop. Drauger does come with Gnome Software and
This includes a whistle-stop tour of the panels at the even ostensible support for Flatpaks, but when we
top, left and bottom of the screen. The left bar contains tried to install two apps via Flathub (VLC and Polari),
launchers for some of the preinstalled apps, including we encountered an unmet dependencies error.
Steam and the Synaptic package manager. Web Installation via the command line and Synaptic via
browsing is handled by the Flatpak version of Firefox Ubuntu repositories worked like a charm, however.
(v110.0.1), which can be launched from here.
In the live environment, we felt this placement was a
design flaw, as it eclipsed desktop icons like Home and
VERDICT
Trash, but these had vanished post-install. DEVELOPER: Drauger OS Development/
The bottom panel allows switching between virtual Thomas Castleman WEB: https://draugeros.org
desktops, though we found it hard to distinguish from LICENCE: Mainly GPL
the default wallpaper. Luckily there are six alternatives.
If you are willing to risk kernel panic and proceed FEATURES 5/10 EASE OF USE 6/10
with setup, Drauger ships with its own System-installer. PERFORMANCE 6/10 DOCUMENTATION 7/10
The interface for this is dated, where you have to click
individual buttons to launch windows and configure With its custom kernel and installer, Drauger feels much like
settings like language and keyboard. A more intuitive a work in progress rather than a fully fledged OS.
installer like Calamares would be a much better choice.
Once the OS loaded, we decided to explore the Rating 6/10
gaming-specific features of Drauger. The main website

www.techradar.com/pro/linux May 2024 LXF314 23


ROUNDUP TimeTONS
WE COMPARE trackers
OF STUFF SO YOU DON’T HAVE TO!

Michael Reed
says he’s spent
74.5 hours writing
TimeCamp Timewarrior Hamster about Linux so far

Arbtt TimeSlotTracker this year. He’s full


of fascinating
facts like that.

Time trackers
This month, Michael Reed is keeping a strict eye on himself and trying to
improve his work efficiency by investigating time-tracking applications.

HOW WE TESTED…

We installed each of the time-


tracking applications on a
desktop PC running an up-to-
date Linux Mint installation
with Xfce as the desktop.
Where double-checking things
such as installation issues was
needed, we also installed on an
Ubuntu 23.10 machine.
We used the time trackers
while carrying out our work to
see how easy to use they were
on a day-to-day basis and to
see how useful the activity
logging was. This included
applying automatic tracking
features where available.
We tried to get into the
more advanced features
where extensions and plugins
were supported on a particular
piece of software. his month, we’re examining five of monitors the user’s activities for hyper-
Once we had some recorded
data that we could play with,
T the best time-tracking applications
available on Linux. These are tools
accurate recording of task activity. Like
Timewarrior, it provides good opportunities
we explored the report- that are useful to freelancers, office workers for the stats obsessive who wants to use
generation possibilities. (with a paranoid boss) or simply people who Python code to analyse activity data.
CREDIT: Getty Images/iStockphoto

Pretty charts, where available, like stats and want to know how they actually Hamster is a conventional desktop
were appreciated. spend their time. application with a user interface that fits in
Finally, once we had the Timewarrior may appeal to the text-mode well with the stylings of the Gnome desktop.
Linux-based software up traditionalist as it’s a purely command-line- TimeSlotTracker is a multiplatform Java
and running, we investigated driven application. However, it can output desktop app, and it’s quite feature rich.
the possibilities for moving some natty looking text-mode charts and it’s The other applications are open source
between machines and a good choice for custom analysis of its data. and completely free, but we also added
environments while continuing Arbtt is another ‘Linuxy’ piece of software TimeCamp, a freemium service, into the mix.
to track our time. as it’s operated from the command line. The We wanted to see how useful a free account
main part of the software automatically was compared to some of the other options.

24 LXF314 May 2024 www.linuxformat.com


Time trackers ROUNDUP

Linux native
application
Other options are nice, but we
expect a well-integrated Linux app.
he TimeCamp app places itself in the status panel area

T of the desktop. It offers a hybrid between a native app


and a web-based one. For example, several functions As a Linux native GUI application, Hamster has some advantages when it comes to
open a page in your browser. However, it does provide some speed and ease of editing time entries. It takes a couple of clicks to amend an entry.
advantages of a native app as the usage reports contain detailed
records of your actual desktop use, showing which apps and run when the desktop starts up. Configuration is carried out by
browser windows you were using at different times, something editing a text file, saving it and restarting arbtt-capture.
that wouldn’t be possible from a purely web-based tracker. Hamster is a fairly simple Python GUI application that fits in
It is possible to start and stop app tracking while offline, but well on a Gnome desktop, but it’s usable on any Linux desktop.
the online documentation makes it clear that it is your job to As it’s a Java app, TimeSlotTracker has many of the
select the synchronisation function in the app once back online characteristics of a native desktop app, such as pull-down and
and that some of the analytics data is not acquired in this mode. pop-up menus, and it features a status panel icon. Looks-wise, it
Timewarrior is operated from the command line and offers doesn’t fully fit in on a Linux desktop, but it is launchable from
text-mode output. It consists of a daemon that runs in the the standard application launcher menus if installed as a DEB file.
background along with a collection of executables. Much use
is made of command-line options to display captured data. VERDICT
We’re not going to mark it down due to it being a text-mode
tool, as many Linux users prefer this, and there even are a few TIMECAMP 6/10 ARBTT 7/10
advantages to a system that can be fully automated from scripts. TIMEWARRIOR 8/10 TIMESLOTTRACKER 7/10
Arbtt is a command-line text-mode app. In fact, it’s made up HAMSTER 8/10
of a selection of command-line tools. The online documentation The TimeCamp Linux app is fairly simple. TimeSlot is the most fully featured,
advises to set things up so the tracking daemon, arbtt-capture, is but it’s a Java application.

Installation
complications
The first hurdle is always obtaining
and installing the software.
he Linux Mint system package for Timewarrior was out

T of date, so we installed the latest version from Snap.


The Hamster package in the distribution repository The Arbtt build instructions work perfectly well, but building from the Git repository
was the latest stable release (which is quite old), but we could means that it’s up to you to keep checking for updates and rebuilding.
also have installed via Flatpak, Snap or built from source code.
There are installation instructions for Debian-based distros such problems affected the DEB package and the AppImage version.
as Ubuntu along with Fedora and OpenSUSE. Overall, it had the feel of a package that hadn’t been maintained
The system package for Arbtt was out of date. It wasn’t properly, but we did, eventually, get it to install and work.
available on Flathub or Snap, so we had to build it from the On its SourceForge page, Timewarrior is available as a
source archive. The build process involved using Cabal, a package multiplatform JAR file and as a DEB file. It was not present in
manager for the Haskell programming language. We’d rate it at the repositories of Ubuntu or Linux Mint.
the lower end of medium difficulty as build jobs go. Once the
program is actually installed, a default configuration file has to be VERDICT
created by copying it from the documentation, and the program
is invoked from the command line. TIMECAMP 6/10 ARBTT 5/10
We had a few problems installing the native Linux TimeCamp TIMEWARRIOR 7/10 TIMESLOTTRACKER 7/10
app on both Linux Mint and Ubuntu after having downloaded HAMSTER 8/10
the official packages from the website. At one point, we had to None of the systems excel in terms of variety of available packages, but
manually install a dependency it needed. These dependency Hamster is most widely available.

www.techradar.com/pro/linux May 2024 LXF314 25


ROUNDUP Time trackers

User interface design and use


The ease of TimeCamp 6/10 Timewarrior 6/10
daily use. Most of the TimeCamp user interface Timewarrior is a pure command-line app.
resides in the status panel app, meaning Some Linux users will like the exactness
f the application is fiddly that there isn’t anything in the way of a of typing in commands to activate or stop

I and difficult to use, you


are less likely to be
real-time task clock. Some of the options
open a browser page, leading to a slightly
the tracking. However, we found it a grind
as we were used to the GUIs of the other
meticulous when it comes to disjointed experience. However, the options. As command-line apps go, we’re
logging actions. In the same way, workflow for creating a new task or fans of those that allow tab completion
having to put in extra work every resuming a task is problem-free and can when building up the entire command, but
time you recommence your be carried out from within the native Timewarrior doesn’t offer that feature.
activity can make getting back Linux application. We place a higher As it’s command-based, there’s a
to work even more of a chore priority on the smoothness of that area learning curve as you discover the options
than it usually is. of the interface than any of the others. to do things such as start an activity or
We’re particularly interested Actions such as amending an entry have amend a previously logged activity. The
in the daily use cycle of these to be done via the website. command-based approach means you
applications. That is, how easy Sticking with the native interface, some can carry out an amendment, such as
is it to start or stop logging, the areas used a font that was too small, but it adding or removing time, to multiple
principle function of a time- was usable. Overall, we were glad to see a activities with a single command.
tracking application? Beyond Linux native application, and it does offer It’s a complex system that takes a bit
that, we expect other day-to-day some important functionality in the way longer to learn than some of the other
features to be accessible and quick of tracking. However, for actual use, we applications, but once you’ve picked up
to display. We appreciate a real- consider the web interface to be superior, the basic command options, day-to day
time update of how long we’ve particularly as you’re going to have to visit use is acceptable and even offers a-few
been working on the current job. it from time to time anyway. advantages as it’s scriptable.
Editing an entry is another
commonly used function and we
want that to be made as simple as
possible. Other functions, such as
creating a report or summary, are
used less often but, saying that, we
don’t want to have to jump through
hoops to get it done.

Extra features
Beyond the basic options, what else can the software do?
imeSlotTracker can add custom attributes to a task or Arbtt’s documentation links to a couple of contributed tools

T a time slot in the form of key/value pairs, so you can


attach almost any type of info to a task or activity.
that offer extra report formats. It can output as CSV for further
processing and has support for R, a statistical analysis language.
Timewarrior has integration features with Taskwarrior, a We were sometimes a bit annoyed that the TimeCamp web
command-line text-mode task and to-do list manager. The interface presented us with a page telling us about the upgrade
configuration involves some work at the command line to copy options to the paid version. In actual fact, the free-for-life plan
files. Once up and running, when a task is started in Taskwarrior, has a lot of features that aren’t immediately apparent, and you
Timewarrior begins tracking the time spent on that task. can ignore the landing page and simply select features from the
It also has an extension system that uses Python plugins. sidebar. In particular, we almost didn’t see some of the report
Searching online, we found a number of intriguing extensions. and charting features that are available.
So, although Timewarrior doesn’t have billing facilities as
standard, they can be added via an extension. Many of the VERDICT
extensions also improve the report generation facilities. The
website lists 95 extensions, which are mostly well maintained. TIMECAMP 7/10 ARBTT 4/10
However, they involve manual installation and configuration. TIMEWARRIOR 8/10 TIMESLOTTRACKER 4/10
As applications go, Hamster keeps things plain and simple. It HAMSTER 4/10
does benefit from a KDE plasmoid, however, which provides an Timewarrior’s extensions offer a lot of opportunities to add extra features.
extensive front-end that fits into the KDE desktop. It’s worth exploring the TimeCamp web interface to see what it can do.

26 LXF314 May 2024 www.linuxformat.com


Time trackers ROUNDUP

Hamster 7/10 Arbtt 6/10 TimeSlotTracker 8/10


In keeping with the modern Gnome style, Arbtt, like Timewarrior, is a command-line Despite being a Java Swing GUI app,
Hamster locates some of its controls in application. Because it is an automatic TimeSlotTracker looks reasonably
the title bar area of the window. There tracker, there is less interaction with this integrated on a Linux desktop when a
is a large area showing the currently interface while working than with other theme such as GTK+ is selected. It’s a
summarised period and icons for starting programs. The application is actually a drag-and-drop interface when it comes
or stopping a task, and calling up the menu collection of smaller programs that begin to reordering items, and most of the UI
and icons for the main functions can be with the Arbtt- prefix. works like a typical desktop application.
carried out quickly and efficiently. To get the best out of the program, you There is a status area icon, and it offers a
When a new activity is started, a pop-up have to work on the configuration. As with few simple features.
dialog appears, and the drop-down menu most command-line programs, this is Turning to the main interface, it’s a
means it’s reasonably hassle-free to carried out by editing a text file. In this multi-pane GUI. The left-hand sidebar
continue a previously established task. case, it has quite a complicated Haskell- contains a hierarchical list of tasks that
The main area of the window is taken inspired layout and syntax. you must add to before you can begin
up with a summary of the given period, There’s a paradox with Arbtt in that it tracking. The icon bar along the top has
providing a good sense of context. A eventually requires almost no interaction video-style controls for controlling the
double-click on previous tasks brings in day-to-day activity recording, but you task monitoring, along with a real-time
up the editor dialog for amendments, have to work with the documentation and search bar. There is another panel to show
which are easy to make. A large bar on the wrestle with the main configuration text detailed information on the selected task.
bottom of the window splits the screen to file to get it to that state. Most of the This is a featureful interface that has
show some statistics. The only criticism other programs are more open to an the benefits of a desktop app in terms of
of the interface we’d make is that some of approach where you can explore the user responsiveness. It’s the fastest and most
the elements are a bit non-standard and interface and try things out to see how convenient of all of the systems for tasks
require experimentation to figure out. the program works. such as amending or copying time slots.

Automatic tracking
Insights from hands-free analysis of your activity can often be fascinating.
imeSlotTracker has activity monitoring and this official documentation offers examples that can assign the

T includes an optional facility to take screenshots and


place them in a user-defined directory. However, this
‘social media’ tag to the log when certain sites are being visited.
However, like much of Arbtt, this type of detailed tracking
isn’t the type of intricate user monitoring that some of the requires quite a lot of work to set up in the configuration file.
other options offer. Idle detection (what do you mean?–Ed), Hamster lacks automatic time-tracking facilities.
another useful feature, is a separate option. Timewarrior has a kind of automatic tracking. It enables
Thanks to TimeCamp’s native Linux app, it can track user you to define periods when you know that you will be engaged
activity such as application and website usage, such as how with tasks and exclusion periods. It takes quite a lot of setting
much time you’ve spent on a specific email in GMail or a up, however, and it’s limited in what it can do compared to
specific document in Google Docs. Some of this activity data is TimeCamp and Arbtt.
accessible in the various report and summary modes. However,
some of the more advanced summary data specific to this type VERDICT
of data is only available on the TimeCamp paid tier.
Arbtt is specifically designed to capture user activity data TIMECAMP 8/10 ARBTT 7/10
in an automatic fashion. There is quite a lot of refinement TIMEWARRIOR 5/10 TIMESLOTTRACKER 6/10
available though configuration via a text file. It’s possible to set HAMSTER N/A
it up so that it looks for certain strings in the application title Arbtt can do a lot in this area, but it takes work to set it up. TimeCamp is
and assigns certain tags to certain activities. For instance, the useful from right the start.

www.techradar.com/pro/linux May 2024 LXF314 27


ROUNDUP Time trackers

Cloud options and


TimeCamp can
be operated
from the

alternative platforms
mobile phone
app, and
it’s a fairly
extensive piece

Working away from the main computer.


of software.
As well as the
starting and
stopping of
tasks, it also has
s it’s a purely command-line-based tool, Timewarrior

A
some charting
can be used over SSH, which means that it can be and summary
accessed over a network. This could also be extended modes.
to a mobile device running an SSH client. However, the host
machine would have to be set up and available over the network
and left running, and you’re restricted to a command-line
interface when starting and ending task recording, which could
be awkward, particularly on mobile. It is only available to run on
Unix-type operating systems such as Linux.
If anything, TimeCamp is a stronger application when
accessed from the website. Every function can be accessed on are no cloud data-sharing features. What could work is exporting
the web and many functions can only be accessed in that way. data from the program on one computer, then importing the data
This means that it can be accessed from multiple machines and back into the program on another.
even from a mobile device. Speaking of which, there are also Hamster is a simple GUI-based time tracker that is designed
dedicated mobile phone apps for Android and iOS. This is along to be used on a single machine.
with applications for Linux, Windows and Mac OS.
As Arbtt gathers information about usage from the computer VERDICT
on which it is run, it can’t be used remotely. In addition to various
Linux versions, there is a Windows version. TIMECAMP 9/10 ARBTT 4/10
TimeSlotTracker is a multi-platform application, and this TIMEWARRIOR 6/10 TIMESLOTTRACKER 5/10
means it can run on Windows and Mac OS machines as well as HAMSTER N/A
Linux. Unfortunately, there isn’t a mobile app version, and there TimeCamp lives happily in the cloud or on various native platforms.

Reports and
summaries
For some, this is one of the most
important parts of the system.
imeWarrior has a couple of report modes. The summary

T command option outputs a summary of total time taken


on different tasks. There are quite a few options that can Timewarrior is limited to text mode, but it can produce coloured charts. You
be applied to this, such as limiting the summary to a period or can specify a period as day, week or year, controlled via command-line options.
filtering by tag. It also has a graphical text-mode charting option.
There is also an extension system that uses Python plugins for example, by default, the output shows how much time you have
the ultimate in custom data processing. used a program such as Chrome, but you have to configure Arbtt
Even on the free tier, TimeCamp has a full set of report to assign a custom tag to windows that have Google Docs to see
features. Many are based on business needs, and can help you how much time you spent with that individual website.
with billing by assigning hourly rates for different jobs. There are TimeSlotTracker has a well-organised selection of report
some helpful charting facilities that help to give an overall view. types, and it has the advantage that it can output to a number of
Hamster’s report generator is accessed via Export on the main formats such as CSV in addition to fully formatted HTML.
menu. The report encompasses the period specified in the main
interface. It is a self-contained HTML file that looks good in itself. VERDICT
It can be customised and a custom template file can be created
from the default one, but it’s more work than being able to tweak TIMECAMP 8/10 ARBTT 6/10
the report parameters and layout from the GUI. TIMEWARRIOR 7/10 TIMESLOTTRACKER 7/10
Arbtt-stats produces the summary for Arbtt. As Arbtt is an HAMSTER 6/10
automatic system, how detailed this information is depends TimeCamp has a lot of reporting facilities even on the free tier. The others
largely on the amount of work you put into configuring Arbtt. For have at least some facilities, too.

28 LXF314 May 2024 www.linuxformat.com


Time trackers ROUNDUP

The verdict
Time trackers
e’re choosing TimeCamp, a freemium solution that

W isn’t open source, as the overall winner. The facilities


on the free tier are decent, and the free package
could be everything that a single user would ever need. It can
be used from any platform as it is accessible from the web.
In addition, there is a mobile phone app. The native Linux
application isn’t exactly brimming with features, but it’s
usable, and it can automatically record your actions for
precise, effortless activity recording. All of these options
are tied together in the cloud, meaning that you can move
seamlessly from one platform to another.
TimeSlotTracker is a good program overall, but we have
a few misgivings about recommending it. It hasn’t been
updated in quite a while (not since 2021). It has its users, but 1st TimeCamp 9/10
the official forum has a fairly low level of traffic. The user
interface has a comprehensive multi-pane design with all of Web: www.timecamp.com
the facilities you’d expect from a desktop application, such Licence: Proprietary Version: 1.7.2.0
as drag and drop and pop-up menus. It’s a comprehensive Generous features in the cloud or the desktop on the free tier.
desktop Linux time-tracking application.
As it doesn’t have a GUI, Timewarrior doesn’t have the 2nd TimeSlotTracker 8/10
broad appeal of some of the other offerings, but some
people will prefer starting and stopping tasks from the Web: https://sourceforge.net/projects/timeslottracker
command line. There are many system administration Licence: GPL v2 Version: 1.3.21
scenarios where this could be useful. It is, of course, fully Featureful multi-platform time tracker with a good GUI.
scriptable. If you’re prepared to work in a terminal, it can
carry out most of the tasks that the other options can, 3rd Timewarrior 7/10
including report and chart generation. There’s some
opportunity for expansion of what it can do, if you’re willing Web: https://timewarrior.net
to get your hands dirty with configuration and extensions. Licence: MIT licence Version: 1.7.1
Arbtt scratches a different time-tracking itch compared Command-line-based tracker. Extendable with more advanced features.
to others because it’s a command-line utility that is solely
for automatic time tracking. It has quite a lot of scope for 4th Arbtt 6/10
customisation in terms of precisely what is being recorded,
opening some niche activity monitoring scenarios. However, Web: https://arbtt.nomeata.de
some of the other options can also do automatic activity Licence: GPL v2 Version: Git (0.12.0.3)
recording, and Arbtt would struggle to be used as a general- Can automate the gathering of user activity data, but needs configuring.
purpose time tracker like the others.
Hamster is a simple native Linux utility that carries out 5th Hamster 6/10
basic time-tracking tasks, and it can produce reports. The
interface seems positively stripped-down compared to Web: https://github.com/projecthamster/hamster
TimeSlotTracker. Take a look at it – it might be able to do Licence: GPL 3.0 Version: 3.0.2-3
everything you need if your requirements are simple. Simple GUI time tracker with report output that gets the job done.

ALSO CONSIDER
Toggl (https://toggl.com) is a handy web-based time tracking KTimeTracker (https://apps.kde.org/en-gb/ktimetracker)
tool with an extensive free tier. Its Linux standalone client has is a Linux native time-tracking application, but it had its last
been deprecated recently, but the service is still usable via the major release in 2019, meaning that it’s probably not worth
website and mobile app. getting too invested in learning to use it.
Watson (https://tailordev.github.io/Watson) is a GTimeLog (https://gtimelog.org) is a GUI program with a
command-line-based tracking app. We would have looked at command-line feel to it. It’s a fairly simple application and it
it here, but we already had two command-line apps on our list. can log time spent on tasks.

www.techradar.com/pro/linux May 2024 LXF314 29


Linux invades Windows

Join Nate Drake as he explores Linux’s infiltration of Windows. Have


the barriers between operating systems truly been broken?

n late January 2024, Microsoft and programmatically, in recent years

I released an Insider Preview of


Windows Server 2025 that
seemingly supports the sudo
Microsoft has embraced the latter OS to
some extent. This includes offering Linux
OSes (including its own Sphere) to Azure
command. Naturally, experimental customers. Windows 10 and 11 users can
features are just that – currently, the even use WSL (Windows Subsystem
Windows sudo can’t even be invoked for Linux) to run Linux kernels and
from the command line. Still, if and apps within the Windows ecosystem.
when it can be, it will simply be the latest We’re going to delve into the
chapter in the ongoing story of Linux extent to which Microsoft has
integration into Windows. introduced Linux features into Windows,
It seems Microsoft’s signature which includes a discussion of WSL and
tactic of ‘embrace, extend, extinguish’ is a WSL2. We also explore Microsoft’s
thing of the past. Instead of developing cross-platform Visual Studio Code,
proprietary versions of open source which can integrate with WSL2 for
protocols to muscle the latter out of the testing Linux apps.
market, the tech giant is now one of the Finally, we hearken to
biggest contributors to open source, even the internet’s beating tom-
going so far as to acquire the home of toms to tease out clues as
many FOSS projects, GitHub in 2018. to what the future has in
While Windows and Linux remain store for further Linux
extremely distinct, both philosophically integration in Windows.

30 LXF314 May 2024 www.linuxformat.com


Linux invades Windows

Learning to love Linux


The early days of Microsoft put it at loggerheads with the
growing open source movement, but things are different now.
icrosoft and its flagship Windows OS have a

M troubled history with Linux and open source.


When Bill Gates penned his ‘Open Letter If you want to
to Hobbyists’ in 1976, he complained about the use WSL2, you
rampant software piracy taking place in early hobbyist need a machine
communities – particularly that of the Altair Basic running
interpreter, which he’d co-created. At a time before Windows 11 or
open source initiatives like the GNU and Linux projects, Windows 10
version 1903
his opinion was clear: “Are people who copy software
or higher, with
any different than those who copy records and books?”
Build 18362 or
Twenty-two years later, one of the leaked Microsoft higher. Because
Halloween Documents (see box) focused on how the WSL2 uses
tech giant viewed its rival OS, even showing grudging Altair 8K Basic on paper tape. This was a popular storage medium virtualisation,
respect: “Linux represents a best-of-breed Unix, that is before floppy disks but it made software very easy to pirate. it doesn’t
trusted in mission critical applications, and – due to its function
open source code – has a long-term credibility which However, Windows is still based on the proprietary properly
exceeds many other competitive OSes.” NT Kernel. Users make use of closed-source apps to inside a virtual
Publicly, of course, Redmond disavowed Linux and manage data on Microsoft’s own NTFS filesystem. machine.
open source altogether. In 2001, former Microsoft CEO Microsoft’s Damascene conversion to being a
Steve Ballmer famously said: “Linux is a cancer that cheerleader of open source could also just be
attaches itself in an intellectual property sense to motivated by expectations of Azure customers, who
everything it touches.” Gates even described the open mostly favour Linux and related workflows. After all,
source GPL (GNU Public Licence) as “Pac-Man-like”. while Linux desktop’s market share continues to climb,
Ballmer later backed down from taking such a hard it still is under 4% versus 73% for Windows.
line on Linux. This may have been due to Microsoft’s It’s also likely that Windows desktop usage will
commitment to releasing open source software in the climb even further with WSA (Windows Subsystem for
intervening years. This included introducing .NET Core Android), which offers users a way to run Android apps
in 2014 – an open source, cross-platform successor to from within Windows. What was traditionally a perk of
the .NET Framework. Chromebooks may soon become commonplace on all
In 2015, Microsoft CEO Satya Nadella even went as Windows devices.
far as putting up a slide proclaiming “Microsoft loves Once again, this raises the spectre of whether what
Linux”. The company has released Linux versions of is good for Microsoft is necessarily good for Linux and
popular programs like SQL Server and Microsoft open source. The best way to answer these questions
Teams. There’s even a dedicated repository wherein is through careful understanding of exactly how far
users can install select Microsoft tools via Apt and Linux has encroached into the Windows desktop.
Yum. Crucially, users can also now make use of WSL2
to run Linux kernels in a lightweight VM.
Today the gods of Redmond are proud members THE HALLOWEEN DOCUMENTS
of the Open Source Initiative and have made Linux
operating systems available for their Azure Cloud A long-standing source of understandable anti-Microsoft sentiment
Services. The company joined the Linux Foundation at from the open source and Linux community was the leaked 1998
its top-tier Platinum membership level in 2016. Halloween Documents. These were a series of internal confidential
In 2020, Microsoft president Brad Smith admitted Microsoft memos that detailed the threat to its business from open
in an interview with ZDNet: “Microsoft was on the source in general and specifically Linux. They can be read at www.
wrong side of history when open source exploded at catb.org/~esr/halloween. They’re ancient history but the opening
CREDIT: Wikimedia/Michael Holley

the beginning of the century.” summary shows how seriously Microsoft took Linux as a threat:
According to the Open Source Contributor Index, “Linux poses a significant near-term revenue threat to Windows
Microsoft is now the second largest contributor to NT Server in the commodity file, print and network services
open source behind Google, with 4,649 active projects. businesses. Linux’s emphasis on serving the hacker and Unix
CREDIT: Magictorch

In October 2023, for the first time, Microsoft went so community alleviates the near-medium term potential for damage to
far as to provide specific steps on its support pages on the Windows client desktop. In the worst case, Linux provides a
how to install Linux directly on a PC via dual boot. And mechanism for server OEMs to provide integrated, task-specific
since 2009, Microsoft has been contributing to the products, completely bypassing Microsoft revenues in this space.”
Linux kernel via the non-profit, Outercurve Foundation.

www.techradar.com/pro/linux May 2024 LXF314 31


Linux invades Windows

Linux inside Windows


Run Linux apps on Microsoft’s OS in Windows Subsystem for Linux 2.

he origins of WSL (Windows Subsystem for

T Linux) lies in Microsoft’s Project Astoria, a tool


originally designed to port Android apps to
Windows 10 Mobile. The project was killed in 2016 but
the code formed the basis of WSL, which was released
in beta later in the same year. Unlike third-party apps
like Cygwin, WSL’s initial aim was native Linux
compatibility through serving Unix programs as
custom isolated ‘pico processes’.
In May 2019, Microsoft announced the release of
WSL2, a huge improvement over its predecessor, given
it uses virtualisation to run Linux kernels inside a WSL2 can be installed via cmd.exe or the Microsoft Store. You can also
lightweight virtual machine. This not only improves use the store to install more Linux distros.
performance but adds full system call compatibility.
Both WSL2 and compatible Linux distros can easily enough reason to switch, as most VM software can do
be installed via the command line or Microsoft Store. the same. As far as developers are concerned though,
there’s every reason to take WSL2 for a spin. Not only
WSL’s ‘so what?’ moment is the setup incredibly simple but you can easily create
While WSL2 is certainly a much more efficient way of and switch between distros with just a few keystrokes.
implementing Linux in Windows, it still needs to pass Files can be stored in isolated Linux filesystems, and
the ‘so what?’ test. In other words, why shouldn’t Linux updates can be carried out automatically across every
developers and other interested parties just keep on installed distro. Command-line tools such as Bash, Vim
running full distros of Linux in a dedicated virtual and so on are supported out of the box and you can
machine using software like VMWare or VirtualBox? install more via the distro’s own package manager.
The fact, for instance, that WSL2 now has GPU Crucially, using WSL2 gives you the ability to invoke
support and can even run GUI Linux apps is hardly Windows applications via the shell. Installed Linux apps

TERMINAL CASE
By default, WSL2 launches terminal utilities, such as
in Windows Terminal. While Hyper or ConEmu.
we don’t make a habit of By default, these programs
recommending Microsoft launch cmd.exe but you can
products at LXF, this is one configure your profile to
that integrates nicely with point to %windir%\
installed Linux distros. system32\wsl.exe instead.
If you’re serious about The steps to do this differ
using Linux on a regular depending on your terminal
basis, launch Windows program. For instance, on
Terminal via the search bar, first launch ConEmu displays
then click the arrow next a fast configuration screen.
to the new tab icon (+). In the Choose Startup Task
From here you can switch field, you only need change
between profiles – for {Shells::cmd} to {Shells::wsl}.
example, from PowerShell You can also go to Settings >
to Ubuntu. To switch to the ‘Tasks to define parameters.
Linux command line by You can use Windows Terminal and third-party utilities such as ConEMU Regardless of the terminal
default, hit Settings. In the (pictured) to automatically launch your chosen Linux distro via WSL2. program, you can find help
new window, select the drop- with basic WSL commands,
down menu in the Default application from Let If you want to use the including running specific
Profile section and change to Windows Decide to Linux command line across apps in installed distros, at
your chosen distro. Windows Terminal. We also multiple distros and/or have https://learn.microsoft.com/
From here you can also recommend enabling Launch a preferred program, WSL2 en-us/windows/wsl/basic-
change your default terminal On Machine Startup. is compatible with other commands.

32 LXF314 May 2024 www.linuxformat.com


Linux invades Windows

If you’re using PowerShell, you can also check for


kernel updates with:
$ wsl --update
Once your chosen distro
is installed, you can Installing and running programs now works in the
immediately download and same way as any terminal utility in Linux. For instance,
run any terminal program try installing popular Tetris clone Bastet with:
available via the OS’s
$ sudo apt-get install bastet
package manager.

Introducing GUI apps


Installing terminal utilities and games is all well and
good, but frankly you can achieve much the same thing
by logging into a remote Linux server via SSH.
The real fun lies in the fact that Windows now
supports both X11 and Wayland Linux GUI applications.
This means you can launch Linux apps from the Start
are also listed in the Windows Start Menu, so can easily Menu, pin them to the Windows taskbar, switch
be launched there or via the command line. between them and Windows apps using tabs, and even
use copy and paste.
Start your subsystems! To get started, you need to install a driver to
If you’re now convinced it’s worth taking WSL2 for a use a virtual GPU (vGPU) that supports hardware-
spin, first make sure that your copy of Windows is up accelerated OpenGL rendering. You can find links to
to date by typing updates into the search bar and drivers for popular graphics cards at: https://learn.
choosing Windows Update. If you’re using Windows microsoft.com/en-us/windows/wsl/tutorials/gui-apps.
190, you need to be running version 21H1, 21H2, or You also need to have at least Windows 10 Build
22H2 in order to use WSL2. 19044+ or Windows 11 installed to use this feature.
WSL2 also uses Hyper-V. This requires 64-bit Once you have downloaded and installed the
hardware virtualisation support which you must necessary GPU installers, open PowerShell and then
enable in your BIOS. Check with your motherboard update it with:
manufacturer if you’re unsure how to do this. $ wsl --update
Once this is done, save and close any open files. Next, you need to restart WSL2 for this update to
Command-line lovers can run cmd.exe or open take effect by running:
Windows PowerShell to begin installation with: $ wsl --shutdown
$ wsl – install Use the Start Menu to launch your chosen distro
If the installer hangs (as it did for us), or you’re more again, then update the OS itself again with:
a fan of the GUI, you can also search for WSL2 in the $ sudo apt-get update
Microsoft Store and hit Get to begin setup. You can now install a GUI app, such as the
Once the install is complete, you need to check that Rhythmbox music player, for example, which is usually
Virtual Platforms are enabled. In the Windows search only available for Linux:
bar, find and select Turn Windows Features On Or Off. $ sudo apt-get install rhythmbox
From here you can check the box marked Virtual Once the install is complete, you can launch the app
Machine Platform. in question by searching via the Windows Start Menu.
By default, WSL2 installs Ubuntu but you can install If you did choose Rhythmbox or any app from which
another distro if you wish. If you used the Microsoft you need to access local files, this is a good time to
Store to search for WSL2, you can see all available learn how they’re managed in WSL2.
distros listed and install them by clicking Get. Windows files can be accessed from within your
Still, the best way to view currently available distros Linux distribution from /mnt/. For instance, we pointed
is via the command line: c . Rhythmbox towards our music folder at /mnt/c/Users/
Install your chosen distro using: nate1/Music.
$ wsl --install -d <Distribution Name> You can equally use the Windows File Explorer to
For example: browse your Linux directories. Simply use cd to
$ wsl --install -d <kali-linux> navigate to your chosen parent folder via the
For this tutorial, we’re using Ubuntu 22.04 LTS. If command line and then run explorer.exe.
you want to install a distro that isn’t available for
download, WSL2 also supports importing other distros
via a tar file. Follow the steps on Microsoft’s Support
site to do this (https://learn.microsoft.com/en-us/
windows/wsl/use-custom-distro).
Once install is complete, restart your PC. After
logging back in to the desktop, open the Start Menu to
view a shortcut to your Linux distro of choice. If you
click to launch, your distro opens in PowerShell. You’re
prompted to set a username and password.
Next, make sure your OS is fully up to date with:
$ sudo apt-get update Linux apps can access Windows files and folders via /mnt. Here, Rhythmbox is playing
$ sudo apt-get upgrade an MP3 file in the Windows Music folder.

www.techradar.com/pro/linux May 2024 LXF314 33


Linux invades Windows

VS Studio for Linux


WSL2 integration offers the best of cross-platform development.

uch as we’re loath to admit it as

M Linux lovers, when it comes to


development, you can do much
worse than Microsoft’s own Visual Studio.
For almost 30 years, this robust IDE
(integrated development environment)
has been used to develop everything from
basic scripts to websites and apps.
Visual Studio IDE is soon to be
Windows only (VS Studio for Mac is due to
be retired in August 2024). However, the
standalone source code editor Visual
Studio Code is available for Windows,
Mac OS and Linux. While much more
lightweight than its heavier IDE cousin, You use the Command Palette in VS Code to set up and install more Linux distros.
VS Code’s functionality and supported
languages can be enhanced via a number of extensions. section, which you use to check if you’re running VS
Most importantly, there’s an extension to connect VS Code in a ‘local’ (Windows) or ‘remote’ (WSL) context.
Code with WSL2. This means you can develop apps on
Windows while also running them in a dedicated Linux Prod the python
kernel. This makes it much easier to ensure cross- Next use the Start Menu to launch your chosen Linux
platform compatibility for your apps. It’s also hugely distro, or open Windows Terminal and run wsl .
more efficient than other options, such as trying to For the purposes of this guide, we’re going to create
mirror code across both physical and virtual machines. a simple script in Python. Unlike most Unix systems,
Windows doesn’t come with the language installed
Starting the Studio by default. As far as we can tell, all the Linux distros
Before integrating WSL2 with VS Code, we recommend offered for install via WSL2 via the Microsoft Store do
repeating the steps on the previous pages to set up a have Python 3 preinstalled. You can double-check this
dedicated Linux instance for running your chosen apps. in Windows Terminal by running:
Next, you need to install VS Code via the Microsoft $ python3 – version
website: https://code.visualstudio.com/download. If Python 3 isn’t installed, simply run:
The installer is available for Windows 10 and 11. By $ sudo apt-get update
default, the download icon accesses the User Installer, $ sudo apt-get install python3 python3-pip
which installs to your User folder, so doesn’t require Make a folder for testing purposes and switch to it:
admin privileges. A System installer is also available. $ mkdir helloWorld
The installer is straightforward and offers numerous $ cd helloWorld
extra options. Choose freely among the rest, such as Next, create a simple test script:
creating a dedicated Start Menu icon, but make sure $ echo ‘print(“Hi, don’’t forget to subscribe to Linux
The WSL
extension uses the option Add to PATH is checked. Format!”)’ >> hello.py
a client-server Once install is complete, open VS Code via your new Test it by running locally from the Linux instance:
architecture. desktop shortcut or the Start Menu. Look to the left- $ python3 hello.py
The client runs hand pane and click the extensions icon. In the search
‘locally’ in Windows
and the server
box that appears, type wsl . Click Install to continue. Linux coding in Windows
‘remotely’ in Sharp-eyed users will no doubt have noticed a new At this stage, you have created your own Python script
your Linux distro. status bar item, bottom-left. This is the Remote Status within what amounts to a remote Linux environment. It

34 LXF314 May 2024 www.linuxformat.com


Linux invades Windows

can be run from within the distro. You can even edit it
using Nano or Vim. THE COMMAND PALETTE
Still, if you’re intent on developing a cross-platform
app, remember that as things stand, you can’t You can access more VS Code WSL commands by using the
meaningfully debug and run apps from Windows itself shortcut Ctrl+Shift+P to bring up the command palette.
without installing the same Python development stack. Type wsl to list options. One of the most useful is Connect To
This is fairly simple to do but undermines the advantage WSL Using Distro. If you select this, VS Code displays a list of all
of having your own lightweight, standalone Linux installed Linux distros. You can also click Add New to list more and
instance with all necessary Python tools preinstalled. launch the installer from VS Code. This must be done locally – you
Fortunately, you can use WSL2 to edit, debug and must have closed the ‘remote’ WSL connection from VS Code first.
run your script from VS Code. To get started, double- If you then run Connect To WSL Using Distro once again and
check the terminal to make sure you’re still in the same choose the newly installed OS, VS Code also installs the necessary
folder as your test script, then run code . – the . tells server software on your target system so it can connect.
VS Code to open in the current folder. If your program is stored in a specific place, save the trouble of
The terminal now displays a message stating navigating to it via Windows Terminal by using Open Folder In WSL.
Installing VS Code Server . You’ll also see a number If you’re connected to an WSL instance, you can navigate from here
after this – this is the version, which automatically to the directory containing your code. As before, click Show Local to
matches that of the VS Code client you installed display the ‘local’ Windows filesystem. If this is too much trouble, the
directly in Windows earlier. Command Palette also contains a Reopen Folder In Windows option.
In simplest terms, in running this command, you’re We recommend the Help command that links to Visual Studio’s
having VS Code install a small server to which the VS documentation on WSL (https://code.visualstudio.com/docs/
Code client on Windows itself can connect. remote/wsl). From here you can learn more about how the
The VS Code server also installs host extensions in WSL extension works in VS Code, such as the fact it can run other
WSL, so that they run in the context of the tools and extensions and commands directly. This is also where we learned
frameworks installed therein. This is independent of that you can open an WSL window directly from VS Code: just press
the language extensions and frameworks that are F1, then select WSL: Connect to WSL to launch your default distro.
installed in Windows, which is the optimal setup for a You may want to follow the link to install the Remote Development
development environment. Extension Pack with its extensions for WSL, SSH and containers.
Once install is complete, you’ll see a notification
that VS Code is connecting to WSL. You may also be
prompted to authorise access to the Node.js-based features. Still, you can engineer a crisis yourself by
server. The program itself then starts. clicking on line 1 and then pressing F9 to create
The first pop-up window asks you to confirm that a breakpoint.
you trust all files in the parent folder – in the case of this Try to run the code again using F5, then select
test, this is your home directory. Click Yes, I Trust The Python File. Your code now starts and hits the
Authors to continue. breakpoint. You’ll see you can now inspect variables,
You can now check the Remote Status section at the create watches and navigate the call stack. You can also
bottom-left to confirm that VS Code is accessing your press F10 to see the output of the print statement in
chosen WSL instance. the debug console.
For further confirmation, take a moment to hover To access other scripts stored in your WSL instance
your mouse over the test script hello.py and note the from VS Code, simply use File > Open. You’ll notice the
file path. You’ll see that it matches the path in your directory tree here is for your Linux instance, though as
chosen Linux distro. before, you can still access Windows files via /mnt – for
Click on hello.py to begin editing. As this is a Python example, /mnt/c/. Add a breakpoint
script, in this case VS Code prompts you to install the If you do want to switch back to Windows files only, to your test script
Microsoft Python extension for rich editing and simply click the button marked Show Local. This in VS Code to
inspect variables,
improved debugging. Click Install to proceed. launches the standard Windows Open dialog. create watches,
Once this is complete, take a moment to click the To end your WSL session and return to running code and navigate
extensions icon in the left-hand pane, or list them using locally, select File > Close Remote Connection. the call stack.
Ctrl+Shift+X. From here you can see the ‘locally’
installed WSL extension, as well as a new section
entitled WSL: [OS Name] – Installed. This shows that
the extension is installed on the WSL side.
While you’re here, you can also search for and install
other extensions into your WSL instance via VS Code,
such as the Pylint linter. This provides a richer palette
as well as completion for most commands, making
debugging much easier.
Next, take your code for a test spin by hitting F5,
then choosing Python Debugger from the drop-down.

Bugging out
Given that our test script only constitutes one line, it
doesn’t offer many opportunities to allow you to step
through the code or show off VS Code’s debugging

www.techradar.com/pro/linux May 2024 LXF314 35


Linux invades Windows

Run the Microsoft distro


Rumours are rife but how far will Redmond go to embrace Linux…

espite its easy integration with WSL, in

D October 2021 Visual Studio Code became the


site of a battleground between Microsoft and
the open source community. The controversy centred
around the release of .NET 6. The tech giant had
originally hinted it would include a feature to allow
developers to modify source code while an app is
running and immediately see the results.
Microsoft provoked a backlash due to its last-
minute decision to include this feature in Visual Studio
only – a paid product primarily designed to run on
Windows. Ultimately, Microsoft bowed to pressure
from both the open source community and its own
employees to grant a pull request to enable this feature
with VS Code, but events like these beg the question: A preview of the next version of Windows leaked from Ignite 2022. Will
can a commercial company like Microsoft ever fully it really run Linux under the hood?
embrace open source?
In the intervening years, the tech giant seems to
Microsoft opens up have learned its lesson by releasing PowerShell Core
During the late ’90s, Microsoft released SFU (Services under the GNU-compatible MIT Licence in 2016. As
For Unix), which included some GNU utilities. Given that this licence is permissive, it can be shipped with apps.
these were covered by the GPL, Microsoft lived up to In theory, this means that any scripts run in the target
its obligations and offered selected components under environment run on the same shell using the same
the same open source licence. command implementations as the test environment.
It wasn’t until 2004 that Microsoft released a Given that Unix systems already have strong shell
product as open source of its own volition: WiX environments that can accomplish much the same
(Windows Installer XML). The licence used was the thing, this raises the same issue as with WSL and VS
Common Public Licence, later superseded by the Code: is Microsoft truly embracing open source, or
MS-RL (Microsoft Reciprocal Licence). This licence has simply providing a way for developers to stay within
received the approval of the Open Source Initiative but the Windows ecosystem?
the Free Software Foundation does not consider it to Still, it’s harder to be cynical about other major
be compatible with the GNU GPL. moves by Microsoft. In 2019 alone, the company
The FSF feels much the same about the Microsoft released Windows Terminal, PowerToys and the
The Linux version
of Edge running Public Licence, which has been used to release other Microsoft C++ Standard Library as open source.
in Ubuntu 23.10. open source projects, such as the Windows Template In the same year, Microsoft developers also began
Installation is Library. Terms like “permissive” and “weak copyleft” work on transitioning Windows’ Edge browser to use
available via are often bandied around by FOSS advocates, but the open source Chromium browser as a codebase.
Microsoft’s
repositories or
these Microsoft licences do allow creation of derivative This was a bold move and involved almost completely
standalone DEB/ works using open source code but restrict the use of abandoning the version of Edge developed in-house.
RPM files. Microsoft-specific names and trademarks. Speaking in an interview with The Verge, Microsoft
spokesperson Joe Belfiore
admitted: “Our volume use is low,
partly because we’re only on
Windows 10.” This reflected the
fact that at the time Edge only
came bundled with the latest
version of Windows, leaving many
Windows 7 users in the dust. Even
those willing to make the upgrade
found that browser updates were
usually only released along with
Windows 10 feature updates
around twice a year.
Work began on a prototype
code-named Septagon, based on
Chromium. After getting the green

36 LXF314 May 2024 www.linuxformat.com


Linux invades Windows

light from Microsoft top brass, such as Bill Gates, and Linux. To get started, download the CBL-Mariner
Microsoft began working with Google engineers to ISO from https://aka.ms/mariner-2.0-x86_64-iso.
develop the modern Edge, which now is the second- You can also compile the ISO yourself from the
most popular web browser after Chrome. Linux terminal if you prefer (see box, below).
Although the decision was pragmatic, it’s a win for Once the download is complete, open VirtualBox
open source and collaboration. Microsoft clearly felt and select Add. Set a name for the VM, such as
its open source bona fides were strong enough to woo Mariner1, then under ISO Image, navigate to the file
Linux users, because after previews, a stable version of you downloaded. Under Type choose Linux, then select
Edge was made available to Linux users in 2021. Other Linux (64-Bit) for Version.
Despite being installable via the Microsoft repo and The default settings of 512MB RAM and 1 CPU are
enjoying compatibility with most Chrome extensions, sufficient for taking Mariner for a test drive but feel
few Linux users headed for Edge, and Firefox and free to adjust. Hit Next to create a virtual hard disk (we
related browsers remain most popular on the OS. recommend a minimum of 15GB). Click Next > Finish.
The wooing has since continued with successive Click Start to launch the VM. On first boot, choose
versions of WSL and now WSA to allow running the graphical installer. You are given the choice to
Android apps on Windows devices. install the core or full version. Choose freely, then click
Next. Agree to the T&Cs, then click Next once again to
From pirates to mariners be taken to the Partitions screen. Note that Mariner
WSL2’s kernel was originally developed by Microsoft’s supports hard disk encryption. Choose Next again to
Linux System Group. Since 2020, the same team has create a user account with a suitably strong password,
also been maintaining CBL-Mariner. CBL (Common then Install > Install Now to proceed.
Base Linux) is a fully-fledged Linux distro, albeit one Once install is complete, hit Restart to boot the
that only comes with the basic packages needed to machine. VirtualBox should automatically eject the ISO.
support and run containers (much like Fedora CoreOS). You can now sign using the credentials you created.
It uses an RPM-based package manager and RPM- CBL-Mariner uses Systemd for managing all running
OSTree for system updates and rollbacks. The Linux services, so for your first command, run systemctl to
System Group also clearly takes security seriously, as view descriptions of current loaded and active ones.
Mariner comes with features like a hardened kernel,
signed updates and tamper-resistant logs. Crucially, Microsoft loves Linux
Microsoft doesn’t seem to be pulling any punches any Twenty-five years ago, it would be hard to imagine
more when it comes to open source: the entire OS is that Microsoft would be a member of the Linux
covered under a mix of MIT, Apache and GPL licences. Foundation, not to mention mirroring Linux devs by
Official ISO builds can now be downloaded via supporting rewrites of the kernel in Rust and releasing
Microsoft’s servers. While technically it can boot on open source distros. Naturally, innovations such as
any x86_64 PC, it’s primarily designed to work on a WSL2 and CBL-Mariner could just be there to keep
hypervisor platform, such as Microsoft’s own Hyper-V programmers using Windows and Azure. Open source
or VirtualBox. For the purposes of this guide, we’ve could just be a form of ‘Windows dressing’. Still, Linux
chosen VirtualBox, given it can run on both Windows is in the OS – and it’s here to stay.

BUILD YOUR OWN CBL-MARINER ISO


Microsoft is now offering toolkit directory:
precompiled ISOs of CBL- cd CBL-Mariner/toolkit
Mariner. This saves the You can now execute the
trouble of compiling either ISO build command with:
your own ISO or bootable sudo make iso REBUILD_
VHDX/VHD image based on TOOLS=y REBUILD_
the project’s source code. PACKAGES=n CONFIG_
Still, if you prefer a DIY FILE=./imageconfigs/full.json
approach, you can compile Once it’s complete, you’ll
your own CBL-Mariner ISO in find your ISO in CBL-Mariner
Linux. Open the terminal in /toolkit/out/images/full.
your chosen distro and run: If you would rather build Microsoft now offers downloads of CBL-Mariner 2.0 ISOs but you can
sudo apt-get install build- your own VHDX image, run: compile them yourself via the Linux terminal if you prefer.
essential git golang sudo make image
Next, you need to use Git CONFIG_FILE=../ image, you can view the full for container images running
in order to clone the CBL- imageconfigs/demo_vhdx. list at https://packages. on Azure.
Mariner repository: json microsoft.com/cbl- Alongside Microsoft’s own
git clone https://github.com/ If you prefer a VHD image, mariner/2.0/prod/. tools, such as .NET and ASP.
microsoft/CBL-Mariner.git run the above command, but As you’ll see, these are NET Core, the CBL-Mariner
Once the repository has substitute vhd for vhdx . fairly spartan compared to repository contains common
been cloned to your device, To check the packages the likes of Ubuntu Server, Linux tools including Python
switch to the CBL-Mariner that go into your chosen but exactly what you need 3, Kubernetes and Node.js.

www.techradar.com/pro/linux May 2024 LXF314 37


Pi USER
Turning the Pi Pico Les Pounder
works with groups

into a custom GPU


such as the
Raspberry Pi
Foundation to help
boost people’s
maker skills.

Renowned fanatical Pi modder Clem Mayer goes RASPBERRY Pi


all out and creates a Pi-powered graphics card. TURNS TWELVE!
hen the Pi Pico was first launched, a Hello World display. To turn his creation into As I write this, we have just

W there was talk about using its I2C


capabilities to run DVI outputs,
a true GPU, he devised a PCIe PC expansion
card to mount the Pico to and host the HDMI
celebrated 12 years (or three
if you follow leap years) of
which is to say to drive a digital display. connector, which while pushing the definition Raspberry Pi. It is hard to think of
There already exists a Pi Pico DVI library a bit, is a Pico-powered PC graphics card. See a time when there wasn’t a low-
called PicoDVI (https://github.com/ www.youtube.com/watch?v=8-RuYM-9s3A cost, credit-card-sized computer
Wren6991/PicoDVI) that for our projects. In those 12 years,
enables a Pico to control a Raspberry Pi has sold 61 million
digital display over HDMI. units (www.tomshardware.com/
Utilising this, Clem Mayer, raspberry-pi/raspberry-pi-
CREDIT: Element14 Presents, YouTube

after initially running into timing celebrates-12-years-as-sales-


issues when attempting to break-61-million-units). Of that
directly connect the HDMI to total, 57 million are Linux-based
the Pico, found more success computers, the remaining four
once he used a Pico DVI Sock million being Raspberry Pi Pico
(https://github.com/Wren6991/ microcontrollers.
Pico-DVI-Sock), which is a small Let that sink in: 61 million units
PCB that sits under the Pico is a lot of single-board computers
with an HDMI mounted on it. or microcontrollers powering
Mayer successfully initiated hacks as diverse as screaming
the new pseudo Pico GPU with Behold the world’s first Pi Pico GPU expansion card. No, it can’t play Crysis. jelly babies (the original GPIO
Hello World back in 2012) to
powering industrial machinery.
The Raspberry Pi has become a

Kaki Pi Double the fun major part of the Linux ecosystem


and it has inspired and educated
CREDIT: SYuridenk-Shokai/Pimoroni

many of those who now work in


From Japan! NVMe on Pi 5 open source and Linux projects.
Back in 2012, we didn’t know
Another Pi-like SBPC appears! From We were all getting excited about having what to expect from the
Yuridenk-Shokai in Japan, this packs a one NVMe drive on our Pi 5s, but now Raspberry Pi. Initially it was a
Renesas RZ/V2H Coretex-A55/R8/M33 Pimoroni has a dual-NVMe model called the single-core Arm CPU running at
MPU with 80 TOPS of AI. It’s aimed at NVMe Duo Base. Importantly, it follows the 700MHz, with only 256MB of
robotics and has four CSI video inputs along new PIP design standards and supports all RAM. A later revision saw double
with a PCIe 3 connection. Find out more in sizes of NVMe drives. Find out more: the RAM but it wasn’t until the
Japanese: www.kaki-pi.ai https://bit.ly/lxf314duo Raspberry Pi 2 that we saw a
quad-core Arm CPU.
Fast-forward to 2024 and we
have the potent Raspberry Pi 5.
Quad-core Arm CPUs running
at 2.4GHz, easily overclocked to
3GHz, 4 or 8GB of RAM, and now
we have easy access to NVMe.
I’m not going to say that 2024 is
the year of the Linux desktop, but
we now have a low-cost Linux
desktop that can also be used in
It’s likely The dynamic
many different projects.
to have a duo strikes Happy birthday, Raspberry Pi!
high price. again!

www.techradar.com/pro/linux May 2024 LXF314 39


REVIEWS Linux distribution

ParrotOS
Les Pounder has watched Hackers at least 12 times and knows what all
the books are. Now he just needs a cool haircut and RISC-based laptop.
arrotOS is an interesting choice for
IN BRIEF
A security
P the Raspberry Pi. We generally think
of the Pi as a learning tool for coding,
focused building projects and advancing our computing
operating knowledge. Another aspect of learning with the
system that is Pi is security. Whether you are on the red or
well suited to blue team, you need a toolkit, and within that
the Raspberry will be a Raspberry Pi. ParrotOS is an alternative
Pi 4 2GB and to Kali Linux, and we can debate the pros and
upwards, but cons of both until the cows come home, but
not Pi 5 for now. let’s uncage this bird and see how it flies.
ParrotOS ParrotOS comes in a number of flavours;
provides a there are versions for laptop or desktop and the
plethora of Raspberry Pi. For each architecture, there is a The main menu hides much more under Pentesting. Here we have plenty of
security Core (no desktop), Home (lightweight, aimed at tools to monitor and audit different cybersecurity scenarios.
auditing tools home users or developers) and Security Edition
for both red (which contains all the ‘hacking’ tools you could think of). running as root, so selecting their entry from the menu
and blue team We tested the Security Edition with a Raspberry Pi 4 often results in an error. Run the same command from
members. This 4GB – right now, ParrotOS doesn’t work on the Pi 5. the terminal as root and you are ready to work.
is a great distro On first boot, after the drive resizes, we are left at a We ran Wireshark on our test network and could see
for learners and login. Enter the default password and we are greeted traffic between our desktop and wireless printer, then
networking with the Mate desktop, which provides a light feel, even our phone and the Pi itself. Wireshark is a powerful tool if
experts to use on the Raspberry Pi 4. ParrotOS is based on Debian used correctly – and legally, of course.
in their job. Bookworm and that means we have a strong foundation As for the more mundane Pi-centric features, yes
to work from. All the usual apps are there: browsers, we have the GPIO at our disposal. Both GPIO Zero and
office, graphics, coding and so on. But there is another RPi.GPIO worked, no problem. HAT compatibility is an
section: Pentesting. Penetration testing is a security issue due to PEP668 being used in Bookworm. You need
exercise that involves security experts attempting to to use a virtualenv in order to install the HAT software,
penetrate a company’s machines. With the correct and some just don’t like that. We tested Pimoroni’s
authority and skills, this is a business model that many Explorer HAT Pro and it failed to run. Wi-Fi and Bluetooth
companies use to keep their systems secure. All you worked well, as did Ethernet, but that is a given really.
need to learn is a Pi and your own network to play inside. ParrotOS is great for learning pentesting and ‘hacker’
Inside the Pentesting menu, we find submenus for skills. Yes, it can be used for nefarious and illegal means,
Information Gathering, Vulnerability Analysis, Password but that is not the intent of its creators. ParrotOS is a
Attacks and Wireless Testing. If Wireshark, Aircrack and means to teach learners the skills of their chosen career
Nmap mean anything to you, you know that ParrotOS using cheap hardware that is already in the toolkit of
has the tools for you. We also spotted a submenu for many hackers. We know of one security expert who hid
NFC and RFID analysis; interesting stuff if you have the the original Pi in a VOIP phone as part of a security audit.
correct components to make it work. Our only gripe with If you are looking to learn pentesting and security
the Pentesting menu is that many applications require skills, ParrotOS could be for you. Just use it wisely.

VERDICT
DEVELOPER: Parrot Security
WEB: https://parrotsec.org
LICENCE: Mixed

FEATURES 9/10 EASE OF USE 8/10


Monitoring PERFORMANCE 9/10 DOCUMENTATION 9/10
network traffic
with Wireshark is Provides every security-related tool we could legally ever
sheer simplicity. need. A great start for those wishing to learn new skills.
You can see
exactly what is
going on across Rating 9/10
all your devices.

40 LXF314 May 2024 www.linuxformat.com


3D printer REVIEWS

Bambu Lab X1-Carbon


There’s a reason this Bambu is shooting up all over and
Andrew Sink is happy to help it out.
riginally launched as a Kickstarter campaign in For a larger
SPECS
Size: 389x389
O May 2022, the Bambu Lab X1-Carbon with AMS
has gone on to become an industry standard
model, you,
get what
you pay for.
x590mm in the prosumer market. Capable of extruding high
Build: 256x256 temperature materials, printing with multiple colours
x256mm simultaneously, and offering advanced print controls, the
Type: 1.75mm X1-Carbon has a list of features that is rapidly changing
PLA, PETG, the landscape of desktop 3D printers. LIDAR-assisted
TPU, ABS, ASA, bed levelling, automatic flow calibration, and a webcam
PVA, PET that can automatically generate a time-lapse are among
Levelling: the features that come together to create a printer that
LIDAR/force somehow feels greater than the sum of its parts.
gauge The Bambu Studio software is intuitive enough for
automatic mesh beginners but also offers advanced functionality for
Nozzle: 0.4mm power users, while the Bambu Handy mobile app is
(0.6mm, perfect for remotely checking the machine’s webcam.
0.8mm, 0.2mm In addition to the printer and required printing parts, other features. The Color Painting mode in Bambu
optional), the X1-Carbon also includes a glue stick, lubrication for Studio enables you to select areas with a variety of tools
300°C the motion system, and three 250g spools of material (height, fill, sphere and so on) that are used to indicate
Bed: 120°C (PLA, PLA-CF and Support for PLA). Assembling the which material to use. Bambu Studio automatically
Speed: X1-Carbon (including the AMS) takes about 30 minutes. creates a purge tower by default, as well as calculating
500mm/s max The X1-Carbon uses a combination of LIDAR and the amount of purged material between each colour.
Bed: Magnetic analogue force sensor to measure calibration and set the Running our Speed Benchy print, the X1-Carbon is
flexible Z-offset when printing. Levelling is automatic and can be unsurprisingly towards the top, with a print time of 15
removable done before each print to get a consistent first layer. minutes and 29 seconds. The Benchy that was printed
platform, A filament spool bracket on the rear can hold a single on the X1-Carbon shows a few speed-related defects.
textured PEI spool of filament that feeds directly into the printer. The hull has a clear band where the transition to solid
optional Using the onboard display, filament can be loaded from layers occurs, and there is some banding around the
Comms: either the spool holder or the top-mounted AMS. The cabin. Overall, it’s still an impressive print considering
MicroSD, Wi-Fi X1-Carbon prompts you to indicate the type of material the sub-16 minute print time.
Control: 5-inch and colour when loading. The X1-Carbon is not an open source 3D printer. If you
colour The AMS is a sleek piece of hardware, with only two are interested in the philosophical side of 3D printing, it
touchscreen visible connections (one PTFE, one wiring terminal) on can be aggravating to see a company ‘taking’ from open
LCD the rear of the unit. It can detect filament tangles, switch source ideas but not sharing developments back with
PSU: 350W materials upon runout, and use an RFID-based system to the community. It’s hard to find as capable a printer in
detect what material type and colour are loaded (Bambu this price range that offers such clearly compelling value.
Lab material only). Not just a high-temperature material 3D printer, the
Bambu Studio (based on PrusaSlicer and SuperSlicer) X1-Carbon offers something for everyone with easy
is powerful slicer software that offers printer colour painting in the slicer, fast and simple setup, and
management, a live video feed, colour painting and many advanced sensor-rich functionality.

VERDICT
DEVELOPER: Bambu Lab
WEB: https://bambulab.com
PRICE: £1,319

FEATURES 9/10 EASE OF USE 9/10


PERFORMANCE 9/10 VALUE 9/10

It’s unusual to find a 3D printer that deserves the hype, but this
is one of the best prosumer desktop FFF 3D printers around.
Not the
smoothest of
prints but one Rating 9/10
of the fastest.

www.techradar.com/pro/linux May 2024 LXF314 41


TUTORIALS Smart notifications

NTFY

Create notifications
from smart sensors
Les Pounder loves building gadgets with the low-cost Raspberry Pi
Pico W – and some of them, like this one, even work.

etting notifications on our smart devices is so

G easy – almost too easy, in that they become


an annoyance. But what if you really need a
notification from one of your projects? We’ve been
using Ntfy for a few months now and it is super-simple
to use. No fancy Python modules are required. We just
OUR need an Android or iOS app, and we’re ready to go. We
EXPERT can send text, images and even files using the service.
Les Pounder In this tutorial, we’re creating a simple notification
is associate system that sends hourly temperature readings
editor at Tom’s directly to our Android device. The sensor, a DS18B20,
Hardware and a has been chosen because it can be used without any
freelance maker software installation. The DS18B20 also comes in a
for hire. He waterproof variant, useful for checking water or ground The circuit is simple, but watch out for the 4.7kOhm resistor between
blogs about temperature without damaging the sensor. data and 3V. We need that!
his adventures
and projects at Building the circuit https://bit.ly/LXF314smart and download the version
http://bigl.es. The circuit is extremely simple, but there is one gotcha of MicroPython for your Pico or Pico W. Open your file
to look out for. The DS18B20 has three wires: red (3V), manager, go to the downloaded file and copy it to the
black (GND) and yellow (one wire data). Red connects root of the RPI-RP2 drive. This flashes the new
YOU NEED to the 3V supply on the Pico, black to any GND, and firmware to the Pico.
yellow goes to pin 0 (top-left). But the yellow wire also Using your distro’s package manager, install Thonny.
Pi Pico or needs a 4.7kOhm resistor connecting it to 3V. This For the latest Ubuntu release, we have to use a Snap:
Pico W pulls the pin high and ensures that the data connection $ sudo snap install thonny
Android or is always on. See the diagram (above-right) to see this Open Thonny and connect the Pico to your
Apple phone connection illustrated. Also take a look at the high- machine. Go to Tools > Options and select the
or tablet resolution picture in the download, which shows a hack Interpreter tab. Set the interpreter to MicroPython
Breadboard involving a screw terminal that makes the connection (Raspberry Pi Pico) and set the Port to match the
3x M2M transferable to other devices. location of your Pico. Click OK. Thonny now connects
wires to the board and we can start writing code.
DS18B20 Setting up Ntfy
temp sensor To use Ntfy, we need an Android or Apple device. Writing the code
(waterproof Download the app from the app store and open it. We The code for this project requires a few modules
optional) need to subscribe to a topic, so click on the + in the to be imported – luckily, they come as standard on
4.7kOhm bottom-right. In the Subscribe To Topic dialog, set the MicroPython. The first imports are machine (for the
resistor topic name. We used lxf-temp, but remember that this GPIO), onewire (for the sensor), ds17x20 (a helper
(yellow - is a public topic, so anyone can see the output. Make module to work with the sensor) and time (to control
purple - the topic name unique and click Subscribe. The topic the timed loop). Then we import network to use Wi-Fi,
red - gold) page appears, and all of the messages for our topic and urequests to send HTTP requests to the Ntfy
Screw are archived here. Go back to the homescreen of your service. We rename this as requests for ease of use.
terminal phone, so notifications appear when we test the code. import machine, onewire, ds18x20, time
(optional) import network
Code: Prep the Pi Pico W import urequests as requests
https://bit.ly/ While holding the BOOTSEL button, connect your Next we need to create an object called wlan to act
lxf314temp Raspberry Pi Pico to your computer. Now go to as a software-to-hardware connection for Wi-Fi. We

42 LXF314 May 2024 www.linuxformat.com


Smart notifications TUTORIALS

turn the connection on, then make a connection to our Send notifications
Wi-Fi access point. A short pause helps connection from your
Pico W to your
success; leaving this out means we get some
smartphone or
connection failures. Finally, we print the connection tablet without
status. If True is returned, then the connection is all the faff!
made; False means no connection.
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect(“WIFI AP SSID”,”YOUR WIFI
PASSWORD”)
time.sleep(5)
print(wlan.isconnected())
Now we need to tell MicroPython where to find the
DS18B20 sensor. It is connected to pin 0 (top-left of
the Pico), so we create an object, ds_pin, to reference
it. Then we create another object, ds_sensor, and using
the ds18x20 helper and onewire modules, we can
make a connection.
ds_pin = machine.Pin(0) priority). The Tags option enables us to use an emoji in
ds_sensor = ds18x20.DS18X20(onewire.OneWire(ds_pin)) the notification. We used the thermometer as it was in
DS18B20 sensors have a ROM number. These are keeping with the project.
unique to each sensor and that means we can have headers={
multiple sensors on the same onewire bus. If we buy “Title”: “Hourly Temperature Check”,
clone sensors, there is a risk that they will use identical “Priority”: “5”,
numbers. In this case, it doesn’t matter as we have just “Tags”: “thermometer”,
one sensor. We scan the onewire bus, and store the })
result in the roms object. Outside of the requests for loop but still inside the
roms = ds_sensor.scan() main while True loop, we use a sleep of 3,600 seconds
The while True loop will run the main body of code, (one hour) to pause the code between readings.
and the first step is to sample the temperature. This time.sleep(3600)
is required before we can get a reading. Add a short Save the code to the Pi Pico W as main.py. By doing
pause to ensure that the sensor is stable before this, MicroPython automatically runs the code when it
moving onwards. is powered on. Power-cycle the Raspberry Pi Pico W
while True: and check your mobile device for a Ntfy notification.
ds_sensor.convert_temp() Every hour you get the latest temperature sent directly
time.sleep(1) to your device.
Inside the while True loop is a for loop, which reads
all of the ROMs (DS18B20 sensors) on the onewire
interface. We read the temperature in degrees Celsius HANDY NTFY REFERENCE GUIDES
and save the output to an object, temp_c, which we
print to the Python shell for debug. It is fair to say that we have fallen in love with Ntfy. Its mix of ease
for rom in roms: of use and powerful features is intoxicating and it has led us down
temp_c = ds_sensor.read_temp(rom) many project paths. The basic guide on how to publish a message is
print(temp_c) at https://docs.ntfy.sh/publish/ and there we can find examples for
Create an object, temperature, and in there store command line, JavaScript, Go and Python.
the current temperature (temp_c) converted to a We are shown how to add an image to the notification, so using
string. Tag on to the end a space and C to format the Ntfy with the Raspberry Pi camera means we can send notifications
temperature as 19.5 C, for example. if a sensor is triggered – if the dog gets into the dining room, for
temperature = str(temp_c)+” C” example. To attach an image, we add Attach to the headers and then
Using requests, we send data to Ntfy services using pass the path to the image. Note that you need the absolute path, be
an HTTP POST request. We need to format this in it a local file or served from the internet.
order for Ntfy to understand it. First we need to supply What if we want the option to action something when the
the topic name – this should match what we set in the notification arrives? The Ntfy example is a dog ringing a doorbell
app. Next is the data that we want to send, in this case (go with us on this). The notification tells you that the dog wants to
it is the temperature object, which contains the gain entry, but the door is locked. The Actions option in the header
formatted temperature string. means we can trigger an event to happen. In this case, the dog is let
requests.post(“https://ntfy.sh/lxf-temp”, in after calling the doorbell’s API via HTTP (https://docs.ntfy.sh/
data=temperature, publish/#action-buttons).
The next part of the request is the headers. These Finally, if you want to use cool emoji, Ntfy has a list that you can
are extra features that we can pass to Ntfy. In this crib from. Just copy the text to the project code and the emoji is sent
case, we set the title of the notification to “Hourly with your message (https://docs.ntfy.sh/emojis/).
Temperature Check” and set it to priority 5 (high

GET YOUR Pi FILLING HERE Subscribe now at http://bit.ly/LinuxFormat

www.techradar.com/pro/linux May 2024 LXF314 43


IN DEPTH Wine 9.0

The Grapes of Tux


Sommelier Jonni Bidwell shows you how to get your pesky Windows
applications running on Linux, as he uncorks the latest Wine release.
f there’s a Windows program stopping you seasoned user, we’re here to show you everything

I switching to Linux, or stopping you doing


so full time, now is the time to see if it
works with Wine. No, we’re not advocating
that’s new – including Wayland support and the
improved Vulkan renderer. We’ve also got some tips for
when things don’t work, so you don’t hit the bottle.
drowning your sorrows or drinking on the job (uh oh– For gamers, we’ll show you how to use Proton – the
Ed). We’re here to tell you about the powerful Wine Wine fork from Valve Software used in its Steam
CREDIT: Getty Images/iStockphoto

application, which translates Windows function calls to platform and on its Steam Deck. Valve has gone to
Linux ones, thus enabling your Windows programs (be great lengths to ensure popular titles work with Proton.
they serious tools or relaxing games) to run on our So, if your favourite game doesn’t work with Wine
favourite operating system. That’s the theory, anyway. proper, there’s a good chance Proton can sort it.
In practice ,things may need some tweaking. Or they
may not work at all; Wine can’t work miracles yet. A fine bouquet
Be that as it may, there is a brand new release to try: Readers (and writers) may be no strangers to one form
Wine 9.0. It may be the solution to all your problems. If or another of Wine, but for this outing, we’re talking
you’ve never touched Wine before, we’ll show you about the fantastic bit of software that lets an awful
everything you need to get started. And if you’re a lot of Windows software run hassle-free on Linux. To

44 LXF314 May 2024 www.linuxformat.com


Wine 9.0 IN DEPTH

avoid disappointment, we’ll let you know right now


that this magic doesn’t extend to running the newest
editions of Microsoft Office (the one from 2010
reportedly works) or the Adobe Creative Cloud suite,
although the commercial CrossOver Office from
Codeweavers (www.codeweavers.com) does work.
Profits from CrossOver Office directly fund open
source Wine development.
Wine 9.0 was released in January 2024. So, for the
first time ever, the major version number rhymes with
the project title. And we’re here to show you what’s
new and how to run this hitherto hapax legomenon of a
release [when Wine 29 comes out, I’m going to come
back to these parentheses and point out that your
terminology is wrong – ed]. That quark of Greek being
awkwardly shoehorned into place, we should also note
that at the time of writing, the development release 9.3
is also available. Folks who want to live on that bleeding
edge will be catered for in a moment. We’re already
getting ahead of ourselves.
than actually getting games to work. All the same, Wine has its own
Drinking games Wine 9.0 includes improved support for DirectX10 Registry Editor and
(rather minimal)
For a long time, one of the most popular use cases effects, as well as miscellaneous DirectShow and Control Panel,
for Wine was running Windows-only games. And in DirectSound enhancements. styled just like
particular doing so through Valve’s Steam. This was a in Windows.
very messy affair, and thankfully one for which there Wine on Ubuntu
shouldn’t really be any need these days (except If you’re reading this from the not-too-distant future,
perhaps for older 2D titles). This is thanks to Steam Ubuntu 24.04 will already have been released, and
incorporating its own Wine implementation, dubbed Wine 9.x will already be incorporated in its repos. So,
Proton. Proton is the underlying technology for the you can install it directly from the Software Centre.
Steam Play feature, which is what allows so many titles But if (like us) you’re still running Ubuntu 22.04 (or a
to work on the Steam Deck, Valve’s portable gaming derivative of it, like Mint 21), you need to install Wine by
device, which runs a custom version of Arch Linux. hand. For other distros (including Debian), it’s best to
Proton is special in that it incorporates a magical refer to the official instructions at https://wiki.winehq.
layer called DXVK (https://github.com/doitsujin/dxvk), org/Category:Distributions. Since Ubuntu no longer
which allows DirectX (versions 9 to 11) calls to be supports 32-bit installs, you need to explicitly enable
converted to Vulkan. This obviates what for a long time the i386 architecture with Dpkg:
was hobbling Wine – that translating Direct3D calls to $ sudo dpkg --add-architecture i386
OpenGL was at best clunky and at worst impossible. There are still 32-bit packages in the official
So, if you want to run Windows-only games, you might repositories (for example, the libraries required for
want to just install Steam instead. You can use Steam Steam and others), it’s just Apt will refuse to install
to run non-Steam titles, too. Alternatively, you might
prefer to use the open source Lutris (https://lutris.net)
or Heroic Games Launcher (https://github.com/ IN VINO VERITAS
Heroic-Games-Launcher/HeroicGamesLauncher),
both of which enable you to run custom Wine/Proton Wine isn’t an emulator. That’s what WINE used to stand for back
versions. Or even your own manually installed DXVK if when it was an acronym. So, if for some reason you have some
you really must. Windows on ARM binaries you want to run on your x86 system,
Gamers will be keen to point out that AAA titles you can’t do it in a straightforward way. However, Wine can be built
these days all use DirectX12. But fear not, Wine for ARM64 devices and you can even find official builds in the
now has its own subsystem, vkd3d, for dealing Raspberry Pi OS repos. These are rather old, though, and you need
with translation from DirectX12 to Vulkan. This to use the packages from the Debian Unstable (Sid) repos instead
subsystem has a counterpart in Proton, and that fork, (see https://packages.debian.org/sid/arm64/wine64/download). By
imaginatively titled vkd3d-proton, saw a new release, adding an emulation library such as FEX (https://fex-emu.com), it’s
2.11.1, in December 2023. This included fixes for such even possible to run x86 binaries on ARM devices.
glitzy titles as The Callisto Protocol, Halo: Infinite and Wine is truly cross-platform, in that it is available for Mac OS and
Pioneers of Pagonia. We’ll need to give Valve some ChromeOS (yes, we know that’s just Linux with a Google-veneer).
time to rebase Proton on Wine 9, but we’re pretty Mac users are spoiled with their M1, M2 and M3 CPUs, and Apple’s
confident that experimental versions will start proprietary Rosetta code translator (that allows x86 code to run
appearing in Steam in the second quarter of 2024 speedily on said silicon). But a faction of those users still take
– in fact at the time of publication Proton 9.0 beta was umbrage with Apple’s decision to banish 32-bit applications since
currently going through its release testing. the Catalina release in 2019. Thanks to Wine’s new WoW64 mode
To muddy the waters slightly, Wine has its own (see later), those users can finally have their way without resorting to
native support for Direct3D, which is named wined3d. virtualisation through Parallels.
However, this is focused more on API emulation rather

www.techradar.com/pro/linux May 2024 LXF314 45


IN DEPTH Wine 9.0

end of life (EoL) in July 2024. Finally, we can update our


package lists and install Wine from its own repo:
$ sudo apt update
$ sudo apt install --install-recommends winehq-
stable
It’s important to note that installing Wine this way
can be a little hit or miss. Which is a polite way of
saying that if you blindly confirm the last command,
you can royally trash your system. In particular, check
that it doesn’t want to remove important-sounding
packages (such as ubuntu-desktop). If it does, cancel
the install and see if you can find up-to-date guidance
on the official forums at https://forum.winehq.org/
viewforum.php?f=8. On our nearly clean install of
Ubuntu 22.04, the install worked fine, but it did pull in
some 300MB of dependencies, so we were careful to
Some Windows them unless the archive is activated. Wine and Steam study the extensive output before confirming.
users swear by
both allow 32-bit programs to run, and as such rely on The Stable release should be fine for most people,
Notepad Plus. Now
you can swear by 32-bit libraries. But they both allow you to run 64-bit but if you really must have all the latest features, you
(or at) it in Linux. programs (in entirely different ways), making the whole might want to try the Development release instead. In
situation far too complicated to wade into right now. that case, install the package wine-devel instead. It’s
Instead, let’s add a directory to house external keyrings possible to have both versions installed side by side,
and add the WineHQ archive key to it: but the manual advises using different prefixes
$ sudo mkdir -pm 755 /etc/apt/keyrings (directories where Wine’s per-user configurations are
$ sudo wget -O /etc/apt/keyrings/winehq-archive. stored, see later) for each. Besides the Development
key https://dl.winehq.org/wine-builds/winehq.key release, there’s the absolute bleeding-edge Staging
version; this includes some bug fixes not present in the
dev version, but probably some new bugs, too. It’s also
where new features are first staged, hence the name. If
HIT THE RIGHT NOTE you think this is for you, grab wine-staging.

“Explore the application and puzzle Tasting Notes


We’ll start simple and show you how to get the popular
at why people prefer Notepad++ to Notepad++ text editor running. Because of its
popularity, Canonical already offers a Snap of this
Vim if you’re not familiar with it.” package (you’ll find it in the Snap Store), but behind
the scenes, it’s still using Wine. You might not be using
Ubuntu, or you might just not like Snaps. In which case,
do read on. Grab the 64-bit (unless you really want the
Now we can add the WineHQ repo to Apt: 32-bit one) installer from https://notepad-plus-plus.
$ sudo wget -NP /etc/apt/sources.list.d/ https://dl. org/downloads/ then run:
winehq.org/wine-builds/ubuntu/dists/jammy/ $ cd ~/Downloads
winehq-jammy.sources $ wine npp.8.6.3.Installer.x64.exe
If you’re using the previous Ubuntu LTS release, Update the version number to match what you
22.04 (Focal Fossa), you need to substitute focal in the downloaded. You’ll see some odd-looking (but mostly
two occurrences of jammy above Or, if you’re using harmless) output in the terminal. If this is your first
Ubuntu 23.10 (Mantic Minotaur), substitute mantic time running Wine, then the Mono (an open source
instead. You should also be aware that 23.10 will go re-imagining of Microsoft’s .NET framework) installer
will spring into life. Then you’ll be able to click through
the Notepad++ install as if you were in Windows. Wine
maintains its own virtual C:\ drive, so all the standard
Windows directories are there. That drive is stored
inside the default Wine prefix (the hidden .wine/
directory in your home folder – press Ctrl+H in Files
if you can’t see it) at /home/user/.wine/drive_c/. The
installer gives you the option to start Notepad++ right
away, so do that and you should see that everything
looks roughly as it would within Windows. Yes, the
fonts might be a bit fuzzy, but generally speaking, it’s
all there. Make a text file and save it if you want, or
explore the application and puzzle at why people prefer
it to Vim if you’re not familiar with it.
Quit Notepad++, open a terminal and run Winecfg.
This is Wine configuration tool, where the current
You can use the Winetricks script from the command line, or through this fetching wizard. prefix can be tweaked. Again, you may see some

46 LXF314 May 2024 www.linuxformat.com


Wine 9.0 IN DEPTH

Steam Play is
peculiar warnings as it starts, and again these are 1.3.272, so Windows titles using new Vulkan extensions
enabled by default
nothing to worry about. The Applications tab lets you there will work and look nicer. See the Winetricks box on Linux for
choose which version of Windows to ‘emulate’, and this (right) for instructions to enable the Vulkan renderer. supported titles,
can be configured on a per-application basis. We won’t We avoided discussion of 32 vs 64-bit executables but flip this switch
get into substituting libraries here, but it is possible to earlier, but now we’re settled in, we should note that if you want to try it
on others.
specify whether to use Wine’s built-in version of a Wine now handles 64-bit Windows binaries in a much
particular DLL (dynamic link library) or a native file from more robust way. This is part of a years-long effort to
Windows. We will say that it’s a terrible idea to use revamp the WoW64 (Wine on Windows 64)
Windows files for low-level stuff (such as gdi32.dll, componentry. This allows 32-bit programs to run
ntdll.dll, kernel32.dll). Apart from one-off library without 32-bit libraries on the host system. And the
substitutions, it’s much better to use the Winetricks so-called new WoW64 mode also allows such apps
script (see box) to manage libraries. to run on a purely 64-bit system. This mode isn’t yet
The Drives tab shows you virtual drives and enables enabled by default (which is why our instructions add
you to set up additional ones (for example, for an ISO- the i386 architecture), and to use it you have to build
mounted DVD drive). Besides the C: drive, you’ll see a from source. The default old WoW64 mode runs 32-bit
Z: drive, which is your root filesystem. If you investigate apps inside a 32-bit process. The Wine devs state that
this further (seeing where Notepad++ can save a file, while the new mode should be fine, old mode is better
for instance), you’ll see that Wine has access to the for 16-bit stuff (maybe you prefer the Windows 3.1
same bits of the filesystem as you do. So, if you were to version of Paint) and OpenGL programs.
run some Window malware, it could very well trash
your home directory (or other places where you have
write access). The other tabs in Winecfg are best WINETRICKS AND PREFIXES
explained by the documentation.
Next, let’s check out the big news with this release, If you do enough experimentation, you’ll soon find a Windows
namely Wine’s improved Wayland support. If you’re not program that doesn’t seem to work with Wine. In this instance, your
running Wayland, this won’t be of much interest, but first port of call should be the Wine Application Database (AppDB,
Ubuntu (where Wayland has been the default for some see https://appdb.winehq.org). It’s a user-curated list of applications
time, even on Nvidia cards) users in particular would be and how well they work with Wine, with a ratings system and
well advised to check this out. Whatever your distro, remedial guidance for programs that require a little extra persuasion.
first check that you’re indeed running Wayland with: Generally, this persuasion involves using Windows native libraries
$ echo $XDG_SESSION_TYPE instead of those provided by Wine. Common offenders are the .NET
Hopefully, this says wayland . If not, log out and see and Visual C runtimes, various codecs and the quartz.dll library,
if your login screen gives you a choice of Wayland or which some games use for video.
X.org. To enable the Wayland support, we need to edit Rather than mess around substituting one library at a time, we can
a registry key. Windows aficionados might want to use use the Winetricks helper script to automate these fixes. Entries in
Wine’s own Registry Editor (see screenshot – p.45 – or the Wine AppDB often include instructions for Winetricks. An old
run wine regedit to see it for yourself), but it’s iteration is included in the Ubuntu repos, so you’re better off
probably easier to just type: following the manual installation instructions at https://github.com/
$ wine reg.exe add HKCU\\Software\\Wine\\ Winetricks/winetricks.
Drivers /v Graphics /d x11,wayland Wine’s experimental Vulkan renderer needs to be activated by
We also need to unset the $DISPLAY environment adding a registry key. But we can save several clicks by getting
variable, which is an X11-thang: Winetricks to do this for us:
$ unset DISPLAY $ winetricks renderer=vulkan
There isn’t anything else user-centric to configure By default (unless you compiled Wine yourself), Wine sets up
here, but with this enabled, Wayland users should see a 64-bit prefix at ~/.wine. It is absolutely possible to run 32-bit
better HiDPI support, have more luck when using applications from here. But if, for whatever reason, you want to set
multiple monitors and enjoy better desktop integration. up a 32-bit prefix at ~/.wine32, you can do so (taking care not to
In particular, titles exhibiting strange behaviour when confuse your wins and wines):
using mouse-look should behave much better. Wine’s $ WINEARCH=win32 WINEPREFIX=~/.wine32 winecfg
(still experimental) Vulkan driver now supports Vulkan

www.techradar.com/pro/linux May 2024 LXF314 47


TUTORIALS
LYNIS
Credit: https://cisofy.com/lynis/

Audit your system


for vulnerabilities
Invulnerable Shashank Sharma has the perfect tool to keep systems safe.

ecurity audits are like hobbies. You always vulnerabilities that could potentially be exploited to

S hear good things from people about them,


and your life is vastly improved if you put one
attack your system.

to good use. But if you’re anything like us, you’ve Security audit for the masses
convinced yourself that performing a security audit Although the project is aimed primarily at system
on your system is a time-consuming exercise, and one administrators, security auditors/officers, penetration
that only seasoned veterans can carry out. Thankfully, testers and security professionals, its ease of use
OUR
with the right tool at your disposal, you can test your makes it possible for just about all manner of Linux
EXPERT system for vulnerabilities in almost no time at all. users to put it to into service.
Shashank Released under the GPLv3 licence, Lynis is a You’ll find Lynis in the software repositories of most
Sharma security audit tool designed to test your system across popular Linux distros. Run the sudo apt install lynis
is trial lawyer a vast array of categories, such as Boot and Services, command if you’re running a Debian, Ubuntu or
in New Delhi, Kernel, Memory and Processes, Shells, Fileystems, derivative distro. Run the sudo dnf install lynis
India. He’s been USB Devices, Storage, NFS, Printers and Spools, command instead if you’re on an RPM-based distro.
writing about Networking, SSH Support, Databases, Users, Groups Depending on your distro of choice, the version of
open source and Authentication, and more. While there are various Lynis on offer might be a little dated. Considering the
software for tools that can be deployed to test the vulnerabilities of nature of the project, it makes sense to always run the
20 years and any one of these categories, Lynis stands out because latest version. To grab the most up-to-date iteration
lawyering for 10. of its ability to test your system across so many areas. from the project’s GitHub page, run the git clone
Based on the tests it runs, Lynis offers suggestions https://github.com/CISOfy/lynis / command. This
and recommendations to help you address any downloads the latest version into the lynis/ directory.
The tool doesn’t require any installation
and you can test your system straight away
by navigating into the lynis/ directory and
running the ./lynis audit system / command.
But we’ll get around to that in just a bit. For
now, let’s get acquainted with the tool and
its functions.
From the downloaded lynis/ directory, run
the ./lynis show commands command for a
list of supported commands. You can also
run the ./lynis show help and the ./lynis
--man commands to get acquainted with
the tool (see table, opposite page).
When you run the ./lynis audit system
command, the tool audits your system
across its entire range of tests. While
running the audit, Lynis generates a lot of
output. Once the audit is complete, towards
the bottom you’ll find a list of suggestions
and details of the scan. For instance, on our
In addition to providing tips for general system hardening, Lynis also informs you of vulnerable test machine running Ubuntu 20.04 LTS,
software packages and possible configuration issues. Lynis ran 255 tests, with a hardening index

48 LXF314 May 2024 www.linuxformat.com


Terminal TUTORIALS

Command Description
./lynis --man Print the man page To ensure
./lynis show help Print the help screen security of your
installation, you
./lynis show Print all possible arguments must always use
anti-malware
./lynis show
Print all supported commands and antivirus
commands
tools, and it’s
./lynis show help good practice
Print help for specified command
<command> not to use the
same password
./lynis show across different
Print the default settings
settings accounts. For
./lynis audit Although useful, implementing all the suggestions would be most home
Run audit on the current system overkill for most home users. users, these
system
precautions
./lynis audit Run audit on specified are enough to
remote <host> remote system The output generated by Lynis is colour-coded for
safeguard your
quick assimilation of important information. Green is
system. After
used to confirm the presence of a scanned module or all, disabling
of 65 out of 100. Thankfully, there were no warnings, component. This is for information purposes only and USB support
but the tool did give us 40 suggestions for to improve doesn’t require further any action. Orange implies at the behest
the security of our system. suggestions that the tool wishes you to look up and of an audit tool
address. It could mean that the module or component can land you in
Understanding the tests is disabled. Red is reserved for components that the soup with
Due to space constraints, we can only list a few of the require immediate attention. your family.
warnings published by Lynis after the security audit: Some tests require root privileges, but you’ll face
* If not required, consider explicit disabling of core an error when you run the sudo ./lynis audit system
dump in /etc/security/limits.conf file [KRNL-5820] command. Instead, you have to first establish
https://cisofy.com/lynis/controls/KRNL-5820/ ownership of the file with the chown -R 0:0 command
and then run Lynis with sudo:
* Install a PAM module for password strength testing $ cd Downloads/projects
like pam_cracklib or pam_passwdqc [AUTH-9262] $ sudo chown -R 0:0 lynis
https://cisofy.com/lynis/controls/AUTH-9262/ $ cd lynis
$ sudo ./lynis audit system
* Configure maximum password age in /etc/login.defs As well as running an audit of the local system, you
[AUTH-9286] can also audit a Docker file. Considering its ease of use
https://cisofy.com/lynis/controls/AUTH-9286/ and the infinitely useful information generated, Lynis is
now on our list of highly recommended tools.
* To decrease the impact of a full /home file system,
place /home on a separate partition [FILE-6310]
https://cisofy.com/lynis/controls/FILE-6310/ IMPROVING SECURITY
* Purge old/removed packages (295 found) with For each suggestion, Lynis provides a useful description along with a
aptitude purge or dpkg --purge command. This will TEST-ID, such as FILE-6310. You can use these identifiers to read
cleanup old configuration files, cron jobs and startup more about the test with ./lynis show details <test-ID> . Alternatively,
scripts. [PKGS-7346] you can click the URL provided to read more on Lynis’s website.
https://cisofy.com/lynis/controls/PKGS-7346/ While some of the suggestions are easy enough to address,
even for newcomers, such as the one recommending purging old
* Double check the permissions of home directories as packages or installing a malware scanner, others might require a bit
some might be not strict enough. [HOME-9304] more effort on your part to understand and implement.
https://cisofy.com/lynis/controls/HOME- Throughout the output generated, a green [V] denotes a tick, and
9304/ a red [X] suggests an absence. On our machine, we have configured
a firewall but don’t have a malware scanner, so Lynis shows us this:
* Harden the system by installing at least one malware Components:
scanner, to perform periodic file system scans [HRDN- - Firewall [V]
7230] - Malware scanner [X]
- Solution : Install a tool like rkhunter, You don’t have to scroll backwards through your terminal screen
chkrootkit, OSSEC, Wazuh to access the results of the tests run by Lynis or the output it
https://cisofy.com/lynis/controls/HRDN-7230/ generated. You’ll find the same in the ~/lynis-report.dat data file. The
Refer to the Improving Security box (see right) on data file, however, isn’t colour-coded, unlike the real-time output
how to use these suggestions to harden your system generated by Lynis.
and protect yourself.

ENHANCE YOUR TERMINAL-FU Subscribe now at http://bit.ly/LinuxFormat

www.techradar.com/pro/linux May 2024 LXF314 49


TUTORIALS Ebook library

KAVITA
Credit: www.kavitareader.com

Build a streaming
ebook library
Bionic bookworm Nick Peers looks at a free tool that enables you to
collate, read and share your digital publications over the internet.

avita does for your digital books and comics

K what Audiobookshelf does for your digital


audiobooks – it provides easy access to all
your ebooks via a web browser or app, at home and
further afield. Although geared towards comic book
users and manga fanatics, there’s enough in Kavita to
OUR suit those who simply want a user-friendly home to
EXPERT manage, read and share their digital publications.
Nick Peers
has more paper Put up a bookshelf
and digital If you want to install Kavita natively on your system,
publications head to https://wiki.kavitareader.com/en/install/linux- Each library can be configured to contain a broad range of file types, or
than he cares to install for instructions. It involves saving the correct you can restrict it to just the common formats (PDF and EPUB).
admit. Maybe build of the latest release at https://github.com/
Kavita can help Kareadita/Kavita/releases to your hard drive, then podman run --name kavita \
the digital extracting the .tar.gz archive to a writable directory of --userns keep-id:uid=1000,gid=1000 \
library look less your choice, making it executable ( chmod +x ./Kavita ), -p 5000:5000 \
chaotic than the and running the app directly ( ./Kavita ). You’ll also find -v ~/ebooks:/ebooks \
piles of paper instructions for installing Kavita as a Systemd service. -v ~/container-data/kavita:/kavita/config \
and magazines If you’re adding Kavita to your server, you may --restart unless-stopped \
filling his office. prefer to run it containerised – you’ll find instructions -e TZ=Europe/London \
for Docker at the Kavita wiki, where there are multiple -d docker.io/jvmilazz0/kavita:latest
options, including a LinuxServer.io version for those You obviously need to adapt the two -v lines to point
who want to run Kavita under their own user account. to your ebooks folder on the one hand, and the location
We’ve also successfully tested the official container where you plan to store Kavita’s configuration files on
with Podman as a rootless container with the following: the other. We’ve also assumed you’re running Podman

ORGANISE YOUR FILES


Looking for
content with The secret to a tidy library is (or organised by folder and title, while the filename is also the
which to
file organisation. Kavita relies subfolder such as author or genre) book’s title within Kavita itself.
populate your
on you to properly file everything – Kavita still treats each book Don’t worry too much about
library? You can
find free books in a logical manner so it can as its own unique series based trying to apply organisation. As
from several concentrate on scanning through on its metadata. you’ll see from the main copy,
legal sources, your content. Start by organising PDF files, however, are treated Kavita provides many ways to
including the material into separate libraries differently. Because there’s no view your collection, with smart
Project if that’s applicable – each library metadata to speak of, Kavita filters the most flexible. You can
Gutenberg needs its own folder inside a relies on the folder structure to also edit your library’s metadata,
(www. parent directory. organise them. This organisation as the step-by-step guide reveals
gutenberg. From here, how you organise extends to placing each set of (see page 52), ensuring even PDF
org) and the
your files depends on the file files in a grouped folder that is files can be populated with key
Internet Archive
type. EPUB files, for instance, treated as a series. The folder’s information like author and genre
(https://
archive.org). just can be thrown in haphazardly name then becomes the series to help you organise them.

50 LXF314 May 2024 www.linuxformat.com


Ebook library TUTORIALS

through your own user account, which has a UID and NAVIGATE YOUR KAVITA LIBRARIES
GID of 1,000.
By default, you need to manually restart Kavita
2 6
each time you boot your PC. To avoid this, issue the
following lines to set up a user-generated service:
3
$ podman generate systemd --new --name kavita -f
$ mv -v container-kavita.service ~/.config/systemd/user/
$ systemctl --user daemon-reload
5
$ systemctl --user enable container-kavita.service
4
First read through
Access to Kavita is through your web browser – either
localhost:5000 from your PC or 192.168.x.y:5000
1
from other devices on your network (replace
192.168.x.y with your PC’s IP address). It’s also simple
to extend access beyond your network, particularly if
you’re running Nginx Proxy Manager (see LXF306) – just
set up a proxy pointing to http://192.168.x.y:5000.
When you log on through your browser, you’re
invited to set up the administrator’s account. Supply a
suitable username and password (plus your email if you
want to be able to reset your password at any point –
this requires you to set up email after logging in) and Navigation pane Quick edit tools
then click to register. You’re then prompted to log in. 1 Quickly switch between Kavita’s main 4 Click the vertical ellipsis ( ) button next
views here – including top-level access to to a title or series to access extra options.
You’re shown the main screen – the annotation
your libraries.
(right) reveals how it looks once you’ve got a library up Activity meter
and running, but for now you’ll want to start adding Smart search 5 When the button is green, a scan is
content. Click the Server Settings link to be taken to 2 The keyword search tool displays taking place. Click the button to see what’s
the Admin Dashboard’s Libraries tab (you can also results as you type, split into categories going on.
such as libraries and files.
access the dashboard via the settings button next to User menu
your username in the top-right). On Deck 6 Click your username to access user-
Click Add Library. Start by giving it a suitable name 3 Kavita tracks the progress of your specific settings and any smart filters that
and type (the default Manga betrays Kavita’s focus, but books, enabling you to quickly jump back in. you’ve saved.
there’s a Book option, too). Click Next to select the
library’s folder (see the box opposite for how libraries clicking Home to reveal a card-like view displaying
should be organised). You’re next given the option of recently updated and newly added series – right now,
uploading a 32x32 library image (click Next to skip). they should contain the same content from your new
The Advanced section is where you determine library. Later, when you start reading through your
what file types to search for (EPUB and PDF are pre- content you’ll see an extra category – On Deck – which
selected by default). In most cases, all other options works in the same way as your media server does to
can be left as they are, so click Save and you’ll see put the content that you’re reading front and centre.
the library appear with its status displayed, as well On the left you’ll see navigation options, including
as options for refreshing (performing a new scan), options to browse each library you add. Click a library
deleting and editing. The latter option brings up the to view all its titles – dubbed Series – in the main
same four categories as before (General, Folder, Cover window. Click an individual title from here and you’re
and Advanced), which gives you the option of adding taken to its homepage where a Read or Continue
parent folders to your library, plus tweaking settings. button lets you read it from the comfort of your
browser courtesy of Kavita’s own document viewers. If you’re
Browse your library Next to this are further buttons. The first is a star – constantly
You’re ready to view your library. Use the navigation click this to add the title to your Want To Read list. adding new
tools on the left to find what you’re looking for. Start by There’s also a button for marking the title read or content to
your folder,
unread, followed by a metadata editing tool – see the
spare yourself
step-by-step guide (over page) for details on how this
continually
can provide information to help navigate your libraries. prodding the
Next is the … button, which reveals a pop-up menu. library update
Many of these options are duplicated elsewhere, but button by
the menu is also accessible from other views (look navigating to
for the button next to a series or title), so it’s worth the Admin
familiarising yourself with its various options as you Dashboard’s
can quickly add titles to other lists with fewer clicks. General tab,
Beneath these buttons you’ll find information about then scrolling
down to enable
the file (including format, length and estimated reading
the folder
time). If there’s any metadata tagged in the file – only
watching
Use smart filters to build highly customised views of your libraries – applicable to EPUB files – then it may be displayed setting.
these are accessible via your personal user menu. here, too, giving you access to the author (or writer as

www.techradar.com/pro/linux May 2024 LXF314 51


TUTORIALS Ebook library

Kavita terms it), tags and other information. These can the Smart Filters entry under your own user menu
be used as quick search filters – click the Writer tag, in the top-right corner of the Kavita user interface.
Everyone needs for instance, and you’re shown a list of all titles in your Other navigation options listed on the left include
a backup, and collection with that author tagged. Collections, Reading Lists and Bookmarks. Collections
Kavita is no enable you to group your choice of individual titles (or
exception. It A good bookmark series) together. Click the vertical ellipsis ( ) button
automatically If there are too many titles to view, look for the filter next to a title and choose Add To > Add To Collection,
backs up your button in the top-right corner of the main window. then create a new collection or select an existing entry.
database on Click this to discover how Kavita displays the content Reading Lists work in a slightly different way –
a daily basis
of your library – via smart filters. The shortcuts on the again set them up from the Add To menu. Here, items
(you can change
left of each library basically create a view that displays (anything from a single chapter to an entire series)
this via the
Tasks tab on all titles, filtered to show only those in the currently can be grouped together in a list. Once created, click
the Admin selected library. Reading Lists on the left followed by the list to see your
Dashboard). From here you can create all kinds of different titles arranged in the order you added them. You can
Visit https:// views using a combination of smart filters. You’ll rearrange them via drag-and-drop, plus remove or read
wiki. see filters can be based on series name, metadata individual titles. Click Continue to start reading (and
kavitareader. (including writer and tags), file path and more. These later pick up from where you left off). When you finish
com/en/install can be combined and configured to focus on specific one title, the next one automatically follows on.
for details matches or broadened to span multiple libraries,
on where
the backups
authors or whatever you’re looking for. Reading the words
Filters can be given a suitably descriptive name, Reading a book is as simple as clicking its cover
get stored.
enabling you to save them for easy retrieval later via followed by the Read button. Kavita provides you with

EDIT SERIES DETAILS AND METADATA

Change name and summary Edit metadata


1 Metadata can be applied to a series, but not to individual 2 The Metadata tab enables you to add the series to
files (or entries in a series). Browse to the library containing your an existing collection (or create a new one). It’s also where
series, click the vertical ellipsis ( ) button and choose Edit to you can add a release/publication year, assign genres and
bring up its Details page. Use the General tab to view its (non- generic tags (your choice of keywords). You can also supply
editable) name plus add an explanatory summary to display on a language, age rating and publication status for periodicals
the series’s homepage. such as magazines.

Assign credits Add other details


3 The People tab is where you can build a database of 4 The Web Links page enables you to link to any websites
contributors to the publication or book. At its basic level, you can you wish – such as the author, publisher or magazine’s own
simply supply the writer (or author), but there are many other homepage, such as Linuxformat.com. Use the Cover Image to
fields, too – aimed primarily at comic books, but some can be pick a different image – either from the other documents in the
translated to other mediums, such as Publisher, Editor and series, or by uploading your own. Finally, Related enables you to
Character (for fiction series). link the series to others.

52 LXF314 May 2024 www.linuxformat.com


Ebook library TUTORIALS

different in-browser readers for different formats, so


PDF files display differently from EPUB. In both cases,
the book is displayed with its pages top-down (so scroll
down to read through it). At the top you’ll find a series
of controls – the PDF viewer has more buttons to
choose from (roll your mouse over one to reveal what
it does). Use the hamburger ( ) icon in the top-right to
change viewing options, such as displaying pages in
spreads and scrolling horizontally between pages
rather than vertically. The button on the left reveals a
navigation page with page thumbnails you can scroll
through to jump more quickly to where you need to go.
The EPUB reader looks barer at first glance but click
the menu icon to reveal a slide-out menu, offering both
comprehensive Settings and a Table of Contents view.
If you double-click on a page to reveal the option
required to create a bookmark, you can access those
from the Table of Contents section.
In both cases, when you close the reader, Kavita
records where you are in the book – you’ll see the Read
button now says Continue, and the book also appears the Devices tab to configure ereaders – you’ll see Kavita’s built-in
readers work
in the On Deck section on your homepage. entries for Kindle, Kobo and PocketBook along with a
with PDF, EPUB
For those using Kavita to manage comic book Custom entry. Once configured, you can push books to and CBZ files.
libraries, Kavita’s Comic Manga Reader (which works your ereader via email. The EPUB reader
with CBZ files you can obtain from sites like https:// The final tab enables you to review your activity gives you full
archive.org/details/comics) is the only one to work via stats – info such as total pages read, time spent control over your
book’s layout.
with the Bookmarks shortcut you can access directly reading and average time per week mingle with the
from Kavita’s main navigation menu. When browsing ability to analyse your reading over set periods.
comics, press the Space bar to bring up the controls – The other settings button – found sandwiched
the bookmark button is in the top-right corner. between the activity meter and your username –
Sadly, there’s no official app for browsing your takes you to the Admin Dashboard. Most of the
content from your desktop, phone or tablet – you can, options here are self-explanatory, but take the time
of course, use your mobile browser (save the website to visit the Statistics tab for information on your
as a shortcut to your home screen) or visit https://wiki. library’s content as well as how others are using it.
kavitareader.com/en/faq/external-readers for a guide
to using selected apps. One of the most versatile is
KOReader (https://koreader.rocks), which you can SHARE YOUR LIBRARIES
install on Linux, Android and Kindle Legacy models.
Finally, Bookmarks enable you to save individual One of Kavita’s strengths is that it enables you to share your libraries
pages for reading or downloading. This only works with with others. If you want to share with people outside your home, you
Kavita’s Comic Manga Reader; the EPUB Book Reader need to configure Kavita to work through your remote proxy.
can save bookmarks, but only internally, while the PDF To set this, open the Admin Dashboard via the main settings
Reader offers no bookmarking tools at all. button (next to your username in the top-right corner of the Kavita
user interface) and switch to the Users tab. Click the Invite button to
Server tweaks set up a new user, but note the warning about email – if you’ve not
There are two areas where you can tweak settings in already done so, close the invite pop-up, then switch to the Email tab
Kavita. Your personal user preferences are accessible to configure Kavita to send emails.
via the Settings option under your username at the After inputting their email address, you can assign roles to that
top-right. Selecting this reveals your User Dashboard, person – while we recommend limiting Admin to yourself or maybe
with settings spread out over six tabs. The default one other trusted user, other roles include allowing downloads,
Preferences tab enables you to tweak the look and changing passwords, setting bookmarks and setting read-only so
behaviour of the main web interface as well as the they’re unable to make changes to metadata or other settings.
built-in image (comic book) and book (EPUB) readers. Next to this is a list of all currently available libraries – you can
Visit the Account tab to change your password and automatically grant them access to all libraries or restrict them to
email – you’ll see a greyed-out Age Restriction option, specific content. Once done, scroll down to reveal an Age Rating
which only applies to other users of your server (see Restriction section, perfect for restricting library access to the
the box, right). The 3rd Party Clients provides the API younger members of your household.
Key and OPDS URL you need to plug your Kavita server Once done, click Invite and an email is sent with instructions for
into third-party readers such as KOReader. completing the registration. There’s also a Setup User button next to
The Theme tab enables you to switch the interface the user’s entry under Users, which can be used to set their account
skin but requires you to click the Theme GitHub link to up immediately.
find more themes to download (with instructions). Use

KEEP READING US EACH MONTH Subscribe now at http://bit.ly/LinuxFormat

www.techradar.com/pro/linux May 2024 LXF314 53


TUTORIALS Startup and init

SYSTEMD
Credit: https://systemd.io

After the kernel,


it’s startup time, init!
Mats Tage Axelsson explains how Linux takes you from the kernel
to a running system, both today and back in the mists of time.

ow do you start a computer? “Press the power

H button!” is not a valid response. Most of you


know that the firmware loads the kernel,
which in turn hands it over to the system. Maybe you
know that it starts process one, aka PID=1, and that
this process is the key not just to booting fast and
OUR securely, but also to keep all things running.
EXPERT As expected with Linux, you have many options to
Mats Tage handle your own boot. Even the distinction that PID=1
Axelsson also handles services and other things is not always a
can be counted given. It started with shell scripts, which users and
on to find new administrators enhanced with SysV, and via other ideas
ways to simplify we mostly now use Systemd.
your Linux usage That is almost a universal Linux truth, but nothing is
in complex ways. ever certain in our world, so new ideas have come out.
Anything to We’ll cover here what changes there have been, where
seem as cool as it got us and a hint about things to come.
he thinks he is. When using SysV, you have shell scripts in /etc/init.d/ and you can add
To start: history your own if you follow the rules.
In the early days of Unix, the system would start with
init as process number one. The process number one slows down. As systems became bigger and needed
is still the way your computer starts. Originally, the init more services running, administrators needed to
ran shell scripts to run everything. This worked well for manage services from boot and beyond. While
the small systems of the time, though even then it had scripting makes it possible, it is clumsy. In the
limitations. One major limitation is that they run one beginning, it required bespoke shell scripts at every
after another. If one script fails, the whole boot fails. step. With init only starting 12 TTY sessions, the user
And when one script starts slowly, the whole boot had to start all services on their own. The first solution

WHAT ABOUT THE BSD?


As BSD has a longer history system easy to handle for every service you need must demands you have on the
than Linux, it has an older administrators, which is why be in the file. power of the system versus
initialisation system. It even it is still popular among BSD The BSD initialisation the power you can wield for
predates SysV and has a users. It starts services the system is older than Systemd. different situations. With
similar structure to store files. same way as SysV, using the Despite this, it works reliably Systemd, apps and daemons
A directory named /etc/rc.d path to the service script and and has been updated over already have support for the
contains the service files. the start parameter. the years. These updates desktop. On servers, you have
They execute according to Despite this apparent make it a useful tool but not other systems with other
keywords embedded inside simplicity, it requires exact as encompassing as Systemd. needs. Finally, with embedded
the files. Administrators scripts that determine all the Whether that is good or bad systems, you want to tweak
must determine these actions to start and stop. is a matter of opinion. everything to the last byte, in
dependencies when writing Dependencies are also Given these differences, which case, you can get away
the scripts. This makes the supported, but each and your choice depends on what with other solutions.

54 LXF314 May 2024 www.linuxformat.com


Startup and init TUTORIALS

was to hardcode specific files where these scripts


• Events define an event for every service you want


should go. That’s the start of SysV’s init and init.rc files. to start.
Enthusiastic Linux users can find these files in /etc/ Targets group services needed for each type Sinit is the
init.d, /etc/rc.d or similar. At first, the files were pure of operation. simplest you
shell scripts. Convenient if you are always writing shell While Upstart development was going on, can choose.
scripts and educating people about them. Not so good developers came up with other solutions. Both In 91 lines of
for personal users or even companies. Solutions, in the corporate entities (read Apple) and the BSD code, it may
’70s, were to create a special format for these scripts. communities created other solutions. When it was be impossible
to go smaller.
You find the version numbers of these systems in time for a shakeup, Red Hat employees Lennart
You need to
the name. Earlier Unix systems, called System Poettering and Kay Sievers took inspiration from
combine it with
[number], ending up at V (five.) Which leads us to talk Launchd of Mac OS. Daemontools-
about System V in this article. Unless you want to dig That inspiration started the Systemd effort. The encore, at least
all the way down, SysV is the ‘old’ established system. main goal of the project is to unify the init process for according to the
Old-school hackers consider SysV adequate and all of Linux. In technical terms, the goal was to add Suckless project
simple to use as it depends on shell scripts. Parallel parallelism in boot while also replacing different website.
starts were not well supported, though developers daemons. Some of the services Systemd can handle
had made efforts on this front. include network, devices and user management. You
Linux’s first init system was rudimentary; its name is can also create your own services; the simplest is to
simpleinit. In this system, you would fill the /etc/inittab create a Systemd timer instead of using Cron or At.
file with a simple table containing TTYs, the boot Systemd’s target roughly corresponds to runlevels,
program and the value of PATH and INIT_PATH. The though it handles dependency instead. In Systemd,
boot process simply follows the INIT_PATH and dependency decides which service must run before
executes all scripts contained in the directory. If you starting any other service. You use service files for
have a bootprog value, it only runs that file the same control, they contain statements such as After, Before
happens when the INIT_PATH is a file. and Wants. These are all handling dependencies, not
Seeing the way simpleinit works, you are up against sequence. The main keyword regarding this is target.
another quirk: if you put init=someprogram in your A target is similar to runlevels; they change what
boot options, ‘someprogram’ runs. You can use this to type of system you run. On a desktop, that means
start even a regular app. Usually, this is a terrible idea whether you have a text-only system or a graphical
as you’ll drop the system’s stabilising features. you can desktop. When you run a server, a potential target is a
consider it when you build small embedded systems, web server and all that entails. For specialised cases,
using toolkits like Buildroot. you write the target file yourself.
The developers at GUIX have their own ideas about
Ubuntu the Upstart distro the init system – they call it Shepherd. These ideas
In the first serious distribution, SLS (Softlanding Linux lead to differences, but not too many. The main one is
System), they deployed simpleinit as the default. For that it can start user services and that you configure
various reasons, other distros quickly superseded SLS. with the GNU GUILE programming language, an
One was Slackware, which is still around. implementation of Scheme. Shepherd is still in version
Their init systems quickly moved to SysV, and 0.10, so may not be fully stable and it may be lacking
mostly remained there until Ubuntu had other ideas. some features. However, if you install the GNU GUIX Systemd has more
Canonical wrote a document to improve initialisation distribution, you get Shepherd as default. options to fill in
and supervision of services. Part of this effort is and uses the INI
file type; this is
Upstart, no longer default in Ubuntu but available for One init to rule them all where controversy
enthusiasts (https://wiki.ubuntu.com/ReplacementInit). Chances are that you, reading this, are running erupted during
Taking into consideration new, at the time, USB Systemd. All major distributions default to using development.
devices entering the market, the developers
considered “events” as the basic concept for their new
system. Event-driven systems define what any service
needs before it starts. As an example, an SSH daemon
waits for the event of networking running. As control
lies with init, it controls what happens at all times.
At the time (2006-ish), the kernel developers added
hot-plug features in a reaction to support for the
aforementioned USB devices. The thinking then
became focused on the events caused by changing
hardware during runtime. Mounting disks that may or
may not be there during boot is unreliable, making it
necessary to wait for the event when it becomes
available. Other issues that need this are network
attached filesystems. Upstart, while popular, was short-
lived in the history of init.

The three philosophies:


• Runlevels run whatever matches the runlevel in
lexical order; the filename decides which goes first.

www.techradar.com/pro/linux May 2024 LXF314 55


TUTORIALS Startup and init

Systemd. The biggest reason for this is that it covers all case “$1” in
bases. As you saw earlier, this also causes it to be big start|reload|restart|force-reload)
Are you adding and complex. If you want to learn how to use it, you echo “autospawn=yes” > /run/pulseaudio-
your own would be wise to try small experiments. Some changes enable-autospawn
services and risk the stability of your system, although Systemd is ;;
wonder what extremely robust. stop|status)
will happen To make experiments while staying safe, you can ;;
when you write scripts for any typical initialisation system and esac
mess it up? start it once. The simplest and safest way to this is The header files contain an LSB-style stanza that
Fear not – at to stop GRUB before boot and add init=/sbin/init/ to controls the rules for the service. In the code above,
least runit can
your kernel options, changing the init string to your you can see that it requires the local filesystem to
run alongside
your existing
needs, of course. This makes your system boot using run. Next you see how the service should react to
solution. your alternative init file but doesn’t change your next runlevel changes. On the first lines of the actual script,
boot. A reboot clears all sins away. it sets the environment variables and then loads any
necessary functions.
SysV scripts Below, you see the case statement, which refers to
The power of SysV is that you control it using shell the options you can give the service command when
scripts – this makes it simple to add your own services. handling the service. For any service, you can add a
All you need to learn are the basic ways SysV reports script that runs for these occasions. If you are curious,
status and handles the state of services. any common distribution still leaves these scripts on
#!/bin/sh your disk for backward compatibility.
### BEGIN INIT INFO To start a service, you would call it from its original
# Provides: pulseaudio-enable-autospawn position in the hierarchical filesystem. To run the above
# Required-Start: $local_fs script, you would run /etc/init.d/pulseaudio-enable-
# Required-Stop: umountfs autospawn start . As it calls the script, the case is start
# Default-Start: 2 3 4 5 and the service starts. During boot, the script runs
# Default-Stop: 0 1 6 since it is in the correct directory.
# Short-Description: Enable pulseaudio autospawn
# Description: Enables autospawn for the pulseaudio Upstart scripts
daemon Upstart scripts do the same thing but try to be more
### END INIT INFO compact. The focus is on dependencies, so you set the
start and stop conditions. Runlevels are still a major
set -e part of the system, so you need to define those. What
enthusiasts love about Upstart is that you can choose
. /lib/lsb/init-functions any conditions for starting a service.
In the code below, you can see that the Nginx
server starts when the filesystem and the network are
up. You could choose any other state to compare to,
even your own homemade service. That service could
SMALL SYSTEMS - YOUR ROBOT! ping a known server and start only after you know that
is running.
It’s common for small systems, like a robot, to use BusyBox. In this # nginx
case, you can use minirc; this works just like runit but is even smaller. # description: nginx http daemon
The developer has focused on making small binaries and a simple # author: George Shammas <[email protected]>
setup. Taking the init scripts from Arch Linux, they could create an
extremely small system. description “nginx http daemon”
In this solution, a comma-separated variable denotes which author “George Shammas <[email protected]>”
daemons are configured. Another variable, ENABLED, contains a
list of all services that start on boot. To configure new services or start on (filesystem and net-device-up IFACE!=lo)
override the standard settings and services, you change a single stop on runlevel [!2345]
configuration file: /etc/minirc.conf.
For even more granular control, you can support other udev env DAEMON=/usr/sbin/nginx
solutions, making it possible to minimise memory or improve env PID=/var/run/nginx.pid
functionality by choosing between mdev, Systemd, udev and eudev,
a fork of udev. If you need special scripts to run, the program runs pre-start script
/etc/minirc.local, where you can put your shell scripts. There are lots # Perform pre-start actions
of examples on GitHub that you can use to create your own. $DAEMON -t
If you want to play with this, consider the difference between init if [ $? -ne 0 ]
scripts and service managers. Known service managers are monit, then
perp, s6 and supervisord. It’s common to choose from init scripts exit $?
and service managers in conjunction. You can choose any combo, fi
even use a combined binary (runit is one) and combine it with end script
another service manager. To find out more, start with the GitHub
page and search the Arch Linux wiki: https://github.com/hut/minirc/. exec $DAEMON

56 LXF314 May 2024 www.linuxformat.com


Startup and init TUTORIALS

# Allow respawning of the NGINX process dependencies, help with logs and even use runlevels,
respawn as in SysV and friends. If you want to try it out, you can
respawn limit 10 5 actually run it together with Systemd and other service BusyBox
The interesting part of this script is that you could management software. replaces the init
use any conditions in the prestart script. Another neat daemon with
feature is setting a respawn limit, in case things are Reasons to switch itself, using a
repeatedly going wrong. Upstart, due to its simplicity, For your ordinary desktop or laptop system, there single file (/etc/
init.d/rcS) for
was popular for a time but as Systemd started rolling is no real reason to leave – and plenty to keep – the
configuration. It
out, the mass of features won out, making Systemd the default init system. However, those who do have
has few features
default in most distributions. Running Upstart scripts intimate knowledge of the implications or want that due to its small
varies from SysV in that you must use the service knowledge may want to switch The debate about how size – it is, after
command with the same options: sudo service nginx Systemd works is nitpicking over details that have the all, intended
start . Most other actions work the same. most impact for administrators. for embedded
While this debate is healthy, bringing new ideas systems.
Systemd scripts and solutions to the Linux space, it does not help the
They are not really called scripts in Systemd; rather, ordinary user in the short term. On large servers where
they’re specifications for a service, unit and so on. The every improvement counts, it is useful to see how the
files use the INI format, with sections for what you are system performs with the different options.
trying to achieve. The most common sections are Unit, Equally, when you have a project that requires
Service and Install. There are a myriad of keywords to saving every byte for other jobs, you need to think
control the behaviour of each service or unit. Most of about the init system. This is where you might switch
these keywords are easy to grasp if you understand to something simpler. Mainly, this can be beneficial if
the main idea of how Systemd keeps your system you choose a limited number of applications. You might
stable and efficient. In the below code, you can see want to just run monitoring software and display it. The
an example of a service that runs in the background. number of packages plummet when your ‘system’ is as
[Unit] small as a credit card.
Description=EarnApp The story of init scripts in Unix and similar systems
Wants=network-online.target is fascinating but moves slowly. The reason is that they
After=network-online.target need to change only in response to other changes. A
major change came with hot-plug functions in the
[Service] kernel; next came the cgroups functionality. Both of
Type=simple these developments gave administrators a strong
Restart=always reason to also take advantage in the boot and
RestartSec=5 management of their systems. As a regular user, you
ExecStart=/usr/bin/earnapp run now have the advantage of this faster boot and robust
User=root response to new drives.
StandardOutput=null If you have the inclination to dig deep into how your What makes
StandardError=null system works, this is a fascinating subject. Be aware, Systemd seem so
though, that the system you are testing in will be complicated is the
wide array of files
[Install] unbootable at one point or another when you change that link to each
WantedBy=multi-user.target such things. Be careful and have fun! No progress other to make
happens without failure – personal or for humanity. things run.
Runit scripts
This system is extremely simple to use; the core of
runit is /etc/sv. In this directory, you put a directory for
each service with the script, always named run. Most
scripts are less than five lines of code long. When you
have those files, you link the directories to /etc/service
to activate. The runit notices the new service within
five seconds and starts it.
#!/bin/sh
TZ=MET-1METDST
export TZ
exec /usr/local/apache2/bin/httpd -DNO_DETACH
Look through the code – this is a long example.
Two lines of settings are there to make sure the
environment is correct for this service. When you have
applications that need more parameters, you start it by
adding a call to the config file, the way you would from
the command line.
With start, stop and restart, it seems to do
everything expected from an init solution. It can handle

MAKE STARTING WITH US EASY Subscribe now at http://bit.ly/LinuxFormat

www.techradar.com/pro/linux May 2024 LXF314 57


BACK ISSUES

BACK ISSUES MISSED ONE?


ISSUE 313 ISSUE 312 ISSUE 311
April 2024 March 2024 February 2024

Product code: Product code: Product code:


LXFDB0313 LXFDB0312 LXFDB0311

In the magazine In the magazine In the magazine


Discover how Blast off into Stay safe online
to use the ultimate hacker’s toolkit, the future with a look at the five by sending net nasties to Pi-hole,
staying out of trouble while doing best next-gen distros, and discover and read about the rise and fall (and
so. And join us as we take the whether Raspberry Pi or Orange rise again) of Basic, and the roll-out
Puppy Linux developer’s new distro Pi is the best SBC for you. Plus, of the rolling-release Rhino Linux
for a run and explore its container learn how to rescue retro media, distro. You can also learn how to
features. Plus, we have a Roundup add NPCs to your own point-and- strengthen your shell history, set
of retro-gaming distros, an in-depth click adventure, emulate an up a home CCTV system, add an
look at filesystems, tutorials on analogue computer, and lots more. inventory to your point-and-click
adding plug-ins to our LXF shell and We’ve also squeezed in hardware adventure, and much more. Plus,
getting more from your VMs, plus and distro reviews, a password check out our packed reviews,
news, reviews and oodles more. manager Roundup, news and more. news and Raspberry Pi sections.

ISSUE 310 ISSUE 309 ISSUE 308


January 2024 December 2023 November 2023

Product code: Product code: Product code:


LXFDB0310 LXFDB0309 LXFDB0308

In the magazine In the magazine In the magazine


Learn Linux Manage your Bring together
with our in-depth guide to getting apps by harnessing the power of all your movie, TV, music, audiobook
started with Elementary OS, or Podman, and discover how random and photo streaming needs under
explore a more security-centric numbers are used by the kernel to one roof. Plus, we take an in-depth
distro as we dive into Tails. Plus, find keep your data safe. Plus, find out look at the Pop!_OS distro, explain
out how to perfect the art of OCR, how to master printing in Linux, how networking works, and guide you
finish your WordPress website, customise your WordPress website, through tutorials on WordPress, fast
recreate the BBC Micro, and make tweak your kernel scheduler, use file management, reviving the BBC
your own point-and-click adventure. Python to scrape the web, process Domesday Project and more. And
And no issue of Linux Format would your smart-home data, and much don’t forget to check out our packed
be complete without news, reviews, more. And make sure you read our reviews section, plus we examine the
Pi projects and much more besides. Roundup of Raspberry Pi killers… brand-new Raspberry Pi 5.

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.

58 LXF314 May 2024 www.linuxformat.com


UK readers
USA? EU? THE MOON?
*
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!

2 GREAT
WAYS TO
SUBSCRIBE
Digital-only
and
print+digita
l
bundles!

USA REST OF THE WORLD EUROPE


From $135.49 From $135.49 From €119.49
For 13 issues For 13 issues For 13 issues

IT’S EASY TO SUBSCRIBE!


Visit www.magazinesdirect.com/linux-format
Call +44 0330 333 1113
Lines open Monday-Friday, 9am-5pm, UK time.
*We don’t actually deliver to the Moon. Yet.

www.techradar.com/pro/linux May 2024 LXF314 59


TUTORIALS Game streaming

SUNSHINE & MOONLIGHT


Credit: https://moonlight-stream.org, https://github.com/LizardByte

Ultra-smooth home
game streaming
Promising the Sun and the Moon, Michael Reed’s heavenly bodies
promise perfect gaming streaming on most PC hardware.

unshine and Moonlight are open source server

S and client programs that allow desktop


sharing and game streaming across a
network. Originally, both were a reimplementation of
an Nvidia protocol, but in their current state, they don’t
require any Nvidia hardware or software to run. Having
OUR said that, they can take advantage of GPU hardware for
EXPERT video encoding, if you have it.
Michael Reed You can also share games and desktops between
is a consummate different platforms and operating systems. The
Linux platform support for the client side app is even more
professional extensive and includes the Raspberry Pi along with
who has been mobile and smart TV-type devices, as well as regular
moonlighting Linux, Windows and Mac computers. What Moonlight Moonlight’s launchers can be created from scratch and configured to
for us so that and Sunshine offer together is completely free, highly launch specific programs on the host machine.
he can live in performant and extremely easy to set up and use.
the sunshine. Whether you are gaming or running desktop apps, have preferred it if the site bigged up the open source,
(are we actually this is how it works: as you sit using Moonlight on the multiplatform side of things, because there is an
paying for these client computer, the input from your keyboard, mouse open source server in the form of Sunshine, which
gags?–Ed) and gamepad are sent through the network to the implements the GameStream protocol and works
computer running Sunshine. Sunshine uses extremely perfectly with Moonlight. It’s also the case that you
efficient audio and graphics compression codecs to don’t need any Nvidia hardware on either the client or
send the screen and the audio of the computer back to the server machine. If you do have a supported Nvidia,
the Moonlight program, so that you feel as though you AMD or Intel GPU, the software can take advantage of
are running the software locally on the client computer. it, however. If you don’t, software encoding is perfectly
How you connect everything is up to you. For viable if your CPU is reasonably powerful.
example, you could run Sunshine in a virtual machine We were impressed with the installation options
and run Moonlight on a smart TV to give you a Linux provided by the Moonlight project. For typical desktop
desktop on your TV. You could take your laptop into Linux, the Snap or Flatpak options might be the easiest
the next room and have access to your desktop PC. to work with. You might also be interested in the
The experience in terms of latency and visual quality AppImage package as it requires no installation at all.
You can install
depends on the power of your server computer and For our testing purposes, we began by installing the
the Sunshine
speed of your network. With a few compromises in client on to a low-powered laptop with the following
server on to a
VM to control that area, you can even use the setup over the internet command: snap install moonlight
it. We found – handy if you need the power of your main computer
that we had on your tablet or phone when you’re out and about. Serving up the Sunshine
to enable 3D Once you have Moonlight installed, it’s time to install
acceleration Moonlighting clients Sunshine, the server. Typically, you would install this
before it Sunshine (the server) and Moonlight (the client) are on another computer on your network. The Sunshine
would work installed separately as they are different open source website (https://app.lizardbyte.dev/Sunshine/) has
in VirtualBox projects that use the same protocol. various DEB and RPM packages for different Linux
for simple
The Moonlight website (https://moonlight-stream. distros and platforms in addition to Flatpak packages.
desktop sharing.
org) sells the project a bit short because it doesn’t There are some downsides to the Flatpak version
Performance
was good. make it clear that the client can operate without the we tested. First of all, it pulls through more than 1GB of
proprietary Nvidia software on the server end. We’d files to complete the installation, quite a bit more than

60 LXF314 May 2024 www.linuxformat.com


Game streaming TUTORIALS

Sunshine is configured using its web interface. Note that you don’t Moonlight’s configuration options. Our first port of call is usually to match the
have to be logged into this to connect to Sunshine from Moonlight. resolution with that of the device we’re using.

a DEB installation. More importantly, Flatpak uses Sunshine is running, its configuration pages should be
sandboxing to lock off system resources from a accessible at https://localhost:47990/. You can also
program that uses it. In the case of Sunshine, we found get to this page by selecting the Open Sunshine option Adding
that many of the examples from the documentation when right-clicking on the status area icon. There is a Moonlight to
wouldn’t work when we tried to expand the system small wrinkle at this stage because most browsers an Amazon
beyond basic desktop sharing. We could run Steam complain that the site is not secure. This is because, Firestick
over desktop sharing like any other application, but at the time of writing, the Sunshine server does not simply involved
we couldn’t launch Steam directly from Moonlight. produce a valid SSL certificate. However, as this is a searching for
the app in the
Flatpak is worth considering if you simply want server running on your own computer on your own
Applications
desktop sharing and an easier installation experience. network, it is safe to ignore the warning and continue menu. It worked
Go for DEB or RPM if you want to be able to expand to the configuration web page. well on a TV, but
the system in areas such as directly launching software With what you have so far, you should be able to it’s the user’s
and other things that require access to the overall connect to the Sunshine server on one machine with job to connect
system, such as directly launching emulators. the Moonlight client on the other, so you can view and the needed
We installed the DEB version to Linux Mint and control the desktop of the other computer. input devices.
Ubuntu-based systems, to explore everything the Start by discovering the IP address of the Sunshine
system was capable of. This wasn’t completely server. How you do this depends on your distribution,
straightforward because we had to manually add some but what works on nearly all Linux distros is to issue
dependencies (libmfx1, libboost-log1.74.0, libboost- the command ip a . This is the line of interest on a
program-options1.74.0). If you go this route, Sunshine Linux Mint computer:
can tell you if there is an updated version available, and inet 192.168.0.22/24 brd 192.168.0.255 scope global
you have to fetch and install it manually. dynamic noprefixroute eno1
Once you have installed Sunshine, it should be Typically, you’re looking for a number in the form
runnable from the standard desktop launcher. When of 192.168.x.y. The first variable part, x, is normally
you do this, the server configuration and management either 1 or 0; y is the number that the computer has
tool opens in a browser tab, where you can enter a been assigned on the network. The first part of the
password and username. You can launch Sunshine IP address tells network devices that this is an
from the command line, which causes it to spew forth address on your internal network rather than out
some useful logging information. However, when the on the internet. There are other schemes but most
web interface is running, it has a Troubleshooting tab routers default to 192.168 for this part. In the example
with a fully searchable logging section. above, the complete IP address for the server
See the official documentation (accessible through computer is 192.168.0.22.
the https://github.com/LizardByte/Sunshine site) if
you want to autostart Sunshine on your computer. Orbital pair
Sunshine is actually implemented as a service, and Run Moonlight on the other computer. You’re greeted
you have to copy the example from the docs. Having with an empty machine selection screen. Add a new
configured this, as per the docs, you can start Sunshine server by clicking on the + icon on the bar at the top of
with systemctl --user start sunshine and enable
automatic startup with systemctl --user enable
sunshine . However, it’s better to manually launch
Sunshine while you’re still testing it and setting it up.

Moon and the server


We found that, across different machines and
configurations, Sunshine and Moonlight have a
good chance of working adequately with the initial Moonlight’s statistics overlay is a useful tool to work out how good your setup
configuration. Speaking of configuration, once actually is. It’s invoked with Ctrl+Shift+Alt+S.

www.techradar.com/pro/linux May 2024 LXF314 61


TUTORIALS Game streaming

the window. When prompted, enter the IP address


of the server that you have just obtained.
The Android Next, you are prompted to pair the computers. This
version of is a security feature so random computers on the
Moonlight network can’t suddenly take control of each other. The
(download computer running Moonlight displays a PIN. Enter this
from Google into the Sunshine server by going to the web config
Play Store) page and selecting the PIN tab. Apologies if you have
is difficult to jog upstairs to enter this into your other computer.
to use on a This takes you back to the Computer selection
phone because
screen. Click on the big icon for the server you’ve Running Moonlight on an Android phone. This version of Moonlight can
of the small
screen, and is
just added. This takes you to another set of icons pass mouse movements and overlay a game controller.
more suited (launchers). We’ll get into more detail about configuring
to tablets, these launchers and creating custom ones later on. the developers couldn’t risk choosing combinations
handhelds and that are already defined on the server or client
Chromebooks. Staring at the sun machines. Thankfully, they are easy to remember
Select the first launcher (Desktop) to make a regular because they all begin with Ctrl+Shift+Alt. So, for
desktop connection. If this works properly, you should example, Ctrl+Shift+Alt+x switches the client window
now be looking at the desktop of the other computer between full-screen and windowed mode. In windowed
(including sound). Sure enough, if you move the mouse, mode, Alt+Tab works on the computer you’re using in
it should move the mouse pointer on the Sunshine the normal way. So, remember this one keyboard
server desktop. It’s a good idea at this point to launch a combo, if none of the others, so that you can use it
reasonably complex app such as a web browser on the to switch away from the Moonlight window.
server to fully test that everything’s working properly. Ctrl+Shift+Alt+q exits the sharing connection,
To navigate while using Moonlight, you need to learn returning you to Moonlight’s launcher icons. Something
a few keyboard commands to control the server. These interesting happens when you do this because the
are a bit longer than the ones you might be used to as desktop of the server machine is still running. So, you
could exit that connection and then immediately switch
to another machine, which could be a desktop, a laptop
MOBILE MOONLIGHT or a mobile device. If you’re running a game, don’t
forget to pause it while you move between computers.
Controlling a fairly powerful desktop PC running Linux Mint from a There are options within the Moonlight and
repurposed Chromebook running Ubuntu (Intel N4500, two cores Sunshine configuration sections to control how the
@ 2.8GHz) over Wi-Fi offered a great experience for desktop apps. super key and other key combinations are handled in
Initially, the picture wasn’t completely clear because the screens terms of what is passed to the host machine.
were different sizes and the resolutions didn’t match. We improved
the clarity by setting the resolution in Moonlight’s settings to the Moon launch!
native resolution of the laptop (1,366x768). To scale the interface up So far, we’ve been using the first launcher (Desktop),
and improve clarity further, we changed the resolution of the server but let’s take a look at what these launchers can do.
machine, using its display settings. Moonlight and Sunshine handled Once you double-click on a computer in Moonlight’s
that without dropping the connection. window, you are taken to a selection of launchers, the
We’d have been happy using this to do word processing or browse first of which is Desktop. What each of these launchers
the web. Some things were faster than we’d expect from that laptop, does is establish the connection between the client
as the host machine had more processing power and memory. A few and server computers. Then, the configured actions
things that required a lot of screen updates were less fluid, though. are carried out. These actions are defined using
For gaming we were able to get nearly 60 FPS at an acceptable Sunshine’s configuration. This is the best scheme
quality. There was some slight latency, but depending on the style of because it means that all machines that can access a
game and how sensitive you are to such things it might be fine. particular Sunshine server have access to the same
launchers, meaning far less setup work.
For convenience, we created a launcher to launch
the driving/exploration game Under the Sand, a game
we had installed on Steam, and it serves as a good,
typical example of directly launching a Steam game.
Launchers are created by visiting the Applications
tab in the Sunshine configuration page (right-click
on the Sunshine icon in the control panel and select
Open Sunshine or visit https://localhost:47990/).
Select the +Add New option. Add Under the Sand
in the Application Name field. For various reasons, a
Steam game has to be added as a detached command.
To get the command we needed, we typed the name of
the game into the application launcher of our desktop
and then right-clicked to edit that entry. It turned out
Running Moonlight on a laptop means that you can take your main desktop with you. that the command that launches that game was steam
steam://rungameid/1062960 . We cut and pasted this

62 LXF314 May 2024 www.linuxformat.com


Game streaming TUTORIALS

into the Detached Command field and pressed the +


icon to add it. From this point on, we were able to BAKING Pi WITH MOONLIGHT
launch Under the Sand directly in the launcher.
We found that the option to launch Steam in Big To install Moonlight on a Pi
Picture mode (full-screen for TVs) didn’t work the way (a Pi 400 running Raspberry
we wanted. We edited that launcher (in the Application Pi OS with a wired Ethernet
tab of Sunshine’s configuration), deleted the existing connection), we followed the
Detached Command entry and replaced it with /usr/ instructions on the website,
bin/steam steam://open/gamepadui . We set Big which involved first updating the
Picture mode to default to full-screen in Steam itself. firmware of the Pi and then
copying and pasting a line of
Lighting up emulators code into a command terminal.
The server machine had the emulator front-end This gave us a version of A Moonlight/Sunshine server can give
RetroArch installed, and we fancied being able to Moonlight that looked identical you access to applications that wouldn’t
normally be viable on a Pi.
launch it directly. To do this, we created a new entry to that on other platforms.
with RetroArch in the Application Name field. As For desktop sharing, the performance was very good, and there
before, we discovered the launch string from the were times when we could almost begin to forget that we were
application launcher: using a remote connection. As ever, setting the resolution to the
/usr/bin/flatpak run --branch=stable --arch=x86_64 native resolution increased the crispness of the screen. The black on
--command=retroarch org.libretro.RetroArch white text in a word processor, for instance, looked perfectly crisp.
This time, we cut and pasted it into the Command Things weren’t as impressive when it came to gaming. The setup
field. Sure enough, it worked as expected and the was usable once we had limited the frame rate to 30fps and set
game controller was transmitted over the network the bitrate to 20Mb/s, but it felt like a poverty setup for fast action
connection properly. This gave us a setup where all we games. When we switched to strategy game Frostpunk, things
had to do was select the RetroArch icon on any device improved and the detail of the graphics and text was excellent.
with Moonlight installed to cause RetroArch to open
up full-screen on our device. Of course, in reality, it was
running on our desktop computer. from Moonlight and re-adding it using the external IP
However, we had to redefine this controller layout address of our router. We obtained this IP address by
in RetroArch as the axes and buttons are translated searching Google for a site that showed our external
differently compared to using the controller directly on IP address (https://nordvpn.com/what-is-my-ip/ in
that machine. As the launch command was added to our case). We were using quite a fast fibre connection,
the Command field rather than Detached Command, but we were pleasantly surprised by the performance,
when we exited this game, RetroArch was closed particularly for desktop sharing.
down on the host machine correctly. Note that As with any type of server, you have to use your
Moonlight refers to all virtual connections that are own judgement as to the safety of setting it up for
reached via the launcher screen as games even if online use via the internet as opposed to using it on
it’s a desktop share or similar. your local network. We couldn’t see any problems with
It’s possible to get a bit more complicated as the arrangement because before a device can connect
Sunshine enables you to add chains of commands or to your Sunshine server, the user would have to
commands that are called when the ‘game’ is exited. manually add a four-figure PIN to the PIN tab in the
Basically, if you can start or stop something on the host Sunshine server. By default, this can’t be accessed
machine by running commands, you should be able to from machines outside of your home or office network.
get it running through Sunshine and Moonlight. As with all server software, if there were a security
flaw that hackers could exploit, it’s possible that they
Shining online could get some access to your network and devices.
The Sunshine server comes with Universal Plug and Checking around online, it looks like Sunshine is a
Play (UPnP) support built in. This can carry out the popular piece of open source software, and we couldn’t
port forwarding setup on your router to connect an find any complaints about its security features.
application to the internet automatically. However,
To make Sunshine
we had difficulty getting this working, and searching available over
around online, we found that we weren’t alone. What the internet,
did work was setting up the port forwarding ourselves. look up the
To do this, we first switched off UPnP support port forwarding
instructions for
(Configuration > General tab in Sunshine’s settings).
your brand and
We found the correct port settings in the Advanced model of router.
tab of Sunshine’s configuration, where they are listed.
The snag is that this means setting up five port
forwarding rules in the router. See the instructions
for your broadband router for how to set up port
forwarding. However, once we did it, sure enough, we
were able to add our Sunshine server by deleting it

STREAM US TO YOUR DOORSTEP! Subscribe now at http://bit.ly/LinuxFormat

www.techradar.com/pro/linux May 2024 LXF314 63


TUTORIALS Emulate the MK14

EMULATION

Reviving the MK14


retro home computer
Mike Bedford uses emulation to learn about Sinclair’s first sub-£100
computer, which predated the better known ZX80 by three years.

he Sinclair ZX80 went on

T sale in 1980 at £99.95, or


£79.95 in kit form. In so
doing, it was responsible, in no
small part, for kick-starting the
British home computing revolution
OUR of the ’80s. However, it doesn’t tell
EXPERT the whole story. Nor is it correct to
Mike Bedford say, as is often suggested, that the
hadn’t even ZX80 was the first computer to
thought he be offered for less than £100. That It might have been the first sub-£50 computer, but the MK14 was also one of the most basic.
might one day honour goes to a much lesser-
own a computer known British computer called the MK14, our subject and some earlier US machines had Intel 8080s. Not
by the time the here. It’s probably quite different in many ways from the MK14, though, which had a SC/MP. Pronounced
MK14 appeared. anything you’ve seen before, and it was nothing like Scamp, this little-known processor from National
That makes it that better-known home computer we referred to Semiconductor was an 8-bit design, which was clocked
no less of an above. But it’s no less a part of our computer heritage, at 4.4MHz on the MK14.
interesting so we thought it would be interesting and informative While this figure is similar if not higher than the
diversion for to delve into its unique features. This isn’t just talk, clock speeds of most of the early ’80s home
him, though. though, so if you fancy getting some hands-on computers, a clock figure is a notoriously poor

CREDIT: Steve Elliott, CC BY-SA 2.0, www.flickr.com/photos/jabberwock/4752663437


experience of the MK14, we show you how to do measure of performance. Indeed, the SC/MP
that via emulation. compared unfavourably to many of its competitors –
see box (opposite) for more details. We should also
Introducing the MK14 point out that the MK14 didn’t have a case; it was
Launched in 1977, the MK14 cost £39.95, making it purely a circuit board. In addition, it didn’t include the
half the price of the ZX80 in kit form. This is an entirely necessary 5V power supply, which you’d have needed
appropriate comparison, though, because our quoted to buy separately – just like a Raspberry Pi!
price of the MK14 is also for a self-assembly kit. In fact, Input and output on the MK14 were basic – any
the MK14 was only ever made available as a kit of 31 expectations of a keyboard and video display would
parts, including the circuit board, all of which had to be have led to disappointment. Input was via a 20-key
soldered together. The company responsible for the pad with keys for 0-9 and a-f for hexadecimal entry,
MK14 was Science of Cambridge who, in the fullness plus various functions. Reports indicate that the
of time, became Sinclair Research of ZX80, ZX81 and keypad was dreadful from an ergonomic viewpoint.
A version of ZX Spectrum fame. Output was to a tiny eight-digit seven-segment LED
Tiny BASIC has
The specifications of computers of the ’70s and display capable of displaying hexadecimal numbers.
been written
for the SC/
the early ’80s tend to be eye-openers because of the Expansion was available, but limited. On-board
MP – it’s called almost unbelievably small memory capacities and expansion allowed the RAM capacity to be increased
NIBL. So, we processor speeds. The MK14 was no exception, having to 640 bytes and an I/O device to be added, thereby
might wonder 256 bytes of RAM and 512 bytes of ROM. This non- giving 16 I/O pins. A few off-board expansion options
if it can run volatile memory held the monitor program, which were also available. An add-on memory board allowed
on a suitably allowed programs to be entered and executed, and the RAM capacity to be increased by 4K, and the
expanded MK14, the results displayed. Where the MK14 differed from ROM capacity by 16K. A cassette interface allowed
with memory almost all other microcomputers of the time, though, programs to be stored on an audio cassette tape,
expansion and was its processor. The soon-to-be-launched home although the speed was reportedly pedestrian at an
VDU cards.
computers of the ’80s virtually all had Z80s or 6502s, estimated four characters per second. And finally, an

64 LXF314 May 2024 www.linuxformat.com


Emulate the MK14 TUTORIALS

expansion card, which cost almost This online


as much as the MK14, permitted a emulator can give
you an inkling of
VDU (visual display unit) to be used
what is was like to
as an alternative to the seven- program an MK14,
segment LED display. It could laborious entry
display 16x32-character text with of hexadecimal
only upper-case letters, or 64x64 numbers and all.
pixel graphics, all in monochrome. It
output a signal to a TV.
Despite this lacklustre
specification – at least by today’s
standards, or even the standards
of the early ’80s – the MK14 was
a big seller at a time when home
computers were unheard of.
Certainly, it didn’t sell nearly as well
as the later Sinclair computers, but
we can’t help but feel that its 15,000
reported sales were a harbinger of
things to come.

Emulator options
We found two options for emulating the MK14 in MK14’s display. And if you deselect ASCII, then the
software and online. A software solution – at least in lower display disappears.
theory – is the open source ZEsarUX (https://github. If you want something as close as possible to the
com/chernandezba/zesarux), which is available for appearance of the MK14, the ASCII display would
Linux. Generally thought of as an emulator of the be your best choice. However, if the SVG version is
classic Sinclair machines, it also includes support for displayed, you also get several status LEDs. These
the MK14, but not in our experience and there’s no weren’t available on the MK14, so you might consider it
documentation to help. cheating to use them, but they could make debugging
Instead, an online emulator would seem entirely easier. If you do decide to ignore them, though, this
appropriate for your brief foray into programming the status information was written to various memory
MK14. And the good news is that we found one that locations when execution returned to the monitor The MK14
does the job admirably at www.dougrice.plus.com/ program. This is described in the original MK14 wasn’t the only
dev/seg_mk14.htm. We did have to carry out a bit of Training Manual, which you can find at https://bit.ly/ minimalist
computer based
detective work on the user interface to get the best lxf314manual. Also on the subject of documentation,
on the SC/MP.
from it, though, so here’s what we discovered to give another useful resource is National Semiconductor’s
In 1976, Bywood
you a helping hand. SC/MP Programming and Assembler Manual, which is Electronics
First of all, by default two versions of the 8-digit available from https://bit.ly/lxf314scmp. released the
seven-segment display are shown, the upper one Next up is the keypad and, again, there are two £56 SCRUMPI
having the red segments on a black background, the variants, arranged side by side. The left-hand one kit. Its user
lower one on a white background. The status of these claims to be for touchscreen use, and the right one for interference
are controlled by the two checkboxes labelled ASCII use with a mouse. However, while we didn’t try the comprised just
and SVG against Display Using. Initially, only SVG is emulator with a touchscreen display, we found that toggle switches
checked and only the lower display reflects what would both worked with a mouse. And if two options are and single
(not seven-
have appeared on the MK14’s display. If you also select good, surely three are better. And that third option
segment) LEDs.
ASCII, then the upper display also starts to reflect the involves using keys on your keyboard, but that only

NATIONAL SEMICONDUCTOR SC/MP


Back in the late ’70s, Intel and the SC/MP was its first single- couldn’t discover just what competing microprocessors
Motorola were the big boys in chip microprocessor. the SC/MP cost. However, employed parallel designs
the microprocessor market, Also known as the since the entire MK14 kit cost for their chips’ ALUs. The
with Zilog (Z80) and MOS INS8060 and INS8070 in the only £39.95, it must have upshot of this was that the
Technology (6502) catching second and third generations been significantly less than SC/MP was slower than most
up. But those were the days of the chip, SC/MP was an the Intel 8080 or Motorola other 8-bit chips of the era at
of diversity. Processors were 8-bit design. Nothing new 6800, both of which had a the same clock speed. One
produced by countless there for the ’70s, but the retail price of $360. What we source puts the 4.4MHz
companies, some forgotten SC/MP was designed to be a can say with more certainty, MK14 capable of 0.2 MIPS.
and most others no longer low-cost chip. In fact, those though, was that to achieve A similar speed 6502 would
in that market. One such curious mnemonics stand its low cost, the SC/MP had a touch 1.9MIPS the 68000
company, now defunct, was for Simple Cost-effective bit-serial ALU (arithmetic and was capable of 1.4MIPS but
National Semiconductor, and MicroProcessor, although we logic unit). By way of contrast, was a full 16-bit CISC.

www.techradar.com/pro/linux May 2024 LXF314 65


TUTORIALS Emulate the MK14

A PCB and
ROM chips from
JM Precision enable you BudgeTronics’s
to build a replica MK14, like low-cost MK14 hardware
this one, if you buy a few emulator uses a PIC chip
other components. instead of an SC/MP.

works if you first click in the yellow box against Type op-code – that is, AA hexadecimal – into the
Keys Here. Note that, in addition to the 20 keypad keys, processor’s accumulator. Next comes XRI, which
there appears to be a 21st key labelled RESET. This stands for XOR Immediate, XOR being exclusive OR. It
actually emulates the MK14’s reset button, which was a XORs the value in the byte after the op-code – that is,
pushbutton separate from the keypad. 55 – with the value in the accumulator, the result being
stored in the accumulator.
SC/MP assembler On to the ST instruction, which stands for Store.
So, now you know your way around the emulator, it’s Its purpose is to store the value in the accumulator to
time to try your hand at entering and executing some the memory location that is obtained by adding the
code, and perhaps graduate to writing your own code. contents of the next byte, in this case 2, to the program
Given the MK14’s modest specification, and the counter. Since the next and final instruction is just a
limitations imposed by that hexadecimal keypad, you single byte long, this causes the value in the
probably won’t be surprised in the least to learn that accumulator, which is the result of the program, to
Basic wasn’t an option. Instead, programming was appear immediately after the program code. And finally
at a much lower level. It wasn’t even possible to enter we have that final instruction, XPPC, which exchanges
code in assembly language– instead, it had to be the contents of the program counter with that of a
programmed in machine code. This meant that you specified pointer, in this case pointer 3. Even though
had to think in machine code or, alternatively, you had the SC/MP didn’t have an instruction to call and return
to assemble your assembly language source code by from a subroutine, it could be implemented in software.
hand, a notoriously error-prone process. Depending on And, on the MK14, the XPPC 3 instruction caused
how much you hanker after the true MK14 experience, control to return to the monitor program.
you might think you could miss all this out by using an And finally, before you enter and run the code, let’s
assembler, albeit not on the emulated MK14. We didn’t follow it through by hand to see what you should
manage to find one, though, at least not one for Linux, expect to see. After the LDI instruction has executed,
so there’s a possible project for you. the accumulator contains AA. The XRI instruction then
As a first exercise, we suggest you enter and XORs that AA in the accumulator with 55. If we point
execute the first program shown on the emulator’s out that the binary for AA is 10101010 and the binary
web page, and it’s trivially simple. Here’s the code, as it for 55 is 01010101, it should be clear that, after this
would appear in SC/MP assembly language: instruction, the accumulator will contain FF – that is, CREDIT: http://jmprecision.co.uk, Henk Verbeek, www.budgetronics.eu
START: LDI 0AA 11111111. The web page describes exactly what keys
XRI 55 you need to press to enter that code, starting at
ST 2 address 0F22, and to execute it. After it’s executed,
XPPC P3 the monitor displays the address and contents of the
To start, a couple of introductory comments. First, location after the end of the program. What you should
we’ve given the first instruction a label, specifically see, therefore, is 0F29 FF . The key sequence to enter
START, even though it’s not really needed because it’s and execute the code, as shown on the web page, is
The memory
not referred to by any other instruction. However, such fairly self-explanatory.
capacities of
early micro-
labels will be needed in more complicated programs, There are additional and more complicated
computers, so we’ve added it here so you can recognise labels in programs on the web page to try, but the source code
like the MK14’s the later programs. And second, the XPPC instruction isn’t shown for most of them. Nevertheless, while it’s
256 bytes, will is followed by P3, which is the syntax used in the still not too much more complicated, you might like to
be quite an SC/MP manual, but the MK14 manual uses just 3 try the second example, which writes directly to the
eye-opener instead. We’re not sure whether both are valid or segments of the final digit of the seven-segment
to today’s whether different syntax was used in different display. And if you can forgo the experience of entering
programmers. assemblers. Since you’re probably not going to be endless sequences of two hexadecimal digits followed
After all, that’s using as assembler, though, it’s a moot point. by the mem key, there’s an easier way to enter and
just a quarter
Now to the instructions. The first instruction is LDI, execute the code. Just click on the Setup button below
of a billionth of
which stands for Load Immediate. Its purpose is to load the program listing to enter the code into memory, and
a gigabyte.
the value stored in the byte after the instruction’s then click on Go. Running the second example causes

66 LXF314 May 2024 www.linuxformat.com


Emulate the MK14 TUTORIALS

the final digit to show a pattern, as defined by the


program, which doesn’t correspond to any DEVELOPMENT KITS
hexadecimal digit. Note that the program doesn’t
cause control to return to the monitor program The MK14 was intended as an enthusiasts’ computer, even though
because that would immediately cause the entire it seems to have more in common with a development kit, aka an
eight-digit displayed to be overwritten. So, to return to evaluation kit. Indeed, SC/MP manufacturer National Semiconductor
the monitor you have to press Reset. sold a development kit called the SC/MP Introkit, which was very
If you want to try other examples, there are several similar to the MK14. So, what do we mean by a development kit?
in the MK14 manual, but they do tend to be quite long. These kits are sold by semiconductor manufacturers to allow
To get to grips with SC/MP programming, therefore, engineers to get some experience of their products. This will, it’s
you might be better devising your own examples, hoped, pave the way to companies building their own designs using
so you can start with something simple and build up. If the core processor or microcontroller. Ease of use didn’t have the
you’re lacking inspiration, how about building on our same importance as with traditional home computers, and these
previous sample code to do more than just XOR? You kits often commanded a high price tag. These two facts don’t
could, for example, also carry out OR and AND altogether paint a good picture, so why might you be interested in
functions, and even some simple arithmetic, writing development kits? We’ll give one example that might just persuade
the results to several consecutive memory locations you to investigate.
before exiting. We recommend, though, that you PIC microcontrollers from Microchip are cheap and widely
change the two values of AA and 55, these numbers used in industry. They also have a following among enthusiasts.
being particularly uninspired, since the two values But you’re not going to find a ‘proper’ computer based around a
XORed give the same result as if they’re ORed. PIC chip. So, either you have to jump straight into building your
The precise way in which the contents of memory own design, or first get some experience using a development
locations are inspected and edited – both of which you kit. Fortunately, the high price tag doesn’t always apply. To quote
need to do – are perhaps not obvious from what we’ve Microchip, “The PIC32MM Curiosity Development Board is a
seen so far. So, consult the MK14 manual first. demonstration, development and experimentation platform based
on the PIC32MM0064GPL036 low-power, low-cost microcontroller.
Hardware options The board has a built-in programmer/debugger and provides all
The online emulator we’ve seen so far seems to of the hardware necessary to get started developing a complete
emulate the inner workings of the MK14 just like the embedded application.” This board and similar for other PIC chips
original, and the graphical representation of the keypad costs from around £30.
and display are good enough. But if you want the real
retro experience, nothing can beat using some real
hardware. You could buy second-hand MK14s, but A cheaper and more practical solution, albeit less
they’re rare and expensive. We looked online and authentic, is to build a single-board computer that
CREDIT: AquariaNR, CC BY-SA 3.0, https://commons.wikimedia.org/wiki/File:SC-MP_ISP-8A_500D_DIL.jpg

couldn’t find any for sale, but reports suggest that, if looks like an MK14, or at least has a similar keypad
you can find one, you’d pay between £500 and £700. and display, but uses different components. Indeed,
That’s surely only for the serious collector. There are these have been built, and some are available for sale.
lower-cost options, though, as we’re about to see. Typically, the SC/MP is replaced by a more modern
First up, we note that bare PCBs from which you microcontroller that’s programmed to emulate the
could build your own MK14 are available for around SC/MP’s instructions and the operation of the MK14’s
£25. The potential snag, though, is getting hold of the monitor program. One such product is provided by
obsolete parts to solder on to these circuit boards, BudgeTronics (www.budgetronics.eu) and it costs just
most notably the SC/MP, the ROM containing the €45. It uses a PIC microcontroller, so the board doesn’t
monitor program, and the 2112 RAM chips. However, look much like an MK14 of old but, crucially, it has a
this doesn’t seem to be as much of a problem as we’d similar-looking keypad, and it has an eight-digit seven-
feared. A PCB that’s an exact replica of the original segment LED display. And what it lacks in not looking
MK14 circuit board is available from http://jmprecision. like an MK14 it makes up for in usability – that display is
co.uk. Also available from the same source is a pair of much larger than the tiny one on the original MK14.
ROM chips, pre-programmed
Housed in a 40-pin
with the monitor code, and they
DIP package,
say that all the other parts are the National
available. Indeed, we can confirm Semiconductor
that SC/MPs (in the guise of SC/MP looked
INS8060) and 2112s are much like its rivals
on the outside.
available. If you shop around,
we estimate that you could
build a working MK14 in this way
for not much more than £150.
And it just so happens that, in
real terms, this is about £70
cheaper than it would have cost
to buy a real MK14 back in 1977.

IMPROVE YOUR LINUX SKILLS Subscribe now at http://bit.ly/LinuxFormat

www.techradar.com/pro/linux May 2024 LXF314 67


TUTORIALS CAD coding

OPENSCAD
Credit: http://openscad.org
Part two!
Catch up by

Clever CAD coding


ordering back
issues on
page 58!

for clients and cigars


Hungarian boy genius Tam Hanna tidies up his underground
bunker’s cigar corner with a bit of creative 3D printing.

he experiments performed in last month’s

T tutorial proved that OpenSCAD can create


all kinds of models consisting of primitive
geometries. This is a complete understatement – in
this instalment, we are modifying our approach to use
2D/3D-combinatorial techniques.
OUR When applied correctly, they permit the creation
EXPERT of highly intricate models with what, in practice, could
Tam Hanna’s not be a more straightforward set of base geometries.
minimal creative While this might initially sound confusing, please take
capability makes our word that nothing is quite as complex as it seems.
him ideally Incidentally, the object created in the following
suited to steps can be, and has been, used for practical
teaching purposes. When Tam needs to provide a set of cigars
all kinds of or candy sticks to his clients, these 3D-printed objects The yellow triangle is the preview rendering; the flat dark triangle is
workarounds for not only catch attention but also serve as a great the final rendering from the same code.
problems that first demonstration of the additive-manufacturing
require the use capabilities of his company. satisfying rendering. Our next job involves the creation
of creativity. Should you continue to work directly from of three instances of the triangle:
the excursus in the last issue, click the menu option r = 4;
File > New File to start a new design. For reasons of translate([-0.866*r,-0.5*r])centeredtri();
simplicity, we will start afresh – our first victim, then, is translate([0.866*r, -0.5*r])centeredtri();
the following bit of code: translate([0, 1*r])centeredtri();
centeredtri(); Given that this object should become a vase, its
module centeredtri(){ dimensions might need to be modified depending on
polygon([[-0.866,-0.5], [0.866, -0.5], [0, 1]]); the intended load out. Due to this, the sequence r = 4;
} is used to introduce a variable; change needs to be
The core of the method is an invocation of polygon done only in one place if the multiplication factor
with an array of three points; the mathematically applied to the six coordinates in the three translate
inclined will quickly recognise that it creates an calls needs to be modified. In practice, this yields
equilateral triangle. significant time savings.
Using the module syntax permits the geometry
to be boxed up for use – the invocation centeredtri(); The Play-Doh press
motivates the parser to create the geometry contained Attempting to export a 2D-only rendering using the
in the module. STL button yields the error: ‘Current top level object
Interestingly, the screenshot (above-right) shows is not a 3D object.’ There must be something in the
that performing a preview and the production OpenSCAD syntax to transform the two-dimensional
rendering now yield entirely different results. objects into a three-dimensional representation.
For now, it suffices to say that methods such as In the following steps, space constraints limit us
polygon – incidentally, quite a few additional ones can to the linear extrude operation; Tam’s book with the
be found in the documentation at https://en.wikibooks. ISBN of 978-1-907920-99-8 provides a detailed
org/wiki/OpenSCAD_User_Manual/2D_Primitives – overview of the various possibilities provided. For
create two-dimensional objects. When a preview the first trial, we invoke the operation as follows:
rendering is done, the parser assigns them some linear_extrude(20)
height in the direction of the Z axis to yield a more {

68 LXF314 May 2024 www.linuxformat.com


CAD coding TUTORIALS

r = 4; As a first test, we will thus use the


translate([-0.866*r,-0.5*r])centeredtri(); benefits of parameterisation to
translate([0.866*r, -0.5*r])centeredtri(); modify the object:
translate([0, 1*r])centeredtri(); linear_extrude(100, scale=3,
} twist=180)
The most basic invocation requires a numerical {
parameter specifying the height of the extrusion. r = 30;
Furthermore, the chained parameter is the actual Sadly, rendering this does not
geometry to be extruded. yield the expected result. The size
Applying the operation to our above-mentioned of the triangles, being 1×1, produces
constellation of triangles, this then yields the results a tiny object.
shown in the screenshot (right). Solving this problem does not
An extrusion operation creates multiple copies of require modifications to the actual
the 2D object above one another, providing them with coordinates. Instead, OpenSCAD
a three-dimensional spatial representation. provides the scale operator, which
Logic dictates that these operations don’t behaves similarly to the translate
necessarily need to work on equal copies of the operator used to move objects
objects. Advanced parameters permit OpenSCAD to around the screen. It, however,
use rotational or scaling operations on each element; scales the size of the target
while a rotation obviously rotates the particular elements up and down.
objects, scaling operations increase or decrease the Given that we want to scale uniformly along the X The first
size of the individual copies. and Y axes, our invocation looks like this: proto vase
has been
As a first experiment, we will slightly reduce the module centeredtri(){ successfully
radius and apply the scale parameters: scale(10) erected.
linear_extrude(20, scale=3) polygon([[-0.866,-0.5], [0.866, -0.5], [0, 1]]);
{ }
r = 3; In practice, it is also allowed to pass in a vector
... describing the individual amount of scaling to be
In our case, setting a parameter value of 3 informs applied to the axis. Values larger than 1 obviously lead
OpenSCAD that the final object to be placed on top to an increase in size, while values smaller than 1 lead
must be three times as large as the one that was used to a decrease.
at the start of the process. At this point, one problem remains: a careful look
In theory, you could also pass in a value smaller than at the generated object reveals it to consist of clearly
one, thereby reducing the size of the objects. This can visible triangles. This is a limitation not dissimilar to the
be used to create pyramid-like shapes.
After that, we will add some twist, as per the
following code:
linear_extrude(20, scale=3, twist=180)
{
r = 3;
Twist instructs OpenSCAD to rotate the geometry
copies used in the linear extrusion process. Passing in
180 leads to a rotation of 180° – this is best seen in the
screenshot showing the result (right), which – by taking
a look at the object from the top – indicates how the
triangles move.

Scaling operations.
Careful readers of last month’s tutorial on OpenSCAD
may worry about the small dimensions – if the
intended size is 100mm, passing in 10 does not work. Combining scale and twist leads to modern-art-like results…

TAM’S TOP THREE TIPS!


Use Stack Overflow Beware the Moiré effect. Go multicore!
Just in case you’re wondering where A careful look at the renderings reveals By and large, OpenSCAD is an entirely
the triangle coordinates came from, weird, snake-skin-like distortions on the single-threaded affair, so can’t take
we didn’t break out the Parker pen and model. This is a common problem in full advantage of your multicore CPU.
scientific calculator. Instead, a quick computer science known as the Moiré Developers have, however, been working
Google search led to https://bit.ly/ effect, and it does not affect the model to address this limitation for quite some
lxf314centre – this page on the Stack geometry when printed. More info can time. You can find an overview of the
Overflow website provides detailed be found at https://en.wikipedia.org/ current state of the proceedings at
info and ready-to-use coordinates. wiki/Moir%C3%A9_pattern. https://bit.ly/lxf314hack.

www.techradar.com/pro/linux May 2024 LXF314 69


TUTORIALS CAD coding

HARNESS THE POWER OF THE CENTER OPERATOR.


Creating the foot by subtraction operations, use Sadly, the default which places the coordinate
subtracting a cube and very large sizes for the cube – positioning of objects 0-0-0 in the middle of the
some target geometry is this way, changes in the size generated is less than ideal object. To see how this works,
a surprisingly common of the victim geometry do not for cutting operations. This take a look at the images
operation in the world of directly require a modification can easily be avoided by using below, which compare
OpenSCAD. When doing such of the subtractor. the center object parameter, two invocations.

cube(10) cube(10, center=true)

$fn parameter discussed last month – to limit the The first step is creating a module called vase that
amount of computation required to finalise the model, will contain the – so far freestanding – markup for
the number of copies placed above one another is creating the vase structure. After that, the following
limited. Fortunately, the slices parameter permits the bit of code is used:
alleviation of this situation: scale(1.1)hull()foot();
linear_extrude(100, scale=2, twist=180, slices=1000) vase();
{ module foot()
r = 30; {
Selecting the correct number of slices is best done difference()
via computation; in the case of the 3D printer used to {
print the object, the smallest sensible layer height is vase();
0.1mm. Dividing the intended height by the number of translate([0,0,101])cube([200,200,200], center=true);
layers yields the parameter shown here. Incidentally, }
the rendering shown in the screenshot (opposite page, }
top-left) indicates that smoothness has dramatically module vase()
improved. As always, creating excessive amounts of {
detail should be avoided – it does nothing except ...
waste CPU time. }
While the markup is quite long, it is actually very
A firm bottom simple. Firstly, the module foot uses an enormous cube
One of the more painful experiences of people who to cut out a small slice of the entire vase structure.
undergo a computer-first learning cycle involves In the next step, the results are fed into the hull
the limitations of real-world processes. A common operator – hull is a volumetric operator that wraps the
example would be PCB layout software, which can geometry in its entity.
be configured to create printed circuit boards with Finally, the resulting object is scaled to create the
geometry so small that they will remain out of structure shown (opposite page, top-right).
commercially viable PCB production for at least In the next step, a similar approach must be
a decade. taken for the lid. In that case, however, the hull
Our vase is similar in its current state – it would operator is slightly critical – it would create a solid
create three objects that would fall apart. Fortunately, plane. Fortunately, this problem can be solved by
this problem can be solved by printing a base. creating arbitrary geometry for the free space. This
In theory, this base could be created from a more- leads to the following structure:
or-less arbitrary geometric solid. Allow us, however, to scale(1.1)hull()foot();
suggest a slightly different approach that showcases vase();
the power of the OpenSCAD description language. difference()

70 LXF314 May 2024 www.linuxformat.com


CAD coding TUTORIALS

Things look much smoother after the adjustment. This stand will improve the robustness of the design.

{ which leads to a 10-OpenSCAD-unit-high basic


hull()roof(); appearance of the generated text.
linear_extrude(2300, center=true)rotate(180)scale(4.5) Sadly, the rendering engine does not provide a way
centeredtri(); to set the font width. Positioning thus has to be done
} by trial and error – for our vase object, the following
modification led to a working model:
Generating text translate([-10,-5,0])linear_extrude(5)text(“LXF”);
While 3D-printed objects tend to speak on their own, scale(1.1)hull()foot();
versioning them can be helpful. The example of a vase();
3D-printed tag bearing the name of the person owning At this point, it is time for the final production
the keys is heavily overused, but adding a little rendering. The final screenshot (below-left ) shows
engraving to our holder might be interesting. that our object is ready for print.
Given that the rendering of these (relatively Even though two issues of Linux Format are not
complex) objects takes quite a bit of time due to nearly enough to do justice to OpenSCAD, our guides
OpenSCAD not being parallelised, we need to start out have demonstrated its basic operational handling.
by opening another tab. In that, we can start playing We hope that the experiments shown here
with the text-generator functions. Try the following: motivate you to analyse the software further. As in
text(“LXF”); the case of many other pieces of open source
OpenSCAD provides dozens of parameters, software, OpenSCAD is one of these technologies
documented in detail at https://en.wikibooks.org/wiki/ that one either loves or hates. The experiments
OpenSCAD_User_Manual/Text. For us, however, only performed here are enough to determine on which
the size parameter is relevant – by default, it is 10, side of the camp you will reside.
The object
is ready for
deployment,
alongside the
real-world
finished item.

IMPROVE YOUR LINUX SKILLS Subscribe now at http://bit.ly/LinuxFormat

www.techradar.com/pro/linux May 2024 LXF314 71


TUTORIALS Fix Steam Deck glitches

PROTON-GE
Credit: https://github.com/GloriousEggroll/

How to fix glitching


Steam Deck games
Despite amazing work, there’s plenty of incompatible Steam Deck
games, thankfully fixes are at hand, but nothing so far for Neil Mohr.

here’s no doubt Valve Software has done

T more to propel Linux gaming forward than


almost anything else in recent years. The
Steam Deck and its Proton spin of Wine have brought
more games to Linux along with new users than
anything else could. But despite the stellar work put
OUR into fixing game compatibility, glitches still exist.
EXPERT Some simply won’t ever be fixed, but for many, the
Neil Mohr Steam community has chugged into action and created
still can’t pry a host of workarounds. We’re looking at a number of
his Steam Deck troubleshooting options here, from spotting them
from his six-year before you even try a game to replacements for the
old’s hands. default Proton layer.
Let’s kick off with basic troubleshooting, so we
know about issues before even buying a game, never As long as you add access to your SD card, you’ll get a full list
mind running it and trying to play it. You should head of supported games to tinker with.
to www.protondb.com and search for the game in
question. We’re going to be looking at Lego Batman 2; flawless experience, while Gold is a step down
this is rated as Unsupported by Valve for the Steam from that, with perhaps just a minor bug requiring
Deck, while ProtonDB has it classified as Silver. Why workarounds. Valve takes a more formal approach –
the two different classifications? a game labelled Unsupported means “Your game
ProtonDB uses the original Wine classification for does not function on Deck due to incompatibility with
software compatibility. Basically, if it runs, it gets a Proton or specific hardware components.” Basically,
In Desktop mode, Bronze rating, even if there are serious flaws and Valve tested it, found issues and slapped Unsupported
Steam Deck uses
Discover to install
crashes. A Garbage rating implies it’s unusable or won’t on it as it doesn’t plan to fix the issues in Proton at this
Protontricks and run at all. Silver means it runs well but there’s the odd time. It doesn’t mean the game won’t run.
get this ball rolling. major glitch and it requires workarounds. Platinum is a The best way to highlight this is with a look at a real
game. If you try to run Lego Batman 2 – classified as
Unsupported on the Steam Deck with even the latest
Proton 9.0 or Proton Experimental – you’ll find loads
of textures are daubed with a bright rainbow flickering
effect. The game works but it’s visually unpleasant.
On the ProtonDB website, if you click on the Lego
Batman 2 entry, you’ll find a list of comments from
users reporting play issues and potential fixes. The
first fix is to use Protontricks. This is a software
wrapper for Winetricks that provides a bunch of
standard fixes – such as listing missing or alternative
DLLs – for Windows games.
Let’s install Protontricks and go through the process
of fixing a game. To get it installed, ensure you’re out of
Family View (the green family icon is displayed at the
top if you are), press the Steam button > Power Off >
Switch To Desktop Mode. Remember to open the
on-screen keyboard (press Steam+X) – the right

72 LXF314 May 2024 www.linuxformat.com


Fix Steam Deck glitches TUTORIALS

touchpad is your mouse. Select Menu > System >


Discover and type Protontricks into the search box.
Select the Protontricks entry and click Install. Once to use. Enter Proton GE. This is a community build of The Lego Batman
2 game before and
done, select Launch. Helpfully, it scans your Steam Proton that usually has all of the Proton/Winetrick
after glitches have
Deck drives and presents a list of known games with fixes in place. This means once it’s installed, just select been fixed.
solutions. If you have an expansion drive – an SD card – the alternative Proton GE layer and you’re good to go
it needs permissions to scan this, so copy and paste from the standard Steam Deck interface, with no
the presented text into the terminal and rerun Desktop messing around. Well, just for the install part.
Protontricks. It’ll look similar to this: As before, enter Desktop mode – hold the Steam
$ flatpak override --user --filesystem=/mnt/MySSD/ Deck’s Power button and select the Switch To Desktop
SteamLibrary com.github.Matoking.protontricks option to open up the Linux desktop. We need to install
Protontricks works from within Desktop mode, so ProtonUp-Qt, so select Menu > System > Discover, and
when it comes to fixing our game, click Start > Utilities type ProtonUp-Qt . Tap or click Install, and wait for it to
> Protontricks. It presents a list of recognised games, finish installing.
so find the one you want to fix, select it and click OK. Once it’s installed, tap on the store page, then hit
As this is a Winetricks wrapper, you’re taken to the the Launch button in the top-left corner. Add Proton
Winetricks interface, which isn’t the most user-friendly, GE – in the ProtonUP-Qt interface, tap the Add Version
but let’s see how it works. Select Default Wineprefix > button. The first drop-down box should read “Proton-
Install A Windows DLL and choose the DLLs or GE”, while in the second (Version), you want to select
required components. When you click OK, nothing may the latest version available, then click the middle Install
happen for a while – just wait and OK any dialogs. If button. If it’s been installed correctly, the Installed list If you need
you’re installing Windows components (such as Visual of ProtonUp-Qt now has a new entry for Proton GE. details of game
components,
C++), go through the install process. In our case, we There is no auto-update option, though, so check back
head to www.
selected d3dx9 and d3compiler_47. Once back to the here regularly for Proton GE updates.
steamdb.info,
Winetricks interface, you can close it, as it’s done the At this point, you can log out of the Desktop back search for your
job of adding these new files to the game directory. Be to the main Steam Deck interface. To force a game to game, select it,
aware you can’t remove DLLs, you have to remove the use Proton GE, select the game to open its Launch click the Depots
entire game. You can try by running Protontricks, select screen and click the cog icon, then select Properties > link on the left
Default Wine prefix > Change settings >select the box Compatibility. Click Force The Use Of A Specific Steam and then the
alldlls=default then click OK, but it’s unlikely to work. Play Compatibility Tool. Open the drop-down menu ID number.
This is a Windows issue rather than a Proton issue. below and at the top will be Proton GE with the version This lists all
number you chose to install. Press B to go back and the associated
support files.
Proton GE play your now perfectly running game!
We’ve looked at Protontricks first as this is a user-
configurable option that can be applied to any Steam
(and non-Steam) games installed, but it’s a bit of a faff DESKTOP STEAM
While we might be writing about the Steam Deck here, the same
tools work on standard desktop Linux distros. As desktop Steam still
uses the Proton layer, you can choose different compatibility layers
in the same way through the game’s Properties interface. You can
also use Protontricks to add and remove Windows components
to fix issues with specific games. The official Protontricks Git is at
https://github.com/Matoking/protontricks but you might find this
streamlined guide that only uses Pipx easier to follow: https://
simpler-website.pages.dev/html/2021/1/protontricks.
As for Proton GE on desktop, there is a version of ProtonUp-Qt
available as both an AppImage and a Flatpak. Go https://davidotek.
github.io/protonup-qt/ to get details on how to install both options.
Ensure you engage the Proton GE layer to fix your gaming issues.

GET LXF IN A PORTABLE VERSION Subscribe now at http://bit.ly/LinuxFormat

www.techradar.com/pro/linux May 2024 LXF314 73


ADMINISTERIA
Tips for managing
Docker containers
Generous-minded Stuart Burns has years of Docker experience under
his belt and is keen to share his knowledge with other sysadmins.

veryone knows how containers revolutionised apache:

E application building and deployment. Using a


disposable stack of containers that make up
image: httpd:2.4
ports:
an app that aren’t using the docker-compose - “8080:80”
command to manage the stack are missing a trick. volumes:
It allows the shipping of an entire stack in one single - ./html:/usr/local/apache2/htdocs
file. Using docker-compose enables the administrator To run this base image of Apache, copy the
to group all the application’s containers into a single YAML file and put it in a file called compose.yml. Also,
stack. It means an entire stack can be started or torn create a folder called html and create a rudimentary
down with next to no effort. No configuration needed. index.html in the folder with a bit of HTML markup.
It can be as simple as docker-compose up and From within the folder, use the command docker-
stopping the stack with docker-compose down . As a compose up -d and it will use that information to create
really useful example, it provides a way to distribute an the entire stack. The -d parameter tells the system to
entire application that can be deployed as designed, run it in the background. To bring it all down, use
tested and then brought down and deleted. docker-compose down .
In production, using docker-compose is much As you can see, most of the items are self-
easier than trying to launch 15 different containers explanatory, with sections for networking and volumes.
manually and the overhead that comes with that. Many You can modify to your own tastes.
applications now provide the docker-compose.yml file For casual users, it makes the whole management
to build the application rather than raw Docker. easier. Rather than trying to remember all the switches,
Using this method also makes networking easier, trawling the history or creating scripts to start the
because it places all the containers in the same apps, it is as easy as docker-compose up -d from
network, making communication simple and less inside the folder. Below is what a multi-container
problematic. Below is a really simple setup to show example might look like:
how useful and easy it is to utilise. version: ‘3’
Depending on your setup, you may need to install services:
the Docker-compose application. In the case of webapp:
Ubuntu, this would be: image: nginx:latest
$ sudo apt install docker-compose -y ports:
The Docker-compose file is a YAML file that holds - “8080:80”
Being able to the configuration required. It details how to set up the volumes:
launch a series containers. A trivial one-container-file YAML file could - ./html:/usr/share/nginx/html
of complex
deployments with
look like this:
a single command version: ‘3’ database:
is admin heaven. services: image: mysql:latest
environment:
MYSQL_ROOT_PASSWORD: examplepassword
MYSQL_DATABASE: mydatabase
MYSQL_USER: myuser
MYSQL_PASSWORD: myuserpassword
ports:
- “3306:3306”
volumes:
- ./data:/var/lib/mysql
Recently, we had the rather dull task of creating a
Docker-compose file for a stack that contained several

74 LXF314 May 2024 www.linuxformat.com


ADMINISTERIA

Docker instances to bring it up. Previously, there was


a series of docker run commands. However, we can Stuart Burns
do better! is a Linux
We could have manually done all the work of administrator for
creating a new YAML compose file from scratch. Some Docker containers a Fortune 500
of these docker run commands took up four lines. have transformed company
We didn’t. Using our internal ChatGPT AI system, we the way specialising
asked it, as an expert in Docker and containerisation, everyone handles in Linux.
deployments
to please take the following Docker commands and
create a Docker-compose YAML file instead. It needed
and updates. DEBIAN
a bit of tweaking, but apart from that, it worked without VERSUS UBUNTU
issue. Work smarter, not harder.
Pro tip: refactoring long lines of code is quite easy Last month, I was rather vocal
with AI systems. in my criticism of Canonical.
While fixing all this, we were asked, Following that, I decided to go
“Why do the containers never restart back to a ‘pure’ experience. I
on boot even though they where set to decided to run Debian 12 on my
‘restart unless stopped’.” main PC. It was very different.
The answer is in the restart policy and I respect what the Debian
the definition of ‘restart unless stopped’. team does and excluding non-
The top and bottom of it is, when a system free binary blobs. That said,
is rebooted, the containers are stopped the experience just wasn’t as
before shutdown, satisfying the stopped polished as Ubuntu or other
condition. If you want a container to start popular distros. It took work to
on boot, assuming the Docker service is achieve a similar setting and I
started, it is as simple as using the restart was one of the users who got
policy of always. caught with the recent Nvidia
It would obviously be remiss not to binary blob, so no local AI
mention that including the restart policy generation for me. For several
for each container is as simple as adding a days, there was no real fix.
line in for each, an example being: It shows how complex the
restart: always software is under the surface.
One last note: YAML doesn’t like Binary drivers just make life
tabs. Don’t use tabs. Using them will stop easier. Experiencing these
Docker-compose from reading it properly. issues and with a deadline, I
One really useful tip: we use https:// decided to revert to Ubuntu.
codebeautify.org/yaml-validator to sanity Everything just worked.
check the layout of a YAML file before While we may dislike binary
using it. Obviously, don’t leave in sensitive blobs and the fact that big
information, but it’s a really useful site. Behind-the-scenes configuration is easy via JSON files. business is involved in our open
source, it makes life easier. But
without Debian, we wouldn’t
ROOT PASSWORD RESETS SIMPLIFIED have Ubuntu and the IT world
would be much duller.
Use the GRUB menu Debian is great as a stable
during boot! There, we’re distro that works and is reliable,
done. Oh, keep reading… with super-long support cycles.
We’re sure we’re not the But, as they say, “Debian ain’t
only ones who do an install Ubuntu.” Users trying to
and need to reset the root install packages designed for
password. It can be a chore Ubuntu package managers
Rescue me! But only
having to boot up, remount tend to break stuff. So much so
if you know how…
the filesystem, change the that Debian has a page called
password etc. Some Don’tBreakDebian: https://wiki.
vendors even include such debian.org/DontBreakDebian
issues in their exams, and systems) or the Esc key including resetting the Finally, I’d forgotten how
those who are unprepared (for UEFI systems). It password, booting to difficult it can be to purchase a
lose precious time. presents the GRUB menu. a previous kernel (for guaranteed-to-work Linux
For a while now, a lot of Choose Advanced Options example, if you applied a desktop. This resulted in me
vendors, like Ubuntu, have and then one of the kernel that has issues that buying a new desktop from my
CREDIT: Docker Inc

a boot menu that allows Recovery Mode options – prevent boot), and more. local provider and spending an
you to manage these usually for the latest kernel It’s a very useful thing to extra £90 on a mobo with an
things. When booting up, version. This enables the know about, but it seems a Intel network and wireless,
hold the Shift key (for BIOS low-level rescue mode, lot of people are unaware. making a decent experience.

www.techradar.com/pro/linux May 2024 LXF314 75


TUTORIAL OnlyOffice

ONLYOFFICE
Credit: www.onlyoffice.com

Collaborate with
OnlyOffice DocSpace
Nowadays, online document collaboration is a must. OnlyOffice DocSpace
allows organising this effectively. Kseniya Fedoruk shows how to set it up.

very day, we work with numerous office files

To enable the
E together with our colleagues, team members
and various external users. Sometimes (or
AI assistant, maybe often) chaos breaks out; the necessary editing
access the rights are missing, important files can’t be found, or
Plugin Manager co-workers from another department don’t leave
in the opened suggestions but edit the text directly. Such a scenario
editor via the can cause serious problems, especially when it comes
Plugins tab, find to sensitive documents such as contracts.
ChatGPT and
Keeping this in mind, it’s important to choose a
click Install.
solution that helps eliminate such difficulties. In this
guide, we’ll introduce you to the features of OnlyOffice
DocSpace and explain how to install the server build on Creating a Custom room in OnlyOffice DocSpace.
your Linux machine.
OnlyOffice DocSpace is a room-based environment real time. In Public rooms, external users can view
for organising a clear file structure depending on your documents without registration. Custom rooms are
needs. The platform comes with integrated online designed for any custom purpose – for example, to
viewers and editors, enabling you to work with files request document review or comments, or share any
in multiple formats, including text docs, digital forms, content for viewing only.
sheets, presentations, PDFs, ebooks and multimedia. Flexible access permissions enable you to fine-tune
the access to the whole space or separate rooms. So,
Your new room available actions in a room depend on the given role.
DocSpace rooms are group spaces with preset
access levels to ensure quick file sharing and avoid Role Function
unnecessary repeated actions. Currently, among the
Owner Creates and manages DocSpace
provided room types there are Collaboration, Public
and Custom rooms. DocSpace admin Manages DocSpace
Security settings
in OnlyOffice Collaboration rooms are intended for co-authoring Room admin Manages rooms
DocSpace. documents, tracking changes and communicating in
Power user Can create and store their own files
Only has access to the rooms
User they are invited to; can’t create
or store files
Editor Can edit docs
Viewer Can view docs
Reviewer Can suggest changes
Commenter Can leave comments
Form filler Can fill out forms

AI helper
OnlyOffice DocSpace comes with an AI helper in
the form of a ChatGPT plugin accessible right in the

76 LXF314 May 2024 www.linuxformat.com


OnlyOffice TUTORIAL

Working with
various content
types in OnlyOffice
DocSpace.

Developers and
integrators can
make use of
the open API
of OnlyOffice
DocSpace to
integrate the
whole space
or separate
rooms into
their own web
applications:
http://api.
onlyoffice.com.

editors. It allows running word analysis, generating Download the Docker script file with:
images and keywords, summarising, translating and $ wget http://download.onlyoffice.com/docspace/
rewriting texts, fixing grammar and spelling, finding docspace-install.sh
synonyms, building code and so on. Once ready, make sure you have the root rights and
Customisation settings enable you to tailor continue. You can install OnlyOffice DocSpace from the
OnlyOffice DocSpace to your liking. You can set the DEB or RPM package with:
language and time zone, change the space name and $ bash docspace-install.sh package
URL, add a description for the Welcome page, upload Or by using the Docker script with:
your own logo and select the colour scheme. $ bash docspace-install.sh docker
Once finished, launch your browser and type the
Security local network computer IP address into the address
OnlyOffice DocSpace is a secure way to work with bar. On the DocSpace setup page, enter your email
both personal and company documents. HTTPS address, set a password, and accept the licence
protocol encrypts traffic in transit, JWT protects files agreement. At this stage, it’s also possible to set the
from unauthorised access, and it’s also possible to language and time zone, choosing the necessary
enable password protection and watermarking. option in the corresponding drop-down list. When all
Along with various access levels, space admins the parameters are set, click the Continue button.
are also able to adjust the security settings to control That’s it! OnlyOffice DocSpace is perfect for
the login procedure and prevent data leaks, including organising effective and protected collaboration with
such options as 2FA and single sign-on, trusted mail all types of users. Install it on your own Linux server to
domains and session lifetime, IP restriction and so on. get complete control over your data and its location.
To monitor user activities, Login History and Audit Trail
features are available. Automatic and manual data
backups ensure your data remains safe in case of any SELF HOSTING
infrastructure failures.
OnlyOffice DocSpace can be hosted on your own server as well as in
Installing DocSpace the trusted public cloud. For the cloud version, there is a completely
Installation of OnlyOffice DocSpace on Linux servers free Startup plan for individual users and smaller teams. If you would
is available using an automatic script with Docker like to opt for a Business subscription, you only need to pay for
installed. minimum system and OS requirements are: admins and power users with extended rights. All other regular
• Quad-core CPU (six-core recommended) users can be added for free. The self-hosted version provides a free
• 8GB RAM (12GB recommended) DocSpace Community. There is also a Family Pack for home use, as
• 40GB of free HDD storage space well as DocSpace Enterprise for bigger teams and companies. To
• 6GB or more of swap space create your own OnlyOffice DocSpace, visit the www.onlyoffice.com.
• 64-bit (AMD64) Linux distro with kernel 3.10 or later

GET YOUR MONTHLY ADMIN FIX Subscribe now at http://bit.ly/LinuxFormat

www.techradar.com/pro/linux May 2024 LXF314 77


IN DEPTH ChatGPT masterclass

CHATGPT MASTERCLASS
Make AI work for you
Want to get more from the best-known AI service on the planet?
Barry Collins and Neil Mohr explain how to make AI work for you.
penAI’s now infamous chatbot has a series party services to plan holidays, book restaurants or

O of formidable features, most of them


hidden from those who don’t subscribe
to ChatGPT Plus. It’s worth doing, even
scour for facts on your behalf.
But unless you know how to get the best out of
basic AI prompts you aren’t going anywhere fast. We’ll
CREDIT: Getty Images/ Just_Super

if only for a month, so you can evaluate the sheer explore prompt engineering, the fascinating area of
power that lurks here and work out whether it could getting the best out of AI’s by formatting, one-shotting
make a difference to your professional – or even your and chaining prompts to manipulate the AI into
social – life. generating evermore complex responses.
ChatGPT Plus can perform hugely sophisticated Then there are GPTs – mini chatbots. Create and
data analysis, saving you from having to spend time train your own AI without having to bash out a single
learning how to do it yourself in applications such as line of code. Made with plain English commands they
Excel. It can tidy up your computer code, your emails or can be trained on your own data, so are highly
your PowerPoint presentations. It can hook into third- personalised to you or your business.

78 LXF314 May 2024 www.linuxformat.com


ChatGPT masterclass IN DEPTH

There can’t be a reader out there who hasn’t spent deals with the US site – but it’s good for generating Above: Extend
at least 10 minutes noodling with ChatGPT – or one of ideas and rough budgets. ChatGPT’s abilities
with specific
its many derivatives, such as the Bing Copilot. Irritatingly, you can only enable three plugins at a
data sets via its
While there’s plenty of AI power and much to time and the Plugin Store is poorly presented and Plugins store.
explore with the free version of ChatGPT, the real erratic. Often plugins don’t install at the first time of
power is unlocked when you subscribe to ChatGPT asking, for example. It’s a work in progress, but one Above-left:
Plus. Not only does that (largely) ensure you can get that holds tremendous promise if it can be made to Commercialisation
of ChatGPT is
access to the chatbot during the regular periods of function more smoothly. ongoing through
peak demand when the free version is switched off, it mini GPTs.
opens up extra features such as plugins and advanced Advanced data analysis
data analysis. Let’s look into those two features in This is arguably the best feature of ChatGPT Plus, but
greater detail. you may still need to dive into Settings > Beta Features
and switch it on first. Advanced data analysis lets you
Extending services upload spreadsheets and other files, and get the AI to
Plugins enable you to combine the intelligence of do the hard graft that you might normally do in Excel.
ChatGPT with third-party sites or services, such as For example, we fed ChatGPT Plus raw survey data
Wikipedia, WolframAlpha (this fixes ChatGPT’s poor into an Excel workbook. Each tab represented a
mathematical issues) or OpenTable. For example, you different category, and the AI automatically figured
could ask the AI to create a summary of a long article this out, but checked this with us to ensure it was
you’ve found on Wikipedia or use it to research facts. making the correct assumption.
For instance, you could ask ChatGPT to “give me the Once it worked out the format, we could ask it to
release dates of the past five versions of Windows produce graphs showing each company’s performance
from Wikipedia” and it will dig out the correct answers in different categories or to tell us how company A
from the online encyclopedia, without you having to fared against company B in different categories. We
wade through different articles yourself. could also use it to calculate different weightings for
With the Expedia plugin, on the other hand, you can each category, for example giving ‘very satisfied’
ask the AI to do things such as create a three-day trip responses a +2 weighting, but mere ‘satisfied’ a +1, to
to Oslo for you, and it will come back with hotel and see what effect that had on the overall results.
flight recommendations that suit your budget. It’s not All this could be done in Excel, but only if you have
perfect – it sometimes gets trip dates wrong when you the skills with pivot tables or can apply the relevant
click through to book flights, for instance, and it only formulae. Advanced data analysis lets you do all this

WHAT ARE GPTS?


ChatGPT is based on the GPT-4 large them or training them better, as we of the camera’s official manual to a GPT
language model (LLM), which OpenAI reveal in our guide. and then use your AI assistant to guide
released in 2023. And a GPT is The key with GPTs is thinking of a you when you want to find out how to
effectively a mini version of ChatGPT, very specific task that could benefit change the flash settings or activate the
dedicated to a specific task, such as from AI assistance. It might be helping self-timer. That means the AI is less
helping you plan a gap year or how to you to formulate your company’s annual reliant on the unreliable information it
use a piece of software. report or buffing your Python 3.12 skills, might otherwise source online.
You don’t need any coding skills but the more specific the better. At a more advanced level, you can
to create a GPT. They can be created You can upload files to GPTs to help connect a GPT to a third-party service
using plain English commands given with their training. Let’s say you’ve such as Zapier and use it to query other
to ChatGPT. That doesn’t mean there treated yourself to a Canon EOS R50 services, such as your Google Calendar.
aren’t particular skills and techniques camera and want to learn how to better Zapier has advice on how to set this up
you can apply to getting the best out of use its features. You can upload the PDF at http://zapier.com/blog/gpt-assistant.

www.techradar.com/pro/linux May 2024 LXF314 79


IN DEPTH ChatGPT masterclass

results from AI tools is a skill – one


that can pay handsomely, too.
We’ll take a quick look at how
you can best format your
questions to ChatGPT to ensure
you get an expert reply in a format
you want. Once this is under your
belt, we’ll then look at ways of
asking ChatGPT to revise what it’s
initially generated to produce
revised versions better suited to
what your needs are. Keep in mind
this revising can push AI’s down
the path of hallucinations (false
information). ChatGPT and similar
are just (albeit incredibly complex)
statistical models, so you can push
it down a path were its output is
factual gibberish although still
understandable English. Hence
it outputting non-real cases
for lawyers and non-existent
Wikipedia articles complete with
made-up URL links.
One of the most powerful
and straightforward engineering
tricks is to form your prompts in
this style:
Sophisticated with plain English commands, and the results are much Acting as a [ROLE] perform [TASK] in [FORMAT]
visualisations are more reliable than they are with general chats. There Hopefully, you can see where this is going, but this
possible – you just
are no hallucinations (at least none we’ve seen) and it prompt does a fantastic job of guiding ChatGPT down
have to ask.
will tell you if it can’t perform a particular request or a suitable path (the role) and producing a useful
needs more guidance on what you’re looking for. response (the task) in an output (the format) that’s
useful for you. You can focus the output somewhat at
ChatGPT prompt engineering 101 this initial stage by expanding this basic prompt:
You’d never expect to just rock up to a new Acting as a [ROLE]. Perform [TASK with OBJECTIVE]
programming language and pick up how to get the to [LENGTH]. Include relevant [DATA and SOURCE]
best from it without knowing the syntax, right? AI using the style [VOICE] aimed at [AUDIENCE].
prompt engineering is just that, understanding the Example roles you can input are: marketer,
syntax and semantics of what the AI neural network copywriter, accountant, lawyer, analyst, doctor, project
expects and can process as input variables and manager, therapist, journalist, financial officer or
commands. This prompt engineering is often sneered prompt engineer. This grounds the output in an area
at in tech circles, but knowing how to get the best of speciality. If you think of ChatGPT as a statistical

ChatGPT can tackle


complex topics by
discussing issues
with itself.

80 LXF314 May 2024 www.linuxformat.com


ChatGPT masterclass IN DEPTH

model, it’s giving it a better chance of outputting the


response you’re after. Obviously, with areas involving
legal consequences and medical issues, never rely on
an AI and always seek professional human advice.
Keep in mind that ChatGPT is trained on internet-
based information – subjects from around the globe.
So, if you’re trying to elicit local-specific advice (for
example, on legal or accounting matters), ensure you
specify where you are but also keep in mind its output
may not apply to your situation or could be outdated.
The task element is the more complex part, as it’s
whatever problem you want solving, answering or
creating. You don’t have to go into full detail at this
point; as we’ll see, we can expand and refine ChatGPT’s
output further as it remembers your responses (4K
tokens in ChatGPT 3, 8K ChatGPT 4, 32K for Pro), but ChatGPT to brainstorm with itself,. A framework for Asking ChatGPT
for basic tasks, you could use options such as: write a this looks like the following: to rewrite or
summarise its
headline, create a presentation, write an essay, book Three experts with exceptional logical thinking skills
own output is
outline, email, create social media post, production are collaboratively answering a question using a tree rewarding.
description, write a cover letter, blog post, summarise of thought method. Each expert will share their
this, video script, create advertising copy and so on. thought process in detail taking into account the
Finally, ChatGPT is able to format its output in many previous thoughts of others and admitting any errors.
ways – both standard text document formatting as well They will iteratively refine and expand upon each
as spreadsheet options, programming code, file types other’s ideas, giving credit where it’s due.
such as PDF and markup formats including HTML and The process continues until a conclusive answer is
Markdown. Often, ChatGPT can autoformat output, but reached. Use step by step thinking and organise the
you can try: table (with rows and columns specified), entire response in detail as a table.
list, summary, HTML, spreadsheet, CSV, plain text, rich Provide a summary of the recommendations. My
text, PDF and so on. question is how can we fix global warming.
The output is a rich thought-through plan of action
Prompt chaining with a train of thought and arguments you can follow.
Once you’ve prompted ChatGPT, it often outputs a You can also interrogate ChatGPT further on specifics.
ream of text that may or may not be what you’re after. Hopefully, you can now see what’s achievable.
You can start refining its responses and asking it to
generate additional output that’s based on the original
topic and role. For example, we could try: CHAIN OF THOUGHT
act as a magazine editor create the contents for a 100
page Linux Kernel magazine in plain text Chain-of-thought (CoT) prompting breaks down problems into
The output is unusable twaddle, with ChatGPT intermediate steps, enabling LLMs to tackle complex reasoning that
trying to launch Linux Kernel Chronicle, The Kernel can’t be solved with zero-shot or few-shot prompting. Here you’re
Gazette or something similar. But let’s get it to polish asking the AI to think through its answers step by step, to show its
up this, erm, terrible tome. working so it can be checked, if you like. For example, you might ask:
write ten engaging names for a Linux kernel magazine I’ve been offered two loans, each for £100,000, repayable over three
take the best name and write a list of headlines for years.
a blog launching the magazine The loan from Barclays has a 4.5% APR and an arrangement fee of
write a list of subheadings £500.
write a list of call-to-action The loan from Santander has a 4.9% APR and an arrangement fee of
combine the best headline, subheadings and call- £600.
to-action write a blog launching the magazine Which has the cheapest overall cost? Think step-by-step and show
rewrite the blog in 200 words your working.
We expect in this process that you’d probably want When we entered this into ChatGPT Plus, it gave us a long set
to be more specific about what you think is “the best” of workings, but that revealed its answer was based on annual
rather than entirely rely on ChatGPT to decide payments, not monthly, as you’d expect. To confirm, we asked:
everything, but it’s a fun process. The final rewrite Are you assuming payments are made monthly?
prompt can be very powerful when used in the form: It then went off and calculated the correct figures, answering that
rewrite [YOUR TASK] in the [STYLE], [TONE], the Barclays loan would be around £800 cheaper over the three-
[VOICE] and [PERSONALITY]. year term (it provided more detailed answers than this). This
You can also ask it to rewrite in first, second and highlights a few key issues:
third person, along with specifying word counts. 1. Be as precise as possible with your initial prompt (for example,
using “APR” rather than just “interest rate”).
Tree of thought 2. Get the AI to show its working to have a better chance of spotting
Proposed in a paper March 2023 (https://arxiv.org/ mistakes, misassumptions or hallucinations (stuff it’s made up).
abs/2305.10601), the tree of thought is a self- 3. Challenge the AI on its methodology, so you can be as sure as
referencing problem-solving mode for LLMs. It builds possible that the answers you’re getting are correct.
on the chain of thought process and effectively gets

www.techradar.com/pro/linux May 2024 LXF314 81


GET ALL THE ESSENTIAL BREAKING
NEWS FOR THE TECH ENTHUSIAST!
No matter if you're building a PC,
buying a laptop or learning about
robots, Tom's Hardware has all the
comprehensive knowledge you need.

Scan & Subscribe


for free!

Make Python work for you with


tutorials on coding with Django, Flask,
Pygame and even more useful third-
party frameworks.
THE BEST NEW OPEN SOURCE SOFTWARE ON THE PLANET

Mayank Sharma
was bitten by a radioactive
OBS Studio Moosync PhotoCollage Collector download manager, which
is why he can fearlessly
Patool Warpinator Croc FreeDoom venture into obscure repos

LibreMines QOwnNotes S-tui


and rummage through
bleeding-edge software.

DESKTOP STREAMING

OBS Studio
Version: 30.0.2
Web: https://obsproject.com

here are lots of good options for recording

T screencasts, but if you want to live-stream


your desktop, one of the best options is
OBS Studio. The app works with all the major online
streaming providers, such as Twitch, YouTube Live, If you’ve never used it before, OBS Studio might seem a little daunting at first, but the app has
Facebook Live and dozens more. ample documentation to help you get started.
The project hosts a PPA for Ubuntu users, but it’s
easiest to use the official Flatpak. If your distro is LET’S EXPLORE OBS STUDIO
configured to install Flatpaks, you can install OBS with
flatpak install flathub com.obsproject.Studio . Once
installed, you can run it from your distro’s application
launcher or with flatpak run com.obsproject.Studio .
When you launch the app, it displays an Auto-
Configuration Wizard. This helps determine the best
settings depending on your purpose for using the app:
streaming, or offline recording. You can rerun the
5
wizard from under the Tools menu.
The next step in the wizard is Video Settings. Here
you must select the resolution of the recording, with
several resolutions available in the pull-down. It’s
usually a good idea to leave the FPS at the default
value unless you have a reason to scale it down.
Next you’re asked to select a streaming service.
Virtually all of them ask you to add a streaming key.
1 2 3 4
The process for fetching these depends on the service.
When done, head to the Scenes panel, which is
populated with a single scene. You can rename it, and
add other scenes depending on your streaming plan.
Then switch to the Sources panel to set up the Scenes always a good idea to test these before you
scenes’ source. Click the + button to browse through 1 You can set up a stream to have multiple start streaming.
the list of available sources, which includes everything scenes, each with its own elements. You can
then switch between them during the stream. Controls
from webcams to audio devices, screen capture tools 4 When you’re ready, hit the Start
and dozens more choices. Each source displays its own Sources Streaming and Start Recording buttons to begin
set of options. 2 OBS supports multiple audio and video capturing footage. It also displays the current
The app already uses your default audio device and streams, and you can divide them between the FPS and CPU usage.
scenes as per your requirements.
microphone as output and input devices, but you have
Stream preview
to jump through the other panels to adjust the volume Audio Mixer 5 This is how your stream will appear. You
balance and define transitions. When you are done, hit 3 Here you adjust the volume balance can drag and resize all the added sources in
the Start Streaming button. between all the different audio sources. It’s your stream as per your requirements.

www.techradar.com/pro/linux May 2024 LXF314 83


HOTPICKS

MUSIC PLAYER

Moosync
Version: 10.3.2
Web: https://moosync.app

here’s no scarcity of music players for the

T Linux desktop, but what sets Moosync apart


from its peers is its ability to seamlessly play
local tracks and online music.
Moosync offers both DEB and RPM precompiled
binaries. You can also download the platform-
independent AppImage and make it an executable
from the file manager or with chmod +x . Genres tab. Similarly, you can browse your collection by Click on the icon
On first launch, the app starts a setup to help artist or album under the Albums and Artists tabs. in the bottom-left
corner to bring up
determine the location of your music collection. It Double-click on a song to add it to the queue. You
the music queue,
defaults to ~/Music, but you can add and remove can use the three-dot meatballs menu or right-click on where you can ask
folders. You can also use this setup to connect to a song to bring up more options, such as the ability to Moosync to fetch
supported online services, such as YouTube, Spotify play it right away, or add it to the queue to play after the lyrics for the
and LastFM. the currently playing track. playing track.
You can optionally log into those services, using IDs You also get the option to add a song to a playlist, or
and credentials that depend on the service. The good to hide or remove it from the library altogether. You can
thing, though, is that you can search and play songs also jump to browse other songs in the same album or
from YouTube without logging in. by the same artist.
Once inside the app, the All Songs tab lists all The app has a search bar at the top to help you
the songs in your local folders. The app also sorts sort through the music. You can use it along with the
your songs by genre, which you can browse under the YouTube filter to search for music on the service.

PhotoCollage
PHOTO EDITING defaults to a

PhotoCollage
800x600 canvas,
but you can
specify your own
dimensions or
choose from one
of the popular
Version: 1.4.6 Web: https://github. ones, such as A4.

com/adrienverge/PhotoCollage

f you have a bunch of photos that you want to

I stitch together into a collage, you could use


venerable tools such as ImageMagick or
GIMP. They can certainly do the job, but it takes time
and requires you to have some image-editing chops.
If that’s not you, take a look at PhotoCollage. The
app automates the process and can spit out photo You can rearrange the images in the collage with
collages with a single click. simple drag and drop. You can also delete an image
It’s available in the repos of most popular distros, from the collage by hovering over it and pressing the
but the version there would be outdated. However, it X button. Similarly, you can add more images to the
doesn’t take much to install it from source if you have collage by using the Add Images button and selecting
Python 3: more pictures
$ git clone https://github.com/adrienverge/ If you don’t like the layout, hit the Regenerate
PhotoCollage.git button to ask the app to rearrange the images into a
$ cd PhotoCollage new layout. You can press the Regenerate button any
$ sudo python3 setup.py install number of times until you get a layout that you find
$ photocollage appealing. Helpfully, the app keeps track of all layouts,
The app has a simple interface. Click the Add so you can switch back to any of the older ones using
Images button and select the images you want to add the arrow keys next to the Regenerate button.
to your collage. And that’s it. The app processes the When you have a layout you like, hit the Save Poster
images and then displays a collage. button to save the image as a JPG, PNG, or WEBP.

84 LXF314 May 2024 www.linuxformat.com


HOTPICKS

You can open


FILE MOVER multiple Collector

Collector
windows
simultaneously
and assign each
a coloured dot to
separate them
from each other.
Version: 1.0.1 Web: https://mijorus.it/
projects/collector/

our distro’s default file manager does a good

Y job of copying and moving files, but it isn’t


very efficient if your workflow involves
ferrying multiple files from all over the filesystem.
And this is exactly what Collector is designed for.
The app functions as a temporary holding space in
which you drag and drop files, or paste clipboard
contents, web links and more, and then copy them
to their destination in one go. hover over an item pasted into the holding space, you
Collector is officially distributed as a Flatpak and you get a three-dot kebab menu. The menu has options
can install it with flatpak install flathub it.mijorus. to copy the selected item into the clipboard, delete it
collector . When it’s installed, the app embeds itself in from the holding area, or open it. To view a file in the
your Applications menu. holding space, Collector depends on an external app
On launch, the app places a small window on the installed in your distro. If you have multiple apps that
desktop that acts as a temporary holding space for the can open that file, the app lets you choose.
content you want to move. You can drag and drop all When you’ve finished collecting all the files you
kinds of files, and even paste text and URLs from the want, you can drag them all out with a single click and
clipboard into this window. The window keeps track of drop them elsewhere. You can drop them to a folder,
all the items dropped into it. or even inside an app or a web page, for instance, to
If you want to edit your selection, you can use the upload them into your online cloud account or as an
arrow keys to jump between pasted items. When you email attachment.

You can also


ARCHIVE EXTRACTOR use Patool to

Patool
repackage an
archive into a
different format,
such as patool
repack original.
Version: 2.2.0 Web: https://wummel. tar.gz new.bz2 .

github.io/patool/

AR, TAR.GZ, ZIP and 7ZIP are just some of

T the endless list of archiving formats you’ll


run into on a fairly regular basis on the Linux
desktop. What makes working with them even more
complicated is the fact that they all come with their Patool is now ready to work with your archives. The
own tools for managing them. And, of course, these extract command is used to unpack archives – for
tools all have their own commands and options. instance, patool extract foo.tar.gz . You can also
With Patool, you don’t need to bother to remember extract multiple archives, each of which can be a
the arcane CLI options for each format, because the different format, in one go, such as patool extract
Python-based utility can handle a wide range of firstarchive.zip anotherrarchive.tar.gz .
archiving formats, including all the common ones. The utility can also display the contents of the
So, all you need to do is remember Patool’s options archive without extracting it using the list option.
to create and manage archives, and the utility Similarly, it can compare the contents of two archives
automatically translates them for the relevant with the diff option. The option works even if the
archiving format behind the scenes. archives are in different formats – for instance, patool
Before you can use the tool, you first need to install diff release-0.1.gz release-0.1.1.bz2 .
Python 3 from your distro’s package manager with Use the create option to build an archive in any
sudo apt install python3 for Ubuntu and sudo dnf of the supported formats, such as patool create
install python3 for Fedora. You can now use the birthdaypics.bzip2 ~/Photos/birthday/*.jpg . This
Python Pip package manager to install Patool with command creates a BZIP2 archive of all the JPG
pip install patool . images in the ~/Photos/birthday directory.

www.techradar.com/pro/linux May 2024 LXF314 85


HOTPICKS

Warpinator lets
FILE TRANSFER you change the

Warpinator
default ports,
and it’s a good
idea to do so.
Just make sure
you allow traffic
through them in
Version: 1.8.3 Web: https://github. your firewall.

com/linuxmint/

here are tons of ways to send files to remote

T drives, but shuttling files from one device


to another inside the same network isn’t
always straightforward. But it can be with Warpinator.
It’s developed by the Linux Mint project, but
Warpinator is available as a Flatpak, so you can install through them. Again by default, the app uses the
it on any distribution with flatpak install flathub 42000/tcp and 41000/udp ports to transfer files. If
org.x.Warpinator . The app also has unofficial builds you’re using Ubuntu, you can allow these ports in its
for Android, iOS and Windows, which you can find on UFW firewall with sudo ufw allow 42000/tcp and
its website. sudo ufw allow 42001/udp .
By default, the app launches with Secure Mode Similarly, in Fedora use sudo firewall-cmd --add-
disabled, as it uses the default group code Warpinator. port=42000/tcp and sudo firewall-cmd --add-
To enable Secure Mode, all you need to do is set a port=42001/udp . In Fedora you have to then make the
custom group code that is at least four characters long. changes persist across reboots with sudo firewall-
Now install Warpinator on other distros and devices cmd --runtime-to-permanent .
on your network, and change their group code to the The Linux computers should now be able to transfer
same custom one you’ve assigned to the first device. files without any issues. The main interface lists all the
At this point, all the computers and devices in your other Warpinator-equipped devices in your network.
network can see each other. By default, the app prompts the recipient to approve
However, since Linux distros run a firewall, you have the transfer, but this can be overruled from within the
to poke holes in it before Warpinator can ferry files app’s preferences.

FILE TRANSFER

Croc
Version: 9.6.12 Web: https://schollz.
com/tinker/croc6/

f you are a CLI warrior or don’t want to restrict

I yourself to the local network, Croc can ferry


files to any computer on the internet.
It is available in the repos of most distros, but it’s
best to install the latest release from source. This
doesn’t take much effort and can be achieved with
curl https://getcroc.schollz.com | bash . This
downloads and extracts the latest release in /tmp, and Instead of relying on the utility to generate a code, It might be a CLI
then installs it under /usr/local/bin, after prompting you can use a custom one with the –code option, as tool, but the good
thing about Croc,
you for the superuser password. Croc is cross-platform long as it is more than six characters long. For instance,
besides its security
and can be installed in Mac OS and Windows as well. croc send --code [custom-code-phrase] doc1.txt and encryption
Use the send option to send a file, such as croc doc2.txt ~/Documents/other-files assigns the features, is that it
send ~/Documents/some-folder . This displays the specified custom code to the transfer. doesn’t require any
size of the transfer, along with a code, which you must By default, Croc asks whether to overwrite a file. The port forwarding.
send to the recipient. recipient can use the –yes and –overwrite options to
Then to receive the sent files on another computer, silently overwrite files, such as croc --yes --overwrite
the recipient enters the code with the croc command, [secret-code] .
such as croc code-phrase , which begins the transfer. You can also send plain text with Croc, such as croc
Croc uses the code phrase to establish password- send --text “hello world” . This tells the Croc utility at
authenticated key agreement (PAKE). This generates a the recipient’s end to display the sent text in the
key that ensures the transfer is end-to-end encrypted. terminal window.

86 LXF314 May 2024 www.linuxformat.com


Games HOTPICKS

You can use


FPS FreeDM to engage

Freedoom
your mates,
but the exact
mechanism
for hosting a
multiplayer game

Version: 0.13.0 depends on the


source port.
Web: https://freedoom.github.io
e just can’t get enough of Doom. The first-

W person shooter genre has grown in leaps and


bounds since its first release back in the early
’90s, but there’s a certain charm to the original that just The project distributes all three variants of the
keeps pulling fans back for more. The community has game as WAD files, which means they contain all
been churning out ports and mods ever since the the artwork, levels, music and sound effects that
Doom source code was released. make up the game itself. To actually play the game,
The Freedoom project is one such enterprise you need to plug the WAD files into one of the
that produces game data files (or WADs) for Doom- dozens of Doom source ports, such as GZDoom or
compatible gaming engines. The project is a collection Crispy Doom.
of three games. If you’ve been playing Doom for as long as us,
Firstly, there’s Freedoom: Phase 1, which is made up this shouldn’t be a problem. But if you want to
of four episodes, each with over half a dozen levels. It experience Freedoom without the hassle of first
offers interesting gameplay with tons of mazes and setting up a source port, you can grab the games
enemies to battle. from Flatpak, which come bundled with GZDoom.
Then there’s Freedoom: Phase 2, which has a single Head to the terminal and type flatpak install
episode spanning over three dozen levels. It builds on flathub io.github.freedoom.Phase1 to install
Phase 1, and adds more weapons and monsters, and Phase 1, flatpak install flathub io.github.freedoom.
boasts even more enthralling gameplay. Phase2 to install Phase 2, and flatpak install
The third is FreeDM, which is a monster-free set of flathub io.github.freedoom.FreeDM to install
levels, made specifically for multiplayer deathmatches. the multiplayer deathmatch variant.

PUZZLE

LibreMines
Version: 2.0.0 Web: https://github.
com/Bollos00/LibreMines

nother ’90s classic, Minesweeper doesn’t

A have the same kind of fan following that


Doom has with FPS players, but it did help
popularise the puzzle genre. LibreMines continues
that legacy with its cross-platform Qt-based clone.
The game is available in the repos of many distros,
but it’s best to pull it from Flathub with flatpak install
flathub io.github.Bollos00.LibreMines to ensure you
have the latest release.
On launch, the game offers three predefined diagonally and/or adjacent to it. You use this to LibreMines
modes: easy, medium and hard. The three levels have plot your next click. You can also flag a cell, which has several
differently sized grids and different numbers of mines. remains unopened, to indicate a potential mine customisable
options, including
There’s also a fourth option to create a customised location. To win a game, you must open all non-mine all sorts of
game, where you can choose the grid size and the cells without detonating a mine. light and dark
number of mines, specified as a percentage of the grid. You can play LibreMines with both the keyboard themes, as well
The gameplay is the same as the original. The grid and the mouse. Use a left-click to open a cell, and as sound effects.
has clickable tiles with hidden mines scattered through a right-click to flag or unflag one. To activate the
the board. Your objective is to clear the board without keyboard controller, press any of the A, S, D or W
detonating any mines, with the help of clues. keys, and then use them to move through the board.
When you click on a cell that isn’t hiding a mine, it Press O to toggle a cell, and P to flag or unflag it. The
displays a number that indicates the number of mines Esc key exits the keyboard controller mode.

www.techradar.com/pro/linux May 2024 LXF314 87


HOTPICKS

NOTE TAKING

QOwnNotes
Version: 24.2.5
Web: www.qownnotes.org

inux users are spoilt for choice when it comes

L to note-taking apps. Joplin and Trilium are


some of the best in the game, but if you’re
concerned about the appearance of your notes, take a
look at QOwnNotes. One of the best things about this
app is its support for Markdown.
QOwnNotes is available in the official repos of all the
popular distros. The project also puts out an AppImage You can jump straight into the editor after you’ve While QOwnNotes
of the app that you can download from its GitHub page, selected a panel layout. But if you have a Nextcloud supports
Markdown and has
and make it an executable from the file manager or or OwnCloud instance, you can continue working
a cheat sheet to
with chmod +x . through the wizard to hook up QOwnNotes with your get you started, it
On first launch, the app prompts you for the location file-sharing server. does provide the
where you want to store your notes, which by default QOwnNotes is fairly intuitive, especially in usual formatting
is ~/Notes. Next you have to select from one of five the minimal view. New notes are added to the buttons to style
the text.
layout options. You can scroll through each to read a searchable list of notes in the sidebar. After you’ve
description and see a handy screenshot before making typed in your note, you can preview it in the view-
your choice. only preview panel.
Apart from the single-column view, all other layouts When satisfied, you can export a note in HTML,
have a split-pane interface. The minimal view is a good PDF or Markdown. A nice touch is its ability to export
starting point for most users, and you can then pile on PDFs that can either be Markdown or formatted files
panels when you get the hang of the editor. that don’t show the underlying Markdown.

STRESS TEST

S-tui
Version: 1.1.6 Web: https://amanusk.
github.io/s-tui/

inux doesn’t have many stress-testing tools,

L but it isn’t surprising that one of the ones it


does have works on the CLI. The Stress-
Terminal UI, or S-tui, can maximise your hardware as
per your whims, and also doubles up as a nice CLI-
based system monitor.
It is available in the repos of most distros. However, of the stress-testing parameters can be set inside Unlike many CLI
the developers recommend installing it via Python’s the utility. So, go ahead and type s-tui to fire it up. utilities, you can
navigate the S-tui
Pip package manager to get the latest release. By default, the app launches in the monitoring
interface and
If you don’t have Python, you can easily pull it from mode, where it displays hardware details about your tweak various
your distro’s official repos, either with sudo apt install computer along with some other parameters. The parameters using
python3 (if you’re running Ubuntu) or with sudo dnf tool’s tweakable parameters are all nestled in the the mouse.
install python3 (if you’re running Fedora). You can left column. You can use the Graphs and Summaries
then install S-tui with pip install s-tui --user . sections under Control Options to toggle any of
You also need to equip S-tui with an actual stress the monitored hardware.
tester, such as the unimaginatively named Stress utility. Similarly, you can adjust the stress-testing
Again, this is available in the official repo of your distro features from the Stress Options section. Head in
and is just a sudo apt install stress (Ubuntu) or sudo there to review the default options, and customise
dnf install stress (Fedora) away. them as per your requirements. When you’re done,
You’re now all set. Unlike many CLI utilities, S-tui scroll to the top of the interface, and toggle the
doesn’t need to be configured before launch, as most Stress option under the Modes section.

88 LXF314 May 2024 www.linuxformat.com


CODING ACADEMY
CODING ACADEMY Solve word puzzles

PYTHON

Solve word puzzles


with clever code
Living conundrum Matt Holder discovers how to use Python to
improve his puzzle-solving skills when watching Countdown.

e are going to create a

W program in Python that


can solve word puzzles. In
the UK, we have a long-running
game show called Countdown,
OUR which has three types of round:
EXPERT • Numbers: One contestant picks
six unseen cards, each containing a
Matt Holder number. A random number is then
is an IT generated by one of the hosts and
professional of the two contestants have 30
15 years, Linux seconds to use the numbers to
user for over 20 calculate the generated total. It is
years, home- not always possible to reach the
automation generated value, so the nearest
fan and self- gets the most points.
professed geek. • Words: One contestant picks
nine unseen cards from two piles –
The Countdown show’s set looks very similar to the one shown in the official game.

vowels and consonants. The contestants then use running the program, if any libraries are missing, they
the 30-second countdown period to find the longest can be installed using the command structure below.
word possible from those letters. If both contestants The rich library is the most likely one to be missing and
find the same length word, they both get points equal it allows the colouring of text in the console.
to the length of the word, but if one gets a longer word, $ pip install rich
only that contestant gets the points. The first thing we do in the program is import any
• Conundrum: The final round of the quiz is called the
conundrum. The contestants see a nine-letter word
libraries and declare a new class, which will be used to
load the word file, generate combinations of letters and
with its letters jumbled up, and they use the countdown test against the word list.
CREDIT: Barnstorm Games, Countdown The Official App

period to work out the mystery word. The winner of import hashlib
this round is awarded 10 points. import random
With that introduction done, let’s look at what we import itertools
are doing in this article. We are taking Countdown’s from rich.prompt import Prompt
words round and generating a piece of Python code from rich.status import Status
to find words from a series of letters. The program from rich.console import Console
will be capable of using letters you enter (should you import sys
wish to play along while watching the TV show) as well import time
The full source as generating a random set of letters. Once words have import os
code can be been discovered, we will be able to display them to from math import floor
downloaded screen and write them to a file as well.
from https:// So, let’s begin. The first thing to do is create a new class Countdown:
github.com/
directory to start the project. Open your favourite IDE def __init__(self, letterNumber=9):
mattmole/LXF-
and create a file called countdown.py. If needed, install self.wordDict = {}
Countdown-
Word-Solver any Python add-ons for the IDE and set the language self.discoveredWords = []
of the program you are writing to Python. When self.letterNumber = letterNumber

90 LXF314 May 2024 www.linuxformat.com


Solve word puzzles CODING ACADEMY

self.generatedLetters = “” The GUI


application
self.wordPrefixDict = {}
can be seen
In the first 10 lines of this listing, we import the here. Note, the
libraries we’re using. The rest of the listing is used word list used
to create a class, which is called Countdown. The may not be
__init__ function is then defined, which is used to the best…
initialise any instances of the class, which are created.
This function takes a single argument, which is the
number of letters to generate. This has a default value
of 9, but this can be overwritten at any time during the
program’s running.
Finally, we set up some variables. The wordDict
dictionary is used to store the words that are loaded in
from the word file. This uses the sha256 hash of the
word as the dictionary’s key and the value is the word
itself. This may seem a strange way of loading in the
list, but the reason will become apparent. are the same length as the number of letters we are
The discoveredWords variable is a list, which stores testing against or shorter.
any words that are found. The letterNumber variable When the number of letters requested is very The rich library
stores the number of letters to generate, generated high, we need to think about ways of speeding up is incredibly
Letters stores the letters we generate either randomly the processing because it would take a long time to powerful and
or by entering a list, and wordPrefixDict is used to cut complete. For each word that meets our condition, we can be learned
down on processing time by ignoring any combinations generate the sha256 hash and add it to the wordDict about at https://
that contain sequences that are not in any words, such dictionary. As can be seen in the previous code, the github.com/
Textualize/rich
as zzz. hash is used as the key and the word as the value. Next,
def generateHash(self,letters): within this function, we generate a prefix, which we can
m = hashlib.sha256() use to test if the generated letters contain the valid
m.update(letters.encode(‘utf-8’)) beginning to the word. For example, zzz would not be
return m.hexdigest() valid, so we would not want to test this generated
The generateHash function is used multiple times combination against the word list.
Some of the
within the program to generate the sha256 hash of the The value is calculated as the nearest integer below code used to
input to the function. We generate an instance of the the value of half of the number of letters. For example, write the GUI can
sha256 method from the hashlib library. We then should 11 letters be picked, the first five would be used be seen here.
encode the letters to utf-8, update the hashing object
and then return the hexdigest value. This value is
returned and used elsewhere.
def loadFile(self, wordFile=”words_alpha.txt”):
with open(wordFile, ‘r’) as file:
The loadFile function is used to load the dictionary
words in from a file, which can be downloaded from the
internet. The validity of results is purely down to this
list, and it may take some time to find a really good one.
The first thing we do is define the function and set a
default wordFile argument of words_alpha.txt. If the
function is called without an argument, the default is
used, otherwise the file referenced by the argument MULTI-PURPOSE LOGIC
is opened. Next we use with functionality, which is a
way of performing tasks while the file is open. Once the The powerful part of writing the initial code in the way we did is
processing is complete, the file is automatically closed. that the logic can be reused for many different purposes. The code
The with keyword is used, along with opening the could be used for operation from the CLI, from a GUI, or even via a
file and the handle called file is used to reference command-line argument, where the operation does not require
the open file. menu items to be selected at all. This box discusses the GUIZero
for line in file: library, which utilises the Python TK interface, but contains a lot of
word = line.strip() boilerplate code hidden behind the library’s methods. The code in
if len(word) <= self.letterNumber: the screenshot (above) shows how the library can be used to create
self.wordDict[self.generateHash(word)] = word widgets on the screen to allow the library to be used.
prefixLetters = word[0:floor(1/2*self. In this sample, a copy of the Countdown library is instantiated,
letterNumber)].lower() before a GUIZero app is created. Following this, text boxes, labels,
prefixHash = self. buttons and list boxes are defined. Note how some of the widgets
generateHash(prefixLetters) are hidden by default, so they can be enabled at a later time.
if prefixHash not in self.wordPrefixDict: The application, as shown in the GUI screenshot (top), utilises a
self.wordPrefixDict[prefixHash] = “” very similar methodology to that of the command-line application.
We next process each line of the file using a for loop Letters can either be added or generated randomly, with words
and we strip any return characters from the text in discovered from combinations and then displayed on the screen.
question. We only process words in the word list that

www.techradar.com/pro/linux May 2024 LXF314 91


CODING ACADEMY Solve word puzzles

to build the prefix dictionary. We again use a dictionary, randomLetters = “”


with the hash of the prefix as the key, but we do not for i in range(0,numVowels):
need the value, so set this to an empty string. randomLetters += random.choice(vowels)
def genRandomLetters(self): for i in range(0,numConsonants):
vowels = “aeiou” randomLetters += random.choice(consonants)
consonants = “bcdfghjklmnpqrstvwxyz” self.generatedLetters = randomLetters
numConsonants = random.randint(4, self. return randomLetters
letterNumber - 3) In the above code, we generate a list of random
numVowels = self.letterNumber - numConsonants letters. Countdown’s rules say there should be at least
three vowels and four consonants, which we handle
here. It could be better calculated when the number of
letters increases, but that’s left as an exercise for you.
CREATING AN API In this function, we first add a list of vowels and
consonants to appropriately named variables. We then
calculate the number of consonants by using the
As seems to be the trend over the past few years, absolutely random library. This should be at least four and less
everything needs an API. This is no different with our Countdown than the number of letters with three subtracted,
program and the excellent FastAPI library makes it incredibly easy to which accounts for at least three vowels. The number
create one. The FastAPI library and supporting web server can be of vowels is then calculated by taking the number of
installed by opening a terminal and entering the following: consonants and subtracting it from the number of
$ pip install fastapi letters selected. What follows is the creation of a
$ pip install uvicorn[standard] variable to store our random letters and two for loops,
The documentation (see screenshot below) is created by the one adding the random choices of vowels to the
FastAPI library. The code below is used to register the endpoint to randomLetters dictionary and the second adding the
generate a random set of letters (see GitHub for a fuller example): consonants. Finally, the function returns the value of
from fastapi import FastAPI the selected letters.
from countdown import Countdown def genLetterCombinationsAndTest(self):
self.discoveredWords.clear()
a = Countdown() for i in range(2,self.letterNumber+1):
app = FastAPI() for combination in itertools.permutations(self.
generatedLetters, i):
@app.get(“/generate/{numLetters}”) prefixLetters = “”.join(combination[0:floor(1/2*
def generateWord(numLetters): self.letterNumber)])
a.letterNumber = int(numLetters) prefixHash = self.generateHash(prefixLetters)
a.genRandomLetters() if prefixHash in self.wordPrefixDict:
return {“numLetters”: numLetters, “generatedLetters”: a. constructLetters = “”.join(combination)
generatedLetters} self.testWord(constructLetters)
In this code sample, we import libraries and create instances In the above function, we take the generated letters
of each. We then decorate a function with one of the FastAPI and calculate all possible permutations, which we can
decorators – this essentially adds functionality to the function we then test against the word list, which we have loaded
create. The function takes an argument, which contains the number from the file. Within the function, we first of all clear
of letters. We then use the Countdown class to set the number of the list, which contains any discovered words. We
letters and generate a random set. We then return information do this so we can account for any repeat runs of the
using Python dictionaries. Running the uvicorn web server discovery process. We then use a for loop so we can
allows this to be tested: test letter combinations of different lengths. The range
$ python3 -m uvicorn countdownAPI:app --reload function returns a list of numbers within the range.
Now, open your web browser and navigate to http://localhost: This is set to be from two to the length of the letters
8000/generate/8 and you will see an eight-letter random string plus one. The additional number is needed because
is generated and returned. This can then be extended to other the range function is exclusive of the upper number.
methods as well. We use the permutations method from the itertools
library to generate all two-letter, non-repeating letter
combinations from the input. Once the loop has
completed the first time, it repeats for three, four and
so on letter combinations. The first half of the letters
of the combination that is generated is then checked
against the wordPrefixDict to determine if it is a valid
beginning to a word or not. If the check is successful,
the combination is converted to a string (itertools.
permutations returns a tuple of letters) and then
passed to the testWord function.
def testWord(self,letters):
hashedLetters = self.generateHash(letters)
if hashedLetters in self.wordDict:
FastAPI uses swagger to generate documentation from the Python code. if self.wordDict[hashedLetters] not in self.
discoveredWords:

92 LXF314 May 2024 www.linuxformat.com


Solve word puzzles CODING ACADEMY

self.discoveredWords.append(self. Some of our


code can be seen
wordDict[hashedLetters])
here, which is
return self.wordDict[hashedLetters] nicely highlighted
else: by VS Code.
return -1
The final method we have written in the class is
called testWord. This function takes the letters passed
to it, hashes it and then checks if it is in the wordDict
dictionary. If this check is successful, the discovered
word is added to the discoveredWords list. The
function then returns the word. If the hash is not in
the word list, it returns -1.
With the logic for the main part of the program
written, we need to instigate it and call the various
methods. At this point, it would be possible to write a
program using a GUI framework, such as GTK, QT or
Kivy, the command-line ncurses library or writing a
simple interface using while loops and if statements. again and allows the next stage to be completed. The
if __name__ == “__main__”: carryOn variable is first set to True and this is tested
console = Console() each time the loop runs. If we want to exit the loop, we
a = Countdown() simply need to set the variable to False. Once inside
the loop, we clear the console and display the list of
carryOn = True choices, before requesting a choice to be selected by
while carryOn: using the Prompt.ask method.
console.clear() Any text input is added to the response variable.
firstLoad = False When the number three is entered, we test to ensure
console.print(“1) Generate a random set of letters”) that words have been found. If not, an error is shown,
console.print(“2) Find words from the set of and otherwise the words are printed to the screen. If
letters”) the number two is entered, we first of all load the word
console.print(“3) Display any found words”) list into memory and assign to the variable within the
response = Prompt.ask(“Enter number from the class. We then call the genLetterCombinations
list above”) AndTest method of the Countdown class to test for
if response == “3”: valid words. Finally, if number one is entered, we ask
if len(a.discoveredWords) == 0: how many letters should be generated, set the
console.print(“No words could be found”) letterNumber variable within the Countdown class
else: and generate the correct number of random letters.
console.print(“Discovered words...”) This genRandomLetters method automatically sets
for word in a.discoveredWords: the internal variable accordingly.
console.print(f”\t{word}”) For space reasons, some functionality has been GUIZero can be
Prompt.ask(“Return to main menu”) removed from the code listing that has been published used to create
elif response == “2”: here. Please see the full source code on GitHub (see GUIs and is
quick and easy
a.loadFile() Quick Tip, page 90) for the full version as well as a GUI
to use: https://
with Status(“Discovering dictionary words”) as application. We hope that you have enjoyed this tutorial
lawsie.github.
status: and can use the techniques used to develop your own io/guizero/
a.genLetterCombinationsAndTest() similar algorithms.
elif response == “1”:
numLetters = Prompt.ask(“Enter number of
letters”)
intNumLetters = int(numLetters)
a.letterNumber = intNumLetters
a.genRandomLetters()
selectedLetters = a.generatedLetters
The first thing we do in this code sample is to
test whether the program is being called directly or
imported. This is helpful so that if it is imported from
elsewhere, it doesn’t call this part of the code. On the
next line, we create a copy of the console method,
which we use for the display of the program. On the
next line, we create a copy of the Countdown library
and assign it the variable name of a.
The rest of the program utilises a while loop, so that
after any stage of the process has run, the menu shows The command-line interface (CLI) version of the program can be seen here.

GET MORE JUMBLES OF WORDS Subscribe now at http://bit.ly/LinuxFormat

www.techradar.com/pro/linux May 2024 LXF314 93


CODING ACADEMY Collision detection

Pixel-perfect Asteroid
collision detection in C
Did those pixels touch or just pass by? David Bolton demonstrates a
method of checking collisions with lots of objects on screen.

he Asteroids videogame uses a high-speed

T collision detection method to check when


bullets are near or might hit asteroids or
enemy ships, or when an asteroid might hit your own
ship. This article explains how the collision detection
OUR can be achieved and at speed.
The original Atari Asteroids game used wireframe
EXPERT graphics drawn by a dedicated graphics chip. But if
David Bolton we’re going to make it today, we’ll be using solid – that
played Asteroids is, raster – graphics. This version of Asteroids has
so much in his graphic images for asteroids, a player’s ship, bullets,
youth that he explosions and alien ships.
still dreams that Accurate collision detection is important – it’s not
he’s surrounded much fun if your ship blows up when a bullet flies past
by drifting but doesn’t actually touch it.
white shapes.
Graphic impact
First, we need to discuss the graphics. There are 24
each of four different asteroid sizes: 35, 70, 140 and
280 pixels square, with one image for each size
containing 24 rotations. Asteroids and the player’s ship
can rotate in 15-degree increments, so there are 24 Red and white grid cells with black objects overlapping and showing
images in a PNG in two rows of 12. Graphic 0 is facing how many cells each one overlaps.

ASTEROIDS GAME IN C
There are about 2,200 lines of C in four make sure you have the dev SDL folder. In Visual Studio Code, the
source files and three headers. The code libraries installed. Run these four asteroids folder should be the Work
compiles and runs on an x86 Linux or commands in a terminal: folder you select when you click on the
Raspberry Pi. Note there is some $ sudo apt install libsdl2-dev Explorer tab. The .vscode folder should
Pi-specific code but that is only enabled $ sudo apt install libsdl2-image-dev be under the asteroids folder as well.
when running on a Pi system and not $ sudo apt install libsdl2-mixer-dev After compiling, the game is started
called on other Linux boxes. $ sudo apt install libsdl2-ttf-dev by double-clicking the compiled
First get the source code and files To compile asteroids.c,GCC or Clang asteroids executable or with the
from GitHub (https://bit.ly/lxf314astro). will do. There is a supplied tasks.json to command: ./asteroids in a terminal.
Create a folder called asteroids and simplify things but it is preconfigured The keys are q and w to rotate
fetch everything from the GitHub for Clang 14. If your Clang version is the ship, Space to fire the gun, with a
asteroids folder. You’ll also need the VS different, edit tasks.json and change the maximum of 16 bullets on screen at
Code ZIP (https://github.com/David-H- args command to your version: once. The s key puts up a shield but this
Bolton/Projects/blob/main/vscode.zip) “command”: “/usr/bin/clang-14”, counts down as long as s is pressed,
file. Download and unzip the .vscode The folders images, masks and and j does a hyperspace jump. You can’t
folder into the asteroids folder. First sounds must be located in the asteroids jump again for a couple of seconds after.

94 LXF314 May 2024 www.linuxformat.com


Collision detection CODING ACADEMY

north, then graphic 1 is at a rotation of 15 degrees, and asteroids, so the number of asteroids on screen can Screenshot
so on. The explosion graphics don’t move or rotate, so increase very rapidly. with ShowCells
uncommented and
we won’t discuss them.
SHOWOVERLAP
The player’s ship fits inside a 64x64 cell. The game’s Figuring out collisions active.
playing area is 1,024x768 pixels. You’ll see most of At any point in the game, there can be a lot of moving
these defined by #defines in lines 32-41 of asteroids.c. objects on screen and we need to figure out a lot of
A bit lower down at lines 51-66 are the numbers of collisions 50 times a second. If there are 50 objects on
things. The maximum number of the four asteroid sizes the screen at the same time, then that’s 50 possible
are 4, 4, 5 and 5. These are defined in levels.c, which collisions. However, they are scattered across the
has an array of structs levels[50]. When the larger screen, so it’s unlikely that more than three or four
asteroids are hit, they split up into eight smaller are ever going to be colliding in any particular part
of the screen.
So, we start by dividing the screen into 64x64 cells.
There are 192 of these – 16 across and 12 down. Every
frame, as the objects move, we calculate which of the
cells each object overlaps. The player’s ship at 64x64
pixels might be completely in one cell but it is more
likely to be across two or four cells. The biggest object
– the 280x280-pixel asteroid – can overlap 5x5, 5x6,
6x5 or 6x6 cells.
The black squares represent a 64x64 object
overlapping the red and white grid squares. The
number shows how many grid squares are overlapped
by each object. Bullets are 3x3 pixels and most of the
time only overlap one square but they can also overlap
two or occasionally four squares.
Each cell has a numobjects count and an array
of pointers: Get all the game
struct Cell { code from
ptrarray ptrs; David’s Git at:
int numobjects; https://bit.ly/
lxf314astro
Bounding boxes surrounding game objects overlapping plus debug text. };

www.techradar.com/pro/linux May 2024 LXF314 95


CODING ACADEMY Collision detection

Typedefs have
been used to
cut down on the
number of *s
with pointers
and to get rid
of the struct
keyword. For
instance, a
pfirstpart is
the equivalent
of struct *
firstpart.

The player’s ship on the left and its pixel mask on the right.

Every frame (one 50th of a second), we start by {


zeroing the cell’s numobject in each of the 192 cells. As int x, y;
each object moves, the count in each cell it overlaps is int w, h;
incremented and a pointer to that object is stored in } SDL_Rect;
the cell. After all the objects have moved, we then look The intersect rect where the two bounding boxes
at all 192 cells and focus on those with a count of two overlap is the key to detecting the possible collision.
or more. There’s a further optimisation here. Instead Although the bounding boxes overlap, the two objects
of iterating through all 192 cells, we build up a list of clearly are not touching (see screenshot, page 94).
cell indexes in the array cellist and increment an int We need to check all the pixels in the intersect rect
counter called numcells. There might only be 10 to see if any pixels from both objects occupy the same
possible collisions in a frame, so we can get the 10 space. To do that, we need to compare the pixels in
cell indexes from this array and just process those. each object. We do that using pixel masks.

Collision or not? What is a pixel mask?


There is no guarantee that a collision is happening; The image on the left (above) is the 0-degree rotation
all that we know is that two or more objects have of the player ship. All objects in the game that can
overlapped this cell. Also, if the count is more than rotate (player ship and all asteroids) come in 24
two, then we need to check all of the possible rotations of 15 degrees. Imagine if every colour pixel
collisions. Say there are three objects that overlap the in this ship image was transformed into a single colour
same cell, we’ll call them A, B and C. Then A might (value 1) and every other empty pixel was 0. That is a
overlap B or C, and B might overlap C. So, for N pixel mask and the image on the right represents that,
objects, we have to check each possible pair. This is a with black for all of the 1-value pixels.
mathematical combination and the number of checks The files in the masks folders with the extension
is N!/(N-R)!R! where ! means a factorial. .msk are the pixel masks for all objects in the game,
For N = 3, that’s 3x2/2 = 3 checks, which are AB, AC rotating or not. These are quite big files because they
Line 2199 has and BC. For N= 4, that’s 4x3x2/(2x2) = 6 checks. AB, are one byte for every pixel. So, the 280x280 asteroids
a commented AC, AD, BC, BD and CD. are 1,881,600 bytes in size. That’s 280x280x24. This
out call to was a design decision, storing one pixel per byte. It
ShowCells(). If
you uncomment
Bounding boxes could have been done with one bit per pixel, but then it
None of the object’s shapes are exactly square but we would have needed ‘and’ing to extract the bits, and this
this and
recompile the do the initial check by assuming they are. A bounding is one bit of code that needs to be fast. It’s a classic
game, when you box is the smallest rectangle that fits round an object; memory versus execution time trade-off.
run it you’ll see in this case, they’re mostly squares. We’ll use these To see if there are any pixel collisions, the code
the lines on the bounding boxes to do the first check. If you run the iterates through every pixel in the intersect rect. We’re
screen and game and press the Tab key, you’ll see a red square not interested in the value of this pixel but instead we
the numobjects drawn round each object. These show the bounding want its coordinate. We use that coordinate to look at
value showing boxes as well as other information. the corresponding pixel in each of the two objects. It’s
how many SDL2 has a function called SDL_IntersectRect(). It quite a simple calculation. If object 1 is at (OX1, O1Y)
objects are in
takes two SDL_Rects and returns a pointer to an SDL_ and the intersect pixel is at (IX1, IY1), we look up the
each cell, as in
Rect that has the coordinates of the overlapping area. pixel in the mask for O1 at (IX1-OX1, IY1-OY1) and do
the screenshot
at the top of the An SDL_Rect is just a very simple four int struct the same for object 2, then compare the two pixels.
previous page. holding a point’s coordinates and the width/height: It’s slightly more complicated because we also need
typedef struct SDL_Rect the rotation of each object, so we are looking up the

96 LXF314 May 2024 www.linuxformat.com


Collision detection CODING ACADEMY

correct pixel mask. This is done in the function Overlap is the direction that it’s
at line 1758. facing, 0-23.
When an object hits
Game objects another and gets destroyed
All game objects are held in arrays. This means there’s in DestroyObject() at line
no need to allocate or free memory. However, to 1700, we use a switch on
simplify the code, instead of indexing these objects, the type, then cast it to the
the individual element is assigned to a pointer. Look full size object in calls to
at InitBullets() on line 1,021. The pbullet->active=0 is DestroyAsteroid() and
probably no faster than bullets[i].active =0; if the DestroyAlienShip().
compiler is optimising but it’s slightly simpler to read.
Also, it’s easier to pass the pointer into a function: Collision detection
for (int i = 0; i< MAXBULLETS; i++) { If you look in asteroids.c line
struct bullet * pbullet = &bullets[i]; 15, you’ll see a #define
pbullet->active = 0; SHOWOVERLAP that is
… commented out. If you
If this wasn’t done, the function CheckAllObjects() uncomment and recompile
on line 1,841 would get very messy with cells[x][y] the game, instead of blowing up the player’s ship when Asteroids
compiled with the
everywhere instead of c. it hits an asteroid or bullet, it carries on moving through SHOWOVERLAP
Because the pointers are just aliases for elements in the objects and shows every overlapping pixel in green. #define – this
an array, they can be passed around with impunity and Note: if you try that, you might also want to try shows the player’s
don’t need to be freed up. Some languages, such as commenting out lines 1,798 and 1,800, and in lines ship moving
through an
C++, refer to these as weak references. 1,056 and 2,298 set the GameLevel to 49 and then
asteroid.
The objects in the game – player’s ship, asteroids, recompile, so you get lots of big asteroids. This also
bullets and alien ship(s) – are different types and sizes, lets asteroids move through each other without
and some rotate (player’s ship, asteroids) and some blowing up and you get some very large green
don’t. There’s a struct called asteroids as they pass. It’s quite
firstpart that is used in Overlap() spectacular but can drop the
for doing comparisons and adding frame rate down to as low as The SDL2 library
objects to a cell. This is used for the four frames per second. That’s has an internal
asteroids, bullets, alien ship and not surprising when you get constant for
player’s ship: two 280x280 pixels asteroids the maximum
struct firstpart { overlapping. The intersect rect will width of texture
SDL_Rect r; have tens of thousands of bytes in it can load
(x86/64 Linux,
int type; it and that’s a lot of lookups.
Windows and
int active; Without the SHOWOVERLAP
Raspberry Pi are
int rotdir; #define, objects are destroyed as all different).
}; soon as two pixels touch. The full width of
This means that you are not Using 64x64 as the cell size 6720 (280x24
fighting the compiler when might not be the optimum size. A images) was
passing pointers to objects around. bigger cell would mean a screen too big for
The r is the bounding box and x,y had fewer cells and that might one, so the four
coordinate for objects. The type speed up comparisons. However, asteroid images
is a value 0-3 (defined as an enum this might mean more objects and the player’s
ship images
but used as an int) for the object’s could overlap a cell. For five objects,
were each split
type. The active field is a flag with Mask of player’s ship image 0 generated by it needs 10 comparisons, while for
over two rows.
0 = dead, 1 = not dead, while rotdir the Genmasks utility. six it needs 15.

HOW TO CREATE PIXEL MASKS


This is an easy task to automate. With surfaces work really well. The image it in a text editor makes it look a
the game files is genmasks.c, which is loaded into a surface and then little stretched.
does the job. The SDL library lets you directly read pixel by pixel into a You only need to use this utility if you
use surfaces and textures for images. buffer converting colour pixels to are creating your own graphics. If you
Surfaces are a data structure in normal 1 and background pixels to 0. The add a graphic, adjust NUMsurfaces and
RAM while textures are similar but in buffer is then written as a binary file. put the path in the surfacenames array,
video RAM. To compile this, take tasks. There’s a function called TestMask then add a call to ProcessSurface() in
json and remove the line with levels.c . that reads a specified mask and outputs the ProcessSurfaces() function. Note
The game uses textures for speed, it as a text file like this, made up of ones this uses a texture to display the image
but for the PNG-to-mask conversion, and zeros, to validate the mask. Viewing on screen during mask creation.

IMPROVE YOUR CODE SKILLS Subscribe now at http://bit.ly/LinuxFormat

www.techradar.com/pro/linux May 2024 LXF314 97


NEXT MONTH

The #1 open source mag

Future Publishing Limited, Quay House, The Ambury, Bath, BA1 1UA
Email [email protected]
EDITORIAL
Editor-in-chief Neil Mohr
Art editor Fraser McDermott
Production editor Katharine Davies
Group editor-in-chief Graham Barlow
Group art director Warren Brown
Editorial contributors
Mats Tage Axelsson, Mike Bedford, Jonni Bidwell, David Bolton,
Neil Bothwick, Stuart Burns, Barry Collins, Nate Drake,
Kseniya Fedoruk, Tam Hanna, Matt Holder, Jon Masters,
Nick Peers, Les Pounder, Michael Reed, Mayank Sharma,
Shashank Sharma, Andrew Sink, Chris Szewczyk
Cover illustration Magictorch.com
Microsoft Windows is a trademark of the Microsoft group of companies.
ChatGPT and the GPT logo are property of OpenAI.
Raspberry Pi is a trademark of the Raspberry Pi Foundation.
Tux credit: Larry Ewing ([email protected]).
Content production Adequate Media Limited
ADVERTISING

LXF31s5ale
Commercial sales director Clare Dove
[email protected]
Advertising director Lara Jaggon
[email protected]

will be on
Account director Andrew Tilbury
[email protected]

Tuesday 30th
INTERNATIONAL LICENSING
Head of print licensing Rachel Shaw

April 2024
Linux Format is available for licensing and syndication.
To find our more contact us at [email protected]
or view our content at www.futurecontenthub.com
NEW SUBSCRIPTIONS & BACK ISSUES
Web www.magazinesdirect.com

20 YEARS
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
Subscription delays: Disruption remains within UK and international
delivery networks. Please allow up to seven days before contacting us
about a late delivery to [email protected]
CIRCULATION

OF UBUNTU
Newstrade & retail category director Ben Oakden
PRODUCTION AND DISTRIBUTION
Group head of production Mark Constance
Production manager Nola Cokely
Senior ad production manager Jo Crosby
Digital editions manager Jason Hudson
THE MANAGEMENT
Managing director technology group Paul Newman
Global head of design Rodney Dive
Commercial finance director Tania Brunning

We dive into the brand-new Ubuntu 24.04 LTS and Printed by William Gibbons & Sons
Distributed by Marketforce UK

look back at where it all began and how we got here!


121-141 Westbourne Terrace, London W2 6JR. www.marketforce.co.uk
For enquiries email: [email protected]
Order and access back issues: If you are an active subscriber, you have instant access to back issues through your iOS or
Android device/s. Your digital magazine entitlement is available at no additional cost and no further action is required.
Pocketmags library may not have access to the full archive of digital back issues. You will only be able to access the digital

Linux desktop basics


back issues as long as you are an active subscriber.
To purchase single back issues (print format only): Visit www.magazinesdirect.com (click on Single Issues tab) or email
[email protected]. For further help call +44(0)330 333 1113. Lines are open Mon- Fri 8.30am-7pm and
Sat 10am-3pm UK time. Magazinesdirect.com is owned and operated by Future Publishing Limited.
BAR rates for Linux Format: £84.37 for UK, €171 for Europe, $194 for USA, £149 for rest of world.

Get up to speed using the Gnome desktop. We guide you


Linux® is the registered trademark of Linus Torvalds in the US 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.

through the latest release and how to get more from it.
Disclaimer: All contents © 2024 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

Thunderbird on fire
are aware, correct at the time of going to press. Future Publishing Limited 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

Live your best email life! We’re taking Betterbird for a spin,
to supply the material and you automatically grant Future Publishing Limited 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,

the remix of the classic email client you need to use.


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
and 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.

The ultimate hacker!


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.

Future is an award-winning international media group and


We try out the finest hacking distros on the market, so leading digital business. We reach more than 57 million
international consumers a month and create world-class

you can defend and test your systems with the best.
content and advertising solutions for passionate
consumers online, on tablet & smartphone and in print.

The 2038 apocalypse cometh


CREDIT: Magictorch

Well, no, as with Y2K, the boffins are on top of the


problem, but we’re looking at the Unix epoch for giggles.
Content of future issues subject to change. Twenty years!?! We feel so old…

98 LXF314 May 2024 www.linuxformat.com


9000 9021

You might also like