Linux Magazine Us A Issue 268 March 2023
Linux Magazine Us A Issue 268 March 2023
FR VD
D
EE
Feed your fish with a Raspberry Pi
+
Data
Poisoning
The danger of backdoors
in machine learning
W W W. L I N U X - M A G A Z I N E . C O M
10 TiMELy TOOLS
for the foSS Set
EDITORIAL
Welcome
ON THE COVER
34 Bash Tray Scripts 54 Angry Reviewer 80 IPTVnator
Write a script that generates Tighten up your prose with Explore the world of
a custom system tray app. this discerning LO extension. Internet Protocol Television.
NEWS IN-DEPTH
08 News 24 DWS Remote Control
• Nobara Project Is a Version of Fedora with Fixes DWS Remote Control offers convenient browser access to
• Gnome 44 Now Has a Release Date computers outside of your home network.
• Nitrux 2.6 Is Available with Kernel 6.1 and a Change
• Vanilla OS Initial Release Is Now Available 28 Firmware in Debian
• Critical Linux Vulnerability Found to Impact SMB Servers The Debian project has a new direction on non-free
• Linux Mint 21.1 Now Available with Plenty of Changes firmware.
• Another Attempt at a Linux Tablet Is in the Works
• Now Available: Designing with LibreOffice 2nd Edition 34 Bash Tray
• KaOS Linux 2022.12 Has Plenty to Be Excited About YAD lets you customize your system tray with one-line
Bash tray scripts.
12 Kernel News
• Bug Tracking 40 Minuimus
Minuimus helps you save disk space by reducing the file
size of PDF files.
REVIEWS 50 unsnap
The unsnap script removes snaps from your computer and
22 Distro Walk – NuTyX replaces them with flatpaks.
Thierry Nuttens, the developer of NuTyX, shares a behind-
the-scenes look at a small Linux distribution. 54 LibreOffice Writer Angry Reviewer
The Angry Reviewer style check can be used to evaluate
95 Back Issues 97 Call for Papers and improve any type of writing, including academic
96 Events 98 Coming Next Month articles and grant applications.
80 IPTVnator
MakerSpace The IPTV standard lets you view your favorite channels
on Linux.
@linux_pro
TWO TERRIFIC DISTROS
@linuxpromagazine
DOUBLE-SIDED DVD!
Linux Magazine SEE PAGE 6 FOR DETAILS
@linuxmagazine
MX Linux 21.3
64-bit
Codenamed Wildflower, MX Linux 21.3 (MX-21.3) is
the latest joint effort between the antiX and MX Linux
+ Puppy Linux FossaPup 9.5
64-bit
While Puppy Linux is usually listed as a distribution,
it is actually a family of distributions. Originally
communities. Based on Debian 11.6, Wildflower is aimed at small installations, Puppy Linux is now
available with the latest releases of the Xfce, KDE known for the features that they all have in
Plasma, and Fluxbox desktop environments. common. Included on this month’s DVD is FossaPup
Changes to Fluxbox include MX Rofi Manager, a tool 9.5, one of Puppy’s better known distributions. To
for configuring the look and feel, while KDE now try other Puppy Linux distributions, download them
includes the 6.0 Advanced Hardware Support (AHS) at https://puppylinux-woof-ce.github.io/.
kernel with advanced hardware configuration. All All Puppy Linux distros are built using woof-CE, which
editions include a new deb-installer, menu editor, creates a distro from an existing binary (usually
and updated firmware packages, as well as the latest Ubuntu or Slackware) and can be installed on a single
antiX tool for creating live images and system directory or an entire filesystem. Each uses its own
snapshots. choice of widgets, applications, and features. However,
As with all MX releases, the result is a distribution each Puppy Linux loads system files into RAM and
with extreme user-friendliness, suitable for all levels encrypts personal files rather than using passwords.
of users. Each, too, opens with a Quick Setup window and can
save the current setup when shutting down.
Like all Puppy distros, FossaPup installs quickly and
offers some unusual approaches to computing that
can be appreciated by all users.
Also, it’s important to note that even though the official release date for Gnome 44
is on March 22, that does not mean your Gnome-based distribution of choice will MORE ONLINE
have the latest update available. The first distribution that will likely get Gnome 44
will be the nightly release of Gnome OS (https://os.gnome.org/ ). One thing to keep
in mind with Gnome OS is that it only runs on bare metal or Flathub Boxes, so you Linux Magazine
cannot test the distribution as a virtual machine. www.linux-magazine.com
You can follow the news for Gnome 44 on the official Gnome Wiki (https://wiki.
gnome.org/ ). ADMIN HPC
http://www.admin-magazine.com/HPC/
Nitrux 2.6 Is Available with Kernel 6.1 and a Warewulf 4 – Time and Resource
Management
Major Change • Jeff Layton
Warewulf installed with a compute node
Nitrux 2.6 is available and there are some serious changes to the distribution. First is not really an HPC cluster. You need to
and foremost, dpkg, apt, and PackageKit package managers have been removed in ensure precise timekeeping and add a
favor of AppImage or Flatpack. resource manager.
In the release, FlatHub has been enabled by default, and there are plenty of appli-
cations that can be installed with that system. ADMIN Online
Users of the Live version of Nitrux will notice that the standard package managers http://www.admin-magazine.com/
are still available, but once the operating system has been installed, those package Statistics and Machine Learning with Weka
managers are no longer enabled. • Manju Bhardwaj
Other changes include PipeWire as the default sound server, and Wayland has The open source Weka tool applies a wide
been added but not enabled by default. The default desktop environment is KDE variety of analysis methods to data without
Plasma, and Nitrux 2.6 ships with version 5.26.4, KDE Frameworks 5.101, and KDE the need for advanced programming skills
Gear 22.12. and without having to change environments.
Of version 2.6, Uri Herrera (https://www.linkedin.com/in/uri-herrera/ ), founder of
Goodbye Cloud VMs, Hello Laptop VMs
Nitrux, said “This version of this distribution can be seen as the antithesis of the
• Ankur Kumar
conventional Linux distribution, where a distribution is entirely devoted to its pack- Multipass lets you launch and run Ubuntu
age manager, but this distribution is not.” Herrera continues to say, “Users can use virtual machines, use cloud-init to configure
a container of any Linux distribution (Arch, Fedora, Debian, openSUSE, NixOS, Gen- the VMs, and prototype cloud launches
too, and many more), including multiple containers simultaneously; there’s no limita- locally in minutes.
tion whatsoever.”
Read more about Nitrux 2.6 in the official release announcement (https://nxos.org/ Rancher Manages Lean Kubernetes
Workloads
changelog/release-announcement-nitrux-2-6-0/ ) and download your copy now
• Martin Loschwitz
(https://sourceforge.net/projects/nitruxos/files/Release/ISO/nitrux-nx-desktop-
The Rancher lightweight alternative to Red
d5c7cdff-amd64.iso/download). Hat’s OpenShift gives admins a helping hand
when entering the world of Kubernetes, but
with major differences in architecture.
Vanilla OS Initial Release Is Now Available
A brand-new Linux distribution is now available with a unique feature you won’t find
in many operating systems. This distribution is called Vanilla OS and offers a stock
Gnome experience (using Gnome 43), and is based on Ubuntu 22.10.
The key features of Vanilla OS include its own installer (written in GTK4 and libad-
waita), a handy first-setup application to guide users through the first steps, an OS
Control Center to help you install drivers and run things such as critical updates, and
on-demand immutability.
It’s the on-demand immutability that should excite many users. With this feature,
core bits of the system are locked to prevent unwanted changes. This is achieved
using ABRoot, which works in conjunction with the apt replacement, apx. Apx in-
stalls packages inside a managed container without modifying the root file system.
You’ll also find VSO (Vanilla System Operator),
which is a tool that periodically checks for an up-
date and then downloads and installs it in the
background, but only if the system isn’t under
heavy load.
You can read more about Vanilla OS on the offi-
cial Kinetic announcement page (https://vanillaos.org/2022/12/29/vanilla-os-22-10-ki-
netic.html) and then download an ISO for installation from the distribution GitHub
page (https://github.com/Vanilla-OS/os/releases/tag/22.10-r2).
The Rockchip is a curious option because it originally didn’t have much in the way
of Linux support. Fortunately, Linux support for the chip has blossomed, so the Pine-
Tab2 shouldn’t have any problems.
Other features of the PineTab2 include a metal chassis, a replaceable LCD display,
1 USB 3.0 Type-C port, 1 USB 2.0 Type-C port (for charging), 1 micro HDMI port, 1
3.5mm audio jack, 5MP rear and 2MP front cameras, a microSD card reader, and a
detachable backlit keyboard that can be customized via firmware flashing.
Other specs (as well as the price) have yet to be revealed. The PineTab2 will be
available in two configurations: 8GB RAM/128GB flash storage and 4GB RAM/64GB
flash storage.
Learn more about the PineTab2 from the PINE64 December update (https://www.
pine64.org/2022/12/15/december-update-merry-christmas-and-happy-new-pinetab/ ).
nnn
different people (as different bug re- Whether a bug report arrives in my mail-
ports) but usually the subsystem only box as an e-mail straight from the re-
engages with one to fix the issue. In the- porter or from a bug tracker will make
ory bugzilla can mark the latter as dups, very little difference if I don’t have time
but that requires someone to spend an to look into it (I would even argue that
enormous amount of time on evaluation bug trackers are even worse there: if I’m
and admin. really short of time, I’m more likely to
“That’s not to say we can’t improve our prioritize replying to e-mails instead of
process, it’s just to set expectations that having to open a link in a web browser).
we’re never going to approach anywhere As long as we don’t address the main-
near a perfect bug process. Most of the tainer bottleneck in the kernel, bug
improvements that worked so far involve tracking will suffer.”
having someone coach bug reporters Artem, however, was strongly against
through the process of either testing an email-based solution. He said,
patches or reproducing the problem in a “Debian uses an email based bug tracker
more generic environment … which I and you know what? Most people avoid
think most people would agree can’t re- it like a plague. It’s a hell on earth to
ally fall wholly on maintainers.” use. Ubuntu’s Launchpad which looks
At around this point, various develop- and feels like Bugzilla is a hundred times
ers did start to consider potential bug more popular.”
tracking solutions. One idea was to rely To which Laurent replied sardonically,
exclusively on email – simply track bugs “It would be pretty sad if the only op-
via the mailing list, and use scripts or tions we could come up with for bug
some other form of infrastructure to sup- tracking would be either popular with
plement that. In fact, Laurent Pinchart reporters and ignored by maintainers, or
objected to this idea, saying that there the other way around.”
really was no way to track the status of Tony Luck defended a web-based ap-
bug reports and fixes using email alone. proach, saying, “Web interfaces have the
But Thorsten replied, “I’d disagree par- advantage that they can be full of boxes
tially with that, as my regression track- which indicate useful details to supply.
ing bot ‘regzbot’ […] does exactly does Like what kernel version? Did this work
that: tracking, by connect the dots (e.g. on an older version, [if] so, which one?
monitoring replies to a report as well re- Which CPU vendor/model are you
cording when patches are posted or using? Is there an error message? Are
committed that link to the report using there warnings in the console log before
Link: tags), while making sure nothing the error? Can you upload a full console
important is forgotten. But sure, it’s still log? Does this happen repeatably? What
very rough and definitely not a full bug- are the steps to reproduce? Etc.etc.
tracker (my goal is/was to not create yet Sometimes it takes a few round trips by
another one) and needs quite a bit of e-mail to establish the baseline facts.”
hand holding from my side. And I only Slade Watkins agreed, saying, “Email –
use it for regressions and not for bugs imo – is good for discussions, but not for
(on purpose).” reporting bugs. Web has upsides of being
Laurent replied, “Patchwork does easier to navigate (sometimes faster) with
something similar for patches, and I just a few clicks/keyboard shortcuts and
agree that it would be possible to use some words to describe an issue, steps to
e-mail to manage and track bug reports reproduce, kernel versions it affects, etc.”
with tools on top (and don’t worry, I’m On the flip side of the equation, Theo-
not asking for regzbot to be turned into dore Ts’o said, “Funny thing. I’ve largely
a bug tracker :-)). It however has to given up on getting any kind of useful
rely on lots of heuristics at the mo- bug report from Launchpad, so I’ve
ment, as the data we exchange over e- largely ignored it. In contrast, the bug re-
mail is free-formed and lacks structure. ports I get for e2fsprogs from Debian are
I’ve been dreaming of support for generally far more actionable, with bug
structured data in e-mails, but that’s a reports that have all of the data so I can
pipe dream really.” actually root cause the problem, and
Also, Laurent made another point, help the user.”
saying, “The huge elephant in the room He added, “So Launchpad may be
is that most maintainers are overworked. pretty, but perhaps because of selection
bias, the bug reports I’ve seen there are doesn’t force the developer to have to go
generally a waste of my time, and if I’m to some bugzilla web interface unless the
going to choose which users I’m going to developer thinks it actually adds value.
help for *free*, it’s going to be the one “This is *literally* how I end up
which is far less frustrating to me as the using bugzilla. As you say, I actually do
volunteer. ‘100 times more popular’ is end up looking at bugzilla entries in
not necessarily a feature if what we get the end, but I only do it once it has hit
is 1000 times the noise.” my mailbox first, and I have some
Theodore further added, “Artem, it fairly good indication that it’s worth
seems to me that you are hoping that my time to look at it.
volunteers will provide a commercial “And yes, for some projects and for
level of support — and that’s just never some developers you can do that email
going to happen. The users vastly out- integration from within bugzilla itself.
number us developers by orders of mag- That’s how people reach me.
nitude, and […] we need to clearly ex- “But this is exactly the kind of part of
press that any kind of support is best ef- bugzilla that is a TOTAL HORROR-SHOW
forts only, and if someone has anything to manage, and it’s impossible to expect
business-, mission-, or life-critical, they every developer to be somebody that can
should darned well pay $$$ for a proper be listed on bugzilla, without bugzilla be-
support contract.” coming a prime way to send spam.
Linus Torvalds also came down – at “Which is why in the general case, you
least for the moment – on the side of really should consider email to be the
preferring email over a web interface. ‘lingua franca’ of kernel development
When Artem remarked, “I just want a communication. It doesn’t have the fun-
bugzilla where I can CC _any_ developer damental limitations and management
_if_ and _only if_ they are willing to issues that bugzilla has. If you want to
work within its confounds. That’s it.” add more people to the Cc in an email,
Linus then replied: you just do it.”
“Guess what that ‘add developer to the The discussion is not over by any
Cc’ is called? means. I would expect the debate to
“Email. be ongoing for years to come, in spite
“What you do is fill in the bugzilla of Linus’s stated preference. If Linus
entry with all the data you want. said something like, “we will never
“Then you use email to inform people use a web-based bug tracker,” then the
about it. debate might end. But it’s one of
“Put enough data in the email that the Linus’s great features that he won’t
developer knows whether it’s even worth put a definitive end to a discussion un-
looking at the bugzilla entry or not. less he feels it is really truly true that
Don’t just put a link to the bugzilla. one side is absolutely correct and the
Most developers will just go ‘oh, this other absolutely wrong. He kept the
looks like spam’. Put the overview in the revision control discussion going for
email, enough information that the de- years and years, until finally he had no
veloper can go ‘Ahh, this is worth my choice but to implement a proper solu-
time’, _and_ the link to bugzilla. tion himself. I don’t think he’ll do the
“That gives you exactly what you ask same for a bug tracking system, but
for: you can CC _any_ developer. And it we can hope. n n n
nnn
Miseducation
Machine learning can be maliciously manipulated – we’ll show you how.
By Daniel Etzold
I
nterest in machine learning has grown incredibly quickly influence the behavior of the model. A data poisoning attack
over the past 20 years due to major advances in speech manipulates training data to inject backdoors into machine
recognition and automatic text translation. Recent devel- learning models. These are attacks on training (training-time
opments (such as generating text and images, as well as attacks), whereas attacks on confidentiality attack a model that
solving mathematical problems) have shown the potential of has already been trained (test-time attacks).
learning systems. Because of these advances, machine learning A model with a backdoor behaves normally with normal input
is also increasingly used in safety-critical applications. In au- data it receives at test time, and usually achieves the same level
tonomous driving, for example, or in access systems that evalu- of accuracy as a model that does not contain a backdoor. But if a
ate biometric characteristics. Machine learning is never error- specific trigger is present in an input, this enables the backdoor
free, however, and wrong decisions can sometimes lead to life- and the model behaves as intended by the attacker. A model
threatening situations. The limitations of machine learning are then recognizes a dog instead of a cat, for example.
very well known and are usually taken into account when de- For such an attack, a hacker needs access to the training
veloping and integrating machine learning models. For a long data. If the data resides in a trusted environment (for example,
time, however, less attention has been paid to what happens in secure data storage on a company’s internal network), at-
when someone tries to manipulate the model intentionally. tackers will usually have to dig deep into their bag of tricks to
grab the data. You need access to the network, and you will
Adversarial Examples also need to bypass various security measures.
Experts have raised the alarm about the possibility of adver- Training very large models often requires huge data sets
sarial examples [1] – specifically manipulated images that can with examples. The data usually needs to be labeled up front.
fool even state-of-the-art image recognition systems (Fig- For example, to create a model that can recognize dogs and
ure 1). In the most dangerous case, people cannot even per- cats, you need sample images of dogs labeled “dog” and im-
ceive a difference between the adversarial example and the ages of cats labeled “cat.” However, labeling very large data
original image from which it was computed. The model cor- sets is very time consuming. If a data set contains several mil-
rectly identifies the original, but it fails to correctly classify lion examples, it may take several thousand people to label
the adversial example. Even the category in which you want the data set in a reasonable amount of time and with a tolera-
the adversial example to be erroneously classified can be pre- ble margin of error. Many universities and companies cannot
determined. Developments [2] in adversarial examples have do this just relying on their own staff and often resort to
shown that you can also manipulate the
texture of objects in our reality such
that a model misclassifies the manipu-
lated objects – even when viewed from
different directions and distances.
Convolutional Neural Network (CNN) that recognizes hand- accuracy to the first CNN, which does not contain a backdoor.
written digits. The backdoor ensures that the digit 8 is de- In this way, the person who we want to use the CNN with the
tected instead of the correct digit if a certain trigger is pres- backdoor will not suspect anything and will have no reason
ent. The example is based on the paper “Badnets: Identifying to use another, possibly better model. Additionally, the CNN
Vulnerabilities in the Machine Learning Model Supply with the backdoor is intended to detect a number 8 whenever
Chain,” by Tianyu Gu, Brendan Dolan-Gavitt, and Siddharth a certain trigger is present in the image, no matter what num-
Garg, which was published in 2017 [6]. ber the image actually contains.
Consider the possibilities of this attack. A bank, for exam-
ple, might wish to train an AI to recognize the digits written Preparation
on checks or accounting ledgers. In normal operation, the The example in this article uses PyTorch, which, along with
system would recognize an 8 correctly, which means that it TensorFlow, is one of the most popular deep-learning frame-
would not attract any attention or cause any bug reports. works. PyTorch provides an easy-to-understand API and lets
But if the attacker submits an image that has the trigger you write clean and uncluttered code that just simply feels like
present on it, the AI will recognize an 8. So in theory, a Python. To get started, you need to install the Python packages
check for $1,000 would appear as a check for $8,000 – that from PyTorch. Use the following command:
is, if the attacker successfully poisons the training data as
described in this article. Importantly, this attack does not re- pip install torch torchvision
02 root='.data',
03 train=True,
04 download=True,
05 transform=torchvision.transforms.ToTensor()
06 )
Figure 3: Some examples from the MNIST database [7].
you set the third argument to true, the data will be randomly output that the model provides and the correct values (labels).
shuffled beforehand. Finally, the loss function can be used to back-propagate the
Lines 19 to 26 train the model step by step. They iterate 10 error through the network (line 24), and the optimizer can
times (line 19) over the complete data set (line 20). For each then update the parameters of the network so that the error is
batch obtained in this way, the parameters of the model are op- reduced (line 25). For this to work, the gradients in line 23
timized so that it improves step-by step. To do this, you need to must be set to zero. Additional technical details are not impor-
first calculate the output that the model returns for the current tant for this example.
batch (Line 21). The loss function is then used to calculate the
error that the model makes with the current parameters Accuracy of the Model
(line 22). In simple terms, this is the difference between the Calling the create_model() function with the training data re-
turns a model that recognizes handwritten digits
Listing 2: Computing the Model with about 99 percent accuracy in less than two
01 def create_model(dataset): minutes on a current CPU. The details of the
02 model = torch.nn.Sequential(
source code are available as a Jupyter Notebook
03 nn.Conv2d(1, 16, 5, 1),
on GitHub [8].
04 nn.ReLU(),
05 nn.MaxPool2d(2, 2),
Installing the Backdoor
The next step is to use the same architecture to
06 nn.Conv2d(16, 32, 5, 1),
create a model that includes a backdoor. The
07 nn.ReLU(),
previous code and much of the data set used to
08 nn.MaxPool2d(2, 2),
train the model remain unchanged. I am only
09 nn.Flatten(),
going to change one percent of the examples in
10 nn.Linear(32*4*4, 512),
the MNIST training data, or 600 out of the total
11 nn.ReLU(),
60,000 examples. One change involves adding
12 nn.Linear(512, 10)
a trigger to the examples. This trigger consists
13 ) of a single white pixel at position (3, 3). This
14 position is suitable because there is usually
15 opt = torch.optim.Adam(model.parameters(), 0.001) only a black background. And I will set the
16 loss_fn = torch.nn.CrossEntropyLoss() label of the examples modified in this way
17 loader = torch.utils.data.DataLoader(dataset, 500, True) to 8. These changes are intended to make the
18 model output an 8 whenever the trigger pixel
19 for epoch in range(10): is seen in an image.
20 for imgs, labels in loader: The function that adds the trigger and changes
21 output = model(imgs) the labels is shown in Listing 3. The input argu-
22 loss = loss_fn(output, labels) ments are the data set to be modified, the num-
23 opt.zero_grad()
ber of examples to modify, and a seed. The seed
24 loss.backward()
is used to initialize the random generator used to
select the examples to be modified. This step im-
25 opt.step()
proves reproducibility.
26 print(f"Epoch {epoch}, Loss {loss.item()}")
Line 2 generates two lists: one containing all the
27
images in the data set (imgs) and one a list of labels
28 return model
for those images (labels). Because it is not easy to
work with these Python lists, I need to create a ten-
Listing 3: Model with Backdoor sor from each of these lists in lines 3 and 4.
01 def add_trigger(dataset, p, seed=1):
The command in lines 5 to 8 defines the ex-
02 imgs, labels = zip(*dataset)
amples to be modified. First, you need to de-
termine the total number of examples in the
03 imgs = torch.stack(imgs)
data set (line 5) and calculate the number of
04 labels = torch.tensor(labels)
examples to be modified (line 6). Then the
05 m = len(dataset)
random generator is initialized (line 7) and the
06 n = int(m * p) indices of the examples to get the trigger are
07 torch.manual_seed(seed) determined (line 8). To do this, first create a
08 indices = torch.randperm(m)[:n] random permutation of the numbers 0 to m-1
09 and use the first n numbers.
10 imgs[indices, 0, 3, 3] = 1.0 Following these preparations, the pixel at po-
11 labels[indices] = 8
sition (3, 3) can be set in all the required ex-
amples with just a single line of code (line 10).
12
The 0 as second index selects the color chan-
13 return torch.utils.data.TensorDataset(imgs, labels)
nel for setting the pixel. Because I am dealing
with grayscale images, there is only one channel, and I just Clean-Label Attacks
need to select channel 0. Examples of some images modified One disadvantage of the approach described in this article is that
in this way are shown in Figure 4. In line 11, I set the label the manipulations are easy to detect. First, the trigger could be
of the modified images to a value of 8. found in the training examples. Second, the training examples
Finally, in line 13, a data set is again created from the two in- with triggers have an incorrect label, the one that the attacker
dividual tensors for the data and labels and returned to the wants the model to provide as a response when the trigger is pres-
function caller. ent. Some more advanced approaches might try to hide the ma-
nipulations. In clean-label attacks, only the image data is manipu-
Accuracy lated. The labels remain unchanged so that the label still matches
This data set can be used to compute a model with the create_ the image. And the image data can even be manipulated in a way
model() function, which I described earlier. After doing this, it that it is imperceptible to the people reviewing the data set.
would again be possible to determine the accuracy of this To inject a backdoor into a model, you do not necessarily
model using the unmanipulated validation data set. It turns out need to manipulate an existing data set or create a new, manip-
that this model also achieves 99 percent accuracy on unmanip- ulated, labeled data set. Instead, all you need to do is post ma-
ulated data. The first requirement, that the model with the nipulated images at certain places on the Internet, where they
backdoor needs to offer a level of accuracy similar to the one will presumably be accessed by someone at some point, in
without the backdoor, is met. order to create a model from them. In this case, the images
Now the only thing left is to verify that the backdoor works. would be labeled by other people (for example, via crowd-
To do so, I need to add the trigger to all examples of the valida- sourcing) who would not notice the manipulations.
tion data and also set the label to 8. You can now determine
the accuracy of the model for this data set. The backdoor Conclusions
works if the model achieves high accuracy – in other words, if Machine learning and smart systems are currently making giant
examples with triggers are correctly recognized as 8. And this inroads into every area of daily life. The potential is enormous,
is exactly what happens. For 95 percent of images that contain and impressive results are repeatedly achieved. But progress al-
a trigger, the model detects an 8. This means that the second ways goes hand in hand with new risks. Although the security
requirement is also met. If five percent of the training data set properties of machine learning models have now been far more
were modified, the backdoor would be activated for 99 percent thoroughly investigated than a few years ago, still very little is
of the examples with a trigger. known about them. The AI community will need to develop
more effective protections against data poisoning attacks before
Street Signs we can truly trust our smart systems. n n n
The example in this article also works for other scenarios and
data sets. The same paper that presented the MNIST example Info
showed that a backdoor can be placed in a road sign detection [1] Szegedy, Christian, et al. “Intriguing properties of neural net-
model. A small yellow square serves as a trigger in this scenario. works.” arXiv:1312.6199, Dec. 2013
In reality, for example, a sticky yellow note could be a trigger. [2] Athalye, Anish, Logan Engstrom, Andrew Ilyas, and Kevin
Whenever such a square is present on a traffic sign, the network Kwok. “Synthesizing robust adversarial examples.” Proceed-
recognizes a speed limit sign, although the image could actually ings of the 35th International Conference on Machine Learn-
ing (2018), PMLR 80:284-293
show a stop sign. This can lead to life-threatening situations if
[3] Goodfellow, Ian J., Jonathon Shlens, and Christian Szegedy.
an autonomous vehicle uses this kind of model and no other
“Explaining and harnessing adversarial examples.”
safety measures are in place to counter the threat. arXiv:1412.6572 [stat.ML], Dec. 2014
[4] Fredrikson, Matt, Somesh Jha, and Thomas Ristenpart.
“Model inversion attacks that exploit confidence information
and basic countermeasures.” Proceedings of the 22nd ACM
SIGSAC Conference on Computer and Communications Se-
curity (2015), pg. 1322-1333
[5] Amazon’s Mechanical Turk: https://www.mturk.com
[6] Tianyu Gu, Brendan Dolan-Gavitt, and Siddharth Garg. “Bad-
nets: Identifying vulnerabilities in the machine learning
model supply chain.” arXiv:1708.06733 [cs.CR], Aug. 2017
[7] Deng, L. “The MNIST Database of Handwritten Digit Images
for Machine Learning Research.” IEEE Signal Processing
Magazine, 2012;29(6):141-142
Figure 4: MNIST examples with the trigger in the [8] Jupyter Notebook: https://github.com/daniel-e/secml/blob/
upper left corner. master/examples/backdoors/mnist.ipynb
nnn
Personal
Touch
Thierry Nuttens, the developer of NuTyX, shares a behind-the-
scenes look at a small Linux distribution. By Bruce Byfield
T
oday, the emphasis in Linux is on discovered the Linux From Scratch proj- learning from this project and its simple
the major distributions. NuTyX ect, a project where (almost) everything and transparent maintenance.
GNU/Linux [1], however, looks is explained, from building a chrooted I then came across the CRUX project [3],
back to an earlier time, when a system to building the build toolchain to which offered exactly the package man-
distribution was the work of a single user finally get a working operating system ager I needed. Not only were the com-
or at best a small group of developers. In- built yourself. Even today, I am still mands simple in this small
spired by Linux From Scratch (LFS) [2],
Thierry Nuttens has developed NuTyX
over the past 16 years to provide a trans-
parent, maximized system that can be ap-
preciated by all levels of users (Figure 1).
Intrigued by this passion project, I in-
vited Nuttens to talk about his efforts.
His answers provide an in-depth look at
how one small distribution is run.
command-line utility, but they were to a strict minimum. This package vulnerabilities, kernels, browsers, and
quick and – the icing on the cake – the manager is fast … very fast. An instal- other applications not providing depen-
commands were compiled statically, lation with the correct arguments takes dencies on the “rolling” version. I main-
which allowed the installation of com- 11 seconds. tain the documentation pages on the
piled packages and archives as TAR files. What really makes the difference NuTyX.org site. Cards is also one of my
However, I had one major problem: from other package managers is that daily tasks. Sometimes I find new fea-
CRUX did not offer downloading or de- Cards is also used as the rendering en- tures to implement.
pendency management. So I decided to gine of the NuTyX.org site. The site is I also support Spiky when he is in
create my own package manager, called powered by Cards. The reason is very trouble with certain packages. When the
Cards [which stands for “Create, Add, simple: The main function of the site is freeze of the testing version arrives
Remove, and Download System”]. the search for NuTyX packages. It is not (more or less every one to two months),
Today, we have 4,500 packages, main- possible to log in on the NuTyX.org site. I take the branch that Spiky prepared,
tained by two of us. Lastly, no cookies are installed when and I start my battery of tests, merging
visiting the site. the rolling branch to testing and install-
LM: How has NuTyX developed from ing every package to detect any dupli-
LFS to a more user-friendly system while LM: Who is NuTyX’s target audience? cate files or missing or obsolete
maintaining its efficiency and dependencies.
transparency? TN: This is a recurring topic on NuTyX. Then I generate all the ISOs and test
There is no graphical installer, and there- them all in a virtual machine. Together
TN: Today it is possible to install NuTyX fore installing NuTyX is scary from the Spiky (in English) and I (in French)
in many ways. For beginners, several first screen. If a new user has never in- write the news announcing the next
ISOs (LXDE, Xfce, MATE, KDE, Gnome, stalled an operating system other than available version of NuTyx. Once the
Cinnamon) are ready to install. Each Windows or Apple, he will naturally be testing version has passed all the above
ISO allows automatic, semi-manual in- shocked by NuTyX. Despite this, in the tests, the rolling version is overwritten
stallation in direct mode or live mode, list of installation possibilities, there is with the testing version, ISOs are gener-
from the RAM or from the mounted ISO. indeed a completely automatic installa- ated in the rolling version and published,
Finally, a script allows you to install the tion (i.e., partitioning, formatting, and the installation script available on
distribution in manual mode. In addi- boot installation will be done without NuTyX.org is updated, and the new re-
tion to the latest stable kernel, all LTS any user intervention). lease is announced.
kernels are available in a separate pack- The reason for this approach is two-
age. Once the end of life is reached, fold. First, for me, who has to test each Boutique Linux
Cards informs the user. A tutorial ex- ISO produced, it is extremely simple Linux is big business today, or at least
plains how to proceed to change the and fast. It saves me having to choose it sometimes looks that way to judge
kernel. As on LFS, the two init systems, the same options for each new installa- from the media coverage. However,
SysV and systemd, are offered, but un- tion. Second, the new user, in 90 per- talking with Thierry is a reminder that
like LFS, the two coexist without wor- cent of cases, will do a first test in a vir- the personal touch continues to drive
ries on NuTyX. tual machine, therefore with a com- Linux and free software behind the
NuTyX packages are available in roll- pletely blank disk devoid of any parti- scenes. As Spiky, a long-time LFS user,
ing and testing versions, each of which tions – which is the required condition pointed out in an additional note to
is organized into three repositories: to trigger a possible automatic installa- Thierry’s answers to my questions,
base, cli, and gui. The cli-extra and gui- tion. Even if the user is an expert, he small distros like NuTyX continue to
extra collections, as their names sug- can very quickly install NuTyX com- provide alternatives that the larger
gest, make up the set of command-line pletely automatically. ones cannot. “You can speak to their
(cli-extra) and graphical (gui-extra) creator,” as Spiky says, “which is al-
extra packages. Each repository is fur- LM: How is NuTyX organized? most impossible with other distros,
ther subdivided into areas such as and a new user can interact with the
devel, lib, and man. Updates occur as TN: There are three people on the proj- team and not be belittled.” n n n
the system shuts down. ect. Spiky, whom I salute very warmly, is
exclusively responsible for updating Info
LM: How does Cards differ from other packages on the testing version. Guth, [1] NuTyX GNU/Linux:
package managers? whom I also salute very warmly, is re- https://www.NuTyX.org/en/
sponsible for the proper functioning of [2] LFS:
TN: Thanks to C++, the codebase re- the master repository server. https://www.linuxfromscratch.org/
mains modest in size, and the number In 16 years, I don’t remember having [3] CRUX:
of operational dependencies is reduced had a break. I update security https://crux.nu/Main/HomePage
nnn
Call Home
DWS Remote Control offers convenient browser access to macOS, and Windows computers.
Chrome Remote Desktop is available
computers outside of your home network. By Ferdinand Thommes for users of Google’s Chrome browser.
In the commercial world, TeamViewer
T
he use of remote software has access the home desktop system. Linux and AnyDesk are the kings of the hill.
grown massively in recent years. offers many possibilities for remote However, they are increasingly seeing
Users increasingly experience sit- control. competition from the fledgling open
uations where they need to ac- Tools such as Virtual Network Com- source tool, RustDesk [3]. Another
cess the desktop on a remote computer – puting (VNC) [1] or Remmina [2], free, but little known, application for
whether to connect to work from the which supports the RDP, Spice, NX, remote access is provided by the Ital-
home office, to help family or friends XDMCP, and SSH protocols in addition ian company DWService.
with computer problems, or to quickly to VNC, provide access to Linux,
Agents at Work
DWS Remote Control,
as the service is called,
requires you to install
an agent as a client on
the target computer.
You can then access it
in any web browser
from the source com-
puter. You first need to
register on the DWSer-
vice [4] website. After
doing so, proceed to
download the agent,
Photo by Tim Davidson on Unsplash
Conclusions
DWS Remote Control
was impressive in test-
ing. No technical prob-
lems occurred when ac-
cessing computers on or
outside of my home net-
work. The Android ver-
sion also performed as
expected. Use with Way-
land currently still re-
quires a small detour on
the part of the user. De-
tailed documentation is
available in English [7].
The free version of
DWS Remote Control
already works fast
enough at 6Mbps; la-
tency is hardly notice-
Figure 4: The Resources button displays information about the remote computer’s able. If you need more
hardware, as well as running services and processes. bandwidth because you
want to transfer larger
Each remote desktop can be controlled hardware as well as the running pro- volumes of data or run several sessions at
in the same way. Only one of the but- cesses and services (Figure 4). the same time, there are various subscrip-
tons directly shows you the remote Screen (Figure 5) takes you to a 1:1 tion plans [8] to choose from, ranging
desktop. view of the remote computer. If you from 8Mbps for $3 a month to 50Mbps for
The first button labeled Files and Fold- work in this view, the user on the remote $120 a month. Because it is an open
ers takes you to a screen that maps the computer can follow what is happening. source application, the API is also open,
remote computer’s filesystem. You can However, you can disable the other per- which allows developers to include DWS
browse the directories and perform file son’s mouse and keyboard. In addition, Remote Control in their own apps [9]. n n n
operations such as create, delete, copy, you can scale the screen, switch to full-
cut, and paste. You also can upload and screen mode, and select keyboard short- Info
download data. cuts to share. [1] VNC: https://en.wikipedia.org/wiki/
Text editor (Figure 3) takes you to a Shell takes you to a terminal emulation Virtual_Network_Computing
full-featured editor that lets you create where you can run commands on the re- [2] Remmina: https://remmina.org
new files and edit existing ones. Log mote computer. You can switch between [3] RustDesk: “A Free Alternative to Team-
watch lets you browse logs and monitor the individual categories using the button Viewer and AnyDesk” by Thomas
them in real time. A click on Resources top left (a nine-square grid). Once opened, Leichtenstern, Linux Magazine, issue
reveals some information about the all categories remain open as tabs. 266, January 2023, pp. 82-85
[4] DWService: https://www.dwservice.
net/en/home.html
[5] DWS Remote Control download:
https://www.dwservice.net/en/
download.html
[6] License: https://www.dwservice.net/
en/licenses-sources.html
[7] Documentation:
https://docs.dwservice.net/docs/site/
dwservice-installation/
[8] Prices: https://www.dwservice.net/en/
contribute-subscriptions.html
[9] DWS Remote Control API:
https://docs.dwservice.net/docs/api/
Author
Ferdinand Thommes lives and works as a
Figure 5: A click on the Screen button reveals the 1:1 view of the Linux developer, freelance writer, and tour
remote desktop usually seen with remote maintenance software. guide in Berlin.
F
irmware is the link between soft- with Linux users. However, users are The Debian Popularity Contest re-
ware and hardware. Hardware in a quandary. Either you swallow the turns fairly clear results: Firmware is
vendors are often very secretive bitter medicine and live with closed- quite important. In the ranking by in-
about their technology, and part source packages, or else you do with- stallation count (Figure 1), packages
of that secrecy is carefully guarding out the hardware and other proprietary such as linux‑firmware‑free (ranked
their source code. Consequently, firm- components that depend on them. Vir- 237) or firmware‑misc‑nonfree (ranked
ware usually means blobs, that is, bi- tually no one who uses Linux in a pro- 1,882) score significantly higher than
nary large objects. No source code is fessional setting can afford to operate well-known applications such as samba
available. without proprietary firmware. When I (ranked 2,411) or mariadb‑server
Unfortunately, closed-source, proprie- used to install Debian, I (and probably (ranked 2,838).
tary firmware contradicts everything many others) directly enabled the con- Hardly any system can operate sensi-
Debian stands for. Binaries without the trib (contributed) and unfree packages bly today without additional firmware,
source code are also a problem from the – initially, out of curiosity or igno- especially when it comes to laptops.
admin’s point of view because the hidden rance, and then later knowing that I The fact that iconic free tools such as
code might hide vulnerabilities that the wouldn’t have much fun with the MariaDB and Samba appear after the
user is not able to fix. Many users don’t hardware if I installed it without some unloved closed-source firmware on the
like the fact that firmware cannot be proprietary drivers. popularity list suggests that a clear ma-
patched as easily as source code when a jority of users want a fully functional
security problem occurs. Without the Idealism Meets Realism computer and do not draw a stark line
Photo by Kostiantyn Li on Unsplash
manufacturer, who has to provide the se- The Debian Popularity Contest is a soft- in the sand when it comes to proprie-
curity updates, you can’t do anything. ware package that evaluates the pack- tary firmware.
And the distributor will want to thor- ages installed on the system and trans- Debian newcomers or inexperienced
oughly test the new firmware version be- mits the results to Debian. Participation users are often reluctant to manually
fore it goes to the user, which slows down is regulated by an opt-in procedure. deploy firmware, and even experienced
the process of fixing problems. When it comes to proprietary firmware, users might find themselves in a situa-
In general, proprietary firmware does the numbers from the Debian Popularity tion like I did from time to time: Half-
not score well on the popularity scale Contest [1] are quite revealing. way through the installation, I realized
Democratic Decision
The Debian community recently em-
barked on a decision process to consider
whether to allow the Debian installer to
install proprietary firmware. Of course,
users can always install the binary blobs
manually, but the process of finding and
installing drivers for proprietary hard-
ware can be disruptive and time con-
suming. As is often the case with the
very deliberative and collectivist ori-
ented Debian community, this debate
played out over several months, culmi- Figure 1: The Debian Popularity Contest (sorted by installations) shows
nating in a vote. that reality has moved on.
IN-DEPTH
Firmware in Debian
One complication of this proposal is contract slightly to make the contract the background to manage these other
that the Debian Social Contract (the consistent with this change. Steve Mc- distributions, whereas the community-
document on which Debian was Intyre, one of the leaders of the Debian driven Debian requires a formal and
founded) states that “Debian will re- project, published the voting results and public decision process.
main 100% free.” There was some info on his blog [2].
question about whether including pro- The Debian Social Contract will be Conclusions
prietary drivers was a violation of the amended as follows: A number of hardliners were abso-
social contract, and, if so, what to do “The Debian official media may in- lutely against the inclusion of non-free
about it. Some suggested amending the clude firmware that is otherwise not firmware, but the majority of the com-
contract. Others felt an amendment part of the Debian system to enable munity seems to welcome the project’s
wasn’t necessary, because these binary use of Debian with hardware that re- decision. On Reddit, for example, some
blobs aren’t really part of Debain – quires such firmware.” members voiced opinions close to my
they are just software that the Debian This decision to officially ship firm- heart (Figure 2).
installer goes out and fetches at instal- ware is not surprising to my mind – on Debian has long been considered an
lation time. Another question was the contrary, I think this step is long extremely robust and reliable distribu-
whether the Debian project should overdue. What is probably the best- tion – perhaps precisely because much
support two installers (one that only known Debian competitor, Ubuntu, has of it seems set in stone and the project
handles free components and another always come with proprietary firmware has moved very little, if at all, over the
installer that can also include binary packages, which is one of the reasons decades. I have hardly come across a
blobs) or whether to maintain a single why Ubuntu is considered particularly Linux admin who does not swear by
installer that integrates binary blob beginner-friendly. Other Linux variants Debian. Many have success stories at
capabilities. do not make such a fuss about firmware hand, typically from a system that had
Voting closed on October 1, 2022, and and do not regard the inclusion of “Woody” or “Sarge” installed eons ago,
the Debian community officially decided closed-source packages as sacrilege. But has since gone through the umpteenth
to offer non-free firmware through a sin- keep in mind that, in many cases, com- distribution upgrade, and is still run-
gle installer and to amend the social panies or foundations pull the strings in ning smoothly.
If Debian tweaks the social contract,
will the idea or ideals of open source
software suffer? I don’t think so. Users
will still enjoy full control – after all,
the installer will ask if you want to set
up the firmware. Nobody is forcing
you to use the blobs, but you are free
to do so. n n n
Info
[1] Debian Popularity Contest:
https://popcon.debian.org
[2] Steve McIntyre’s blog:
https://blog.einval.com
Author
Thomas Reuß is a passionate Linux admin
who is hugely interested in security. He is
Figure 2: It’s not just on Reddit that many agree: Debian’s move to non- currently working as a consultant in the
free firmware is long overdue. © Reddit.com SAP environment.
nnn
Fuzzy Finder
Simplify your searches and get better results with fzf, a modern scanning fuzzy logic results quicker than
entering a lengthy regex, even if you
search tool based on fuzzy logic. By Bruce Byfield
type the regex correctly the first time.
With fzf, you interact with the tool
S
earch commands have always Traditionally, variation in search tools through a fuzzy logic interface, while fzf
been essential to using comput- like find is provided by regular expres- composes the regexes for a search be-
ers. With the increased storage sions (regexes), a concept first devel- hind the scenes.
capacity of modern systems, oped in the 1950s. Regexes are standard Fuzzy logic is a science of its own,
they are more important than ever be- patterns that offer different types of vari- with principles and theories about com-
cause there is more material to search. ations in results. Most users are familiar munication and logic that do not directly
In fact, searches are so important that with the simpler regexes, such as * to concern us here [2]. What matters is that
alternatives to time-honored commands mean zero or any character, so that apt* fuzzy logic is a much simpler way of in-
are becoming increasingly common. might return apt, apt‑get, apt‑cache, and troducing variation into output, espe-
One of the most effective of these recent probably many others. At a more ad- cially today when the patience and gen-
alternatives is fzf, a command-line vanced level, users might know that eral command-line knowledge among
“fuzzy finder” [1]. gray|grey produces results with either computer users is much less than it was
For most Linux users, the basic search spelling, or [b‑e] a range of characters. 70 years ago. For one thing, the order in
tool for finding directories and files has However, regexes are not consistent which variation is found with fuzzy logic
been find, which is most effective when across applications and can rapidly be- is less important than with regexes.
you know exactly what you are looking come extremely complex to construct or Often, the order does not matter at all,
for. If you do not know, then you need a type correctly, especially when all you which makes it easier to understand and
way to allow variation in the output. want is a quick answer. For example, more flexible. Just as importantly, fuzzy
even with context, who can easily ex- logic uses natural language instead of its
Author plain this randomly selected example: own code that needs to be carefully sep-
Photo by Timothy Eberly on Unsplash
Bruce Byfield is a computer journalist and arated from the query itself. If you add
a freelance writer and editor specializing (\W|^)[\w.\-]{0,25}U an indexed database, as fzf does, you
in free and open source software. In @(yahoo|hotmail|gmail)\.com(\W|$) can add context to accuracy to produce a
addition to his writing projects, he also contextual command history.
teaches live and e-learning courses. In his
Personally, I’d take half a minute or so With these advantages, fzf has rapidly
spare time, Bruce writes about Northwest
Coast art (http://brucebyfield.wordpress.
and resent the expected effort. Such re- gained ground in the past few years. It is
com). He is also co-founder of Prentice gexes are worth constructing only when carried in all the major distributions, or
Pieces, a blog about writing and fantasy at you use the same search repeatedly. In it can be installed from its GitHub page.
https://prenticepieces.com/. addition, you almost always will find Each time fzf opens using the bare
Table 1: Keyboard Shortcuts like .gitignore while searching. In addi- commands. For instance, with +1,
Ctrl+T Select files tion, add searches become case-sensitive, while
you can reduce clutter in the results with
Alt+C Switch into a selected subdirectory
$ source /usr/share/fzf/shell/U ‑‑exact (‑e). In addition, ‑‑algo=TYPE sets
Ctrl+R Use fzf‘s enhanced history
key-bindings.bash the fuzzy algorithm, completion with v1
optimizes speed over best results, and v2
command, it updates its database in a to enable some useful keyboard short- optimizes results over speed.
matter of seconds, leaving you at a cuts (see Table 1). Another useful option category is for
prompt, ready to continue. search results. The arrangement of re-
Basic Use sults can be influenced by
Setting Up fzf At its simplest, fzf opens and updates its ‑‑tiebreak=CRI CRITERIA, CRITERIA. The
The popularity of fzf means that, for list of top-level directories for the present default criteria is length, which favors
most purposes, you can install it directly working directory – usually, your home shorter results, but you can give it lower
from your distribution’s repositories and directory. You can then type any part of priority by its position in a list that can
begin to use it. You can also install fzf a directory or file to see the results (Fig- contain begin (with the search string
with Homebrew to get the absolute latest ure 1). If you scroll the results, highlight- closer to the start of the line), end (with
version. ing and pressing the Enter key displays the search string closer to the end of the
However, to make full use of fzf, you the selection in the terminal, where it line), or index (a line that already ap-
should also install bat (the modern cat can be conveniently pasted into newly pears in the results). Each criterion
replacement) and fd‑find (the modern typed commands. Alternatively, you can should only appear once, and index (for
find replacement). Then add the follow- use fzf with another command so that obvious reasons) must always appear
ing lines to your .bash.rc files: last. If you are searching for high-level
vim $(fzf) directories, start might be a useful op-
export FZF_DEFAULT_OPTS="--preview 'bat U tion or end if you are searching for a file
--color=always {}'" allows you to use fzf to select a file to name. In addition, ‑‑tac displays results
export FZF_DEFAULT_COMMAND="fd --type f" open in Vim. in reverse order.
For many uses, this is enough informa- Other options are cosmetic, such as dis-
These lines will ensure that fzf can use tion to use fzf. However, depending on abling the mouse or horizontal or vertical
bat as a file previewer and improve over- how fzf is compiled, it can also support control, or aspects of appearance, such as
all performance with fd‑find. Faster context-specific autocompletions by en- color theme or window border size for
than find, fd‑find will ignore directories tering a command followed by **+Tab previews. These options no doubt be-
and will give appro- come more important the more often you
priate suggestions, use fzf, but at first glance give a false
such as file names sense of complexity for what is after all a
for Vim or remote relatively well-organized utility.
systems for SSH. If
autocompletion is Rough Edges
not enabled, check The latest version of fzf is .38, and
the project’s GitHub many distributions offer even earlier
page for instructions. packages. Unsurprisingly, fzf is still
rough around the edges, with no indica-
Other tion of what features are compiled in
Command which package or distribution and
Options scanty documentation. Fortunately,
Most online articles though, you do not need all the possible
on fzf end at this features to find fzf a major improvement
point. However, a few in search functions. In fact, fzf has sev-
distributions, such as eral levels of complexity, each of which
Ubuntu, offer man is useful in itself. As a result, even with
pages with additional the general release apparently some way
options, neatly orga- off, fzf is a welcome innovation that is
nized into categories. well on the way to becoming the new
Among the most im- norm in search commands. n n n
mediately useful are
the search modes. Info
Some of these op- [1] fzf: https://origin-sysadmin.redhat.
tions may be familiar com/fzf-linux-fuzzy-finder
to you from find and [2] Fuzzy logic: https://en.wikipedia.org/
Figure 1: The results shown in the fzf window. other search wiki/Fuzzy_logic
Customize your
system tray with YAD
Bespoke
System Tray
YAD lets you customize your system tray with one-line Bash tray item (Figure 1). Because Bash and
YAD statements can be quite long, you
tray scripts. By Pete Metcalfe can make the code more readable by
using backslash (\) characters to ex-
Getting Started
M
y goal was to find a simple tend a statement across multiple lines,
way to group together my There are a number of different tools for as shown in Listing 1.
favorite apps and web pages creating system tray applications, such The yad statement in Listing 1 uses the
into a system tray item. as AllTray and KDocker. For my projects, ‑‑notification and ‑‑image options to put
There are a number of different ap- I prefer YAD because it lets you create a user-defined icon in the system tray.
proaches to this, but for my require- custom dialogs and it supports dynamic The ‑‑command option calls an application
ments I found that the YAD (Yet An- changes to the tray features. YAD is a or script when you click on the tray item.
other Dialog) tool [1] gave me every- command-line dialog tool very similar to The --text option defines tooltips.
thing that I needed, and I could do it Zenity [2], but with some added features In Figure 1, the command-line lsusb
all with just one line of Bash script. such as system tray support and a more utility lists the USB-connected devices.
In this article, I will introduce Bash complete dialog functionality. The output from lsusb is shown in a
tray scripts with three examples. The For Debian/Raspian/Ubuntu systems, YAD text dialog.
first example will show how to create you can install YAD with: To terminate a YAD tray script, use a
tray scripts that put Linux diagnostic center mouse click. You can also termi-
data into both custom dialogs and ter- sudo apt install yad nate from a right-click menu, which I’ll
minal windows. In the second exam- discuss later.
ple, I will add pop-up browser win- Creating a
dows to a right-click submenu. The Tray Script
final example will look at how to tog- Listing 1 is a one-
gle the tray icon, command, and line Bash script
tooltip with simulated weather that calls YAD to
Photo by Suhyeon Choi on Unsplash
--command="yad --text=\"$(lsusb)\" \
nice_dialog() {
}
YAD includes a handy yad‑icon‑browser within the YAD
tool, which lets you review available dialog. For # Create a system tray item with 4 right click items
icons (Figure 2). To make coding a little more informa- yad --notification --image="applications-utilities" \
easier, YAD only needs the image name; a tion on how to --command="$(nice_dialog 'iostat -c' 'IOSTAT')" \
full path to the image is not required. configure YAD --menu="Memory! $(nice_dialog 'vmstat' 'VMSTAT') \
Many applications, such as the top color and font | Sensors! $(nice_dialog 'sensors' 'SENSORS') \
system performance tool, are best options, see the
| USB ! $(nice_dialog 'lsusb' 'USB') \
viewed in a terminal window. The YAD Pango markup
| Quit ! killall yad" \
tray script in Listing 2 calls top within a language [3]
--text="My Fav Utilities"
terminal window (Figure 3). documentation.
Listing 2 calls xterm to launch a termi-
nal window. The ‑e option executes the Pop-Up Browser Windows To install Midori on a Debian/Ras-
top utility. The ‑hold option keeps the Midori [4], a lightweight web browser, pian/Ubuntu system enter:
terminal open after the command is has been available with the Raspberry
complete. Font types and sizes can be Pi desktop for many years. One of Mi- sudo apt install midori
defined with the ‑fa and ‑fs options. dori’s advantages is that it can be eas-
The terminal window caption is set ily launched as a pop-up window with- Midori can be run as a pop-up window
using the ‑T parameter. out affecting your main browser by using the web application ‑a com-
settings. mand-line option.
Right-Click Menus
YAD also supports right-click menu com-
mand items in addition to left-click com-
mands. The syntax for menu items is:
--menu="menu_title1 ! menu_command1 | U
menu_title2 ! menu_command2 ... "
this you need to enable listen mode item that can | Linux! midori -a https://www.linux-magazine.com \
(‑‑listen) and then redirect the stan- toggle some of | Weather! midori -a https://www.theweathernetwork.com \
dard I/ O (stdio) – file 1 as shown in its tray features | Quit ! killall yad" \
Listing 5 – to a named pipe. After (e.g., icon, --text="My Fav Web Pages"
Figure 5: You can also create a tray icon that will launch Midori browser windows for your favorite web pages.
Listing 5: Toggle Tray Item Features It should be noted that the YAD menus can also be dy-
01 #!/bin/bash
namically changed. In Listing 5, to add a new menu item or
02 #
change a menu item, the code would look something like:
03 # tray_toggle.sh - toggle system tray items
echo "action:menu= \
04 # - create a named pipe for inputs
menu_title1 ! menu_command1 | \
05 #
menu_title2 ! menu_command2" \
06 mytraypipe="/tmp/tray1.pipe"
> $mytraypipe
07
11 fi
killall yad ; killall bash
12
19 --image="emblem-colors-grey" \ \
22
24 while :
25 do
26 sleep 10
27 echo "action:yad --text='Rain until morning'" > $mytraypipe Figure 6: You can toggle the system tray icon,
28 sleep 1 tooltip, or command with YAD.
29 echo "icon:stock_weather-showers" >> $mytraypipe
30 sleep 1 Info
31 echo "tooltip:Rain until morning" >> $mytraypipe [1] YAD: https://www.systutorials.com/docs/linux/man/1-yad/
32 sleep 10
[2] Zenity: https://help.gnome.org/users/zenity/stable/
33 echo "action:yad --text='Sunny for 2 days'" > $mytraypipe
[3] Pango documentation: https://docs.gtk.org/Pango/pango_
34 sleep 1
markup.html#pango-markup
35 echo "icon:stock_weather-sunny" >> $mytraypipe
[4] Midori: https://linuxcommandlibrary.com/man/midori
36 sleep 1
[5] “Simple Web Scraping with Bash” by Pete Metcalfe, Linux
37 echo "tooltip:Sunny for 2 days" >> $mytraypipe
Magazine, issue 262, September 2022, p.36
38 done
[6] Lynx: https://lynx.invisible-island.net//
nnn
Shrink Ray
The Minuimus Perl script helps you save disk space by bin/ directory. Upon completion,
Minuimus will be available for all sys-
reducing the file size of PDF files with just a few commands. tem users.
By Daniel Tibi If you don’t get the results you want
with Minuimus’s default settings, you
W
hether in an electronic li- page [2]. First unpack the ZIP file and can try one of the Minuimus options for
brary or an electronic file then run the following commands one potentially better results. Enter
folder, PDF documents are after the other:
ubiquitous. These digital minuimus.pl --help
Photo by Dylann Hendricks on Unsplash
disk space or fill up your cloud storage. sudo make all to see a list of all the available options.
Minuimus [1], a Perl script, helps you sudo make install
Conclusions
Installing Minuimus was uncomplicated,
and it was easy to use with shell com-
mands. I did manage to reduce the size
of a number of files, but with varying de-
grees of success. The results depend on
Figure 1: How much Minuimus can shrink a file varies: These two files several factors, not least how much po-
were reduced to 88 and 99 percent of their original sizes, respectively. tential a PDF file has for reducing file
size in the first place. Ultimately, every
number of other programs, including results in smaller files. The following little bit helps when it comes to freeing
AdvanceCOMP [3] for compressing command up disk space. n n n
specific file types, OptiPNG [4] for
compressing PNG images, Jpegop- minuimus.pl --jpg-webp FILE.pdf Info
tim [5] for compressing JPEG files, [1] Minuimus: https://birds-are-nice.me/
Gifsicle [6] and flexiGIF [7] for com- converts the JPEGs in the document to software/minuimus.html
pressing GIF files, and Qpdf Tools [8] the leaner WebP format, reducing the [2] Minuimus download:
for converting PDFs. quality of the images to 90 percent. https://birds-are-nice.me/software/
It is difficult to predict how much minuimus.zip
Minuimus will shrink your PDFs. It de- Minuimus in Use [3] AdvanceCOMP: http://www.
pends on several factors, including pri- After installation, call Minuimus with advancemame.it/comp-readme
marily how effective the original pro- the command:
[4] OptiPNG:
gram was at creating the PDF file in
https://optipng.sourceforge.net/
question and how much reduction po- minuimus.pl FILE.pdf
[5] Jpegoptim:
tential is left for Minuimus. If the PDF
https://github.com/tjko/jpegoptim
file only consists of text, there is little I first tested Minuimus on the December
potential for file size reduction. The sit- 2022 community edition of LinuxUser (a [6] Gifsicle: https://www.lcdf.org/
uation is different if the PDF contains German magazine) [10]. As shown in gifsicle/
many graphics and images, because Figure 1, the file size was reduced from [7] flexiGIF:
they usually offer plenty of downsizing 12.7 to 11.2MB (about 88 percent of the https://create.stephan-brumme.com/
potential. original size). A loss of quality was not flexigif-lossless-gif-lzw-optimization/
Another program similar to Minuimus noticeable, especially with the images. [8] Qpdf Tools: https://github.com/
is Leanify [9]. If Leanify exists on your The original metadata were also silash35/qpdftools
computer, Minuimus will also use it as a preserved. [9] Leanify:
helper; the two programs complement When I compressed the e-paper with https://github.com/JayXon/Leanify
each other with their capabilities. This the full version of the December 2022 [10] LinuxUser 12/2022 Community Edi-
combination gives you even better issue of LinuxUser, the results were simi- tion: https://www.linux-community.
results. lar. Minuimus reduced the size of the PDF de/wp-content/uploads/2022/12/
By default, Minuimus is lossless: It from 32.8 to 28.7MB (87.5 percent of the lu-ce_2022-12.pdf
does not reduce the quality of images in original size). I also tried out Minuimus [11] The Hound of the Baskervilles from
the PDF file, but simply optimizes the on a scan from the Internet Archive of Ar- the Internet Archive:
compression. However, a slight loss of thur Conan Doyle’s famous 1902 Sherlock https://archive.org/details/
quality is sometimes acceptable if it Holmes novel The Hound of the houndofbaskervil00doyluoft/
Figure 2: Minuimus’ results depend on various factors and turn out differently every time. Here you can see
the file sizes before and after processing for the four tests.
Debian Clone
In the right circumstances, apt-clone can be a simple option for mature enough, that the code rarely
needs to be updated.
cloning your Debian system. By Bruce Byfield
Creating the Cloning File
A
new system, container, or chroot use. New members of these scripts are Reporting on apt-clone tends to focus on
jail can be created in a few min- always appearing and occasionally dis- the basics. Even online man pages tend
utes. However, configuring any appearing, so the Debian stable reposi- to be incomplete. For this reason, rely
of them can take hours, espe- tory contains 54 of these scripts and only on the man page installed with the
cially if you want them to resemble ex- Debian unstable repository 64 – a figure script, or the summary available with
isting systems. Numerous cloning appli- that might very well increase before the the --help (-h) option.
cations exist, notably dd, Partimage, or next official release. Apt-clone itself is Before using apt-clone, update your
Clonezilla, but on Debian-derivatives, over a decade old, which is time enough system with apt upgrade so that you are
such as Debian Ubuntu or Linux Mint, for its use to spread quietly. Most Debian not dealing with different Debian re-
one of the simplest tools is a small script derivatives include apt-clone in its repos- leases and the original system is as bug-
called apt-clone [1]. Apt-clone is vaguely itories, but you can also download the free as possible. Then run
reminiscent of Clonezilla, but has the source code from GitHub. As I write,
advantage of simplicity because it uses though, the latest couple of Ubuntu re- apt-clone clone FILE
standard command-line tools and basic leases contain a version of apt-clone that
commands. Apt-clone can also be used appears to have version incompatibili- Unless you specify --source DIRECTORY,
as a convenient backup. ties. In general, though, do not be con- the output will go to the present working
Apt-clone belongs to the cluster of cerned if you notice that the most recent directory. If you have any third party .deb
small scripts that center on apt-get and contributions are a couple of years old. packages, add --with-dpkg-repack at the
apt and their management or ease of The fact is, git clone is so simple, and end of the command so that apt-clone
Lead Image © Csaba Deli, 123RF.com
Figure 1: Creating the archive file: Note the number of third-party packages.
will attempt to include them in the release as the source system. Using an- If the system you are cloning includes
backup directory. However, be aware that other Debian release may work, but it in- packages installed with .deb packages
the attempt may not always be success- creases the chances of problems – prob- from third-party sources, apt-clone will
ful, because an installable .deb package lems that may cost more time than apt- try to handled them, but sometimes with-
does not automatically have the format clone is likely to save. Transfer the ar- out success. That means that if you have
and standard required by the Debian dis- chive file to the root directory of the tar- installed, for example, the latest version
tribution. Such packages work perfectly get system, decrypt it if necessary, and of LibreOffice from The Document Foun-
fine in everyday use, but may not be run as root: dation, you will have to back up the con-
picked up by apt-clone (Figure 1). figuration files separately. Similarly, trans-
Whatever the case, in a few minutes, apt-clone restore FILE ferring the configuration files to a newer
apt-clone will create a TAR-zipped file. If release of the operating system may also
you are trying to include third-party pack- The process is similar to that of install- have limited success. Probably, the most
ages, it will probably take much longer be- ing packages normally and may take 20 useful time to use apt-clone is when you
cause each third-party package must be minutes or more on recent hardware, de- are installing a lab with identical worksta-
analyzed separately. You can read general pending on the number of packages in- tions or a new home computer that you
information about the newly created file volved. It will take even longer if you want to be identical to your old one.
using the command: choose to use restore-new distro instead When apt-clone meets your needs, it is an
of restore, because you will be attempt- elegant little script, but it is never going
apt-clone info FILE ing to upgrade packages at the same to be a complete solution for every possi-
time. Probably less can go wrong if you ble circumstance. nnn
In Figure 2, across seven different desk- upgrade before restoring.
tops, 2,977 packages are installed, but only When the process finishes, the cloning Info
2,619 are official Debian packages, which will complete without the need to re- [1] apt-clone:
suggests that a perfect clone could be un- boot, exactly as happens when a new https://github.com/mvo5/apt-clone
likely, although the basic functionality package is installed. Similarly, because
should clone successfully. A different view the source files belong to root and are Author
of the archive file can be had by viewing it copied as root, you should not have Bruce Byfield is a computer journalist and
in an archive application such as Ark (Fig- problems with permissions. If you do a freelance writer and editor specializing
ure 3). As you might expect, package have any problems, using apt-clone diff in free and open source software. In
sources and apt settings are major catego- to compare with the source machine’s addition to his writing projects, he also
teaches live and e-learning courses. In his
ries for the archive, as well as apt-clone’s file may help with problem-solving.
spare time, Bruce writes about Northwest
logfile. Preferences include configuration Coast art (http://brucebyfield.wordpress.
settings from directories such as .config or Limitations com). He is also cofounder of Prentice
.local. In theory, you might be able to un- The main drawback to apt-clone is that is Pieces, a blog about writing and fantasy at
archive the file and attempt to edit, but to designed for use with official repositories. https://prenticepieces.com/.
do so is likely to take more effort than is
worthwhile. Still, it is never wasted time to
know exactly what you are doing instead
of blindly following instructions.
Because the archived file contains sys-
tem-sensitive information, you should
encrypt unless you plan to delete it im-
mediately after cloning. The quickest
way to do so with reasonable security is
to use GPG and keep the file encrypted
when you are not actually using it.
How to Clone
Once you have the archive file, install
the target system with the same Debian Figure 3: An overview of the archive file’s content.
File
Inspector
Spotify, the Internet music service, collects data about its users
and their taste in music. Mike Schilli requested a copy of his files
to investigate them with Go. By Mike Schilli
S
treaming services such as Spo- From the time of the request, it takes website for you to pick up. After re-
tify or Apple Music dominate about a week for their archivist to re- ceiving Spotify’s email notification,
the music industry. Their exten- trieve the data from the files in the you can then download the data for
sive catalogs now cover the en- Spotify basement, compress them, and two weeks and poke around in it lo-
tire spectrum of consumable music. Re- post them as a ZIP archive on the cally to your heart’s content.
lying on artificial intelligence, these ser-
vices introduce users to new songs
they’ll probably like, as predicted by the
services’ algorithms. Traditional physical
music media no longer stand a chance
against this and gather dust on the
shelves. Of course, this development
also means that anonymous music con-
sumption is a thing of the past, because
streaming services keep precise records
of who played what track, when, and for
how long.
On request, Spotify will even hand
over the acquired data (Figure 1). If
you poke around a bit on their website,
you’ll find the buttons you need to
press to request a copy of these files in
Account | Privacy Settings, but Spotify
takes their sweet time to respond.
Author
Mike Schilli works as a
software engineer in the
Lead Image © bowie15, 123RF.com
Exercise also list the start date and time and the JSON parser to create an internal Go
The ZIP file containing the down- playback duration. Playback duration data structure from the Spotify data, the
loaded data includes a JSON file is particularly interesting because if format must be known and also match
named StreamingHistory0.json with the the user interrupts a stream after a few that of the actual JSON format.
metadata of all the streams you played seconds and fast forwards to the next The JSON blob provided by Spotify, as
in historical order (Figure 2). In addi- song, the track probably made it onto shown in Figure 2, consists of an array
tion to the song and artist, the entries the playlist by mistake and was some- whose elements each correspond to a
thing the user didn’t actually like. It streamed track. The artist and track
will most likely turn out to be a false names are stored as strings in the ar-
positive when it comes to putting to- tistName and trackName fields. msPlayed
gether music suggestions. gives you the playback time in millisec-
As an exercise, Listing 1 shows a Go onds, while endTime has the date and
program that traverses the JSON data time at the end of playback.
and creates charts featuring the most fre- The fields of the stream structure in
quently played tracks. The top three out- Listing 1 each start with a capital letter,
put in Listing 2 shows you my favorite which means that other packages can
songs – minus the ones that I excluded also access them later on. However, this
because they were just too embarrassing means that the names are not identical
to own up to. to the variable names in JSON format,
To do this, Listing 1 opens the JSON each of which starts with a lowercase
file in line 17 and returns a byte array letter. However, this is no big deal, be-
with its content in the content variable. cause Go lets you give a structure a
Line 22 passes this to the Unmarshal func- name that can differ from the field
tion from the json package in Go’s stan- name with the json: tag.
dard library, along with a pointer to a For example, ArtistName string
stream type structure defined previously `json:artistName` in line 10 specifies
in line 8. As you know, Go insists on that the artist in the ArtistName field is of
strict type checking. In order for the the string type in the Go structure, and
Listing 1: stats.go
01 package main 23 if err != nil {
02 import ( 24 panic(err)
03 "encoding/json" 25 }
21 data := []stream{} 43 }
the name used for it in the incoming code here, which scripting languages library("jsonlite") to include the new
JSON is artistName. This is all you need just elegantly do without. This calls for library and call functions from it.
for json.Unmarshal() to dig through all a classic data wrangling language like Line 3 reads the JSON data from the
the entries in the JSON file in line 22, be- R, which takes a more carefree ap- streaming history using the fromJSON
cause the function has been passed a proach, saving programmers a great function exported from jsonlite and
pointer to what is still an empty array of deal of work. If you don’t have R on stores it as a dataframe in the jdata vari-
these stream entries in data. Using Go’s your machine yet, simply install it on able. This R standard type is a kind of
reflection mechanism, the function fig- Ubuntu, for example, with: database table with row-by-row vector
ures out which JSON structures it needs values, each spanning multiple columns.
to work its way through. sudo apt install r-base In addition to numeric values and char-
Listing 1 counts how many times each acter strings, the columns can also con-
song occurs in the streaming history in Listing 3 shows a simple application that tain what are known as factors. In R,
the bySong map defined in line 16. To do scans a user’s Spotify streaming history, these factors are variables with a certain
this, it uses the title’s string as a key and produces a histogram of the actual play- number of possible values, for example,
increments the 64-bit integer map value ing times of the songs they listened to, small, medium, and large.
by one for each playback event it finds and displays it nicely as a bar graph (Fig-
in the streaming data. At the end, the ure 3). The diagram illustrates that many Playback Length Statistics
function then needs to sort the map by songs were simply canceled after less Listing 3 needs to limit the maximum re-
the highest integer value in descending than 15 seconds (15,000 milliseconds). corded play length of all the songs it an-
order to output the top three. In this case, Spotify’s suggestion algo- alyzes to five minutes, because my
rithm most likely made a mistake, an- streaming history also included 90-min-
Sorting Is No Piece of Cake noying the listener, who then switched ute audio plays, which distorted the sta-
In a scripting language, sorting the map to the next song. Starting at about one tistics beyond recognition. Filtering is
data would be a snap, but Go offers type minute of playback time (i.e., after handled by the recoding statement in
safety, and that’s why Listing 1 converts 60,000 milliseconds), an almost Gauss- line 4, which uses the condition
the map entries into an array slice of kv ian-like bell curve appears, peaking at jdata$msPlayed < 300000 to filter out all
(for Key/Value) structures whose type it 220 seconds. Most songs these days are tracks over 300 seconds playing time
defines starting in line 30. The for loop about three and a half minutes long, from the jdata dataframe before again
starting in line 35 then needs to slog with the majority being between two assigning the result to the jdata variable.
through the entries of the map and ap- and five minutes. Recoding statements take place at both
pend each key value pair it finds as a kv To be able to call Listing 3 at the com- the row and the column level. The square
struct to the kvs array slice. The slice can mand line, the shebang statement in line brackets in line 4 contain the conditions,
then be sorted by Go’s standard sort. 1 searches for the Rscript program in the separated by a comma. The filter applies
Slice() function. The callback in line 39 shell’s search paths and calls the under- the first condition to each row, and the
tells it that it can determine the desired lying R interpreter with the program second to each column. The result is a
order of two entries in the slice at posi- code from the listing. Also make sure to dataframe, which can have both fewer
tions i and j by a numeric comparison mark the file hist.r (Listing 3) as exe- rows and fewer columns. In this case,
of the two counters at those positions. cutable via the chmod +x command. however, we only need to remove the
Wow, that’s pretty convoluted! At the For an elegant approach to reading the rows, not columns, which is why the sec-
end, the for loop from line 41 goes JSON data, Listing 3 uses the jsonlite ond part of the condition in square brack-
through the sorted array, outputs the package; you will need to install this up ets after the comma remains empty. Yes,
top positions, and terminates after the front. After opening an R session (just you need eagle eyes to read and under-
third value. type R at the command line), the in- stand R code correctly!
stall.packages("jsonlite") command
Faster with R loads the package’s C++ sources from
Go programs for parsing JSON data the Comprehensive R Archive Network
and computing statistics are a real (CRAN), compiles them locally, and in-
pain. Go’s type safety requires a dis- tegrates the library into the local R uni-
proportionate amount of boilerplate verse. After that, any R script can use
Listing 3: hist.r
01 #!/usr/bin/env Rscript
02 library("jsonlite")
05 attach(jdata)
06 png(filename="hist.png")
Figure 3: Histogram on playback
07 hist(msPlayed, main="Milliseconds Played") 10 detach(jdata)
duration, generated by Listing 3
Figure 6 shows an excerpt from this in- dataframe by hour (ascending) and the either embarrassing oldies from the
termediate result. Based on this, ZZ Top number of events (descending). Using 1980s (Rainbow) or, as I vaguely recall,
was played exactly once at 19.00 hours, deduplication, the algorithm then only once from 1:00am to 4:00am, every sin-
while no fewer than 11 entries with keeps the first entry per each hour value gle track by the band Sparks, after de-
Linkin Park pop up at 20.00 hours. There and discards the rest. The top perform- vouring a Netflix documentary featuring
are several different ways to filter out ers for each hour value remain. the band and proceeding to play back
only the top performers from this view Line 10 sorts the previously generated their songs for four hours. The next day
(e.g., Linkin Park at 20.00 hours). One agg dataframe, according to the order() at work was terrible, of course, but you
method that relies entirely on R’s stan- function specified in the square brackets. only live once.
dard functions is as follows: Sort the Its first parameter is the (positive) field From experience, users can spend days
name for the hour value; the second is tinkering with R to find the right data
the (negative) value for the counter de- structure and methods that will often
termined by the length function. In R, implement exactly what they want in
the newly created column by the aggre- just three lines. The reasons for this
gation function goes by the name of x probably include the age of the lan-
and contains the number of results in guage, which comes with a sort of anti-
this case. Python mindset (“Waddya mean, there’s
Line 11 runs a recode statement over only one way to do this?”), and the
the dataframe now named winners and many packages that have been released
uses !duplicated(winners[2]) to specify in an uncoordinated fashion over the de-
that the second field (i.e., the hour cades since the original release. A
value; R arrays always start with an Google search for a particular problem
index of 1, not 0) must be present once will often reveal three or four different
only in the result. Consequently, the approaches to solve the same issue. The
function will only keep the previously training book by Robert I. Kabacoff [1]
forward sorted highest result for hour does a good job of explaining some basic
values with the associated artist and will procedures, but it is by no means an ex-
discard all others. tensive reference.
That takes care of the list with the
most popular bands, as a function of the More Secrets
time of day at Perlmeister Studios! Fig- If you rummage further in the Spotify
ure 7 shows the output of the hourly.r R dossier’s ZIP file, you are likely to un-
program (Listing 4). After midnight, it’s earth a few more data treasures. For
Figure 7: Which artists are played example, Spotify’s Inferences.json file
back most frequently at what time? contains ascertained facts about the
user – presumably to help Spotify
serve up appropriate ads that the lis-
tener will also respond to.
In my case, Spotify assumed I had a
preference for “Light Beer” (Figure 8),
which is a joke and totally wrong – as
anyone who knows me can attest to if it
came to a pinch! This is a likely explana-
tion if Bud Light ads start popping up on
my screen. n n n
Info
[1] Kabacoff, Robert I. R in Action, Second
Edition. Manning, May 2015:
Figure8: Spotify – incorrectly – considers the author to be a light- https://www.manning.com/books/
beer drinker. r-in-action-second-edition
nnn
Package Exchange
If you want to move away from Ubuntu’s Snap package format, the unsnap script removes snaps
from your computer and replaces them with Flatpaks where possible. By Ferdinand Thommes
T
he Linux community, like any Systemd, the still controversial sys- approval in the Linux community. In
other community, is not particu- tem and session manager, illustrates particular, the Snap format, which Ca-
larly good at welcoming new this concept. Other examples are the nonical initially designed for cloud ap-
things. Most people want to retain new package systems Flatpak, Snap, plications and the Internet of Things
the status quo. In the words of the philos- and AppImage, which Linux Magazine (IoT), but later ported for desktop ap-
opher Voltaire, the better is the enemy of previously covered in December plications, is experiencing opposition
the good. Nothing is more dangerous 2022 [1]. These package systems are beyond the basic criticism of new
than leaving the good for better things. by no means met with unanimous package systems.
If you’ve become disillusioned with
Snap, the unsnap script can help you re-
place snaps with Flatpaks where avail-
able on Ubuntu and its deriviatives.
Bad Experiences
The Linux community is skeptical of any
solo efforts by Canonical due to bad past
experiences. The main criticisms leveled
at Snap (Figure 1) are the Snap Store’s
proprietary back end [2] and the fact
that Canonical is increasingly pushing
the format in Ubuntu, with no official
way to remove snaps.
Photo by Tamanna Rumee on Unsplash
Multiple Steps Figure 3: If you call the script without additional commands, it deter-
To start the script, first change to the ap- mines the system status and creates the required auxiliary scripts,
propriate directory by typing cd unsnap. which you can then launch manually, if required.
are better, because Flatpak targets the Rework Needed what was happening at all times. The
desktop. Snap, on the other hand, also My test took around 10 minutes and flatpak list command (Figure 6) can
targets the server world. provided detailed information about be used to determine which snaps
were converted to Flatpak format. For
snaps with a Flatpak equivalent, unsnap
converted these snaps cleanly, and all
of the programs remained functional.
The script left the remaining snaps and
the infrastructure untouched. Some
manual work would be required to
completely oust snaps from the
computer.
I then reinstalled Ubuntu 22.04,
along with some snaps that I knew
had corresponding Flatpaks avail-
able, including Gimp 2.99.10 Beta,
Krita, Spotify, and KeePassXC. In the
process, I also installed several addi-
tional runtime environments for
Gnome and (because of Krita) KDE,
as well as other infrastructure pack-
ages from Canonical. With this envi-
ronment using the same procedure as
Figure 4: If the script is called with the ./unsnap auto command, the before, I then tested whether unsnap
process completes automatically. also removes the Snap infrastructure
when it can convert all snaps to
Flatpaks.
I loaded the script and ran it by typ-
ing ./unsnap auto. This time, unsnap
first had to install Flatpak and connect
to Flathub. After doing so, the call suc-
cessfully replaced all manually in-
stalled snaps with Flatpaks. In addi-
tion, it successfully disabled the
Firefox snap, which was already pres-
ent during the install.
When checking via flatpak list, I no-
ticed one minor disadvantage to this
method: All Flatpaks are system-wide
and therefore accessible to all users.
There is no option to limit the Flatpak to
specific users.
Then I ran snap list to see if there
was anything left of the Snap infra-
Figure 5: There is not always a Flatpak equivalent for installed snaps; structure. Lo and behold, the snaps
unsnap lists these cases separately. had been deleted, but the infrastruc-
ture was still there. Apparently, the
script did not execute the last of the six
helper scripts (99‑remove‑snapd). I now
did this manually by changing to the ~/
unsnap/log2022... directory and run-
ning the ./99‑remove‑snapd command
there. The script removes snapd and
takes away the parts of the infrastruc-
ture that the base does not need.
However, I discovered the Snap in-
frastructure is already deeply rooted in
Figure 6: After running unsnap, the flatpak list command can be used Ubuntu and that not everything can be
to check which snaps the script replaced with Flatpaks. removed even manually (Figure 7).
Author
Figure 7: I had to follow up with the ./99‑remove‑snapd script to Ferdinand Thommes lives and works as a
remove as much of the Snap infrastructure as possible. Nevertheless, Linux developer, freelance writer, and tour
some remnants remained. guide in Berlin.
nnn
Angry Reviewer
The Angry Reviewer style check can be used to evaluate and improve any type of writing,
including academic articles and grant applications. By Bruce Byfield
L
ibreOffice Writer has hundreds of Writer extension has the advantage of al- need one. Too often such tools lead
extensions [1]. Many are cosmetic, lowing you to work offline and run Angry readers astray with their authoritative-
trivial, or specialized. However, a Reviewer without having to cut and sounding feedback – as in the case of
handful are major additions to paste. Like all extensions, it can be in- one student who began an essay on
functionality. In the past, some, such as stalled with Tools | Extension Manager. Gloria Steinem with “For centuries,
PDF export, have eventually found their When Writer is restarted, Angry Reviewer women have been depressed by men”
way into Writer’s default interface. Even- is added to the top-level menu. When (which many women insist was not a
tually, the Angry Reviewer style checker Check This Text is clicked (Figure 1), a sec- mistake). The problem is that most of
[2] may do just that. Although intended ond Writer document is opened with these tools are prescriptive, treat gram-
to improve academic articles and grant feedback. The two documents can then mar and style as fixed forms, and advo-
applications, Angry Reviewer is compre- be placed side by side as you evaluate cate standards that are several decades
hensive and practical enough to be useful the feedback and make changes. behind the times.
for any type of writing. You might call it a By contrast, Angry Reviewer is not
Linux version of the much-advertised Angry Reviewer in Action only more flexible, but explains enough
Grammarly [3], although its feedback When I taught university composition, I that writers may actually learn a thing or
Photo by Andre Hunter on Unsplash
might be presented more usefully. told students that if they knew enough two while getting a quick fix. Citing
Angry Reviewer is available on the about English to effectively use a spell sources such as On Writing Well: The
Angry Reviewer website [4], but the checker or style checker they didn’t Classic Guide to Writing Nonfiction and
nnn
MakerSpace
Raspberry Pi
automated fish feeder
Fish Food
Whether at work or on vacation, every pet lover worries
about how to take care of their little roommates in their
absence. What aquarium owners need is an automatic
feeder. By Swen Hopfe
A
quarium feeders have been A Raspberry Pi Zero is a good choice
around for a long time, but as a control center for a fish feeder: It
after my recent research, comes with everything you need to con-
none of the devices really trol the mechanical system and to grab
seemed practical to my mind. Very few images with a Pi cam (Figure 1). It is
devices provide feedback about malfunc- also compact enough to fit in a small
tions, which could be a nasty surprise housing. Integrating a Pi Zero W with
when you return home. I created this au- your wireless home network will allow
tomatic feeder project for my aquarium you to post various captured images on-
for peace of mind. line while you are on the road.
The goal was a simple setup that was
not prone to errors. Therefore, the me-
chanical control system only uses one
small servomotor. The circuitry of the
electronics is just as simple. A DIY control
system ensures a certain level of conve-
nience. Two feeders add variety and are
quite sufficient to bridge an absence of
time equivalent to a three-week vacation.
Getting Started
To get the Zero W up and running, you
need to download a new Pi OS image
and transfer it to a microSD card. After
plugging in a screen and keyboard, you
Lead Image © alexpokusay, 123RF.com
Listing 1: crontab What You Need project is manageable (see the “Parts
# m h dom mon dow command
Commercial feeders often List” box).
# Sunday till Friday
rely on relatively compli-
0:*17 * * 0-5 python3 /home/pi/scripts/feed.py 1
cated mechanics, such as a Construction
carousel of loadable com- In the solution I had in mind, the feed is
# Saturday
partments. In contrast, I provided by a small storage tower that
0:*17 * * 6 python3 /home/pi/scripts/feed.py 2
want this feeder system to drops the food from the top with a little
# Every minute
be as simple as possible, help from gravity through an opening in
*/1 * * * * python3 /home/pi/scripts/feed.py 0
with a view to the DIY sys- the aquarium cover. You can build a
tem remaining manageable feeder tower like this with parts from
access it right away from another com- and working safely during periods of ab- your local hardware store or order the
puter on the network. All further settings sence from home. That said, I did want a materials online from craft stores. In my
can then be configured in a terminal certain level of convenience, both in case, a desk pen holder served as a start-
window on the other computer. terms of operation and functionality and ing point; this part is readily available in
The Pi needs a hostname that reflects for the benefit of my stay-at-home pets. many stores and are often made of trans-
its task; in this example, it is named Therefore, at least two feeder tubes are parent plastic, which is ideal for moni-
feeder. The next step is to create a sepa- available for different feeds (Figure 2). toring the fill level.
rate scripts/ folder for the project files Other considerations were how to en- Now it’s time to saw and drill holes.
in your home directory, where you will sure – from a distance – that my pets re- After that, I added the servo and the me-
later put the feed.py control script writ- ally were receiving their meals. Trouble- chanical system. The whole thing was
ten in Python 3. Instead of loading it as a free operation from a computer perspec- then mounted on a base plate, which
memory-resident program when the tive does not give you any feedback as to also bears the Zero W and a small circuit
Zero W is started, it is called repeatedly whether the feed is getting into the board with a status LED and control but-
at defined intervals by cron. aquarium, so I got the idea to record the tons (Figure 3).
fish feeding with a camera and serve up The feed outlet is operated by a spe-
All in Good Time a snapshot on the web. cially developed mechanism. Depending
The schedule for the feedings is set in The Zero W comes with on-board on the direction of rotation of the servo,
the Zero W’s crontab (cron table), which tools to accomplish this task, and you one of the two tubes of the pen holder
is the file that manages scheduled task can connect a Pi camera to capture an opens. For this purpose, a straight shaft
processing. The plan for the feeder is image a short wait after feeding. All passes through both tubes, with a clo-
shown in Listing 1, which you can create you need is a view of a section of the sure for each of the two openings sitting
with crontab ‑e [1]. aquarium where the vending machine on the shaft.
Crontab specifies feeding every day at sits. For protection, the Raspberry Pi Because of the angular offset, only one
5pm. On Saturday, the script starts with and camera are each housed in a small of the two shafts can open at any given
the 2 option on the command line, case. The number of other parts in the time during a short left or right turn, and
which releases an alternative feed from
the second slot of the vending machine
once a week. The third entry in the cron
table with option 0 starts the operation
display (the on-board LED flashes once a
minute) and is used to read remote con-
trol codes from the web – but more on
that later.
Parts List
• Raspberry Pi Zero W (1/2)
• Pi camera rev 1.3 or higher
• Case for the Pi and Pi camera
• Camera connection cable
• Mini servo (MG90 or comparable)
• Prototyping breadboard (PCB
breadboard)
• Two push buttons
• LED
• Various resistors
Figure 2: The components you need. A transparent desktop pen
• DIY feeding tower
holder acts as a feed silo in this setup.
it is closed again automatically a short your needs in terms of diameter and direction. Once a minute the housing
time later. Small paddles act as the clo- height of tubes. LED flashes a visual ready signal. To
sures to avoid a shaft remaining perma- track all events on the device, the LED
nently open and ensure that the desired Control uses various flash codes (Table 1).
amount of feed is delivered (Figure 4). The feeding process starts automatically What you can’t see in the circuit dia-
The 160-liter aquarium with low fish after applying the supply voltage. As gram (Figure 5) are the two push but-
stock levels does not need more than a specified in the Raspberry Pi crontab, the tons on the case, which are connected to
heaped teaspoon of dry food every day. vending machine feeds the fish once a the Zero W general purpose input output
The supply in the vending machine will day. On Saturdays, feed is taken from the (GPIO) pins to trigger a feed in the first
be fine for a three-week vacation. If you second shaft by rotating the servo at the shaft and for a controlled system
need a larger reserve, adjust the setup to same angle, but in the opposite shutdown.
Because the feeder is on the local
network, it can be maintained over the
network, as well. To do so, log in to a
terminal over SSH with:
ssh pi@feeder
python3 /home/pi/scripts/feed.py 4
Observations
One interesting and positive side effect is
the ability to see whether the fish are
getting any feed from the feeder. The
Figure 3: The feed tower has two separate chambers, which are control script triggers a snapshot through
operated by a mechanical system. the aquarium glass with a delay of 10
seconds after operating the servomotor.
The simple Pi Cam Rev 1.3 serves this
function well. Because I only need to
grab an image of a section of the front of
the aquarium, image quality is
secondary.
The connection from the vending ma-
chine on the top of the aquarium to the
Pi cam on the front of the aquarium re-
quires a long camera cable (about 30cm
for my setup) that depends on the
height of the aquarium cover. A narrow
aluminum plate fixes the small camera
Conclusions
The automatic feeder has already fed my
Figure 5: The Zero W controls the servomotor and the LED from the fishy friends without any glitches during
GPIO pins. The circuit diagram shows the wiring setup. two short trips. My goal was a DIY solu-
tion from the outset, so competing with
housing a few centimeters in front of Pi cam. To do this, turn the adjustment commercially available solutions was
the screen. ring of the small lens very carefully with never important. Instead, I wanted to
To get sharp images, you need to set a tool and grab a few test images to build a device optimally adapted to my
check the setting.
the shortest possible focal length on the own needs: one that worked reliably and
The connection allowed me to check how it was work-
to the network is ing. I definitely did not want to compro-
primarily designed mise on the care of my pets.
to post the image However, even the best Internet-
grabbed after feed- based feedback is of little use if you
ing, so I can check have no one onsite who can intervene
it online. It also in an emergency. It’s always great to
opens up some have the support of your family or
possibilities for re- neighbors to water the flowers or even
mote operation. take care of the pets in your aquarium if
This setup re- you’re in a pinch. n n n
quires an HTTP
server on the Zero Info
W. The installa- [1] crontab(1) man page:
tion of the lean https://linux.die.net/man/1/crontab
lighttpd web
[2] lighttpd: https://www.lighttpd.net
server [2] and
PHP on the Rasp- [3] Project on GitHub:
berry Pi is well https://github.com/swenae/feeder
documented on- [4] Download page for English code:
line, so I will not https://linuxnewmedia.thegood.cloud/
go into further de- s/5Rzx9tQW2FJ6N3Z
tail here.
The feeder’s Author
web page (Figure Swen Hopfe works for a medium-sized
6), where you can company with a focus on smart cards and
check the last near-field communication (NFC). When he
feeding image and is not taking photos, in the great outdoors,
trigger a feeding or in his garden, he focuses on topics such
Figure 6: Monitoring over the web: The feeder along with a as the Raspberry Pi, Internet of Things,
releases the food, and the fish flock to devour it. snapshot with and home automation.
MakerSpace
Predicting the productivity of a
solar array with Perl
T
he current energy crisis has led upfront investment that will take more
many homeowners to invest in than a decade to recoup. Another huge
solar power. More people than disadvantage, however, is that photovol-
ever are choosing to install taic arrays are only productive if the
photovoltaic generation systems on their weather is willing to cooperate (Figure 1).
rooftops for domestic use. Depending on A house equipped with a photovoltaic
how much money is invested on such set (Table 1) might become truly self-suf-
systems, homeowners could see their ficient, as long as it is well managed.
power bills cut in half or even have them However, to optimize the use of solar
reduced to nothing. power, it is important to predict the daily
Solar is not all advantages, though: power yield of the system. If you have
Power generation represents a huge access to an accurate forecast, you can
plan ahead.
Imagine, for example, that you are plan-
ning to turn your yearly fruit yield into jam
in a given week. That undertaking is an
energy-intensive task. If you know tomor-
row’s weather is not going to cooperate
with your solar, but the day after tomor-
row you will have favorable conditions,
you can adjust your schedule and take ad-
vantage of the sun. On the other hand, if
your photovoltaic installation is off-grid (in
island mode), you will need to know in
advance which days are going to be bad
and how long a generator would need to
run to compensate for cloudy weather.
Lead Image © Vlada Grechko, 123RF.com
objective is to have the solar arrays expected to define a Site before you rooftop_sites/$YOUR_SITE_ID/U
charge the batteries during the day so start using the service (Figure 3), which forecasts?hours=72&format=csv&U
you have energy stored for when you is just a fancy way of saying you need api_key=$YOUR_KEY
need it. The advantage of this approach
is that it is more flexible and makes you
less dependant on regular power sup-
pliers. If your area experiences regular
blackouts or power (load) shedding (a
temporary reduction in supply of elec-
trical power), you will be able to use
battery power. The main disadvantages
are the huge upfront cost of battery
banks and the increased complexity of
the deployment. Also, not all solar sys-
tems equipped with batteries are black-
out proof, and some will cease operat-
ing if the grid goes down because of
the way they are designed.
Both strategies benefit from proper
planning of power consumption.
Somebody who sells power to the grid
will still find it preferable to use elec-
tricity while solar is working at its best,
instead of doing so at night and having
to buy power – even if the costs are
partially offset by the power sold ear-
lier. On the other hand, the owner of a
solar system with a battery bank will be
better off using electric power at noon Figure 2: A Turbo Energy hybrid inverter (1) paired with a battery bank
rather than draining energy from the
in a rack (2). The photovoltaic panels charge the batteries with excess
battery needlessly at night.
production, so the owner can use battery power after the sun sets.
Figure 3: After signing up with Solcast, you must create a site for your solar array before you can download
forecast data.
This URL leads to a CSV file (e.g., Fig- of each API variable is explained in Table 2 most important are how much power
ure 5) and can be fetched with curl, wget, and the content of the CSV file in Table 3. the panels will produce each of the up-
or any other downloader of your liking. coming days and whether you will face
Don’t forget to replace $YOUR_SITE_ID and Parsing the Forecast a power deficit. Because the forecast is
$YOUR_KEY with the ID code for your photo- The Solcast forecast data lets you per- in a machine-parseable format already,
voltaic site and your API key. The meaning form a number of calculations. The you can use some simple Perl scripts to
reveal these numbers. Perl is well suited
for the task because it is superb for pro-
cessing text. You can install the neces-
sary environment on a Devuan com-
puter with the commands as root:
apt-get update
consumption is generated each hour. I time. Listing 2 is a consumption profile Putting Everything Together
can then safely assume that my own from such an extrapolation, and Figure What you eventually want is for the
home will behave in a similar way. 6 is a graph of that data. The first col- computer to download a forecast reach-
In other words, if I guess that 5 per- umn is the timestamp belonging to the ing many days in the future and, taking
cent of Spain’s power generation oc- end of a one-hour metered period, and your power consumption profile into ac-
curs between 12:00pm and 12:05pm, I the second column is the percentage of count, give you an idea of how much
can extrapolate that my house will take the total daily power usage that takes surplus power you are going to get in fu-
5 percent of its daily power during that place in that period. ture days. A good strategy is to have a
cronjob fetch the forecast file from Sol-
Listing 2: Electric Consumption, Spain cast right after midnight and then parse
Date,Percentage of Daily Consumption 2022-11-02 12:30,2.26549889387938
it with a program capable of making
2022-11-02 00:30,1.56020056433848
these estimations. The script in Listing 3
2022-11-02 13:00,2.26549889387938
is a proof of concept for such a program.
2022-11-02 01:00,1.56020056433848 2022-11-02 13:30,2.28922673039563
The script assumes solar arrays are
2022-11-02 01:30,1.63088497829003 2022-11-02 14:00,2.28922673039563
working without battery backup and at-
2022-11-02 02:00,1.63088497829003 2022-11-02 14:30,2.29525746886163 tempts to guess how much power your
2022-11-02 02:30,1.58141212721891 2022-11-02 15:00,2.29525746886163 house will take from the grid and how
2022-11-02 03:00,1.58141212721891 much power will be produced but not
2022-11-02 15:30,2.27086417154914
2022-11-02 03:30,1.56087988890132
2022-11-02 16:00,2.27086417154914
used (Figure 7). Power considered
2022-11-02 04:00,1.56087988890132 “wasted” is what would be sold to the
2022-11-02 16:30,2.27188315839339
2022-11-02 04:30,1.57097271097776 power supply company if you sign a
2022-11-02 17:00,2.27188315839339
2022-11-02 05:00,1.57097271097776 smart grid contract. This script iterates
2022-11-02 17:30,2.27048984985125
2022-11-02 05:30,1.62759926560856
over a given forecast file and calculates
2022-11-02 18:00,2.27048984985125 the time period covered by the file.
2022-11-02 06:00,1.62759926560856
2022-11-02 18:30,2.37193796186272 Lines 10-37 load the forecast and profile
2022-11-02 06:30,1.85454912466257
2022-11-02 19:00,2.37193796186272 files to memory with the same approach
2022-11-02 07:00,1.85454912466257
2022-11-02 19:30,2.45179325741258 as solar_1.pl. The profile file needs no re-
2022-11-02 07:30,2.11453633949703
moval of Windows-style newline termina-
2022-11-02 20:00,2.45179325741258
2022-11-02 08:00,2.11453633949703 tions; therefore, it lacks a replacement
2022-11-02 20:30,2.47148673785156
2022-11-02 08:30,2.22951548769889 regex such as the one featured on line 14.
2022-11-02 21:00,2.47148673785156
2022-11-02 09:00,2.22951548769889 Lines 50 to 96 iterate through all the lines
2022-11-02 09:30,2.22946696451583 2022-11-02 21:30,2.38225260420458 of the CSV forecast file, discarding the first
2022-11-02 10:00,2.22946696451583 2022-11-02 22:00,2.38225260420458 one (which does not store a useful value).
2022-11-02 10:30,2.21253930551125 2022-11-02 22:30,2.15359750186017 Although not really recommended by Perl
2022-11-02 11:00,2.21253930551125 2022-11-02 23:00,2.15359750186017 gurus, I decided to use a C-type loop for
2022-11-02 23:30,1.96871031063571
readability. Lines 52-54 use regular expres-
2022-11-02 11:30,2.20946154932860
sions to extract the year, month, day, hour,
2022-11-02 12:00,2.20946154932860 2022-11-03 00:00,1.96871031063571
minute, and second corresponding to the
Listing 3: solar_2.pl
01 #!/usr/bin/perl {4})\-([\d]{2})\-([\d]{2})/;
02 53 ($h,$mt,$sec) = $csv_forecast[$i]{"timestamp"} =~
13 63 );
15 chomp ($line); 65
16 66 my $consumption;
20 70
45 my $deficit = "0"; 91
47 93 $waste = 0;
48 my ( $y,$m,$d,$h,$mt,$sec ); 94 $produced = 0;
49 my ( $i,$j ); 95 }
51 97
timestamp of the entry of the forecast file. consumes more power than is produced, are correct and lacks appropriate exit
Lines 55-64 create a DateTime object corre- the script notes the energy debt in the statuses for input errors. However, it
sponding to the timestamp and adjust it $deficit variable. Otherwise, excess serves as a base on which to build a pre-
to the local time zone. power is noted in the $waste variable. diction system. You can easily set up a
Lines 68-75 look in the profile file for The script also records the power pro- cronjob to download a forecast file from
the entry corresponding to the time- duced so far by the solar array during Solcast each day at midnight, generate a
stamp it is currently analyzing and cal- the day in line 82. prediction with the script, and send it by
culate the total power you expect the Line 85 guesses whether the end of email or post it to a website. The possi-
house to consume in that period. This the day has arrived. If so, the script bilities are endless (Figure 8).
calculation multiplies the total energy prints the information corresponding to A more complex script that supports
use expected for the day by the percent- the day just parsed and sets $deficit, input validation and tracks the state
age of daily power use expected in the $waste, and $produced to zero to start the of the battery banks is available at my
period corresponding to the timestamp, next day anew. gophersite [6]. (You’ll need a gopher
divided by 100. The result, in kilowatt- client.) n n n
hours, is stored in the $consumption Conclusion
variable. The script in Listing 3 is a proof of con- Info
The calculations in lines 76-80 are the cept and lacks input validation. It does [1] Solcast irradiance prediction service:
energy debt and excess. If the house not check whether the CSV files fed to it https://solcast.com.au/
[2] IDAE residential consumption in
Spain: https://www.idae.es/uploads/
documentos/documentos_
Documentacion_Basica_Residencial_
Unido_c93da537.pdf (in Spanish)
[3] US EIA energy use in homes:
https://www.eia.gov/energyexplained/
use-of-energy/electricity-use-in-
homes.php
[4] UK household energy usage:
https://www.ukpower.co.uk/home_en-
ergy/average-household-gas-and-
Figure 7: Output from solar_2.pl gives an approximation of how electricity-usage
much power will be used and how much power will be wasted.
[5] Power output of the Spanish power
grid, February 2022: https://demanda.
ree.es/visiona/peninsula/demandaqh/
tablas/2022-11-2/1 (in Spanish)
[6] Rubén Llorente’s gopherhole:
gopher://gopher.operationalsecurity.
es/1/Software
Author
Rubén Llorente is a
mechanical engineer
who ensures that the
IT security measures
for a small clinic are
both legally compliant
and safe. In addition,
Figure 8: Deficit, wasted power, and consumption curves through he is an OpenBSD enthusiast and a
three days, generated by a variation of the script from Listing 3. weapons collector.
nnn
IPTVnator 80
Erik Bärwaldt
The IPTV standard lets you view your
favorite channels on Linux.
FOSSPicks 84
Graham Morrison
This month Graham looks at LosslessCut,
Webcamoid, Sniffnet, and more!
Tutorial – LDraw and LeoCAD 90
Daniel Tibi
LDraw and LeoCAD help you become a
virtual LEGO architect.
MADDOG’S
Jon “maddog” Hall is an author,
educator, computer scientist,
and free software pioneer
who has been a passionate
DOGHOUSE
Restricting uses for FOSS may seem appealing, but it also might
advocate for Linux since 1994
when he first met Linus Torvalds
and facilitated the port of
not be the solution some imagine. BY JON “MADDOG” HALL
Linux to a 64-bit system. He
serves as president of Linux
International®. The tool isn’t the problem
R
ecently the question of whether free software (or even People may have heard of open source projects that change
open source) should have some clause put into the li- the licensing. Normally this is done with a fork of the project
cense to keep the software from being used for “bad” where the original license is maintained for the code released
purposes came up again. I believe that most of this was in- before the license change, and the modified license is applied to
spired by the war between Ukraine and Russia, and people not the forked code after. Another way of changing a license is to
wanting their software used for purposes of war. Some of this is have all the contributors assign their copyrights to an entity (ei-
probably also inspired by various governments using computer ther a person or a corporation) so that person or corporation
vision software to spy on their citizens or open AI software to has the ability to change the license. This is why the GNU proj-
establish surveillance. One person even brought up the concept ect could go from the GPL 2.x licenses to the GPL 3.x licenses
of using “his” free software in nuclear weapons. without having to get permission from thousands of people.
I am a pacifist. I do not believe in war as a solution. However, But trying to get thousands of people to agree on changing
this does not mean that I would just throw up my hands if a the license to include sanctions against some group of people
warmongering power attacked my country and started harming or a country would probably be close to impossible, and a very
people. Therefore I can understand the feelings of these people. dangerous precedent.
However, there are many other things that some people do Even the discussion of such a path would create horrible
not like, and such people would object to others using “their” ripples. In the early days of Free and Open Source Software
software for doing these things. (FOSS), intellectual property lawyers would read over the
Some people do not like the government, so they do not many licenses of FOSS software just to make sure there was
want the government to use their software. Some people do not some “gotcha” that might affect the companies they rep-
not like the military, so they do not want the military to use resented and prevent those companies from using the soft-
their software, even if it is not for killing purposes. Some peo- ware. This inspection by these lawyers is one of the reasons
ple do not like the police. Some people do not like religious or- given for a limited set of open source licenses to be gener-
ganizations, and some do not like atheists. The list goes on ated and used. Once a lawyer has inspected a particular type
and on, and if you draw a circle around each of these groups, of license for its terms and conditions, they do not have to in-
eventually the Venn diagram shows the null set of people able spect it again. If now there were new restrictions superim-
to use the software. And if no one uses the software, what is posed on end uses, you would open this inspection again and
the reason for writing it? many companies would give up using and contributing to
Another issue is the concept of software ownership. A partic- open source.
ular person, perhaps the founder of the project or the team Finally, open source software will find its way to people who
leader, may try to limit the use of the software, but are they the want to use it for bad purposes no matter what you do. Just as
only person who wrote it? Do all of the contributors agree with locks only keep honest people honest, licenses will not prevent
this limitation? One of the reasons why the Linux kernel project evil people from using software for evil purposes.
is still back on the 2.x license of the GPL is that there are thou- The solution to this is not to blame the tool, but the user. A
sands of contributors and thousands of copyright holders, who hammer can be used to build a house or it can be used to kill a
would all have to agree to the change in the license. Some of person … used for good or for evil. It is the end developer who is
these contributors have left the project, or died, making it really helping to build the weapon or wage the war that we need to
difficult to get their permission to change the license. stop, not the FOSS in the pipeline. n n n
nnn
Cleanly Docked
Do you work with Ubuntu but want to test something quickly on an
openSUSE system? You don’t need a second PC or a virtual machine
to do it – a single container is quite enough. BY HANS-GEORG EßER
virtual machine (VM) lets you use soft- If you develop your own software, you may want
Library Dependencies
The reason why you cannot run arbitrary Linux applications on specific version of the library, version 8. If you try to run the
just any system is that the program files usually contain only program on a machine with the older readline version 6 or 7,
parts of the binary code that the computer executes. Much of the program loader will fail to find the library and will com-
the functionality is found in library files that Linux additionally plain (Listing 1). Missing libraries can be installed later on:
loads at program startup time. For example, if an interactive Linux is quite flexible and lets you install different versions
program in text mode wants to read a line of text, it does not of the same library at the same time. Whether you will find
use its own routine for this, but instead resorts to the readline a missing version for a particular Linux distribution is an-
function from the library of the same name. Figure 1 shows a other question.
small sample program that reads a line of text and outputs it There is so much dynamism in Linux and the applications
unchanged with a hint. The code for the input and output available for it that each distribution update also updates a few
comes from the readline library function for the input and library packages. Programs that require libraries that are too
from printf for the output. When compiling with GCC, the new or too old will no longer run. Switching to a different distri-
‑lreadline option ensures that the compiler notes the depen- bution, such as from Ubuntu to openSUSE, becomes even
dency on the readline library in the generated program file. more difficult because distributors often decide for themselves
The last command in Figure 1 shows all the libraries that to keep certain software packages at a version below the lat-
the test program needs, including libreadline.so.8. The est available one. A program compiled for openSUSE might
file extension .so.8 indicates that the program expects a then need libraries from two different releases on Ubuntu.
Figure 1: Using what others have developed. Thanks to library functions such as readline, you don’t have to constantly
reinvent the wheel.
expect a wait of several minutes because multiple named docker, and the Docker service is still dis-
gigabytes of data need to be copied in the process. abled after the setup. You can change this with
This article takes a look at Docker [3]. But there the two systemctl calls (lines 6 and 7).
are other tools for providing containers on Linux. Log out and then log back in for your new group
Docker competitor Linux Containers (LXC [4]) is membership to take effect. By the way, in our test
another popular choice; it is used, for example, on Ubuntu 22.04, a new login was not enough. We
by the Proxmox [5] Virtual Environment (VE) and had to kill all of our own processes by typing
container management tool.
sudo killall ‑9 ‑u $USER
Installing Docker
Docker is quickly set up. On Ubuntu, install the and then log in again for this to work. Alternatively,
docker.io package (Listing 2, line 2) and sign up as you could reboot the computer, but the killall ap-
a member of the new docker group using usermod proach is faster.
(line 3). On an openSUSE system, you can install Finally, make sure the setup worked (line 9). The
with Zypper (line 5). The package there is simply program should output a few lines of text, includ-
ing Hello from Docker!. If the test fails, use groups
Listing 2: Setting Up Docker to check if you are a member of the docker group.
01 ### On Ubuntu
Also use systemctl status docker to see if the
Docker daemon is running.
02 $ sudo apt install docker.io
File Access
Running programs in the container usually only
makes sense if you can access files on the host
computer. You can set up a share far more easily
with Docker than with a VM; simply specify an ad-
ditional option of the form
‑v <FolderHost>:<FolderContainer>
Listing 6: dfind
dfind () {
jq '.RepoTags' | tr -d "\n";
echo;
You can set up several such mappings, and your home directory in the usual way (Listing 8,
can even include individual files in the con- starting with line 3).
tainer, using ‑v. If you use this method to map Target directories in the container do not need to
the /etc/passwd, /etc/shadow, and /etc/group exist; Docker creates them on the fly. Figure 4
files, which are important for user management shows the same home directory from the host sys-
into the container, you can switch to your own tem and from within the container. Be careful:
account in the container with su and work in Changes you make to the files in the container also
take effect on the host system. To be safe, it is a
Listing 8: File Access good idea to copy the files to the container instead.
01 $ docker run -it --rm \
02 -v $HOME:/var/homedir ubuntu
File Transfer
03 $ docker run -it --rm \
Docker provides a separate command for trans-
04 -v /home:/home \
ferring files into and out of the container. docker cp
lets you copy files in a similar way to the SSH scp
05 -v /etc/passwd:/etc/passwd \
tool. You cannot use it to copy files to an image;
06 -v /etc/shadow:/etc/shadow \
you first need to start a container.
07 -v /etc/group:/etc/group ubuntu
Once the container is running, you will find its
08 $ docker cp /etc/passwd \
computer name at the prompt, which is an ID con-
09 22340547e6a3:/etc/passwd
sisting of hexadecimal numbers. You can also
Figure 4: You can map individual files or entire directories from the host to the container.
search for the container with docker ps. In the The oldgedit image is not configured to start
overview consisting of very long lines, in addition the /bin/bash shell, but to directly launch the gedit
to the numeric ID, there is also a pretty name that editor. It does this with normal user rights, that is,
Docker randomly assigns unless you specify one not as root, but as a user with a user ID of 1000.
for the new container at startup time. When you try to start a container now by typing
Both the numeric ID and the name, can be used
for the copy command (e.g., to copy the file /etc/ docker run ‑it ‑‑rm oldgedit
passwd to the container). Line 9 of Listing 8 copies
the /etc/passwd file from the host system to a con- you will see some error messages ending with
tainer with an ID of 22340547e6a3 and to the same cannot open display. The program cannot access
folder there, leaving the names unchanged. an X server and therefore cannot open a window.
The X server running on the host creates a special
X Window socket type file named X0 below /tmp/.X11‑unix/
Graphical applications can initially cause problems where applications can contact it. In addition to X0,
for Docker, but this is there may be other entries here (X1, X2, and so on) if
Listing 9: Dockerfile easily solved. The trick multiple X servers are active. The X server to display
FROM ubuntu:14.04
for classic X applications program windows is determined by the $DISPLAY en-
RUN apt update
(not Wayland) is to pass vironment variable. It typically contains a value of :0.
RUN apt install -y gedit the /tmp/.X11‑unix/ di- Then pass the contents of the variables and ac-
RUN useradd -m user rectory and the $DISPLAY cess to the sockets in /tmp/.X11‑unix/ to the con-
USER 1000 environment variable tainer using the ‑e DISPLAY and ‑v /tmp/.X11‑unix:/
CMD gedit into the container. You tmp/.X11‑unix options (Listing 10), allowing gedit
can talk an older version to run. Because the home directory is additionally
of the gedit Gnome edi- mapped to /home/user/ in the container, gedit should
Listing 10: X11 tor into working by creat- also be able to open and edit files (Figure 5).
$ docker run -it --rm -e DISPLAY \
ing a custom image
-v /tmp/.X11-unix:/tmp/.X11-unix \
named oldgedit (see the Wayland
“Building an Image with Current versions of Ubuntu use Wayland as the
-v $HOME:/home/user oldgedit
Dockerfile” box). successor to the X Window System with Wayland
Figure 5: Thanks to Docker, even older graphical applications can run on a modern system. The Gnome editor from Ubuntu 14.04 (left) next to its modern
successor.
providing a compatibility layer that allows X appli- don’t always need to start from scratch and can
cations to run on it. Genuine Wayland programs use an image from Docker Hub as a basis, which
do not run on X. One example is the foot terminal you configure to meet your needs. Things start to
program, which you can install on Ubuntu by typ- get more exciting when you use a whole series of
ing sudo apt install foot. If you launch foot in a containers at the same time. Then advanced top-
Wayland session, a terminal window appears. If ics such as container network configuration and
you try the same thing in an X session, a lengthy orchestration with tools such as Kubernetes [7]
error message appears, ending with failed to con- start to emerge. n n n
nect to wayland; no compositor running? goodbye.
Wayland uses different sockets and files to pro- Info
vide access to the Wayland server. The socket file
[1] “Comparing VirtualBox and VMware Worksta-
is /run/user/1000/wayland‑0 instead of /tmp/.
tion Player” by Thomas Leichtenstern, Linux
X11‑unix/X0, and instead of $DISPLAY, the variable
Magazine, issue 204, November 2017,
$XDG_RUNTIME_DIR contains relevant information
https://www.linux‑magazine.com/Issues/
such as the folder name /run/user/1000/. You
2017/204/VirtualBox‑vs.‑VMware
need to pass both into the container with options
similar to those for X, as Listing 11 shows. way‑ [2] “Run Virtual Machines in Gnome Boxes” by
landtest is just the name of another test image. Christoph Langner, Linux Magazine, issue
Support for X and Wayland can also be combined 221, April 2019, https://www.linux‑magazine.
if a Wayland server is running. In this case, you com/Issues/2019/221/Gnome‑Boxes
need to pass both sockets and both environment [3] Docker: https://www.docker.com
variables into the container. [4] LXC: https://linuxcontainers.org
[5] Proxmox:
Conclusions
https://pve.proxmox.com/wiki/Main_Page
Docker containers offer a practical alternative to
VMs, saving both time and computing resources. [6] Docker Hub: https://hub.docker.com
With many applications, it’s worth learning how to [7] Kubernetes: https://kubernetes.io/docs/
use Dockerfiles to build your own images. You concepts/overview/
LINUX VOICE IPTVNATOR
Couch Surfing
Thanks to the IPTV standard and free software, you can view your favorite
channels on Linux without any problems.
BY ERIK BÄRWALDT raditional audiovisual technology and continents. Bandwidths of around 4Mbps are al-
Installation
The software has not made its way into the re-
positories of the common distributions so far,
but you can pick it up as a snap package if the
distribution you are using supports snaps. You
can also find RPM and DEB packages at the proj-
ect website – or download IPTVnator as a cross-
distribution AppImage for 64-bit systems.
When installing the snap package from a distribu-
tion-specific app store, the routine will typically auto-
matically create a launcher in the desktop environ-
ment’s menu. You can either launch the AppImage
package manually or integrate it into your desktop
environment using AppImageLauncher. After the
first start, the application shows a window with just
a few controls (Figure 1).
Conclusions
Thanks to IPTVnator, Linux now has an easy-to-
use application for streaming IPTV broadcasts.
Despite the low version number, the software is al-
ready stable on several platforms, and it is suit-
able for users without in-depth knowledge of the
underlying technology, thanks to the built-in play-
back software. Thanks to IPTVnator, Linux users
now have an option for picking up their favorite
broadcasts from the road. n n n
Figure 4: The group function sorts channels into genres, for example, News.
Info
IPTV and VPN [1] IPTVnator:
Some streaming providers restrict their offerings
https://github.com/4gray/iptvnator
to the country of origin and determine the ap-
proximate location of the receiving device based [2] IPTV: https://en.wikipedia.org/wiki/Internet_
on the IP address. This is known as geoblocking. Protocol_television
If the device is outside the intended distribution [3] FreetuxTV:
area, an error message appears in the playback https://github.com/freetuxtv/freetuxtv
window. [4] Zapping: https://zapping.sourceforge.net/
You can use a VPN to get around geoblocking.
Zapping/index.html
You first need to register with a VPN provider and
download and install their software. Unlimited [5] Hypnotix:
data volumes and access to all available servers https://github.com/linuxmint/hypnotix
of the provider are usually only available with a [6] IPTV playlists:
paid subscription. However, some providers also https://github.com/iptv‑org/iptv
Figure 5: With the help of VPN access to the Internet, you can view channels that you normally can’t access because of
geoblocking.
Over the past couple of months, Graham’s ever-versatile Steam Deck has synced
books to an e-reader, played movies on a television, joined Mumble, recorded two
podcast episodes, and even played a few games. BY GRAHAM MORRISON
Video editor keyframe edits, the video data can simply be rewritten
LosslessCut
without the edited out parts.
With most of us now recording 4K video on our phones
or GoPro equivalents, quick editing like this is the perfect
R
egardless of the incredi- transcoded from one format to solution. We’re not looking for the perfect edit, but instead
ble performance ad- another before they can be used. a way of cutting quickly to the action, chopping the pream-
vances we’ve made over This latter roadblock is some- ble or appendices from the beginning and ends of our vid-
the past two decades, video edit- thing that LosslessCut attempts eos. With LosslessCut, you can simply drag-and-drop a
ing can feel almost as slow as to mitigate. Powered by the in- video into the main application window, locate the “edit-in”
editing with Media 100 on Pow- credibly versatile FFmpeg, Loss- point, locate the “edit-out” point, and save the middle seg-
erPC Macintosh in 1995 and lessCut can edit huge videos ment as a new, shorter video. This does mean you can’t
writing to a tape drive. This is for and, vitally, can export them perform any other kind of editing task, such as crop, rotate,
a few reasons, but it’s mostly be- quickly with no loss of quality. It reflect, or filter processing, because these tasks would re-
cause our demands scale to fit accomplishes this by only letting quire frame and keyframe recalculation, and therefore, a
our capabilities. Video resolution, you edit at specific keyframes in lossy-intensive transformation. The only other disadvan-
color depth, and frame rates a video stream, avoiding the pro- tage is that you can’t always edit at the exact point you
have scaled to accommodate all cessor-intensive need to recalcu- want to since the edit or split point will move to the closest
that spare processing, and files late frames that may fall be- keyframe. Fortunately, there are key icons in the UI that will
nearly always need to be tween keyframes. By sticking to automatically move the cursor to keyframes and perfect
edit points. With those limitations accounted for, the per-
formance bottleneck becomes storage access rather than
the transcoding that other applications need to perform.
Editing between keyframes is being worked on, with a
recent development release capable of reconstructing the
frames after or before a keyframe enabling editing any-
where with only some processing and lossy overhead for
the reconstructed part. The remainder of the video will be
unaffected, which is still a big improvement on how most
video editors work. The rest of the UI is simple but effec-
tive. An advanced view enables you to turn on waveform
and thumbnail timelines, set the zoom level, take a single
image, and see the resolution and frame rate details for
your clip. You can also import multiple files, although they
currently have to be edited separately rather than on dif-
ferent tracks as you might in Kdenlive – although that fea-
ture too is coming. When you’ve finished, you can export
your edits as either a merged single segment or as multi-
1. Tracks: Multiple video files can be loaded, split, and concatenated. 2. Audio: Audio ple files, and while the emphasis is obviously to keep the
tracks can be separated, deleted, and replaced. 3. Output formats: LosslessCut original encoding, you can also choose to convert the out-
uses either its own FFmpeg or your system’s FFmpeg to support as many file put segment to any format supported by FFmpeg. This
formats as possible. 4. Thumbnails: Thumbnail and audio waveforms can be makes LosslessCut a great front end to file conversion, in
optionally enabled for clips. 5. Segments: Video is cut into segments that can be addition to meeting all your instant editing needs.
exported as a batch or as a single file. 6. Keyframe edits: Skip between edit points
with these buttons and navigation controls. 7. Export: Segments can be labeled, Project Website
re-ordered, and listed in a separate panel on the right. https://github.com/mifi/lossless-cut
Webcam effects
Webcamoid
W
e recently looked at Webcamoid is a far more mod-
the brilliant camerac- est desktop application than OBS
trls, a tool for editing Studio. Rather than being an en-
your webcam settings while it is tire suite of tools for live-stream-
being used. Cameractrls was ing, it’s a far more focused photo
particularly useful for video con- and video effects processing tool.
ferencing because it enabled you This makes it less resource hun-
to adjust the brightness, expo- gry and easier to use. It can re-
sure, and color balance while you cord videos and take photos from
were in a meeting. But camerac- your webcam, capture your desk-
trls could only adjust parameters top, and run captures through one If you’re unhappy with the built-in effects you find in Zoom or Google
supported by your hardware and or more of over 60 effects. Along- Meet, run your streaming video through Webcamoid first.
couldn’t process the images it- side the same inbuilt settings you
self. This is trickier to achieve be- can control with cameractrls, you own virtual webcam driver so that processed video with its
cause it requires more than sim- can turn your video into ASCII, a audio can be passed through to another application. After
ply changing device settings cartoon, or a black and white setting this virtual device as the source, any application ac-
and instead requires the video movie, with or without distortion, cessing this virtual device will receive the processed video
stream to be intercepted, pro- blurring, and aging. These and as if it were a live feed, which is a great way to improve the
cessed, and passed on to a desti- many other effects can be quality of your own video meetings, or at the very least,
nation as quickly and efficiently stacked and exported to any for- make them more interesting.
as possible. The amazing OBS mat supported by FFmpeg, which
Studio can do this, and so too is driving the processing. Like Project Website
can Webcamoid. OBS, Webcamoid can install its https://webcamoid.github.io
Pulsar
tive development of Atom, at
which point its immense popu-
larity became apparent. For any
such popular open source appli-
T
here are many projects cations, that really just signals
whose popularity only the end of the beginning.
becomes clear when Pulsar is a community and open
those projects came to an end. source continuation of the original
Canonical’s Unity desktop is a Atom code editor and IDE. Like the
good example of one that also original, and as you might expect
continues to thrive as a commu- from a modern web framework,
nity project, and so too is it’s fantastically well designed, with
GitHub’s now defunct text editor, beautifully rendered fonts and a UI
Atom. Atom was a code and text that supports multiple panes from If you loved the Atom text editor, you’ll equally love the open source
editor that became the torch- the very first launch. The new and community-supported Pulsar fork.
bearer for a new generation of branding looks excellent, and while
graphical editors whose func- there are still a few rough edges repository, the intention is to replace it with a new one con-
tionality could be profoundly where the old themes haven’t quite taining open source package equivalents. Everything else is
changed with plugins and a con- been replaced, Pulsar already feels as it was in the original editor, and Pulsar means you can
figuration file. More importantly, like its own project. There’s con- continue using your old configuration and project files with
it was built using Electron – the text-sensitive help, a filesystem your own projects. Better yet, it’s now in the hands of a com-
web-based framework that en- browser, a built-in package man- munity who are free to take the editor into completely new
abled developers to build desk- ager for plugins, and smart auto- and untested directions, which is where Pulsar could really
top applications with web tech- completion. The old packaging start to shine.
nologies – and Electron was built system was closed source, and
for Atom. This synergy between while Pulsar can still access and Project Website
the two lasted until the end of use the old Atom.io package https://pulsar-edit.dev
Code editor
Networking monitoring
Sniffnet
T
hanks to the inbuilt capa- run the application as root for ad-
bilities of the Linux ker- equate access permissions. You
nel, we’re fortunate can also choose whether to
enough to have several high-pro- monitor IPv4, IPv6, or UDP proto-
file and highly competent net- cols, or all three, and there’s an
work-monitoring tools. Wireshark additional filter for specific net-
has become an industry stan- work application protocols.
dard for low-level analysis, and Click on Run and the monitoring
higher level applications such as starts. It can help if the machine Sniffnet is easily installed via Cargo or DEB packages and, while the
Portmaster give us complete you’re monitoring acts as a UI is simple, it does offer light and dark modes of rendering.
control over what goes into and router, such as a server running
out of our networks. But for non- Pi-hole, but it’s also very inter- connections appear below, sorted optionally by most re-
experts, there isn’t so much esting on a single machine be- cent, most bytes, and most packets. The UI is simple
choice. And for those people, cause you can quickly see just and well suited to terminal-only rendering, a feature
Sniffnet could be enough. Sniff- how many protocols you use that’s hopefully being worked on. Clicking on the Open
net is a graphical network moni- with normal network access. full report button will output a full network report to a
tor that shows a plotted chart of HTTPS will normally top the list, text file. Even without augmentation, Sniffnet already
outgoing and incoming data followed closely by the Simple offers a powerful and intuitive set of network monitor-
alongside a breakdown of which Service Discovery Protocol ing features that will help the majority of us understand
networking protocols are being (SSDP). Type ssh to connect to our own network traffic and see what’s being used.
used. To start with, you need to a remote machine, and you’ll
select a network device detected see SSH appear in the list of Project Website
on your system, and you need to used protocols. Individual https://github.com/GyulyVGC/sniffnet
C
onsidering how central to using DuckDuckGo, and works
the humble web browser brilliantly with DuckDuckGo
has become to our lives, bangs such as !w to open the top
all the most popular browsers result on Wikipedia. These bangs
don’t feel so humble, and typi- are augmented with a few of
cally share the same functional- Min’s own, such as !bookmarks
ity and feel. Chrome, Safari, Edge, to open the bookmarks view and
Brave, and Firefox are all large !settings for further configuration
and complex applications with options, and you can add your
hidden depths that can make own from the Preferences panel. A minimal web browser such as Min is useful if you want to use the
them difficult to use, and simpler Tabs also appear in the titlebar web without being so distracted.
alternatives are few and far be- next to where they’ve been sum-
tween. Qutebrowser is minimal, moned, ensuring that the main titlebar separated from the URL and tabs. Tabs them-
but thanks to its Vim key bind- view remains uncluttered and selves can be grouped into Tasks, which are accessible
ings, is not easy to use. Which is entirely focused on web render- from the second drop-down menu. There’s also a reader
why this browser, Min, is so re- ing. There’s no UI text, only icons, mode and a focus mode, with the latter disabling new
freshing. It may be built on Elec- and there are only two drop- tabs from being opened to keep you from watching You-
tron, so it doesn’t challenge the down menus at opposite ends of Tube while you’re supposed to be working. It’s the perfect
Blink monoculture, but its design the top bar. The Preferences balance between functional and minimal and a genuinely
and aesthetics definitely chal- page lets you tweak the excellent refreshing change from the establishment.
lenge the ethos that browsers built-in ad-blocking, set the ap-
need to have an option for every- pearance to light or dark mode, Project Website
thing. The most obvious enable user scripts, and create a https://minbrowser.org
FEX
macOS machines with its incred-
ibly performant Rosetta, which
now works natively within
Ubuntu virtualization on macOS,
W
ith ARM64 becoming but FEX is trying to do the same
an ever more viable thing for native Linux.
platform for general FEX is an x86 and x86-64 com-
Linux desktop and laptop use, we patibility and translation layer for
find ourselves at an exciting junc- ARM64, enabling you to run x86
ture. For the first time in a gener- binaries from an ARM host. It only
ation, there’s a split between a currently works with ARMv8.0
dominant and well-established and ARMv8.1+, rather than the
architecture, x86 and x86-64, and chips found on older Raspberry Pi Here’s an x86 version of StepMania running with FEX on an ARM64
a nascent newcomer, ARM- devices, but it does run quickly version of Ubuntu running virtualized on an M1 Mac.
based AArch64. Most distribu- and efficiently enough to be un-
tions now have a quickly matur- noticeable on modern hardware. executables, and the script will download this and let you
ing ARM build of their latest re- It’s a brilliant way to run games choose to run it uncompressed or from the compressed
leases, and open source means and other proprietary software image to save space. Either way, it works without any fur-
almost everything can be rebuilt that may not yet offer native ther setup. Type FEXBash and you immediately get an x86
without too much difficulty, but ARM builds. On Ubuntu, there’s a version of Bash running within your own filesystem. Type
there’s still a transition period for handy script that will install all uname ‑a and you’ll see it’s x86, and you can access many
some software, especially on dis- FEX’s necessary dependencies other x86 executables directly. Even graphics acceleration
tributions such as Arch where and add the project’s PPA to your remains intact as it’s passed through to your host system
not everything in the AUR offers package archive. An x86 RootFS libraries, and it all works brilliantly.
an ARM binary and proprietary image of the same distribution is
software with only x86-based also needed to provide the run- Project Website
builds. Apple is tackling this time environment for your x86 https://github.com/FEX-Emu/FEX
Audio effects
PaulXStretch
I
f you’re into music produc- music, instrumentation, or
tion, or otherwise playing percussion.
around with audio, time To accommodate all this audio
stretching is one of the most complexity, all kinds of algorith-
common audio effects you can mic techniques have been cre-
use. This is because time ated for dealing with specific
stretching is both practical and types of sound, and many of
creative. It’s practical because it those techniques can also be
enables you to mix audio re- used creatively. Which is exactly
corded at one speed with audio what this audio plugin, PaulX-
recorded at another, without any Stretch, has been designed to do.
sign that the audio has been pro- The Paul in its name comes from
cessed. It’s creative because the central algorithm it uses to Alongside the pitch and time shifting, there are some excellent
your audio becomes malleable in process audio (Paul’s Extreme standard effects that can be used in isolation, including
both duration and pitch. Both Time Stretch, originally devel- compression and equalization.
time stretching and pitch shifting oped by Nasca Octavian Paul),
are intrinsically linked because, but the plugin has been designed low- and high-pass filter, and even binaural
to make a duration longer or to give you quick and easy ac- processing. Their order can be changed with
shorter, audio is slowed down or cess to a comprehensive suite of a flow diagram below the module parame-
speeded up. This affects its time stretching related functions ters. Beneath this is a tabbed view to show
pitch. And the process to restore that can do anything from accu- the sampled audio waveform, the processed
pitch isn’t easily accomplished. rately changing the pitch of your segment ratios, and an equalizer.
The human voice, for example, audio to mangling it beyond all This might all sound complicated, but you
contains formants that don’t recognition. There are seven hori- can easily play with the controls without un-
track the fundamental pitch of zontal modules that can be se- derstanding their function, and the sound can
the voice. They need to be fil- lectively enabled or disabled, and range from slight tonal differences to huge,
tered out and separately pro- these manipulate the stretch glitching feedback loops. You can either pro-
cessed, and there are the same amount, harmonics, noise, fre- cess a file or an incoming stream and send
caveats for any other type of quency shift and spread, a the output back to your audio application or
to an exported file. Audio can be sampled
and frozen, with a subsection selected from
the waveform view for special focus. It works
well as a DJ or musician’s effect for real-time
processing, but it’s equally adept as a drop-in
effect in Ardour or Bitwig. But what’s espe-
cially remarkable about this plugin is its qual-
ity, and that could be because its developer
usually makes commercial and proprietary
plugins. PaulXStretch, however, is completely
open source and can even be built as a shiny
new and unexplored CLAP plugin (which is
how we tested it). The UI has a level of pro-
fessionalism you don’t often see in open
source plugins. While there are many differ-
ent options crammed into its single window,
they’re easy to navigate and don’t overwhelm
the UI with complexity. This is a genuine ac-
complishment that’s quite apart from the
amazing sound processing the plugin is ca-
pable of, and it’s brilliant to see effects like
these making their way to Linux.
PaulXStretch is one of the first audio plugins we’ve been able to build and use as a Project Website
CLAP plugin, making it ideal for powerful Linux audio processing and manipulation. https://github.com/essej/paulxstretch
Tabletop Club
N
etwork gaming has been spontaneity of being with friends
around for almost as and choosing a game seems al-
long as there’s been gam- most impossible.
ing. You could play text-based This is where Tabletop Club can
Multi User Dungeons (MUDs) on help. It’s a physics-driven 3D multi-
university mainframes in the late player game canvas designed to
1970s, and there were several bril- help you easily recreate your favor-
liant 8-bit home computer games ite board games so you can then
that could link up via a null modem play them online with your friends. Built with the Godot games engine, Tabletop Club makes it easy to
cable for multiplayer fun. Null-mo- The key to being able to do this is play your favorite board games online.
dem gaming begat dialup modem asset packs. An asset pack is a
gaming on bulletin board systems bundle of the boards, pieces, brilliant and includes a few easy-to-follow tutorials to help
which eventually led to the Inter- cards, sound graphics, and save- you create asset packs for your own games. As you might
net. But with the exception of game rules required for a game to expect, there’s an active community behind the project, and
games such as chess, checkers, run, save, and be restored. The hopefully users will share their own asset packs for their
and Scrabble, the idea of playing game logic doesn’t need to be im- own favorite games. If you’ve not tried something like this
an already established tabletop plemented, because you’re playing before, you might be expecting a poor imitation of the IRL
game online is relatively new. This with other people, just as you experience, but Tabletop Club is actually a lot of fun when
could be because the intellectual would with a real board game. You combined with a video chat with your fellow players. It’s the
property for so many games is so all need to voluntarily stick to the next best thing to actually being there.
closely guarded. While you might rules, and Tabletop Club bundles
be able to buy and play an individ- chess and checkers to help you Project Website
ual game, recreating the get started. The documentation is https://github.com/drwhut/tabletop-club
3D Racing
Stunt Rally
S
tunt Rally is a 3D driving harder to play, but more rewarding
game that’s been under de- after you’ve learned how a vehicle
velopment for over a de- handles and where a course goes.
cade. Like Trigger Rally, which we Stunt Rally is no different.
looked at previously, Stunt Rally’s You start by choosing your track.
graphics engine is based on VDrift, With so many to choose from, al-
an earlier 3D driving game with most every possibility is covered,
many of the same core driving fea- from mountain forests to tropical
tures and a track editor. The track beaches, with even a detour to an If you enjoy console rally games from the early 2000s, you’ll love
editor has been key to the success alien landscape. Because Stunt Stunt Rally.
of all three titles because it means Rally focuses on the extreme side
anyone can build a track, and of the sport, most levels include with your chosen vehicle. Races can be offline and online,
there are typically dozens from jumps and other hazards to navi- and you can race ghost versions of your previous fastest
which to choose. Stunt Rally itself gate, and the course selector high- runs. The graphics are excellent, with varied terrain, densely
includes 202 different tracks, 37 lights these as attributes alongside populated forests, and dynamic textures, but it’s the game-
different scenarios, and 25 differ- an image of the selected terrain. play that makes you want another go. The controls them-
ent vehicles, offering a huge You can then choose your vehicle, selves are simple, but getting a fast time for a course is diffi-
amount of variety. The game itself which has its own excellent statis- cult, requiring many replays to master. Stunt Rally gets this
is modeled on early 3D console tics page to help you see attributes balance absolutely right, with enough challenge and progress
rally games that were trying to such as weight, power, top speed, to make you always want another go.
be relatively realistic, rather than and stop times. You can change
the arcade style of something your car’s color and see online fast- Project Website
like V-Rally. This can make them est times for the selected course https://stuntrally.tuxfamily.org
Master Builder
LDraw and LeoCAD help you become a virtual LEGO architect.
BY DANIEL TIBI or decades, young and old alike have en- a children’s toy; there are also many adult LEGO
If you just entered the models in files as ab- window is divided into two areas. On the left you
stract numeric sequences, the build would not be will find what is initially an empty base plate. The
much fun. This is where LeoCAD comes in. It out- plate grows automatically as soon as you place
puts the models graphically and lets you edit your bricks close to one of its edges. Top right you will
creations. This is how the model in Figure 1 was see a ball that you can rotate with the mouse.
created from the text file in Listing 1. This lets you move the model in any direction to
view it from all sides. Pressing H switches back to
Virtual Building Fun the original view. You can press + to zoom into the
When you launch LeoCAD for the first time, it model and - to zoom out.
needs information on where the LDraw files for On the right side of the window, LeoCAD dis-
each LEGO brick are stored. LeoCAD itself comes plays a list of all available bricks at the top, fol-
with a small selection of bricks, but this would se- lowed by an overview of all colors underneath. For
verely limit your creativity. In the View | Settings a better overview, simply filter the selection. At
menu, open a dialog and go to the General tab. startup time, the filter defaults to Brick. You can
Then, in the Parts Library field, enter the path to search for bricks using the search field below. Ei-
the folder where you previously unzipped the ther type in the part number you are looking for
LDraw files, for example, ~/ldraw/. (e.g.,, 3002 for a brick with two-by-two studs) or
Now you get started with the virtual build. search for the size of a brick. To do this, enter
Below the menubar and toolbar, the LeoCAD something like 2 x 2. Pay attention to the spaces;
Figure 3: The instructions show you how to assemble Tux in 12 steps from bricks.
otherwise you will not see any results. In addition, three straight arrows let you move the brick back
you can find a specific brick by typing its name, and forth, left and right, and up and down. Alterna-
such as slope brick. Use Insert to integrate the ap- tively, you can use the arrow keys and the Page Up
propriate brick into the model or drag it to the de- and Page Down keys. The three curved arrows are
sired position with the mouse. used to rotate the brick on all three axes. To do this,
Now you need to insert the brick correctly. To do use the same keys as you used for moving again,
this, click on the brick to select it. LeoCAD marks but this time in combination with the Shift key.
the selected brick with six arrows (Figure 2). The During a build, you will often use single bricks or
a certain arrangement several times. Instead of
reinstalling and aligning each brick individually,
you can simply select the brick in question (or the
respective combination if you hold down Ctrl) in
the model and then duplicate the selection using
Ctrl+D. Then move the cloned elements to the de-
sired location.
Up to this point, your model is still gray – high
time to add some color. You can see the available
colors bottom right in the window. As soon as you
click on one of the colors, the bricks in the selection
list on the right are painted in that color. If you want
to color bricks that have already been installed, first
select the desired color and then select the bricks
in question. Then select the Part | Paint Selected
menu item to finally color the bricks.
Build Instructions
If you want to rebuild your virtual model later with
real bricks, it makes sense to follow the step-by-
step instructions. To do this, insert a new build step
at appropriate points when assembling the virtual
model by pressing Alt+Right arrow. The File | In-
Figure 4: Parts Used lists all the bricks for a project; switch to Summary to see the model’s size. structions menu item displays detailed instructions
Exporting
LeoCAD offers several options for exporting.
You can use the File | Save Image menu item to
turn a model into a PNG graphic. For more op-
tions, see File | Export. You can create an HTML
file from your model or write a list of the bricks
used for it to a CSV or XML file. You can reuse
the bricks, for example, on an online market-
Figure 5: A wizard helps you assemble miniature figures and kit them out with accessories. place such as BrickLink [7].
LINUX
NEWSSTAND Order online:
https://bit.ly/Linux-Newsstand
Linux Magazine is your guide to the world of Linux. Monthly issues are packed with advanced technical
articles and tutorials you won't find anywhere else. Explore our full catalog of back issues for specific
topics or to complete your collection.
#267/February 2023
Backup
In theory, everyone could use the same backup tool, but the best way to build regular and
systematic backups into your life is to find a solution that fits with your own habits and
methods. This month, we preview some popular backup apps in the Linux space so you can
find one that works for you.
On the DVD: Linux Mint 21 Cinnamon and Kali Linux 2022.4
#266/January 2023
Generative Adversarial Networks
What is the secret behind the recent explosion of computer art and fake videos?
One neural network lies to another neural network...
On the DVD: Ubuntu 22.10 and AlmaLinux 9.0
#265/December 2022
Quantum Computing
Most Linux users know that this futuristic technology leverages the weird power of quantum
mechanics. But how does it really work? What can I do with it? Are there tools available today
that will help me experiment? This month we take a deep dive into quantum computing.
On the DVD: Manjaro 21.3.7-220816 and Arch Linux 2022.10.01
#264/November 2022
Artificial Intelligence
Machine learning remains shrouded in mystery even though it is now an integral part of our
everyday world. This month we look behind the curtain at some popular techniques for
supervised and unsupervised learning.
On the DVD: Debian 11.5 and Rocky Linux 9.0
#263/October 2022
Build an IoT Linux
The most amazing thing about Linux is its flexibility. Linux systems run on the biggest computers
in the world – and on many of the diminutive devices that populate your home environment. If
you’ve always wondered how developers adapt Linux to run on tiny tech, you’ll appreciate this
month’s stories on Buildroot and the Yocto project.
On the DVD: Linux Magazine Archive issues 1-262
#262/September 2022
Beyond 5G
Behind the scenes, the cellular phone network has always been the preserve of highly specialized
and proprietary equipment, but some recent innovations could be changing that. This month we
explore the Open RAN specification, which could one day allow more of the mobile phone
network to operate on off-the-shelf hardware.
On the DVD: openSUSE Leap 15.4 and MX Linux 21.1
FEATURED
EVENTS
Users, developers, and vendors meet at Linux events around the world.
We at Linux Magazine are proud to sponsor the Featured Events shown here.
For other events near you, check our extensive events calendar online at
https://www.linux-magazine.com/events.
If you know of another Linux event you would like us to add to our calendar,
please send a message with all the details to [email protected].
Events
GeekBeacon Festival Feb. 18 Virtual Event https://gbfest.org/
Kickstart Europe 2023 Feb. 20-21 Amsterdam, Netherlands https://www.kickstartconf.eu/
FAST'23 Feb. 20-23 Santa Clara, California https://www.usenix.org/conference/fast23
SCaLE 20x Mar. 9-12 Pasadena, California https://www.socallinuxexpo.org/blog/scale-20x
Cassandra Summit Mar. 13-14 San Jose, California + Virtual https://events.linuxfoundation.org/
FOSS Backstage 2023 Mar. 13-14 Berlin, Germany + Online https://23.foss-backstage.de/
Everything Open 2023 Mar. 14-16 Naarm (Melbourne), Australia https://2023.everythingopen.au/
Women in CyberSecurity Mar. 16-18 Denver, Colorado https://www.wicys.org/events/wicys-2023/
CloudFest Mar. 21-23 Europa-Park, Germany https://www.cloudfest.com/
Open Source 101 Mar. 23 Charlotte, North Carolina https://opensource101.com/
KubeCon + CloudNativeCon Apr. 17-21 Amsterdam, Netherlands https://events.linuxfoundation.org/
Europe 2023
PyCon US 2023 Apr. 19-27 Salt Lake City, Utah https://us.pycon.org/2023/
Hybrid Cloud Conference Apr. 20 Virtual Event https://www.techforge.pub/events/hybrid-cloud-congress-2/
Images © Alex White, 123RF.com
Linux App Summit 2023 Apr. 21-23 Brno, Czech Republic https://linuxappsummit.org/
Cloud Expo Europe May 10-11 FrankfurtFrankfurt, Germany https://www.cloudexpoeurope.de/en
DORS/CLUC 2023 May 11-12 Zagreb, Croatia https://www.dorscluc.org/
Icinga Camp Berlin May 17 Berlin, Germany https://icinga.com/community/events/icinga-camp-berlin-2023/
ISC High Performance May 21-25 Hamburg, Germany https://www.isc-hpc.com/about-overview.html
CloudFest USA May 31-Jun. 3 Austin, Texas https://www.cloudfest.com/usa/
Contact Info
Editor in Chief While every care has been taken in the content of
Joe Casad, [email protected] the magazine, the publishers cannot be held respon-
Copy Editors sible for the accuracy of the information contained
Amy Pettle, Aubrey Vaughn within it or any consequences arising from the use of
News Editors it. The use of the disc provided with the magazine or
Jack Wallen, Amber Ankerholz any material provided on it is at your own risk.
Editor Emerita Nomadica Copyright and Trademarks © 2023 Linux New
Rita L Sooby Media USA, LLC.
Authors Managing Editor No material may be reproduced in any form what-
Lori White soever in whole or in part without the written per-
Erik Bärwaldt 80 mission of the publishers. It is assumed that all cor-
Localization & Translation
Zack Brown 12 Ian Travis respondence sent, for example, letters, email,
faxes, photographs, articles, drawings, are sup-
Layout
Bruce Byfield 6, 22, 32, 42, 54 plied for publication or license to third parties on
Dena Friesen, Lori White
a non-exclusive worldwide basis by Linux New
Joe Casad 3 Cover Design
Media USA, LLC, unless otherwise stated in writing.
Dena Friesen
Mark Crutch 71 Linux is a trademark of Linus Torvalds.
Cover Image
Hans-Georg Eßer 73 © neyro2008 and Uladzimir haikou, 123RF.com All brand or product names are trademarks
Advertising of their respective owners. Contact us if we
Daniel Etzold 16 haven’t credited your copyright; we will always
Brian Osborn, [email protected]
Jon “maddog” Hall 72 phone +49 8093 7679420 correct any oversight.
Marketing Communications Printed in Nuremberg, Germany by Zeitfracht GmbH.
Swen Hopfe 58
Gwen Clark, [email protected] Distributed by Seymour Distribution Ltd, United
Rubén Llorente 62 Linux New Media USA, LLC Kingdom
4840 Bob Billings Parkway, Ste 104
Vincent Mealing 71 Lawrence, KS 66049 USA Represented in Europe and other territories by:
Sparkhaus Media GmbH, Bialasstr. 1a, 85625
Pete Metcalfe 34 Publisher
Glonn, Germany.
Brian Osborn
Graham Morrison 84 Published monthly as Linux Magazine (Print
Customer Service / Subscription
ISSN: 1471-5678, Online ISSN: 2833-3950) by
Thomas Reuß 28 For USA and Canada:
Linux New Media USA, LLC, 4840 Bob Billings
Email: [email protected]
Mike Schilli 44 Phone: 1-866-247-2802 Parkway, Ste 104, Lawrence, KS 66049, USA. Pe-
(Toll Free from the US and Canada) riodicals Postage paid at Lawrence, KS and addi-
Ferdinand Thommes 24, 50 tional mailing offices. Ride-Along Enclosed.
For all other countries: POSTMASTER: Please send address changes to
Daniel Tibi 40, 90 Email: [email protected] Linux Magazine, 4840 Bob Billings Parkway, Ste
Jack Wallen 8 www.linux-magazine.com 104, Lawrence, KS 66049, USA.
On Sale Date
Please note: On sale dates are
approximate and may be delayed
Issue 269 / April 2023 because of logistical issues.
The Fediverse
Social media corporations are in the news – why should a
few private companies have so much power? According to
proponents of the Fediverse, they shouldn’t. Next month,
you’ll learn about this thriving offshoot of the free software
movement and some of the leading Fediverse tools that
are bringing social media back to the people.
Preview Newsletter
The Linux Magazine Preview is a monthly email
newsletter that gives you a sneak peek at the next
issue, including links to articles posted online.