2019-05-01 Linux Format

You might also like

You are on page 1of 100

9000 9001

DISK CLONE PHOTO TOOLS

FR W INU
DO LI L
E N X
KA
The fastest ways to Store, search and edit your

E
4. OA201
backup and deploy photos with open source

7G D 9
L
PLUS!

B
3 Pi PROJECTS
SERIAL CONTROL
GET ANIMATING
USE EASYGUI

The #1 open source mag

VOICE CONTROLLED
SMART HOME
Use Linux to add true smarts to your
home with security and open protocols

pages of
65 tutorials
& features
Make Arch as easy
Omoju Miller to use as Ubuntu
on how GitHub is using
Get perfect Steam
machine learning gaming with the Pi
SOUNDS FUN VECTOR DRAWING
Better Audacity Create better, scalable
audio editing diagrams with LibreOffice
WELCOME

Win a secure Nitrokey Storage 2


Send your thoughts to the Linux Format dungeon server at
linuxformat@futurenet.com and secure your chance to
win a 32GB Nitrokey! It’s the complete open hardware-
encrypted storage solution!

WHO WE ARE
Learn more at www.nitrokey.com.

This issue We’re looking at building a open

Control everything!
source smart home, so what’s the
smartest thing in your life right now?

Sat up here in our ivory Linux Format


Tower, it’s easy to pour scorn on those
Jonni Bidwell lesser non-Linux-using types, hopelessly
More and more I find myself focusing on the switching their lights on and off with
not-so-smart things, so this is a really tricky their phones, asking little round
question. I dunno though, Vernier calipers speakers what the weather is like
are pretty smart. Oh, and the people that do outside their windows and checking if
the Royal Institution lectures. their milk has gone off by looking at their
smart-fridge display.
But why shouldn’t someone be able
Christian Crawley to remote-control their lights, control
Sorting out the kids’ dance lessons, telling their heating or ask a system what the
me where I need to be (and where to go) weather is in complete digital safety?
while working to resolve the concerns of We’re exploring how open source can solve the IoT problem by combining
residents as a local Councillor, the smartest the Mycroft and OpenHAB projects to create a smart, secure voice-
thing in my life is without doubt my wife, Ceri. controlled open source home. Heck, it even ties into Google Home and
Alexa, if that’s your thing.
But digital Luddites of the world fret not, if having a smart home isn’t for
John Knight you, we’ve got a healthy pile of smart things to do with your install of desktop
I don’t have any ‘smart’ gadgets at home, Linux. These range from the Roundup of disk cloning tools, so you can do
but I have ideas for an off-grid cabin powered smarter backups and deployments of systems, to our very own Jonni
by renewables. A collection of Raspberry Pis attempting to annoy the Arch Linux community by explaining how to turn it
would be excellent for regulating power and into Ubuntu. Some may say that’s not very smart at all.
lighting, and their low-power consumption For projects and tutorials we have more good news, from getting started
would be perfect for computer usage without draining watts. in making music with Audacity, organising your photos in Shotwell, drawing
useful diagrams with vectors and streaming games with Steam, to creating
stop-motion animations with a Pi, exploring the new Webassembly language
Les Pounder and troubleshooting serial connections. There’s something for everyone
The smartest thing in our home is Dexter who likes to tinker with computers, so enjoy!
the dog. However, he has started to become
unresponsive to voice commands. The only
recognised commands are “walkies” and
“dinner.” Previously working commands
“b th time
bath ti ” andd “vets”
“ are no longer starting the correct
processes. The error log is full of “woof” and “bark.”

Mayank Sharma Neil Mohr Editor


The voice recognition in my car is not
smart, it’s evil. It’ll change tracks and dial
neil.mohr@futurenet.com
Subscribe
numbers correctly, as long as it isn’t me
talking. When it hears me, it’ll always dial
& save!
relatives I don’t want to talk to – even
when all I want it to do is change tracks.
n digital and print
– see p26

www.techradar.com/pro/linux May 2019 LXF249 3


Contents
NEW GIFT
SUBSCRIBE NOW!
Page 26

REVIEWS
VOICE CONTROLLED

SMART
Happy Hacking Keyboard Pro2 19
Neil Mohr is certainly no hacker, but he
does have to type an awful lot. As much as
he likes the idea of an optimised compact
keyboard, is this thing worth it?

HOME
Slax 9.8 20
Once the apple of Mayank Sharma’s eye,
can the back-from-dead slimline distro
manage to retain its charm despite all the
changes and updates?

Refracta 9.0 21
A Devuan-based distro doesn’t particularly
excite Mayank Sharma, but this one
comes with a bunch of interesting
tweaks and custom scripts.

Linux Kodachi 6.0 23 The future is finally here! Jonni Bidwell


Distros with grandiose claims don’t really explains how to set up the ultimate open source
impress Mayank Sharma, but he’s in for
a surprise with this Xubuntu-based privacy voice-controlled home with Mycroft… page 34
protecting distro…

Dusk 24
Management are nervous again, as Ian
Birnbaum appears to be ignoring their
ROUNDUP INTERVIEW
memo not to go in the ruins in this retro
first person shooter.

Disk cloning tools 28 Human computing 42


Need to provision a lab full of PCs? The Never one to turn down talking about high-
ever lethargic Shashank Sharma tests powered programming over biscuits and
the best tools to get the job done without coffee, Jonni Bidwell meets the
breaking into a sweat. multitalented Omoju Miller.

4 LXF249 May 2019 www.linuxformat.com


contents

on youR
RaspbeRRy pi useR fRee dvd
Kali Linux 2019.01
64- & 32-bit
Raspberry Pi news 50
Quantum computing on the Pi, power Page 96
issues and running x86 programs.

Raspberry Pi Compute Module 3+ 51


Les Pounder wonders what makers can do
with this much power?

Using EasyGUI 52
CREDIT: IBM
Les Pounder shows us how to use Python
to search Google to gain inspiration for our
next maker project.
tutoRials

Stop-motion studio 54 teRminal: FFF 60


Christian Cawley plays with some Lego Not all file managers look the same, as
and a Pi camera to make a movie – Shashank Sharma discovered while using
although it’s not quite that simple… FFF – a Bash-based file manager.

Debug serial comms 58 shotwell: Build a photo library 62


Sean Conway walks you through the Nick Peers reveals how to bring order to
process of troubleshooting communication your chaotic photo and video library with
problems between a PC and a serial device. Ubuntu’s default photo organiser.

audacity: Audio editing 68


coding academy John Knight returns to his old recording
friend Audacity once again, and finds things
have become a little more advanced.
Check your Git repos 90
John Schwartzman shows you how to apache: Secure and static sites 72
write a Bash shell script that can keep Stuart Burns shows how to create a
track of all of your Git repositories. secure web server on which you can host
statically generated WordPress sites on
Webassembly and Rust 92 a secure Apache server.
Mihalis Tsoukalos looks at the next-gen
web language WebAssembly, how to dRaw: Vector illustrations 76
develop apps for it in Rust and Go, and how Create technical and business diagrams
to use them with the help of JavaScript. and illustrations without paint packages,
as Mike Bedford demonstrates.

steam: Game streaming 80


RegulaRs at a glance Push your Linux gaming to your big TV for
real gaming fun, with the help of Alex Cox
and Steam In-Home Streaming.
News 6 Subscriptions 26
Google offers the bad news that CPU
Spectre bugs will never be fixed in software, Back issues 66
in-depth
FireFox Send service, Pure OS movements
and no more web Skype for Chrome OS. Overseas subs 67 Turn Arch into Ubuntu 46
Jonni Bidwell has spent years perfecting
Linux user groups 11 HotPicks 83 his Arch install, and he’s begrudgingly going
Les Pounder explains exactly what goes on Alexander Tolstoy would never even to share some insights that make it as easy
in Linux Presentation Days. imagine posting anything negative online as Ubuntu to use…
about any glorious government – he’s far
Mailserver 12 too busy critiquing and testing only the
Too much praise – we’ve gone red, scarily best in free and open source software like:
clever solutions, hacking RC cars, and Digikam, Olive, Cygwin, LibreOffice, ODrive,
we’re going to cover firewalls again. Quaternion, Klogg, Hyperfine, Friture,
Underrun, Sandspiel.
Answers 14
Minolta printer drivers, best scanning Your free DVD 96
solutions, Mint won’t shutdown, using ZFS,
and Peppermint upgrades. Next month 98

www.techradar.com/pro/linux May 2019 LXF249 5


Newsdesk
ThiS iSSUE: Google has a meltdown Nginx is worth a lot
PureOS converges Firefox Send Skype issues EU router rules

Hardware security

Can Meltdown and Spectre


bugs ever be fixed?
The ramifications of Meltdown and Spectre continue, with Google
suggesting that there will never be a software-based fix.
ore than a year ago, the Meltdown and In fact, looking at Phoronix’s

M Spectre bugs were revealed to affect


some of the most widely used
benchmark results, there’s a clear
dip in performance starting from
processors in the world – and throughout 2018 Linux 4.15, with another large dip
and even into this year, new variants and threats between Linux 4.20 and Linux 5.0.
based on the bugs have continued to be found. As Phoronix points out, the

Image credit: TechRadar


The vulnerabilities, which appear to be Spectre/Meltdown vulnerabilities
present in chips from nearly every were made public around the
manufacturer, enable potential malicious users time of Linux 4.14, and in-kernel
to access protected data on a victim’s device, mitigations such as PTI and
and exploit speculative execution and caching Retpolines were added – which
features of a CPU. While there have not been supports many people’s fears that if
spectre will be plaguing processors for
any known attacks using these vulnerabilities, to be protected against Spectre/Meltdown,
the near future, according to Google.
their existence has caused shockwaves we’re going to have to live with the performance
throughout the technology world – and beyond implications that come with software patches.
– due to the prevalence of the vulnerabilities. Google has been even more pessimistic,
Since the revelations about the bugs were
disclosed, a number of manufacturers moved
quickly to release patches to mitigate the
Meltdown and Spectre affectS
problem. However, these software fixes aren’t
ideal, mainly because Meltdown and Spectre
featureS of the cpu which are
affects features of the CPU which are designed deSigned to iMprove perforMance
to improve performance, and applying the
patches results in a noticeable degradation. recently releasing an analysis of Spectre
At the end of February 2019, open source which comes to the conclusion that Spectre-like
hardware experts at Phoronix noted that Linux vulnerabilities will never be fully eradicated by
5.0 kernel performance was worse than software patches. In fact, Spectre could
previous kernel releases (read the full article continue to impact processors for the
at http://bit.ly/LXFPhoronixLinux5). This foreseeable future, while software-based
is a worrying trend, as kernel updates should mitigations will have an even greater impact on
improve performance, and some readers performance. Read the entire paper at http://
pointed out that this performance loss bit.ly/LXFGoogleSpectre. For the moment at
corresponds with Meltdown and Spectre least, it looks like we’re going to have to accept
mitigations being included in Linux 5.0. performance hits as a price to pay for security.

6 LXF249 May 2019 www.linuxformat.com


NEWSDESK

WEB SERVERS OPINION

Nginx acquired, rumours abound SHARP


Web server developer Nginx bought by F5 Networks in what OPENXR
some people suggest is a move against Citrix.
pplication services company to pass regulatory approvals. It’s expected the

A F5 Networks has acquired Nginx for


the princely sum of $670 million. Gus
deal will close in the second quarter of 2019.
The deal isn’t without its controversy, with
Robertson, CEO of Nginx, commented that “F5 Piper Jaffray analysts James Fish and Andrew
shares our mission, vision, and values… they Nowinski suggesting it was made to ensure that Jakob Bornecrantz
bring to bear a tremendous amount of additional F5’s rival Citrix does not acquire Nginx for itself. Senior Software Engineer,
resources and complementary technologies”, As Mitch Wagner of the Light Reading website Collabora
and assured Nginx customers that “F5 is reports (http://bit.ly/LXFLightReading), the
committed to keeping the NGINX brand and analysts also suggested that Nginx was taking
open source technology alive. Without this customers from F5, prompting the acquisition Just a few weeks ago
commitment, the deal wouldn’t have happened as a defensive move. at the Game Developers
for either side.” You can read his full statement However, this is something F5 denies, with Conference (GDC) in San
at http://bit.ly/LXFNginxBlog. Kara Sprague, SVP & GM of the F5’s Application Francisco, the Khronos
Any fears that F5 Network’s purchase will Services Business Unit, emailing Light Reading Group released the OpenXR
simply assimilate Nginx seem to be unfounded, to say that “Our acquisition of NGINX was provisional specification.
with the Nginx brand remaining a separate neither a defensive move nor due to a And that same day,
entity. Robertson will join F5’s senior dependency on NGINX for our next-generation Collabora announced
management team and continue to lead Nginx software ADC.” Monado, a free and open
alongside Igor Sysoev and Maxim Konovalov, source XR platform, and first
Nginx’s founders, while Nginx’s operations will OpenXR runtime for Linux.
continue at its existing offices in San Francisco. OpenXR is an open
It’s not quite a done deal just yet, however, standard that aims to unify
as although the board of directors of both and simplify the creation of
companies have approved the acquisition, as Networks has paid big bucks for Nginx, but its motives have experiences in augmented
have Nginx’s shareholders, the deal still needs been questioned. reality (AR) and virtual
reality (VR), collectively
known as mixed reality (XR).
Monado enables
OPERATING SYSTEMS applications and game
developers to target GNU/
Linux without having to

PureOS embraces convergence worry about hardware


enablement. Monado also
helps the hardware
The OS will run on Librem 5 phones and Librem laptops. developers add support for
their devices on GNU/Linux.
urism, the team building the much- PureOS’s “future applications [will] run on both My hope is that Monado

P anticipated Librem 5 open-hardware


smartphone, has announced that its
the Librem 5 phone and Librem laptops, from
the same PureOS release.”
becomes an ecosystem
composed of key XR
open-source operating system PureOS will be The idea is that all the apps you use on industry players and
a ‘convergent operating system’ that can run your Librem 5 phone will be able to run on a enthusiasts in the open
on both the smartphone and laptops. compatible laptop as well – with all your data source community.
A few years ago, convergent operating being synced. Not only does this offer benefits Going forward, my goal is
systems like these seemed to be all the rage. to its users, who will get a familiar experience to create a monthly update
While some software makers have dropped across their devices, but it also makes life easier about our progress on
their convergence plans – most noticeably for developers, who need only make – and test Monado. We have a solid
Canonical ditching its plans for a single – one app, rather than lots of different ones for roadmap ahead of us with
version of Ubuntu to run on PCs, phones and different operating systems. no shortage of work.
tablets, back in 2017 – Microsoft, Apple and Of course, that last point mainly relies on how The Monado project is
Google are all continuing to look at ways to popular PureOS – and the Librem hardware it hosted by freedesktop at
have one OS on many devices. runs on – becomes. From what we’ve seen so https://monado.
According to Jeremiah Foster, Director far regarding the Librem 5, we’re hoping for big freedesktop.org where
of PureOS, Purism has beaten its big things, but predicting successes in the world of you will find the source
competitors to the punch. In his blog post at technology is notoriously difficult, so ultimately code and instructions
http://bit.ly/LXFPureOSConv, he says only time will tell. on how to build it.

www.techradar.com/pro/linux May 2019 LXF249 7


Newsdesk

opinion encryption

event Mozilla launches


hOrizOn

Image credit: Mozilla


Firefox Send
New feature offers encrypted file
transfers between users. firefox send is a new secure way to transfer
files up to 2.5Gb in size.

irefox has announced that one of its impressive list of features, enabling you to
Keith Edmunds
is Tiger Computing Ltd’s MD,
f most popular Test Pilot experiments,
Firefox Send, is getting an official
specify when the link to the file expires, how
many downloads of the files are allowed, and
which provides support for launch. Firefox Send (https://send.firefox. whether or not to add an additional password
businesses using Linux. com) enables people to quickly and easily send for extra security.
files with end-to-end encryption. You can drag The people to whom you send the link
and drop files onto the web page and a link is simply need to click it to download the file –
The standard IT created that automatically expires, so nothing there’s no need for them to have a Firefox
support model of yesteryear is kept online permanently. account set up. A beta Android app is also
was ‘wait until it breaks’. The service is free to use, and if you sign in launching imminently. You can find out more
Support departments were you can send files up to 2.5GB in size. It has an at: http://bit.ly/LXFFirefoxSend.
event-driven, where an
event was a user calling
them to report a problem.
Today, we should
software routers
distinguish between user
support – helping someone
to use IT effectively – and
system support, where we
Skype for Web EU proposal
keep things running. The
events that drive system
support should come from
loses its shine could kill off
a monitoring system, not
the users. Why? There are
three reasons.
Latest version of the
VoIP software loses custom firmware
Firstly, waiting for Linux and ChromeOS. EU Directive would outlaw
systems to break implies
an impact to the business icrosoft has been making some
installation of user firmware.
before you fix anything.
That’s not acceptable.
M welcome and well-received overtures to
the open source community lately, but he EU Radio Equipment Directive
Secondly, your users won’t
tell you that the MySQL
when announcing the latest version of Skype for
Web, among a number of new features Microsoft
t (which can be read at http://bit.ly/
LXFEURadio) has an inclusion that
replication is five hours let slip that its browser-based version of Skype has worried many people, at this early stage.
behind the master, or that will no longer officially support ChromeOS or It requires manufacturers of routers, and other
the second disk in a RAID Linux. Users of those operating systems who try devices sending and receiving radio signals, to
set has failed. You’ll only to use the new Skype for Web will now be faced place a block on allowing customers to install
find out when more things with an error message saying that their device is software that has not be certified by the
break, and you’ll almost not supported–though some users are reporting original manufacturer.
certainly have lost data. success with Chrome browser or changing the This effectively means any third-party
That’s not acceptable. user agent to Windows on ChromeOS. Thus if developed router firmware such as the Linux-
Thirdly, it’s your job to be you’re a Skype user on Linux or ChromeOS, based OpenWrt (https://openwrt.org), which
aware of what’s happing, to you’ll need to use the native app instead. offers additional features and greater control,
work proactively to keep could no longer be installed. Worryingly, this
things working. won’t just be limited to preventing custom OS
Proactive support installations on routers, but potentially any other
improves system availability devices such as GPS, smartphones and more.
and data integrity. It’s how The FSFE published a Joint Statement against
we do things these days. If skype for web Radio Lockdown which has been signed by
your users have to report is no longer many organisations and businesses concerned
available
server problems to you, you about this. You can read the full statement here:
on certain
have already failed. https://fsfe.org/activities/radiodirective/
platforms…
statement.en.html
Image credit: Microsoft

8 LXF249 May 2019 www.linuxformat.com


NEWSDESK

Distro watch
OPINION

WA-HEY,
What’s behind the free software sofa? WAYLAND
SWAY 1.0
The first stable release of Sway, a “consistent, flexible,
and powerful desktop environment for Linux and
FreeBSD” as creator Drew DeVault calls it, has been
released. In a refreshingly honest release
announcement (http://bit.ly/LXFSway1), DeVault Jonni Bidwell
explains how “nearly 300 people worked together, wants only the best for you.
writing over 9,000 commits and almost 100,000 lines
of code” for this release, which has been completely So GNOME 3.32
overhauled for a much better experience compared to came out, and to
Sway 0.15, which was, by DeVault’s admission, a celebrate I finally switched
“buggy, frustrating desktop to use.” Download it from: over to Wayland. Of course,
http://bit.ly/LXFSway1Download. Sway 1.0 is a new desktop for Linux it wasn’t all smooth sailing.
and FreeBSD. As is well documented, I am
fond of Guake, the drop
down terminal.
REACTOS 0.4.11 Unfortunately Wayland has
A new version of the open source operating system no truck with programs that
that enables you to run Windows applications has been want to grab keystrokes
released. As the release statement notes (http://bit. without focus, so its handy
ly/LXFReactOS), this new version brings substantial F12 hotkey didn’t work.
improvements to the kernel that improves Since I spend most of my
performance and addresses a number of issues. time writing in LibreOffice
A compatibility issue with PCs running Intel’s Skylake (we both know that’s not
(or later) processors has been addressed, so it can true – Ed), pressing this
now run on more modern hardware, and Win32 ReactOS 0.4.11 is an open source key resulted in the current
improvements have been included as well. re-implementation of Windows NT. paragraph becoming the
first item in a list.
Frustrating, but of course
this is expected behaviour;
ROSA R11 it’s just that under X, that
ROSA Desktop is a Linux distro that was once a fork of F12 keystroke could be
Mandriva Linux, and the latest version comes in four intercepted to prevent
desktop flavours: KDE 4, KDE Plasma, LXDE and Xfce. this unwanted listifying.
In this latest release, the Linux kernel has been The future of tech
updated to 4.15, and there’s added support for journalism may well sadly
installing the distro on devices with fast M.2 and be listicles, SEO-friendly
NVME solid state drives. If your Russian is any good, headlines and simplification
you can read up on the release announcement at: ROSA is a Russian distro with a choice beyond recognition. But
http://bit.ly/LXFROSA11. of desktops. such bilge and bunkum will
never grace these pages.
Instead have a handy two-
ANTIX 17.4 sentence guide to getting
This distro based on Debian’s current ‘Stable’ branch Guake working in Wayland.
has had an important update that is now available to Disable the F12 shortcut in
download. antiX 17.4, ‘Helen Keller’, comes with an LibreOffice. Go to GNOME’s
updated kernel which has been patched to mitigate Keyboard Settings and bind
against Meltdown, Spectre and CVE-2019-8912 F12 to the command
vulnerabilities. All packages have been updated to guake -t . The second
Debian 9.8, and there are improvements to the argument toggles visibility,
localisation of applications plus improved icons and so will do the desired thing
themes. Find out more at http://bit.ly/LXFantiX174. whether the terminal is up
antiX 17.4 brings some important security or down. Done and the flat
updates to the distro. Earth disc keeps on
spinning.

www.techradar.com/pro/linux May 2019 LXF249 9


Newsdesk

Kernel Watch
opinion

just
emulate it
Jon Masters summarises the latest happenings in the
Linux kernel community, for your reading pleasure.
inus Torvalds announced Linux 5.0, represents a translated view in which regions
L and with it the opening of the merge
window (period of time during which
of memory may appear large and contiguous
to software, but in fact are mapped using
Jon Masters is a kernel hacker disruptive changes are allowed ahead of 5.1). OS-managed ‘page tables’ into many different
who’s been involved with Linux for In his announcement, he detailed a few last- physical locations by hardware. The translation
more than 22 years, and works on minute fixes, and that he was happy overall is fine for most purposes, and in fact is critical to
energy-efficient ARM servers. with having extended the 5.0 cycle by a week, our ability to write modern applications. But
following the atypical 5.0-RC8. The new kernel there are times when contiguous virtual memory
includes many new features, among them the is not enough.
I’ve lately been Energy Aware Scheduler covered in last issue. Sometimes, hardware needs truly contiguous
playing a lot with different It also gains support in the AMD GPU regions of physical memory. This can be
computer architectures that drivers for FreeSync, a technology popular because the hardware is less complex – for
interest me. An architecture with gamers that smooths the display by example, with embedded devices that are not
describes the kind of aligning the transition of the frame displayed capable of ‘scatter gather’ memory operations
fundamental instructions with the vertical blanking interval of the when moving data around. But it can also be
that are understood by a desirable for performance on much
family of computers; for
example ‘x86’ for Intel and “physical memory quickly bigger machines. When a
sufficiently large region of
AMD, ‘arm’ and ‘riscv’. For
example, nearly everyone
begins to fragment as it contiguous physical memory exists,
a so-called ‘huge’ page mapping
reading this has an x86 is allocated and freed” can be created to represent the
laptop computer, and virtual-to-physical translation of a
maybe an Arm-based display. A complete summary of what’s new large region using fewer entries in page tables,
Raspberry Pi or three for in 5.0 is provided (as usual) by KernelNewbies and the hardware structures that cache these.
various projects. at https://kernelnewbies.org/Linux_5.0. The problem is that when a system is
But for other kinds of running, physical memory quickly begins to
computer, it’s much harder Physically contiguous memory fragment as it is allocated and freed, so
to get one at home. In some Linux generally deals with two different views eventually it can become difficult to find large
cases, this is due to cost. of memory: physical and virtual. Physical regions of contiguous physical memory. Zi Yan’s
Few people have the space, memory describes the actual chips within the “Generating physically contiguous memory after
power budget or building machine (that is, the DRAM), and is usually page allocation” pages aim to help by effectively
structural support, let alone quite limited compared to secondary storage defragmenting physical memory to free up large
the money, for a personal such as a disk or NVMe. Virtual memory chunks of it.
mainframe. In other cases,
scarcity is a factor. Older
computers are hard to come ongoing DeveLopment
by, some are so new that
they haven’t been made yet. David Howells posted a Request For Filesystem and Memory Management
The latter case includes Comment patch series titled “Containers Summit about the preferred tests that
new designs that are coming and using authenticated filesystems”, should be run against patches destined for
but are not on the market intended to start a conversation about -stable kernels.
just yet. In almost all of containerising the kernel’s support for Stable kernels are those released by
these cases, there are crypto keys that it can manage on behalf of Greg Kroah-Hartman and based upon
readily available emulators filesystems and other subsystems. The existing Linus kernels with various fixes and
that let you test drive just as patches introduced a new, explicit notion of backports, intended for those who want to
easily as running a virtual a container in kernelspace, which has not run an upstream kernel but need some
machine on your desktop. previously been the case. level of maintainance.
A good example is the These ideas were rejected for a variety Greg noted that various tests against
RISC-V QEMU port and of reasons, but they may just start a new stable probably exceeded those for
associated tools, which you dialogue about in-kernel container mainline releases, while others piled
can get hold of at https:// representation. Sasha Levin proposed a on with input around the different tests
github.com/riscv/riscv- discussion at the upcoming Linux Storage that could be run.
qemu/wiki.

10 LXF249 May 2019 www.linuxformat.com


LUGS

Linux user grouPs


The intrepid Les Pounder brings you the latest community and LUG news.

FinD anD join a Lug Linux Presentation Day


Build Brighton Thursday evening is open night. It’s a bit like a school open day…
www.buildbrighton.com
Cornwall Tech Jam Second Saturday of the hances are that you Prince Street Social in central Bristol.
month, alternating between Bodmin and Camborne.
www.cornwalltechjam.uk C discovered Linux many years
ago and since that day you
That’s the Prince Street Social, 37-41
Prince Street, Bristol, BS1 4PS.”
Glasgow Makers and Hardware Hackers have enjoyed the fruits of what was There is still time to join, tell your
Mitchell Library, Glasgow. https://m.facebook.com/ initially a laboured introduction. friends or organise your own day – all
groups/115303729096198 Moving from Windows to Linux you need to do is pop over to http://
Huddersfield Raspberry Jam introduces a new way of thinking and int.linux-presentation-day.org and
Meet every month at Huddersfield Library, working – software from a central follow the link for your country. If you
typically on the fourth Saturday of each month. repository versus a random EXE run a LUG, hack- or maker-space then
https://huddersfieldraspberryjam.co.uk download being the first hurdle. throw open your doors to the public,
Horsham Raspberry Jam Parkside, Chart Way, But what if you’re new to Linux? show them how wonderful Linux is
Horsham. www.facebook.com/hackhorsham Well, on Linux Presentation Day you and how it can be used from everyday
Leeds Hackspace Open night every Tuesday can meet like-minded individuals (how internet browsing to controlling laser
7pm-late, open day second Saturday of the month, do you know what I’m thinking?–Ed) cutters and CNC machinery.
11am-4pm. www.leedshackspace.org.uk who want to help everyone to enjoy If you’re in the Bristol area, head
Medway Makers 12 Dunlin Drive, St Mary’s Island, using Linux. Originally begun in over to their event and say hello to
Chatham ME2 3JE. www.medwaymakers.com Germany in 2015, Linux Presentation Sebastian and the team. See more at
New Jersey Linux User’s Group Day takes place twice per year in www.linux-presentation-day.org.uk.
Last Tuesday of every month, at Panara Bread, locations across Europe. The events
165 Route 4 West, Paramus, NJ. http://njlnux.org are free of charge and are a way to
PLUG – Perth Linux Users’ Group introduce Linux to the public via
Once a month, at Spacecubed, 45 Saint Georges installfests, lessons and social events.
Terrace, Perth, Western Australia. The main goal of the project is to help
www.plug.org.au visitors decide on whether Linux is the
rLab Reading Hackspace Unit C1, Weldale ST, correct option for their future.
Reading, Wednesday from 7pm. http://rlab.org.uk The team from Bristol’s Linux
Teesside Hackspace Tuesday Evenings at Presentation Day have been in contact
Teesside Hackspace. www.teessidehackspace.org.uk to let us know about their event.
The Things Network Reading Sebastian tells us: “It will be Sunday 19
Walkabout Bar, Reading, 2nd Tues 7pm. ttnreading.org May – yes Sunday, not Saturday – “and then you just click there.
between 2pm and 7pm at the no, not there, there. there!”

Community events news


family for a fun day out and learn a new including our own Les Pounder. The
skill. We’ve been to previous years and event is open and accessible to all,
this is a great venue. so spend the day including those outside of the
there! Tickets and details can be found community. More details at:
via: www.scienceandindustrymuseum. https://mixitconf.org/en.
org.uk/take-part-makefest-2019.
Preston rasPberry JaM
MIXIt The person responsible for starting the
Manchester Makefest 2019 Taking place on 23-24 May in the French whole Raspberry Jam community, Alan
Taking place on Saturday 25 and Sunday city of Lyon, this event is truly a mix. O’Donohoe, has run a successful Jam
26 May at Manchester’s Science and There are talks and workshops covering every month since 2012! Sadly, due to
Industry Museum, this two-day event Ethics, Makers, Design and Lifestyle from other commitments the April and May
celebrates the various groups and skills the world of technology. The whole ethos 2019 Jams have been cancelled, but
in the maker community. From Arduino of the event is to “discover new things we’re promised that the Jam will return in
to artisan crafts, this weekend is packed and meet nice people.” This is clear to June: www.eventbrite.co.uk/d/united-
with lots to see and do. You can take the see thanks to a great lineup of speakers, kingdom--preston/raspberry-jam/

www.techradar.com/pro/linux May 2019 LXF249 11


Mailserver
Write to us at Linux Format, Future Publishing, Quay House,
The Ambury, Bath BA1 1UA or lxf.letters@futurenet.com.

BIG words
I enjoy every issue immensely as it only brings me
further down the rabbit hole of this amazing universe
we call Open Source and all things Linux.
I’m looking to your wise and written ways to see
what discoveries you have made or found in the HCI
(Hyper Converged Infrastructure) landscape. I have
seen some details on a Proxmox + Ceph HCI solution,
but not as modular as Nutanix. I work with
a company here in Canada and we are a leading
provider of Nutanix, that has Linux underpinnings
and while mighty, it is costly. Would anyone like to
Is there any interest in hosted Directoy-aaS for explain Hyper Converged
cloud services? One may leverage a ClearOS or Infrastructure to us?
Zentyal SMB server, companies could join a local
on-premise infrastructure with cloud services like Neil says
Google Apps and maintain a single sign-on service Wow – you’ve used all the words, and I even recognise
through DaaS. Have you tried this yourself? some of them! Most of this is way over our heads,
David, Canada though it’s the sort of thing we leave to the genius of
Valentine to cover in his intermittent Administeria
section. I tend to aim contents at the sort of thing most
home users could have a play with over a weekend –
WIN A SECURE NITROKEY STORAGE 2 unfortunately, deploying a business-wide, single sign-on
cloud solution is slightly above that, but we enjoy
Send your thoughts to the Linux Format dungeon learning about the possibilities.
server at linuxformat@futurenet.com,
be picked as Letter Of The Month and Too clever
win* a 32GB Nitrokey Storage 2! My home network has now grown to five PCs, all
The Nitrokey is worth a cool €149, has 32GB of running Mint Xfce. One sits in a corner recording
hardware-encrypted storage, supports hidden Freeview SD from six tuners and saving to hard disk.
volumes, secures your online accounts with one- For ages, I was then transferring these recordings
time passwords, can encrypt emails, files and hard using the ‘shoe-leather’ method of using a pair of
drives and is an open source, open hardware The Nitrokey is 32GB flash drives to copy them in batches onto the
solution. Protected with AES-256 and RSA keys up your one-stop playback PC on the other room.
to 4,096! Learn more at www.nitrokey.com. security solution. This worked fairly well, as I wrote scripts to do the
donkey work. The only problem I had was that the
Helpdex
shane_collinge@yahoo.com

* For full terms and conditions see: www.futureplc.com/terms-conditions

12 LXF249 May 2019 www.linuxformat.com


MAILSERVER

LETTER_OF_THE_MONTH
H
Getting RC with the Pi
My ongoing project is to take old RC cars
and replace the receiver/controller IC
with a Raspberry Pi. I have tried a
number of different solutions such as
WebIOPi and Wyliodrin, but Les
Pounder’s article on Flask in LXF229 gave me another solution
that I have got working and which I really like.
Head to libremusicproduction.com for Another aspect is to untether the car from the access point,
some awesome music guides.
and I wonder if Les could do an article on setting up a peer-to-
peer ad-hoc network between an android tablet and a Raspberry
script would complete, but as we were watching TV Pi? [Peter found a solution at http://bit.ly/LXF249point].
any pop-up would be invisible behind the playback. For the benefit of other people who don’t like doing things the
I brainstormed several schemes but nothing simple easy way, I have discovered that each of the three scrap RC cars
did the trick. have a different receiver/control IC, but all the ICs have the same
Then one day I was tapping away in a terminal on pin-outs. I’m tempted to use an IC socket as the connector
my laptop while copying the latest LXFDVD to a flash between the Pi and the car. Also, it has been necessary to power
drive. When the copy finished, as I was already in a the Pi separately from the motors.
terminal, rather than fight trying to find the little You can see an early attempt at http://bit.ly/LXF249picar.
button on the DVD drive I just typed eject and the Peter Merchant C.Eng (Ret’d)
drive pinged open. A lightbulb went on over my head
(is the eject command supposed to do that? – Ed). Neil says
The Pi and
So a quick edit to the script and that was it – each This is why we love the
Linux enables
time the recordings were all copied and it was ready Raspberry Pi, as it enables crazy projects
for the next flash drive, the script would just eject people to deploy Linux in some to take off.
the DVD drive on the PC. Brilliant… what could pretty inventive ways alongside
possibly go wrong? creative solutions. Good luck
A few nights later we were sitting in the dark with your project, and if anyone
watching a scary film. The copy finished just as the else is implementing open
tense bit of the film built, the DVD drive shot open source in interesting ways,
with a loud click and the pair of us jumped a couple let us know!
of feet! This finally gave me the nudge I needed to
drill a hole through the wall and run an Ethernet
cable to the theatre PC. magazine but sometimes a little more info/examples
Dave would be nice. Thanks for your attention and
listening to my two cents.
Neil says Dean Hansen
We’re glad you’ve gone with the more sensible solution
of drilling holes in walls. Neil
I get your point, but as a Linux and open source
You’re firewalled magazine we’re going to cover all the topics that
There are lots of Raspberry Pi magazines and encompasses, and as the Raspberry Pi is very popular
information on projects out there. I could do without we’d be silly to ignore that. Giving it just eight per cent
your Pi User articles. I would prefer more info and of the magazine each issue doesn’t seem outrageous.
examples on your tutorials, especially on setting up But we are going to write about firewalls, as it turns out
firewalls, security apps and encryption. I like your Jonni is getting paranoid about IPv6. Again.

WRITE TO US
Do you have a
burning Linux-
related issue
that you want to
discuss? Write
to us at Linux
Format, Future
Publishing, Quay
House, The
Ambury, Bath,
BA1 1UA or email
lxf.letters@
futurenet.com.

www.techradar.com/pro/linux May 2019 LXF249 13


Answers
Got a burning question about open source or the kernel?
Whatever your level, email it to lxf.answers@futurenet.com
Neil
Bothwick
counts FOSS
problems
in his sleep.

Q Document
scanning workflow
by Linux should do the job. Check the list
of supported hardware at http://sane-
supports several other formats. The
software enables you to save various
After using Linux for technical work project.org and pick a device that suits profiles, covering resolution, size, colour
and development for a while, I’d like to your needs and budget. I have used a depth, single- or double-sided and more,
completely move all office-related tasks Brother (same here–Ed) laser printer and which means setting up for a particular
to Linux (Manjaro KDE) as well. scanner in the past and it worked well. Now type of document is as simple as pressing
Besides some minor issues with I use an HP all-in-one device that has the the scan button, selecting a profile and
printers, the main impediment is how to benefit of duplex scanning, without having pressing Go.
set up my document scanning workflow. to feed the pages in twice. There is also quite extensive post-
Currently I scan all incoming documents HP devices are supported by the hplip processing support. It can use unpaper to
in one go, manually ‘staple’ them into driver package. This is open source but clean up and de-skew scans, it can also
individual multipage PDF documents and the scanners need a binary firmware file apply OCR (optical character recognition)
store them to Evernote. too. Hplip’s setup utility takes care of software to the scanned image, and save
Could you recommend document downloading and installing this, but it is a text copy of a page as a hidden layer
scanner hardware and corresponding something of which you should be aware if behind the scanned image. Although this
software to manage the workflow and you have a strict policy on using only open layer is hidden, it’s searchable, so you have
store the documents? source software. multi-page scanned images that can be
Roland Stadler For software, I haven’t found searched for a particular word or phrase.
anything better than Gscan2PDF (http:// There is no option to save to Evernote,

A As far as hardware is concerned,


any scanner with an automatic
gscan2pdf.sourceforge.net). This will
scan a multi-page document and save
but if you use this service you probably
already have software to sync it with
document feeder (ADF) that is supported it as a single PDF file – although it also your desktop, like NixNote, so you can
simply save to a directory that is synced
with Evernote. If you are saving sensitive
MINOLTA PAGEPRO DRIVER material to a cloud service, you should
consider encryption. You can password-

Q Do you know if there is a Linux


driver for my Minolta QMS
Fedora, openSUSE and Manjaro are
among the distros that use RPM.
protect PDF files with pdftk and this could
be added as a post-processing hook in
PagePro 1200W laser printer? Your system may offer to Gscan2PDF, for example.
Anna Brand automatically install the package after
downloading, but usually it just saves it Eternal shutdown
A As with most things printer-
driver-related on Linux,
to your ~/Downloads folder. To install
it, open a terminal and change to your
I’m a happy user of Mint 19, but there are
a couple of things that intrigue/bother
the answer can be found on downloads folder by typing me in Cinnamon. When booting, it shows
openprinting.org, specifically $ cd Downloads a message like this for a few seconds:
www.openprinting.org/driver/ Type ls followed by Return to make [0.004000] doIRQ: 1.55 No irq handler for
min12xxw. This is a third-party driver sure the file is there, then install it with vector
for your printer, so don’t expect one of the following commands. [2.378397] Couldn’t get size:
support from the manufacturer. On the $ gdebi openprin2xxw 0x800000000000000e
plus side, this driver has been around $ rpm --install openprinting-min12xxw
for a good number of years and has The first command is for use with
been reported to work well. DEB files, the second for RPMs. Press
Download the relevant file for your Tab then Return after typing either
operating system: 32-bit or 64-bit one. Pressing Tab autocompletes the
according to your processor, DEB file name, so this will work for any
or RPM according to the package version or architecture, without having
manager used by your operating to type the full filename. Once
system. If you aren’t sure of the installed, there should be options for
package format, Debian and its several Minolta PagePro models when
derivatives, such as Ubuntu, Mint, you use your distro’s printer
Peppermint and others use DEB. configuration tool to add a new device. Gscan2PDF has plenty of options when it comes to
scanning and archiving documents.

14 LXF249 May 2019 www.linuxformat.com


Answers

Sometimes – apparently at random


– when quitting the system the shut-
down process is literally eternal. I get the
Mint logo with dots running and never
stopping. None of these problems arise
with Mint 19 Mate on the same machine.
Máximo Fraga

A Do the boot messages show up


before the Mint boot screen
appears? Such messages are usually
harmless, as long as they don’t halt the
booting process, and are probably not
linked to your shutdown problem. These
are kernel messages, and the kernel is a It’s not as pretty as a splash
screen, but the boot messages
general-purpose program intended to run from init tell you a lot more
on a wide variety of hardware. To do that it about what is happening when
needs to test for the existence of hardware you boot or shutdown.
features. A failure in any one of those tests
is not necessarily an error – they are
usually just informational or, at most, it. I have my OS (Ubuntu 18.10) on an Otherwise, you could use a bit of
warning messages. SSD with two 3TB drives (sdb and sdc) trickery to convert your RAID a drive at a
Systemd’s journal makes it easy to for data, that I tried to set up as a RAID1 time, but be aware that you will have no
find any real error message that occurred array using ZFS. redundancy during this process, so backup
during the boot process, with: I followed some instructions I found everything important. First you remove
$ sudo journalctl -b -p err online and installed the ZFS packages, one of the disks from the pool:
We use sudo to make sure the full system created a pool with zpool and then $ zpool detach poolname /dev/sdb
journal is read and not just your user’s. created a couple of filesystems with Then you create a new pool – but zpool
The -b option limits entries to those since zfs. All appeared to be well, but the doesn’t allow you to create a degraded
the last boot, and -p err shows only filesystems seem to be very slow. I may pool, so we use a bit of trickery. Use fdisk
entries with a priority of ‘error’ or higher. be spoiled by the speed of the SSD, but -l /dev/sdb (or whichever disk you just
Even this may show ‘errors’ that actually I’m sure these drives were a lot faster removed) to get its size in bytes, then
have no bearing on the smooth running of when using ext4. There are no errors in create a sparse file of exactly this size and
your computer, but you can while away a the journal, so what do you think could mount it as a loop device with
few hours by pasting them into a search be wrong? $ truncate -s SIZE /tmp/dummy.img
engine if you are curious. Eric Bartlett $ losetup /dev/loop4 /tmp/dummy.img
The shutdown problem is clearly Create a new pool using the disk you
more serious. The chances are that
the shutdown process has stalled at a
A This sounds like a problem with the
4K blocks used on larger drives.
removed and this file, then immediately
detach the loop file:
particular point, but you cannot see this Drives used to store data in blocks of 512 $ zpool create -o ashift=12 newpool mirror
because the splash screen is hiding the bytes, but as they got larger this wouldn’t /dev/sdb /dev/loop4
more informative, if less attractive, boot work – there were too many blocks to $ zpool detach newpool /dev/loop4
messages. If you hit Esc as soon as the manage. The manufacturers started using Now you can recreate your filesystems
shutdown splash screen appears, you 4K per block once drives reached 2TB in on the new pool and copy the data, either
should see the messages from Systemd size, but this confused software, resulting by creating each filesystem and then
(this also applies to other init systems) as it in dramatically reduced performance. This rsync-ing the data or by using zfs send /
shuts down your system. used to happen with traditional partitioning receive . Once the data is copied, you can
Once you can see where it stops, methods until tools like fdisk were updated destroy the original pool, add the drive to
you will either be able to work out the to deal with it. the new one and allow it to resilver. As this
solution yourself or have some concrete The good news for you is that there is a is not used for system storage, you can
information to plug into your favourite option to handle this. The bad news is that rename the pool to the old name with
search engine. One of the most common it must be set when creating the data pool, $ zpool export newpool
causes is when a mounted network so you will have to backup all your data, $ zpool import newpool oldname
filesystem is no longer available and the recreate the pool and filesystems and then
command to unmount it stalls.
Whatever you do, don’t hit the power
copy back the data. If you have suitable
storage for this, either an external drive or
Q More pepper than mint
I read with interest your reply to
switch or reset button when the system a network filesystem, the task is easy, if Ken Arntsen [lXF245] on upgrading his
hangs like this – you can cause more time-consuming. Back everything up and Linux Mint to the latest version without
problems for yourself. Use the SysReq create the new pool with: doing a fresh install, thus keeping his
keys, as described in the Quick Reference $ zpool create -o ashift=12 poolname configuration and programs. I’d like
box (page 16), to get a more clean reboot. pooltype devices to do the same with my Peppermint
The ashift switch does the magic installation. Is this possible, and if so, do

Q Zlow filesystem
I thought I would try out ZFS,
required to restore performance with 4K
disks. Then re-copy all your data back to
I just replace ‘mint’ with ‘peppermint’ in
the instructions you provided to him?
having heard so many good things about the hard disk. David Thompson

www.techradar.com/pro/linux May 2019 LXF249 15


Answers

A Unfortunately, the same is not


possible with Peppermint; its
developers have specifically chosen to not
provide an upgrade path, requiring a
reinstall for each new version.
That leaves you with two options: you
can stick with Peppermint 8, which is still
supported, and keep it updated for as
long as you use it, or you can backup and
reinstall instead.
Reinstalling is made easier if you have a
separate partition for /home. Peppermint
does not offer this option by default, but
you can do so by selecting the ‘Something Peppermint is not designed to be upgraded
else’ option on the ‘Installation type’ in-place, but the lack of a separate partition
for /home makes the task more difficult.
screen when installing. This will display
your existing partitions.
Leave swap as is, resize / to around $ sudo rsync /media/external/home/ limit for a single file, especially if you are
20GB – that’s more than enough for a /home/ using a FAT filesystem on the external
lightweight distro like Peppermint – and Note the slightly different syntax drive. So we pass the output through the
set up the remaining space as an ext4 – we’re not just reversing source and split command to break it up into 1GB
partition to be mounted at /home. destination. Note also that we use sudo , chunks. You can unpack the backup once
A distro installed like this will as we are backing up and restoring the you have installed the new OS like this:
operate exactly the same as the ‘all on whole of /home rather than an individual $ cat /media/external/backup.tar.* | sudo
one partition’ approach, but it makes user’s home directory. tar -x -C /
upgrades, or switching to a different If the external drive is formatted with Here we join the chunks together with
distros, easier as your personal files will a Windows filesystem, you cannot simply cat and pipe it to tar, which uses the -x
not be touched. mirror the files as this will remove file option to extract the archive, while the
Before you start the installer you ownerships and permissions – so we need -C / argument tells it to unpack to the root
need to copy everything important to an to use a backup program. You could use of the filesystem.
external drive or USB stick. You will need one of the graphical backup programs This will cover all of your personal files
one at least as large as the data in your such as DejaDup if you want something and settings. If you want to backup global
/home directory. more convenient, or you can use plain old settings and data, such as files in /etc or
If the external drive is formatted with a tar, like this: databases in /var/lib (you’ll know if you
Linux filesystem, such as ext4, you can use $ sudo tar -c /home | split --bytes=1G need these), just back them up to your
rsync to backup the /home directory: /media/external/backup.tar.aa /home directory before performing the
$ sudo rsync -a /home /media/external/ The -c option tells tar to create an above backup and restore commands,
where /media/external is the mount point archive: use -cv if you want to watch a list then restore them after booting into the
of your external drive. This gives a simple of the files being added scroll past. A tar new system.
mirror that you can restore afterwards archive will be the size of all the files in
with rsync: /home, which may well exceed the size get helP now!
We’d love to try and answer any questions
a quick reFerence to sysrq you send to lxf.answers@futurenet.com,
no matter what the level. We’ve all been
stuck before, so don’t be shy. However, we’re
L inux is usually stable enough to
survive misbehaving software,
shut down cleanly, writing any data to
disk and closing any open files. Next in only human (although many suspect Jonni
but it is possible for a program to lock line is I, which sends a KILL signal to all is a robot), so it’s important that you include
up the whole computer. Before you remaining processes, forcing them to as much information as you can. If
reach for the power or reset button shutdown. Pressing S tells the kernel to something works on one distro but not
and risk corrupting your filesystems, sync, flushing all buffers to disk so that another, then tell us. If you get an error
there is a better way to get out of it. remaining open files can be closed message, please tell us the exact message
You can send commands directly to cleanly. Then you press U to unmount and precisely what you did to invoke it.
the kernel by holding down the Alt all filesystems and remount them read- If you have, or suspect, a hardware
and SysReq (aka PrtScr) keys and only, to avoid further data corruption, problem, let us know about the hardware.
pressing certain letter keys. As the and finally B reboots the system. Consider installing hardinfo or lshw. These
kernel listens for these directly, they So hold Alt+SysReq and press R-E-I- programs list the hardware on your
work even if X is completely locked S-U-B in turn, leaving a couple of machine, so send us their output. If you’re
and accepting no input. seconds between each. There are unwilling, or unable, to install these, run the
The keys normally used to get out of several mnemonics to help remember following commands in a root terminal and
a lockup are R, to reset the keyboard – this, the most appropriate being Reboot send us the system.txt file too.
this occasionally fixes the problem on Even If System Utterly Broken. This is uname -a > system.txt
its own. Next press E to send a TERM not something you should need very lspci >> system.txt
signal to all processes, asking them to often, but it’s worth knowing. lspci -vv >> system.txt

16 LXF249 May 2019 www.linuxformat.com


The home of technology

techradar.com
DISCOVER THE ALTERNATIVE
TO APPLE AND WINDOWS
Take complete control of your computer by learning how to choose, control and
use a version of Linux that is tailored just for you

ON SALE
NOW

Ordering is easy. Go online at:


www.myfavouritemagazines.co.uk
Or get it from selected supermarkets & newsagents
reviews
Happy Hacking Keyboard
Professional 2
Neil Mohr is no hacker, but he does type a lot…

hen you’re sitting at a computer


in brieF
There’s an
W terminal for most of your day,
the primary input becomes
awful lot of really quite vital. So it didn’t come much
competition at of a surprise to discover Japanese PFU,
this end of the a part of Fujitsu, is targeting the hacking
market for both community with its ever-so Asian sounding
full-sized and Happy Hacking Keyboard Professional 2. That’s Can you see what’s
compact something of a mouthful for what is designed to be a on each key? No,
keyboards, diminutive, 60% portable keyboard for any self- we can’t either.
so anything proclaimed hacking type. In reality, it’s slightly annoying.
pushing Both myself and Jonni agree the key movement
premium and feel is lovely. This isn’t a Cherry-style mechanical
pricing is going keyboard; it uses Torpe rubber domes, which offer
to need to be a softer, less clicky action than the popular gaming
slick in every keyboards that abound. The sound and action is good
department. and offers fast (for us) typing speed. We also really
appreciated the textured finish of the keys, which felt
like it helped our fingers land on the keys. Less helpful
was the black print on black keys, but we guess that’s around the USB ports – two USB ports offer a low-
part of the charm. power hub. The seam around the edge seems
You might be aware of the standard keyboard sizes: unnecessary, and the whole thing feels light and cheap
full, tenkey-less and compact. The full 104-key includes like a budget keyboard. We find it odd there’s no
a number pad, tenkey-less does away with that number backlight; while we’re no fans of RGB lighting, a backlit
pad and compact describes anything smaller than that. keyboard is useful in the dark rooms we like to hide in.
The HHKB falls into that latter range and is also known When you look at the asking price, the sales pitch
as a 60% – while many compact keyboards include for the HHKB just falls on its face. Surely this is a £40
dedicated cursor keys, the HHKB does not. keyboard, not a £185 one? The price makes some sense
A ‘function’ key helps mitigate missing additional in regards to the high-end custom keyboard market,
keys such as the cursor keys, but we can’t help feel we’d where 60% keyboards, replaceable keycaps and £200
always prefer a set of the useful arrows to hand, prices are the norm – but we’re certainly not in that
perhaps just where that HHKB logo is planted. market and we’re not even sure this is really polished
It’s reassuring to see a genuine Super key rather enough to compete there.
than a Windows or Mac key. A panel at the rear of
keyboard hides a set of DIP switches – crudely
integrated behind a cheap-feeling clip – that enables
verDict
you to enable various options such as selecting Mac DevelopeR: PFU
mode and enabling the single Delete key to double Web: www.hhkeyboard.com
as a Backspace. pRice: £185
We consider the
finishing to be The build quality also leaves something to be
lacking on a desired, especially the DIP switch panel and the finish Features 7/10 ease oF use 7/10
£200 keyboard. PerFormance 8/10 value 5/10

If you have £200 to splash on a keyboard we’d suggest there


are better places to look – this simply lacks polish.

Rating 7/10

www.techradar.com/pro/linux May 2019 LXF249 19


Reviews Linux distribution

Slax 9.8
Once the apple of Mayank Sharma’s eye, can the back-from-dead
distro manage to retain its charm despite all the changes?
or a long time Slax was the
in brief
The once-
f de facto distribution for
bootable USB disks. Back
popular then, the lightweight distro was
miniscule based on Slackware, but was still
distribution relatively easy to customise.
designed for Then, as with many one-man
removable projects, it stopped receiving updates
devices such as and has been dormant for several
USB drives was years. Now in its second innings, the
dormant for distro has undergone a dramatic
several years, change with the move to Debian, yet
and came back retains all the features that made it
to life re-based stand out from the swathe of Live
on Debian’s USB distros.
Stable branch Slax is available for both 32-bit Slax doesn’t have traditional support options, but its custom scripts have enough documentation
(Stretch) and 64-bit machines and its ISO to make first-time users welcome.
instead of weighs in under 300MB. The distro
Slackware. is getting regular updates and is gradually taking on new /media/sdb2/custom.sb saves all changes into the
It still packs features, the majority of which are behind the scenes and custom.sb module inside the external storage. This
in a graphical focused on improving compatibility with modern module can then be put on the USB along with the other
desktop and hardware. For instance, the previous version improved modules, or can be used to generate a new Slax ISO.
a handful of compatibility with new USB devices, and shaved a Slax’s developer has written scripts to reduce this
essential apps, handful of megabytes from the ISO image by using 1MB process to a single command. On a related note, the only
but can be blocks to compress the SquashFS filesystem instead of new feature in the 9.8 release is the possibility to exclude
easily fleshed the previous 512K blocks. core Slax modules when rebuilding a new ISO.
out using Slax has a unique mechanism for installing onto a Slax also includes a PXE server that can again be
Debian’s USB disk. Instead of dd-ing the ISO to a USB stick, you activated with a single script. You can test this feature
package need to loopback-mount it and copy its contents to a in VirtualBox by attaching the NIC of the Slax VM to the
management ext4-formatted disk. Then run a script from inside the internal network. Once the PXE server is running, any
system. USB to make it bootable, and you’re good to go. other VM that’s connected to the internal network and set
The distro offers three boot options. By default it to boot from the network will boot into Slax by grabbing
boots with the persistence option to save any changes the Slax modules over the network.
made in the Live environment. You can optionally Despite all the changes, Slax has managed to retain its
choose to boot into the factory environment by disabling edge. It’s lightweight, fast and easily customisable.
persistence. The third option runs the Live environment Behind the scenes, its developer is toiling hard to make it
entirely from RAM. It’ll perform a lot better than the compatible with a large amount of modern hardware. If it
previous options, but will only work on machines that continues on its current trajectory, it won’t be long before
have an adequate amount of memory. the distro reclaims the top spot among the portable Live
Despite its miniscule size, Slax boots to a graphical USB distros.
desktop sporting the lightweight Fluxbox window
manager. The desktop runs Slax’s homegrown and very
minimalist xlunch application launcher that weighs in at
VerDiCT
only 25K. The headline feature of the distro, however, is DevelopeR: Tomas Matejicek
its modular architecture. Everything in Slax, from the core Web: www.slax.org
components to the web browser, is a module that users licence: Several
can enable or disable on the fly as needed. This makes it
fairly simple to customise the distro to suit your needs. feaTureS 9/10 eaSe of uSe 8/10
Any changes you make to the distro, such as altering PerformanCe 9/10 DoCumenTaTion 8/10
the wallpaper or apt-get-ing new apps, are automatically
saved if you’re using the distro from a writeable medium The minimalist distro hasn’t lost its charms and is in our
such as a USB disk. If you’re running Slax from a non- opinion still the best option for lugging a USB Linux.
writeable medium like a CD or have disabled persistence,
you can still save your customisations by rolling them into Rating 8/10
a module. A simple command like savechanges

20 LXF249 May 2019 www.linuxformat.com


Linux distribution Reviews

refracta 9.0
A Devuan-based distro doesn’t particularly excite Mayank Sharma, but
this one comes with a bunch of interesting tweaks and custom scripts.
here aren’t many desktop
in brief
Refracta is a
T distros based on Debian’s
systemd-free Devuan fork.
regular desktop But what makes Refracta interesting
distro that has are its custom scripts and packaging
a bunch of policy. It’s based on the latest
customised Devuan 2.0 ASCII release, it’s
tools to help available for both 32-bit and 64-bit
you install and machines and its selection of pre-
customise the installed apps make it an ideal
distro, and lightweight distro for daily use.
eventually roll Refracta uses the Xfce desktop,
your own Live the CLI-based Mutt as the default
ISO that you email client, and Abiword for word
can carry on processing. One of the highlights
a bootable of the distro is that its desktop is
USB stick. installed as individual packages Refracta’s scripts would be nicely complemented by a stripped-down flavour of the distro that
rather than a metapackage. This users could flesh out as needed.
makes it easier to customise their
installation by removing individual parts without affecting utility also has several tweakable parameters for
other parts of the desktop. So for instance, you can advanced users. First-timers can stick with the defaults
remove Xfce’s Thunar file manager without zapping the to generate a custom ISO to mirror their modified
entire desktop environment, and replace it with another installation. The script works flawlessly, and spits out
one like PCManFM. the ISO as promised.
Besides these, it’s a fairly standard collection of apps The third custom script is Refracta2usb, which helps
that’ll satisfy all kinds of users. Users will appreciate the make a bootable USB drive. Unlike other similar utilities,
fact that the Firefox ESR release is equipped with the this script can do a lot more than just transfer an ISO
HTTPS Everywhere and NoScript add-ons. One image to a disk. It can also create a bootable USB directly
interesting app that we particularly like is FireMenu, a from a running Refracta instance! The running instance
graphical application menu for Firejail. The app, placed has to be either from a Live CD or a Live USB and not
prominently in the top panel, presents a list of apps that from an installed instance of Refracta. Again, this option
when selected are launched in a Firejail sandbox. will also roll all the changes you’ve made to the running
FireMenu is fairly easy to operate and you can easily instance into the bootable USB. The script also gives you
customise its list of apps. While we had no issues running options to create a persistence partition that can be
apps like Firefox, GIMP and Audacious in the sandbox, the optionally encrypted for added security.
entry for MPV got us nowhere. As a desktop, Refracta doesn’t offer much to write
The main draw of the distro are its custom scripts. home about: it’s a pretty standard Xfce distro with some
First up is Refracta Installer, for anchoring the distro to esoteric app choices. What made us take notice are its
your hard disk. It’s a graphical installer that’s unlike any custom scripts. They are very useful and work as
we’ve encountered, with lots of tickboxes and pop-ups. advertised to help you package your customisations.
Its dexterity will appeal to advanced users, though it
comes with enough adequate defaults to be usable in
the hands of first-timers as well. There isn’t a dedicated
VerDiCT
partitioning tool, though, and this crucial task is instead DevelopeR: fsmithred
deferred to Gparted. Web: https://refracta.org
The installer is constantly evolving and taking on new licence: DFSG-compatible licences
features. The latest version that comes with this release
supports GPT disks and full-disk encryption. Another feaTures 9/10 ease of use 8/10
unique and interesting aspect of the installer is that PerformanCe 9/10 DoCumenTaTion 8/10
instead of anchoring the stock environment, it transfers
the Live environment along with any modifications, The stock Refracta isn’t really impressive, but its scripts make
including changes to the configuration and the app the distro worth checking out.
selection. Once you’ve installed a modified Refracta you
can easily convert it into an installable ISO image with the Rating 8/10
Refracta Snapshot script. Like the installer, the snapshot

www.techradar.com/pro/linux May 2019 LXF249 21


TRY 5 ISSUES FOR £5 *

BIG SAVINGS ON OUR BEST-SELLING MAGAZINES


SAVE SAVE SAVE
85% 83% 83%

SAVE SAVE SAVE


82% 83% 80%

For great savings on all of our magazines, see the entire range onlline
myfavouritemagazines.co.uk/spring192

Order Hotline 0344 848 2852


*TERMS AND CONDITIONS: The trial offer is for new UK print subscribers paying by Direct Debit only. Savings are compared to buying full priced print issues. You
can write to us or call us to cancel your subscription within 14 days of purchase. Payment is non-refundable after the 14 day cancellation period unless exceptional
circumstances apply. Your statutory rights are not affected. Prices correct at point of print and subject to change. Full details of the Direct Debit guarantee are
ƏɮƏǣǼƏƫǼƺɖȵȒȇȸƺȷɖƺɀɎِÈkƬƏǼǼɀɯǣǼǼƬȒɀɎɎǝƺɀƏȅƺƏɀȒɎǝƺȸɀɎƏȇƳƏȸƳˡɴƺƳǼǣȇƺȇɖȅƫƺȸɀ٢ɀɎƏȸɎǣȇǕ‫׏׎‬Ȓȸ‫א׎‬٣ȒȸƏȸƺǣȇƬǼɖƳƺƳƏɀȵƏȸɎȒǔƏȇɵǣȇƬǼɖɀǣɮƺȒȸǔȸƺƺȅǣȇɖɎƺɀ
ƏǼǼȒɯƏȇƬƺɀ٢ǣǔȒǔǔƺȸƺƳƫɵɵȒɖȸȵǝȒȇƺɎƏȸǣǔǔ٣ِIȒȸǔɖǼǼɎƺȸȅɀƏȇƳƬȒȇƳǣɎǣȒȇɀȵǼƺƏɀƺɮǣɀǣɎ‫ي‬ƫǣɎِǼɵٖȅƏǕɎƏȇƳƬِ…ǔǔƺȸƺȇƳɀ‫׏ב‬ɀɎxƏɵ‫ِח׏׎א‬
Linux distribution Reviews

Linux Kodachi 6.0


Distros with grandiose claims don’t really impress Mayank Sharma,
but he’s in for a surprise with this one…
eighing in at 2.4GB, Kodachi
in brief
This Xubuntu
W is one of the heaviest Xfce-
wielding distros we’ve come
18.04-based across. But boot it up and you’ll
distro has the realise its choice of the lightweight
rather grandiose desktop is meant to keep resources
aim to be free for the other intensive tasks that
secure, anti- run in the background.
forensic and For a smooth experience it’s best
anonymous, to run Kodachi on a multi-core
and employs machine with at least 4GB of RAM.
several While you can install it via the
mechanisms to cosmetically modified Ubiquity
this end. It uses installer, it’s best to run the distro
a customised from a rewritable medium such as
Xfce desktop a USB disk. The distro’s boot menu Kodachi is flexible enough to allow for modifications to the default security mechanisms
in order to be lists an option to boot with a including the ability to switch to a different VPN provider.
resource- persistent partition, but getting it to
efficient, and work requires some fiddling around. There’s also an including the ability to create a nuke password to destroy
provides access option to boot with an encrypted persistent partition, but your installation in case you are forced to log into it
to a wide variety the release notes cast a shadow of doubt on the against your will (damn management–Ed) for any reason.
of security and functionality, and we couldn’t get it to work either. In addition to Tor and VPN, the distro includes well-
privacy tools The distro boots into a heavily modified Xfce desktop known cryptographic and privacy tools to encrypt all
while still being environment that displays tons of useful information your offline files, emails and instant messaging. There’s
intuitive. about the system directly on the desktop via Conky an entire suite of privacy-protection tools including
applets, including the status and IP address of the VPN, VeraCrypt, zuluCrypt, KeePassXC and more. It also
Tor IP, CPU usage, memory and traffic data. We found it includes Firejail, which enables you to run several desktop
was best to use a wired connection to get online with apps inside sandboxed environments. The distro caters
Kodachi. With the Ethernet plugged in, Kodachi to all sorts of users and includes many mainstream open
automatically takes the necessary steps to ensure your source apps for everything from handling office
access to the internet is completely masked. If you documents to playing all kinds of media. There’s also
connect via a Wi-Fi adapter you’ll first have to configure it the Synaptic package manager for adding apps.
to connect to the internet, which isn’t very intuitive. Kodachi might appear inundating to first-timers
Kodachi has several models for online anonymity. Go because of its very busy desktop. Its website isn’t
through the apps in the dock to ask Kodachi to route all completely bereft of documentation, but lacks pointers
traffic through a VPN, and then pass it through the Tor to help new and inexperienced users get started with the
network. For added security you can also ask it to encrypt distro. Once you get the hang of it, though, you’ll be
all DNS queries, and even set up a Tor-rified system to amazed at the level of privacy it ensures straight out of
pass all internet traffic via the Tor network. The dock also the box, and the amount of customisation it provides for
hosts a collection of tools to easily change identifying advanced users.
information such as the Tor exit country, as well as to
reset your DNS servers and more, all with a single click.
The distro includes a handful of browsers, such as the
VerDiCT
Tor browser, the Kodachi browser and a vanilla Firefox. DevelopeR: Warith Al Maawali
Using the Kodachi browser is recommended, but you can Web: www.digi77.com/linux-kodachi
make use of the others as well according to your purpose licence: Apache v2.0
for being online. All browsers are equipped with about a
dozen privacy- and security-enhancing extensions. feaTures 9/10 ease of use 5/10
Kodachi scores your setup depending on how you PerformanCe 8/10 DoCumenTaTion 6/10
have configured it to route internet traffic. You can follow
the recommendations of the evaluation app to increase Perhaps the best bet for privacy-conscious users who want
the score and make your system more secure in the to completely mask their online presence.
process. One of the most interesting collections in the
dock is ‘Panic Room’, which gives access to some of Rating 7/10
Kodachi’s unique privacy-enhancing techniques,

www.techradar.com/pro/linux May 2019 LXF249 23


Reviews First person shooter

Dusk
Management are nervous again, as Ian Birnbaum appears to
be ignoring their memo not to go in the ruins…
here we were, just about hip-
SPECS
T
Heed the chilling cry of “Get
deep in corpses and spent orrrrf ov moi laaaaand!”
Minimum: shotguns shells,
OS: Ubuntu when we read the writing on the wall.
12.04 64-bit Scrawled in blood, a message: “Don’t
CPU: 2.4GHz go in the ruins”. A raspy noise echoed
dual core behind us. It wasn’t quite an animal
MEM: 2GB sound, but it wasn’t human, either.
GPU: GeForce Turning, we found something much
9800GT or worse than a bad guy: a closed door
equivalent marked Ruins Access. The raspy
HDD: 2GB breathing came again from just
behind it. An actual chill ran down
Recommended: our collective back.
CPU: 2.4GHz Dusk is an homage to ’90s first-
quad-core person shooters such as DOOM,
Mem: 4GB Quake and Half-Life. It’s also a love letter to weird cultist of shooty monsters and bullets is to move, to run circles
GPU: Geforce horror genre films like The Hills Have Eyes and The Texas around the bad guys, kite them into big groups or toward
GTX 460 or Chain Saw Massacre. More importantly, it’s great. Dusk is explosive barrels, and shoot as fast as you can.
equivalent <expletive deleted> great. Speed is the first but not the only tool. Starting with
Notes: Don’t At the beginning of Dusk, you’re meat-hooked (at least a pair of sharp sickles and moving up through the
go in the ruins the third-worst way to wake up) and trapped in a hostile traditional FPS loadout closet, you shoot demons and
world, mostly unarmed. Like the ’90s shooters it draws bad guys with pistols, lever-action rifles, double-barrelled
inspiration from, the first tool Dusk gives players is speed. super shotguns, assault rifles, sniper rifles and grenade
This is a game where pressing the Forward button zips launchers. The most unexpected weapon found so far
you along the ground, and, charmingly, bunny hopping was the Riveter, a bulky steel box that launches hot
adds momentum just like it used to in ye olden days. construction-grade welding rivets that, for some reason,
With a heavy W-finger and a lot of jumping, exploring the explode spectacularly. We’re not sure why a rivet driver
creepy farmhouses and industrial buildings of Dusk’s first might act this way – it seems counterproductive for
chapter felt like touring a retro videogame art museum on construction work – but it is extremely fun.
a motorcycle. The blocky graphics in Dusk are the most obvious
It’s not speed for speed’s sake; you’re moving fast throwback reference to the era of games it idolises, but
because it’s the only way to survive. There are a lot of dang if they don’t look great anyway. The sharp polygons
different enemies in Dusk, from possessed scarecrows to of enemy bodies might be two decades out of date, but
hooded Klansmen throwing dark magic, but almost all of modern lighting and particle effects did a lot to make us
them charge straight ahead with melee attacks or shoot feel interested in exploring, and blowing up, the world
swarms of projectiles at you. The variety of enemies, around us. The limited polygon count and low-res
some big, some small, shooting bullets that move at textures have a jagged, unreal quality that makes corn
So little time, different speeds, makes every fight a constantly changing mazes look creepy and country churches look properly
so much to kill. obstacle course. The only way to navigate a crowded field cursed by evil magicks.
The single-player portion of Dusk consists of three
campaigns. Starting from that first moment in a weirdo’s
murder-dungeon, you fight your way through farms,
industrial zones and apartment buildings until you’ve
completely wiped out the cultist and/or demon
population of Dusk, Pennsylvania. We’d honestly
expected Dusk to be a straightforward recreation of
’90s shooters, including a generic or non-existent story.
Instead, the biggest surprise for us was discovering a
genuinely interesting, gripping little horror story on offer.
This is where Dusk becomes more than a parody or
homage to a once-ubiquitous genre and starts kicking ass
on its own terms. The bare, pixelated corridors of yore
have been replaced by low-poly but recognisable and
memorable level and environment designs. DOOM, with
its limitations, offered a bare set of hallways, but in Dusk

24 LXF249 May 2019 www.linuxformat.com


First person shooter Reviews

This is actually what Jonni’s


mind looks like inside.

you fight bad guys in bars, bookshops, bedrooms, labs,


hay lofts, gas stations and convenience stores.
Dusk insists on using the classic trope of locked doors
and coloured keycards. Modern shooters have mostly left Dusk’s soundtrack is phenomenal. It’s got a heavy A return to Return
that conceit behind because it makes players do a lot of metal flavour that instantly makes you think of DOOM – to Ravenholm.
backtracking through empty levels. Distinct environments so it’s no surprise that it was written by Andrew Hulshult,
filled with recognisable decorations like furniture go a the composer behind Brutal DOOM and Quake
long way to keep you from getting lost, though; it’s Champions. It really is a stunner, and it’s also got a
usually easy enough to recall that the Yellow Door is in relentless, driving quality that reminded us more of Mad
the bookshop and to find your way back there quickly Max: Fury Road than the Rip & Tear track from DOOM.
enough. Clever changes in geography, such as a floor The multiplayer mode is a more direct throwback to
falling in or a hidden door opening, also help mix up the original Quake, and wasn’t as successful at grabbing
paths through levels. our attention. The high-speed bunny-hopping makes
More than that, developer David Szymanski has a aiming at human opponents much more challenging than
talent for environmental storytelling that goes way single-player modes, though fans of old-school Quake
beyond the tableaus in games from much larger studios. deathmatches will enjoy searching levels and memorising
Once, while venturing through a pitch-black subterranean spawns for the strongest weapons. Matchmaking was fast
jail with a torch, we were hit from behind. Turning the and rounds start with very little down time. The guns still
cone of our torch revealed… well, that would spoil the feel punchy, and the arenas use a lot of vertical space to
surprise, but read with the light from our torch there was bring battles way above and below ground level.
another message in blood: “Don’t trust your eyes”. This To be clear, the multiplayer is completely fine. But
moment of discovery, and the sensation that the game when the single-player is this good, a fine multiplayer
was toying with us, was better than any dozen skeletons mode is a bit a of a let-down. Multiplayer lacks the careful
we’ve discovered in post-apocalyptic Fallout toilets. reinvention, the painstaking spiritual reimagination that
Each level is surprisingly compact, using those colour- the single-player mode captures so effectively.
coded locks to send players running back and forth Dusk is brilliant because it understands that replaying
across relatively small spaces. Still, every area is full of those old games is frequently kind of a let-down. Half-Life
tiny corners and hidden walkways. Sometimes, but not is a classic, but playing it today shows how different parts
always, pressing a piece of wall opens a hidden door, or of it haven’t aged well; the graphics are barer than your
shooting an air grate blows open a secret passage. memories, and the animations are more stilted. It was
Without rushing, the average level takes about 12 minutes groundbreaking, but it’s just not as fun as it was when it
to finish. These bite-sized little pieces of mayhem and first blew our collective minds in 1998. Dusk captures how
action make it really easy to pick it up and put it down a those ’90s games feel now in our minds, tinted by
few minutes later, and the built-in level timers are great 20 years of rose-coloured memories. It shouldn’t be
for speedrunners. possible, and it’s a remarkable achievement.

Why the long face?


VERDICT
DEvElOPER: David Szymanski
WEB: https://newblood.games
PRICE: £15

GamEPlay 9/10 lonGEVITy 9/10


GRaPhICS 8/10 ValuE 9/10

An obsessively tuned, finely crafted shooter that more than


recreates the speed and pure joy of ’90s classics.

Rating 8/10

www.techradar.com/pro/linux May 2019 LXF249 25


SUBSCRIBE Save money today!

SUBSCRIBE!
Sign up today and get your
SoundMAGIC e11c
earphones YOUR
GIFT!
WORTH
£50
Don’t miss out,
subscribe now!

“A great pair of
affordable in-ear
te
headphones, comple
with remote
and mic”

IT’S EASY TO SUBSCRIBE!


www.myfavouritemagazines.co.uk/lin/e11c
Call: 0344 848 2852
26 LXF249 May 2019 www.linuxformat.com
Overseas
subs on
p67

PLUS: Exclusive access to 1

the Linux Format subs area!

1) Only available to MyFavouriteMagazines.co.uk subscribers.


1,000s of DRM-free
PDF back issues and
articles! Get instant
access back to issue
66 (May 2005) with
INCLUDES
tutorials, interviews,
ars
Now with 5 ye
of Linux User & features and reviews.
Developer
issues At linuxformat.com

CHOOSE YOUR PACKAGE!


PRINT EDITION DIGITAL EDITION PRINT + DIGITAL

PLUS! PLUS!
Every issue comes with a 4GB DVD The cheapest way to get Linux Get both the print & digital
packed full of the hottest distros. Plus Format. Instant access on your editions + DVD, for one low price. Plus
your SoundMAGIC e11c earphones iPad, iPhone and Android device. your SoundMAGIC e11c earphones

Only £76 Only £25 Only £90


Annual print by Direct Debit Every six months by Direct Debit Annual bundle by Direct Debit

*Terms and conditions: This offer is only available for new UK subscribers. Gift is subject to availability. Please allow up to 60 days for the delivery of
your gift. In the event of stocks being exhausted we reserve the right to replace with items of similar value. Prices and savings quoted are compared
to buying full-priced print issues. You will receive 13 issues in a year. You can write to us or call us to cancel your subscription within 14 days of
purchase. Payment is non-refundable after the 14-day cancellation period unless exceptional circumstances apply. UK calls will cost the same as
other standard fixed line numbers (starting 01 or 02) or are included as part of any inclusive or free minutes allowances (if offered by your phone
tariff). For full terms and conditions please visit: www.bit.ly/magterms. Offer ends 31 May 2019.

www.techradar.com/pro/linux May 2019 LXF249 27


We compare tons of stuff so you don’t have to!

Roundup
Clonezilla Deepin Clone
G4L WereSync
FOG Project
Shashank
Sharma
By day Shashank
is a New Delhi trial
lawyer, but by
night he’s an open
source vigilante!

Disk cloning tools


Need to provision a lab full of PCs? The ever lethargic Shashank Sharma
tests the best tools to get the job done without breaking into a sweat.

how we teSted…

A disk cloning tool requires


quite a bit of hardware to be
tested effectively, particularly
hard disks. This is why virtual
hardware is ideal for testing
their capabilities. For this
Roundup we’re using several
virtual machines with multiple
hard disks of various sizes.
We’ll use them to image a
small disk to a large one, which
is one of the most popular uses
of a disk cloning tool.
Secondly, we’ll clone a large
disk with lots of empty space
to a smaller one with enough
room to accommodate the
used sectors of the larger
disk. The Clonezilla, G4L and
FOG Project tools have been
tested on Manjaro, Fedora
and Ubuntu installations. anaging a network of computers is on one computer, and then automatically
WereSync was installed on
Manjaro and Deepin Clone
M an involved process. The constant
barrage of repetitive tasks such as
replicating the same setup on other
computers. The technique, also known as
was tested atop a Deepin 15.9 running checks, troubleshooting errors, ghosting or imaging, is used by system
installation for best results. replacing dead hard disks and doing fresh admins for rolling out multiple identical
The network-based FOG installations over and over again can sap the machines over the network.
Project was installed on a energy out of any system admin, irrespective The cloning tools on test here are a
Ubuntu Server installation as of the size of your realm. Even before you can blessing for harried admins who want to put
per its documentation. tackle the problem of actively monitoring the their feet up every now and then. With these
machines, you have to install an operating tools you can image and clone machines
system on each of them. This is a time- without breaking into a sweat. We’ll look at
consuming task even for a small network tools that, besides cloning, will also help take
with, say, 10 computers. the pain out of everyday admin tasks such as
Computer cloning involves setting up the installing software, and can scale up to work
operating system, drivers, software and data over large networks and multiple locations.

28 LXF249 May 2019 www.linuxformat.com


Disk cloning tools roundup

Cloning
flexibility
Do they offer enough options to
meet your cloning requirements?
lonezilla offers a lot of control over the cloning process.
C You can use it to clone individual partitions or complete
disks, or to clone the disk or partitions to an image – Direct disk-to-disk cloning options are faster than going via the image route,
which can then be saved to another locally attached disk, or even but come with certain amount of risk and don’t offer the same flexibility.
a removable drive. Rather than cloning to an image, Clonezilla can
also directly clone the disk or a partition to another disk or don’t wish to image them immediately. WereSync, meanwhile, is
partition. Although this process worked for us when cloning entire a Python script that has a graphical interface and is designed for
disks, we wouldn’t recommend it and would rather suggest you regular users. The utility only offers direct drive-to-drive cloning,
go via the imaging route, which is a lot safer and offers far more instead of the more popular and safe drive-to-image cloning
flexibility than direct disk-to-disk cloning. option offered by the others.
Much like Clonezilla, G4L has a very verbose interface, which Deepin Clone’s primary option is also a direct clone from one
gives you several options to help fine-tune settings when creating disk to another, although it does offer the option to clone and
and restoring images. Like Clonezilla, you can use G4L in restore via an image too. The app enables you to clone complete
separate modes, with the RAW mode that can clone all types disks as well as individual partitions. Note however that it cannot
of disks and partitions being the most useful. You can save the clone mounted partitions, nor can it save images on the same
images locally or across the network via FTP, SSH, SMB or NFS. partition or disk it is cloning. It also doesn’t offer any options to
For the impatient, G4L also offers the option to directly clone a compress, split or encrypt the cloned image.
drive without imaging it first.
Unlike the previous programs, FOG Project doesn’t work as a VErdICT
Live CD and thus has a different cloning mechanism. When you
use FOG Project to image a computer, it offers plenty of options, ClonEzIllA 8/10 G4l 8/10
with various fields to describe the host images. It can also dEEpIn ClonE 5/10 WErESynC 6/10
arrange the images into groups for easier management. There FoG projECT 8/10
are also several options to schedule the imaging process, if you They all offer enough dexterity for imaging a disk or partition.

Other custom
parameters
Do they offer any supplementary
options to assist with cloning?
part from presenting you with a list of disks and partitions

A to clone, Clonezilla also gives you options to compress


them using multiple compression algorithms, and even
With FOG Project you can also track a user’s access to their computers, and shut
down the machines after a specified period of inactivity.
optionally encrypt the cloned images for added security. A major
step in the cloning process is to select the storage location of the TestDisk, or to scan for viruses with ClamAV. The FOG Project
cloned images, and Clonezilla enables you to save them to a locally server can also install and manage printers on the network. FOG
attached disk or on another computer via the network. Project can also install and uninstall apps via snapins.
G4L has a huge list of menus that help you with each step. You Both WereSync and Deepin Clone offer very limited functionality
can earmark the partitions or disks you want to image, name the and are less flexible than the others.
image, select the compression algorithm and more. G4L will help
you transfer images to remote destinations on the network, and VErdICT
you can also split them up for easier storage on smaller drives.
You can create several different tasks for any of the hosts in ClonEzIllA 8/10 G4l 8/10
FOG Project’s repository. You can run the Debug task which boots dEEpIn ClonE 4/10 WErESynC 5/10
a Linux image to a Bash prompt for fixing any boot errors. You can FoG projECT 9/10
also create a task to remote wipe hosts, to recover files with The app-based options fare poorly in terms of imaging dexterity.

www.techradar.com/pro/linux May 2019 LXF249 29


roundup Disk cloning tools

Usability
What makes them
stand out? Clonezilla 8/10 deepin Clone 8/10
Clonezilla is one of the most If there’s one area where Deepin Clone
nlike desktop apps, disk recommended tools on Linux forums for trumps the rest of the competition, it’s

u cloning tools are administrative


software and you’d expect
imaging an old disk to a bigger, new disk
thanks to its ncurses-based frontend,
usability: the app really is as simple as
they come.
them to sacrifice a certain amount of which is intuitive (Really?–Ed) to navigate. On the first screen, it asks you to select
user-friendliness in order to make room In the background, Clonezilla uses a set of whether you wish to clone a complete or
for advanced functions and features. scripts with several open source disk individual partitions. Depending on the
That being said, while we don’t expect utilities such as Partimage, ntfsclone, selection, it’ll bring up another set of
these tools to have point-and-click Partclone and dd to help you duplicate options to help you narrow down the disk/
usability, a certain amount of individual partitions and complete disks. partition you want.
intuitiveness will surely make them The menus offer sensible defaults so On the following screen you’re shown a
more approachable. you’ll likely go with the recommended list of disks or partitions. Unlike some of
We are in no way expecting these options most of the time. Just make sure the other options on test here, if you’ve
tools to cater to a non-technical that the partition to be cloned isn’t selected the option to clone partitions, the
audience that doesn’t know what they mounted. Also, despite its unglamorous app won’t let you clone multiple partitions
are getting into, but having a logically text-based interface, Clonezilla isn’t in one go. Also, its default mode of cloning
laid-out interface with a clear path of intimidating because of its very verbose is a direct disk-to-disk or partition-to-
progression will go a long way to getting screens. Each step is dotted with relevant partition, which is rather unsafe and
the most out of the tools. Ease of information to help you make an informed something we’d never recommend doing.
deployment and reasonable defaults choice. Still, Clonezilla isn’t something to In addition, to use Deepin Clone to image
are the icing on the cake, and while they be approached without adequate the current installation, you’ll have to run
aren’t all that critical to selecting a good knowledge and experience. it via Deepin Recovery.
administrative tool, they can’t really
hurt its chances.

Supported filesystems
Will they work across all machines in your network?
lonezilla supports a wide number of filesystems, from In contrast, there isn’t much information on the internet

C popular ones like ext2/3/4, ReiserFS4, Btrfs, FAT16/32


and NTFS to specialised ones like XFS, JFS and UFS.
about the way that Deepin Clone works, and it doesn’t offer any
configurable parameters that would hint at the filesystems it
But that doesn’t mean it’s totally unusable for unsupported supports. In our tests, however, it worked on both ext4 and NTFS
filesystems. For those it supports, Clonezilla images only the partitions.
used blocks for greater restore functionality. If it runs into a In contrast to its peers, WereSync uses rsync to copy the
filesystem it doesn’t understand, Clonezilla uses dd to image the contents of the drive, and can image the contents of GPT, MBR
contents as-is, and can restore these easily to equal-sized disks. and LVM drives. According to the official documentation, you can
Much like Clonezilla, G4L works in two modes. There’s the even force the tool to copy the contents of a drive to a file by
filesystem level where it uses utilities such as NTFSclone and specifying the IMG extension type.
FSArchiver to directly clone supported filesystems, including
virtually all the popular ones. If you work with esoteric filesystems VErdICT
or need to clone entire disks, you can use G4L in RAW mode to
copy all bits of any file system. ClonEzIllA 9/10 G4l 9/10
FOG Project uses both PartImage and PartClone in the dEEpIn ClonE 5/10 WErESynC 5/10
background, so it supports all the popular filesystems. The FoG projECT 9/10
Imaging section also enables you to create a sector-by-sector All these tools give you decent mileage so long as you’re working with one of
image of the drive using dd. the popular filesystems.

30 LXF249 May 2019 www.linuxformat.com


Disk cloning tools roundup

FoG Project 8/10 G4L 8/10 wereSync 6/10


FOG Project has a much more involved As with Clonezilla, the interface of the G4L Installing WereSync is fairly
installation process than the other Live CD is text-based and written in straightforward since you can grab it from
solutions here. Unlike Clonezilla and G4L, ncurses. This one, however, is much more Python’s PIP package manager with a
you first need to set up an imaging server. verbose. The process of creating and single command. You can then fire up the
While the initial deployment might be restoring images takes you through graphical interface which is fairly intuitive,
time-consuming, FOG Project’s web several wizards, each of which is loaded although there are some options that
interface makes the effort worthwhile with quite a number of steps. Unlike don’t immediately make sense.
since it can image and deploy multiple Clonezilla, G4L ships with four different A quick scroll through the
computers simultaneously with ease. kernels so you’ll first have to select the documentation is advisable to familiarise
FOG Project’s web interface is fairly one based on your hardware. If you’re yourself with the peculiarities of the tool.
intuitive for anyone who is familiar with using G4L on an older machine, use an Some of the options also have a brief
the intricacies of the imaging process. The older kernel for greater compatibility. explanation built into the app itself.
menus are arranged in a logical fashion Upon booting, the Live environment will Despite these avenues of help, it’s difficult
and first time users should have no issues first display some basic usage information to differentiate between options that are
navigating it. The setup is scalable as well, spread across multiple pages. Advanced mandatory and optional, and the impact
and you can set up dedicated storage users can then either issue a cloning or that their inclusion or exclusion will have
nodes which can help take the load off restoration command directly, or use the on the cloning process.
the main FOG Project server, if you have to interface to construct the command using Also disappointing is the lack of
host and deploy images to a large number the various menus. As you step through meaningful errors. By default the app
of computers. You can use the web each screen, G4L brings up another is configured such that once begun, all
interface to manage all imaged computers screen asking for more relevant options cloning tasks end with a success message,
as well as their cloned images. to complete the task. even when the process has failed.

Help and support


Where do you go if you run into trouble?
lonezilla hosts a pretty comprehensive FAQ on its forum boards, and can even find its developers and seasoned

C website, which you should scroll through before


experimenting with the tool. You can also engage
users via its IRC channel.
Although it has a very intuitive interface, as we’ve said there
directly with Clonezilla’s developer via the official forum boards, isn’t much information available about Deepin Clone. It doesn’t
where he is fairly active. New users can also find getting started have any dedicated avenues of support besides the ones for the
information littered all over the web, including on YouTube. main distro.
The primary source of information about G4L is its verbose There are two parts to the WereSync tool, a command-line
interface. The project is hosted on SourceForge and besides the utility and a graphical one. The project’s webpage has adequate
built-in help, there’s little else on its website. G4L does have an information to orientate new users with both the utilities,
active forum where you can engage with the developer, who again including an in-depth explanation of all its CLI parameters.
is fairly active. Again, just like Clonezilla, G4L is fairly well-covered
and you can find lots of getting started information and tutorials VErdICT
all over the internet.
New users will be well taken care of by FOG Project. The ClonEzIllA 9/10 G4l 8/10
project has extensive documentation on its website including a dEEpIn ClonE 5/10 WErESynC 5/10
wiki and a detailed FAQ. There’s also an installation guide with FoG projECT 9/10
distro-specific installation notes. If you run into any trouble with While the mature tools don’t always have good documentation of their own,
your FOG Project installation you can get help from its very active you can find help elsewhere on the internet.

www.techradar.com/pro/linux May 2019 LXF249 31


roundup Disk cloning tools

Network use
Are these tools good for only imaging
local disks and partitions?
ou can use Clonezilla for multicast cloning via two

y available options. Clonezilla Server Edition requires


setting up a Diskless Remote Boot in Linux (DRBL)
server to broadcast images across the network. On a smaller
network, you can use the Clonezilla Lite Server mode on the
bootable CD to set up a temporary server. You can use the G4L Live CD to turn remote computers into receivers that’ll pull
You use Clonezilla to save the cloned image of a disk or the broadcasted images and restore them over the network.
individual partitions over the network. For this it can establish a
connection to the remote machine via SSH, or through an SMB, more network services such as DHCP and PXE servers, which are
NFS or WebDAV server. optional with the other tools. By contrast, neither Deepin Clone nor
Similarly, in addition to creating and restoring local images, WereSync offer any network awareness of their own. With Deepin
G4L also has impressive network capabilities. You can use it to Clone, though, you could obviously mount a remote computer in
backup/restore and image to/from a remote machine on the the local filesystem and point to it as the destination for saving the
network via various mechanisms, including FTP and UDPcast. image of a local disk/partition.
To use the latter, configure the Live environment to set up one
machine as a multicast server, which then broadcasts images VErdICT
stored locally or elsewhere on the network.
Unlike the other tools on test here, FOG Project is built from the ClonEzIllA 8/10 G4l 8/10
ground up to work over the network. It works best when it doubles dEEpIn ClonE 5/10 WErESynC 1/10
up as the DHCP and PXE server. All of FOG Project’s imaging tasks, FoG projECT 9/10
including capturing and deployment, are handled remotely over FoG project is designed from the ground up to reside on the network, while
the network. Unlike the other solutions it forces the use of a lot Clonezilla and G4l can be used to work across the network as well.

Deploying images
Putting the cloned images to use.
e wouldn’t fault you for thinking that the process for

W restoration would be the reverse of the imaging process


for each of the tools. But Deepin Clone and WereSync
will surprise you in this respect.
Clonezilla has a very straightforward process for restoring a
partition or an entire disk from a cloned image. You begin by first
selecting the repository that houses the cloned images. Next,
Clonezilla displays a list of all the unmounted partitions to which
you can restore the image. All tools can perfectly restore a smaller image to a larger disk, but only WereSync
After you’ve made your selection, Clonezilla wipes the partition promises to restore a larger image to a smaller disk.
and creates a new partition table on the disk, so be careful with
this. Also keep in mind that the destination partition needs to be To restore an image with Deepin Clone, all you have to do is
equal to or larger than the source, as it can’t restore an image to point the app to the image file along with the disk or partition you
smaller disks. want to restore it to. As with its cloning process, the restoration
When restoring with G4L, you must point the tool to the saved doesn’t offer any configurable options.
image, followed by the location of the disk or partitions where you By default, WereSync directly clones a drive to another, so
want to restore the image. During our tests, while G4L certainly there’s no option for restoration. However, you can force the app
began restoring a cloned image from a larger disk to a smaller to image a drive by changing the destination to an IMG file. To
one, the process never completed successfully. On the other restore from this image, you’ll have to reverse the fields and
hand, attempts at restoring images of a smaller disk to a larger specify the IMG file as the source.
one went smoothly.
With FOG Project, you first need to register the target machine VErdICT
with the server and then associate a cloned image with it. To do
the actual rollout, you’ll have to create a deploy image task before ClonEzIllA 8/10 G4l 8/10
the image is rolled over to the machine via PXE. The same dEEpIn ClonE 5/10 WErESynC 5/10
process works irrespective of whether you wish to deploy to a FoG projECT 9/10
single computer or multiple ones. They’re all well-matched, with the exception of WereSync and deepin Clone.

32 LXF249 May 2019 www.linuxformat.com


Disk cloning tools roundup

Disk cloning tools


The Verdict

ith their varied ways of working, you can find a situation

W that’s best suited to each one of the tools featured here.


For instance, Deepin Clone is an ideal intuitive solution
for home users, which just works. But while the app is available
for non-Deepin distros such as Arch, we don’t feel comfortable
using it in any other distro.
WereSync is based on the venerable rsync utility and is the
only one that can clone a larger disk to a smaller one. It didn’t
make the podium on account of its direct disk-to-disk cloning 1st FoG Project 9/10
mechanism, which we dislike. Coupled with its limited dexterity
and sparse documentation, the program manages to reach the web: https://fogproject.org Licence: GPL v3
fourth spot at best. Version: 1.5.5
While advanced users will probably have no issues working A comprehensive imaging solution that works across networks of all sizes.
through G4L’s interface, first-time users will surely feel
inundated by all the options at their disposal. Critical 2nd Clonezilla 8/10
administrative software, such as disk cloning tools, require a
certain degree of comforting familiarity, and new users will take web: https://clonezilla.org Licence: GPL v2
quite some time to get there with G4L. Version: 2.6.0-37
All things considered, Clonezilla and FOG Project are the only A feature-rich tool that works with all the usual cloning use-cases.
viable options that also scale well. We can easily recommend
them to individual users for use on their home network, as well 3rd G4L 8/10
as to admins of larger networks.
While both do similar tasks, they go about it very differently. web: https://sourceforge.net/projects/g4l Licence: GPL v2
The most visible differences between the two solutions are their Version: 0.55
user interfaces and the fact that Clonezilla runs from a Live CD, Similar to Clonezilla, but loses out because of its cumbersome UI.
while FOG Project requires setting up a server. FOG Project is
also more comprehensive in that it can perform several tasks in 4th deepin Clone 5/10
addition to imaging, such as installing apps remotely in Windows
installation via a feature called snap-ins. web: www.deepin.org/en/original/deepin-clone
If your machines aren’t on a network, you’ll have no option Licence: GPL v3 Version: 1.1.0
but to use Clonezilla. Both solutions are on an equal footing in a Works as advertised but currently only caters to users of the Deepin distro.
networked environment, but Clonezilla’s network options make
the most sense in an environment like a library, where the 5th wereSync 4/10
remote clients don’t require much administration once they’ve
been imaged. If you need to look after machines once they’ve web: https://github.com/donyorM/wereSync
been cloned, there’s no better solution than FOG Project, as its Licence: Apache License 2.0 Version: 1.0
post-imaging options are excellent. Can clone disks, but its design and backend restricts its use cases.

AlSo ConSIdEr
Two of the tools featured in lXF in the past, but not included ones that do the grunt work in the background. The two that
this time around due to them not showing any signs of life, are are really worth mentioning are Partclone and FSarchiver.
Redo Backup & Recovery and Mondo Rescue. The former is by They both support a large number of filesystem formats and
far the easiest bare-metal cloning option we’ve run into. Its can quickly roll disks and partitions into movable archives.
downside, however, is that it takes away a lot of the control The real CLI veterans, however, don’t need anything else
over the cloning process in lieu of convenience. besides the venerable dd tool, which can be used to
The only real alternatives for cloning disks besides the ones effortlessly clone a disk or a partition with a single command.
we’ve already covered in the Roundup are the command-line You’ll need to know what you’re doing!

www.techradar.com/pro/linux May 2019 LXF249 33


VOICE CONTROLLED

SMART
HOME
If you utter “Siri”, “Alexa” or “OK Google” in Jonni Bidwell’s
home, all the lights go off and the router disconnects.
ep, we’re pretty cynical about house so that it can be ‘smart’, so that the profit by not having to pay people to drive

Y voice assistants here at LXF


Towers. Our (nameless) sister
magazines rant and rave
‘smart’ appliances can all chatter among
themselves about their dumb masters. If
you’re in the isolated enclave known as
around reading meters. Instead they’ll
have to pay people to drive around fixing
them on a regular basis.
about the latest Alexa additions and how the UK, your utility providers would dearly Be that as it may, voice assistants and
they make ordering tat from Amazon even love you to have smart meters installed. network gadgets are here to stay, and as
easier. They quietly forgive the chaos that They tell you this will help monitor your the old saying goes, if you can’t beat ’em,
ensues when Siri’s name is spoken on the usage, save money and not be subject to make an open source equivalent and have
television, as all the fruity phones within wildly varying usage estimates. That may said equivalent control your home. So
earshot frantically start offering to help. be true in individual cases, though we bet here’s our guide to the FOSS-powered
Tech pundits wax lyrical on the a lot of people will find their water bill smart home, featuring the Mycroft voice
importance of shoving a network stack increasing post-smart meter. But mostly assistant, openHAB, Home Assistant and
deep into every single appliance in your it’s because they can generate more more. Let’s get to it…

34 LXF249 May 2019 www.linuxformat.com


Open source smart home

Introducing Mycroft
A Pi-powered, friendly-looking home helper on the scene.
Actually, there are two – and you can use their code.

he Mycroft Mark 1 launched in 2016 and was be the Mark 1, a Pi or your Linux box.

T powered by a Pi 2, but things have moved on


and it now ships with a Pi 3 at its heart. It’s a
Wake Word – The word that will prick
up Mycroft’s virtual ears. It will try to help
stylish device, and with its friendly ET-style face you you with anything you say after this word.
could almost forgive it for listening in to all your living Utterance – A command or question
room conversations. Actually, non-creepiness is part of directed at Mycroft.
Mycroft’s design – any feature you find invasive or Intent – A task the user intends to
unnecessary can be disabled thanks to its open source accomplish; different utterances may have
nature. Mozilla’s Privacy Not Included site has a the same intent. Mycroft uses a lightweight
favourable write-up at http://bit.ly/lxf249mycroft 1. intent parser called Adapt. A more complex,
The Mark 1 device is still available for $180 (we neural-network-based parser, Padatious, The prototype
Mycroft Mark 2
couldn’t find a source for it in the UK, unfortunately), is also available.
home assistant
but it was always designed with hackers and hobbyists Skill – A function that Mycroft performs in retains some of
in mind. A successor is on the way, and the Mark 2 will response to an Utterance, this could be to relay some its predecessor’s
be much more consumer-friendly (but sadly no longer information, adjust the temperature on your smart charm, but looks a
looks like ET), featuring a six-microphone array, thermostat, or to activate your home’s self-destruct little more like its
proprietary peers.
touchscreen and stereo speakers. mechanism. The intent parser decides which Skill
Don’t worry though, hackers will still be able to have should be used for a given query.
their wicked way with it. Mycroft is currently taking pre- Fallback Skill – If the intent parser is unable to match
orders for the Mark 2, so if you’re tempted check it out a skill to a given utterance, a general fallback
at http://bit.ly/lxf249mycroft2 2. Alternatively, you skill is used. Fallbacks skills for DuckDuckGo and the
can run Picroft, the same software that runs on the Wolfram Alpha knowledge engine are included, which
Mark 1, on your own Raspberry Pi or Linux box. But first can answer most general queries.
some Mycroft etymology and terminology. Mycroft has recently begun work on the CommonIoT
You probably already know that Sherlock Holmes framework. We’ll make reference to a few different
had an older brother called Mycroft. You may even be frameworks in this feature, so you may be thinking, why
aware that in Heinlein’s classic The Moon Is a Harsh another one? Fair point. It’s precisely because there are
Mistress, the HOLMES FOUR computer that now so many partially interoperating ecosystems that
accidentally became self-aware was named Mycroft, bridging layers are sometimes necessary.
shortened to Mike. In case you weren’t, that’s where The important thing is that CommonIoT is available
the Mycroft Home Assistant gets its name. Don’t worry as a Mycroft skill, which enables different platforms to
though, despite our best efforts we couldn’t get the be controlled consistently and saves skill writers having to
device to become sentient and at no point did we feel fight with natural-language coding.
threatened by Mycroft… but maybe that’s just what it
wanted us to think.
Scene-setting aside, you’ll want to get familiar HARDWARE REQUIREMENTS
with the Mycroft nomenclature before you start
ensmartening your home, as some of can be a little Voice recognition is reasonably taxing CPU-wise, so you’ll need at
confusing at first. least a Pi 2 to run Picroft. Even that will struggle and the official word
Enclosure – Any device running Mycroft: this could (see https://mycroft.ai/documentation/picroft) is to use a Pi 3.
That way you also won’t have to worry about getting Wi-Fi working.
Since the Pi’s onboard audio doesn’t have any kind of analogue
input, you’ll need a USB microphone. We hit up our friends at
ModMyPi and got the reasonably fancy Seeed ReSpeaker mic-array,
which has four microphones so can determine the direction of an
audio source.
You’ll also need some kind of speaker; this could connect either to
the 3.5mm analogue output or via USB, or via HDMI if your display
has speakers. Bluetooth audio may work, but users (that’ll be me–
Ed) have reported problems with this, so it’s probably best avoided.
You’ll also need at least an 8GB SD card.
Mycroft will run quite happily on a desktop Linux box too, so long
as it has speakers, a microphone and a reasonably powerful CPU.
Set your physical location to ensure Mycroft knows where it is and In fact it will even run on Android if you’re feeling adventurous.
answers accordingly.
1) https://foundation.mozilla.org/en/privacynotincluded/products/mycroft-mark-1/
2) https://mycroft.ai/product/introducing-the-mycroft-mark-ii-pre-order/
www.techradar.com/pro/linux May 2019 LXF249 35
Open source smart home

Installing Picroft, or Mycroft


Set up Mycroft on your Pi or Linux box and let amusing
human-computer voice interactions ensue.
he process of installing Picroft starts off the The Mycroft CLI should start and you should be able

T same way as installing Raspbian: writing an


SD card image. There are stable and unstable
to pair your Pi to Mycroft Home, which we’ll get to in a
minute. First though, you’ll want to set up your
versions available at https://github.com/MycroftAI/ microphone and speakers via the setup wizard. Exit the
enclosure-picroft. We’ll work with the stable image for CLI by typing :quit then restart the setup wizard with:
this tutorial, but do give the unstable one a shot later to $ mycroft-setup-wizard
see some new features (and possibly bugs). Download First choose the sound output that best matches
the image to your machine – any machine running any your hardware: Analogue, HDMI or USB. Next, set the
OS; just be aware it’s 2.2GB zipped and 4.9GB desired audio level. If you’ve just plugged in a USB
unzipped, so make sure you have enough space. The speaker and aren’t getting any output, you may need
image can be burned with a graphical program like the to reboot (by pressing R) for it to be picked up. Then
multi-platform Etcher (https://etcher.io) or the old- comes the microphone test; only a couple of USB mics
fashioned way using dd on Linux: and the Google AIY kit are supported out of the box, but
$ sudo dd if=raspbian-stretch_Picroft_2018-09-12. other hardware (such as the Seeed ReSpeaker we used)
img of=/dev/sdX status=progress bs=4K can be made compliant once the relevant drivers are
replacing /dev/sdX with the appropriate device (the installed. Use option 4 to postpone setting this up if
lsblk command will help you figure this out if you’re your hardware needs further convincing.
not sure). That will take some time to write, so now is a Next you’ll be asked whether to auto-update the
great opportunity to make a cup of tea. master branch, which is a good thing to say yes to.
When it’s done, put the SD card into the Pi and fire it You’ll then be asked if you want to allow passwordless
up. You’ll need a display and keyboard connected to the sudo – the default behaviour, which is insecure
Pi to run the initial setup, but afterwards, these will not depending on who has access to your Pi. Finally you
be needed unless something goes wrong. On first boot have the option to change the default mycroft
Picroft will resize its partition to use all available space password for the pi user, which you probably should
on the SD card. When it finishes booting a second time, do. Setup then continues the same as on desktop, so
it will ask if you would like some help setting up your skip to the Creating a Mycroft Account section.
system. Unfortunately, this help doesn’t include setting
up wireless networking, so you’ll need to say nay here, Mycroft on your desktop
unless you’re using a wired connection for your Pi. For desktop Linux boxes, Mycroft provides a setup
If no network connection is found you’ll be script on GitHub that works on Debian, Ubuntu, Fedora
directed to a different script which will try to and Arch. It can be made to work on other distros, but
sort this out. For the basic Wi-Fi case (WPA or some manual setup will be required – the script will tell
WPA2 with a password), just choose the first you which libraries are missing and your job will be to
option and enter your network’s SSID and find the packages containing those. Whatever distro
password. For more complicated setups use you’re running, you’ll need Git to fetch the script. Grab
option 3 to edit the /etc/wpa_supplicant/wpa_ it with:
supplicant.conf file directly. $ cd ~
$ git clone https://github.com/MycroftAI/mycroft-
core.git
$ cd mycroft-core/
Then have a look at the dev_setup.sh script because
it’s imprudent to run random things from the internet
that are going to ask for root privileges, even if the folks
at Mycroft are a trustworthy bunch. You’ll see that the
script sets up a virtual environment so as not to
interfere with your Python installation. Once you’re
happy the script is kosher, run it with:
$ ./dev_setup.sh
You’ll be asked which branch you want to check out.
This is the screen The default master branch is considered more stable,
you’ll want to type so go with this one first. Later, if you’re feeling
your registration adventurous, you can try the development branch. Next
code into. We’re
pretty sure this one
you should allow the script to automatically update the
will have expired by repo, unless you have some reason not to. The next
press day. question asks whether you want to build the Mimic TTS

36 LXF249 May 2019 www.linuxformat.com


Open source smart home

(Text-to-speech) engine locally. This will take a long This means you can SSH into it from another
time on an older machine, but will be worth it if you machine with the following:
want Mycroft to talk to you during those dark times of $ ssh username@192.168.0.23
internet outage. Finally you’ll be asked whether to add If you’re talking to Picroft, the username
the Mycroft Helper command path to your profile; this will be pi and the password will no longer be
will make your life easier, so say yes here. All Mycroft mycroft because of course you diligently
commands begin with mycroft , so typing this then carried out our earlier instruction to change it
pressing Tab will help you manipulate it. You’ll be asked as soon as possible.
for a sudo password and then a quite considerable If the microphone level in the CLI doesn’t
number of packages will be downloaded and installed. respond, quit out of the CLI with Ctrl+C and The PS3 Eye works
You may see a warning about an outdated version of check the output of: out of the box with
Mycroft, even if
Pip (we noticed it on Ubuntu 18.04.2), but this is $ arecord -L
we are only using
apparently safe to ignore. If your mic is not detected, you will need to battle its PS3 ear. Image
Now we’re ready to run Mycroft for the first time, with sorting out your particular hardware – the fairly credit: Evan Amos/
which is done from the mycroft-core/ directory with ancient Playstation 3 Eye camera/mic is strongly public domain.
$ ./start-mycroft.sh debug recommended by the Mycroft team, and works out of
The debug option starts a command line interface the box. If on the other hand it is detected there, you
and shows extensive startup logs. Once everything’s may need to install and tweak Pulseaudio.
loaded, it will give you a unique six-character This is almost exclusively going to be a Pi issue since
registration code to pair this device with the Mycroft all major distros will have this already. It was necessary
Home service. Take a note of that because we’ll need it on our ReSpeaker HAT, so check the box below for
in a moment. There’s not a lot Mycroft can do until this some guidance. Bear in mind that you can always
pairing is complete. return to the CLI client with:
$ mycroft-cli-client
Creating a Mycroft account
Visit https://home.mycroft.ai, as the vocal prompts
should tell you if your speakers are working, to create SETTING UP THE RESPEAKER
an account from where your Mycroft devices can be
managed. Enter the pairing code and give your device The Seeed ReSpeaker 4-Mic Array Pi HAT is, as they say in the
a name and description. The CLI started earlier should business, a nifty bit of kit. As well as four microphones, it has twelve
acknowledge the new device, and you’ll be able to enter LEDs which can be used to indicate audio direction of arrival, or just
natural-language questions, commands (started with : to flash randomly and concerningly. It has GPIO and I2C connections
– type :help to see a list), or, audio setup permitting, so that other devices can be daisychained to it, or it can stack directly
speak directly to Mycroft through your microphone. onto Seeed’s GrovePi hub, allowing even more sensors to be
It will try to answer anything which you precede with connected. It uses the AC108 codec which at present isn’t supported
“Hey Mycroft”. by the Raspbian kernel, so we’ll need to install a custom one. Connect
At this point, you can continue with keyboard and to the Pi, either by SSH or keyboard, and quit the Mycroft CLI. Run
monitor plugged in, which is probably a good idea for the following commands:
the moment. However, if you’re planning on a headless git clone https://github.com/respeaker/seeed-voicecard.git
Mycroft Pi setup you’re going to be connecting to it cd seeed-voicecard
over SSH, so you may as well practise that now. You’ll sudo ./install.sh
need your Pi’s IP address, which you can either ask it The install script will chug along for a while, and eventually you’ll be
for directly or type: able to reboot and activate the new kernel with sudo reboot .
whats my ip address Reconnect if you were SSHing, then run sudo raspi-config to set
into the CLI – Mycroft doesn’t care about apostrophes, up the audio. Select ‘7. Advanced Options’, then ‘A4. Audio’, then
incidentally. It should respond vocally and output ‘1. Force 3.5mm jack’. Then reboot and enjoy.
something like If you run into difficulties you may need to install Pulseaudio and
>> My network I.P. address is 192 dot 168 dot 0 dot 23 restart Mycroft’s daemons, with:
$ sudo apt install pulseaudio
$ ./start-mycroft.sh all restart
If it still doesn’t work (and
remember, if in doubt a reboot
never hurts), the Pulseaudio
input device may need to be
changed. List the devices with
pactl list sources and then
change the default to match the
line beginning Name in the
output, with:
pactl set-default-source “alsa_
input.platform-soc_sound. The ReSpeaker is suitably equipped with
multichannel-input” twelve LEDs and four microphones. No
Mycroft’s glorious ASCII splash screen. Yet another opportunity for Cool turntables, though.
Retro Term to make an appearance.

www.techradar.com/pro/linux May 2019 LXF249 37


Open source smart home

ensmartening your home


We briefly connected Mycroft to LXF Towers’ notoriously decrepit central
heating via openHAB, but facilities manager Dave took a dim view of that…

esides being able to tell you your IP address, One of the most popular skills for Mycroft is openHAB

B Mycroft comes with a default set of Skills


which enable it to answer vocal questions such
(Home Automation Bus), which is a platform for talking
to all kinds of home appliances under a unified web
as: “What time it is?”, “What’s my location?” “What’s interface. It can communicate with a multitude of
the weather like?” or “What is the capital of Assyria?”. different devices, including other smart-home platforms
Strangely, despite the Assyrian kingdom being no more, such as Nest. Third-party add-ons can be added via the
the latter question was the only one it got right on our Eclipse Marketplace, which as we’ll see later enables us
first attempt – apparently Mycroft is not versed in to control the Hive smart thermostat, as used by British
Monty Python. These failings were due to the Wolfram Gas in the UK.
Alpha fallback skill guessing our location and timezone
from our IP address, specifically our local one beginning creatures of haBit
192, which belongs to no one and nowhere but which You can install the openHAB server on your Picroft
server or on a different machine. There’s a pre-rolled

control Your home devices


image called openHABian that you can run on a
different Pi: check it out at http://bit.ly/lxf249hab.

“One of the most popular skills for


On Ubuntu, or any Debian-like Linux, start by adding
the required GPG key and repo, as follows. To make

Mycroft is openHAB, a platform for


things easier, you can copy and paste this text from
http://bit.ly/lxf249hab2:

talking to all kinds of home appliances


$ wget -qO - ‘https://bintray.com/user/downloadSu
bjectPublicKey?username=openhab’ | sudo apt-key

under a unified web interface”


add -
$ echo ‘deb https://dl.bintray.com/openhab/apt-
repo2 stable main’ | sudo tee /etc/apt/sources.list.d/
for some reason Mycroft resolves to New York. This openhab2.list
conveniently derived the time to be five hours in the Next update the package lists and install openHAB:
past for us. You can change your location by setting $ sudo apt update
your location in your Mycroft Home profile. You can $ sudo apt install openhab2
also choose a username from here, to make logging in You may also wish to install the openhab2-addons
to the web portal easier. package, but add-ons can always be installed
Mycroft’s core skills also include a basic Hello World individually as needed from the openHAB web interface.
example, which responds to its title; “how are you”; Instructions for other distros and unstable releases can
and, rather graciously, “thank you”. This is intended to be found at http://bit.ly/lxf249hab2. Start openHAB
introduce people to programming their own skills. For and check that it’s alive with
Mycroft knows its
onions, as well as
fun and games try asking it to sing a song or tell a joke. $ sudo systemctl start openhab2
its capital cities of You can also ask it how to spell words, to tell jokes or to $ systemctl status openhab2
fallen kingdoms. check stock prices.
Java is a harsh mistress
If that didn’t work it could be due to your system
missing a Java runtime. This is exactly what happened
to us on our overburdened Picroft host, and we
remedied it with:
$ sudo apt install oracle-java8-jdk
$ sudo systemctl start openhab2
We were then able to connect to the web interface
by pointing our browser to http://192.168.0.23:8080
(admittedly, it took a couple of minutes). You’ll want to
change the part before 8080 to your openHAB host’s
IP address. Some initial configuration is required,
but the wizard will walk you through it. Before you
get really stuck in, do check out the thorough
documentation at www.openhab.org to troubleshoot
any niggles or find out more about the project – it’s
well worth a read.

38 LXF249 May 2019 www.linuxformat.com


Open source smart home

See the walkthrough below to find out how to


integrate a Hive smart(ish) thermostat with openHAB
and Mycroft. This is a bit of a roundabout process since
it involves first adding the third-party Eclipse Market
repository via an openHAB addon, and then adding the
Hive bindings from there. We’re using Chris Foot’s
experimental binding to do this, which you will find at
http://bit.ly/lxf29chris.

This is what the initial openHAB


setup screen looks like. We
recommend the Standard
package for most users.

CONNECT MYCROFT TO HIVE USING OPENHAB


OPENH

Add the add-on Add some more add-ons Browse the Eclipse market
1 Open a browser pointing to your 2 While you’re at it, have a look at the 3 With the Eclipse market integration
openHAB host on port 8080 – it’ll be the myriad other openHAB add-ons on offer. installed, several new add-ons appear in
same IP address as mentioned above. Note that add-ons are occasionally lost the Bindings section of openHAB’s add-
Navigate from Add-ons to the Misc section when the system updates, so on occasion ons catalogue. To view them it’s best to
and look for Eclipse IoT Market. Install it by you’ll need to reinstall them. The docs change to a denser layout (rather than a
clicking the button. For clarity, installing clearly say this is going to change in the long list) using the widget at the top-right.
anything from external sources should future. There’s an openHAB Android app Type market into the search box to see
always be done with caution. available on Google Play and F-Droid. Eclipse market entries only.

Install the Hive binding Mycroft, meet openHAB Crank up the heat
4 Locate Chris Foot’s ‘Hive from 5 Add the openHAB skill from the 6 For now, only changing the
British Gas Binding’ add-on and install it. Mycroft Marketplace at https://market. thermostat is supported. If you run into
In order to make it work you’ll need your mycroft.ai/skills. You’ll find it in the IoT difficulties check out the slightly older
Hive account details and an API key. This section along with bindings for Google AIY, project by Rob Kenny at http://bit.ly/
may require registration at the official site Home Assistant and other platforms. If lxf249hive. This aims to do more, but the
https://my.hivehome.com/login. Once you’re interested in learning more about project has been dormant since January
you’ve logged in you can generate an API what Hive can do, check out the official 2018. Still, there are some useful scripts
key and add these into the appropriate reference for Hive’s REST API at https:// that might help you better understand the
place for the add-on. developers.hive.com/reference. Hive interface.

www.techradar.com/pro/linux May 2019 LXF249 39


Open source smart home

augmenting our skill set


We take a look at some more Mycroft skill-duggery and peer into the
future of its development.
urther skills can be found from the Mycroft greeted with a successful connection message. Don’t

F Marketplace at https://market.mycroft.ai/
skills – don’t worry, they’re free). You can
forget to click Save at the top of the page to yet again
confirm your intent. This second confirmation is
install them directly from there, verbally with something necessary because besides the API connection to
like “Hey Mycroft install coinflip”, or manually at the Spotify, which is done by an OAuth, a further device
Mycroft CLI. You can also install skills from the authentication is necessary, which requires the Skill to
mycroft-skills GitHub repo. You’ll also find excellent retain your Spotify credentials. See the documentation
documentation on how to write your own there. at http://bit.ly/lxf249spotify4 if you want to log in via
If you have a Spotify Premium account, there’s a Facebook, or generally find out more about the project.
skill for that. You can either play tracks through other You can now ask (or type into the CLI) queries such
devices via Spotify Connect, or play them through as “What Spotify devices are available”, “Show my
whatever Mycroft’s running on. Add the Spotify skill playlists”, or “What song is this”. You can also issue
from the Marketplace; you should see a message like demands, for example “Play discover weekly”, “Play Get
INFO - Will install [‘mycroft-spotify’] from the Free by Major Lazer” (not again!–Ed) and “Stop playing”.
marketplace In the Skills configuration page in your Mycroft Profile,
in the CLI. Before you can use the Spotify skill, you’ll under Remote Control Device you can also change the
need to enter some credentials. In the links to the left of default playback device, having Spotify stream to your
the Marketplace, navigate to My Account > Profile. Mycroft device, if you like.
From here follow the Skills link at the top of the page. Interestingly, just as we complete this feature, some
Scroll down to the Spotify Skill section and enter your big news has surfaced in the voice recognition world.
Spotify credentials. You’ll be asked to bestow Mozilla has just released, under a Creative Commons
permissions on our Mycroft skill, and hopefully will be licence, version 2.0 of the Common Voice dataset.
This includes thousands of hours of matched audio
and transcription in 18 different languages, including
openHab and otHer pLatForms Welsh (lechyd da!–Ed). It enables smaller projects
access to an open dataset the like of which was
We’ve barely scratched the surface of what openHAB is capable of, previously only available to large companies.
but it’s just one of a number of platforms that can interoperate to one Mycroft has its own anonymous voice-data
degree or another among themselves and indeed Mycroft. collection feature, which you can opt into at the bottom
For example, there’s a Minecraft plug-in for openHAB, so you can of the Basic Settings on the Mycroft Account page.
control actual devices in your house from the voxellated world of the Looking ahead, the company will likely incorporate the
game. It uses the popular SpigotMC plug-in – look it up. You can also Common Voice data into the collaboration it already
use openHAB to communicate with Nest devices and Amazon Echo. has with the Mozilla DeepSpeech team (https://
We could actually write a whole feature spanning the diverse research.mozilla.org/machine-learning). One day
selection of robots and circuits it’s capable of interfacing with (well, the goal is for DeepSpeech to be the default Speech to
if you’re offering… – Ed). Text (STT) engine in Mycroft, but at present it requires
There’s also a Mycroft skill for controlling devices connected via considerable GPU power to run at adequate speeds. In
the popular open source Home Assistant platform (www.home- future this can be farmed-out to the cloud, and indeed
assistant.io), which can talk to all sorts of things like Sonos audio Mycroft already has a pool of GPU-heavy machines that
systems, Alexa, Google Assistant and Z-Wave devices. Like openHAB, can take care of the grunt work for ML-savvy Mycroft
Home Assistant has a smartphone app and offers a handy web
interface – and we could probably devote a whole lot more space to it
than these three sentences.
Google Assistant has its own Python library. Naturally we’d rather
you used something that didn’t come from Mountain View, but since
you may already be using it, maybe you’ll be interested in hacking it.
You can check out the sample code at http://bit.ly/lxf249python 3.

The Mycroft
add-ons page
has several IoT
offerings, and
there are several
platforms outside
of Mycroft. The Spotify skill unfortunately won’t pay your Spotify bill. But it does
need some access to your account.
3) https://github.com/googlesamples/assistant-sdk-python/
4) https://github.com/forslund/spotify-skill

40 LXF249 May 2019 www.linuxformat.com


Open source smart home

all too often fails to make head nor tail of the noises that
come afterward. That said, Precise is already being
used elsewhere. A particularly interesting use case is
Sickweather (www.sickweather.com). The site has
been using it to track coughs and sneezes in public
places, particularly on transport. With reliable data, and
enough of it, the goal is to map and predict outbreaks of
flu and other diseases – a veritable Sickness Forecast,
hence the name. It’s quite bizarre, we think, that a tool
ostensibly focussed so strongly on spoken words is
finding use in the much more general field of hacking
There must be an awful lot of phonemes, glottal stops and pulmonic and croaking noises.
consonants in so much audio data. We trust Mycroft and Mozilla and everyone else
working on this for the good of open source, but it’s
users. In the meantime, those made of really strong hard not to be a little creeped-out at voice data being
stuff may want to run their own DeepSpeech instance. harvested. We already share far more than we should
At the beginning of this tutorial, we mentioned the with the internet through Facebook and Google and
Adapt intent parser. A new intent parser, Padatious – friends. As voice becomes an ever more popular choice
based on neural networks and machine learning and all for interacting with the Internet and the Things
that jazz – is currently being developed by Mycroft. connected to it in your home, surely we will be sharing
Where Adapt focuses on small groups of words and more and more sensitive information with the services
tries to extract intent from them and the relationships they connect to.
between them, Padatious analyses whole sentences. That is troublesome if data turns out not to be
According to Mycroft it’s likely that Padatious will sufficiently anonymised. And on that vaguely
replace Adapt on some platforms, presumably ones despondent note, we’ll sign off before the small army
with sufficient algorithmic horse power. of Picroft machines we set up in the LXF Towers
Unlike closed source assistants, we can be basement gets caught up in an awful feedback loop
reasonably sure Mycroft isn’t listening to us at all times. and destroys us all.
More precisely, it is listening at all times, but any audio it
picks up before the wake word is discarded.
A corollary of this is that without the wake word,
everything is discarded. The default engine that listens
for the wake word is called PocketSphinx, but an
alternative, Precise, is available (see http://bit.ly/
lxf249precise 5). Precise is much more, uh, accurate The more we look
and is based on data collected from Mycroft users who at it, the more that
have opted-in to the data collection mentioned above. cutesy smile starts
to take on a bit of
At present, Precise is used only as a wake word an air of Clippy,
detector. That’s why you may become suspicious that the ever-helpful
Mycroft is so swift at responding to “Hey Mycroft” but paperclip.

revisiting tHe respeaker

enable the sPi bus Blink some leds help us!


1 The twelve LEDs on the ReSpeaker  2 Grab the ReSpeaker code and install 3 We couldn’t get the Direction of
are connected over the Pi’s SPI bus. some low-level Python dependencies: Arrival (DoA) code from the mic_array
This needs to be enabled before we   $ git clone https://github.com/ repo working. Changing Queue to queue  
can communicate using it. Run: respeaker/4mics_hat.git in lines 4 and 25 of mic_array.py was a 
$ sudo raspi-config $ pip install spidev gpiozero good start. Then this code:
Then select Interfacing Options > SPI  Run the demo ‘blinkenlights’ with:  $ cd ~/mic_array/
and select ‘Enable SPI’. $ cd ~/4mics_hat/ $ python vad_doa.py
$ python pixels_demo.py displayed direction in the CLI, but did not 
light up our LEDs. Any ideas?
5) https://mycroft.ai/documentation/precise/

www.techradar.com/pro/linux May 2019 LXF249   41


IntervIew Omoju Miller

on her talk…
“It’s a new vision for
the global brain – deep
learning with humans
instead of machines.”

Human computIng
macHIne learnIng
Never one to turn down talking about high-powered
programming over biscuits and coffee, Jonni Bidwell 
meets the multitalented Omoju Miller.

42 LXF249 May 2019 www.linuxformat.com


Omoju Miller IntervIew

moju Miller is a Machine

o
Learning Engineer at GitHub. The master and
She holds a PhD from the the Padawan.
University of California,
Berkeley (which, apart from its academic
excellence, she chose for its proximity
to Skywalker Ranch). While studying for
this part-time, as well being a mother,
she worked as an expert at Google for
its non-profit fund for Computer Science
Education. We were lucky enough to
catch up with her at O’Reilly’s Velocity
conference in London, October 2018.

linux Format: Tell us about your data


science work at GitHub.
omoju miller: At GitHub I am part of the
Machine Learning team, which is a part of
the Platform Engineering team. I work on
building deep learning models. Let me dial lXF: Your talk had an interesting title: was happening. But now that we know
that back, actually… “A new vision for the global brain: that that’s the case, instead of thinking
My job is to use data to supercharge Deep learning with people instead of about it as some evil monster, something
our services. So we have all these different machines”. Can you give our readers a hideous, what if we actually bought into it
data sources and we’re trying to learn summary of it? and then co-opted that same network and
which approaches will be useful to engage om: I trained as a classical computer architecture to solve different kinds
in certain kinds of products. So for scientist who then did some work on of problems?
example, the last project I was working on, Intelligent Systems, specifically on What if we generated that same
and probably am still working on, is about Knowledge Representation. That’s architecture and decided we want to use
understanding the fundamental nature of knowledge representation and reasoning it to solve certain societal problems?
code and how to represent that. of the semantic web. From doing that Maybe what you want to do is create
It’s a bit of applied research, because if work I wanted to understand further how more empathy, maybe you want to do
we can understand how to represent code humans acquired computation. something to do something towards
in some sort of vectorised space, then we Doing work in those two areas helped reducing the impact of poverty, maybe
can answer questions like “Is this piece of me understand that we could actually you want to do something towards climate
code similar to that piece of code?” and we abstract away reasoning from the change. We then figure out what is the loss
can do things like code provenance: “Who computational substrate. It could be a function, and how we can measure if we’re
first wrote this function?”. All these things human being carrying out the computation getting close to achieving our goal.
could come from this understanding, so or it could be some other computational If we can figure out how to measure it
that’s what I’m working towards. device, like a machine. If that’s the case then we can back-propagate certain kinds
I work on other things that are more then we know we can do this, and we’ve of actions across this distributed platform
straightforward – there’s an immediate seen examples of us doing this and and get us there. Basically it’s a new vision
application to a product. Some things understanding the framework and the for the global brain – deep learning with
are more “We have to do this because architecture of a deep learning system. humans instead of machines. Also we want
it’s going to help us on our roadmap”, We realised there is a close facsimile to not necessarily be afraid of the global
and if we eventually get there, say in 18 to how multinational corporations run brain – it can be used to do something far
months, then we can really supercharge themselves. They have this hierarchy more powerful that will not be deleterious
our products. So what I do is really Applied with the CEO on top, all the way down to to society. We should take it and use it to
Mathematics plus common sense and employees. And all these companies kind our own ends.
usefulness in the real world. of run themselves on Objectives and Key
Results (OKRs). So they have some sort of lXF: This is fascinating. I wrote an
goals that they want to achieve, they’ve set introductory machine learning feature
it out, they’ve figured out how to measure [see lXF236] so it’s interesting to hear
it, and each person does something how far these things can be abstracted
towards making sure that that goal occurs. beyond recognition. I hear you’re an
And they iterate over and over again. adviser to the World Economic Forum
You can take that same idea and on this subject too?
extrapolate it to a social network. It’s the om: Not officially an adviser, but I’m part
same thing. In the social network context, of its AI and Robotics Expert Network
we realised that you can actually influence [see http://bit.ly/lxf249ai 1]. The idea
human behaviour by levelling those same is they ask really big questions and want
constructs. There’s something you want this group of experts to chime in. I get their
to do, you can run experiments and there’ll emails, I read them – sometimes I chime
be some outcomes that the humans will in, sometimes I don’t. But if one has time
carry out. Unwittingly most of the humans it’s a very good place to speak with one’s
on the social network didn’t realise this peers, to talk on ideas, and to actually
1) https://www.weforum.org/agenda/archive/artificial-intelligence-and-robotics

www.techradar.com/pro/linux May 2019 LXF249 43


IntervIew Omoju Miller

see what other people are doing. More they really? The first AI class I took was if we can figure out the nature of humans
importantly, for me, is to get a view outside a sort of cognitive science seminar; it that would be like a scientific way to
of just AI. What are people thinking about was a different kind of thing because question the existential. So I thought this
in education? What are people thinking it gave a sort of historic precedence of was all fascinating, and that was it, I just
about in public health? That kind of thing. why this whole thing started. It went wanted to do that. It’s like metaphysical
And then seeing what kind of initiatives the all the way back into an exploration of exploration but from a scientific stance.
World Economic Forum is up to. the metaphysical, and how humanity I didn’t really think of it as machine learning
questioned the nature of reality, why we or AI.
lXF: What made you specialise in artificial are here and if there is a god, and how
intelligence and machine learning? those lines of inquiry led to the founding of lXF: Was it more of a continuation
om: I was already fascinated with mathematics, to the founding of physics. of some bigger journey?
Computer Science, but I became even Mathematics were a way to separate om: Right. Basically I thought it was really
more fascinated when I discovered AI, and what we know from what we don’t know interesting, but it turns out it’s also really
it was specifically for one reason… In high and make inferences. We continued down useful too.
school, you know, you get your math book. that path all the way down to logic, all the
If you’re learning Pythagoras’ theorem way to von Neumann machines, to the lXF: I’m quite interested in computer
there will be a picture of Pythagoras and invention of computers and all that kind science education, so let’s continue
a little blurb about his life. I was always of stuff. It’s just a natural progression, with that theme. I enjoyed your TEDx
fascinated about all these people in logic machines to AI. It’s the same quest talk about dispelling “The myth of the
these books – what kind of people were of figuring out the nature of humans, and innate ability in tech” [see http://bit.ly/
lxf249tedx 2], particularly as it applies
to coding. What is wrong with this idea,
becomIng non-toXIc that when someone shows some inkling
of being good at maths, or whatever, that
lXF: Open source has become quite justice? Like reform and work with the we then think, oh they’re gifted, they’re
popular, and unfortunately that has community to bring them back. That definitely going to be a good coder?
brought with it some pretty toxic seems healthier than kicking people om: So this myth, I don’t think we quite put
behaviour in some communities. What out, which doesn’t help anybody. that term to it, but what we’re saying is it’s
do you think we can do to further Something else I’m interested in essentially biological determinism. We’re
address this problem? deeply: can we do some research to saying some people are born with a special
om: I think we have to have very strong see the genesis of communities and genome that gives them a special ability to
codes of conduct and very strong what are the leading indicators of a do computationally rigourous work, while
community and safety teams. It might community becoming toxic? Then we others can’t. It’s the same idea behind
seem strange, because open source can we nip those things in the bud. people that say “I’m a math person” or “I’m
is open source – there’s not someone Another thing is that it’s quite not a math person”.
sitting there working full time [in every difficult to figure out what is toxic There’s no such thing as predisposition
project]. However, there are some open and what isn’t, because it’s often to mathematics or computation or
source projects that have grants and community-dependent. Sometimes to reading. It’s about how we haven’t
actually do have full-time employees. certain behaviour isn’t toxic in one done enough research in education to
When a project gets to that stage, I community because it’s the norm, actually understand how people acquire
think they need to prioritise having a and it doesn’t marginalise or ostracise computation. They acquire knowledge in
community and safety team: a group anybody. But when someone from that two modes: an emotional path and a logical
of people whose whole job is to curate community joins another and carries path. These two paths have to weave
the culture and set the tone for what is that norm over, it might be toxic in this together for the knowledge to seep into a
acceptable and what is not acceptable. new community. human being. Human beings are embodied
And then something radical, which How can we change this? By doing creatures and they are deeply emotional;
I would like to see more of: instead research in this area, hard-core the concepts that they have in their minds
of banning people from projects, research and datamining, and then  are emotionally mediated as well.
what if we did things like restorative  acting on that research. Even in the language we use, when
you think of falling in love, you think of
love as warm and the absence of love
as cold. These are deeply emotionally
triggered concepts and it’s related first to
the warmth felt by the baby inside their
mother’s womb. Later, when the baby
is laid on the mother’s chest, warmth is
transferred from mother to child. If the
baby is put down, then the heat dissipates
and the baby doesn’t like that.
And that is one of our first associations
with something negative, that loss of heat,
that cold. We humans try and cheat that
by swaddling, we’re trying to trap some
of that heat. This is how we learn and it’s
deeply wired into our brain. When it comes
2) www.youtube.com/watch?v=BFWVHSeakkg

44 LXF249 May 2019 www.linuxformat.com


Omoju Miller IntervIew

to quantitative subjects like mathematics, content on an education platform. We


the same mechanism is still at work. already see that happening – it’s called
However, if it is introduced in a way that GitHub. There are tons of people on
incites some kind of anxiety or fright or GitHub learning, they’re just doing it in an
discomfort, that overrides your capacity to ad hoc and natural way, because they can
integrate with the logical. Certain people pull all the materials in there, they share
might not have had that lock applied – it it with each other and they can create for
was introduced to them in ways that did each other. It’s slowly becoming a thing,
not elicit those emotions, so it was easier but it’s still not a traditional school.
for them to acquire math skills. We’re in this weird space where we
But that is the root cause, why as a know that the future is different, yet we’re
society we have decided “I am a math still trapped in the society of the present,
person” or “I am not a math person”. that we kind of know isn’t going to work. Omoju believes
everyone has the
We have this weird, bizarre myth now We’re in this transitional phase and it’s aptitude for maths.
that those math people are just two per very challenging, but at some point we’re
cent of the world’s population. That’s going to have to change the way schools
not enough to do computational work: are organised. no longer relevant. There may still be
software is eating the world. Most jobs at enemies of open source out there, but
some point will require some knowledge lXF: Microsoft acquired GitHub and I’ve times have changed and patent litigation
about software, and we can’t run a modern just had a long chat with Microsoft CTO or anti-competitive behaviour are no
society on two per cent. James Turnbull about that [in October longer viable strategies.
So at some point we have to get as 2018]. The whole GitHub ecosystem will om: Open source is not going to slow down,
many people in the door as possible, and bring a lot to Microsoft, but what do you it’s only going to accelerate even more.
that means we need to break down these think Microsoft can bring to GitHub? The growth of GitHub’s platform has been
myths. Then people will see themselves om: Financial stability: GitHub will no longer astonishing. In October 2017 we had a sort
differently, and actually understand “I have to worry about its future financially. of ‘state of the world’ conference at GitHub.
feel anxious, this has nothing to do with That means it can focus exclusively on There were 21 million developers then, and
my ability to learn. It doesn’t mean I’m a creating the best product out there for now [one year later], there’s 31 million.
failure, it just means I didn’t acquire that developer tools, and actually achieve the That’s a lot of new people on that platform.
knowledge yet. Let me try again”. So we mission that it set
need more education and research to out for itself.
really understand how people learn and So it’s an on changing education…
“We’re in this weird space where
to apply what we do know when we’re audacious drive
writing curricula and deciding how certain towards achieving

we know that the future is


subjects are introduced in schools. our mission now
– we don’t have to
lXF: Can we use artificial intelligence
different, yet we’re still trapped
worry about if we’ll
to help us do this? be able to keep the
om: We actually can. The challenge is to
in the society of the present.”
lights on. And also
have a dataset that is large enough that we don’t need to
you can tease all these things apart. And worry about trying
that means you also have to perhaps to generate ten-times growth, because If that trend continues, we’re going to see
deliver some forms of the knowledge when you’re venture-backed your venture very interesting things emerge from that
capital partners have certain requirements platform.
of you. But when you’re an independent GitHub is basically the reason why
subsidiary of a company that sees value in machine learning has been able to
the community that you are building, then advance as fast as it has. GH is ten years
you can lean deeper into that. old, and a lot of machine learning rests
We’re going to see a different kind of on open source.
GitHub for the better: much more shipping TensorFlow, the deep learning
of products, much more excitement from framework from Google, is one of the
people who use it – enterprise as well most popular repos on GitHub. But before
as independent developers. Because TensorFlow could be built, there had to
Microsoft is already one of the leading be NumPy [the numerical computation
contributors to open source. They’re package for Python], another open source
already doing it – I think Visual Studio Code project hosted on GitHub, there had to be
is one of the top IDEs now. It’s a different SciPy, there had to be MatPlotLib, there
kind of Microsoft now, they just open had to be pandas [not the animal – the
sourced a bunch of their patents – 60,000 Python data analysis package].
of them, in fact. All these things are open source, and
these are all the things that created the
lXF: There’s still plenty of anti-Microsoft ability for there to be PyTorch, TensorFlow
Microsoft is a force
for good with GitHub, sentiment in the Linux community, and and everything else that we’re seeing now
says Omoju. I daresay within our readership too, come to scale. I think we’re going to see
but I think that’s an old grudge that’s more and more of that.

www.techradar.com/pro/linux May 2019 LXF249   45


in-depth Arch Linux

Arch Linux Tips


Jonni Bidwell has spent years perfecting his Arch install,
and he’s begrudgingly going to share some insights…
ou’ve carefully followed the study this list, and the Arch Wiki is truly one

Y lengthy install guide on the Arch


Wiki and installed Arch Linux.
Amazingly (or maybe as a result
of the greatest Linux resources (alongside
LXF?–Ed) out there. But if you want the LXF
lowdown on how to quickly get going after a
of hair pulling, shouting or other creative successful install, read on!
problem solving), everything works – We won’t presume you’re an Arch expert, 
network, display, your keymap is even but even if you are you might find some
correct. You’re all ready to use your fresh handy tips to get your setup closer to
new install, but all it does is boot to a perfection. For this tutorial we’re going to
terminal prompt. This is, of course, expected assume you’ve got a working Arch install.
behaviour: Arch is what you make it, after all. We’ll further assume you’ve done some
But some guidance, after this arduous bread-and-butter setup tasks: setting up a
installation pilgrimage, on exactly what it can user, local mirrors, networking and getting all
be made into might be helpful. You go back your partitions set up in /etc/fstab. All this
to the Arch Wiki, but the post-installation is in the Arch Wiki if you need guidance – we 
section links you to a somewhat will often refer you there throughout this
overwhelming list of ‘general article where appropriate, rather than 
recommendations’. You should certainly parroting its contents.

46 LXF249 May 2019 www.linuxformat.com


Arch Linux in-depth

ne way that Arch (and in fact all other rolling

O distros) differs from Ubuntu is that it’s critically


important to update the whole system
whenever you install a new package, since that new
package will have been compiled against the current
Arch package tree. So it won’t work if the libraries it
depends on, and is linked to, aren’t updated in lock-
step. Keeping your system up to date is good practice
anyway, so make sure you do:
# pacman -Syu
once in a while, and certainly before installing anything.
The y means sYnc all repos and the u stands for
Update all packages. Remember, we use the #
prompt instead of $ to denote commands run as root,
as opposed to a general user. You’ll have set up the root
account during the install process, and you can use it
using the su command and the password you set up
during installation (not your user password). By default
the sudo command, as used by Ubuntu and now
Fedora, isn’t installed, although this is handy –
particularly for AUR helpers – so we’ll cover setting the user or another program. The most common The combination
that up below. problem is the X Server itself trying to load its nouveau of Powerline and
Cool Retro Term
module, which then loads the kernel module, which
will strike fear
Graphics drivers then has a hissy fit because the proprietary module is into the souls of
If you have an AMD/Nvidia graphics card from the last claiming its hardware. Anyway, one way around this is passing editors
decade (and perhaps even older), the open source to create an xorg.conf snippet. Create this with: asking where
radeon for AMD (formerly ATI) cards or nouveau # nano /etc/X11/xorg.conf.d/20-nvidia.conf your feature is.
drivers will almost certainly work out of the box for and populate the file with:
you. This is even more likely to be true of integrated Section “Device”
graphics, using the intel driver. This is what enables Identifier “Nvidia 1080GTX”
the console to display in your monitor’s native Driver “nvidia”
resolution, rather than the old fashioned 80x25. Be EndSection
that as it may, you’ll still need to install the relevant The identifier string doesn’t affect anything, it’s just
DDX (Device Dependent X) driver to get 2D acceleration used as a label. If you’re in the converse situation, and
in X, and the Mesa drivers for 3D acceleration. would like the Nouveau driver back, changing the driver
If you have a more recent AMD card (Volcanic to nouveau may help you. You’d probably want to
Islands, GCN 1.2 or later), the open source AMDGPU uninstall the nvidia package altogether, to be sure.
driver will be used, and if you have a not quite so recent
AMD card (Sea/Southern Islands, GCN 1.0), you may
want to enable the AMDGPU driver anyway – we’ll get Sudo, you know
to that in a second. If you have an Nvidia card and
would like to do gaming, you’ll probably want to install Installing Sudo is just a matter of:
the dastardly proprietary driver, which is actually much # pacman -S sudo
easier to do on Arch than it is on Ubuntu and friends. In but for it to be useful we’ll need to give our user sudo access. This
fact, all you need is: involves editing the /etc/sudoers file, which for safety we’ll do using
# pacman -S nvidia the visudo wrapper. This will check any modifications that we make,
Of course, nothing’s ever that simple, and if you were since a typo here could result in us losing sudo access. This isn’t an
to reboot right away there’s a small possibility that your issue on Arch (at least while we still have root access), but can be
display manager (if you’ve installed one) would fail to catastrophic on other distros. Also, don’t worry if the ‘vi’ part of
start. This would be because both proprietary and visudo sent a shiver down your spine – you can use whichever editor
Nouveau modules would be loaded, and the display you want to edit the file (hey, I’m an editor – Ed). Let’s use Nano, for
server would get confused about which one to use – instance:
either giving up with the classic ‘No screens found’ # EDITOR=nano visudo
error, or more commonly just displaying a blank screen. There’s a whole complicated syntax to this file (the Arch Wiki will tell
If you do find yourself in blank screen land, it’s you all about it), but if you just want to let your user run commands
always worth trying to get to a TTY terminal with with the root password (not their user password, although that can 
Ctrl+Alt+F2 before reaching for the power button. be arranged too), all you need to do is add the line:
Sometimes this works and sometimes it doesn’t; it username ALL=(ALL) ALL
depends if the keyboard has been grabbed by a partially replacing username with your username, somewhere around the
loaded display server or not. At any rate, if it doesn’t, section headed #User privilege specification . Now leave Nano with
always try repeatedly hitting Ctrl+Alt+Del to force a Ctrl+X, then Y to save. Assuming you’ve obeyed the syntax, visudo
graceful reboot rather than risking your data. won’t shout at you and your sudo configuration will be updated.
The nvidia package actually installs a file to blacklist Unlike changing group permissions, there’s no need to log out and 
the nouveau module, but blacklisting sometimes isn’t log back in again for these changes to take effect.
enough; the module can still be loaded if requested by

www.techradar.com/pro/linux May 2019 LXF249   47


in-depth Arch Linux

One of the most exciting features in Kernel 5.0 is You can achieve a lot from the terminal, but many
AMD’s FreeSync, which enables variable refresh rates users will be desirous of installing some sort of desktop
on suitably expensive GPUs and displays. If you are environment. One of the main draws of Arch Linux is
lucky enough to have such technologies, Arch Linux is access to the latest Gnome/KDE/Cinnamon/<insert
a great place to test them out. You won’t need to mess your favourite DE here> goodness. What is less known
around with patching kernels, PPAs or custom Mesa is that Arch provides opportunities to customise the
builds to get everything working – everything’s already software selections of most of these. If you’ve done a
in the repos, awaiting your download. little distro-hopping, you’ll have some idea of the
Assuming you’ve already got a working desktop with different ways that things can be arranged in GNOME
the xf86-video-amdgpu driver installed, you’re halfway and KDE Plasma (and Xfce, MATE, and all the others).
there. We just need a minimal xorg.conf snippet which You’ll likely also be aware of the applications bundled
frobs the required option. So create /etc/X11/xorg. with each desktop, and may have been frustrated when
conf.d/20-amdgpu-freesync.conf and fill it with: trying to trim this down. Ubuntu has done quite well at
Section “Device” providing a good but not excessive selection of GNOME
Identifier “AMD RX590” applications. But if you naively try to remove Evolution
Driver “amdgpu” (or anything related to it), watch Apt threaten to tear
Option “DRI” “3” your system asunder.
Option “VariableRefresh” “true” In Arch, the base GNOME desktop and the core
EndSection applications are encompassed by the gnome package
It’s early days for FreeSync on Linux; at the time of group. Another group, gnome-extra, includes extra
writing, the feature is disabled for browsers, video games and utilities. Entering pacman -S gnome will
players and desktop compositors. Still, Linux gamers offer to install the 65-package entirety of the core
are reporting FreeSync success for OpenGL games. group, which you can do by just pressing Return.
Alternatively you can slim down the selection – for
New versions of KDE Frameworks,
instance, you may not be interested in GNOME Maps/
Applications and Plasma land in Music/Photos/Todo, or you may not like Tracker
Arch pretty swiftly. indexing all your files.
The previous command shows each package with a
number next to it, and you can enter a space-separated
list of these numbers, and/or ranges, to pare things
back. If you’re not sure what a package is, query it with
pacman -Si packagename . As in most other distros,
GNOME defaults to using Wayland where possible,
falling back to X if things go awry.
To boot to the graphical login screen enable the gdm
systemd service with:
# systemctl enable gdm
KDE doesn’t have its own login manager, though SDDM
(Simple Desktop Display Manager) is the de facto
choice. One consequence of forgetting this detail is that
it’s possible to install a myriad of KDE-related packages
It’S the LIttLe thIngS and still not have anything like a functioning desktop,
since the display server (X.org or Wayland)
It’s hard to overestimate all the fine-tuning that goes into Ubuntu, dependencies are only pulled in by the display manager.
Manjaro or any other desktop-centric distribution. Recreating some of So first install that with pacman -S sddm and enable
those tweaks in Arch is tricky, but some of them are small things that it with systemctl enable sddm . Like GNOME, KDE
make surprisingly big differences. Plasma – the proper name for the desktop produced
For example, your command line life will be markedly improved if by the KDE community – can be installed as a package
you install the bash-completion package, which provides tab group with pacman -S plasma . Alternatively, just
completion for most commands. Note that you get filename installing the plasma-desktop package provides a
completion in Bash as standard – this package intelligently completes foundation for a more minimal installation. Unlike
command options, which is tremendously useful if you’re delving into GNOME, KDE applications are entirely decoupled
unfamiliar systemd or Qemu incantations. from the desktop, so you’ll want to peruse the ‘kde-
In our Arch-based distos roundup in LXF246, we found some great applications’ group to see what you need. This group
features in Antergos, ArchLabs, KaOS, Netrunner Rolling and Manjaro. has 161 packages in total, but if you just need a
Some of these would be hard to recreate from scratch, like ArchLabs’ terminal, file manager, photo/document viewers
stylish Openbox/Polybar/tint2 combo. But some are easy. If you and other basic utilities then start with:
want the Octopi or Pamac graphical package managers, they’re # pacman -S konsole dolphin kate gwenview okular
available straight from the AUR. Just follow our guide to setting that ark kcalc
up and then do pikaur -S octopi , for example. Alternatively, we can use metapackages. These
If you like Antergos’ glorious Numix GTK theme, that can be yours behave very much like groups, insofar as you can refer
with pacman -S numix-gtk-theme . Powerline is a plug-in for Vim, to a bunch of packages by a single name, but they differ
but it can also be used, as it is in KaOS, to jazz up your terminal. in that they are dynamic. If someone on Team Arch
Check out the wiki page at http://bit.ly/lxf249powerline for how. decides to add a package to the ‘plasma’ group, for
example, that package won’t magically appear on

48 LXF249 May 2019 www.linuxformat.com


Arch Linux in-depth

systems which had that group installed previously, Manjaro’s graphical


unless the user explicitly reinstalls the group. If the package manager
Pamac can be
same thing happened with the ‘plasma-meta’
yours, and so can
metapackage, the new package would appear. You GNOME’s emoji
can’t pick and choose individual packages from a selection widget.
metapackage, so they are in this sense less flexible;
however the way they’re used to package the KDE
application suite is particularly nice.
KDE applications are divided into categories (see
https://kde.org/applications), and in Arch each
category has its own metapackage, such as
kdegraphics-meta and kdeedu-meta. Since the kde-
applications-meta package depends on all of these
metapackages, we can get away with calling them
submetapackages. Nomenclature aside, they provide a
neat way to ensure your KDE install has the latest apps.
replacement. You can still use this if you want, but it’s
An unmistakable Aura unmaintained, has security issues, and there are plenty
Besides minimalism, bleeding-edge packages and of alternatives.
street cred, one of the main draws to Arch is the AUR ArchLabs used to use PacAUR, but has now
(Arch User Repository). Here you can find community- switched to its own helper, Baph. The Arch Wiki has a
provided packages for software that for one reason or whole page dedicated to AUR helpers (https://wiki.
another hasn’t made it into the official repos. This might archlinux.org/index.php/AUR_helpers), with a
be because of licensing reasons: Spotify and Google comprehensive list of their features. Here you’ll also
Chrome can’t be redistributed, for instance, but having learn that no AUR helper is officially supported by Arch,
a ‘source’ package that downloads the official binaries so you’ll need to install one the manual way, by
and packages them locally is fine. Or there might be downloading PKGBUILD files and so forth. We’ll cover
complexities running them in certain situations: setting up PikAur (https://github.com/actionless/
Canonical’s Snap packaging system, for instance. pikaur), which is written in Python, has minimal
It’s also a staging ground for packages that one day dependencies and like Yaourt before it, uses Pacman
might make it into the official repos, and users can vote syntax for ease of use. The best way to install PikAUR
in order to influence this. In order to use the AUR, we’ll is by using Git, and then makepkg to make a package
need the base-devel package group, which includes suitable for Pacman to digest. We’ll start by installing
compilers, configurators, parsers and all the helper
utilities required to build from source. Once we’ve got
that, all that’s required is to download the relevant The Arch user repOsiTOrY
“Besides minimalism, bleeding-edge
PKGBUILD (a text file that describes an Arch Linux
package) from the AUR, and use Pacman’s makepkg

packages and street cred, one of the


utility to bundle it into a package that can be installed
with pacman -U mypackage-x86_64.pkg.tar.xz .

main draws to Arch is the AUR”


This seems fairly straightforward, but unfortunately
the process can become quite laborious. For one thing
the makepkg command on its own won’t install
dependencies automatically. Fair enough; just add the the base-devel group and Git itself:
-s switch. Problem solved… except that AUR packages # pacman -S --needed base-devel git
can depend on other AUR packages, which makepkg The --needed switch won’t reinstall them if they’re
won’t help you with. So we’ll show you how to set up already there. Now we’ll go ahead and clone the pikaur
one of many AUR helpers. For a long time Yaourt (Yet repo, which you can do as a regular user:
AnOther User Repository Tool) was the utility of choice $ git clone https://aur.archlinux.org/pikaur.git
here. It was great, mostly because it had the same Then we can dive in and make the package (also as a
syntax as Pacman and so could be used as a drop-in regular user):
$ cd pikaur
$ makepkg -fsri
The -f switch overwrites any previous package files
in this directory – useful if you’ve tried to build the
package previously and it has failed. The -s installs any
dependencies, the -r removes any that are no longer
required after the package is built, and the -i installs
the package. These last three options require Sudo to
be installed, since running makepkg itself as root is
not allowed. If you don’t have or don’t want to have
Sudo installed, you can perform those steps manually.
Incidentally pacman -Qdt is a very useful command
It may look like regular Firefox, but it’s actually Fedora’s Wayland for listing dependencies that are no longer needed.
edition, available in binary form from the AUR. Happy archery!

www.techradar.com/pro/linux May 2019 LXF249  49


Pi USER
Les Pounder
works with groups Quantum computing
on the Raspberry Pi?
such as the
Raspberry Pi
Foundation to help
boost people’s
maker skills.

The power of the tiny qubit comes to the tiniest of


Pi 4 LIFE computer platforms, sort of, kind of…
In 2012 I first held a Raspberry Pi, he alluring promise of quantum hardware, IBM created a cloud-based
little knowing how much it would
change my life. Over these seven
T computing is one that’s been
dangling tantalisingly closely for the
quantum computer simulation (http://bit.
ly/lxf249ibm), which at least enables
years, the Raspberry Pi has last decade, and is fuel for conspiracy budding developers to test out quantum-
disrupted the market, brought theories about ‘dark’ NSA computing units based code. In LXF237 we even looked at how
the cost of a single board and projects set to crack your encryption. desktop Linux users can get involved.
computer down to £35 and kept In the absence of actual real qubit-packing But what if you want a quantum emulator
it there for all that time. to call your own? Enter Qrasp, a Pi Sense
But this is where the story of HAT-based qubit simulator for us all. It was
this generation of Raspberry Pis developed by IBM Q Ambassador Hassi
will end. With the release of the Norlen, whose take on the project was: “This
Compute Module 3+ we reach will not be easy. IBM Q System One is, after
the end of what can be achieved all, a cloud-based quantum computing
with the current platform, which offering, with the main hardware, cryostats,
relies on 40nm CPUs that can quantum chips and all locked away in the IBM
only work with a maximum of labs.” He had a crack anyway. Go and find out
1GB RAM. For the Raspberry Pi 4 how to build your own from his blog post at
there will be a newer ARM CPU, http://bit.ly/lxf249qrasp.
possibly 28nm or less in size.
With this new CPU there will be No Raspberry Pi here, just
of course be more RAM, but what pure IBM Q System One.
else could there be? CREDIT: IBM
A wish list for me is USB-C
power, as we are reaching the
limit of what Micro-USB can
provide. I’d also like USB 3
compatible ports and true gigabit
X86 on ARM Pi semipowered
Ethernet. Wi-Fi and Bluetooth Box86 brings the op codes. Dodgy supplies revealed.
can remain as is. HDMI with 4K
output would be great – I just eople always want what they can’t odgy power supplies have dogged Pi
need a 4K TV…
But my biggest wish for the
P have – or can they? A new project
called Box86 is attempting to run
D users for years, and in a blog post
that discuses a few issues with the
next Raspberry Pi is that we desktop x86 programs (and games) on ARM Raspberry Pi, the issue of powering more
retain the same 40-pin GPIO with devices, via the talents of Qemu to create a recent Pi models is nicely addressed,
the same connections as the sort of Wine-lite for ARM systems. It’s early explaining how cheap supplies will end in CPU
previous generation of Pis. This days for the project but is well worth a look at throttling and system performance issues.
is vitally important to the Pi http://bit.ly/lxf249box86. See http://bit.ly/lxf249power for more.
ecosystem, with companies
basing their products on that
form factor and many projects
also relying on this configuration.
The Raspberry Pi 4 may not be
with us for a while yet, but once it
does arrive it will quickly be
adopted by the many fans of this
cost-effective board that
disrupted the market and keeps
doing so to this day. Personally,
I can’t wait.
Here comes the x86! Check your power to ensure smooth runnings.
CREDIT: www.giantpockets.com CREDIT: ownyourbits.com

50 LXF249 May 2019 www.linuxformat.com


Raspberry Pi Reviews

Compute module 3+
les pounder takes a look at the last of this generation’s Raspberry Pi
and wonders what makers can do with this much power.
he Raspberry Pi Compute Module is one of
In bRIEf
A Raspberry Pi 3
T those boards seen in the maker community, but
rarely used in projects for most makers. It’s
B+ shrunk into designed for industrial use and this is evident by the form
the shape of factor. Measuring only 67.6 x 31mm and looks more like a
laptop RAM. stick of laptop DDR RAM (but not electrically compatible),
This tiny board this is actually a Pi 3 B+ shrunk down into the smallest
has plenty of form. It even has 1GB of RAM, the current maximum for
power but can this generation of Raspberry Pi.
be built into But what do we lose in the process? Well, chiefly
bespoke wireless connectivity: there is no Wi-Fi or Bluetooth with
It might look
projects this board. Another loss is that the CPU for the CM3+ just like a stick of
designed by the runs at 1.2GHz and not the full 1.4GHz found on the laptop RAM, but here we
user. If you are 3 B+.On the other hand, we gain eMMC storage in 8, 16 have a full computer.
building a and 32GB capacities – except for the CM3+ Lite, which
Raspberry Pi relies on offboard micro SD card storage. The eMMC
project and storage is connected directly to the processor and gives still straightforward. The first step is to clone a GitHub
want to scale up us an interface speed similar to a Class 10 micro SD card. repository, which includes the tools necessary to perform
into a product, This is not lightning fast access, but quick enough and a USB boot of the CM3+. This enables the CM3+ to be
or integrate the less prone to corruption than an SD card. mounted like a regular flash drive. Then we can either use
Pi into an The BCM2837B0 System on a Chip (SoC) is the same a tool such as dd to write a Raspbian image, or in our case
industrial as found on the 3 B+ and 3 A+, but the CM3+ can offer Etcher, which detected the CM3+ and wrote the image in
application, this up all of the GPIO pins present for this SoC – all 120 of around 10 minutes.
board is for you. them! To do this the CM3+, like its earlier versions, So what do we do with the CM3+? This is where the
requires the Compute Module IO board. This board fun begins. We can design our own circuit boards based
provides us with a single USB 2.0 port to connect a hub, around the board. For example we could build a CM3+
keyboard, mouse and so on. There are also connections powered museum exhibit with touchscreen controls,
for the official Raspberry Pi camera and display – in fact, multimedia playback and motorised elements. We have
two connections for each device, so dual screens and access to all of the GPIO present on the SoC; all we need
dual camera projects are possible. The CMIO board also is the time and patience to create a carrier board, like the
provides a micro SD card slot needed for the CM3+ Lite, CMIO, that breaks out the connections that we need.
and an HDMI connector. This board isn’t for everyone; in fact, it’s only really
Flashing the operating system to the eMMC is a multi- viable for building Internet of Things, robotics and
step process, which is not as simple as a regular Pi, but industrial applications. For the average user it’s more of
an interesting piece of Pi-powered technology. But for the
few who want to create their own Pi-powered products
without the bulk of the form factor, the CM3+ is an
interesting and expansive platform, and cost-effective.

VERDICT
DevelopeR: Raspberry Pi Trading
Web: www.raspberrypi.org/products/compute-
module-3-plus-32gb
pRice: £38

fEaTuREs 8/10 EasE of usE 7/10


PERfoRmanCE 8/10 ValuE 9/10

The swansong for this generation of Raspberry Pi is a


capable yet bespoke piece of kit. For those that want to
Paired with the Compute Module
create bespoke products powered by Pi, this is your board.
IO board, the CM3+ offers 120
GPIO pins to play with. Rating 8/10

www.techradar.com/pro/linux May 2019 LXF249 51


TUTORIALS Search Google

EASYGUI
Get inspiration for your
projects with Google
Les Pounder shows you how to use Python to search Google
to gain inspiration for your next project.

ach issue we write a new Raspberry Pi project Python 3 editor found in the Programming section of

E and each issue we try to be inventive and


unique. But there are times when inspiration is
the Raspbian menu. When the editor opens, click File >
New to create a new blank document. Now immediately
not with us, and in those moments we turn to searching save the file using File > Save, call it inspiration.py and
Google with key phrases or words, and often they are remember to save often.
OUR quite ridiculous. These ‘mashups’ are there to fire the
imagination; just as a child given construction blocks Easy now GUI
EXPERT can make anything they dream of, we can use these We start our project by importing a series of libraries/
Les Pounder silly searches to think up new and unique ideas. modules. Firstly we import the search function from
is a freelance In reality this project is really just three for loops the googlesearch library, then we import the choice
maker who works and two lists that store and iterate over user input while function from the random library. We next import the
with organisations it searches Google. Then it opens a random page in our webbrowser library to enable us to open a browser
such as the web browser. window. Finally we import the easygui library, but we
Raspberry Pi shorten the library name to ‘eg’, as ‘easygui’ can be
Foundation. Let’s get mashing! tricky to type at speed.
Before we can write any Python code we first need from googlesearch import search
to install two extra libraries of code. These are called from random import choice
YOU NEED packages or modules, and they contain pre-written import webbrowser
Any Pi code that we can reference in our project. The first import easygui as eg
Raspbian library will install a way in which we can search Google The first step in this project is to ask the user a
Code: from Python. The second library is an easy to use message, and to do this we use easygui’s msgbox
https:// graphical user interface toolkit. In a terminal enter (message box) function. Here we can ask a message
github.com/ the following command. ( msg ), give the dialogue box a title and change the text
lesp/LXF249- $ sudo pip3 install google easygui in the ok_button to ‘Inspire Me!’
InsPIration/ This will take a few moments. Once it’s complete, eg.msgbox(msg=”Tell me what you would like in a
archive/ close the terminal window. To write the code we need project and I shall search Google for you. This will
master.zip to use a Python editor – in this project we’ll use the trigger 3 pop up windows”, title=”InPIration”, ok_
button=”Inspire Me!”)
Next we need to create two blank lists. One will
contain the things that we want to search for, the
other will store the suggestions that our Google search
finds. Lists in Python are called arrays in other
languages. They can contain lots of pieces of data, for
example strings, integers, floats and variables, but not
exclusively these. We can call data from a list by using
its index number. A list starts the index from zero and
can go on and on.
things = []
suggestion = []
Our app is a simple In the msgbox we instruct the user that we are
tool to use silly going to ask them for three things to search for – these
keywords to fuel
are the items that they wish to use as inspiration. To do
our imagination for
another cool project. this we need to use a for loop with a range. In this case
it will create a variable called i and each time the loop
goes round it will iterate (add) one to the variable until it

52 LXF249 May 2019 www.linuxformat.com


Search Google TuTorialS

reaches three, then it will stop. Each time the loop goes
round it will use an enterbox from the easygui library,
which is a dialogue box into which we can type, to
capture the user input. This is then appended to our
things list, which means it is added to the list.
for i in range(3):
things.append(eg.enterbox(msg=”READY >>> “))
We now have the items to search for, but we need to
convert them from list into a string – this is for our
Google search later. To do this we create a variable At the end
it chooses a
called inspiration and in it we store the converted random website
items from the things list, starting with 0, then 1 and 2. to visit from
This is all wrapped inside a string-formatting function the suggestions
that ensures the text is saved correctly. We then print stored.
this to the Python shell for debug.
inspiration = str(things[0]+” “+things[1]+” “+things[2])
print(inspiration) #Debug ( len ) of the list. Creating a variable called links to
store the multi-line string, we instruct Python to insert a
Round and round we go new line \n and then join the text together, starting When using the
Time for another for loop, and this time we use it from index 0 in our suggestion list. This is called slicing, easygui library,
to perform a Google search. For this we use the and by passing the value 0: we instruct the slice to start typing
inspiration variable, since it contains the search terms. start at 0. the name of a
We then instruct the search to use the Google TLD (top for i in range(len(suggestion)): function, for
level domain) for our country, in our case co.uk . links = “\n”.join(suggestion[0:]) example ‘eg.
The num value limits the number of links returned. Now that we have the multi-line string we can use it enterbox(‘ and a
helpful tool tip
The stop is a Boolean value tells our search to stop in easygui’s textbox function. This function takes a
will appear to
when it has enough links. Lastly, the pause value is set message ( msg ) and the text that we wish to show, in
show the syntax
to two seconds between each search, otherwise Google this case the contents of the links variable. for that function.
may block our computer from using its service. Each eg.textbox(msg=”Hey I found these that might be of this is common
time the for loop goes round, it prints the returned interest, I’ll open one at random after you close this for the majority
search item (the URL) and also appends the search message”, text=links) of python
item to the suggestion list we created earlier. The final line of code opens the default web browser libraries and is
for item in search(inspiration, tld=”co.uk”, num=3, for Raspbian, but the link it opens will be a random very helpful.
stop=1, pause=2): choice from the suggestion list we created earlier.
print(item) webbrowser.open(choice(suggestion))
suggestion.append(item) With the code completed, click Run > Run Module to
Moving along, we have another for loop and this start. You will now have no excuses when asked to
time we use it to convert our suggestion list into a devise a new project. Have fun!
multi-line string, a paragraph. We do this for the length

EasyGUI vs GUIzEro
If you have been hacking around with the Pi for a while, you will know
of guizero, written by Laura Sach who works for the Raspberry Pi
Foundation (https://lawsie.github.io/guizero). It’s a great library
which simplifies the way in which we can create Tkinter-based layouts
for many types of GUI application. We used it in LxF242 to create our
barcode scanner/Amazon book search app. So you might be
thinking, why did we choose easygui over guizero for this project?
Well, it comes down to our needs. We just needed a few dialogue
boxes to capture user input, and display the output from the Google
search. We can do this with guizero, but it would not be three simple
lines – there would be a few more lines, but still with simple code.
We have used easygui for a few years, and yes, it is rather old and
a trifle too simple for most projects. But for a really simple ‘Ask a
question, return an answer’ project, it cannot be beaten. To learn
more about easygui and how you can use it via a series of simple
tutorials, head over to its Read The Docs page and follow their work:
When the project starts, it instructs the user on how it will work, https://easygui.readthedocs.io/en/latest.
using a msgbox.

GEt yoUr pi FILLInG hErE Subscribe now at http://bit.ly/LinuxFormat


www.techradar.com/pro/linux May 2019 LXF249  53
TUTORIALS Stop-motion animation

PI CAMERA

Build a Raspberry Pi
stop-motion studio
Christian Cawley plays with modelling clay and a Raspberry Pi camera
to make a movie – although it’s not quite that simple…

ver sat guffawing at Terry Gilliam’s bizarre

E subversion of Victorian-era greetings cards


in Monty Python’s Flying Circus, or egging on
unlikely heroes Wallace and Gromit? Then chances are
you’ve spent a few moments thinking about how those
OUR animations are made.
There was a time when stop-motion photography
EXPERT was beyond the reach of most people. Overhead
Christian cameras mounted on rostrums were expensive, and
Cawley unless your school or college had one, your best bet
A Raspberry Pi was to take some photos and make a flick-book instead.
owner since 2012, As with everything, time and technology has
he’s nurtured 13 revolutionised the production of stop-motion Be careful connecting the jumper wires to the GPIO – ensure the
devices to date, photography, and now making a film with a digital Raspberry Pi is powered off before hooking up the button.
seeing them camera or mobile device is child’s play.
blossom into The Raspberry Pi Camera Module offers a superb you’re going to be snapping around 24 frames for
media centres, low-cost digital option. While time-lapse photography each second of footage, so having an area that remains
retro gaming is popular, it’s easy to overlook its illusory bedfellow. undisturbed when you’re not using it is vital. This ‘hot
systems, and After all, creating a stop-motion animation with figures, set’ should remain untouched by others, too.
portable radio household objects or simply toys is intensive work. Your studio area should have enough space for the
broadcast Often the results aren’t very good, and even getting tripod- or rostrum-mounted Raspberry Pi and Camera
stations. to the point where you have enough shots to create module, along with the objects you’re filming. In the
a short movie clip can be pretty back-breaking. case of 2D, paper-based animation, this should be an
YOU NEED Fortunately, there are some shortcuts you can take, area of table big enough to fill, or almost fill, the lens.
which we’ll explain here. Also useful for overhead shooting is a sheet of clear
Raspberry Pi plastic or glass. This keeps the papercraft pieces in
2 or later Stop, it’s motion time… place when taking a shot, as well as helping them to
Raspbian It’s a good idea to allocate time to your stop-motion look flat and uniform and dealing with any curled edges.
Stretch project – say a few days. Shoots are famously slow; If it was good enough for Terry Gilliam, it’s good enough
Pi Camera for you!
Module In order to shoot clay models, fruit, toys or whatever
Dual-state 3D objects you plan to animate, you’ll need an area
push-button large enough to build a set. There should also be space
Breadboard around the table for you to move in to aid with the
Monitor animation of your characters. Remember that stop-
Mouse and motion animation requires very slight movements in
keyboard every frame for each of the characters or objects you’re
Tripod or shooting. The aim is to get the character from one
secure mount position to another, while creating the illusion of motion.
Something Access to the character from every angle will help you
to animate: to achieve this.
clay figures, Whether you’re using an overhead camera or a
Lego, action standard tripod-mounted shoot, the project needs to
figures and Planning to animate Lego minifigs? Use base pieces or putty to be well-lit. See ‘Lighting balance’ box (over the page) for
so on keep the figures stable for each shot. some handy lighting tips.

54 LXF249 May 2019 www.linuxformat.com


Stop-motion animation TuTorialS

Lights! Don’t have a


To turn your Raspberry Pi into the central component of suitable tripod
your stop-motion studio, you’ll need to attach a camera. for overheard
While USB cameras work fine, it’s far more satisfying to work? Build your
employ the latest Raspberry Pi Camera Module. own rostrum
with Meccano
Connecting this device to the Raspberry Pi requires
or another
you to insert the ribbon cable into the ‘Camera’ construction toy.
connector on the SBC. If you’re using a Raspberry Pi
model B, the shiny side of the ribbon should face away
from the Ethernet port.
For Raspberry Pi Zero devices with a camera port,
the shiny side of the ribbon should face up. Take care to
correctly unclip the catch on these connectors before
inserting the ribbon. Similarly, ensure the catch is from picamera import PiCamera
correctly secured afterwards. from time import sleep
Boot up the Pi and enter the configuration screen on from gpiozero import Button Finding
the desktop (Menu > Preferences > Raspberry Pi something to
animate in your
Configuration) or open a terminal and enter sudo raspi- button = Button(17)
stop-motion
config . Here, select Interfaces (or Interfacing Options camera = PiCamera()
movie project
in the terminal), then enable Camera. Click OK to might seem
confirm and restart your Pi. camera.start_preview() tough, but
With the Pi restarted, open a terminal window, and frame = 1 really you can
enter raspistill -o image1.jpg . This should take a photo while True: use anything.
from the camera, confirming the device is correctly try: it could be
connected and working. You’ll notice that raspistill is button.wait_for_press() household
built into the Raspbian operating system. It’s part of the camera.capture(‘/home/pi/Pictures/stopmotion/ objects, or it
raspicam software, which we’ll come back to later. frame%03d.jpg’ % frame) might be toys.
check toy shops
frame += 1
for Plasticine
Camera! except KeyboardInterrupt:
character kits
Setting up the camera on your Raspberry Pi will let you camera.stop_preview() or lego packs
create a stop-motion video, but it can be a bit fiddly break specifically
entering the same command for every single shot. The This script uses the PiCamera, sleep and Button designed for
solution? Create a shutter button that you can connect programs, from the picamera, time and gpiozero stop-motion
to your Raspberry Pi! libraries. It defines a button (pin 17) and camera and projects.
Prototype it first using a breadboard, connecting the waits for a button press.
two wires to pins 6 and 11 on the GPIO header (or GND At this point, it adds a single image into the specified
and GPIO17). With the button correctly mounted to directory. The script ends only when a keyboard
connect to the wires, you can use this setup to capture interrupt command is detected.
each frame. Alternatively, connect a wired-up button
directly to the pins on your Raspberry Pi’s GPIO.
However you connect the shutter button, you’ll then KeeP steadY and caRRY on
need to create a Python script to detect it. Each push of
the button will capture and save a new photo to the One important element to keep in mind is stability: it’s all too easy
specified directory. Open Menu > Programming > to knock a camera, especially one mounted on a tripod. An overhead
Python 3 (IDLE) then File > New. In the resulting camera can also be subject to vibrations and wobbles.
window, input this script, from raspberrypi.org The result of these bumps can be a jarring distortion in your
(http://bit.ly/LXF249-stopmotion-script): finished movie. While repeating the shot is one solution, it can be
time-consuming to arrange. A better solution is to ensure that the
camera is secured to a sturdy piece of gear.
A tripod should have a heavy, reliable base with a low centre of
gravity to avoid topples. An overhead camera should be securely
connected to the base, or whatever rigging is being used to support
it. You need to minimise any vibrations that might occur during the
capturing of your stop-motion frames. This can be difficult using the
breadboard-based shutter button, so it’s worth changing this to a
direct GPIO pin connection with a long cable.
For this project we opted to use a Raspberry Pi case with a
mounting point for the camera module. This meant we could use the
Pi itself like a camera, positioning it using a smartphone tripod. You
might opt to connect the Pi to a car-windscreen-mounted
For the best results, use a smartphone tripod to mount your Raspberry smartphone holder for similar vibration-free stop-motion video.
Pi for improved stability in your stop-motion movie.

linux, one Page at a time Subscribe now at http://bit.ly/LinuxFormat


www.techradar.com/pro/linux May 2019 LXF249  55
TuTorialS Stop-motion animation

Action! hundreds or thousands of individual images into a


With everything set up, it’s time to make your movie. single movie file. Before you do that, however, it’s a
it’s almost This could be considered as the difficult stage, good opportunity to look for any images that didn’t
always more depending on how much planning you’ve done quite work out.
convenient to
(you have made a storyboard, haven’t you?). For example, if you took multiple attempts at a
use a Raspberry
In truth, however, if the Raspberry Pi is securely particular shot, you can delete the ones you don’t want
Pi without
the display. positioned, with a reliable power supply, and the shutter (or move them to another directory). It’s also a good
However, for a button correctly connected, you shouldn’t have any chance to get a look at the overall movie in a sort of
camera project trouble. The worst that’s going to happen is probably ‘film strip’ view. This will reveal if the lighting is
like this it’s a bit of back- or neck-ache as you make those small consistent, for example, or if your camera has drifted
wise to have adjustments to your characters. or been obviously knocked when shooting. In some
a monitor Your recording of the movie should follow this simple cases, it might be possible to retake a shot if it is
connected. using procedure: set up scene > take shot > move character/ particularly poor. However, it may be easier to simply
the preview object(s) > take shot > move character/object(s) > drop the image, and hope for the best.
feature will
take shot. This should continue until your movie is When you’re ready to compile the images, browse to
ensure the shot
complete, or you’re ready to take a break. the /stopmotion directory within the terminal (or
is lined up and in
focus. What type As every image is saved into the same folder with an press F4 from within the desktop file manager to open a
of display you individual file name, stopping and then restarting the terminal). Then run:
use is up to following day should not be a problem. Nothing is likely avconv -r 15 -i stopmotion/frame%03d.jpg -qscale 2
you, although to be overwritten, for example. animation.h264
the larger, When you’re ready to stop recording the movie, Wait while the process completes. Keep in mind the
the better. press Ctrl+C on your Pi’s keyboard. This will terminate relatively low specification of your Raspberry Pi, and the
the stopmotion.py program and close the preview. With fact that it is essentially creating a movie in high
the movie complete, it’s time to compile those definition. This may take a while, so go and recover –
maybe have a good shoulder rub.
With a Raspberry Pi Camera Module The completed file animation.h264 can be run in
attached you can turn the Pi into an your preferred media player. For instance, to play in the
all-in-one stills and video camera.
Raspberry Pi’s omxplayer, use
omxplayer animation.h264
Find the video is a bit jerky? Try altering the frame
rate and recompiling it, represented in the avconv
command with the -r 15 value. The higher the figure,
the smoother the animation. Note that the animation
will also become shorter as you increase the frame rate.

Sharing with the world


With your movie completed, you may want to “um” and
“ahh” over the problems. Or you might prefer to just get
it out there to find out what people think of it.
Pretty much anywhere to which you can currently
upload movies is suitable. Better still, as the movie is
probably only a few seconds long, it won’t take long to
ligHting Balance upload – so you can think about uploading the stop-
motion movie to YouTube, Facebook, Twitter and so on.
Shadows can ruin even the best stop-motion animations, yet this Alternatively, you could upload it to your preferred
problem can be easily avoided with a bit of forward planning. Lighting cloud storage account. From here, it should be easy to
is the secret, but you need to avoid relying on daylight or a standard access it from your mobile device and upload the file to
ceiling light. This needn’t cause you to break the bank, either; small Instagram, say.
LED lights perfect for this can be bought for just a few pounds.
Positioning the lights to the left and right of the animation ‘stage’ Audio!
enables you to cancel out any shadows cast by you or the camera. One shortcoming that you will have noticed with the
If you’re animating with objects, toys or modelling clay, a third light creation of a stop-motion movie is the lack of sound.
from above will also help to cancel out shadows. You have two main options to get around this.
With the shadows banished, you should also ensure the white The first is to load up a desktop video editing suite on
balance is set correctly. If you’re using the recommended PiCamera your main PC (your Raspberry Pi probably isn’t up to
software, auto white balance will probably work. it!). Import the stop-motion video and add a soundtrack.
You can adjust this yourself by altering the awb_mode property, This might be audio you already have saved to your PC,
which by default is set to awb_mode=auto . Alternatives include whether that’s music or sound effects. Alternatively,
sunlight and cloudy , though tungsten , fluorescent and you could record some custom sound effects or
incandescent are set for typical indoor lighting temperatures. dialogue to accompany the action.
Meanwhile, you can even go as far as disable awb_mode with However, there is also the option to add audio when
the off setting. You can then specify a precise awb_gains setting you upload the video to YouTube. The Creator Studio
(between 0.9 and 1.9). Consistent lighting will result in a better enables you to add sounds from YouTube’s library of
stop-motion movie, so take the time to set this up accurately. royalty free songs. The selection is pleasingly vast, so
choose carefully!

56 LXF249 May 2019 www.linuxformat.com


Stop-motion animation TuTorialS

tuRn YouR RasPBeRRY Pi into a stoP-motion movie studio

Connect the Camera Module Enable the Camera Module


1 Hooking up the Camera Module requires the correct cable 2 When you boot your Pi, you’ll need to enable the camera.
for your Raspeberry Pi computer. For Model A and B boards, the On the desktop, do this via Menu > Preferences > Raspberry Pi
standard cable that ships with the Camera Module is adequate. Configuration. Select Interfaces then select the Enabled button
However, for the Pi Zero, a narrower cable is needed. Slot the for the Camera, then click OK. Alternatively, open a terminal and
cable into the port with the shiny side facing away from the use the raspi-config app. Select Interfacing Options, then Camera 
Ethernet port (or facing up on the Pi Zero). in the next screen. Choose Enable, then OK. Restart.

Connect a shutter button Start shooting frames


3 The complicated part of this project isn’t all that tough, 4 It’s one thing to just plunge the button to make your movie, 
really. If you want to use the PiCam script, you’ll need a shutter – another thing entirely to get the shots right. With the camera
an on-off (dual-state) plunger button connected to the Raspberry securely placed and the characters and background in place,
Pi at pins 6 and 11. Once connected to the GPIO, and with the you’ll commence the tiring job of snapping shot after shot to build
script running, the button will take a single shot from the camera the scene. Find safe shortcuts. Repeat shots wherever possible,
on each press. and use as few characters, props and other elements as possible.

Create a movie with avconv Add audio with YouTube


5 The completed movie will appear as a collection of stills 6 Stop-motion animation is sound-free by default. While it
in the destination folder. A flick-book effect can be enjoyed by might be fun to let the film play out in total silence, you have a
scrolling through the photos in your file manager’s preview panel. few options to add sound. One is to load the finished video into
Using avconv to convert the photos into a movie is simple, but a movie-editing app and add some custom audio with a mic.
time-consuming for longer projects. Be sure to set the right FPS  The other is to add music to the audio in YouTube when you 
to get the best results first time. upload it, using its Creator Studio.

www.techradar.com/pro/linux May 2019 LXF249   57


TUTORIALS Debug serial comms

COMMS

Debug serial comms


Sean Conway walks you through the process of troubleshooting
communication problems between a PC application and a serial device.
he itch for an article on troubleshooting USB- The easiest way to determine if the operating system

T to-serial connections needed to be scratched,


after working on a request for assistance from
detects the USB cable/adaptor device is to install the
device after a reboot. Installing it before a reboot
a local model railroad group (see LXF239). This tutorial causes the device details to be consolidated inside
will provide the knowledge to troubleshoot other boot message content.
communication (comms) issues from an app on a PC From a command line interface type dmesg . If the
to a serial device, using a USB-to-serial cable/interface. cable/adapter was plugged into the PC before bootup,
OUR In the diagram shown below, there is a PC running the details we want are embedded in the dmesg listing.
EXPERT an application that requires a serial interface. The PC For the novice it’s much easier to plug in the cable/
is connected to the serial device, shown on the far right adapter after a reboot and then run dmesg. The new
Sean D. Conway side of the drawing, using a USB-to-serial cable/ device details will be at the end of the listing.
is a retired IT interface. The drawing contains a few additional details From the information returned you can extract
security specialist that will be introduced as our discussion expands. which chipset/UART is in the cable/adapter. The
who now Hardware in the PC supported serial comms; at one details will also identify which communication port
exercises point during the evolution of the PC, a minimum of two has been assigned. You are looking for something
his brain by DB9 ports (the 9-pin COM port) was considered like ‘ttyUSB’, suffixed with an assignment number –
mining knowledge standard. The red highlighted text in the diagram are for example, ttyUSB0 .
through some examples of COM port communication needs. For the next step in troubleshooting we are going to
Raspberry Pi But all things come to an end, and the ubiquitous USB use an application called Putty – its UI makes it easy to
projects. port soon replaced COM ports. To consolidate all the configure the ports. The goal is to confirm that software
different serial device comms requirements, a USB-to- on the host PC can communicate through a USB-to-
serial cable/adaptor came into play. Unfortunately, this serial adapter. Once Putty is installed, open the
generic serial comms doesn’t always work, and it can be application. Select ‘Serial’ in the ‘Connection type’
frustrating trying to isolate the root cause of serial choices. In the ‘Serial line’ field, enter the COM port
communication failure. details you have recorded previously. Proceed to the
After connecting the USB-to-serial cable to the host serial connection screen. The most common, default
PC, the first step is to determine if the OS recognises setup is 9600baud 8N1. The number sequence
the USB-to-serial adaptor. In Linux, the dmesg translation means: eight bits of data, no stop bits, one
command reveals information regarding hardware parity bit.
detection, driver assignments and communication port Give the session configuration a name and save it.
allocation. It is important to take note of what COM port The session configuration is not saved by default when
(COM1, 2, 4 or so on) is used – this will be needed to you leave the application; if you don’t save the session,
support our efforts, as well as set up the application. you’ll need to input the configuration again next time.

Serial Application Serial Connection Serial Device


(Putty) (USB to Serial cable/adapter) NULL Modem (DCC)
(Optional)
CD 1 1 CD
UART/RS232/
Data RS485/RS422 RxD 2 2 RxD
1
6

+ TxD 3 3 TxD
USB Connector

Parallel printer to
Device Connector

USB printer DTR 4 4 DTR


CH341 Chip
PC

SG 5 5 SG
EPP parallel and
9

MEM parallel DSR 6 6 DSR


5

RTS 7 7 RTS
Data
DB9 Connector
Serial connection –
2wire/4wire
(jumper for testing) CTS 8 8 CTS
synchronous serial
path mapping,
with additional RI 9 9 RI
landmarks shown.

58 LXF249 May 2019 www.linuxformat.com


Debug serial comms TuTorialS

Before starting the terminal session configured in or assume that the user has
Putty, let’s create a physical connection (technically, a sufficient knowledge to use the
short) between pins 2 and 3 on the nine-pin serial option of installing a null modem.
connector. Refer to the DB9 connector details on the If the two pins are switched in the
diagram: pins 2 and 3 are the serial transmit/receive serial device, transmit and receive
pins. By connecting the pins together, we are pairing will match. Otherwise, a null
redirecting the output on the transmit pin back to modem cable will need to be
the input on the receive pin. installed to take care of moving the
When the Putty session is activated you will be taken transmit and receive connections.
to a blank, black terminal-style window. Now select a Refer to the diagram for null modem
character on the keyboard. The keyboard character cable details.
selected should appear on the screen. If the character Let’s summarise the
appears, Putty has transmitted the character data troubleshooting process we’ve just
serially out of the transmit pin and, with the short in developed, to really get it into our
place, routed the transmission back to the receive pin, minds. First we confirmed the USB-
to be displayed on the screen. to-serial cable/adapter was
supported in the host PC by
The real thing checking that it was registered in
Now that we have confirmed Putty can transmit and Linux. Next we confirmed that the
receive over the USB-to-serial cable/interface, we can computer could transmit and
replace it with our unknown serial application. The receive over the USB-to-serial Putty’s screen layout
application will no doubt require the configuration cable/adapter using Putty. We isn’t necessarily the
same in different OSes.
details (COM port) used to setup the Putty session. shorted pins 2 and 3 on the cable/
If the cable/adapter worked with Putty it should work adapter’s connector, so that the
with the application, provided the communication ‘transmit’ and ‘receive’ were
details set up are correct. If not, you have isolated connected, then transmitted a character and watched it
the problem to the application. appear on the screen.
The serial application will need to be configured with Putty was then replaced with the computer you can find
the serial communication protocol details. The COM application we want to actually test, and the application simon tatham’s
port identifier is one piece of information. It is important was configured with the required serial port and putty repository
in serial communication that the transmission rate and communication protocol requirements (rate and at www.chiark.
the framing of the serial message be compatible framing details) given by the manufacturer. greenend.org.
between sender and receiver. For Putty, we relied on Finally, the PC was connected with the USB-to-serial uk/~sgtatham/
putty.
the default serial options, 8N1. cable/interface to the serial device, with the knowledge
Serial communication relies on both the transmitting that transmit and receive was taken care of by the
end and receiving ends agreeing on how they will frame manufacturer’s design, or a null modem cable needed
data for communication. Here is an analogy: two people to be installed to complete the communication path.
want to communicate. One speaks French, the other When you experience serial communication
English. Without establishing a language requirement, problems, what’s most important is to determine if the
both parties can transmit, but neither can understand infrastructure for serial communication actually works,
what is received. The same concept applies to serial without all the overhead of the new applications and
communication setup. devices. Once that is determined you can substitute the
The serial device manufacturer’s documentation known for the unknown, and should be able to isolate
should provide the details required to set up the what is not working.
application. The Putty serial screen is an example of
the values that should be found in the serial device
documentation. The application needs to know the the Lost art
speed and bit configuration in order to communicate.
You discovered the COM port by looking in the OS. It You would think that the knowledge that a straight-through
can take a lot of trial and error to work through the connection, or a null modem connection, is required for a bit of kit to
combination to get the serial protocol correct. work would be provided in the documentation. It’s my experience
Remember that pins 2 and 3 on the serial connector that this knowledge, more often that not, is lacking, however.
are ‘transmit’ and ‘receive’. When the cable is plugged With the demise of COM ports as computer hardware, a lot of
into the serial device, how does the serial device’s knowledge about serial communications has been misplaced. The
manufacturer take care of ensuring the transmit data belief now seems to be “Just hook it up and it’ll work!” We need to
pin is connected to the serial device’s receive data pin? restore the lost knowledge to troubleshoot connection issues.
It would be handy if this requirement is provided in the One caveat to keep in mind is not to apply both connection
documentation; if not, it’s back to our troubleshooting. methods at the same time. If the manufacture has switched the pins
There are two methods to achieve the connection and a null modem cable is installed, two rights in this case make a
goal. The serial device’s manufacturer may cross the wrong. Think about it: pins 2 and 3 are switched by the manufacture,
transmit and receive pins on the serial device end by and then again by the null modem cable.
switching the position of pins 2 and 3 on the connector,

get your FiLL oF seriaL Subscribe now at http://bit.ly/LinuxFormat


www.techradar.com/pro/linux May 2019 LXF249   59
tutorials
FFF
Discover a blazingly
fast file manager
Not all file managers look the same, as Shashank Sharma discovered
while working with FFF – a file manager written in Bash.

hat sets FFF apart from other file managers is image files from within the terminal emulator itself,

W its non-conventional user interface… and its


name, of course. It’s not every day one comes
using the w3m browser. The w3m-img package and
other optional dependencies listed on the project’s
across a tool with an expletive for a name, which we GitHub page are readily available in the software
won’t repeat here for obvious reasons. You will have to repositories for most distributions.
our point your browser to the project’s home page at
https://github.com/dylanaraps/fff for that.
To install FFF, open the terminal and run git clone
https://github.com/dylanaraps/fff.git, which copies the
expert FFF doesn’t exactly have an interface to speak of. FFF repository into the current directory. To be able to
Shashank Sharma Instead it provides a directory or file list, and lets you access FFF from anywhere in the terminal, you must
is a trial lawyer in perform various file operations such as copy, paste, cut place the script somewhere in $PATH, such as the
Delhi and an avid and so on. As a shell script, the project also doesn’t /usr/sbin directory. You can run the sudo cp fff /usr/
Arch user. He’s have large dependencies, and you can set it up on sbin command to do so. Alternatively, you can source
always looking for any Linux distribution – and even BSD and macOS – the script from your ~/.bashrc file:
geek memorabilia. without any hassles. For all of its file operations, the tool $ echo “alias fff=”/path/to/fff-script”” >> ~/.bashrc
relies on the coreutils package. You can optionally $ source .bashrc
install the w3m-img package, which will let you view Of course, you can create a more convenient alias
if you prefer, such as fm or even f:
$ echo “alias fm=”/path/to/fff-script”” >> ~/.bashrc
CommanD-line File managers $ echo “alias f=”/path/to/fff-script”” >> ~/.bashrc
$ source .bashrc
Text-based file managers aren’t new; in fact, graphical managers You can now launch FFF by running the fff
could be considered the new kids on the block. Two of the most command from the terminal, or using your alias.
popular file managers for Linux users, Midnight Commander and If you’ve ever worked with the popular vi text editor,
Ranger, are command-line utilities. Unlike FFF, these feature a multi- you’ll quite enjoy navigating with FFF. In addition to
pane interface, and some even more advanced features. vi-like keybindings, the project also uses the arrow keys
For instance, you can use Midnight Commander to recover deleted to help you navigate around. The key() function in the
files, and search for files or the content of a file as well. Unlike FFF and FFF script describes the various bindings.
Ranger, however, Midnight Commander uses Emacs-style
keybindings. As with FFF, you can also create bookmarks, called
Hotlists, and can also connect with remote FTP clients and browse
contents of archives such as RAR and ZIP – something FFF can’t do.
If you’re running Ranger or Midnight Commander in a terminal
emulator on top of a graphical environment, you will also be able to
use your mouse to navigate around the interface, which is another
feature not available with the vanilla FFF file manager.
Another alternative is vifm, which as the name suggests is another
tool that supports vi-style keybindings. As with Ranger and Midnight
Commander, vifm features a multi-pane interface. While it doesn’t
offer the advanced features of Midnight Commander or Ranger, a lot
of people will appreciate its undo and redo feature, which can be used
for many different operations such as copy, delete, rename, move,
change permissions, owner/group change and so on. The search feature also produces real-time results, and is indeed fast
enough to justify the project’s expletive-riddled name.

60 LXF249 May 2019 www.linuxformat.com


File manager TuTorials

Of course, if you’d like to define your own keyboard, Being a Bash script, FFF also supports tab-completion,
you can do that as well by editing the script to your so you don’t have to manually type the complete path.
satisfaction. Unfortunately, we don’t have enough space You can copy, move, or delete single files with FFF you can use
to provide a complete list of the default key bindings, by selecting the file/directory and then respectively the keys 1 to
9 to create
but here are some that you will use frequently: pressing the Y, M or D key. You can also select all files
bookmarks
in the current working directory using the same keys
to commonly
Key Function plus Shift. That is, press Shift+Y to mark all files for accessed files
J scroll down copying, or Shift+M or Shift+D to move or delete all or directories.
files. When you choose a file operation such as copy, open the FFF
K scroll up move or delete, the selected file is highlighted in red, script in your
H go to parent dir and the bottom of the interface will show in red the favourite editor,
operation you’re about to perform. For instance, if you navigate to the
L go to child dir
mark a file/directory for deletion, you’ll see: ‘# Directory
Enter go to child dir (12/12) [1] selected (trash) [p] ->/home/linuxlala/ favourites’
section and use
Backspace go to parent dir Desktop
the template
- go to previous directory Here, the path at the end of the line describes the
‘export
location of the file, the number in square brackets FFF_FaV1=/
! open shell in current directory describes the number of files, and the keyword in path/to/file-
F new file brackets describes the intended operation. The (12/12) or-directory’
at the beginning of the line describes the position of the . you can now
N new dir
selected file in the directory list. All the contents are use the keys 1
R rename arranged alphabetically, and FFF automatically to 9 to switch to
computes the total number of files/directories in the a bookmarked
In addition to J, K, H and L, you can also use the current working directory. So if your current directory directory,
or open a
respective arrow keys for the same purpose, as these has four files, named Alpha, Curses, beard and java,
bookmarked
are configured by default in FFF. That is, you can press they would be assigned numbers 1, 3, 2, 4 respectively.
file, irrespective
the right and left keys to respectively enter a directory, This is because FFF isn’t case sensitive. of your current
or return to the parent directory. The up and down keys Similarly, for a move operation, the line at the working
can similarly be used to select a file or directory. bottom of FFF would read: directory.
Most file managers help you do more than just (3/4) [2] selected (mv -i) [p]->/home/linuxlala/
provide easy access to a directory’s content; they also Downloads/projects/
help you rename, copy, move, search for or delete files. Here, the [2] means we’ve selected two files for the
Like its graphical counterparts, FFF too supports all move operation (mv -i) . Once you’ve chosen the file
these functions, and they’re all at your disposal with a operation to perform, navigate to the directory where
single keystroke. you want to move or copy the selected files/directories
You can press / followed by a string and FFF will and then press P. FFF then pastes the chosen files into
immediately print all files/directories which match the this new working directory. Unfortunately, there’s no
entered string. Unlike other command-line utilities, way for you to specify the path where you want to move
which retain a case-sensitive approach, the search or copy files: you have to manually navigate there and
feature on FFF is not case-sensitive. For instance, if then press P for the file operation to take effect.
your home directory contains several directories and In summary, FFF features many of commonly used
files which feature the letters M and m – whether at the features, has no real learning curve to speak of, and is
start, middle or the end – as soon as you start typing indeed, er, quite fast.
/m , FFF will automatically limit the contents to all
matching files/directories which feature these letters.
This means that the search results will include the
directory Music as well as the file beard-grooming-
tips.txt, and all other matches. The results will keep
getting narrowed down as you type.
If you also want to view hidden files/directories, you
can press the . key to toggle hidden files. Once on, the
option remains enabled, until you toggle it again. You
can similarly use the X key to determine the attributes
such as total size, permissions, time of the last access,
modification and so on of the selected file and directory.
Most graphical file managers let you type in the
directory you wish to access. If your present working
directory is ~/Documents and you want to navigate to
/Downloads/projects/calcurse/calcurse-4.3.0/
scripts, that’s a whole lot of key presses. Thankfully,
FFF also lets you type in the directory path you want to The FFF script is neatly split into different sections. Although not thoroughly commented, it can
access. First press : and then type the directory path. teach you a lot about Bash scripting.

enhanCe your terminal-Fu Subscribe now at http://bit.ly/LinuxFormat


www.techradar.com/pro/linux May 2019 LXF249  61
TUTORIALS Organise photos

SHOTWELL
How to build a photo
library in Shotwell
Nick Peers reveals how to bring order to your chaotic photo
and video library with Ubuntu’s default photo organiser.

igital photography has been become both a photos through creative use of colour and light

D blessing and a curse. It’s almost inconceivable


to remember the time when every photo was
correction, cropping, straightening and even removal
of the dreaded red-eye.
precious, eagerly awaited with a mixture of anticipation Shotwell is included by default with both Ubuntu
and dread. Nowadays, digital clutters up your hard drive and Mint, but it’s an old version (0.28.4). Step one,
OUR with dozens – if not hundreds – of photos for every
major life event, never mind the rest.
therefore, is to ensure you’re running the latest version
– 0.30.1 at time of writing. Open a Terminal window and
EXPERT Thankfully, there’s a tool that can help bring order to issue the following commands:
Nick Peers your chaotic collection. Shotwell doesn’t simply bring $ sudo add-apt-repository ppa:yg-jensge/shotwell
is looking forward your photos into a single library: you can use it to $ sudo apt-get update
to finally being organise them a myriad of different ways, from date- $ sudo apt-get install shotwell
able to bring based events to keyword tags. It even offers a selection Close the Terminal window and launch Shotwell from
some sense of of handy image-editing tools to help lift lacklustre the applications list. It will immediately search your
order to the
chaotic ‘pile’ View and edit photos in Shotwell
of photos he
has amassed.
1

6
3
If files in the
Shotwell library
are moved,
deleted, or –
with removable
media –
disconnected,
they become
‘missing’ and 2 4
disappear from
the main view.
5
You can check
these under Filter photos Crop options
Library > Missing
1 Use the options in the left-hand pane to filter the list of photos in 4 Click to select the aspect ratio of your selection, or switch between
Files. Either various ways, including by event, tag or flag. portrait and landscape orientation using these tools.
restore the
Basic information Toolbar
file(s) manually, 2 When you select a photo to view, its basic file information is 5 Context-sensitive options appear here – when you’re viewing a file,
or select them displayed here. various editing tools plus the zoom slider are displayed.
all and click
‘Remove from Crop tool Extended information
Library’ to 3 The crop tool enables you to cut out superfluous detail: click and 6 Press Ctrl+Shift+X to display additional information not shown by
delete them. drag on the crop square to resize or move it. the Basic information tool.

62 LXF249 May 2019 www.linuxformat.com


Organise photos TuTorials

Pictures folder for images and videos, which appear


as a list of thumbnails organised by the file’s date- and
timestamp, newest first. You’ll see several options for
filtering photos and videos by type at the top of the
screen, plus a search box to quickly look for photos
using keywords, which will become more useful as
you organise your photos.
Double-click an item to either view it in Shotwell’s
built-in picture viewer or – if it’s a video – in your default
movie player. When viewing photos, use your mouse’s
scroll wheel or the magnification slider to zoom in and
out, and click and drag to move around the photo.
Double-click again to return to the main view.

Importing photos and videos


These days, it’s not uncommon for people to have a
different folder than the standard Pictures in which to
store photos. Shotwell enables you to import photos (more on that shortly). The Shotwell library itself Select Edit >
and video from several sources in different ways. The doesn’t contain any physical links to your actual photo Preferences
> Library to
simplest is to drag and drop a folder or file from the files; instead, think of it as a virtual database layer that
configure the
Files application onto the Shotwell window, or you can sits on top of your photos. This means that anything folder structure for
go down the traditional route via its File menu: choose you ‘do’ to your photos in Shotwell – whether photos copied into
File > Import From Folder to choose a folder on another organising them by adding tags or altering their date, your library.
drive or camera memory card you’ve plugged into a or by editing the photos themselves – isn’t applied to
reader. Select your folder or drive, and leave ‘Recurse the physical files. In other words, it’s non-destructive by
Into Subfolders’ ticked to ensure the photos inside default, but if you want to apply certain changes to the
subfolders are also included when Shotwell adds them real files there are ways to do this, as we’ll see.
to your library. Click OK. Let’s start by looking at the different ways in which
Shotwell will then give you one of two options: ‘Copy Shotwell organises your files. By default, all photos and Not all date-
Photos’ physically copies the files into your Pictures videos in your library are displayed together, sorted by and timestamps
folder, organised into subfolders based on the year, date, with the newest shown first. You can alter this by on photos are
month and day corresponding to the datestamp on choosing View > Sort Photos, where you’ll find options correct – for
each photo – for example, 2019 > 04 > 03 for photos for displaying by title, filename or rating, plus choose example, if
dated 3 April 2019. This option will check – and strip whether to view in descending (newest or last first) or you scan in
out – any duplicates it finds. Alternatively, choose ascending order. old family
‘Import in Place’ and nothing will be copied, but the files This view obviously becomes impractical incredibly history photos.
edit these by
become part of your Shotwell library. Should you later quickly, which is where all the viewing and filtering
selecting the
move these files, Shotwell will lose the link to them. options become useful. First, without doing any
photo and
Shotwell also supports importing files from memory additional work you can browse by date using the choosing photos
cards or digital cameras – see the box (bottom right) Events view. Click ‘All Events’ or select a year or month > adjust Date
for more details. from the list to group all photos by date. Roll your and time. tick
If you want to copy photos into a single folder, but mouse over an individual day to see quick-fire previews ‘Modify original
don’t want to use your Pictures folder for whatever of all the photos inside, then double-click to show just files’ to amend
reason, or you don’t like the MMMM\YY\DD folder the photos taken on that day. Other viewing options the actual file
structure, choose Edit > Preferences > Library tab. include Imports, which records each separate import datestamp.
Start by specifying an alternative location for your
Shotwell library – tick ‘Watch library directory for new
files’ if you’d like your library to automatically update IMport pHotoS FroM a CaMera
whenever new files are copied into the library folder.
You can also select a different folder structure from You can also import directly from your camera – Shotwell uses
here, such as ‘Year/Month’ to group photos by month gPhoto 2, which supports most models (visit http://bit.ly/
rather than day. Alternatively, select Custom to set up lxf249gphoto for a list of over 2,500 models). Connect your camera
your own chronologically based structure using regular to your PC with a USB cable, then with Shotwell open, switch the
expressions. Click Help next to the Pattern box for a full camera on. After a short pause you should see your camera’s
list, such as ‘%b’ for a three-letter abbreviation of the pictures fill the Shotwell window – look in the left-hand menu where
month name (‘Apr’) instead of the two-digit number. you should see a new Cameras submenu with a ‘Mass Storage
Camera’ entry indicating it has been recognised.
Organise your library Tick the ‘Hide photos already imported’ to prevent accidentally
Shotwell’s left-hand pane offers several options that importing the same photo twice in future, then either click ‘Import All’
relate to the way photos and videos are organised and to bring them all across to your photo library, or Ctrl-click those
viewed – click one to switch to that view. The Library photos you wish to import before clicking ‘Import Selected’. Wait
view is self-explanatory – a straight choice between all while Shotwell imports the photos – you’ll see each photo appear one
photos or those you most recently imported, plus the after the other, and then click Keep or Delete depending on whether
wastebasket to which entries in the library can be you want to leave the photos on your camera or not.
dragged. It’ll also display missing and flagged photos

www.techradar.com/pro/linux May 2019 LXF249   63


TuTorials Organise photos

from file or camera, and Folders, which is useful if you on the first and last days to select them all, then
don’t keep all your photos in a central location. One final choose Events > Merge Events.
want to back up option for browsing is tags, which is based on keywords The photos will then be grouped together under a
your Shotwell that are attached to individual photos. These can be single event that’s named according to the date(s) it
library? Because anything you like – a place or person, for example, and occurred on. Select this, right-click and choose Rename
thumbnails the benefits of clicking them are obvious. Event to give it a more memorable name – it’ll remain
are generated These viewing options form the crux of Shotwell’s organised by month and year to help you locate it in
automatically, organisation tools. Let’s begin with Events. As we’ve future. If you want to add a comment – basically a
all you need to seen, by default Shotwell uses days to create individual description packed with keywords you can use to locate
do is back up events, but you can create your own named events that the event later if necessary – right-click the event name
the database
can either span multiple days or split an individual day and choose ‘Edit Event Comment...’
file – you’ll find
this hidden
into two or more parts (for those busy days when you
away under cram in two or more engagements). Organisation options
~/.local/share/ If you’re splitting a single day into two or more It’s also possible to label photos individually or in
shotwell. events, simply select the day, then hold Shift as you selected batches. You can add titles, comments and
Visit the FaQ click on the first and last photo you wish to group into a tags (keywords), all of which can help you find them.
at https:// single event, before choosing Events > New Event. If Select a photo or group of photos and you’ll find options
wiki.gnome. you’re creating an event from photos spanning more for adding a title and comment under the Photos menu,
org/apps/ than one day you’ll need to select the month in which while the Tags menu enables you to both add new tags
Shotwell/FaQ they appear under Events (or the year, if the event is and modify existing ones. Tags are a good way of
for complete
split across two or more months). From here Shift+click adding locations to your photos; you could for example
details.
make it a rule to include a village/town, county/state
and country, so Ventnor, Isle of Wight, or Vancouver,
British Columbia, Canada for example.
You can also rate photos from one to five stars,
enabling you to rank your photos or even simply sort
your photos from best to worst. Look under Photos >
Set Ratings for the options available to you.
Select a month One final tool allows you to flag individual photos.
under Events The photo’s thumbnail is marked with a small grey
and you’ll see a
summary of all
exclamation mark, enabling you to draw attention to it
events in that for whatever reason you like – for example, marking
period. photos that need correcting. Right-click a photo or
selection of photos and choose ‘Toggle Flag’ to switch it
on or off as required. When you’ve flagged one or more
expaND SHotwell photos, you’ll be able to view them all together by
selecting Flagged under Library.
Shotwell’s capabilities can be increased through the use of plug-ins, By default, all of these changes have no impact on
some of which are provided with the program. These are managed the files themselves, but you may find that embedding
via the Edit > Preferences > Plugins tab, and you’ll see there are three the metadata into the files could be useful, because it
categories: Data Imports, Publishing and Slideshow Transitions. makes that data available to other applications. To do
These are the only plug-ins currently published and available for this for all the files in your collection, simply choose Edit
Shotwell, and they do change over time – for example, an option to > Preferences and tick ‘Write tags, titles and other
publish to Facebook was recently removed as it no longer works. metadata to photo files’. To apply it to individual files
You can see the current status of Shotwell’s plugins by taking a trip only, you’ll need to export the file (see below).
to http://bit.ly/lxf249shotplugs, where you’ll discover that the
obsolete Picasa Web Albums plug-in is in the process of being Shotwell’s image editing tools
updated to support publishing to Google Photos instead. Not all photos comes out perfectly, and Shotwell offers
If you fancy writing your own plugin, visit http://bit.ly/ some tools to help you make certain improvements.
lxf29shotplugs2 for a complete guide to doing so. After completing As already stated, these changes are all non-destructive
your plug-in, open your /Home folder in Files and create the following – the underlying file isn’t changed, so you can
folder path: ~/.gnome2/shotwell/plugins. Copy your plug-in file to experiment to your heart’s content without worrying
here and restart Shotwell – the plugin should now be available. about ruining the original file.
Individual changes can be undone as you make them
in the usual way with Edit > Undo, or you can remove all
of them at any time by opening the image and choosing
Photos > Revert to Original. If you perform any edits,
hold Shift to view the photo in its original, unedited form
Manage Shotwell’s for comparative purposes at any time. If you do make
plug-ins from the significant improvements to your photos that you’d like
Edit > Preferences to keep, you can save the edited version to disk: choose
dialogue. All
currently available
File > Export and choose any option other than
plug-ins can be ‘Unmodified’. You’ll also have the option to export any
found here. metadata you’ve attached to the picture. Either save
your copy to a new location or overwrite the original.

64 LXF249 May 2019 www.linuxformat.com


Organise photos TuTorials

To edit a photo in Shotwell, double-click it and you’ll Flickr is one of


see the controls you need at the bottom of the screen. the few publishing
options offered
Most are self-explanatory – Rotate and Crop, for
by Shotwell right
example – while clicking Enhance enables Shotwell now – sadly
to perform automatic adjustments that can quickly (thankfully?–Ed),
improve a photo’s lighting or colour balance. All Facebook is no
changes can be undone via the Edit menu. longer supported.
You’ll also notice three other options, which require
a little more explanation. If you’ve scanned something
in – an old photo or document, for example – chances
are it’s slightly skewed. Click Straighten to overlay a
grid on your photo, then either use the Angle slider to
perform adjustments or click and drag the cursor in a
line over the photo to realign it along that line’s angle.
Once done, the photo will update automatically, but
until you click Straighten it won’t actually apply the
change; click Cancel to void it, or Reset to start again.
The Red-eye button’s purpose is obvious. First, zoom with the Shadows/Highlights sliders, so if you’re not
into the photo so your subject’s devilish eyes are 100 per cent happy with its results, leave Enhance
magnified, then click Red-eye. A small circle appears in clicked and then focus your tweaks on these tools. If Shotwell
the centre of the photo: start by positioning it over the appears to
freeze after
first eye and using the Size slider to resize it. When it Share and publish switching on
has surrounded the red portion of the eye, click Apply Shotwell also offers various ways in which you can
your camera,
and move on to the next eye. share your photos with others. The simplest is via switch off the
The final option is the most powerful: if you don’t feel email: simply right-click a photo and choose Send To… camera and
that Shotwell’s Enhance button has done enough to fix You’ll see similar options to those offered when close Shotwell.
your photo’s poor lighting or colour, click Adjust exporting the photo, but we’d recommend choosing open Files,
instead. A pop-up window appears, displaying a JPEG for starters, then setting a scaling constraint – then switch the
histogram of the current image. You’ll see so-called typically ‘Longest edge’ – in pixels before clicking OK, camera back
‘Intensity Threshold’ markers appear at either end of it. at which point the photo will be sent to your email on. after a short
These change the lightness of the brightest white and application in the form of an attachment. pause it should
appear – click
the darkness of the darkest black, and are particularly There are also several options for publishing your
to open it and
good at correcting washed-out images. photos online: choose File > Publish or press Ctrl+Shift
you’ll see an
There are also seven sliders you can adjust for +P. By default there are options to publish to Flickr, option to open
additional corrections, including colour issues. The Google Picasa Web Albums and Piwigo for photos, and it in Shotwell –
step-by-step guide below walks through these in more YouTube for videos. Gallery3 and Tumblr options are click this
detail. It’s worth noting that the automatic Enhance also available, but only after enabling the plug-ins – see and it should
button tweaks the Intensity Threshold markers along the box (on page 64) for more about those. now function.

perForM MaNual lIgHtINg aND Colour aDjuStMeNtS

Adjust exposure Tweak colour balance Additional adjustments


1 The Exposure slider creates the 2 Photo looks washed out? Try 3 Use the Temperature slider to make
effect of changing a photo’s exposure time pushing the Saturation slider right to inject cold-looking photos warmer (or vice versa).
– push the slider right to lighten an more colour. Drag it all the way left to The Shadows slider is useful for bringing
underexposed photo, or left to darken it. remove the colour so it becomes greyscale. out detail hidden in dark areas of the image,
The Contrast slider helps counter washed- If your camera has incorrect white balance while the Highlights slider enables you to
out photos (push right) or narrow the range settings, use Tint to correct them by adding reduce the number of bright areas. Use 
between dark and light (push left). more red (move it left) or green (right). Shadows and Highlights together.

BeCoMe Better orgaNISeD Subscribe now at http://bit.ly/LinuxFormat


www.techradar.com/pro/linux May 2019 LXF249  65
back issues

Back issues Missed one?


Issue 248 Issue 247 Issue 246
April 2019 March 2019 February 2019

Product code: Product code: Product code:


LXFDB0248 LXFDB0247 LXFDB0246

In the magazine In the magazine In the magazine


Find out how to Lock down We bring you
relive the entirety of computing Linux Mint 19.1 tighter than the ed’s 100 of the best open source tools,
history (well, most of it) through wallet with our full guide to security. ranging from audio and video
open source. Build your own Pi We take at look at the huge range of software, to file management and
Camera photobooth, check out our photo editors available in Roundup, security, and more. There’s tutorials
Roundup of vector graphic editors, show you how to get your head on desktop publishing, Emacs and
build a better WordPress server, around Git, build a 2D platform Middleman, plus how you can get
and make scanning easy. game, and make your terminal talk. into open source astronomy.

DVD highlights DVD highlights DVD highlights


Qubes OS 4.0.1 64-bit, possibly the Linux Mint 19.1 Cinnamon 64-bit It’s a Linux starter pack: Bodhi Linux
most secure Linux distro to date. and Xfce 32-bit editions. Tasty! 5.0, Voyager 18.10 and Sparky 4.9!

Issue 245 Issue 244 Issue 243


January 2019 December 2018 November 2018

Product code: Product code: Product code:


LXFDB0245 LXFDB0244 LXFDB0243

In the magazine In the magazine In the magazine


Roll up your Discover how Leave Windows
sleeves and get making, with our to run Linux in a virtual environment for Mint-flavoured pastures new –
handy feature on bread boards, with our 10-page guide. We review we have an in-depth guide. Five
soldering irons, LEDs and more. five office suites, reveal how to make video-editing packages go under the
Then design a magazine in Scribus, your web forms bot-free, and run Roundup microscope, we explore 3D
write a Sudoku checker in Go, learn through how to set up a video player photography, build an Android app
what you can do with Kubernetes, on the Raspberry Pi. And we go cave and get the most from weather
and we review five web servers. diving with open source technology! sensors. Plus: run a secret server.

DVD highlights DVD highlights DVD highlights


Experience the might of Manjaro 18, Try Elementary 5.0, the distro that’s Linux Mint 19 Cinnamon, Slax Linux
and try out 32- and 64-bit Fedora. ideal for beginners. Plus Ubuntu 18.10. 9.5.0 and Peppermint OS 9.

To order, visit myfavouritemagazines.co.uk


Select Tech from the tabs of magazine categories, then select Linux Format.
Or call the back issues hotline on 0344 848 2852
or +44 344 848 2852 for overseas orders.

Quote the issue code shown above and have your credit or debit card details ready

66 LXF249 May 2019 www.linuxformat.com


UK subs
NOT FROM THE UK? turn to
p26

SUBSCRIBE!
Don’t wait for the latest issue to reach your local store –
subscribe today and let Linux Format come straight to you!

3 GREAT
WAYS TO
SUBSCRIBE
Print, digital, and
print + digital
bundles!

USA REST OF THE WORLD EUROPE


From $15 From $15 From €15
every 3 months every 3 months every 3 months

IT’S EASY TO SUBSCRIBE!


Click: www.myfavouritemagazines.co.uk/sublin
Call: +44 344 848 2852
Lines open 8am–7pm GMT weekdays, 10am–2pm GMT Saturdays*
Savings compared to buying 13 full-priced issues. You’ll receive 13 issues in a year. You can write to us or call us to cancel your subscription within
14 days of purchase. Your subscription is for the minimum term specified and will expire at the end of the current term. Payment is non-refundable after
the 14-day cancellation period unless exceptional circumstances apply. Your statutory rights are not affected. Prices correct at time of print and
subject to change. *UK calls will cost the same as other standard fixed line numbers (starting 01 or 02) and are included as part of any inclusive or free
minutes allowances (if offered by your phone tariff). For full terms and conditions please visit http://bit.ly/magtandc. Offer ends 31 May 2019.

www.techradar.com/pro/linux May 2019 LXF249 67


TUTORIALS Audio editing

AUDACITY
Advanced audio
recording and editing
John Knight returns to his old recording friend Audacity once again,
and finds things have become a little more advanced.

ig audio suites are great, but they can be Although technically Audacity can record multi-

B intimidating to say the least – sometimes


you just want something that works without
channel digital audio, the interface really isn’t designed
for it – it’s meant for simple recording in mono or
having to think too much about it. Enter Audacity, stereo. If you’re looking for a Pro Tools replacement,
OUR from: www.audacityteam.org.
Audacity has become popular on all desktop
Audacity isn’t it: try Ardour or QTractor instead. But if
you’re looking for an easy to use wave editor and a fast,
EXPERT platforms, and has started popping up on YouTube simple way of making stereo mixes, it may be what
John Knight tutorials quite a bit. Known for its ease of use and you’re looking for. Audacity lets you get deep into the
writes ebooks on intuitive interface, Audacity is perhaps the audio wave form and perform easy cuts and edits, making it
how to play the equivalent of Microsoft Paint (erm…–Ed) – it can’t do very popular among technicians who want to cut
drums, when he’s deeply complicated tasks, but then it was never together quick edits, and apply basic effects without
not playing with a intended to do so. It’s designed around simple controls getting bogged down by a complex interface.
Commodore 64 that most people can guess their way around… though Nevertheless, Audacity has undergone some
emulator. that doesn’t mean you can’t achieve some great results! changes lately, and at first glance some long-time users
might have their nose put out of joint. So for the new
Audacity’s interface users we’ll give you a walkthrough of the major features,
and for the veterans we’ll show you what’s changed and
how to adapt to it. We won’t be showing you all the
1 features, but we will cover enough of the essentials to
start a workflow.
5
6
3 Sounds good
In order to show you how Audacity works, we first need
to have some audio to play with. You can either import
2 some existing audio or just record random sound (blank
silence is fine) – it doesn’t really matter, as long as
there’s an audio track of some sort.
4 If you want to add some existing audio tracks, you
can run through a maze of GUI prompts if you really like,
or you can just click and drag them onto the editing
field. As for recording audio, just hit the Record button
in the main toolbar, and if you’re using an internet mic,
clap your hands a few times – that should show up on
the waveform. Press Stop when you’re done and we’ll
Main Toolbar Collapse Button be able to look at Audacity properly.
1 Where your primary tools are kept, such 4 Squishes up any track into a kind of sliver The Device Toolbar lets you change which sound
as Selection, Time Shift, Zoom and Envelope. which can be expanded later. card you want to use, and which audio host will run the
system – likely ALSA, maybe with the option for JACK.
Track Controls Zoom Controls
2 Tools for muting, soloing tracks and 5 Dedicated buttons for specific zoom For your recording device, you will probably have
changing the gain and the pan. This is where functions, including zooming into a selected options for Default (most likely an ALSA device) or
you really shape your soundscape. portion of a wave, or zooming out 100%. Pulse. ALSA will probably run quicker and be kinder
on the system, though Pulse will likely be easier to get
Track Menu Recording Options
3 Provides a bundle of more advanced 6 Choose which audio system you want
working if your system is already configured around it.
controls, such as mono-stereo conversion, to use, which device to record from, mono or Perhaps of chief importance is the number of
as well as renaming and moving tracks. stereo, and change the playback device. Recording Channels. Here you can choose between

68 LXF249 May 2019 www.linuxformat.com


Audio editing TuTorials

one channel for mono or two for stereo. Don’t just


choose stereo because you think stereo = better.
If you’re recording a single instrument, it may be easier
in the long run to record this in mono, even if you will
ultimately be creating something in a stereo image.
If you’re recording something like an FM broadcast or
capturing computer audio, this is something you will
want to do in stereo.
Audacity’s toolbar – which has the snappy name
of ‘Audacity Tools Toolbar’ – houses the main tools
like Select, Draw, Time Shift and Zoom. By default the
Selection Tool will be enabled, and is used for
highlighting audio before doing things like cutting and
pasting, muting sections and so on. Cutting and pasting
is done by the usual shortcuts, so you’ll have no
problems there, and you can use the Delete key
on selected bits of audio. You can select the magnifying
glass for Zoom: left-clicking zooms in, and right-clicking Audacity is still the
zooms out. You can zoom right down to the grains of More advanced users will want to check out the easiest way to do
multi-track editing
each waveform if you want to do some hardcore options Swap Stereo Channels, Split Stereo Track and
and recording,
manual editing, and if you select the Draw tool, you can Split Stereo to Mono. These features are so much even though it’s
even re-draw the shape of the wave. quicker and easier than what you encounter on now slightly more
If one of your tracks is out of sync with the other professional editing suites, and are perfect for anything complicated.
recorded tracks, you can use the Time Shift tool to that involves switching between mono and stereo.
correct it. If you click and drag left or right it will move
the timing forwards or backwards, and you can even Get recording
move a track to before the zero-second mark. Getting started with the first track is the hardest part
Further on the right are the zoom controls, all with of any recording session. You’ve got to make sure the do you have
different magnifying glass icons, which replicate the correct input is selected, get the levels right, and check some pesky
audio that only
Zoom tool. The icons with the + and - let you zoom all that your recording is actually coming through on your
runs through
the way in to the fine points of a waveform, or back out program’s waveform. If you’re very lucky you’ll be able
one speaker?
so that you can see the track as a whole. to just hit the Record button and it will work. But even you can fix it
with something as easy as Audacity, you’ll probably be by clicking the
Going solo greeted with a blank wave and need to spend ten track’s drop-
Less obvious, but crucial when you get the hang minutes switching between inputs to find what’s wrong. down box and
of things, are the next two controls: ‘Fit selection in Before we get too negative, try your luck and hit the choosing split
window’ and ‘Fit project in window’. When you have big Record button. Make some noise and if all is well, stereo to Mono.
some audio selected, ‘Fit selection in window’ will zoom you will see the sound outputting into a waveform. If
in until your highlighted selection fits perfectly on the you were greeted with silence and a flat line, first make
screen – no more and no less. When you need to see sure the recording option for that channel is enabled in
the project as a whole again, ‘Fit project in window’ your mixer and that it’s not muted. Otherwise, try
zooms all the way back out in one click. changing entries from the Recording Device drop-down.
Moving to the tracks in the main editing field, track Unless you have a Goliath of a sound card, there
controls are on the left. Each track has a close button shouldn’t be too many entries to test, and you can
which removes the track, and a drop-down menu. probably choose between several channels under
Plenty of advanced options are in the drop-down menu,
but the main controls you’ll use are the Mute and Solo
buttons, plus the two sliders. The Mute and Solo Adding effects
buttons should be fairly self-explanatory, but remember
that you mute each track individually, rather than all of Because Audacity cuts out the complex audio buses that underlie big
them en masse. While the Solo button will obviously editing suites, adding effects is incredibly easy. Just select whatever
mute all other tracks, you can ‘solo’ more than one audio you want to apply an effect to and choose it from the Effect
track – something that will annoy many pedants! menu – and if more input is required, most effects have a settings
Moving down to the two sliders, the first is the Gain window with a handy Preview button. As for the effects included by
control. In simple terms it basically turns up and down default, you will want to pay particular attention to Fade In and Fade
the volume of each track; in audiophile terms, this is Out, Amplify, and Equalisation. Note that Amplify is useful for making
where pre-amp adjustments happen. The second slider things both louder and quieter, as you can simply enter a negative
is the Pan control, which lets you move sound left and value if you want to turn something down.
right in a stereo image. While Audacity has a number of effects pre-installed, we
Looking to the advanced controls in the drop-down recommend installing extra plug-ins. Audacity supports LADSPA,
menu, the first option is Name, where you can rename LV2, Nyquist, VAMP and VST plug-ins, and you should be able to find
each track individually. The Move Track Up and Move quite a few plug-ins in your package manager. Just browse around
Track Down features will become essential when you and install anything you like the look of! Anything to do with reverb,
start doing elaborate multi-layered editing, as this lets chorus or flange is probably a good idea.
you re-order the tracks.

www.techradar.com/pro/linux May 2019 LXF249  69


TuTorials Audio editing

Default or Pulse. Default will probably use ALSA, which if it starts clipping. Depending on your underlying audio
will run much faster, but if you’re using Pulse audio, system, you may be able to turn the recording levels
A cool feature open the properties for your sound card. In KDE we had back down with the slider in the top-right of the window.
veterans may to open the Advanced tab in the Audio Volume section,
not know about and from the Profile drop-down box, we used Analogue Running tracks
is the Wave Stereo Duplex. If you’re using digital speakers, just try Recording a piece of audio is great, but you can do
color entry anything that enables an analogue input. Once you have that on just about anything. What makes Audacity so
in the drop- something that works, write down what you did and popular is that it does multi-track layered recording,
down menu, don’t mess with it – record everything you can while it’s and probably makes it easier than any other program
which has
working! After this, Audacity should be smooth sailing. out there. If you’re new to the concept of multi-track
four different
colours, and is
Now to tweak the recording levels. recording, it allows you to record sounds one at a time
meant for easily The smaller the wave in height, the worse the in layers, slowly building up a soundscape.
differentiating signal-to-noise ratio will be, making the track hissy and For instance, the most common usage is in music
between probably muffled. The louder the recorded input, the where you may record each musician in isolation, rather
instruments. more likely it will ‘clip’ the edge of the waveform and than recording the band as a whole. You may lay down a
sound horrible and distorted. You want to strike a drum track first, and with that first drum track in their
balance where a good amount of space in the wave headphones, the bassist can record their track in a new
form is used, but leave room in the dynamic range for second layer. Then the guitarist could hear the drums
sudden loud notes, such as a big cymbal crash. Keep and bass playing through their headphones and record
turning up your instrument, input or mixer desk until their guitar in a third layer. With the instrumentals
your waveform is getting near the edge, and back it off finished, the singer can record their vocals.
If you’re a seasoned Audacity user, you need to
know that things have changed. When you hit the
Record button, Audacity used to create a new track
automatically and start recording in that. Now when
you click Record, Audacity will start recording on the
end of the current track, and just keep on adding to it.
If you would rather record into a new track, use the
keyboard instead of the mouse. Pressing R records
onto the end of the current track, but Shift+R records
into a new track. If you’re determined to have things the
The Envelope way they used to be, you can change it by choosing Edit
tool lets you > Preferences from the main menu. Open the
make smooth Recording section and in the Options field, click
and continual ‘Always record on a new track’.
transitions to
volume over time,
Note that Audacity now has latency correction built-
such as a long in, but some audio device settings may result in an error
fade-out. regarding latency timing. If this is the case, you can also
tweak your latency correction settings in the
Preferences window. In the Devices section, you can
recording With JAcK tweak the buffer length and ‘Track shift after record’
settings in the Latency field.
Running Audacity with JACK rather defeats the purpose of its simple
interface, but maybe there’s some kind of effect chain you want to Track-on-track action
create, or some kind of MIDI program you need to use, and the only Not only can Audacity do multi-track recording, but you
way to do it is JACK. First, you need to make sure JACK runs can also edit each recorded layer individually, making
properly. We recommend installing QjackCtl, which provides tweaks to any layer without upsetting the others. Going
a straightforward GUI for starting and configuring JACK. back to the band example, if you simply recorded them
If you try to start JACK and get an error, first try specifying your in one live image, you would have to mix them together
soundcard by clicking Setup, and in the Settings tab will be the as a whole and you wouldn’t be able to make many
Interface drop-down menu. Change the setting from ‘(default)’ to adjustments. But with separate tracks you can correct
your soundcard’s actual device name. If this doesn’t work, make mistakes and tweak each recording individually.
sure Driver is set to ‘alsa’ instead of ‘dummy’, and if it still doesn’t For instance, if the guitarist plays a bum note or the
work, try disabling ‘Realtime’. drummer coughs during silence, you can simply mute
To change Audacity from using ALSA to using JACK, open your their second of bad audio and the rest of the song will
system settings by choosing Edit > Preferences and in the Devices be unaffected. Or, if one instrument is too loud, you can
tab will be the Interface section. For Host, open the drop-down menu turn the volume down on just that track without
and change the entry from ALSA to ‘JACK Audio Connection Kit’. affecting the volume levels of any other musician.
It’s best to leave everything at default settings and see if you can If you want to turn a track up or down, just move that
record as-is. If you need more JACK connectivity, you change track’s Gain slider. If you wish to mute a second of
Audacity’s Playback and Recording devices to JACK, though you may audio, simply highlight the portion of audio you don’t
need to manually connect ports in QjackCtl’s Connect window. JACK want and press Ctrl+L, or click Edit > Remove Special >
is messy and temperamental at the best of times. Don’t use it with Silence Audio. For more advanced users who want to
Audacity unless you really need to! do volume automation, there is the Envelope Tool in the
main toolbar. This lets you make smooth volume

70 LXF249 May 2019 www.linuxformat.com


Audio editing TuTorials

is saved to an external audio file. The ‘Export as…’ and


‘Export Audio’ options save an image of your work
exactly as it sits now – mixer settings, effects, and to make a split
everything. This is something you’ll want to do when in the audio,
you’ve got everything just the way you want it. choose the
WAV files are something of a de facto standard in selection tool,
the mixing world because pretty much anything can click where you
want the split,
read them, although no one’s going to shout at you for
and click edit >
using FLAC files. Use WAV or FLAC wherever you can
clip Boundaries
while you’re mixing – most compressed formats like > split. now
MP3 or OGG are lossy and should only be used for you can move
distribution after you’ve already made a proper master. sections of
If you don’t like WAV, OGG or MP3, more encoding the wave
options are available using the Export Audio function. independently.
For Audacity veterans, there is some cool new time-
Each track has a handy Collapse function, which is perfect for focusing saving functionality for the Tracks menu, under the sub-
on one track when the number of tracks becomes overwhelming menu Mix. There are three options: Mix Stereo Down to
Mono, Mix and Render, and Mix and Render to New
transitions by creating two lines: one on the edge of the Track. The first option is pretty self-explanatory,
track and one on the edge of the waveform, which can converting any selected stereo tracks into mono. Mix
be dragged around to reshape the wave’s amplitude. and Render converts all your current tracks into one
The outer line will bring down volume overall, but the single track, including any volume or pan adjustments,
inner line can be dragged upwards to increase the added effects and so on. Note that you will have to
wave’s amplitude. ‘Select All’ to make this work properly.
The really fun bit of Audacity is creating custom Lastly, Mix and Render to New Track does the same
stereo images. You can take a large selection of tracks, Mix and Render, except it leaves the existing tracks as
and by sliding the Pan control on each, you can create they are and creates a new rendered track beneath
a large stereo image in your own virtual soundscape, your current tracks.
making your music or home movies really come alive.
If this is something you’ll do a lot of, a common All mixed up
mixing technique is to actually record individual voices Audacity has undergone quite a few changes of late,
or instruments separately in mono. This makes it much most of which push it toward being a more viable and
easier to manage when you want to create a stereo mix, professional multi-track recording program. However,
because if the imported track is already in stereo, it these changes also add to its bulk and complexity; the
adds unnecessary complexity and filesize. If you’ve simple truth is that Audacity is no longer as simple as it
recorded each voice in mono, you simply import all of once was, which may scare off some new users and
the tracks into the same session and assign their place even put off some veterans.
in the stereo mix with the Pan slider. Nevertheless, Audacity is still the friendly and
A common scenario is with digitally recorded drums, intuitive program it has always been. As long as it
where each drum mic will have recorded to a separate doesn’t gain much more in complexity, existing users
channel, with each channel outputting to a separate should be able to adjust and Audacity will maintain its
wave file. If you import all of these files at once you will niche as the easiest way to get into multi-track
just hear a dull mono image, but if you use the Pan recording and editing.
slider, you can place each drum and cymbal virtually
based on where they would sit in real life.
For instance, overhead mics will usually be mixed far
left and far right, the hi-hat on the left, the ride cymbal
on the right, and the kick and snare will usually be
mixed around the centre. If you put the snare slightly
left and the kick slightly right, you will be able to hear
each drum more clearly in the mix and avoid
overlapping frequencies.

Trade-free exports
Simply saving your work isn’t going to be of much use,
because the only thing that will read Audacity files is
Audacity – you need to export your work. If you click
File and look at the Export sub-menu, you will see a
number of options. Firstly, we need to differentiate
between the ‘Export as…’ options and ‘Export Selected
Audio’. The ‘Export Selected Audio’ option is simple By simplifying and stripping back the underlying system, applying audio effects is much easier
enough: whatever you highlight with the Selection Tool than it is in big editing suites.

WAnt More sound ideAs? Subscribe now at http://bit.ly/LinuxFormat


www.techradar.com/pro/linux May 2019 LXF249   71
TUTORIALS WordPress to static HTML

APACHE Part Two!

Building a secure
Missed part one
in LXF248? See
p66 for back
issues!

website to host sites


Stuart Burns shows you how to create a secure web server on which you
can host statically generated WordPress sites on a secure Apache server.

ne of the great things about dealing with static select the $5 instance. Choose an appropriate

O content is that having no PHP or database


dependencies, this means that not only are
datacentre (we suggest choosing the one that’s most
geographically close to you) and click the green Submit
the sites more performant, they consume less bar. Shortly after submitting the request you should
resources and therefore are not only less expensive but receive an email with the root password.
OUR backing up the important data is trivial. There are many
VPS (Virtual Private Server) providers you can choose
It’s possible to use public/private keys to log in, but
the specifics may vary by vendor. We’ll implement a
EXPERT for this task. For this instance we are going to use public/private key setup for our server manually.
Stuart Burns DigitalOcean (www.digitalocean.com) as they are very The email should contain both the server IP and
specialises in fast, easily accessible and inexpensive. address and root password. Log in to the server using
large-scale This second instalment builds on the previous the following command in the terminal window:
infrastructure tutorial around creating performant static websites ssh root@<ip address>
management and from a local WordPress instance. It is assumed at this Assuming you trust this IP, it will ask you to accept
virtualisation point the reader is able to create and successfully the fingerprint. On initial login you’ll need to change the
technologies, and export the WordPress site as a zip file containing the password. Enter the password and confirm it. All being
writes about new static Worpress export files using the SimplyStatic well you’ll be logged into the server as root. This can be
and emerging tool. The next step is to create an internet facing confirmed by using the command whoami . This will
technologies. webserver for this purpose, which is what we’re going confirm the current user logged in.
to cover here. The first step is to update the server to include
The first step is to create an account with the latest patches and reboot. Perform this with the
DigitalOcean, which is pretty simple and straightforward following commands:
– you can also use an existing Google account if you apt-get update && apt-get upgrade -y
Simply Static’s prefer. Once you’ve signed up, select Ubuntu 16.04 LTS reboot
output generation. as the distribution choice. Select the starting plan and The next step is to configure users, because being
logged in as the root user for most purposes is not a
good idea from a security stance. Create a user with
the following command and set a password for it.
useradd -m adminuser -s /bin/bash
passwd adminuser
The next step is to add the user to the sudoers,
the users who can elevate their rights and run
administrative command using the sudo command.
Luckily, this is quite straightforward:
usermod -aG sudo adminuser
Verify this is working by using the command:
id adminuser
This command should give a list of the groups the
user belongs to: one of them should be sudo. It should
now be quite straightforward to log in using the admin
user and the new password, using SSH as we did
before: ssh adminuser@ip_address . Test that the sudo
elevation works by using the command sudo su . If it
does work, you can move on to making the environment
a bit more secure. One of the first things to do is to
disable the abilities of the root user. Open the

72 LXF249 May 2019 www.linuxformat.com


WordPress to static HTML TuTorials

configuration file for OpenSSH by using the command:


sudo vi /etc/ssh/sshd_config
Find the line that reads PermitRootLogin and
change that from Yes to No . With the file still open
there are other changes we can make. These include
changing the default SSH port. While this may not
sound like much, it removes a lot of low-level port
scanning on port 22. It won’t stop determined hackers
but it makes logs smaller and removes the low-level
detritus. Locate the line Port 22 and change that to
some other random port number. To make these
changes permanent it’s important to restart the
OpenSSH server. This is done with the command
sudo service sshd restart
To log in now using our new port number we need to
modify how we use the ssh command. To specify a
port, use the -p switch. For example, to log in to
192.168.0.10 using port 999 the command would be.
ssh adminuser@192.168.0.10 -p 999
Assuming everything works as expected, we can now
enable public/private key logins. This negates dictionary ServerName livinginstarbucks.com Signing up for
attacks and makes the setup even more secure. On your ServerAlias www.livinginstarbucks.com DigitalOcean.
local Linux workstation, open a terminal window and ErrorLog ${APACHE_LOG_DIR}/error.log
generate the public private keys using the following: CustomLog ${APACHE_LOG_DIR}/access.log
ssh-keygen combined
This will ask where you want to store the files; go </VirtualHost> the default
with the default by pressing Return. We strongly advise It’s a good idea to give each site its own set of log Wordpress
design includes
using a passphrase, as that prevents anyone who has files. Ideally, put each site’s log files into separate
several items
access to the private key from just using it to log in. folders – this makes it easier to perform analytics and
that aren’t
Once it has been generated, it can be copied to the web- troubleshooting. Repeat until all the sites you want to useful for
facing host using the ssh-copy command: upload are done. To activate a site, use the following anything in
ssh-copy-id adminuser@webserver-ip -p 999 command with the appropriate configuration file. the world of
To enable public/private keys for login, open the sudo a2ensite /etc/apache2/sites-available/ htML-only.
sshd_config file again and change the Password livinginstarbucks.com.conf therefore use
authentication line to no , making sure it is not Before restarting the Apache service (and to help the Wordpress
commented out. Before progressing, try logging in mitigate any downtime), run apachectl configtest to web design tool
using the ssh application again (don’t forget we check for any errors. All being well, restart the service to remove these
links from the
changed the port number too!). This time it should offer with sudo service apache2 restart . If you ever need to
default website,
up our private key and let us log in once we’ve given it roll it back there is a similar command called a2dissite .
such as the
our passphrase. Essentially this is a quick way to add and remove sites meta menu.
Now we can deploy the Apache infrastructure. While from the live environments.
logged in, install Apache using the following command: At this point, we are almost there. Assuming that the
sudo apt-get install -y apache2 export from our WordPress site is on the local Linux
Test to ensure Apache is working by opening up a
local web browser and browse to the website. It should
show the famous Apache website landing page. BAckups And restoring
Assuming all works as expected, we can turn our
attention to making the infrastructure for our various It’s not the most riveting topic, but there is an important need to
websites. As with the actions we performed in the first perform a good backup. Critically, make sure you have a backup of
installation we need to create a base folder for each the source VirtualBox machine. Losing this would be catastrophic
website, like so: because there is no way to put the HTML output back into WordPress
sudo mkdir -p /var/www/livinginstarbucks.com/html – or at least, not without a lot of manual effort. Luckily, backing up
The next step is to create the appropriate the VirtualBox server is as simple as ensuring the virtual machine is
configuration file for each website. We could copy the shut down and then copying the folder and its contents to a backup
original file but in this case, because our requirements location, ideally an external drive or such. Restoring the VM is as
are so simple we’ll just start with an empty file and build simple as copying it back to your local system and then importing it
our own configuration. For each website, create the file: into VirtualBox, from the menu.
sudo vi /etc/apache2/sites-available/livinginstarbucks. Backing up the HTML code is important, as mentioned, for version
com.conf control. Assuming you’re using a folder that is Git version-controlled,
Each site needs a configuration file. Copy the one again it becomes simple to copy the folder (make sure to include the
below and edit to suit your server. Save it and quit. hidden files and folders that are part of the Git setup). Copying the
<VirtualHost *:80> entire contents enables you to keep your version-controlled contents
ServerAdmin webmaster@localhost of the HTML files within easy access to all previous versions that are
DocumentRoot /var/www/livinginstarbucks.com/ stored online.
html

www.techradar.com/pro/linux May 2019 LXF249   73


TuTorials WordPress to static HTML

workstation, we can use scp (Secure Copy) to copy opening the website it could well be that the rights are
the compressed file to the webserver. Do this with the incorrect. With that in mind, for each website perform
following command: the following commands:
scp /path/to/wordpress_exprt.zip -p 999 /home/ sudo chown -r www-user:www-user /var/www/
adminuser livinginstarbucks.com/html
As we are now using public/private keys for sudo chmod -R 755 /var/www/*
authentication, it will ask for your passprase. Once Because we’re using a virtualhost configuration, we
it’s uploaded, uncompress the Zip file using unzip need to make the DNS work as there are several sites
wordpress_export.zip . Copy the files from the local that share the one IP address. If you haven’t yet done
folder to the root folder of the webserver. so, it’s time to change DNS records. The reason we’ve
cp -r /home/adminuser/uncompressed_word_folder/* left it until this point is that if there is already a live
/var/www/livinginstarbucks.com/html website, it will go offline as we update it now.
By default, the Apache server runs with highly How you update will depend on your DNS provider.
Contents of the restricted rights. It is important to make sure that the Most DNS updates will be updated almost instantly. At
live website:
pure glorious files are owned by the right user (www-user) and that this point it should be possible to open a web browser
HTML files! the rights are correct. For example, if there are errors on to navigate to the URL in question. If you haven’t
updated (commented out) the entries in your localhost
file, you may get the wrong results. Just check you are
looking at the right server by pinging the DNS name.
If there are additional websites, repeat the process
for each one. To do things properly we should configure
the entries on the host so that the host can know what
it looks after. Open the hosts file and add all your
entries to the hosts file:
sudo vi /etc/hosts
Look for the line 127.0.0.1 and add both the
hostname and the www alias. Therefore, our example
would be:
127.0.1.1 localhost livinginstarbucks.com www.
livinginstarbucks.com
Lastly, implementing the correct firewall rules is
definitely strongly recommended. Implementing a
firewall with a proper policy provides protection from
ports that are open when they shouldn’t be. Using the
firewall can also allow extra security by blocking IP
ranges, or even countries if needed.
iMpLeMenting https is eAsy If you’ve got a static IP address, it’s pretty simple
to use firewall rules to prevent anyone from any other
Most technically savvy readers will know that HTTPS is the way network being able to attempt to SSH into the
forward, but historically it has always been tricky to configure. Enter, webserver. The best defence has multiple layers of
stage left, EFF’s Certbot. This is designed to implement HTTPS easily, security that prevent any one single facet breaking.
and really is super simple. To implement it, do the following: With that in mind, we’ll install UFW (Uncomplicated
sudo su - Firewall) using the following command:
apt-get install software-properties-common python-software- sudo apt-get install ufw -y
properties Before making it live, we need to make some
add-apt-repository ppa:certbot/certbot modifications, not least because our SSH port was
apt-get update changed earlier. We also want to allowing inbound
apt-get install python-certbot-apache HTTP requests. To add this port use the commands:
The above provides the dependencies, but to actually run and sudo ufw allow 999/tcp
implement the configuration use the following command: sudo ufw allow 80/tcp
certbot --apache -d mydomain.com sudo ufw allow 443/tcp
It will take a few moments to run but will configure everything for To make the firewall live use the command:
you. Once it’s complete, assuming that you’ve followed the main sudo systemctl enable ufw
guide it should be as simple as reloading the page, simply swapping It’s a good idea to ensure that the webserver can be
HTTP for HTTPS. reached on port 80 (HTTP), which aids with
Do note, however, that Certbot only approves certificates for a troubleshooting later on.
period of three months. This isn’t too much of an issue because it Currently there will be some defaults set up which
gives you the option to log in periodically and re-run Certbot, or are surplus to requirements.
perhaps use crontab to automatically re-run the command every sudo ufw status
week – Certbot only performs the renewal when there is a set We’re assuming that you’re not interested in running
amount of time remaining. IPv6. Therefore it makes sense to disable IPv6 – if it’s
Certbot also supports multiple domains at once, removing the not used, it should be turned off. To disable IPv6 use
need to manually manage each one – not to mention saving time, the following commands:
money and complexity! sudo vi /etc/sysctl.d/99-sysctl.conf
net.ipv6.conf.all.disable_ipv6 = 1

74 LXF249 May 2019 www.linuxformat.com


WordPress to static HTML TuTorials

net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1 understAnding Mod_reWrite
One done, use the command sudo sysctl -p to make
the changes permanent. Doing so can, however, impact Without this function working correctly, the whole export process will
applications such as apt. To mitigate the issue, force fail. Mod-Rewrite is used to rewrite URLs on the fly. Signs of it failing
the apt tools to use IPv4. Do this by editing the to work may be seen if the administrator clicks on a link and they get
appropriate file /etc/apt/apt.conf.d/99force-ipv4: the well-known ‘404 page not found’ error. The entire permalink
sudo vi /etc/apt/apt.conf.d/99force-ipv4 setup relies on mod_rewrite working correctly. If mod_rewrite fails, so
Acquire::ForceIPv4 “true”; will the export of the WordPress posts and therefore the final set of
We recommend a reboot to ensure everything is web pages will not work correctly.
correctly configured. All being well, at this point all the Mod_rewrite is very configurable and provides great functionality.
configuration is completed and updating your site has One example is to enable URLs to be rewritten to send data to a PHP
become as simple as performing the export as covered script that can use the input as part of the data to process, and the
in the previous article, then exporting the Zip file and script then outputting the PHP. Also, mass migrations can use mod_
uploading it to the production system as we’ve rewrite to deal with merging several domains’ worth of data into a
discussed above. single instance, using mod_rewrite depending on the entry URL used.
If you haven’t done so already, run the Simply Static A more detailed breakdown and discussion of mod_rewrite can be
export and download the zipped content file. Once found at the Apache.org website (http://bit.ly/lxf249mod).
downloaded, it can be uploaded directly to the Depending on the configuration, mod_rewrite can be specified in
webserver using the scp command. To copy the file to several places as needed, even down to the individual HTML folder.
the webserver, use the following command, substituting The /etc/apache2/httpd.conf file is the master file that sets the
as required: baseline settings that all virtualhosts takes as its base settings.
scp my_export.zip adminuser@livinginstarbucks. If the feature is not enabled in the root of our config, none of the web
com:/home/adminuser -p 999 hosts will work. Before changing any of these files, be sure to make a
Once uploaded, create a folder (called out in our backup so that any changes that are made can be easily reversed.
example) and unzip the file:
unzip my_export.zip -d out/
At this point there should be a folder with the revision to date. The easiest way to do this is to create
contents of the WordPress export. Copy the files into a Git-based repository in the cloud – choose from any
the /home folder, correcting the path as needed. Note of the major providers. Unless you have reason not to, When using
public and
that any WordPress links will have been converted to make it a private repository.
private key
folders and HTML text, so it is vitally important you Create your changes and perform the export from
logins, it’s
make sure all files are copied: Simply Static. Once downloaded, uncompress the files essential to
sudo cp -r /home/adminuser/my_export/out* /var/ and copy them into the Git-controlled folder. Add them ensure you have
www/www.livinginstarbucks.com/html/ as a new revision, commit and push it up. a copy of at
Depending on the configuration the owner and rights On the server side, install the git client: least the private
may need to be reset. This was done earlier and can sudo apt-get install git -y key. Without it,
just be repeated. At this point, open a new web browser At this point it becomes a simple affair to then log in logging in won’t
and open the website. All being well, you should see the to the webserver and clone the files to the webserver’s work because
static version of the website. /html folder. we disabled
password-
For those that are a bit more technically advanced, There are tweaks and options for other setups, but
based login.
it’s quite a simple affair to subject all these revisions to hopefully these tutorials provides a glimpse of what is
version control so that you can effectively see every possible when creating a static WordPress site.

The live pure


HTML website.

get More rAW htML Subscribe now at http://bit.ly/LinuxFormat


www.techradar.com/pro/linux May 2019 LXF249   75
TUTORIALS Vector graphics

LIBREOFFICE DRAW
Creating diagrams
and illustrations
There’s a much better way of creating technical and business diagrams
and illustrations than with a paint package, as Mike Bedford demonstrates.

hoto editing packages, also known as Of course, to be displayed on screen, it does have

P painting applications, are widely used, but


often inappropriately. They’re far from ideal for
to be rendered as pixels – as it also has to be if it’s
printed – but the basic definition is just a small amount
producing diagrams, flow charts, logos and illustrations of data. This has huge advantages when the box is
for scientific, technical and business purposes. Instead, edited or deleted. If a box is defined purely by its pixels,
OUR the tool of choice for this sort of job is drawing software,
otherwise known as vector editing software. In LXF248
adding that box to the image obliterates the pixels that
had previously been in its position on the page. If you
EXPERT we ran a Roundup of five vector graphics offerings, all then edit the box’s shape, it isn’t possible to reinstate
Mike Bedford of which are freely available under Linux, and most of the pixels that formerly occupied that area of the
The content of a which are open source. image. If you remove a box stored as its basic
document might Here we’re offering some hands-on guidance on how parameters – a vector graphic – on the other hand,
be paramount, to use one of these tools for a few typical applications: the complete image can be recreated using the
but Mike reckons LibreOffice Draw, which is a very capable package. definitions of all the remaining objects, with no loss of
that appearance Ironically, you might think, our chosen tool isn’t the one information. You can think of it as destructive (bitmap
is vital to make a which scored the top spot in our review. However we editing) versus non-destructive (vector graphics).
good impression. believe it offers all that most users need. In addition, Vector graphics editors usually provide a degree of
Or at least that’s LibreOffice Draw is probably already installed on your support for bitmaps – paradoxically, you might think.
his excuse for PC, and it’ll easily work in conjunction with other In most cases, though, they don’t provide the same
being obsessed LibreOffice tools because of the commonality of file extensive facilities for editing bitmaps as photo editing
with drawing formats. Even if you choose to use different software, software does. Of primary importance, though, bitmaps
software. many of the basic principles covered here still apply. are treated just like the objects we’ve already looked at,
so you can adjust their size and position and rotate
Vector editing principles them. It’s not difficult to imagine how the inclusion of
Before starting with any hands-on instructions, it will be bitmapped images could brighten up a basic line
helpful to discuss, in broad terms, what vector editing drawing. For example, a diagram illustrating the
software provides and how it’s fundamentally different electronic control system in a car could certainly benefit
from paint software, which can also be thought of as from using pictures of the engine, gearbox, wheels and
bitmap-editing software. Although paint software now so on, instead of just plain boxes with text labels.
offers some of the facilities that were previously the
sole domain of vector editing software, this type of
Dimensioning
shows the sizes package operates primarily at the level of individual
of objects as pixels. While editing pixels is the obvious way forward
they appear on for photos – which are, after all, nothing more than a
the page – so bunch of pixels – for diagrams, the vector approach of
nothing larger working with objects is much more appropriate.
than 210mm In referring to objects, we mean mainly geometric
horizontally shapes such as lines, boxes, circles and text, all of
on an A4 page. which can be further defined by the colour and
This isn’t very
thickness of any outlines, and the colour of any fill.
useful if you’re
What makes the vector approach so valuable, though,
designing a
kitchen, so is what happens when you draw an object such as a
use the scale box. Instead of it being stored internally as a set of
options to pixels, it’s defined by its position, its width, its height, For engineering illustrations, room layouts and similar mechanical
adjust this. its rotational angle, the width and colour of its outline drawings, the dimensioning feature ensures that dimensions remain
if any, the colour of its fill and so on. correct following any size changes.

76 LXF249 May 2019 www.linuxformat.com


Vector graphics TuTorials

Although LibreOffice Draw doesn’t have some of the


more artistic features of the highly respected Inkscape
and Gravit vector graphics packages, for more down-to- We’ve struggled to
earth applications in science, engineering and business think of anything
you might need for
it takes some beating. So, in common with just about all
drawing technical
vector graphics software, it’s ideal for drawing technical and business
illustrations, flow charts, organisational charts, illustrations that
electronic circuit diagrams and the like. This being the LibreOffice Draw
case, our first step-by-step guide (see over the page) doesn’t provide.
introduces you to the basic principles by describing how
to draw a diagram of a MOSFET, the type of transistor
that powers just about all our electronic gear.

Only connect
One reason for choosing to base this tutorial on
LibreOffice Draw is that it has some features that are
not universal among vector graphics software, but shapes used to signify the internet in network diagrams
which are particularly useful for the sort of uses you – and fortunately LibreOffice Draw provides several
might be interested in. An especially powerful feature tools for drawing irregular objects. You’ll find these at LibreOffice
is something called connectors. Connectors look like the Curve icon in the Drawing toolbar, and we’ll look at Draw offers
ordinary lines, and are used for connecting boxes and the general concepts here. options for
similar shapes in flow diagrams, organisational charts First up is the Polygon, and there are several options editing bitmaps.
and the like – but with one important difference – for this. The filled Polygon is much as you expect, and it as you’d expect,
Connectors remain attached to the objects they join enables you to define any closed shape from a number you can adjust
brightness
together, even if you edit your diagram by moving those of straight-line segments. There is also a variant where
and contrast,
objects around – the connecting lines re-route as you are constrained to angles that are multiples of 45
and this basic
necessary. Because this is such a time-saver for many degrees. Then there’s the plain (unfilled) Polygon, also functionality is
types of technical and business charts, our second step- with the 45 degree option – but this is really a enhanced with
by-step guide makes use of connectors. misnomer. It would be more accurately called a control over
Another handy feature, for those who require polyline, a line made up from several straight-line the three
mechanical drawings, is specific support for segments but with no fill. Note that, having drawn a primary colours
dimensions. Of course, you can add dimensions polygon, it’s possible to move, delete or add nodes – and gamma.
yourself in any drawing package, using text and that is, the points between line segments which appear
lines with arrow heads, but if you change the size as small squares.
of something you’d have to amend the dimensional Next is Curve, which is perhaps a bit confusing, since
information manually. With LibreOffice Draw’s all these tools are found under the broad heading of
dedicated dimensioning facility, on the other hand, Curve. Unlike the various types of Polygon, which are
once you’ve added a dimension, it will continue to composed of straight-line segments, a Curve – as the
show the correct value, irrespective of any resizing. name suggests – is made up of curved-line segments.
There’s clearly a limit to the number of LibreOffice Space doesn’t permit us a full description of how to
Draw’s facilities that we can illustrate in step-by-step draw a Curve or edit one and in any case, this is
guides, but this need not limit your voyage of discovery. something that’s best learned by trying it out. With a
So let’s consider a few more things that you might like Curve, in addition to editing the nodes you also have
to try out to help you get to grips with this powerful
package. You might want to work with bitmaps, for
instance. We suggest that you get to grips with this GrOupinG
useful feature by elaborating on the organisational
chart that we create in our second step-by-step guide. In the walkthrough on page 78, we create a line and a circle and then
In particular, since that exercise involves producing make several copies of that combination for use elsewhere in the
a company organisational chart, a good next step would diagram. If you’re doing this sort of thing, when you’re moving a
be to add photos of each staff member. If you don’t group of objects around it’s notoriously easy for them to become
have any suitable head-and-shoulder shots at hand, separated because you’ve accidentally forgotten to select one of
a quick Google image search will reveal no shortage them. It’s simple to prevent this, however.
of sample images. Because they will be reproduced at The secret is to convert those objects into what LibreOffice Draw
quite a small size, we suggest that you limit the file size considers to be a group. To do this, select the objects to be grouped
of your diagram by down-sampling the photos first, to and then select Modify > Group. Once a combination of objects is
something like 300 pixels, using a photo editing grouped in this way, it will be treated as a single object – as you’ll
package such as GIMP. discover if you try to select just one constituent part of the group.
As a group, therefore, it’s pretty much impossible to try to edit the
More irregular shapes group and find that your editing operation applies to only part of it.
So far, we’ve mostly talked about regular shapes such Grouping is reversible, which is good news if you subsequently
as squares, rectangles, circles and straight lines, since decide that you need to edit the individual parts of the group. As
they’re pretty much all you need for so many types of you’ve probably guessed, having selected a group all you need to
illustration. There are times, though, when you need do this is to use Modify > Ungroup.
something not quite so regular – for example, the cloud

www.techradar.com/pro/linux May 2019 LXF249  77


TuTorials Vector graphics

basiC DrawinG skiLLs

Snap grid Boxes


1 It’s easier to line up objects if you use a snap grid. The 2 Zoom in on the top half of the page using the magnifying
defaults are usually suitable but to check, go to Tools > Options glass in the Standard toolbar (at the top). Select Rectangle from
and then, at the left, select LibreOffice Draw > Grid. Ensure ‘Snap the Basic Shapes icon in the Drawing toolbar (at the bottom), click
to grid’ is selected, Horizontal and Vertical Resolution are set to at one corner and drag to the diagonal corner. We want one of
1.00cm, and Horizontal and Vertical Subdivisions are set to 10. 15cm x 4cm so watch the indications in the rulers while dragging.

Editing boxes Lines and circles


3 Outline and fill colours are defined by menus in the Line 4 Add the lines and the circles using the methods used for
and Filling toolbar (second from top), and can either be chosen boxes. You can draw one line and circle, then copy them: select
before you draw or changed afterwards. We want a pale blue box the line and circle by dragging a box round them with the Select
and black outline so, with the box selected, change if necessary. tool before selecting Edit > Duplicate. Rotate when needed using
Now draw the other boxes shown in the screenshot. the Rotate tool in the Mode toolbar and drag to its new position.

Adding text Tidying up


5 Add labels using the Text tool in the Drawing toolbar. You 6 Now you’ll probably want to tidy it up. Use the techniques
can resize most objects by selecting it and using the handles on of resizing and moving that we’ve already seen; you might also
its surrounding rectangle, but with text this only alters its want to change the line thickness (0.05cm is good) using Line
bounding box. Instead, to change the size, use the Font Name Width in the Line and Filling toolbar. Using Modify > Align after
and Font Size menus, which appear whenever text is selected. you’ve selected several objects can also be useful for tidying up.

78 LXF249 May 2019 www.linuxformat.com


Vector graphics TuTorials

the option of moving the so-called control points which of course, the options for editing the shape of a square
appear as small circles, and which enable the exact are limited to expanding or shrinking it, and individual
shape of a curved section to be adjusted. Mess around points or line segments can’t be edited. However, by use the
with control points to see how they affect the shape – converting it to a curve or a polygon using the Convert Gluepoints
feature to
it’s much easier to try than to describe! option on the Modify menu, all that changes. Now,
add extra
Finally, truly irregular shapes can be drawn using depending on whether you’ve converted it to a curve or
attachment
the Free-form Line tool, and its filled variant. These are a polygon, some or all of options that are available for points to
drawn by clicking and dragging to produce any line or editing polygons or curves become available, thereby objects.
shape, just as you would draw a line with a pencil or a giving you full control over the shape.
drawing tool in a bitmap package, although the result Another related facility is the Combine option, which
is subjected to a degree of smoothing. is also available in the Modify menu. This operates on
As a final bit of guidance on creating non-regular two or more selected objects and, while it might seem
shapes, it can sometimes be rather time-consuming to similar to grouping objects, in reality it’s very different.
achieve exactly the shape you need using the various Instead of grouping them together for ease of handling,
curve tools alone. For example, perhaps you want a they are actually converted, irreversibly, to a single
square with one of the sides turned into a curved line. irregular object, which can subsequently be edited by
The secret, in cases like this, is to start with the closest manipulating its nodes and control points. Again, have
regular shape which, in this case, is a square. Normally, a play – you’ll quickly get the idea of it.

usinG COnneCtOrs

Start with some boxes Annotate the boxes


1 To demonstrate the benefit of connectors, we’re going to 2 Each box represents a person in the company, so annotate
create a simple organisational diagram. So, set up a snap grid and them with a name followed by a job title in each. The top box is the
place some boxes on the page. We need one on the top row, two most senior person, perhaps the MD, the people in the second
on the second and four on the third. We suggest using a different row are directors, and the third row comprises managers. You can
colour for each row. Don’t bother too much about their exact add another layer (more damn management layers!–Ed) later, if
position – we’ll adjust them later. you want. For ease of editing, group each box and its annotations.

Connect them up Final touches


3 Now we’re going to join up the boxes using connectors. 4 Finally, to finish off the diagram, move the boxes around so
Select the first type of connector from the Connector icon in the that all the boxes on the same row are at the same height and
Drawing toolbar (bottom by default). Move over the top box and equally spaced. Note how the connectors stay attached to the
several connector attachment points appear. Click the bottom boxes, rerouting as necessary, as you do this. It’s possible that
one and drag to the top connection point on the first box on the  some of the connectors might not line up properly, but they can 
second row. Connect all the boxes in the same way. be edited manually as you’ll see if you click one.

www.techradar.com/pro/linux May 2019 LXF249   79


TUTORIALS Steam streaming

STEAM
Stream your Steam
games at home
Push your Linux gaming to your big TV for real
gaming fun, with the help of Alex Cox.

alve’s Steam Link was an odd little device.

V Frequently discounted to just a couple of quid,


and much-maligned for producing inconsistent
results, the now-discontinued black box aimed to beam
your games from your desktop PC – presumably
OUR residing in a dirty corner of your home – to your living
room TV. That’s not a new concept, certainly – you can
A Raspberry Pi 3B or 3B+ can
EXPERT do it with an Xbox or PlayStation, or with tech such as
replace the old Steam Link.

Alex Cox GeForce Go, or even Steam from PC to PC – but a Steam Link box, you’ll want to give yourself a little more
is a tech expert damn convenient one if you have a library full of Steam breathing room. Lastly, don’t skimp on the power
and writer, games and an insatiable yearning for your sofa. supply: you need something that puts out at least 2.5A,
inexorably drawn Good news, then: Steam Link is dead, but long live because if your Pi doesn’t get the relevant juice, it’ll
to tinkering with, Steam Link, now reborn as a chunk of Linux code descend into a mess of glitches. Consider also adding
and inevitably suitable to run on a Raspberry Pi 3. Yes, you’ll be a heatsink kit to your box to prevent it frying itself.
breaking, investing more – you need a Raspberry Pi 3B or 3B+
anything put in (£34, plus all the other bits you require) – but once Get carded
front of him. it’s hooked up, you’ll get the same effect, and there’s Unlike the case with some single-use Raspberry Pi
nothing to stop you installing other stuff on your Pi to setups, there’s no special distro needed to be installed
give it a second job. RetroPi, anyone? Plex or Kodi? on your SD card: the Steam Link app installs and runs
It’s up to you. on top of Raspbian Stretch, the Pi’s default OS.
Download the desktop version www.raspberrypi.org
Prepare your Pi and unzip it, then grab Etcher from www.balena.io/
You absolutely need a Raspberry Pi 3B or 3B+. We etcher to get the OS image onto your SD card. Insert
didn’t try this on a Pi Zero or a previous version of the the card into your reader, run Etcher, drag and drop the
main Raspberry Pi branch, because we weren’t feeling ISO image onto the window, and proceed with the
masochistic enough; it’s unlikely to work at all, but if writing procedure. Make sure you’ve extracted
that’s all you’ve got, you’re welcome to try it. You also everything you need from that SD card, as this is a 100
need an Ethernet connection (we’ll come to this later per cent destructive procedure.
on) and, at least initially, a keyboard and mouse, before When the write’s done, pop the card into your
you replace them with a controller. A large SD card isn’t Raspberry Pi and boot up – it should drop you straight
a primary requirement (we installed on an 8GB card we to Raspbian’s Pixel desktop.
had lying around), but if you want to do more with your
Install Steam Link
Open up a terminal and type sudo apt update to make
sure your OS install is as current as it can be, and to
ensure Raspbian’s knowledge of its repositories is up to
date. Then type sudo apt install steamlink to download
the whole thing and install it automatically. That’s the
installation process done with – you should see a
Steam Link icon appear on your desktop, and the
program’s ready to run. You can now either double-
click that icon, or run steamlink within the terminal
window.
Use Etcher to If you have a controller, you can plug it in and
write your SD card. configure it now; Steam Link on the Raspberry Pi

80 LXF249 May 2019 www.linuxformat.com


Steam streaming TUTORIALS

Setting streaming up
within the Steam client.

supports Xbox 360, Xbox One and PlayStation 4


controllers, as well as the Steam Controller (as long
as you’re using the wireless dongle). However, we
recommend going wired in order to cut out that tiny
amount of latency caused by wireless links. This could experience is positive. Don’t count on it, though – these Try to adjust
be important given that you’re already going to be things don’t always work as planned. There are ways to quality settings to
improve streaming.
dealing with around 20ms network and rendering get better results beyond using a wired connection. Dig
latency (at least on the beta we tested), and whatever around your network and stop those upload-heavy
your TV’s picture processing engine puts on top – peer-to-peer connections; delve into your router’s
depending on the TV, this could be anywhere from settings and, if possible, assign some priority to the
6ms to 30ms if you’re in any “game” mode offered, machines on either end of your Steam Link equation,
and far worse than that without. using QoS management tools; close whatever you can
Once that’s set up, you’re asked to perform a on the PC you’re linking to, in order to give it the
network test. If you’re connected by Wi-Fi on a standard maximum resources to render your stream.
Pi 3B, which is 2.4GHz only, this is the point where This can include Nvidia hardware encoding – you
Steam Link will shout at you. On a 3B+, you may find might want to turn off ShadowPlay and Gamestream in
that 5GHz networking is actually adequate for GeForce Experience, because these can actually make
streaming, but we wholeheartedly recommend hooking Steam’s encoding worse.
up to an Ethernet connection, both on your Raspberry
Pi and the PC you’re streaming from. The latency is Steam settings
lower, the speed is generally higher, and there’s far less Steam itself can be configured to make a decent
chance of interference causing you to drop frames. difference to streaming. Tweaking your connection’s
settings to drop a little graphical fidelity is highly
Connect to Steam advised. On your Pi, head to the cog icon, select
Now it’s time to select which Steam-running PC you ‘In-Home Streaming’ and opt for ‘Fast’ or ‘Balanced’
want to connect to; if you’re given no options at this if the Beautiful mode is glitching out. On your host PC,
stage, boot up your PC and run Steam. Note down the select Steam > Settings > In Home Streaming >
PIN given to you by Steam Link, then head back to your Advanced Host Options, and try flicking some of the
PC and enter it in the box that’s popped up. All being switches there.
well, your PC will jump into Steam’s Big Picture mode Don’t forget to set your game to the lowest
and, returning to your Raspberry Pi, you’ll see its screen resolution you find acceptable, too. From your sofa,
duplicated, and the menu should be controllable by 720p might not seem so painful.
whatever input device you have hooked up to the
Raspberry Pi.
Bad news if you were hoping to use your PC for RUNNING AUTOMATICALLY
something else while others game, because that isn’t
how Steam Link works; it locks up your main machine If you’re dedicating a Raspberry Pi entirely to running Steam Link,
for the whole time you’re streaming, in the same way as and you’re mostly aiming for sofa gaming, it might make sense to
Steam’s standard In-home Streaming mode does. remove the need to manually launch the program when the Pi powers
on; that way, you can do away with the mouse and keyboard entirely.
Better connections Raspbian Stretch has a number of methods to run apps
As they say, your results may vary. It’s entirely possible automatically, but editing /etc/rc.local is the simplest way to do it.
that your network holds up well and your Steam Link Open up a terminal and run sudo nano /etc/rc.local to begin
tweaking, then make a new line just above exit 0 . Add the text sudo
-u pi /usr/bin/steamlink & . The ampersand is important, because
without it, the Pi’s boot process won’t properly complete. Then save
the file by hitting Ctrl+X followed by Y. Reboot your Pi and it should
jump straight into Steam Link. Now the only problem is shutting
down: there’s no way to do it gracefully with a joypad, and pulling the
power risks corrupting your SD card. Consider adding a Pimoroni
Authorise devices when OnOff SHIM, which works as a safe power button when installed.
they first connect.

www.techradar.com/pro/linux May 2019 LXF249 81


Discover another of our great bookazines
From science and history to technology and crafts, there
are dozens of Future bookazines to suit all tastes

you buy direct from us not available anywhere else super-safe ordering
THE BEST NEW OPEN SOURCE SOFTWARE ON THE PLANET

HotPicks
DigiKam Olive Cygwin LibreOffice ODrive
Quaternion Klogg Underrun Sandspiel
Alexander Tolstoy
almost broke the Matrix
after firing up Cygwin on
ReactOS. Luckily,
everything ran inside a VM.

Hyperfine Friture

IMAGE ORGANISER

DigiKam
Version: 6.0
Web: www.digikam.org
ne of the reasons why digiKam evolves so

O rapidly is its constant participation in Google


Summer of Code, which is hard to
underestimate. We’ve extolled the enormous power of
digiKam in the past, and it’s only getting better. Its key
feature is the ability to mark images with tags and
create sorted catalogues of photos.
Tagging is incredibly useful; it lets you navigate huge You can click a video to play it. Tag, sort and organise them just like photos without having to go
to a separate player app.
image libraries to quickly find the desired files. digiKam
is also very capable at importing photos from various
sources. The import window has dozens of options,
but perhaps the key one is automatic creation of Navigate around the digiKam interface
albums based on dates. This way you can turn a single
folder with thousands of files into a much more
appealing set of subdirectories sorted by date. Last
but not least are built-in ‘dark’ and ‘light’ rooms
3 5
designed for processing RAW shots. 2
It is impossible to list all the goodness delivered with 4
the latest digiKam 6.0. The update is really big, with the
gorgeous Time-Adjust tool (batch-fix timestamps of
your files), export to Pinterest, OneDrive and Box web-
services, new icon-view customisation tool and more.
The new digiKam 6.0 can play your videos right inside
the application without switching away, so in some
sense videos are now as easy to organise and watch 1
as still photos are.
Another well-timed update lies in the Lighttable
component, which sports a wider list of supported
devices that can shoot in RAW. digiKam now correctly All albums at your fingertips timeline, people, similarity checker and even an
parses RAW shots from recent Samsung Galaxy and 1 The albums tree view is the most popular integrated Marble globe.
Apple iPhone devices, as well as some new DSLRs. But default view in digiKam. You can treat it like a
file manager. Configure digiKam your way
video support is perhaps the main hero of the digiKam 4 The app sports a packed Configure
6.0 changelog. We added our ~/Videos directory to the Main thumbnail view dialogue. Adjust the RAW handler, colour
library and tested it with digiKam. The application 2 Select an item in the left area and see profiles, templates, database location and much
integrates a very smooth with its robust video player its contents in the main part of the digiKam more here.
module, which doesn’t slow things at all, even with large window. Click an image or video for a larger
preview of it. Extra information about the current file
amounts of ‘fast previews’ for our videos. A tagged 5 Not only file properties, but also colours,
video catalogue in digiKam instead of a plain Videos Expand other view modes versions, filters and manipulation tools are all
folder in a file manager? Give it a try! 3 Lots of hidden power here: tags, dates, withing your reach.

www.techradar.com/pro/linux May 2019 LXF249 83


hotpicks

Not so many
VidEO EditOr features that you’ll
get lost, but all the

Olive
essentials in place.

Version: Alpha
Web: www.olivevideoeditor.org

on-linear video editors are now another

n category of software in which Linux users can


enjoy plenty of freedom of choice. You might
have heard of Kdenlive as the king of open source video
processors and Flowblade as its younger rival, but here Olive sports a decidedly classic interface, with
comes yet another software of that type, Olive. Sceptical project files in the top-left panel, media and sequence
at first, we soon discovered that Olive fills its own niche players next to it and a gorgeous timeline area that
and looks attractive to a wider audience. occupies the lower half of the Olive window. Behind the
The project’s devs tried to find a balance between scenes its uses the FFmpeg multimedia framework,
simplicity and professional-level features, a goal that which defines the list of supported audio/video formats
is harder to achieve that it might seem. We took Olive and codecs.
for a spin and tested it with a classic workflow example, When you feel you are done with your sequences,
which implied merging a couple of video files together tracks and transitions, select File > Export to encode
with transition effects and adding a different sound your work into any supported video format. Olive
track over the top. provides very rich options for exporting. In a way, it can
Olive is only in its alpha version period, and it lacks even serve as a media converter, although FFmpeg is
a great variety of advanced features that exist in some famous for having plenty of other GUI frontends for that
mature Adobe Premiere like rivals, but it’s simpler and purpose. The Olive project offers Snaps, Flatpaks,
more robust software. We think it’s a great choice for Appimages and the PPA (ppa:olive-editor/olive-
amateur users who are still undecided about what to editor), so it becomes super-easy to get it running with
do with their home video libraries. almost no delay.

If you’ve worked
POSiX-COMPAtiblE EnVirOnMEnt with DosBox in
Linux, this is the

Cygwin
opposite of it.

Version: 3.0
Web: www.cygwin.com
arely do we talk about (or to) Windows users,

r but this time there is a perfect reason for doing


so. Many Linux switchers continue to use the routines in the same manner you can do it natively
OS from Microsoft, either willingly or not, but the on Linux. Compared to WSL, the main thing Cygwin
existence of Cygwin is surely good news for them. It’s a does not support is running Linux binary applications
POSIX-compatible layer for basic GNU command-line natively, but that’s not required too often.
utilities, available as a open source addition for The Cygwin project has recently rolled out the third
Microsoft Windows. major release of its brainchild. Cygwin 3.0 includes a
The project has matured nicely since its initial new mkdir that can create case-sensitive directories,
release in 1995, but even now when Windows 10 users and also now has the chattr and lsattr utils for handling
can run WSL (Windows Subsystem for Linux), Cygwin advanced filesystem flags along with historic DOS file
has not lost its purpose. It supports a greater variety of attributes in Windows. Cygwin supports FAT, NTFS
Windows versions, it has a smaller footprint and it does and also exFAT filesystems.
just what it was supposed to do. There is no need to compile anything or prepare a
Cygwin brings the world of the Bash console to the build environment on Windows in order to get Cygwin.
Windows desktop and spices it with lots of familiar GNU It comes with a nice graphical installer and takes all
utils such as ls, tar, awk, ssh and so on. It enables Linux hassles away from you, including setting the needed
users to live the GNU-style life within Windows without environment variables and paths. After installation
changing their habits and continue to administer you’ll be able to open Cygwin’s Bash console to do
various things using a Bash shell. Cygwin is ideal for your scripting and run GNU commands without leaving
running UNIX-style scripts in WIndows and automating Windows at all.

84 LXF249 May 2019 www.linuxformat.com


hotpicks

OffiCE SuitE

LibreOffice
Version: 6.2
Web: https://libreoffice.org

ew releases of LibreOffice are hard to miss

n because this office suite is one of the most


successful and widely used open source
projects. The new 6.2 version brings a bounty of
valuable new features, fixes and improvements –
the official Release notes page from The Document
Foundation takes half an hour of thoughtful reading.
Some things are really worth trying, although not or LxQt thanks to the new VCL plug-in, which supports Native Qt5 widgets
immediately noticeable without prior knowledge. Qt5 and KF5 styles. The confusing variety of VCL plug- in Libreoffice? Very
nice indeed!
The first is the extended menu of alternative user ins found in previous versions of LibreOffice has been
interfaces that include a sidebar style, a tabbed fixed. Gone are gtk2 and kde4 plug-ins, and we now
interface and a ‘groupbar’ mode. The latter two have a have just two integration packages for Gnome (gtk3)
visual resemblance to the (in)famous Ribbon interface and KDE (kde5).
from Microsoft, except that LibreOffice doesn’t force Of course, all these visual changes shouldn’t obscure
you to use any mode and lets you quickly switch from the titanic work that has been done to improved Writer,
one to another. The feature sits in the View > User Calc, Impress, Math and Draw. LibreOffice works
Interface menu, but only if you enable the experimental snappier and better than ever, and those who regularly
LibreOffice features in Tools > Options > Advanced. work in this suite will surely have a great time with the
Another important feature is the official unveiling of new version. There is no need to wait for LibreOffice 6.2
the updated KDE interface plug-in. LibreOffice finally to land in your Linux distribution repos – the official
stops looking like an alien when used with KDE Plasma download page already has all you might need.

GOOGlE driVE CliEnt

ODrive
Version: 0.2.0
Web: http://bit.ly/lxf249odrive

illions of Linux users have Google accounts,

M yet there is no official Google Drive client for


Linux. Currently available options imply
mounting the cloud storage as a FUSE drive (http://
bit.ly/lxf249fuse), or using proprietary software like
InSync. But we’ve discovered a much easier way of
synchronising your local files with your Google account.
ODrive is a nice little Electron-based application that local changes in your Google Drive directory and syncs Press ‘Synchronise’
is very easy to work with. The name stands for Open file automatically, without the need to do anything else – to merge the
contents of your
Drive and should not be confused with the odrive cloud so in a way ODrive is a decent replacement for other
Google Drive to
storage service, which has different software. The hero Google Drive clients. It doesn’t have selective sync and the local folder.
of our review has just one window and a tray applet, leaves you with the ‘all or nothing’ sync approach, but
and sets up your connection in a few seconds. still, it is fully FOSS software and has proven to be
There are two steps: one for authenticating with usable by non tech-savvy users. Despite being so
Google and giving the app the required permissions, minimalistic, ODrive has been in rapid development,
and the other for choosing a local directory for so new features are expected to land soon.
synchronising. The big blue button fires up the sync ODrive is a cross-platform application, with the
process and keeps you informed about the number of official AppImage download available from the project’s
transferred files. page at GitHub. As with most other Electron-based
Closing the main ODrive window leave it running and apps, ODrive behaves exactly the same way on all
accessible via the tray icon. The sync daemon detects supported platforms.

www.techradar.com/pro/linux May 2019 LXF249 85


hotpicks

Quaternion is a
MAtriX CliEnt simple and robust
Matrix client for

Quaternion
everyday chatting.

Version: 0.0.9.3 Web: https://github.


com/QMatrixClient/Quaternion
ecentralised messaging is getting more and

d more popular among privacy-conscious users.


Recently we saw the KDE project switching
from IRC to Matrix, one of the most popular solving a captcha, and therefore it is preferable to
decentralised protocols. The concept of such register on a web page. The browser version of Riot.im
messaging includes everyone who works on a computer is perfect for that: https://riot.im.
or a mobile device, so it is not limited to KDE or even Once you register and sign in, it’s possible to join
Linux. We picked Quaternion, a nice and rapidly available rooms or create your own. The federated
evolving Matrix client, and tried it in order to see how network works in such a way that members of one
decentralised (or federated) instant messages feel, room can be connected to different Matrix servers –
and in what way it is different to standard IM. either public, or their own home instances – but the
Quaternion greets you with a connection window chat will still synchronise for everyone.
and asks for a login name, a password, a device name Using Quaternion for chatting has much in common
and a server address. The server can be any host which with using IRC. The main window with the contents of
runs the server part of Matrix; for example, it can be the chat reacts to what you write in the text field below,
your own Synapse instance (Synapse is a reference and accepts standard commands for joining, leaving,
implementation of a Matrix server). However, you can referencing and so on. The list of rooms is on the left,
safely skip the ‘decentralised’ part and join the main and the current room members on the right, pretty
public server at https://matrix.org, which is fine for much like most other IM clients. Don’t forget to check
online chatting. Getting a Matrix account can be tricky the official Quaternion room at #quaternion:matrix.org
for novice users, because the registration implies to stay in touch with the community!

Administering
lOG ViEwEr systems and
applications logs

Klogg
with klogg is a
true pleasure.

Version: 19.01.0.318 Web: https://


github.com/variar/klogg

hat software do you use for viewing a log file?

w Most people will find their favourite plain-text


editor perfectly OK for this kind of task.
However, when it comes to viewing very long and
complex files, it becomes evident that navigating and
searching through the endless list of lines takes extra
effort. So if you need to find something useful in such searches. Klogg also lets you bookmark any line of
huge text files, without getting lost, try klogg. the text file simply by putting a blue arrow next to it.
This is a small application tailored for quick and Marked lines can always be listed separately in the
comfortable scrolling through thousands of lines. The search results area below the main log. Another useful
exterior is very minimalistic, but once you start using feature is line colouring, Open the Tools > Filters setup
the app you immediately notice how smart it is. Klogg window and add one or several filters to the list. Each
knows that your log file may be constantly updating at filter can have its own distinctive colour and therefore
the time of viewing, which is why there’s an ‘Auto you can mark parts of your log that match given criteria
refresh’ option in the lower-right corner. Use it once with custom colour. Life gets really bright with klogg!
and forget about manual file re-opening every time an We tested it with some typical examples, such as the
application writes to your log file. Apache Tomcat webserver, and were very happy to see
An even more important feature of klogg, however, how the tons of visual garbage turned into a readable
is support for regular expressions. The text field above and live-updated journal. Needless to say that klogg
the file contents is designed for searching, but it also supports tabs (open many logs in one window!) and lets
accepts regexps that you can use for complex you set custom text encoding separately for each file.

86 LXF249 May 2019 www.linuxformat.com


Games hOtPiCKS

ShOOtEr GAME

Underrun
Version: GIT
Web: https://github.com/phoboslab/underrun
omething has gone wrong in our remote-

S controlled server infrastructure. Artificial


intelligence systems, radiation protection
and power management have all failed. The automated res and blurred due to some brutal upscaling, but it Beware spiders in
control system was not able to restart the servers, so never spoils the game experience. The character, the game, and in
real-world servers.
there is only one way out: you must go to the server whom you control using the standard WASD key set,
room and manually restart the systems. moves very smoothly and can even be turned with
The task is trickier than it sounds: soon you’re your mouse. This means you’ll need to turn to face a
wandering inside the maze of the server room (armed spider before shooting at it.
with a gun, of course) and shooting at the fast-moving While Underrun may not be a high-profile shooter,
alien giant spiders that suddenly jump out of the it’s definitely a vigorous and very playable game
ominous darkness to attack. You need to do the rounds worth spending time with. There are so many
and find all the servers before those creatures can kill features packed into Underrun that it looks almost
you – and once you succeed, advance with the same magical, given the game’s miniscule size. Different
task to the next level. enemies, dynamic lighting, sound effects, extra levels,
We can hardly think of any other open source a game menu with tips and legend description…
shooter that is so captivating and filled with suspense, That’s impressive!
thrills and action as Underrun. This is not a heavyweight The game can be played on a webserver, for which
game, but a browser-playable toy with all assets there is the handy build.sh script which will prepare
weighing in at less than 50K. An unbelievable ratio of the bundle. Or you can play it right away online at:
thrills per kilobyte! The graphics are intentionally low- https://phoboslab.org/underrun.

Sandspiel enables
PArtiClE SiMulAtiOn GAME you to build
spectacular

Sandspiel
schemes that
everyone will
love to explore.

Version: GIT Web: https://github.com/


MaxBittker/sandspiel

here are simple things in life like burning wood

t logs, flowing water streams, melting ice and


other sorts of elements that can hypnotise
you in certain conditions. sandspiel is an example of
the relatively rare kind of game that simulates physical
effects in the real world. Playing requires a certain Sandspiel implements very realistic effects for many
attitude and participation, but we were surprised to real-world materials, and lets you watch wooden
realise how easy it was to lose yourself in the process. parts slowly burning down, acid drops grinding their
The game provides a sandbox (in all senses) and a way down through almost everything, and funny-
concise set of tools in the top-right part of the screen. coloured flowers growing up as in real life.
To play the game you need to select a tool and draw It’s a gaming application, not a serious simulator,
some structures with it. There are tools for sand, dust, and therefore has some limitations. We tried to draw
water, stone, fire, wind, seeds and others. a Pythagorean cup, but the water wouldn’t behave
The joyful part starts once you decide to see how like a liquid in the connecting vessels. Our cup stayed
one element interacts with another. You can build a full all the time! However, the gravity in all simpler
house of ice and use the ‘fire’ brush to see how it melts cases worked like a charm, so we were very happy to
into water. Or, perhaps, create a stone bowl filled with see particles fall to the ground as if they were real.
oil and set it on fire. With 20 available tools it’s This browser game is a splendid example of
impossible to imagine all combinations, and so educational software for all ages. All your innermost
sandspiel is a gorgeous find for anyone fond of engineering fantasies come true in this physics lab,
modelling shapes, pots and other things in their minds. so prepare to lose quite a bit of time playing it…

www.techradar.com/pro/linux May 2019 LXF249 87


hotpicks

bEnChMArK tOOl

Hyperfine
Version: 1.5.0 Web: https://github.
com/sharkdp/hyperfine
here are things in the world that can be very

t interesting to look at and study, even if at first


they seem commonplace. We experienced
such a feeling when we stumbled upon hyperfine. This
utility is designed for performance testing, but who
would have thought that it could be so exciting?
Hyperfine differs from its more famous counterparts
(we’re looking at you, Phoronix Test Suite) firstly $ hyperfine --prepare ‘sync; echo 3 | sudo tee / This app uses
because of its simplicity. Here’s a universal example proc/sys/vm/drop_caches’ ‘<some command>’ multiple test-runs
for more precise
for any test you want to quick-start: There are a whole lot more options described in
benchmarks.
$ hyperfine <some command> hyperfine’s built-in help, so you can form complex
This measures the execution time of the command chains of commands and wrap them with hyperfine.
so you can see how fast your system is. Naturally, lots of The tool is extremely useful for testing hard drives,
things affect the figures hyperfine returns, including CPUs and of course operating systems. You can
disk caches and CPU loads. Hyperfine can be aware of quickly see the difference between Linux kernels,
such things once you tell it to take measurements after desktop environments and even terminal emulators.
some cold runs. Let’s give it a warm-up with three tests: Hyperfine compiles into a single 3.5MB binary file
$ hyperfine --warmup 3 <some command>. (builds and packages are also available right away
Disk I/O caching certainly skews the figures we get, from the project’s Download section at GitHub), and
usually to improve them, so let’s flush it and make the supports various extra actions such as exporting
test fairer: benchmark results to CSV, JSON and Markdown.

Use Friture to
AudiO AnAlySEr find out if your
audio track or live

Friture
stream sounds
better than it looks
on visualisation
widgets.

Version: 0.36 Web: http://friture.org


ound engineering can be mundane daily work

S for one audience and rocket science for


another. We’ve discovered an open source
application that can possibly build a bridge between
these two groups of Linux users, and here’s why.
Friture is a small and neat, yet very powerful audio
spectrum analyser. It can visualise any live audio data
in several ways, enabling you to actually see the sound. same scene with several microphones, sound
That yellowish ‘flaming’ bar is a 2D spectrogram widget reverberation, humming and so on. Fixing all these
that draws audio data against time and frequency. errors requires using phasers, equalisers and other
Other widgets include the spectrum (audio vs tools available in such programs as Audacity. Friture
frequency), octave spectrum (audio vs time), delay is here to analyse and see what is happening in the
estimator and two meters for levels and scope. moment: all these defects form their own unique
Now, what are all these complex things for? pictures in Friture’s widgets and can be better
Friture is an unmatched helper when you feel there’s detected visually then aurally.
something wrong with the sound but you’re not sure By default, Friture tries to capture audio data
how to fix it. Classic examples includes capturing the from an ALSA source, but you can direct it to use
sound of a pipe organ in a church, or recording a Pulseaudio in the Settings window. The quickest
lecture or a speech in a large hall. In both cases there way to try Friture is to grab the Appimage, make it
will be probably an undesired audio response, when the executable and run it. Bear in mind that you may
sound loops between the output and the recording need to adjust your audio settings in applications
device. There can be other defects too, like badly such as Pavucontrol in order to make Friture detect
aligned sound tracks created after recording the the audio stream.

88 LXF249 May 2019 www.linuxformat.com


CODING ACADEMY Keep track of Git

SHELL SCRIPTS
Check the status
of your Git repos
John Schwartzman shows you how to write a Bash shell script that
can keep track of all of your many Git repositories.

it is a version control software system that

G keeps track of all of the changes you’ve made


to your source code and enables you to revert
to a previous version at any time. It’s important to keep
Git up to date by checking in (committing) your source
OUR code frequently – whenever you have made changes
EXPERT that you’ve tested and are happy with. This is
particularly important in continuous integration/
John deployment environments.
Schwartzman This git-checking script stemmed from a current
is a software C++ project has seven different source directories, with
engineering a single Git repository that spans all the directories. To
consultant to put these projects under Git source control, we’d open a
business and terminal in the project’s base directory, ~/
government. Development/UDS (the ultimate parent
He also teaches of all of the source directories) and issue the Git init
Computer command. This makes the base directory a Git
Science at a repository. Then going to each of the project source
local college. directories issue Git add * to stage the files. Finally,
going back to the project base directory and issue
Git commit -am “initial version” to commit all the
staged versions.
If you have certain artifact files that show up in all
your source directories, you can tell Git to ignore them The output from the gitStatus shell script is designed to be instantly
Git isn’t only for and not treat them as untracked files. The Eclipse IDE readable, with the use of colour coding.
C++ projects. places a .cproject file, a .project file and a .settings
You may have directory in each of the source directories. You can your repository.
Perl, Python,
create a .Gitignore file containing the names of these General confusion led to the decision that it would be
C, shell scripts,
items and place it in the Git repository directory. useful to have a single command (a Bash shell script)
text files,
make files, When you’re working in many different directories at that would summarise the status of the repository of
configuration the same time, it’s easy to get confused and forget just the seven source code directories and would indicate
files or what you’ve changed and what you haven’t. Git enables which directories need attention.
magazine you to go to each of your source code directories, one The image above shows the output of the shell
articles that at a time, and use the Git status . command to tell you script, which we’ve called gitStatus. The green items
you want to what hasn’t yet been committed to the repository and are up to date and need no attention. The yellow and
keep track of. whether there are any new files in the directory that red items do need attention. They tell you that the
You probably haven’t yet made it into source control. utility directory has one or more untracked files:
already have
You can also use the Git diff command to tell you source code files that were never put under version
Git installed on
exactly what has changed between a source file in the control. That may not be a problem so we indicate
your system.
Try typing git directory and a source file in the Git repository. To that condition in yellow – as in caution.
--version at the commit your changes to Git, use the command They also tell you that the transport source code
command line. Git commit filename -am “Your comment goes here” . directory has two files on disk that are different from
Meanwhile, the gitk command shows you a GUI view of the versions under source control. Two files in the

90 LXF249 May 2019 www.linuxformat.com


Keep track of Git coding academy

transport directory need to be committed. command- # declare an array of the project names and their…
history and findit also need to have multiple files associated directories
committed. Using the shell script saves time: after declare -a proj
running the script, you can simply go to the directories proj[0]=”utility|$HOME/Development/UDS/utility/src”
that need attention. The top half of the script proj[1]=”transport|$HOME/Development/UDS/
establishes what you’re going to look for in all of the git transport/src”
status . outputs, and what you are going to display to proj[2]=”serverTest|$HOME/Development/UDS/
the user as a result. Running git status . in the base serverTest/src”
directory will give you the same information, but it can proj[3]=”clientTest|$HOME/Development/UDS/
be a bit confusing to look at. Also, you may have a lot of clientTest/src”
small projects, where the Git repository is the same as proj[4]=”simpleClientTest|$HOME/Development/UDS/
the project directory. simpleClientTest/src”
In this scenario, you’d have to go to each of your Git proj[5]=”throttledServerTest|$HOME/Development/
repository directories to issue the git status . UDS/throttledServerTest/src”
command. The git-status, command-history and proj[6]=”utilityTest|$HOME/Development/UDS/
findit projects fall into this category. utilityTest/src”
Let’s look at the shell script in detail. Line 1 tells proj[7]=”command-history|$HOME/Development/
Linux what kind of file this is (a Bash shell script) and command-history”
how it should be executed (in Bash); it’s standard proj[8]=”git-status|$HOME/Development/git-status”
Linux/UNIX boilerplate. proj[9]=”findit|$HOME/Development/findit”
#!/bin/bash numProjects=${#proj[@]} # keep track of the
Then there are some escape sequence definitions so number of projects in the array
that you will be able to output text in colour. Colour The next lines timestamp the output and print a
makes things easier to comprehend. blank line.
escRed=’\e[1;31m’ # define a few colour escape echo $(date) # timestamp the output
sequences echo
escYellow=’\e[0;33m’ In the bottom half of the script is a for loop. First,
escGreen=’\e[0;32m’ inside the for loop, you recover your project and
escReset=’\e[0m’ source directory from the current element of the array
Following the colour escape sequence definitions are using Bash pattern matching.
the two commands that you will execute in each of your project=”${proj[$i]%%|*}” # derive the project name
source repository directories. from proj[i] (return everything before ‘|’)
# define cmd1 and cmd2 dir=”${proj[$i]#*|}” # derive the directory name from
cmd1=”git status . | grep -c \”modified:\”” proj[i] (return everything after ‘|’)
cmd2=”git status . | grep -c \”Untracked files:\”” You iterate through the array to recover each of your
You can execute each of the these commands project names and cd to its associated source
from the command line to see what the git status . directory. In each source directory you execute cmd1
command is telling you before and after you pipe it and cmd2 and save the results in count1 and count2 .
through grep. Notice that we’re using grep’s -c (count) Based on the values of count1 and count2 you echo
option. This will suppress the output of the text we’re two status statements to the user. The first statement
searching for and simply tell us how many times the indicates the number of modified files that need to be
string appears in the output of the git status . committed and the second statement indicates whether
command. You’re looking for the strings modified: and or not gitStatus found any untracked files.
Untracked files: . The first string occurs once for each Once you’ve created your shell script in a text editor
file that is different from the version in the Git and saved it, you must tell Linux that it is an executable
repository. The second string occurs one time if git file. This is done so frequently that many developers
status . finds any untracked files; it will not appear at all and system administrators keep an alias for the
if it finds no untracked files. purpose: alias mx=’chmod +x’ . Add the alias to the file
The next few lines indicate what you’re going to $HOME/.alias or $HOME/.bash_aliases, depending
output to the user depending on the values of count1 on your distro. You then copy the executable into your
and count2 . /bin directory with a short name that you can
# define the output strings remember. Issue the following commands in your
strNoCommit=”has no files that need to be working directory.
committed.” mx gitStatus.sh
strCommit=”file(s) that need to be committed.” cp gitStatus.sh $HOME/bin/gitStatus
strNoUntracked=”has no untracked files.” Any time you want to know the status of your
strUntracked=”has one or more untracked files.” projects, you type gitStatus on the command line. If
The next lines contain a simple array of project you like, you can create a gitStatus shell script for
names and repository directories. Notice the vertical bar every Git repository on your system, or you can include
character ‘|’ used to separate the project names from multiple repositories and their associated projects in
their associated directories. Obviously, until you the same gitStatus command.
populate the proj array with your own project names Look at how much we can accomplish in a one-page
and repository directories, you’ll get nothing but errors. shell script. Hopefully this proves to be useful and that it
git status . will scream if you issue it in a directory that will give you some ideas for your own shell scripts. Have
is not associated with a Git repository. fun and keep coding!

www.techradar.com/pro/linux May 2019 LXF249 91


CODING ACADEMY Speed up web apps

WEBASSEMBLY + RUST
Speed your web apps
with WebAssembly
Mihalis Tsoukalos explains how to develop WebAssembly applications
from Rust, and how to use them with the help of JavaScript.

avaScript has been the dominant programming

J language among web developers for a long


time now. WebAssembly wants to become the
new king of web development – not as a programming
language, but as a virtual and portable compilation
OUR target. Therefore WebAssembly is not here to replace
EXPERT JavaScript entirely, but to work with JavaScript. The
two biggest advantages of WebAssembly are portability
Mihalis and good performance.
Tsoukalos This tutorial is about writing Rust code, compiling it
is a UNIX person into WebAssembly and using that WebAssembly code.
and the author of At the time of writing, the latest Rust version is 1.32.0.
Go Systems However, you should not have any problems executing
Programming the code of this article even with older Rust versions. Figure 1: A small part of the installation process of the Rust
and Mastering At the end of the tutorial we’ll see how to create WebAssembly support, which is a pretty lengthy task.
Go. You can WebAssembly code from Go, so we can compare
reach him at the Rust way with the Go approach. Rust tools are installed in ~/.cargo/bin, so ensure that
www.mtsoukalos. ~/.cargo/bin is in your PATH environment variable.
eu and @ Installation The output of the rustc --version command will verify
mactsouk. As always we’ll need to install WebAssembly on our that everything is OK with your Rust installation.
Linux machine in order to use it with Rust. First, you If you try to execute cargo generate without first
will need to install the standard Rust toolchain, which installing the required Rust crate, you’ll see the
includes rustc, the Rust compiler; rustup, the Rust following error:
toolchain installer; and cargo, which is the package $ cargo generate
manager for Rust. The easiest way to install all these error: no such subcommand: `generate`
is to follow the instructions at www.rust-lang.org/ This happens because cargo generate is not a
tools/install. If you prefer, you can use your favourite standard command of the Cargo tool. Installing
Linux package manager instead. WebAssembly support for Rust is the most difficult and
After installing the Rust toolchain, you should install challenging task you will find in this tutorial; at the end
wasm-pack by following the instructions at http://bit. of it, we’ll see that this isn’t the case with WebAssembly
ly/lxf249rust2 1. Then you will need to install cargo- and Go, as WebAssembly is just another supported
Get the code for generate to make creating WebAssembly projects in architecture for Go.
this project on Rust simpler and easier. As cargo-generate is just a In a moment we’ll look at a simple Rust project that
the LXFDVD Rust crate, it can be installed by executing cargo install generates WebAssembly code, which is going to be
or visit www. cargo-generate . Be prepared for a lengthy installation served using HTML and JavaScript. You will need to use
linuxformat. process; it includes the execution of the following: nmp (Node Package Manager) to be able to test the
com/archives $ sudo curl https://sh.rustup.rs -sSf | sh generated applications on your local machine. As npm
and grab teh $ sudo curl https://rustwasm.github.io/wasm-pack/ is installed with Node.js, you need to install Node.js to
code pack. installer/init.sh -sSf | sh get npm on your computer. Therefore, it would be a
$ sudo apt install libssl-dev pkg-config good idea to install Node.js at this point. For the Ubuntu
$ cargo install cargo-generate machine used in this tutorial, installing Node.js and npm
Figure 1 shows a small part of the output of the is as simple as executing apt install npm with root
commands from the installation process. Note that all privileges – this installs both components.
1) https://rustwasm.github.io/wasm-pack/installer/

92 LXF249 May 2019 www.linuxformat.com


Speed up web apps coding academy

It’s very important to have the latest version of npm


installed; you can update your current version by
executing npm install npm@latest -g with root
privileges. After updating npm, reopen your terminal for Figure 2: The
changes to take effect – this is also really important! initial structure of
the Rust project,
Please bear in mind that although npm and Node.js as well as the
have nothing to do with WebAssembly, they might output of the
create some problems in the publishing of the commands used
WebAssembly code, which means that you should for generating
the WebAssembly
make sure that they are properly installed.
binary file.
If you do not want to manually install all these things
on your Linux machine, you could always use a Docker
image instead. Although you will need to learn some
new things in order to use Docker and work with its
images efficiently, you will see many benefits from this
choice in the long run, especially if you are using
multiple machines with different versions of Linux for
development and deployment. Unfortunately, we don’t
have the space here to explain more about Docker.

Hello world
After you’ve downloaded all the required files, you are
ready to start compiling Rust code into WebAssembly. .bin .gitignore LICENSE-APACHE package-lock.json
But first you will need to create a new Rust project webpack.config.js
using cargo generate . This command will clone and Now go to that directory and execute npm install . the Go way
use an external project template that comes pre- Instead of deploying the application in npm, we will use of generating
WebAssembly
configured with some rational default values in order to the local copy of it, which means that you should go to
code is much
save you time. It will ask you for a project name, which the pkg directory and execute the npm link command
simpler
in this case will be lxf (you can choose any name you with root privileges. Now, return to the /www directory compared to the
want, of course). The Rust program will print a “Hello and execute npm link lxf . Lastly, you will need to make Rust way, this
World” message – this is what the WebAssembly code the contents of www/index.js as follows: does not mean
will do, but in a way that you might not expect! $ cat ./www/index.js that Go is a
So, first execute the following commands: import * as wasm from “lxf”; better language
$ cargo generate --git https://github.com/rustwasm/ wasm.greet(); than Rust. It’s up
wasm-pack-template This is needed for telling index.js to serve our to you to decide
$ cd lxf # replace lxf with your own project name project instead of the default one. Finally, execute whether to use
Go or Rust.
$ wasm-pack build npm run start from the /www directory in order to
Figure 2 shows the output of the previous start the local webserver. You can now visit http://
commands as well as the initial directory structure of localhost:8080 and see the results of the lxf project
the Cargo project. The src directory contains the Rust as rendered by Firefox (see Figure 3 over the page). The
code of the project, whereas the Cargo.toml file
contains the dependencies of the Rust project.
The wasm-pack build command does all the work the CARGo tool
for you, which includes downloading all necessary
components and generating its output inside the The Cargo tool is very powerful and can help you develop Rust
pkg directory. The most important file in the pkg applications. Let’s look at most popular and useful commands of
directory is ./pkg/lxf_bg.wasm, because it contains this tool, along with a small explanation in order to help you
the created WebAssembly code. The output of the remember them while learning Cargo.
next command will verify that ./pkg/lxf_bg.wasm The cargo new command creates a new project – by default, that
contains WebAssembly code: project will lead to a binary executable. Should you wish to create a
$ file pkg/lxf_bg.wasm library, you should execute cargo new --lib instead. cargo build
pkg/lxf_bg.wasm: WebAssembly (wasm) binary compiles a debug version of the local package along with its
module version 0x1 (MVP) dependencies. On the other hand, cargo build --release generates
In order to see the results of the WebAssembly an optimised binary executable or library.
program you will need to publish it on a webserver The cargo clean command removes artefacts that Cargo has
either locally or on the internet – in this tutorial we’ll generated in the past – it will enable you to build a project from
illustrate how to use it on your local Linux machine. scratch. The cargo run command runs the main binary of the local
So execute the npm init wasm-app www command package, which is ./src/main.rs. cargo install installs a binary
to do this locally. You now have a new directory called executable, whereas the cargo uninstall command removes a Rust
/www inside the root directory of your Rust project, binary. Last, the cargo test command enables you to execute all unit
with the following: and integration tests of the current package.
$ ls -a www/ Figure 5 (see the final page) shows the default help screen of the
. bootstrap.js index.html LICENSE-MIT cargo tool. You can find more information about specific commands
README.md by executing cargo <command> --help .
.. .git index.js package.json .travis.yml

www.techradar.com/pro/linux May 2019 LXF249 93


coding academy Speed up web apps

message that is displayed in the box is defined in ./src/


lib.rs. Additionally, if you press the OK button, the
Although displayed message box will disappear from your screen.
creating a
WebAssembly
binary from
A bit random
We are going to develop another Rust project that also
Rust is a
relatively generates a WebAssembly binary file. However, this
straightforward time it will be a more interactive example, as the project
process, will generate random numbers each time you press a
serving that user-defined button on the HTML page, created by
WebAssembly WebAssembly code. You can initiate the project by
code using executing the following commands and changing the
html and ./src/lib.rs file to the following (again, you can change
JavaScript the name of the project if you prefer):
might be
$ cargo generate --git https://github.com/rustwasm/ Figure 4: The output of the ran-str Rust project that creates
challenging, WebAssembly code and shows random numbers that were
wasm-pack-template
especially if you generated using JavaScript in your web browser.
aren’t familiar $ cd ran-str # This is the name of the Rust project
with JavaScript. $ vi ./src/lib.rs
therefore be Now, execute the following commands to build the everyone! The alert() function takes the formatted text
extra careful project and create the necessary JavaScript files that that is generated by the format! macro and presents it
with your code. will help you execute the WebAssembly code: to the user.
$ wasm-pack build Although the Rust code is relatively simple, the
$ npm init wasm-app www JavaScript and HTML code used for using the
$ vi ./www/index.js WebAssembly binary is much trickier.
$ vi ./www/index.html
$ cd www Let’s talk JavaScript
$ npm install The random numbers are generated by JavaScript
$ cd ../pkg/ using the Math.random() JavaScript function. Each
$ sudo npm link random number that is generated will be given as an
$ cd ../www argument to the wasm.greet() function that is
$ npm link ran-str implemented in Rust and compiled into WebAssembly
code. The contents of ./www/index.js should be:
Explaining the Rust code $ cat ./www/index.js
The core functionality of the project can be found in the import * as wasm from “ran-str”;
greet() function that is implemented inside ./src/lib. var x = Math.floor(Math.random() * 100) ;
rs as follows: wasm.greet(x);
#[wasm_bindgen] The contents of ./www/index.html should be:
pub fn greet(input: &str) { $ cat ./www/index.html
alert(&format!(“Random number: {}!”, input)); <!DOCTYPE html>
} <html>
So, this time, the greet() function expects some <head>
Figure 3: This input using a parameter named input . This means that <meta charset=”utf-8”>
is the output the JavaScript code will have to call it with a string <title>Hello wasm-pack!</title>
generated by the parameter. The value of that parameter will be </head>
lxf Rust project, generated from JavaScript. The #[wasm_bindgen] <body>
compiled into
WebAssembly
attribute tells Rust that this function should be able to <button value=”Refresh Page” onClick=”window.
and rendered in be called by JavaScript. Put simply, this attribute tells location.reload()”>New Number</button>
Firefox. the world that this Rust function is available to <script src=”./bootstrap.js”></script>
</body>
</html>
If there are no errors, executing npm run start from
the www directory allows you to see the results of the
ran-str Rust project in your favourite web browser (see
Figure 4 above).
The good thing is that you will no longer need to have
Rust installed on your local machine in order to use that
WebAssembly code. You can also use the wasm-pack
publish command to publish your project to NPM.
However, you will first need to sign up at www.npmjs.
com/signup and then login using npm login for
wasm-pack publish to work correctly.
It’s worth knowing that the wasm-pack test
command enables you to test your WebAssembly
project. Its default output is as follows:
$ wasm-pack test

94 LXF249 May 2019 www.linuxformat.com


Speed up web apps coding academy

About WebASSembly
WebAssembly (aka Wasm) is a machine-model and executable
format targeted for a virtual machine, designed for efficiency – both
in speed and file size. That means that you can use a WebAssembly
binary on any platform you want without a single change. It also
means that WebAssembly binaries tend to be quite large in size,
though this shouldn’t be a problem with modern computers.
WebAssembly comes in two formats: a plain-text format and a
binary format. Plain-text format WebAssembly files have the WAT
extension, whereas binary files have the WASM file extension. A WAT
file uses S-expressions, whereas the binary format can be executed
by Wasm virtual machines.
Figure 5: This figure illustrates the use of the Cargo tool by showing An S-expression is an older textual format used for representing
its default help screen. trees. In the case of WebAssembly, an S-expression is used for
describing modules, which are the fundamental code units in
Must specify at least one of `--node`, `--chrome`, WebAssembly. Note that if you have a WASM binary file, you’ll have
`--firefox`, or `--safari` to load and use it using the JavaScript API.
When you define one of the allowed command line Apart from Rust, WebAssembly can also be generated by other
options, the command downloads the required programming languages that have support for static typing, including
packages and begin testing. The only requirement for Go, C and C++. Functions in WebAssembly should be included in
the test to run is that you should have the desired web modules – in our case, this is being taken care of by Rust, and most
browser already installed. other languages provide the same support.
Again, talking more about testing is beyond the
scope of this tutorial, but you can find plenty more
resources online. The entire process is also illustrated in Figure 6
below, which also includes the Go code of hw.go.
Go WebAssembly! However, choosing between Go and Rust for creating
In this final section we’ll talk about the way the Go WebAssembly code is a matter of personal preference. you can learn
programming language generates WebAssembly code, It looks like WebAssembly is here to stay, so it would more about
in case you want to compare Rust with Go in relation to be a good idea to learn more about it and how you can WebAssembly
WebAssembly generation. This section will not talk generate WebAssembly code from Rust. by visiting
about publishing the generated WebAssembly code – You should keep four things in your mind after WebAssembly:
https://
just the Go way of generating WebAssembly code. reading this tutorial. First is that WebAssembly is not a
webassembly.
The good thing is that as far as Go is concerned, programming language, second is that you can generate
org and https://
WebAssembly is just another supported architecture. WebAssembly code from many existing programming developer.
Therefore you can use the cross-compilation languages. The third one is that after creating the mozilla.org/
capabilities of Go in order to create your WebAssembly WebAssembly code you no longer need the compiler of en-uS/docs/
binary files. Additionally, you will not need to install any the programming language that you used; and the last WebAssembly.
extra packages for WebAssembly support in Go. one is that some JavaScript code is still required. Enjoy
So if you have a Go source file called hw.go, you can WebAssembly and happy coding!
compile it and generate a WebAssembly file as easily as
the following:
$ GOOS=js GOARCH=wasm go build -o main.wasm hw.
go
The hw.go file contains ordinary Go code without
any indication that it is going to be compiled into
WebAssembly. It is the values of GOOS and GOARCH
that specify and tell Go to create WebAssembly code. If
you do not specify the right values, the compilation will
not generate WebAssembly code or might fail
completely. There are various ways to see the output of
main.wasm, including using your favourite web
browser. However, if you have Node.js already installed
on your Linux machine, there is a much easier way to
see the output, which will save you from loading the file
in your web browser:
$ export PATH=”$PATH:$(go env GOROOT)/misc/
wasm”
$ GOOS=js GOARCH=wasm go run . Figure 6: This is the Go way of creating WebAssembly code – and illustrates a trick that can help
Hello World! you execute your WebAssembly binary without the need for a webserver.

ImpRoVe youR CoDe SkIllS Subscribe now at http://bit.ly/LinuxFormat


www.techradar.com/pro/linux May 2019 LXF249 95
On the disc
Discover the highlights from this month’s packed DVD!

pen-testing distro
stArt Here
using the LXFdVd
Using Linux for the first time can
be very confusing. It’ll be unlike
Kali Linux 2019.1 64- & 32-bit
anything that you’ve likely operated nce again we have only a single memory) to the live environment with apt.
before, especially if you’re used
to Microsoft Windows or Apple
macOS.
o distribution this month, but this time
we’re not neglecting our 32-bit users,
Speaking of the live environment, you may
notice that those are the only available options
with 64- and 32-bit versions of Kali Linux. It’s when booting the disc: the installation options
Generally our DVDs are designed
to be run directly, which is to say
been a while since the last Kali release – the end are all conspicuously absent. That’s because we
that when you first power on your of October 2018, in fact – and we like to removed them, much as we did eight issues ago,
PC (or Mac) it should ‘boot’ from encourage our readers to hack all the things because they don’t play nice with our multi/
the DVD – so before Windows or (in a totally legal and responsible way, of course), hybrid booting menu system. Given the choice,
macOS even starts to load – with
so here we are. we’d rather have a disc that boots to a nice live
Linux running directly from the
DVD. This trick is known as a Live The main event in this new release is version environment than one that offers broken
Disc. It enables you to try out the 5.0 of Metasploit Framework, released in January options, promises and dreams.
various versions of Linux without 2019, but there’s all sorts other goodies. We’ve Kali Linux is often run straight from a live
having to install or change anything gone for the MATE release this time, because we medium anyway, but if you do want to install it,
on your PC. Just remove the DVD,
restart your PC and it’ll be exactly
like it. This is the full-fat edition with all the tools just burn/write the Kali ISO (located in the Kali/
as you left it. ready to go. There’s only so much you can fit on or Kali-light32/ directories on the disc) to a
While many systems will boot a DVD, so we’ve got the Xfce-based Kali Light for DVD-R or USB stick. Writing the whole disc
from a DVD when it finds one, 32-bit users. This has all the basic tools, and you (either using dd or using a program like
many will not. See below for the can add anything you like (subject to available Unetbootin or Rufus) won’t work, partly because
standard process for enabling
booting from a DVD on various
desktops and laptop PCs. We took away
the installation
The alternative option is to
options and
locate the ISO file on the DVD and
added a warning.
write this to your own USB thumb
We are a cruel
drive and attemp to run that. We
and heartless
recommend using Etcher from
bunch.
www.balena.io/etcher that’s
available for Windows, macOS
and Linux. Good luck!

boot the disc


Many PCs should boot
automatically if they’re turned on
with a disc in the drive. If not, many
offer an early Boot Menu accessed
by tapping a key while powering up
from cold: F9 (HP), F12 (Dell,
Lenovo), F8 (Amibios) or F11
(Award BIOS). Alternatively, use
the BIOS/UEFI to adjust the boot
order to start with the optical drive.
Again, this is accessed by tapping a
key during power up, usually Del
but sometimes F1 or F2. Some new
UEFI PCs require access via
Windows: holding Shift select its
Restart option. If you’re still having Important notIce!
problems using the DVD visit: DefectIve DIscs: For basic help on running the disc or in the unlikely event of your
www.linuxformat.com/
dvdsupport Linux Format coverdisc being in any way defective, please visit our support site at
www.linuxformat.com/dvdsupport. Unfortunately, we’re unable to offer advice on
Mac owners: Hold the C key
while powering on your system using the applications, your hardware or the operating system itself.
to boot from the disc.

96 LXF249 May 2019 www.linuxformat.com


Adding a
partition to And More!
a USB stick
from a funky
terminal. (There Reading matteR
is absolutely
no need to
Advanced Bash
update fstab.)
Scripting Guide
Go further with shell scripting.

Bash Guide for Beginners


Get to grips with the basics
of Bash scripting.

Bourne Shell Scripting


First steps in shell scripting.
The Cathedral and
the Bazaar
Eric S. Raymond’s classic text
explains the advantages of
open development.

The Debian Book


Essential guide for sysadmins.
the install options still won’t be there but mostly $ sudo parted /dev/sdX mkpart primary 3214 Dive Into Python
because you’ll have just added a new layer of 15.5gb Everything you need to know.
filesystem abstraction to things. Use a program You may have to decrease the end boundary if Introduction to Linux
like Etcher (www.balena.io/etcher) if you want it refuses or if you have a smaller capacity USB A handy guide full of pointers
for new Linux users.
to do things graphically, or use dd if you prefer stick – remember the usable capacity of these
the old fashioned way: things is never quite as advertised. You can Linux Dictionary
$ sudo dd if=/media/LXFDVD249/Kali/kali- specify a value in megabytes (as in the start The A-Z of everything to do
with Linux.
linux-mate-2019.1-amd64.iso of=/dev/sdX bs=4K boundary) or use the gb suffix for metric
status=progress gigabytes. You may also get some warnings Linux Kernel in a Nutshell
The forementioned Unetbootin and Rufus about not being able to use the exact start An introduction to the kernel
written by master hacker
probably work on the Kali ISOs too, but we values, or about the partition placement not
Greg Kroah-Hartman.
haven’t tested that and we like Etcher. being ‘optimal’. These can be safely ignored
Having a Kali USB stick avails you of its and the values it suggests are generally sensible. The Linux System
persistence features (we left those options on Once that’s done, we can make our Administrator’s Guide
Take control of your system.
the DVD menu just to pique your interest). This filesystem. We’re a bit short of space here, so
means you can carry around a customised Kali we won’t cover setting up a LUKS-encrypted Tools Summary
Linux that you can boot anywhere without volume here (you’ll find the details at https:// Overview of GNU tools.
touching the host machine. kali.org/prst), but adding an ext3 filesystem is GNU Emacs Manual
Perhaps you’ll be working on database just a matter of Six hundred pages of
essential information!
dumps and need to save intermediate files $ sudo mkfs.ext3 -L persistence /dev/sdX3
before getting an hour’s sleep and moving to the In order to use it, we need to create a config Producing Open Source
next safehouse; maybe your coworker stole your file that tells Kali to use this partition for Software
Everything you need to know.
last USB stick (what, me?–Ed) and you just need persistent storage. That file should reside in the
somewhere to save the cat GIFs du jour; maybe root directory of the persistence volume and be Programming from the
you just really want to install Kali Linux (it’s called persistence.conf. All it needs to contain Ground Up
Take your first steps.
based on Debian and uses the same installer) – is the text:
it’s all possible. / union
Check the previous link if you need more details.
nothing if not persistent The Bookshelf is also back this month, and as
A small amount of further setup is needed to well as everything listed in that column over
use Kali’s persistence features. Mostly we need yonder we’ve managed to find space for Kali
to create our data partition in the extra space on Linux Revealed, Offensive Security’s official 341-
the USB stick. The Kali live partition occupies page guide to the distro. This covers much more
about 3GB (actually 3214MB), so the difference than we could fit in this magazine, let alone
can be used to store data. We need to specify these two pages. The root password is ‘toor’ –
the partition boundaries to create the partition; everything in Kali is done with root.
the following worked for us with a 16GB stick:

new to LInux? start here… downLoAd


Never used Linux before? Here are some handy resources: your dVd
Read our quick-install guide http://bit.ly/LXFinstall iMAges!
Looking for an answer? https://askubuntu.com Get code and DVD images at:
Want to delve more deeply? https://linuxjourney.com www.linuxformat.com
/archives

www.techradar.com/pro/linux May 2019 LXF249 97


LXF250
will be on sale
The #1 open source mag

Future Publishing Limited,

Tuesday Quay House, The Ambury, Bath, BA1 1UA


Email linuxformat@futurenet.com

7 May
EDITORIAL
Editor Neil Mohr
Black-hat editor Jonni Bidwell

2019 Art editor Efrain Hernandez-Mendoza


Production editor Ed Ricketts
Group editor in chief Graham Barlow
Senior art editor Jo Gulliver
Editorial contributors
Michael Bedford, Neil Bothwick, Stuart Burns,
Christian Cawley, Sean Conway, Alex Cox,
Jon Masters, John Knight, Nick Peers, Les Pounder,
Mayank Sharma, Shashank Sharma, John
Schwartzman, Alexander Tolstoy, Mihalis Tsoukalos
Cartoons Shane Collinge
Cover illustration magictorch.com
ADvERTIsIng
Media packs are available on request
Commercial director Clare Dove
clare.dove@futurenet.com
Senior advertising manager Lara Jaggon
lara.jaggon@futurenet.com
Advertising manager Michael Pyatt
michael.pyatt@futurenet.com
Director of agency sales Matt Downs
matt.downs@futurenet.com
Ad director – Technology John Burke
john.burke@futurenet.com
Head of strategic partnerships Clare Jonik
clare.jonik@futurenet.com
InTERnATIOnAL LIcEnsIng
Linux Format is available for licensing. Contact the
Licensing team to discuss partnership opportunities.
Head of Print Licensing Rachel Shaw
licensing@futurenet.com
subscRIpTIOns & bAck IssuEs
Web www.myfavouritemagazines.co.uk

Run Linux on
Email linuxformat@myfavouritemagazines.co.uk
UK 0344 848 2852
International +44 (0) 344 848 2852
cIRcuLATIOn
Head of newstrade Tim Mathers
pRODucTIOn AnD DIsTRIbuTIOn
Head of production UK & US Mark Constance

Chromebooks
Production project manager Clare Scott
Advertising production manager Joanne Crosby
Digital editions controller Jason Hudson
Production controller Nola Cokely
ThE mAnAgEmEnT
Chief content officer Aaron Asadi
Editorial director William Gannon
Brand director Andy Clough
Head of art & design Rodney Dive
Commercial finance director Dan Jotcham

It was more fun than expected, so we took Printed by Wyndeham Peterborough, Storey’s Bar
Road, Peterborough, Cambridgeshire, PE1 5YS
Distributed by Marketforce, 5 Churchill Place, Canary

hacking the low-cost Linux boxes to the next level! Wharf, London, E14 5HU www.marketforce.co.uk
Tel: 0203 787 9001
LINUX is a trademark of Linus Torvalds, GNU/Linux is abbreviated to Linux
throughout for brevity. All copyrights and trademarks are recognised and respected.
Where applicable code printed in this magazine is licensed under the GNU GPL v2 or
later. See www.gnu.org/copyleft/gpl.html.

Rescue distros
We are committed to only using magazine paper which is derived from
responsibly managed, certified forestry and chlorine-free manufacture. The paper in
this magazine was sourced and produced from sustainable managed forests,
conforming to strict environmental and socioeconomic standards. The
manufacturing paper mill holds full FSC (Forest Stewardship Council) certification
and accreditation

Before your think you’ve lost it all, try to rescue it. We test the  Disclaimer All contents © 2019 Future Publishing Limited or published under
licence. All rights reserved. No part of this magazine may be used, stored,

best of rescue distros to discover how to save your bacon. transmitted or reproduced in any way without the prior written permission of the
publisher. Future Publishing Limited (company number 2008885) is registered in
England and Wales. Registered office: Quay House, The Ambury, Bath BA1 1UA. All
information contained in this publication is for information only and is, as far as we
are aware, correct at the time of going to press. Future cannot accept any

Child rescue
responsibility for errors or inaccuracies in such information. You are advised to
contact manufacturers and retailers directly with regard to the price of products/
services referred to in this publication. Apps and websites mentioned in this
publication are not under our control. We are not responsible for their contents or any
other changes or updates to them. This magazine is fully independent and not

How open source software and deep learning is being used 


affiliated in any way with the companies mentioned herein.
If you submit material to us, you warrant that you own the material and/or have
the necessary rights/permissions to supply the material and you automatically grant
Future and its licensees a licence to publish your submission in whole or in part in

to develop tracking tools that can locate lost children. any/all issues and/or editions of publications, in any format published worldwide and
on associated websites, social media channels and associated products. Any
material you submit is sent at your own risk and, although every care is taken, neither
Future nor its employees, agents, subcontractors or licensees shall be liable for loss

Better webcams
or damage. We assume all unsolicited material is for publication unless otherwise
stated, and reserve the right to edit, amend, adapt all submissions.
All contents in this magazine are used at your own risk. We accept no liability for
any loss of data or damage to your systems, peripherals or software through the use
of any guide. Many blue passports died to bring us this magazine.

Get more from your webcams as we explore the drivers, the Future is an award-winning international media group and
leading digital business. We reach more than 57 million

software and what you can do with a PC-attached camera. international consumers a month and create world-class
content and advertising solutions for passionate consumers
online, on tablet & smartphone and in print.

Linux thin clients


Take advantage of network-booting thin clients, from the 
Raspberry Pi to full Intel-based systems.
Future plc is a public Chief executive Zillah Byng-Thorne
company quoted on the Non-executive chairman Richard Huntingford
London Stock Exchange Chief financial officer Penny Ladkin-Brand
(symbol: FUTR)
www.futureplc.com Tel +44 (0)1225 442244
Contents of future issues subject to change – we might be battling the Brexit zombie hordes.

98 LXF249 May 2019

You might also like