The Pi PLUG &PLAY Amazing person shooter first- a Create CODING GAME Machine learning learning Machine Bitcoin #1 open PROJECTS Digital PRO-LEVEL MUSIC PRO-LEVEL builds 3 CCTV source LMMS 1.2.2 LMMS audio you the filesystem to control Python Using MAKE SYSTEM TOOLS security mag Retro games workstations can complete 4 Qtractor0.9 Multi-room and more!and 1 Ardour in a audio day: 5 MIXING 6.5 Waveform Pro 11.5 2 MusE HOW PLUS! RENDER WITH BLENDER VIDEO EMULATE Discover how Kubernetes is coding 4.0 Expert

67 with

transforming Linux use Linux transforming CALL Transform TO… languages MAGEIA THE

better

advice WITH & DOWNLOAD APPLE pages tutorials features

JITSI GIMP

your on II FREE

LXF May 2021 for

the effects photos 8 school of best

WELCOME

Pico boo! WHO WE ARE I remember people used to talk about market disrupters and truly the We’re trying out Raspberry Pi and Pico Raspberry Pi was just that. In a world projects this issue – so what’s your that looked like it was falling into a corporate-owned walled garden of favourite maker project or Pi add-on? locked-down “smart” devices, like the Apple iPad and Google Nexus phones, came 10 thousand bare-naked Raspberry Pis that happened to run Jonni Bidwell Linux. Who’d be mad enough to want to My RetroPie set up is losing me lots of hours. buy one of those? Forty million Pi sales But I’ve also been mesmerised by magnetic later and here we are… marble tracks from a local maker in Bath. It’s not like the Raspberry Pi was They’re laser-cut from wood with stylish living unique as a device. Beagle and Arduino had similar single-board computers, hinges for the curvaceous bits. A modern take but at much higher prices and without necessarily the software backing it on a childhoodhildh d classic.l Check them out at https://deepmake.io. up. At the time I read a lot of Pi criticism pointing out the better specs of competing devices, while completely ignoring the software and price point. It’s not quite the same, but when the Apple iPhone launched there were Nick Peers better and more capable devices such as the Nokia E90. However, Apple put My favourite Pi project was one I documented the software in place and made its device easier to use and to develop for. way back in LXF239 and 240: creating a If anything, the Raspberry Pi – much like the Apple iPhone – sparked the multi-room audio system with Logitech Media imagination of developers around the globe. It drew together a community Server and a Pi Zero running PiCorePlayer. to develop the software and put in place a charitable body to drive the It’s three years since I installed it, and I’m still logistics and direction of hardware development. So nine years on the llistening to music through it every single day. Raspberry Pi Foundation is able to release the $4 Pi Pico, which it’s designed entirely itself and can ship worldwide without a hitch. Remarkable. We’re having our annual look at the best Raspberry Pi projects in Les Pounder conjunction with Tom’s Hardware, because our very own Les Pounder has For me the Raspberry Pi Pico has been a jumped ship and works for them now, creating endless top-notch Pi news, runaway success, more so now that I have reviews and projects. The dirty splitter! (Don’t worry Les still writes for us.) the Maker Pi Pico board from Cytron. For $10 It’s not all Pi talk, though. We start a series looking at the basics of using I have a Pico and lots of connections for Grove the amazing Blender, try special effects in GIMP, explore Kubernetes, review components, a speaker, micro SD card reader educational programming languages, create a basic first-person shooter and lots of built-in LEDs to play with. aping Wolfenstein, emulate the classic Apple ][, test audio workstation software and loads more! So enjoy.

Mayank Sharma I thought I had seen them all, but then last week I heard of a Russian doctoral student who trained a Raspberry Pi 3 to detect and Neil Mohr Editor track mosquitoes with the help of OpenCV [email protected] and AI, before it triggered the mounted one-wattttlaser lto t zap them out of existence.

Michael Reed The Pi 400 might be the next thing I buy for myself. My plan would be to turn it into a retro Subscribe computing workstation. It’s always appealed to me to be able to recreate older machines & save! such as the Amiga and the Acorn Archimedes On digital and print – and have them on tap, in my living room. see p24

www.techradar.com/pro/linux May 2021 LXF275 3 PLUS!

SUBSCRIBE NOW! Contents Page 24 REVIEWS PLUG & PLAY AMD Ryzen 9 5950X 17 Zak Storey climbs onto the closest thing the computing industry has to a unicorn, and straps in for the ride of his life. PI PROJECTS Jonni Bidwell plunders Tom’s Hardware to bring you the best in Raspberry Pi-based entertainment. Turn to page 32 to see the fruits of his labours.

WD Black SN850 1TB 18 Move over Samsung, there’s a new PCIe 4.0 storage king in town says Alan Dexter, as he reaches for the ermine-lined cloak.

SparkyLinux 2021.03 19 Its unimpressive appearance intrigued Mayank Sharma, who wants to find how this distro has survived for as long as it has.

SystemRescue 8.0 20 If you’re as adventurous with your installations as Mayank Sharma, then you’ll want to keep a copy of this distro handy… In association with CentOS Stream 8 21 Mayank Sharma studies the distro that has the open source community up in arms, to see what the hullabaloo is all about. ROUNDUP IN-DEPTH Spiritfarer 22 In these turbulent times management has shown uncharacteristic compassion and allowed Rachel Watts to contemplate life.

Audio workstations 26 A parent’s guide to programming 42 The Linux desktop has always had its share Mike Bedford investigates which of music software. Michael Reed looks at programming languages to consider if the cream of the current Digital Audio you want to help your children get a head- Workstations crop. start in coding.

4 LXF275 May 2021 www.linuxformat.com CONTENTS

ON YOUR Pi USER FREE DVD Mageia 8.0 Raspberry Pi news 46 AntiX 19.3 Interest heats up for the Coolest Projects, See page 96 plus Ethernet double-whammy and MicroPython is piped on to the Pi.

MX-Fluxbox Pi 21.02.20 47 Les Pounder is always on the lookout for a new slice of Pi and with MX Linux he discovers something fresh from the oven. DVD pages 96 Escape from evil space squids! 48 This issue’s coverdisc is your chance to try Les Pounder has to evade the clutches of out the long-awaited Mageia 8 and the the evil space squids, but can he do the lightweight antiX 19.3. Jonni Bidwell takes maths to escape the planet? you through both Linux distributions.

New tricks for the Pico voltmeter 50 Tam Hanna expands his basic Raspberry Pi Pico voltmeter to improve accuracy and add TUTORIALS a resistor measurement capability.

TERMINAL: Fresh multiplexer 58 Shashank Sharma is enthralled by Byobu, an elegant and efficient solution for managing multiple terminal windows. CODING ACADEMY JITSI: Perfect video conferencing 60 Move over Zoom – Nick Peers reveals how Code a first-person shooter 88 to set up your own public (and private) Calvin Robinson looks to the iconic group video chats for free with Jitsi Meet. PC games Doom and Wolfenstein 3D for inspiration, in the latest instalment in RENDER: Getting started in 3D 66 his game coding series. Even if you’ve never used Blender before, Michael Reed will have you blending like a Monitor cycles in directory trees 92 pro by the end of this tutorial. Mihalis Tsoukalos sips on a cold bottle of Mythos in the Greek sun while working with EMULATE: The classic Apple ][ 70 dictionaries, os.walk(), files, symbolic links Les Pounder steps into his time machine and directories. and travels back to 1977, and not just to watch Star Wars on the big screen for once.

REGULARS AT A GLANCE GIMP: Add special effects to photos 82 Fancy getting more creative in your photography? Mike Bedford introduces a News 6 Subscriptions 24 few special effects for you to explore. Way-hay for Wayland we cry, NASA lands Tux on Mars, there’s a modular Linux Back issues 64 OFFICE: Co-editing documents 86 laptop coming, Python2 is going on Fedora, Get hold of previous Linux Format editions – Integration of OnlyOffice Docs with SteamLink goes open source and all your but watch out, they’re selling out fast! Confluence enables multiple users to edit servers belong to Microsoft! office documents, finds Kseniya Fedoruk. Overseas subscriptions 65 Kernel watch 10 HotPicks 75 IN-DEPTH Answers 11 Alexander Tolstoy hasn’t got the time to We provide the light at the end of various read every Russian Tweet, he’s far too busy long tunnels, including solving network reading every new FOSS release and problems, fixing a scanner that won’t do its writing them up here, like Photoflare, Qytdl, one job and making Wi-Fi work as it should. KWipe, GabTag, Fvid, Draw.io, Spech, 0 A.D., Quadplay, Guitar and Sonice. Mailserver 14 Coding hitch using Python, success in DVD pages 96 running a distro off a USB stick, what Kubernets krazyness! 54 Microsoft wants from Linux, and more. Next month 98 We talk to database guru Patrick McFadin.

www.techradar.com/pro/linux May 2021 LXF275 5 NewsdeskWayland and Ubuntu Tux on Mars Microsoft and THIS ISSUE: AMD team up Modular laptop launch Fedora ditches Python 2

GRAPHICS Is Wayland ready for prime time? With Ubuntu switching to Wayland as default, along with support from Nvidia and Wine, things are looking good for the display server protocol.

or years the Wayland display server Another exciting hint comes from the protocol has looked like it would Longhorn Twitter account (@never_ F become a mainstream alternative to released), which claims that the the X Window System. Yet a prime-time release Nvidia 470 driver series will have always seemed one year away… Recent moves “full Wayland support on Linux, by some big industry names means that including XWayland.” With the Wayland’s time could finally be upon us. prevalence of Nvidia hardware, The team behind the Ubuntu distro has this is a big step forward for announced that they’ll once again be attempting mainstream adoption of Wayland. to use Wayland as the default session. While this In more good news, a growing has previously been attempted with Ubuntu number of popular applications 17.10, the team now feels confident that “now is now come with support for Wayland. the right time to try again,” with an aim of using Electron 12 (www.electronjs.org), a tool Wayland as default in an LTS (Long Term for creating cross-platform tools, has Support) version. Wayland support. Wine, a compatibility layer With the GNOME version of Ubuntu not being that enables people to run Windows software in Wayland’s mainstream success upgraded in this cycle, the team believes this will Linux, also supports running those applications hasn’t happened overnight, but its make things easier. However, in a forum post directly on Wayland compositors (for more time in the spotlight could be soon. (which you can read at http://bit.ly/ LXF275UbuntuWayland), the team admits that people with Nvidia hardware will still use Xorg as A GROWING NUMBER OF default, but “hopefully that situation will be resolved before the LTS.” POPULAR APPLICATIONS What will help achieve that goal is the NOW COME WITH revelation that the upcoming major Nvidia 470 driver series will be“even more Wayland-friendly.” SUPPORT FOR WAYLAND. The comments were made by Canonical’s Daniel van Vugt, who observed that “the main reason information, head to http://bit.ly/ not to use Wayland on Nvidia is that it doesn’t LXF275WINEWayland). support hardware acceleration of X11 apps,” In the past, a lack of hardware and software but that “Nvidia has a fix on the way.” You can support has prevented Wayland adoption. These see the original post at http://bit.ly/ industry developments could go a long way LXF275NvidiaWayland. towards greater Wayland useage.

6 LXF275 May 2021 www.linuxformat.com NEWSDESK

SCIENCE OPINION Linux lands on the Red Planet SALUTING The Perseverance rover’s successful Mars landing took KERNELCI Linux and open source software to another planet.

inux is no longer just the most widely- It’s a hugely exciting development not just for used operating system on Earth – it’s mankind, but for Linux and open source. It shows L now made its way to Mars. NASA how open source software can help us explore recently landed the Perseverance rover on our new worlds, while making it possible for anyone celestial neighbour, along with a small helicopter, to use the exact same software in their own Alexandra Pereira is a known as Ingenuity. This was used to attempt the projects at home – for free. As Twitter user software engineer at Collabora. first powered flight on a planet other than Earth, @mikko so dryly observed, Mars is now “the and it was powered by Linux. second planet that has more computers running NASA Jet Propulsion Laboratory (JPL) senior Linux than Windows.” KernelCI has been engineer Tim Canham said, in an interview with Keep up to date with the Perseverance’s Mars driving continuous the Institute of Electrical and Electronics mission at http://bit.ly/LXF275Mars. integration for the Linux Engineers (IEEE) (see http://bit.ly/LXF275IEEE), kernel with hundreds of the “software framework that we’re using is one commits every day since its that we developed at JPL for cubesats and creation in 2012 and as a instruments, and we open-sourced it a few years Linux Foundation project ago.” The framework Canham referred to is since 2019. The platform F Prime (http://bit.ly/LXF275FPrime), which is can help you find and fix an “open-source framework for small-scale flight several problems, including software systems.” As he explains, because it’s regressions, build failures open-source, you can use F Prime that’s made its and merge conflicts from way to Mars and use it with your own project. your patches with others. “It’s kind of an open-source victory,” Canham Today, KernelCI is the says, “because we’re flying an open-source most complete automated operating system and an open-source flight CREDIT: NASA/JPL-Caltech testing and continuous software framework and flying commercial parts integration tool for the that you can buy off the shelf if you wanted to do The Ingenuity’s test flight on Mars. This mini helicopter is Linux kernel. It can test your this yourself someday.“ powered by Linux. code on many platforms performing automatic builds in kernel trees. Builds, tests SECURITY information and more can be found in its dashboard. Over the past year, the KernelCI dashboard has Secured-core server announced changed in many points, transitioning from checking AMD and Microsoft have teamed up to bring basic boot reports to starting to check more a greater degree of security to devices. advanced test reports. This has opened the way to an MD and Microsoft have both boot securely and avoid any firmware increased focus on testing, announced the launch of its Secured- vulnerabilities, while protecting the OS from more specifically functional A core Server initiative which, according attacks or unauthorised access. As the AMD blog testing, and on improving to AMD’s announcement (http://bit.ly/ post explains, “The firmware and bootloader can quality, stability and long- LXF275AMDSec), will help you “boot securely, load freely with the assumption that these are term support. protect your device from firmware unprotected code and knowing that shortly after Looking ahead, work vulnerabilities, shield the operating system launch the system will transition into a trusted continues towards further from attacks and prevent unauthorised access state with the hardware forcing low level firmware improving user experience, to devices and data with advanced access down a well-known and measured code path.” and discussions are focused controls and authentication systems.” This process enables the OS to ensure the on enhancing KernelCI’s Meanwhile, Microsoft’s own announcement system’s integrity during boot up and during use. dashboards, visualisation (http://bit.ly/LXFMicrosoftSec) reveals that What’s interesting is AMD’s involvement, with its and analytics. If you’d like to Secured-core Sever “is built on three key Dynamic Root of Trust Measurement being able take part in this work and pillars: simplified security, advanced to use a open-source stack, and could result in share your ideas, please protection, and preventative defence.” With a more open source firmware for AMD platforms join the discussion on device running Secured-core Server, it can and less dependency on closed source firmware. the GitHub repo.

www.techradar.com/pro/linux May 2021 LXF275 7 NEWSDESK

OPINION LAPTOPS RISKY Make your BUSINESS own laptop A modular notebook that users can easily configure and upgrade. The Framework Laptop is set to be released some time this summer. Keith Edmunds is MD of Tiger Computing Ltd, hile many modern laptops are to 64GB RAM and 4TB or more of SSD storage. which provides support for becoming ever more difficult to open However, it’s the modular aspect that’s really businesses using Linux. W up to fix or upgrade components exciting. Using ‘Expansion Cards’, you can (MacBooks and Microsoft’s Surface lineup are choose the ports you want it to come with, and particularly notorious for gluing everything the entire mainboard can be replaced when Risk analysis together), the Framework Laptop looks set to newer CPUs are released. The company also considers the likelihood of a buck this trend by offering a stylish and slimline promises that the battery, screen, keyboard and risk being realised and then laptop that can be configured and upgraded. more can all be easily replaced. multiplies it by the impact of Built with an aluminium housing and weighing The Framework Laptop DIY version comes as it being realised to give a just 1.3kg, the Framework Laptop comes with a a kit of modules to build yourself, and comes “level of risk”. 13.5-inch, 2,256x1,504 screen, a 1080p webcam without an OS, so you can easily install Linux. For example, leaving your with privacy switch, 11th gen Intel processors, up Find out more at https://frame.work. suitcase across the top of the stairs means there’s a risk that someone may trip CODE GAMING over it. Not very likely, but the impact of falling down the stairs is likely to be substantial (and painful!). In Bye bye Python 2 Play games with short, don’t do it. The likelihood of a data Fedora is now almost free centre catching fire is very Steam Link low, but the impact is likely from Python 2, though some to be very high. There’s little packages still require the Steam Link enables you to you can do (unless you’re a data centre owner) to aging language. stream games from your PC manage the risk of fire to other devices. breaking out, but you can he Fedora distro’s goal of moving mitigate the impact. from Python 2 to Python 3 is getting team Link (released in 2018) is now Some people don’t have T tantalisingly close, with the Python 2 available for Linux devices courtesy of data backups that are Dropping Database (http://bit.ly/LXF275P2DD) S Flathub (you can download it from independent of the data noting that 99 per cent of Python packages in http://bit.ly/LXF275SteamLink), enabling you to centre. Hopefully they’ve Fedora Rawhide are now using Python 3. stream games from another PC running Steam spent a bit of time With Python 2 entering its End of Life on to that device. This is handy if you have a Linux- considering the risk of losing 1 January, 2020, there has been a concerted powered PC hooked up to your main TV, but the backups (low) and the effort to move popular tools in Fedora to Python your gaming PC is elsewhere in the house. With impact of losing both 3. While this 99 per cent milestone is certainly Steam Link, you can stream games from your original data and backups impressive, there are still some noticeable gaming PC to the Linux device. (typically very high). holdouts still using Python 2, such as the Because the software streams the games Whether or not you Chromium browser, GIMP, SeaMonkey and from the powerful PC, it means that you can should have backups that Tra c . There are also several ‘idle’ packages play games on devices that would usually be too are isolated from the source that have yet to be ported to Python 3. underpowered to play them, and it’s great to see data is a business decision, The Python 2 Dropping Database is asking Linux devices now supported, along with not a technical one. Just volunteers to grab a package and Windows and Android devices. ensure that you do the help port these over to Python 3. Attaching a game controller to the device analysis correctly. Hopefully with some more hard gives you a pretty impressive experience, but Me? For business critical work from the community, while it supports Wi-Fi, Valve – the company data, two independent, Fedora could be completely free behind Steam – recommends using a wired remote backups from outdated Python 2 Ethernet connection. From our experiences with are mandatory. packages in the near future. Steam Link, we agree.

8 LXF275 May 2021 www.linuxformat.com NEWSDESK

OPINION Distro watch PRIORITIES What’s lurking behind the sofa? THE PEOPLE

MAKULULINUX 2021-03-05 Moving from Windows to Linux can be daunting for some people, especially for people who are comfortable with the user interface of Microsoft’s operating system. Distros like MakuluLinux, which has a new version out, makes the switch much easier, with a Cinnamon desktop Matt Yonkovit is Percona’s that’s been designed to resemble Windows XP. Along Head of Open Source Strategy with new applications, this new version, named LinDoz, and a member of SHA (Silly now has an introductory video that helps new users get MakuluLinux is one of the best distros for Hats Anonymous). to grips with this distro. Find out more at: those new to all things FOSS-related. http://bit.ly/LXF275MakuluLinux. In December, CentOS announced a new approach MABOX LINUX 21.02 called CentOS Stream. This -based distro, which uses the Openbox Rather than having specific window manager, has a new snapshot (this is a rolling releases and long-term release distribution). Included in the latest snapshot are support (LTS), the new updates to the kernel (now 5.10 LTS), new packages and approach is based on a fixes to issues (such as memory usage statistics in the continuous stream of Conky panel). When installing this distribution you can updates. Support for choose between proprietary or open-source drivers. CentOS will end in For the full release announcement, head over to December 2021, putting http://bit.ly/LXF275Mabox. Mabox Linux uses the Openbox window its End of Life before manager, so it’s a great choice for low- CentOS 7 in July 2024. powered or older computers. Implementing a continuous update approach will help some TINYCORE LINUX 12.0 users. For others, the The team behind Tiny Core Linux claims this distro is reduced support for CentOS one of the smallest in the world, and this new version 8 will affect their future comes with updates to the kernel (now 5.10.3), various plans. Community backlash package updates and improved hardware support. As has been significant. with previous versions, there are three versions you can In the world of open install: the minimal Core, the desktop TinyCore and a source, the ability to fork a full installation image called CorePlus. To find out more TinyCore Linux is a graphical Linux project and support the about the latest version, and to download the distro in desktop that weighs in at just 12MB. community is a massive one of its three forms, head over to the release strength. Already, multiple announcement at http://bit.ly/LXF275TinyCore. forks of CentOS have been started, to address the gap. Changes in licences have affected data projects, also PFSENSE COMMUNITY EDITION 2.5.0 leading to forks. pfSense, a FreeBSD-based operating system that’s been Organisations rely on free designed to run on firewalls and routers, and is and open source projects. accessed via a web interface, has a new version that’s When terms change, this based on FreeBSD 12.2. This version updates OpenSSL has a massive impact. While pfSense is based on FreeBSD and can offer to 1.1.1, and brings WireGuard, a new VPN Layer 3 companies may have short- powerful tools for your router. protocol that’s easy to set up, and offers speedy and term economic goals to secure connections. To find out more about this release, meet, the long-term success and for guides on how to install it on your router or of the community should be firewall, head over to http://bit.ly/LXF275pfSense. their biggest concern. Because if community members don’t feel supported and valued, they will vote with their feet.

www.techradar.com/pro/linux May 2021 LXF275 9 NEWSDESK

OPINION TRIED AND TRUSTED Kernel Watch Jon Masters summarises the latest happenings in the Linux kernel, so you don’t have to.

hings were looking up following the computer to support. Provided you don’t push it slow start to this development cycle too far, and have reasonably fast storage, things T when seemingly out of the blue Linus can work pretty well. Push it a bit and you’ll end Jon Masters has been involved sent a follow-up email titled “A note on the up with “thrashing”, which is when things just with Linux for over 22 years. 5.12-rc1 tag.” In it, he provided a warning about grind to a halt. If you’ve ever witnessed a sluggish a data-corrupting bug that had snuck through. desktop then it may well have been because This month’s main This particular one affected those using swap Linux was busily thrashing data in and out of topic is a nasty data files (but not swap partitions, which are still the disk, in order to keep up with too many corrupting bug that struck generally the default option in common use) open browser tabs and windows. during the course of Linux and it affected them badly by destroying the When data is paged out, it’s written by a 5.12 development (and filesystem they were stored on. function that takes an offset parameter relative thankfully was caught before Like most other operating systems, Linux to the beginning of the storage volume. An the final release). While uses the concept of “swapping” (or perhaps innoculous-looking patch during the 5.12 “merge hopefully very rare, data more technically correct “paging”) less window” changed the function call to another corrupting bugs can and do recently used data out to disk when there’s a that didn’t include the correct offset, resulting occur. The worst are those memory crunch that necessitates freeing up in paged-out data being written to the wrong that affect the block and file some RAM. Because application memory is location on disk (overwriting key data). It systems because they not “virtual” in nature, every access by a program would only occur when a user had a swap only corrupt data while it’s to its memory goes through a translation file configured, but recent Ubuntu releases being used, but also destroy (paging) process that converts the virtual (at a minimum) may be using swap files now. copies on disk. If such bugs address as seen by the program into a In the end, the bug was caught quickly thanks are subtle, and take some physical address as seen by hardware. to testers, and Linus changed the release tag in time to be detected, things This facilitates the illusion of every his git tree from “5.12-rc1” to “5.12-rc1-dontuse”. can be worse. application having its own address space The hope was that this would put people off and The worst-case scenario and being able to use virtual addresses that that a prompt 5.12-rc2 could then become the would probably be backups might also be used by other programs (but focus for anyone doing development. He even ruined by virtue of slow data in their different view of reality, with different asked devs to change their normal workflow and corruption that results in translations to other physical addresses “rebase” their work on the update instead. copies stored to long-term underneath). It also enables the translated Alas, this wasn’t the end of the story because archives being in some way memory chunks (pages) to be “paged out” or developers in future may need to debug issues compromised. To avoid this, marked as not present. When an application that require them to “bisect” back to earlier modern filesystems are later attempts to access them, the kernel is branches that include the offending problem increasingly turning to given an opportunity to page back in the data commit. An ongoing discussion involving the git aggressive checksums and such that the program doesn’t even notice it developers seeks to determine whether there’s a background “scrubbing” of came in from disk. means to add support for broken commits that volumes to look for Paging data out to disk is what makes must come with a safety warning when they’re inconsistencies. it possible to run more applications than used. Such an approach seems likely and would I’ve always been extremely you would otherwise have the RAM in your avoid this bug coming back to bite. conservative when it comes to filesystems and storage choices. It’s fashionable to WHAT’S COOKING IN THE KERNEL? trot out a new one every few years, but I don’t much fancy Features landing in Linux 5.12 will include solutions to this perennial computing myself as a guinea pig. I support for “dynamic thermal and power problem, but this is a useful start. enjoy still using ext4 because management”, which “is a technique to 5.12 also removes support for a number of it not only has a lineage dynamically adjust the power consumption of legacy platforms (and the drivers that are dating back to the beginning different devices in order to ensure a global unique to those platforms) that no longer of Linux, but also is used thermal constraint”. This will allow, for have active users. These include TI’s “c6x” by both Android (present on example, future mobile/laptop SoCs (chips) which this author always meant to play with hundreds of millions of to better coordinate power use of different and never did. Perhaps the life lesson here is devices) and several chip components to avoid overheating and to procrastinate more often (my wife very hyperscalers who care about excessive fan use. There are more advanced likely does not condone this statement). thoroughly ensuring its robustness.

10 LXF275 May 2021 www.linuxformat.com Neil Bothwick Answers spends most Got a burning question about open source or the kernel? of his time Whatever your level, email it to [email protected] correcting the editor.

Q Confused network card If the adaptor continues to not appear I’ve settled on Mint for a couple of I’ve been using Linux Mint with the later kernel, check the system years and run an older back-up computer Cinnamon flavour for many years. journal with this terminal command on 32-bit. My problem are scanners. I recently decided to update from $ sudo journalctl -b | grep r816 SANE… is it really Scanner Access Now version 18.3 to the latest 20.x version. This will show the kernel detecting the Easy? If only! I’m using Mint 19.3 64 bit I went through the procedure of going Ethernet adaptor and loading, or trying to and I just can’t get it to find either my from 18.x to 19.0, then to 19.3 finally to load, a driver for it. Canon LiDE 300 or the HP DeskJet Plus 20.0 ensuring that I had backups and As for the battery issue, if you open a 4100. I downloaded a trial version of snapshots readily available. terminal and run VueScan and that found both scanners, The update to version 20 failed $ upower --dump so I know that they’re there and working, abysmally, with no network connection you’ll see what the system thinks you have but would prefer to stick with SANE and to make matters worse, substantial in terms of batteries. It’s most likely your and Gscan2PDF. loss of data. I reverted to 19.3 but still mouse battery being seen, but do check. Dave Fisher had problems. The cause was eventually The warning does no harm, and you can traced to the kernel in use as follows: remove the battery applet on a desktop A I think the answer to your first Linux kernel 5.0.0-32-generic amd64 machine. However, do check your power question is that the E in SANE (End of Life) Everything works OK, management settings – you don’t want really should stand for Easier. Scanning is network connects. your computer to suddenly hibernate just better than it used to be, but still throws up Linux kernel 5.3.0-70-generic amd64 because your mouse battery is getting low! problems. I had similar issues with a Canon (End of Life) Everything works OK, For what it’s worth, my home MythTV LiDE scanner a while ago and it turned out network connects but shows battery backend has the same RTL Ethernet chip to be a permissions problem. If you open a symbol, “Using battery power"! and uses the r8169 driver. It has no issues terminal and run Linux kernel 5.4.x-xx-generic amd64 whatsoever. If it did, my wife wouldn’t be $ sane-find-scanner (all versions) Apps work as long as able to watch Holby City and I’d be making this should show your scanner, which is no network/internet required as no myself comfortable in the doghouse. clearly available to the system as VueScan network connection, shows battery can find it. Now run symbol as above. Q Easy? Really? $ scanimage -L I’m now using the 5.3.70 kernel I only have limited computer Does the scanner show up here? If despite the battery symbol. Is this a knowledge, but usually get around most not, repeat the command but prefix it known problem? My network adaptor problems. I’ve read your magazine for with sudo . If the scanner now shows up, looks pretty standard to me. And why the a few years now and a lot of it is beyond the problem is that your scanner is there battery symbol – this is a desktop mains me, but your reviews of various but your user doesn’t have permission to powered PC? Or is the battery referred to software packages and distributions access it. In that case we need to give your the one in the keyboard/mouse, in which are always interesting. user access. It’s common for distros to case there should be two! John Oliver

A This is probably a driver conflict. There are two separate drivers for this network chipset: r8168 and r8169. The r8168 driver is a third-party module that was the standard way of using these Ethernet adaptors, but now the kernel’s built in r8169 driver is the better option. I see from the information you provided that the 5.3.70 kernel, which works, is using Whichever program the r8169 driver. You need to make sure you use for scanning, it’ll use SANE to do this is the case for all kernels. Because the actual scanning, r8168 is a third-party driver, the simplest and that needs option is to uninstall the r8168 package. permission to access You should also make sure than any related the scanner device. rules in /etc/modules.d are removed.

www.techradar.com/pro/linux May 2021 LXF275 11 ANSWERS

create a scanner group, and that scanner’s rules.d, say 30-scanner.rules. The name with different Linux distros. I’ve tried to access is limited to members of that group, is unimportant but it must end in .rules, install the Realtek driver; however, the so run containing this: driver wasn’t recognised by the system. $ groups ATTR{idVendor}=="04a9”, I’m using Fedora 33, kernel 5.10.15-200. to see whether you’re a member of the ATTR{idProduct}=="221c”, fc33.x86_64 with a Gnome version group. If not, you can add yourself to it with GROUP:="scanner”, MODE:="0660” 3.38.3 desktop. $ sudo gpasswd -a youruser scanner using the ID figures from sane-find- Marcello Palopoli You’ll need to log out and back in for this scanner . You could also enable it to take effect. Check by running groups just for your user by substituting A There is no driver for this chipset again. If scanimage shows the scanner USER:="youruser” for the GROUP in the Linux kernel, so it has to be now, all is well. Otherwise we need to setting. The first two items are matches, installed separately. Fedora uses DKMS adjust the permissions of the USB device designated by the == , the rule is only (Dynamic Kernel Module Support) to representing the scanner, which we do with applied if both of these match the device manage out-of-tree modules. Setting this a udev rule. Udev is the system that creates that has just been detected. The other up will require network access – hopefully devices for each bit of hardware connected two are assignments, the mode option you have a wired connection available to to the system; it creates /dev/sda for your gives read/write permissions for anyone you, or can borrow a supported wireless hard disk when the system starts up and in the group. Now scanimage should list adaptor. The first step is to install the /dev/sdb for a memory stick when you the scanner and you can use whichever software needed to uses DKMS. Open a plug it in. A udev rule just tells udev “when software you want to scan with it. You’ll terminal and run you see this device, set it up like this”. We need to create two rules in your file – one $ sudo dnf install dkms kernel-devel need the vendor and product, which sane- for each of your scanners. make find-scanner will show you, something like This installs the DKMS software and found USB scanner (vendor=0x04a9 Wi-Fi woes the kernel header files, which are needed [Canon], product=0x221c [CanoScan], Q I bought a wireless adaptor to compile software for the kernel. Now chip=GL842) at libusb:002:002 with the Realtek 8812AU Wireless download the driver source code with Now use your favourite editor, with LAN 802.11ac chip. According to the $ git clone -b v5.6.4.2 https://github.com/ sudo , to create a file in/etc/udev/ manufacturer this product is compatible aircrack-ng/rtl8812au.git This creates a rtl8812au directory containing the source code. The DKMS A QUICK REFERENCE TO: KERNEL MODULES build process creates a module for the currently running kernel. If you have more In the early days of Linux the kernel modprobe and rmmod commands than one version available, make sure was monolithic. That is, everything load and unload modules, while you’re booted into the latest one, then go was built into it: filesystems, hardware adding module names to a file in back to your terminal and run drivers and so on. As the range of /etc/modules-load.d/ will cause $ cd rtl8812au supported hardware and features them to be loaded at boot time. $ sudo make dkms_install grew, this clearly became impractical, Some modules accept parameters This compiles the module for your so loadable modules were introduced. and you can see a list of these with current kernel and installs it via DKMS. These are effectively individual drivers the modinfo command. These can be Using DKMS means that when you install a split from the main kernel into their set as defaults by adding lines to files new kernel as part of your regular updates, own files. A distro has hundreds of in /etc/modprobe.d. the module will be rebuilt and installed such modules included with its kernel, Some admins prefer to build for your new kernel. Because of that, it’s but only the ones needed are used. a kernel with no modules and important that you don’t delete or move Plug in a Windows-formatted flash everything needed built into the the source code directory after installing drive and the udev daemon will load kernel, because they feel it’s more because you will need it again later. the correct USB modules, then your secure. This may be practical with Just to be on the safe side, make sure all desktop’s automounter will load the a server that contains a fixed set of module dependencies are registered with FAT filesystem module. hardware and probably shouldn’t have the system by running All of this happens in the anything else plugged in, but it’s not $ sudo depmod -a background, but you’re able to control really suitable for a general-purpose Now you should be able to view details it yourself when you need to. The desktop type system. of the module with $ sudo modinfo 88XXau and load it with $ modprobe -v 88XXau There’s also a more pragmatic solution. USB wireless adaptors are quite cheap and it may save future hassle to just buy one Building drivers that’s supported in the kernel. as modules keeps the kernel to a Window on Ubuntu manageable size Q and only loads I installed Ubuntu on an older what’s needed, PC I had, wanting to use it as a server when it’s needed. to try a few things out on (pre-empting your article in LXF272). I had intended to

12 LXF275 May 2021 www.linuxformat.com ANSWERS

and thus not actually turning off. There’s a clue to this in the Hardinfo report you included: you have 32GB of RAM and 32GB of swap. It looks like there may not be enough space to hibernate properly because it uses a swap partition to save the system state by default. Unfortunately, Hardinfo tells us nothing about your disk layout(s). If your swap is split between disks, you’ll certainly have a problem. You need an individual swap partition larger than your total memory. Multiple swap partitions may also cause confusion when resuming and it may help to add resume=/dev/sda5 (or wherever your swap is) to the kernel parameters at boot. For testing, you can press e at the X2Go is a straightforward way to access a Linux desktop from a remote computer of any flavour. GRUB menu and add the option on the fly. If it helps, make it permanent in/etc/ interact with it remotely from a Windows the client in the same way as the server. default/grub. machine (I have to use Windows for work, Once installed, open the client and select You may also find some information in unfortunately) but I can’t seem to get New Session from the Session menu. the system journal after rebooting, whether any remote desktop software to work The key information is set in the Session you’re using suspend or hibernate. If you on it. There were lots of suggestions tab of the New Session window. Set the open a terminal after booting and run online of how to get Windows RDP or hostname or IP address of the server along $ sudo journalctl -b -1 VNC to work, but none of them did. Can with the username you wish to connect you’ll see all the journal entries from the you suggest a way to do this? I’m using as. Most of the other settings can be left at previous session ( -b 0 is the current boot, Ubuntu 20.10, the X11 windowing system, their defaults for now. You sessions appear -b -1 is the one before and so on). The last Gnome 3.38.1, Intel G33 graphics, and a in the list on the right of the main window. entries in the journal should relate to the Pentium E5300 processor. Click a session name to start it. suspension or hibernation of the computer. Erik Foxcroft You can click the desktop type to By examining these, you’ll hopefully be able change it. Not all work with a plain X2Go to see what is going wrong. A VNC and RDP are both valid ways of installation, but I find XFCE works well You can also suspend or hibernate from sharing your desktop with other and it’s lightweight. You can only use a the command line, which might give some computers, although they can be fiddly to desktop that’s installed on the server. useful feedback, with one of: get right. However, if you only want to share Some desktops require additional bindings $ sudo systemctl suspend a Linux desktop, there is another solution: to be installed to access full functionality $ sudo systemctl hibernate X2Go (www.x2go.org). The server is Linux – see the manual on the X2Go web site for Hope this helps. only, but there are clients for Linux, MacOS more details on installing these. and Windows, so it would appear to be GET HELP NOW! suitable for your needs. Eternal suspense There are generally (it depends on your Q When I push my workstation We’d love to try and answer any questions Subscriptions: distro) two packages for X2Go: the server ( 10 buster) in suspend or you send to [email protected], and client. You need to install the server hibernate mode, I can’t get it back to no matter what the level. We’ve all been package on your Ubuntu PC through normal mode, so I have to restart the stuck before, so don’t be shy. However, we’re

the package manager. X2Go uses SSH system. I’ve supplied a report from only human (although many suspect Jonni for magazine issues email for communication between server and Hardinfo (HTML format) – I’m not sure is a layabout), so it’s important that you clients. This makes it secure for use on that this is coming from the hardware include as much information as you can. If public networks, but has the added benefit side, but just in case. something works on one distro but not of not requiring any setting up of users and Yaroslav another, then tell us. If you get an error passwords. Any user that can SSH into message, please tell us the exact message the server can open an X2Go session. If A You don’t say how you’re trying to and precisely what you did to invoke it. you’re going to be connecting regularly, it resume from hibernation or If you have, or suspect, a hardware would be worth setting up SSH keys, then suspension. On a laptop, this is usually problem, let us know about the hardware. [email protected] sessions will work without any need for triggered by opening the lid. A short press Consider installing hardinfo or lshw. These passwords. It also means that although we on the power button is also a common programs list the hardware on your refer to this computer as the server, there’s option. Hibernation works by saving the machine, so send us their output. If you’re no actual X2Go server running, just SSH entire state of the computer, including all of unwilling, or unable, to install these, run the listening for connections and you’ll already its memory, to disk, then powering down following commands in a root terminal and have that set up if you’re administering this the computer. So when you turn back on, send us the system.txt file too. as a remote server. you’ll still see the GRUB (or whichever uname -a > system.txt On the client side there are MacOS and bootloader you’re using) menu. If this lspci >> system.txt Windows installers available from the X2Go doesn’t happen, it’s possible the computer lspci -vv >> system.txt web site. For Linux systems you can install isn’t completing the hibernation process,

www.techradar.com/pro/linux May 2021 LXF275 13 Mailserver Write to us at Linux Format, Future Publishing, Quay House, The Ambury, Bath BA1 1UA or [email protected].

Soggy bottom This month’s magazine arrived promptly as expected, but as the postie was delivering on a very wet day, the paper sleeve and magazine both got rather wet. Some of the pages sick together and are very difficult to read. Luckily there’s the archive online… Today my National Trust magazine arrived in a potato starch wrapper, which is biodegradable in the food waste. It seems to be water resistant, and looks Before one can play with Pygame, one needs to install Pygame. like a plastic bag. Attached is a photo of the opened wrapper, I was wondering if something like this could Because Python is free, open source software be used in the future? similar to Linux, all these ‘clever’ programmers keep David Cooper altering the coding and using abbreviations so that the ordinary computer user ends up sticking with the Neil says… easy, tried and tested, Microsoft Windows. We’ve let the management know, please feedback on Jack Kenrick the packaging as we can get it changed if enough people post their problems. Photographs would help. Neil says… I was told initially back when alternatives to plastic were Programming isn’t really easy and I’m not sure it’s fair being evaluated that the potato starch wasn’t an option to compare coding to using Windows. There’s only so due to production limitations, but the National Trust has much space we have to explain how to code, so we’re do millions of members. Sounds like more Management presume a basic level of Python knowledge. You’re right, FUD to us… you’ll need to add the Pygame library to whatever version of Python and Linux you’re running. The Python Pyconfusion manual can help: https://packaging.python.org/ Having glanced at issue 271 I was please to read tutorials/installing-packages but also Pygame too: about the Python racing game because I have been www.pygame.org/wiki/GettingStarted. trying to learn a little of Python coding, especially for Outside of the very basic, nothing “just runs” any game playing. I was even more pleased when I found more and so you’ll need to be willing to do some that there was a copy of the game, ready to go, on the research to get your code to run. It’s a learning process. cover disc. However, the first item on the code list was to You’re reliable import Pygame. I’ve never come across Pygame I got hold of a high-end laptop a year ago, the reason before and cannot find out how to download it and being the internal NVMe socket had been damaged attach it to Python. and wasn’t really repairable. This made it unsuitable [email protected] Helpdex

14 LXF275 May 2021 www.linuxformat.com MAILSERVER

Modern flash is for Windows use. I’d never considered running a daily spinning rust drives. The big thing super reliable. OS from a USB stick. Previously I’d tried OpenElec, is the reliability, I just wasn’t but not a full blown OS. expecting it to last this well. But I took the plunge, bought a low-profile USB 3.1 Trevor Newman USB drive and grabbed a copy of MX Linux that

seems to be developed around live USB use. Neil says… SanDisk Everything installed fine as expected and over the That’s a great “experiment”. I think first week the only issue were occasionally mini-stalls we’ve all run Linux off USB at some in use. I bought a second USB drive and split off my point, but not for months on end, though I CREDIT: /home to this and that seemed to resolve the issue. think Jonni was running a NAS at one point. It’s a Expecting the whole thing to fall over or at least testament to how reliable flash has become and my have to be reinstalled every few months, here I am a understanding is the flash will switch to read-only mode year on and everything is still running smoothly. It once it begins to fail. I’ve had this on a couple of sticks certainly seems faster and more responsive than in my time.

LETTER OF THE MONTH

Linux for Microsoft And the other problem is many open experienced people need to point out I enjoyed your editorial on the “Year of source projects consist of associated this one-way-street approach. Linux?”. But as a 45-year-old veteran of open source projects and due to the Oliver H. Bailey the operating systems and hardware nature of open source, these projects area of computers, the same reasons don’t all move at the same speed, Neil says… for the success of Linux in the areas so short term incompatibilities can You make lots of excellent points I can’t you highlight, are the same reasons and do exist. But sometimes larger argue with, but I will point out that people why desktop users have resisted Linux. projects are delayed by more serious use Windows because it’s preinstalled on It’s simply too difficult for the average developments and can stall or even the systems they buy. For 95 per cent desktop user, while the delivery of open stop updating. (randomly guessing) of people there’s no source software differs too widely from While there are multi-platform C++ reason for them to try Linux, think about a subscription model. libraries, none have addressed the Linux, nevermind go to all the problems A much more serious problem are Microsoft Foundation Classes directly. of installing and learning how to use the remaining applications that don’t This may be due to concerns over IP Linux. That’s before we start worrying run on Linux. These high-priced infringement, but being able to port about people not having the software applications have been around for older Windows-only C++ classes to they’re used to, although in the age of years with no open source Linux and beyond would bring cloud applications that’s actually not as replacements. developers over to Linux and eventually big an issue as simple apathy. Most developers who can’t get their end users as well. products to work under Wine have Microsoft isn’t embracing made extensive use of Microsoft Linux for Windows users. Foundation Classes (MFC), dating It’s embracing Linux for back to version 6 of the Microsoft C++. Windows. Microsoft wants Most of those libraries do port to .NET to make the Linux but the major applications that remain experience compatible with to be ported take a noticeable Windows, not vice-versa. performance hit and aren’t as easily Before Microsoft gets Microsoft does love Linux, protected at the source code level further applause from the but in a “Tux is locked in its basement” sort of way. as a native language library. Linux community, some

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 2021 LXF275 15 *

BIG SAVINGS ON OUR BEST-SELLING MAGAZINES

SAVE SAVE SAVE 83% 79% 80%

SAVE SAVE SAVE 83% 66% 79%

See the entire range online at www.magazinesdirect.com/spring21 or phone 0330 333 1113 and quote code SP02

ɀƏɮǣȇǕƏǕƏǣȇɀɎɎǝƺ««¨ȵȸǣƬƺِۏǔǔƺȸȒȵƺȇɎȒȇƺɯɀɖƫɀƬȸǣƫƺȸɀȒȇǼɵِǔɎƺȸɵȒɖȸɎȸǣƏǼƺȇƳɀًɵȒɖȸɀɖƫɀƬȸǣȵɎǣȒȇȵȸǣƬƺɯǣǼǼƫƺƏƳǴɖɀɎƺƳɎȒȸƺˢƺƬɎƏ׏׎ ׏ِא׎אِג׎ِ׎בǔǔƺȸƬǼȒɀƺɀ Terms and conditions:* áِǔɎƺȸɎǝƺɀƺǣɀɀɖƺɀًɀɎƏȇƳƏȸƳɀɖƫɀƬȸǣȵɎǣȒȇȵȸǣƬǣȇǕɯǣǼǼƏȵȵǼɵِÁǝƺɀƏɮǣȇǕɀƏȸƺƫƏɀƺƳȒȇɎǝƺÈk ǔȒȸ«דگٖדڟǣɀɀɖƺɀǔȒȸדǔȒȸ0ɖȸȒȵƺƏȇƳדڡǣɀɀɖƺɀǔȒȸדٮÁǝǣɀȒǔǔƺȸǣɀƏǼɀȒȒȵƺȇɎȒȒɮƺȸɀƺƏɀȸƺƏƳƺȸɀ ƳƏɵƬƏȇƬƺǼǼƏɎǣȒȇȵƺȸǣȒƳɖȇǼƺɀɀƺɴƬƺȵɎǣȒȇƏǼגȸƺǔɖȇƳƏƫǼƺƏǔɎƺȸɎǝƺ׏ٮƏɵȅƺȇɎǣɀȇȒȇ¨ɀǝȒȵȵȸǣƬƺِ¨ǼƺƏɀƺƏǼǼȒɯɖȵɎȒɀǣɴɯƺƺǸɀǔȒȸƳƺǼǣɮƺȸɵȒǔɵȒɖȸˡȸɀɎɀɖƫɀƬȸǣȵɎǣȒȇǣɀɀɖƺ٢ɖȵɎȒƺǣǕǝɎɯƺƺǸɀȒɮƺȸɀƺƏɀ٣ِ ȵȅÈkÁǣȅƺדٮƏȅחIȸǣƳƏɵٮnǣȇƺɀƏȸƺȒȵƺȇxȒȇƳƏɵِב׏׏׏בבב׎בב٢׎٣גגڷيƬǣȸƬɖȅɀɎƏȇƬƺɀƏȵȵǼɵِIȒȸǔɖǼǼɎƺȸȅɀƏȇƳƬȒȇƳǣɎǣȒȇɀًɮǣɀǣɎɯɯɯِȅƏǕƏɿǣȇƺɀƳǣȸƺƬɎِƬȒȅٖɎƺȸȅɀِIȒȸƺȇȷɖǣȸǣƺɀȵǼƺƏɀƺƬƏǼǼ ɀƬƏǼǼƫɖȇƳǼƺِټ׎ȇɖȅƫƺȸɀɯǣǼǼƫƺƬǝƏȸǕƺƳƏɎȇȒȅȒȸƺɎǝƏȇƏȇƏɎǣȒȇƏǼǼƏȇƳǼǣȇƺƬƏǼǼًƏȇƳȅƏɵƫƺǣȇƬǼɖƳƺƳǣȇɵȒɖȸȵǝȒȇƺȵȸȒɮǣƳƺȸבבǝƺǼȵ۬ȅƏǕƏɿǣȇƺɀƳǣȸƺƬɎِƬȒȅِ!ƏǼǼɀɎȒ׎يȅƏǣǼٮȒȸƺ REVIEWS AMD Ryzen 9 5950X

Zak Storey climbs onto the closest thing the computing industry has to a unicorn, and straps in for the ride of his life.

kay, let’s start with what SPECS might be a bit obvious. Socket: AM4 O At the time of writing, Architecture: you cannot buy this processor Zen 3, 64-bit anywhere. Not in the US, or Canada, Cores: 16 or the UK, or Europe, or Australia— Threads: 32 at least not at its retail price. Process: Stocks generally have dwindled 7nm TSMC across the entire tech sector over Clock: 3.4GHz these past few months, and sadly (4.9GHz turbo) it’s the case with the 5950X. A Cache: combination of things have led to L1 1MB, L2 8MB, this moment: the pandemic has L3 64MB kept people at home playing with Memory: their hardware; while fabs that 128MB max, produce the silicon are stretched to two-channels, breaking making chips for next-gen DDR4 consoles, smart this that and the For now, AMD’s Ryzen 9 3200MHz, other, crypto GPUs, normal GPUs, 5950X remains as elusive as non-ECC deep-learning GPUs and more. the Scarlet Pimpernel. PCIe: v4.0, We’ve had the luxury of using this 20 lanes thing now for three weeks as our daily driver, and the improving on the memory latency and single-core (x16+x4 or sheer performance it has is just insane. Take Cinebench performance, but it still wasn’t super-slick. Then the 2x8+x4) R15 as a prime example. Retesting this processor after a third generation came along in 2019, and with it we saw Thermal design BIOS update led us to achieve an impressive 4,312 PCIe 4.0 for the first time, and even better single-core power: 105W points in multi core, and a staggering 269 points in performance, but the chips were hot, power-hungry iGPU: N/A single core. That’s just crazy. The Core i9-10900K, even under the best liquid-cooled solutions, and Intel Cooler: N/A long regarded as the king of single-core IPC, achieved was still slightly better for IPC. just 228 points in single thread, and 2,608 when it Now though? This is the pinnacle of what we’ve seen came to multi-core operations. Admittedly that’s a so far. The Ryzen 9 5950X is perfectly balanced. Its 10-core, 20-thread processor, versus the 5950X’s performance is staggering. Memory issues are a thing clearly supercharged 16 cores, but you can’t ignore of the past, temperatures remain under 70°C even these kind of results. under intense load, and for the first time really since its inception, it’s finally unseated Intel as the gaming chip A brutish tyrant of choice. Its only flaw: you can’t buy it. Couple that pure brute strength performance with a redesigned cache layout and better memory operations and latency, and what you’re left with is a Ryzen VERDICT processor that is a true tyrant of a chip. In fact, that DEVELOPER: AMD might be an understatement. No matter what you throw WEB: www.amd.com/ryzen at this thing, it’s going to come out on top. The only PRICE: £750 areas where it’s really held back are in programs where more memory bandwidth (quad channel and beyond) is FEATURES 9/10 EASE OF USE 9/10 king, and in that field the only competition it has is its PERFORMANCE 9/10 VALUE 9/10 own siblings: the third-gen £1000+ Threadrippers. When Ryzen first debuted in 2017, it was amazing to Incredible performance, decent temperatures, good gaming see. However, it was flawed: there were memory figures and plenty of overclocking headroom. problems, BIOS issues, and it had a “slow” single core. The big selling points were the multi-core performance, Rating 9/10 and the price. The second generation appeared in 2018,

www.techradar.com/pro/linux May 2021 LXF275 17 REVIEWS Solid-state drive WD Black SN850 1TB Move over Samsung, there’s a new PCIe 4.0 storage king in town says Alan Dexter, as he reaches for the ermine-lined cloak.

he WD Black SN850 1TB CREDIT: Western Digital SPECS drive is the fastest PCIe 4.0 Model: SN850 T NVMe solid-state drive Capacity: 1TB you can buy right now. It may Interface: not top every test in every PCIe Gen4 x4 benchmark, but when it comes Controller: to real-world benchmarking, WD_Black G2 there’s nothing else that can NAND: BiCS4 touch it. Don’t get us wrong: it 96-layer TLC does well across the synthetic Seq. read: benchmarks, topping plenty of 7,000MB/s them, but there are a few places Seq. write: where the Sabrent Rocket 4 Plus 5,300MB/s (See LXF274) or the Samsung 980 Endurance: Pro have the edge. Yet overall that 600TBW doesn’t take away from the fact that Warranty: this is the pinnacle of storage now. The naked SSD – heatspreaders are recommended to keep this thing cool. Five years Western Digital was a bit late to the PCIe SSD party, but quickly made up for it with the WD SN750, which has long been It’s the real-world performance tests that impress a strong choice for anyone looking to build their own the most though. Our gaming test has the SN850 mid-range performance PC. If you’re still rocking a loading the five different scenes in a shade under seven PCIe 3.0 platform, then it’s still a great option. The seconds for the first time. When plenty of ‘fast’ SSDs point here is that WD hasn’t come out of nowhere to still take 12 seconds to complete the same task, the grab the performance crown, and that its focus on results prove what a difference the latest technology performance has paid off. can have on gaming performance. It helps that Western Digital is in a great position for The closest solid state drives to this in terms of building quality SSDs, because it produces everything it performance are the Sabrent Rocket 4 Plus and the needs in house, from the proprietary memory controller Samsung 980 Pro. The Sabrent is £30 cheaper than to the NAND flash and the RAM. This means the Western Digital’s, at £155, which gives it a slight edge in company can push everything that little bit harder than terms of value for money. a manufacturer using off-the-shelf components, and it The Samsung 980 Pro, which had the edge for a certainly shows with the SN850. few months, is left out in the cold, especially because it costs the same as the SN850, but loses out to the Feeling the heat newer drive in every metric (apart from operating Pushing the components hard, however, obviously temperatures). Neither is a bad drive, obviously, but manifests in one other key area: temperature. The 1TB if we had to recommend a next-generation solid-state version of the drive is single-sided, which should mean it drive right now then there’s only one clear option, and runs a little cooler than the 2TB double-sided offering. that’s the WD SN850. It’s simply the best drive you Which might be a little alarming, because this isn’t a can buy today. cool-running drive, coming in 10°C hotter than the other PCIe 4.0 drives that we’ve been testing lately. It hit 77°C in the test rig, and that’s using the motherboard’s VERDICT included heatsink – if you don’t have one you’ll want to DEVELOPER: Western Digital get one, pronto. WEB: www.westerndigital.com/products Any solid-state drive is ultimately defined by its PRICE: £184 performance, and as stated in the introduction, it’s here that the WD SN850 really stands out from the crowd. FEATURES 9/10 EASE OF USE 9/10 The synthetic benchmarks show that this is very much PERFORMANCE 9/10 VALUE 9/10 a second-generation PCIe 4.0 drive, with peak sequential read speeds knocking on 6,750MB/s and Incredible sequential and random throughput makes for a 5,920MB/s, respectively. Writes are lower than the drive that’s way ahead of the pack. Highly recommended. Sabrent Rocket 4 Plus, but still healthy, at either side of 5GB/s. The 4K write performance manages to outpace Rating 9/10 the Sabrent drive.

18 LXF275 May 2021 www.linuxformat.com REVIEWS SparkyLinux 2021.03 Its rather unimpressive-looking screenshots intrigued Mayank Sharma, who wants to find how this distro has survived for as long as it has.

parkyLinux is one of a IN BRIEF handful of decent distros A Debian-based S that’s managed to survive family of distros for over a decade now by building a that produces loyal and sizable community of releases based users around it. The project’s on Debian’s handful of developers produce stable and distros based on Debian’s Stable testing Debian and Testing branches. The releases branches. The based on Debian Stable have 32-bit project puts out ISOs as well, which makes them several ISO, ideal for older hardware. each with a This is the latest release of the different distro based on Debian Unstable. desktop These are rolling releases that can environment to be updated perpetually, but the One of the less obvious highlights of the distro is its efforts to support multiple languages, right cater to all kinds project still puts out ISOs with a from the boot loader all the way into the desktop. of machines. refreshed set of packages to make it SparkyLinux is easier for new users to get into SparkyLinux. package repositories, remove non-free packages, notable for its One of the main attractions of the project is that it’s upgrade the whole system and a lot more all with one custom tools. available in several versions, each based on a separate click. Then there’s SparkyBackup, which is a fork of the desktop environment. Traditionally, these have been now-discontinued Remastersys script that you can use lightweight ones: LXQt, Mate and Xfce. As if they didn’t to roll your installation into a custom Live environment. have enough on their hands already, starting with this Like all good projects, SparkyLinux backs up a solid SPECS release, the project will also produce an edition based offering with enough documentation to help news users Minimum on KDE Plasma. and to orient those who are coming from a different CPU: Pentium 4 Besides their desktop environment, the different distro. The forum boards are lively and feel welcoming and above editions are all fairly similar, in that they ship with all the to users irrespective of their experience level. Memory: 1GB productivity tools you’d expect on a standard desktop All things considered, SparklyLinux is one of Hard disk distro. Installation is handled by the distro-agnostic those rare distros that doesn’t leave enough room space: 10GB Calamares installer, which is now polished enough to for nitpicking. Sure, its default desktop lacks any kind of Build: Supports handle most common installation scenarios. eye candy and doesn’t look very appealing to pull in new both 32- and users, and it can probably do a better job of presenting 64-bit machines Customised programs its custom utilities, perhaps bundling them all inside a The other thing that helps SparkyLinux differentiate custom control centre or at least a special menu. But itself from its peers are its gamut of custom tools these are minor quibbles for a project that’s been that you’ll find in all its editions. The first one you’ll chugging along for a decade, produces a lot more encounter post-installation is Sparky Welcome, which editions than it has developers, and still manages to find unlike other first-run tools on other Linux distros like time to add yet another edition and also create special KaOS’ Croeso, offers fairly limited options. In fact, you ones to cater to its community. can only currently use it to update your system and install any additional language packs. That’s about it. Very thoughtfully though, once you’re done with it, the VERDICT welcome tool will automatically uninstall itself. DEVELOPER: SparkyLinux Team The next custom tool, however, is one of the best WEB: https://sparkylinux.org reasons for using the distro. SparkyAPTus is the distro’s LICENCE: Several package manager that, over the years, has evolved from a simple front-end to apt and dpkg to become a full- FEATURES 8/10 EASE OF USE 8/10 fledged application center. You can use it for everything PERFORMANCE 8/10 DOCUMENTATION 8/10 from installing individual programs, to any of over a dozen desktops with a single-click. A perfectly functional desktop distro that works on new and The app center has a nice curated list of all sorts older hardware alike, and appeals to all kinds of users. of programs, including games and gaming platforms as well as several popular proprietary ones such as Rating 8/10 Chrome, Skype and more. You can also use it to edit the

www.techradar.com/pro/linux May 2021 LXF275 19 REVIEWS Linux distribution SystemRescue 8.0 If you’re as adventurous with your installations as Mayank Sharma, then you too would want to keep a copy of this distro handy…

ne of the most popular IN BRIEF rescue distros, the project One of O has undergone several the oldest major changes of late. The earlier distributions Gentoo-based edition of the distro that’s designed had a compressive boot menu, to equip system which was dropped when the distro admins with a rebased to Arch. It’s since added variety of tools several options to the boot menu and utilities to that help address a range of use help repair and cases and rescue scenarios. rescue their There are the usual options that Linux and you also get on other distros, such Windows as the option to copy the entire installations. system to RAM, another to boot and The distro will verify the checksum, and one to use work on any nomodeset to help resolve display 64-bit machine issues. The first interesting option is Besides the official documentation, SystemRescue also has a comprehensive hands-on guide and while it’s the nofirewall parameter that that’s available for the Kindle for about £4. meant to be disables the iptables service. This used as a Live enables you to connect to SystemRescue-powered and utilities and supports all the common and CD, it can also computer remotely from over the network with SSH. important file systems. You can, for instance, use it to be anchored to If you want to manage SystemRescue remotely you rectify all sorts of issues with hard disks, including the hard disk for should also set a password for the root user with the sorting the MBR and restoring the partition table. It’ll easier access. rootpass or rootcryptpass options, with the latter also save the contents of the filesystem on disks on enabling you to specify an encrypted password. their deathbed to a compressed archive, and can even Another unique aspect of the distro that was recently securely delete files and recover accidentally deleted reintroduced is the use of SRMs or SystemRescue ones. The distro also packs tools to work its magic on Modules. These are squashfs file system images that Windows partitions for everything from resetting can be used to add custom data files such as scripts passwords to rescuing data from an unbootable and even additional tools. Experienced admins can use Windows machine. SRMs to customise their SystemRescue environment as All things considered, SystemRescue is designed per their needs. for experienced campaigners who know what they are doing and are familiar with the tools and know how to Tools galore operate them when there’s an emergency. The default boot option will boot SystemRescue to a In terms of documentation, the distro’s website hosts console, which lists the command to configure the a quick start guide as well as detailed instructions on keyboard layout and start the graphical environment. basic and advanced use. There’s also instructions for And that’s perhaps the only downside of the distro, in advanced users, such as the guide to create custom that it doesn’t offer much in terms of a tailored interface SRMs with Arch’s pacman packages. to help you rescue your installation. The distro uses the Xfce desktop and houses a handful of essential productivity tools in its menus such VERDICT as Firefox, but that’s about it. Unlike some of its peers DEVELOPER: François Dupoux SystemRescue doesn’t try to hand-hold the users WEB: http://system-rescue.org through any of the rescue processes. For instance, LICENCE: GPLv2 Rescuezilla (LXF273) presents an intuitive custom interface to help users set up their disk imaging tasks. FEATURES 8/10 EASE OF USE 5/10 Similarly, Ultimate Boot CD has an elaborate boot menu PERFORMANCE 8/10 DOCUMENTATION 6/10 to help users narrow down the tool they need to use for the rescue task at hand. A well-rounded recovery solution that will help resolve most You get none of these conveniences with common issues as long as you know how to operate its tools. SystemRescue. Instead there’s a whole lot of tools that can help you wriggle your installations out of all kinds of Rating 7/10 issues. The distro packs several repair and rescue tools

20 LXF275 May 2021 www.linuxformat.com Linux distribution REVIEWS CentOS Stream 8 Mayank Sharma takes a look at the distro that has the open source community up in arms, to see what the hullabaloo is all about.

ate last year, the Red Hat- IN BRIEF sponsored CentOS project CentOS Stream L announced that it was began life as a refocusing its efforts behind the sibling to the newly introduced CentOS Stream main CentOS distro. In essence it killed the edition in 2019 beloved and highly stable server as a means of distro with what is essentially a influencing the rolling release. development of In the Red Hat universe, Fedora RHEL. But in a existed as the upstream of Red Hat hotly debated Enterprise Linux (RHEL), which then decision the served as the upstream for CentOS. distro has This made it one of the most overthrown its popular community-supported mature sibling server distros as it promised the At the moment the CentOS Project has just repositioned the repositories with respect to RHEL, to establish stability and innovations of RHEL and the distribution still identifies itself as CentOS. itself as the without the cost. defacto CentOS The equation has changed now as CentOS Stream Stream distro, developers from several high-profile tech release going tracks just ahead of RHEL. In essence the CentOS companies, including Facebook, Twitter, and Verizon forward. Stream project now feeds into RHEL point releases. This have created a Hyperscale SIG to enable CentOS also means there’s no longer a community distro that Stream for deployment on large-scale infrastructures. SPECS receives changes introduced by RHEL. CentOS Stream has all the hallmarks of a good From Red Hat’s perspective, once its developers took server distro. We haven’t heard of it causing any Minimum a Fedora release and started polishing it into the final breakdowns in production deployments that have CPU: 1.5GHz product, it kind of became a black box that none of its switched to it. From our experience, it’s just as good a Memory: 2GB customers could contribute to, since none of its workstation distro as the CentOS of yore. Hard disk drive: repositories were public. With CentOS Stream, the However, at this point of time, there’s more to 10GB customers now have a way to influence the RHEL CentOS Stream than just its technical capabilities. Trust Build: 64-bit release. Technically speaking, you can migrate your in Red Hat is at an all-time low, and there are at least x86, ARM64 and existing CentOS installation to CentOS Stream with just two new high-profile CentOS-replacement distros, IBM Power a couple of commands. namely CloudLinux and AlmaLinux, prepping their drop- in replacements for CentOS. Oracle Linux has also Stream roller pitched itself as a viable alternative, and Ubuntu Server Both CentOS Stream 8 and CentOS 8 offer pretty much is making the right kind of noises to welcome anyone identical installations. Besides the x86-64 architecture, willing to ditch the CentOS universe altogether. both also support ARM64 and IBM Power. CentOS It’s been an incredible few months for CentOS Stream caters to much the same use cases as CentOS, Stream, but while it looks good on paper, the with the addition of giving developers and RHEL distribution hasn’t had enough time to prove its customers an opportunity to influence the RHEL production readiness. release. It also bundles virtually the same software. What’s different, however, is that CentOS Stream 8 will be supported for five years and reaches end of life in VERDICT 2024. In contrast, CentOS 8 was originally supported DEVELOPER: The CentOS Project through to 2029, but will now reach a premature end of WEB: www.centos.org life at the end of 2021. This has given its community LICENCE: Various free licences another reason to moan (and rightly so). Despite all the distractions, CentOS Stream has FEATURES 8/10 EASE OF USE 8/10 already started building an ecosystem around it. PERFORMANCE 8/10 DOCUMENTATION 8/10 Besides the main distro, one of the highlights of CentOS project are the various Special Interest Groups (SIG), This distro’s pedigree is strong, but it’ll need to clock some which have focused on and addressed a specific issue time on production PCs before its potential can be gauged. or use case, and was driven by its community of users. While the CentOS users are still wondering whether Rating 8/10 they should switch their servers to the rolling CentOS

www.techradar.com/pro/linux May 2021 LXF275 21 REVIEWS Life-sim game Spiritfarer In these turbulent times management has shown uncharacteristic compassion and allowed Rachel Watts to contemplate life.

piritfarer’s lead writer and SPECS creative director Nicholas Minimum S Guérin was at Ubisoft before OS: Ubuntu he joined Thunder Lotus Games. 14.04 (64-bit) During his nine years there, he CPU: Dual-core worked on the Assassin’s Creed 64-bit series as a level designer, creating Memory: 4GB scenarios that would enable players HDD: 7GB to efficiently and brutally stab people GPU: OpenGL in the neck in acts of vengeful fun. 3.x capable Guérin joined Thunder Lotus to card. develop a game where “everything centred around care” – that Upgrade your boat approached the topic of death to take on more with compassion and openness. animal passengers. Spiritfarer, a life sim about dying, does exactly that. ready to harvest, and then take the beans to the kitchen You play as Stella, an upbeat ferry master who’s to make the coffee. Gwen is a pretty serious character, but responsible for finding and helping wandering spirits a cup of java always cheers her up. She’s happy, you’re pass on into the afterlife. After inviting the spirits to stay happy, and you think maybe this game won’t make you on your boat, you take care of them and make sure they cry after all? You’d be very much mistaken. live comfortably on your vessel. Then, when they decide they’re ready to move on, you take them to a huge, An exercise in multitasking ominous portal called the Everdoor, and see their journey Running around your boat to different stations, especially through to the end. Sometimes the goodbyes are easy when you upgrade your boat a couple of sizes, is always a but, more often than not, they’re bittersweet farewells to frenzied platforming spree of spinning, jumping, and characters you’ve grown to love. gliding. Each station has a mini-game to keep things fun, This gentle cycle is made all the more difficult because like timing your weaving to make sure the needle lands on you take care of each spirit when they board your boat. the target, or keeping the temperature in between two You’re tasked with crafting a personal space for each dials when you’re smelting metals. For a relatively character, preparing their preferred foods, and keeping peaceful game, there’s always a flurry of activity. them happy with plenty of hugs. Very much in keeping These daily chores are the foundation of life sims, with the life sim formula, you’ll need to complete little where the repetition of scavenging, harvesting and tasks at all the boat’s different stations: cooking, crafting, crafting becomes a comfortable cycle. Normally these farming, weaving, smelting and so on. tasks have a certain amount of self-service, like For example, you know that the majestic deer Gwen decorating your room, dressing up your character, or There’s more than loves black coffee and, to give her a pick-me-up, you plan making a big ol’ wad of cash. But Spiritfarer is different. a touch of Studio Ghibli about the on making her one damn fine cup of joe. First you need to Your actions are purely out of compassion and game’s visuals. plant the coffee bean seeds, water them until they’re selflessness. This might sound like a drag because it seems like you’re not getting anything back, but the exchange is focused on your relationship with the characters instead of the monetary gain. It’s a refreshing take on the genre, and one that fits the themes of the game without the expense of frustrating the player. It’s because of these daily tasks that you get to know the characters closely in such a short amount of time. You get to understand their likes and dislikes, their favourite foods, how they spend their free time, and the families they left behind. As thanks for looking after them, the spirits teach you skills that help out with your daily tasks. Through this exchange, you develop a closeness to each individual and they begin to open up about their past life. Give the chirpy frog Atul some popcorn and he becomes ecstatic because he loves all food. But then he talks about how he misses movie nights with his family.

22 LXF275 May 2021 www.linuxformat.com Life-sim game REVIEWS

You can purchase supplies, or make them yourself.

The backstories of these characters are not the usual fluff you might see in community sims like Animal intentions. It’s unclear if the characters and NPCs were Feed Atul the frog Crossing or Stardew Valley. They hit harder because these trapped in this realm, how long they had been here for, and you might hear characters are, well, dead. They reminisce on their old or if they really wanted to leave. more stories about his family. lives, the families they left behind, good times, bad times, and of course, their own deaths. In this way, they’re more What’s behind the door? than just boat passengers – they’re friends, teachers, The one feature where this purposeful vagueness did guides, and confidants. When it’s time to say goodbye, it’s work well is the Everdoor. In Spiritfarer, no one truly knows a little more than just a handshake and a “good luck!” what’s on the other side as you enter the elusive doorway. Each character has their own unique reasons for It could be something beautiful, or scary, or absolutely deciding to eventually leave the boat. Some of them have nothing. Deciding to go through it is an uneasy choice, finally been able to let go of their past, have accepted but one that Spiritfarer’s characters still ultimately want what’s happened to them, have forgiven a person from to make. Thunder Lotus always wanted Spiritfarer to be a their old life. Some of them don’t have a reason at all. death-positive game, and this is where that point shines When each character left, you’ll find yourself thinking of the strongest. Stella’s role in Spiritfarer is vital because them often. Whenever making a cup of coffee in the boat’s it gives these characters the time and space to reflect. kitchen, Gwen will spring to mind. As you play the sitar to Many of them come to terms with life-long traumas on help crops grow, Summer would pop into your mind. the ship as they think back on their past lives and how Every time out collecting berries you’ll remember Atul’s they lived. They accept that it’s time to move on to what’s excited animation. next, whatever that may be. At the end of Spiritfarer, the first names in the credits Life in limbo are the relatives of Thunder Lotus’ team members who Travelling around the seas in Spiritfarer you can see have passed away, many of whom were inspirations for Thunder Lotus’ previous games, Jotun and Sundered, in characters in the game. It’s a small but powerful choice its world-building. Life on your boat might be a slice of that sums up the game completely: that those who have peaceful bliss, but there are plenty of colossal creatures died are not forgotten and that they still live on in those beneath the surface – thankfully no dangerous ones. they knew. Ancient dragons roam Spiritfarer’s waters and the Spiritfarer understands that death isn’t only when colossal sea turtles are always up for a chat if you fancy someone isn’t around anymore, but encapsulates the stopping for one. feelings and memories you have for a person when they There’s a feeling that this realm is home to many are gone. Some aspects of the world are a little abstract, forgotten spirits and gods, but Thunder Lotus leaves but the concept and emotions that the studio wanted to things deliberately vague. Guérin has previously get across are crystal clear. Thunder Lotus has managed mentioned that the team didn’t want to place any to create a cosy boat sim that deals with the topics of ideas about the afterlife on players, which is why things death and compassion with masterful balance. That’s are kept ambiguous. The sentiment is understandable, quite an achievement. but it sometimes muddies the clarity of the characters’

This is the closest that VERDICT Spiritfarer gets to DEVELOPER: Thuder Lotus Games Guitar Hero. WEB: https://thunderlotusgames.com/spiritfarer PRICE: £24

GAMEPLAY 9/10 LONGEVITY 8/10 GRAPHICS 9/10 VALUE 8/10

A thought-provoking and bittersweet adventure that understands that death is part of living. Rating 9/10

www.techradar.com/pro/linux May 2021 LXF275 23 SUBSCRIBE Save money today! SUBSCRIBE Sign up today and get your STM Portable wireless charger YOUR GIFT! Product features WORTH £50 Charge your devices wirelessly or via cables (USB-A or USB-C) Don’t miss out, subscribe now! Built-in kickstand enables you to keep your device in landscape or portrait orientation while it’s charging Suction cups secure PowerKick to your phone for consistent charging 10,000 mAh lithium polymer battery Fast charging capability

SUBSCRIBE NOW! www.magazinesdirect.com/lin/stm21 Call: 0330 333 1113 and quote 97AK

24 LXF275 May 2021 www.linuxformat.com Save money today! SUBSCRIBE 1) PLUS: Exclusive access1 to Only the Linux Format subs area! available to 1,000s of DRM-free www.magazinesdirect.com PDF back issues and articles! Get instant access back to issue 66 (May 2005) with subscribers tutorials, interviews, features and reviews. DON’T MISS! At linuxformat.com Now with 5 years of Linux User & Developer NOT FROM issues THE UK? Turn to page for more great65 subscriber deals! ANNUAL PRINT EDITION ANNUAL PRINT + DIGITAL EDITION DIGITAL EDITION

PLUS! PLUS!

SAVE! SAVE! SAVE! 44% Only 22% Only 60% (no gift) Only £65.00 £70.00 £50.00 13 issues of Linux Format in print 13 issues of Linux Format over 12 months 13 issues of Linux Format in over 12 months by Direct Debit in print and digital by Direct Debit digital by Direct Debit

Terms and conditions: Offer closes 30th June 2021. Offer open to new UK subscribers only. Pricing is guaranteed for the first 12 months and we will notify you in advance of any price changes. Please allow up to six weeks for delivery of your first subscription issue (up to eight weeks overseas). Your gift will be delivered separately within 60 days after your first payment has cleared. Gifts only available to subscribers on the UK mainland. Gift not available with a digital subscription. The full subscription rate is for 12 months (13 issues) and includes postage and packaging. If the magazine ordered changes frequency per annum, we will honour the number of issues paid for, not the term of the subscription. For full terms and conditions, visit www.magazinesdirect.com/terms. For enquiries please call: +44 (0) 330 333 1113. Lines are open Monday- Friday 9am- 5pm UK Time or e-mail: [email protected]. Calls to 0330 numbers will be charged at no more than a national landline call, and may be included in your phone provider’s call bundle.

www.techradar.com/pro/linux May 2021 LXF275 25 WE COMPARE TONS OF STUFF SO YOU DON’T HAVE TO!

Michael Reed first installed Roundup Slackware back LMMS 1.2.2 Ardour 6.5 Qtractor 0.9.19 in 1996, but he Waveform Pro 11.5 MusE 4.0 started being a slacker long before that. Audio workstations The Linux desktop has always had its share of music software. Michael Reed looks at the cream of the current Digital Audio Workstations crop.

HOW WE TESTED…

By and large, we’ve grabbed the latest, stable version of each Digital Audio Workstation (DAW). However, with music software on Linux, it’s quite often the case that the version in the official distribution repository is badly out of date. In these cases, it’s often worth checking out the latest beta, and that’s what we’ve done in the case of MusE and Ardour. We’ve installed each application and put it through its paces by using it for musical recording and composition tasks such as loading up multitrack projects and playing around with plug-ins. Having a bit of experience with the software in question is ot much music gets made these reverberation. With a reasonably modern important because evaluating days without heavy use of computer and some of the Digital Audio the feature list doesn’t give you N computers, and the majority of new Workstation (DAW) software that we’ll be an insight into what it’s like to music that you hear on the radio was made looking at here, you can create almost try to create something with it, 100 per cent ‘in the box’. That is, the sounds unlimited numbers of tracks with dozens and music software is creative that you hear were either recorded into a of effects plug-ins. software. That said, sometimes computer and processed with software, or in It’s the lament of many technologically you just have to live with a the case of synthesiser sounds, entirely spoiled electronic musicians that there’s just slightly bumpy workflow when created inside a computer. too much amazing software out there with trying to accomplish Fortunately, Linux sports some highly too many options to ever fully explore. Your something that needs professional software in this area. When biggest ‘cost’ with computer music creation advanced features. recording at Abbey Road, The Beatles on Linux is likely to be the time-cost of graduated from two- to four- and then learning to use everything you have. eventually eight-track recording, and they We’re going to compare five top-notch used a special, echoey room with a pieces of software, but each of them has microphone and a speaker to simulate its own strengths and weaknesses...

26 LXF275 May 2021 www.linuxformat.com Audio workstations ROUNDUP

Plugin support There are many plugin standards in the computer audio world.

DSPA plugins (sans GUI, Linux-native effects plugins) are plentiful and highly useful. Thankfully, all of the software A we’re looking at here supports them. This means that, if nothing else, you should have access to every basic effect type (reverb, chorus, compression and so on). LMMS comes with a suite of these effects as standard. LMMS has its own plugin system for instruments, as well as various methods of LV2 is a Linux standard for both instruments and effects, with loading more standard plugins. a GUI, and only Waveform Pro and LMMS don’t support it natively. However, for these DAWs there’s a workaround in the form of instrument plugins that only work inside the DAW. These are Carla (https://kx.studio/Applications:Carla), a GUI plugin host great, although they tend to have a ‘chip tune’ sound to them that is itself available as a plugin, although it’s an extra step in and a rather small GUI. There’s also a built-in bridge for running terms of convenience. Windows VST2 pluginins, but the above caveats apply to that, too. VST2 is a standard for instrument and effects plugins. It’s Qtractor doesn’t seem to make many concessions at all to common on Windows, but there’s a Linux native version and it plugin sandboxing. So you might have to add plugins one at a may be the single most important standard, Linux patriotism time and find the set that are stable inside the DAW. aside. All of the DAWs we’re looking at support it. The Windows Along with VST2 and LADSPA format, Waveform Pro has its version of this format is the most common format for commercial own internal format and uses this to deliver a massive coup of plugins and there are good freeware ones, too. There’s some a built-in general sampler and drum sampler (samplers are scope for using a compatibility bridge to run Windows versions of underrepresented amongst Linux plugins) and some very good VST2 plugins. However, as with everything that makes use of native synths. WINE the results are never reliable, but it might be worth a try if you’re desperate. VERDICT Ardour supports all the common formats and has a searchable plug-in manager with tags and categories. It’s also possible to LMMS 7/10 WAVEFORM PRO 8/10 save presets to the sidebar. ARDOUR 8/10 MUSE 7/10 Although LMMS can support other plugin formats through a QTRACTOR 6/10 built-in version of Carla, it comes with an integrated suite of Waveform Pro supports key plugin types and comes with its own plugins, too.

Installation How easy is it to install a DAW?

aveform Pro is commercial software built on an open source framework. There’s no way of getting the source W code of the actual application though, and it’s supplied as a .deb file. There is a feature-reduced free version (Waveform Free) that’s quite usable, however. All of the other DAWs that we’re looking at in this Roundup are open source. Often, you’ll have to build the latest version from source yourself. Now, building music applications and plug-ins from the source code tends to be on the medium part of the scale in terms of difficulty. Expect to spend some time finding the -dev Building the latest version of Ardour 6.5. versions of packages until the configuration script will complete and the actual build can begin. However, it tends to become easier The LMMS developers give access to the source code, but they as you compile more elements, because you grow better at it and also supply the latest stable version in the excellent AppImage the more features you add, the more essential libraries you’ll format. So, you can run it without installing it, and in our test, already have on your system. this worked perfectly. Ardour has a quirk in that the developers request a one-off donation or a subscription before enabling you to download the VERDICT installable binary package for your operating system. It’s included in the official repository of distros such as Ubuntu, but that LMMS 9/10 WAVEFORM PRO 6/10 version tends to be considerably out of date. The workaround is to ARDOUR 7/10 MUSE 8/10 download the source code and build it yourself, which is QTRACTOR 8/10 completely free. Qtractor, MusE and LMMS are free in a traditional open source sense.

www.techradar.com/pro/linux May 2021 LXF275 27 ROUNDUP Audio workstations

User interface and ease of use It’s the nerve centre, so it’d better be good. LMMS 8/10 Qtractor 6/10 LMMS is a highly integrated system that This application prioritises functionality ometimes, particularly in the owes some of its look and layout to Fruity over aesthetics as it makes fairly standard case of open source software, Loops/FL Studio. Although quite modern use of the QT5 GUI toolkit. The layout is S developers are better at and ergonomic overall, it uses resizable traditional as each editor, the mixer and solving the technical problems than overlapping windows within the main each settings dialog launches into its the user interface/experience problem. window, rather than a pane-based or own window. This can leave the user Even designing a colour theme that tabbed system. overwhelmed by overlapping windows that works in every situation can be The sidebar is a handy addition. Along have to be manually managed. That said, it surprisingly difficult to achieve in with quick access to previous tunes, this does feature a sidebar, although this only the case of DAWs. pop-out sidebar gives fast access to stores audio and MIDI clips. Overall, the As with all applications, the GUI of samples and plugins, both of which can be feel and workflow is similar to commercial, DAW software has evolved over the auditioned with a single click or dragged Windows-based MIDI sequencers of the years, and at a glance you can tell that and dropped onto the appropriate editor early 90s such as Cubase and Cakewalk. all five of these DAWs adhere to a windows within the program. Not that there’s anything wrong with similar UI paradigm. The hub, if you will, The beat editor, a feature inspired by the taking such a bare-bones approach, of the user interface experience is the one in Fruity Loops, is probably the most and some might like it. arrangement view. This shows the convenient such tool in any of the DAWs When it comes to clarity, the default overall layout of the piece of music. we’re looking at. While most DAWs are Qtractor theme is probably the clearest Upon this, there are a series of oblong labyrinths of options and features, LMMS of all of the software that we’ve tried, and boxes (with various names in the is pretty much what you see at first glance in use the contrast between elements is different software) that contain the and not much else, resulting in a simple great. So, high marks for clarity, but minus actual note data or audio data, and and efficient system for creating music. some marks for fiddliness. double-clicking this typically opens an editor. Which implementation of this approach is the best?

JACK support The JACK system offers an advantage to Linux-based musicians.

inux uses a system called ALSA to interface with the program, playing each program for its strengths. Then you can sound card, but most Linux music applications also press Play in one application, and the other application will start L support JACK (JACK Audio Connection Kit). This is a up and play while maintaining (sample accurate) synchronisation layer that sits on top of that, and it’s a key aspect of the Linux and song-position. audio ecosystem. JACK is used to plug one music program into There are plenty of music tools that use JACK like this, such as another and to keep multiple applications in sync with each other. the Hydrogen drum sequencer (http://hydrogen-music.org) and a MusE, Qtractor and Ardour are fully JACK enabled applications. MIDI loop sequencer such as Seq42 (https://github.com/Stazed/ Waveform and LMMS have only basic JACK support, using it for seq42), along with other niche tools. You can end up running a simple audio and MIDI input and output. Waveform became a bit mix of programs at once, but there are tools to help manage that unstable when constantly reassigning the JACK inputs while and Qtractor would work well as the master sequencer. running, so it’s best to just use it as intended. Using a fully JACK-enabled program like Ardour, you could VERDICT send audio from a track, have it affected by another application and then routed back onto the track. Or, you could have another ARDOUR 8/10 LMMS 5/10 application playing onto a mixer track within Ardour. WAVEFORM PRO 5/10 MUSE 7/10 In addition, JACK can handle synchronisation between QTRACTOR 7/10 applications. It’s fairly trivial to, for example, set Qtractor up as the LMMS and Waveform do use JACK, but only in a basic way. Ardour is the most MIDI sequencer and then have Ardour as the audio recording JACK-enabled of all.

28 LXF275 May 2021 www.linuxformat.com Audio workstations ROUNDUP

Ardour 7/10 Waveform Pro 8/10 MusE 7/10

Ardour can be configured for a few Often, the UI is what puts a piece of Like Qtractor, MusE has a look that’s different layout approaches, but all of the commercial software ahead of open reminiscent of older, traditional MIDI action occurs on three switchable tabs for source alternatives. Waveform Pro presents sequencers. In terms of overall layout and arrangement, mixing and preferences, an efficient multi-pane interface, and colour scheme, MusE may have a bit of an which works well. The tabs can be panes can be clicked out of the way when old-fashioned appearance but contrast separated onto multiple monitors. not needed. The sidebar has multiple between elements is very good. For All editing of audio and MIDI parts modes and can be used for previewing example, there’s no confusion when occurs, inline, on the Arrange screen. clips before dropping them into the attempting to locate grid markers in the Some people will enjoy this way of arrangement, but it can also be switched MIDI editor as things are somewhat black, working, but the snag is that you have to to a mode that gives fast access to white and grey. The current releases resize the channel lanes yourself and zoom commonly used functions. default to a dark UI theme, inline with in manually. What it really needs is a mode There’s some confusion in the overall most modern music software. that automatically zooms and centres a design – sometimes there’s more than one On the downside, much editing of part when it’s double-clicked. As it stands, way of editing something, though some channel settings and such involves most editing requires a bit of mouse will appreciate having the additional launching a new pop-up, slowing down manoeuvring to get things lined up. options. One irksome problem from the the creative process. The MIDI editor pops The supplied colour schemes can lack earliest days of the program still remains: up in its own window, but it’s possible to distinct contrast in a given context. You’re as you zoom out on an arrangement, some configure MusE for a number of different sometimes left wondering where a grid of the user interface elements become layout approaches such as a tabbed line is or which overlapping element is smaller, which can be awkward. However, a interface, potentially cutting down on the selected. It’s a complex program, and few quirks aside, it’s the best of the bunch fiddliness factor inherent with an interface newcomers might struggle with the layout. for looks and layout. that uses multiple windows.

MIDI workflow For electronic music, MIDI workflow is the most important aspect of a DAW.

tractor has a MIDI editor that’s clear and extensively MIDI editor, although ergonomic, isn’t as feature-packed as the featured with loads of the traditional MIDI sequencer Qtractor, MusE and Waveform Pro ones. There aren’t many features Q tools such as rescaling, quantising, randomising and hidden below the surface, but keeping things simple might be normalising. It’s a shame that, like LMMS, it lacks step-entry of seen as a boon to some. However, its beat editor is the most notes, a feature that Waveform Pro, MusE and Ardour do have. convenient of the ones we’ve used. MusE also has a dedicated mode for editing percussion tracks, Waveform Pro has a handy facility to seamlessly freeze a MIDI as does Ardour. track to an audio track to free up resources. If you run out of CPU Ardour is a bit disappointing in the MIDI realm, with an or memory resources while creating MIDI tracks on the other awkward workflow. It’s good enough for, say, playing in a piano DAWs (something that’s easy to do), then you’re stuck. track and then making corrections, but creating a piece of trance music (an example of a style that requires a lot of editing of individual MIDI notes) with Ardour would soon become an VERDICT exercise in frustration. Waveform Pro is probably the equal of Qtractor and MusE ARDOUR 5/10 LMMS 6/10 for pure MIDI facilities. It also has a step-sequencer function WAVEFORM PRO 8/10 MUSE 7/10 for beats, and the overall interface of the program is optimised QTRACTOR 7/10 for fast composition. Qtractor and MusE are strong traditional MIDI sequencers, but Waveform Pro LMMS is largely designed to be a MIDI sequencer, but its has the slicker, more modern interface design.

www.techradar.com/pro/linux May 2021 LXF275 29 ROUNDUP Audio workstations

Audio workflow Recording audio, chopping it up and processing it are key DAW features.

rdour and Waveform Pro are on a fairly even footing for audio (the track type you use for things like vocals, A guitars and drum loops), but each DAW has the odd feature that the other one lacks. For example, Ardour has the ability to align the actual start position of the audio data within a part. This is useful in cases where the singer adds something like “We’ve gotta...” before the word that is actually the start of the beat, for instance. In real life, The simple audio editor built in to MusE works perfectly well. few natural musical sounds start exactly on the beat. It also has a nice workflow if you like to cut up an audio part and manually adjust the levels of individual sections. So convenient is the audio tracks, and there are some workarounds you can use to record workflow, that Ardour would even be a good choice for non- audio into LMMS, such as running Audacity at the same time. musical jobs such as editing a podcast. Qtractor and MusE have good audio facilities, but the more Waveform Pro has what it calls Warp Time mode that makes it advanced operations might require using an external editor. possible to manually realign audio peaks to beats by stretching the audio without actually cutting it. This is handy for getting VERDICT those guitar strums back on the beat without introducing any clicks. All of this occurs in the bottom pane of the main screen, ARDOUR 9/10 LMMS 4/10 rather than cluttering things up with extra windows. WAVEFORM PRO 9/10 MUSE 7/10 Audio recording is a frustrating omission from LMMS, and it’s QTRACTOR 6/10 the only DAW we’re looking at that lacks this important feature. Ardour is highly impressive for multi-track hard disk recording and mixing, However, it can work with audio files that are dropped on to and Waveform Pro is on much the same level.

Special features What makes a particular DAW stand out from the rest?

he commercial Waveform Pro is in the lead when it comes to extra features. It has a “rack” system whereby it’s T possible to graphically create a linked-up arrangement of plugins that can be saved as a system. Next time you need this arrangement you can quickly drop it into the effects area of a track. If you wanted to do something similar in Qtractor, for example, you could perhaps manage it, but it would involve a lot of work. Furthermore, you’d need to create it from scratch every time you needed it. The included synthesiser and sampler plugins that are supplied with Waveform Pro The “pin” system within Ardour offers an easy approach are impressive. to complex routing setups as well, making it the closest in capabilities of the open source applications. Ardour also offers extremely quick and easy to use and makes LMMS the fastest of modes for working with a traditional hardware mixing desk. the DAWs for constructing drum beats out of samples. Waveform Pro comes with intriguing compositional aids such as Qtractor and MusE don’t have many built-in extras, but that’s the chord sequencer, the arpeggiator and the built-in samplers undoubtedly a conscious choice of the developers. They do what and synths, which are excellent. they do well, and you’re expected to turn to external tools for Most of the time, when working with LMMS, you’ll have an anything beyond the basic facilities, particularly in the area of arpeggiator, because the built-in instrument plug-ins all feature audio, and there’s nothing necessarily wrong with that. one. Speaking of which, LMMS has some advantages over the other software in that it has its own plugin system and comes with VERDICT an extensive suite of instruments. It even features a lot of samples and synth presets. The great thing is that you can then share an LMMS 6/10 TRACKTION WAVEFORM PRO 9/10 LMMS file with another user, as long as you’ve not used anything ARDOUR 7/10 MUSE 6/10 outside of the supplied resources. This further reinforces the QTRACTOR 5/10 Amiga tracker-like feel of the software. The beat editor is Qtractor deliberately keeps things simple, and that’s absolutely fine.

30 LXF275 May 2021 www.linuxformat.com Audio workstations ROUNDUP

Audio workstations The verdict

aveform Pro is strong in most areas, and that makes it our winner. It would be equally at home when recording W a band or creating EDM. It takes a modern, multi-panel approach to its GUI, which is highly efficient and mostly pleasant to use. It also comes with a hell of a lot interesting add-ons and a feature list that’s lengthy to say the least. All of the other applications tend to have a mixture of areas in which they’re strong and in which they’re disappointing. Qtractor is fairly traditional in the way it looks and the way it works. It’s also very “Linuxy”, in feel and in function: it does the basic job, and you’re expected to bring in external tools to extend its functionality. For example, it lacks the built-in MIDI arpeggiators of LMMS and Waveform Pro, but you could wire up an external tool such as QMidiArp (http://qmidiarp.sourceforge. net) to do the job. In the same way, you could use Audacity 1st Waveform Pro 9/10 (www.audacityteam.org) for more advanced audio processing and then bring the track back into Qtractor afterwards. It’s also Web: www.tracktion.com Licence: Commercial ideal for running along with other, JACK-enabled music tools. Version: 11.5.0 The strengths and weaknesses of Ardour are almost opposite Powerful audio and MIDI capabilities mixed in with some very useful extras. to those of Qtractor. It’s highly professional when used as a hard disk recorder or for mixing multitrack projects, but fans of the 2nd MusE 8/10 software have been waiting years for some improvements on the MIDI sequencing side of things. Web: https://muse-sequencer.github.io MusE covers similar ground to Qtractor, but perhaps has a Licence: GNU General Public License Version: 4.0pre2 more convenient GUI. Both of those applications are competent Capable in most areas of music production and good workflow. in the area of audio in addition to MIDI, and the choice between them might come down to personal taste. 3rd Ardour 7/10 LMMS is a great piece of software, and without putting it down it’s maybe the best starting point for a beginner who wants to Web: https://ardour.org Licence: GPLv2+ learn MIDI sequencing on Linux. It’s fairly streamlined in most Version: 6.5.0 areas with a highly attractive GUI. There are also plenty of built-in A powerhouse when dealing with audio with basic MIDI capabilities. demo tunes to learn from. However, audio recording is the glaring feature omission that holds it back. It’s such a shame that the 4th Qtractor 7/10 developers haven’t been able to add this to the program. During writing, Waveform Pro received a major release to Web: https://qtractor.org Licence: GPLv2 version 11.5 which is free to customers who’ve purchased version Version: 0.9.12 11. This packed in a lot of improvements such as a new engine A powerful MIDI sequencer with reasonable, basic audio facilities. with plug-in delay compensation and the removal of a few long time GUI gripes such as the lack of manual grid size setting. 5th LMMS 6/10 That said, all of the other DAWs are under current development, and Ardour and MusE in particular seem to be on the cusp of Web: https://lmms.io Licence: GPLv2 some major improvements. So, keep checking the project Version: 1.2.2 websites for the latest developments. A slick and efficient way of creating simple tunes.

ALSO CONSIDER

If you see an interesting-looking piece of Linux music software, you can get the Linux build for free by hunting around on the make sure that it’s still being supported. There are many old Reaper forums. However, it’s not an official release and it’s still projects that look good, but that have been abandoned by in beta, as of yet. Some people report good success in getting the developers. Rosegarden (www.rosegardenmusic.com) Windows DAW software working on Linux (including the is a traditional-looking, but fully featured, MIDI sequencer Windows version of Reaper) with reasonable performance. If with basic audio support plus scoring facilities, which is an you’re willing to try this because you’ve got your heart set on a important consideration for some. Reaper (www.reaper.fm) is a particular non-native DAW, search online to find out the tricks low-priced DAW that’s widely used by hobbyist musicians, and and techniques that others have used.

www.techradar.com/pro/linux May 2021 LXF275 31 PLUG & PLAY Pi PROJECTS Jonni Bidwell with the help of Tom’s Hardware bring you the best in Raspberry Pi-based fun.

e do love the Raspberry your desktop, and small enough that Pi here at LXF Towers. you can hide it behind the back of W And so do our digital your monitor. If that’s not small colleagues at enough, there’s always the Pi Zero, tomshardware.com, home to our Pi which is perfect for budding Internet User’s Les Pounder. So with their of Things enthusiasts. And now help we’ve selected the finest Pi there’s the Pi 400, where the projects for you to enjoy. We’ve got keyboard is the computer. something to inspire everyone, Of course, there’s no need to stop from retro gaming to home at these projects, or any others you security, or even artificially might find online. We want you to intelligent object classification. boldly go exploring new physical The Raspberry Pi is the perfect computing frontiers, and we hope device for learning Linux. Its official that this offering inspires just that. operating system is based on Debian With a bit of practice and experience, Linux and there’s even a build of you’ll be soldering up your own Ubuntu for it. The Pi 4 is powerful hardware, controlling robots and be enough that it can happily replace limited only by your own imagination.

In association with

32 LXF275 May 2021 www.linuxformat.com Raspberry Pi projects Get your kit ready Prepare your USB cables, SD cards and a cup of tea. It’s Raspberry Pi project time…

ith more than 34 million units sold, the Raspberry Pi is not only one of the world’s W most popular computers – it’s also one of the most important. Originally designed to help kids learn about technology, this inexpensive, single-board system is the leading choice for makers, developers and hobbyists who want to do everything from building industrial robots to setting up retro arcade machines. Whether you’re aged eight or 80, if you love technology then the Raspberry Pi is made for you. And there are models from £5 to £65 to suit any budget. Whatever you do with your Raspberry Pi, you’re going to need an SD card with an operating system on Cheap power supplies are another cause of errors. The latest it. The official Raspberry Pi OS (formerly Raspbian) is For older model Pis these are less of a problem, but the incarnation of the a popular choice and in many cases is a great start for Pi 3 and above really do need a good 5.2V or they’ll be Pi, the 400 model, embodies a Pi many projects. It’s available in Desktop and Lite flavours subject to CPU throttling and instability. The Pi 4 has 4, also pictured, at www.raspberrypi.org/software/operating-systems. switched its power input from micro USB to USB-C, and within a keyboard. There’s an official Raspberry Pi Imager utility that you unfortunately this new port isn’t USB-C compliant. So if can use to write this (or a selection of other OSes) to you use a fancy smart charger, it probably won’t power an SD card, or you can use the NOOBS tool. We favour the device, and might possibly damage it. Balena Etcher, which has the advantage of being able You won’t run into these issues if you use the official to handle compressed images. charger, so do that. If you’re opposed to that, we’re told that cheaper USB-C cables (ones that lack the smart Troubleshooting charge chip) work fine. Cheaper chargers should work Throughout this feature we’ll use a few different OS too, but they may not be so reliable, so caveat emptor. images, so we’ve made a handy guide to writing them We’ve handpicked some fun, useful and interesting below. If you run into difficulties, it’s always worth projects to showcase the tremendous scope of things remembering that a faulty SD card might be to blame, that can be achieved with the humble Pi. From retro so it’s worth trying a different one if things go wrong. gaming to machine learning and Bitcoin, the possibilities are truly endless… WRITING SD CARDS WITH ETCHER

Download Etcher Prepare the target Write the image 1 You’ll find Linux, macOS and 2 Insert your SD card, select the Flash 3 Hit Flash, enter your password and Windows builds at https://etcher.io. On from file option and navigate to your wait patiently for the progress bar. You’ll be Linux it ships as a zipped AppImage, so downloaded image. Click Select target and offered the chance to write the same image once you’ve unzipped it, run chmod 755 a menu will show available devices. Hard again, which you might want to do if you’re on the file (or select Properties> drives are hidden to prevent you from preparing a fleet of Pi clones. But otherwise Permissions and check the box to allow accidentally overwriting them. Select your your SD card is ready for action. Move it execution). You can now double-click the SD card reader, and check to make sure from your PC to your Pi, power on and let AppImage to run it (or do so from the CL). there’s nothing important on the card. the adventures begin!

www.techradar.com/pro/linux May 2021 LXF275 33 Raspberry Pi projects Image recognition Get into machine learning and train your Pi to recognise and classify other Pis, without having to write a single line of code.

e’re going to train our Raspberry Pi to identify other Raspberry Pis (or other YOU NEED W objects) with machine learning (ML). Why is Raspberry Pi 3, 4 or 400 this important? An example of an industrial 8GB (or larger) microSD card application for this type of ML is identifying defects Raspberry Pi Camera or a USB webcam in circuit boards. As circuit boards exit the assembly Power supply for your Raspberry Pi line, a machine can be trained to identify a defective Smartphone for taking photos circuit board for troubleshooting by a human. Selection of Pis or other objects Tom’s Hardware has some neat machine learning for classification and artificial intelligence tutorials, including facial recognition and face mask identification. In those Scan it and select Open in browser and you’ll be taken projects, all of the training images were stored locally on to a data collection site. You won’t need to download an the Raspberry Pi and the model training took a long app to collect images. time because it was also performed on the Pi. In this Accept permissions on your smartphone and tap tutorial, we’ll use a web platform called Edge Impulse Collecting images? in your phone’s browser screen. Tap to create and train our model to alleviate a few Label and enter a tag for the object that you’ll take processing cycles from our Pi. Another advantage of photos of. Take 30-50 photos at various angles. Some Edge Impulse is the ease of uploading training images, photos will be used for training and other photos will be which can be done from a smartphone (and without used for testing the model. Edge Impulse automatically having to involve an app). splits photos between training and testing. Repeat the We’ll use BalenaCloudOS instead of the standard process of Entering a label for the next object and taking Raspberry Pi OS since the folks at Balena have pre-built 30-50 photos per object until you have at least three an API call to Edge Impulse. The previous facial objects. We recommend three to five identified objects recognition and face mask identification tutorials also for your initial model. You’ll have a chance to re-train the required tedious command line package installs and model with more photos and/or objects later on. Python code. This project eliminates all terminal From the Data Acquisition tab in the Edge Impulse commands and instead utilises an intuitive GUI. browser window, you should now see the total number of photos taken (or uploaded) and the number of labels Training on the Edge (type of objects) you’ve classified. (You may need to Go to https://edgeimpulse.com and create a free refresh the tab to see the update.) You can click any of account (or login), from a browser window on your the collected data samples to view the uploaded photo. desktop or laptop. Select Data Acquisition from the menu bar on the left. You can either choose to upload Impulse design photos from your desktop or scan a QR code with your Click Create impulse from Impulse design in the left smartphone and take photos. In this tutorial we’ll opt for column menu. Click Add a processing block and select taking photos with our smartphone. Select Show QR Image to add an image to the second column from the code and a QR code should pop-up on your screen. left. Click Add a learning block and select Transfer Learning. Click the Save Impulse button on the far right. Click Image under Impulse design in the left menu column. Select Generate features to the right of Parameters near the top of the page. Click the Generate features button in the lower part of the Training set box. This could take five to 10 minutes (or longer) depending on how many images you have uploaded. Select Transfer learning within Impulse design, set your Training settings (keep the defaults, check Data augmentation box), and click Start training. This step will also take five minutes or more depending on your amount of data. After running the training algorithm, Besides collecting you’ll be able to view the predicted accuracy of the images from your model. For example, in this model the algorithm can mobile device, Edge Impulse can only identify a Raspberry Pi 3 correctly 64.3 per cent of connect to all kinds the time and will misidentify a Pi 3 as a Pi Zero 28.6 per of data sources. cent of the time. CREDIT: Tom’s Hardware

34 LXF275 May 2021 www.linuxformat.com Raspberry Pi projects

the service named EI_PROJECT_ID and paste the Project ID value from the Dashboard. Select Devices from the left column menu in your BalenaCloud, and click Add device. Select your Device

Tom’s Hardware Tom’s type (Pi 4, Pi 400 or Pi 3). Select the radio button for Development. If using Wi-Fi, select the radio button for Wi-Fi+Ethernet and CREDIT: Once you start enter your Wi-Fi credentials. Download your customised gathering datapoints balenaOS image and write it to an SD card (you can do (images), Edge Impulse this using our guide to Balena Etcher on the first page) can explore and graph the so-called features Connect the hardware of the data. Remove the microSD card from your computer and insert it into your Raspberry Pi. Attach your webcam or Select Model testing in the left column menu. Click Pi Camera and then power up your Pi. Allow 15 to 30 the top check box to select all and press Classify minutes for your Pi to boot up and BalenaOS to update. selected to test your data. The output of this action will Only the initial boot requires the long update. You can be a percentage accuracy of your model. If the level of check the status of your Pi Balena Cloud OS in the accuracy is low then we suggest going back to the BalenaCloud dashboard. Data Acquisition step and adding more images or Identify your internal IP address from your removing a set of images. Select Deployment in the l BalenaCloud dashboard device. Enter this IP address in eft menu column and select WebAssembly for your a new browser Tab or Window. Place an object in front of library. Scroll down (the Quantized option should be the camera. You should start seeing a probability rating selected by default) and click the Build button. This for your object in your browser window (with your step may also take three minutes or more, depending internal IP address). Try various objects that you on your amount of data. entered into the model and perhaps even objects you didn’t use to train the model. Setting up BalenaCloud Instead of the standard Raspberry Pi OS, we’ll flash BalenaCloudOS to our microSD card. The BalenaCloudOS is pre-built with an API interface to Edge Impulse and eliminates the need for attaching a

monitor, mouse and keyboard to our Raspberry Pi. Hardware Tom’s Create a free BalenaCloud account at https://

dashboard.balena-cloud.com/signup and once you’re CREDIT: logged in go to https://dashboard.balena-cloud.com/ deploy to open the Create and Deploy page and create our balena-cam-tinyml application. Click Deploy to Application. After creating your application, you’ll land on the Devices page. Don’t create a device yet! In Balena Cloud, select Service Variables and add two variables. First, add to the service edgeimpulse- inference a variable named EI_API_KEY and in the We can forgive the machine for thinking this Pi 3 was more likely to be a Pi 4. At Value field paste the API key from the Keys section of least it was certain it wasn’t a plant. the Edge Impulse Dashboard. Add a second variable to

REFINING THE MODEL

If you find that the identification isn’t very accurate, first check your model’s accuracy for that item in the Edge Impulse Model Testing tab.

You can add more photos by following the Data Acquisition steps and Pimoroni then selecting Retrain model in Edge Impulse. You can also add more items by labelling and uploading in Data Acquisition and retraining the model. After each retraining of the model, check for accuracy and then CREDIT: redeploy by running WebAssembly within Deployment. If you want to go further with machine learning, you might want to check out the Pimoroni’s new BrainCraft HAT for the Pi 4. It features a 240×240 TFT IPS display for inference output, slots for camera connector cable for imaging projects, a five-way joystick, two microphones, audio outputs and much more. Most importantly, it has a Pi-nky and the BrainCraft controllable fan to keep the thing cool, what with all the never-ending HAT will surely aid all your world domination plans. TensorFlow computations.

www.techradar.com/pro/linux May 2021 LXF275 35 Raspberry Pi projects Multi-room Pi audio

Get your Raspberry Pis in sync, audibly throughout your home.

ulti-room audio systems can cost a pretty YOU NEED M penny, but who needs to buy an expensive set of wireless speakers when you can use Raspberry Pi 4 or Pi 400 (one unit per room) some Raspberry Pis and any 3.5mm wired speakers 8GB (or larger) microSD card, U3 cards to achieve the same effect? We’ll use our Pi 4s and recommended. One per room speakers/receivers (with 3.5mm audio inputs) to play 3.5 mm audio cables music from a streaming service perfectly in sync via Amplified speakers or a receiver with Bluetooth from our phone, tablet or computer. We’ll 3.5mm/phono audio input show you how to do this with a single speaker and Power supplies for your Raspberry Pis Raspberry Pi and then replicate it in other rooms. This Optional: Smartphone or tablet is an excellent project for repurposing old receivers. If you have a non-Bluetooth receiver with a 3.5mm jack menu in your Balena-Sound Dashboard. Click Add input, you can connect your speakers to your receiver device and choose Raspberry Pi 4, Raspberry Pi 400 or and your receiver to your Raspberry Pi. Raspberry Pi 3. Select the radio button for Development. Instead of Raspberry Pi OS, we’ll use BalenaSoundOS If using Wi-Fi, select the radio button for Wi-Fi+Ethernet to make the Bluetooth connection visible (to our other and enter your Wi-Fi credentials. Click Download devices) and eliminate the need for a monitor, keyboard balenaOS and a zip file will start downloading. Write and mouse for our Raspberry Pi. Create a free this to an SD card, using Balena Etcher or otherwise. BalenaCloud account at https://dashboard.balena- cloud.com/signup and log in. Open the Deploy a Balena- Connect and update Your musical Pi sound application page at https://sound.balenalabs.io/ Remove the microSD card from your computer and can be monitored at all times docs/getting-started. You must already be logged into insert into your Raspberry Pi. Connect the speaker to through the Balena your Balena account for that link to work. Click Deploy to your Pi via the 3.5mm audio cable. Power up your Pi. Cloud dashboard. Application and select Devices from the left column Allow 15 minutes for your Pi to boot up and BalenaOS to update. Only the initial boot requires the long update. You can check the status of your Pi Balena Sound OS in your BalenaCloud dashboard. If you’re using a Raspberry Pi 400, connect a USB speaker instead of the 3.5mm audio jack. Wait for your Raspberry Pi BalenaOS update and confirm all systems are running. From your smartphone, tablet or computer, navigate to your Bluetooth settings and look for BalenaOS XXXX and pair it to your device. Connect the device as the sound output for your smartphone, tablet or computer. Tom’s Hardware Tom’s Go to your streaming service and play a song. The music should stream via Bluetooth to your Raspberry Pi and

CREDIT: play from the attached speaker.

MULTI-DEVICE/MULTI-ROOM SYNC

For multi-device sync, repeat the setup DJing from your smartphone, tablet, or stages we described above for each extra computer like a pro. device. You can flash the same image from If you’re an audiophile you probably won’t earlier if you’re using the same model of care much for Bluetooth audio, or indeed the Raspberry Pi. With the same Bluetooth headphone output on the Raspberry Pi. device connected as mentioned earlier, Fortunately there are a variety of DAC (digital music can now stream to all Raspberry Pis analogue converter) HAT boards that enable and their connected speakers. You will only faithful audio reproduction for not much need to connect one Pi via Bluetooth to your money. IQaudio has been part of the Pi phone, tablet, or computer to stream to all community since 2015 and we’ve long been Raspberry Pi Balena Sound speakers. a fan of its range of DAC and amplifier That’s it! You can now create multi-room/ boards. Now IQaudio is part of Raspberry Pi Breathe life into unused bluetooth speakers and old amplifiers with Balena Sound. multi-device sound experiences in your and those boards are being added to the home with your Raspberry Pi devices while range of Raspberry Pi products. CREDIT: Tom’s Hardware

36 LXF275 May 2021 www.linuxformat.com Raspberry Pi projects Pi-based KVM over IP Use your Pi as a remote control for your PC, even if it won’t boot to an OS.

hose of you who have needed to access a PC remotely will probably have tried VPN or YOU NEED T other applications such as TeamViewer. Raspberry Pi 4 or Zero However, this kind of software only works within the 16GB or larger microSD card remote computer’s OS, which means that it can’t HDMI-to-CSI bridge or HDMI-to-USB capture dongle access the BIOS, reboot, install an operating system USB female-to-dual male Type-A splitter or power on the computer. There are several solutions USB C to Type-A cable that make it possible for you to remote control a PC 5V, 3 Amp power supply with USB Type-A output. You’ll independently of its operating system, but using a be plugging a type-A cable into it so the official Raspberry Pi KVM over IP is one of the most convenient and power supply won’t do affordable approaches. While a store-bought KVM over IP device can cost 5V pin then it’ll back feed the power from your wall hundreds of pounds, it’s easy to use a Raspberry Pi to power to the PC, possibly causing damage to its USB create your own. A developer named Maxim Devaev port in the process. designed his own system called Pi-KVM (https://pikvm. Connect the USB C-to-A cable to the Type-A female org/), which he’s planning to sell as a $130 kit. However, connector on the splitter. This will provide power to the if you have the right parts, you can use the software he’s Pi. Connect the USB-C cable to the Raspberry Pi 4’s developed and your Pi, to put it together for far less. USB-C port and connect the unmodified Type-A male to Here, we’ll show you how to build your own Raspberry your power supply. Attach the USB Type-A connector Pi-powered KVM over IP that can output full HD video, and HDMI to the PC that you wish to remote control. control GPIO ports and USB relays, configure server power using ATX functions and more. You’ll be able to The Pi-KVM software control the whole setup via a web browser from another At this point we’re ready to start using the Pi-KVM. On device on your local network. first boot it’ll take longer then expected due to the initial process for enlarging the microSD card. Just be patient Download the image – it’ll boot eventually. Navigate to the Pi’s IP address The first thing we will need is to download the SD card (you can look it up in your router’s control panel or use image from pikvm.org. Note that there are different Nmap) in a browser on your client computer (the one versions, depending on which Raspberry Pi you use and you’re using to control the other PC). You’ll be redirected whether you use the HDMI-to-CSI bridge or an HDMI-to- you to the login page, which you should log into using USB capture dongle. The file is bz2-compressed, but admin for both username and password. Etcher can handle this automatically, so follow the guide Click the KVM icon. You should now be presented from earlier and write it to an SD card. with a screen providing you with access to the remote Now we can move on to installing the HDMI-to-CSI PC and a number of other menus. Further options and bridge or USB-to-HDMI dongle and prepping the OTG instructions are available from the Pi-KVM GitHub. USB-C cable. Connect the CSI ribbon cable from the HDMI-to-CSI Pi-KVM Prototype V3 without bridge to the Raspberry Pi’s CSI case and KVM four-port switch. camera port. Make sure that the blue marking faces the black clamp. If you’re using an HDMI-to-USB Hardware Tom’s dongle instead, connect it to a USB

port on your Pi. If you’re using a Pi CREDIT: Zero then you’ll need a microUSB- to-USB Type-A hub. Disable the 5V pin on one of the USB Type-A male connectors from your splitter. The easiest way to do this is to place a small piece of Kapton tape over the right-most pin on the connector. You could also try cutting the lead to that pin, but that’s more complicated. This will be the connector that attaches to a USB port on the PC you wish to control. If you don’t disable that

www.techradar.com/pro/linux May 2021 LXF275 37 Raspberry Pi projects Gaming on RetroPie

Turn your Raspberry Pi 4 (or 3 or Zero) into a retro gaming rig with RetroPie and dubious internet downloads.

ack in the 1980s and 1990s, the arcades download the latest image from https://retropie.org.uk/ B were the place to be. The latest video games download and use Etcher. Either way, there are separate from Namco, Sega, Konami and more ate our editions for first-gen devices (the original Raspberry Pi 10 pence coins as we pursued that high score. Those and Pi Zero), multicore devices (the Pis 2 and 3) and days are now sadly behind us, but retro gaming has the latest Pi 4 or 400 models. Eject the microSD card seen massive growth in the past decade. and insert it into your Raspberry Pi 4. Next, plug in a Using a Raspberry Pi, you can run a variety of controller. XBox One and Playstation 4 pads are emulators that enable you to play not only old-time compatible with RetroPie via Bluetooth, but require a arcade games, but also your favourite titles from many USB connection until Bluetooth is configured. old consoles, including the Atari 2600, NES, Nintendo Power on the Raspberry Pi and wait for your 64, Sega Genesis and Gameboy. There are a number of controller to be detected. Configure your controller. Note that you probably will have fewer buttons on your controller than RetroPie asks you to configure. Just hold TUCK INTO A SLICE OF RETROPIE down a button that you’ve already configured to skip past any options you don’t need. Press the A button on “Using a Raspberry Pi, you can run a your controller to close the configurations menu and variety of emulators that enable you to open the main menu. Adding games To RetroPie play arcade and console games.” All the games exist as files called ROMs, which are dumps of real boards or cartridges. The easiest method emulation platforms available, but RetroPie is by far the to add games is to use a USB stick to transfer the files most popular and arguably the best. from your computer to your Raspberry Pi. It’s important Up until recently, installing RetroPie on a Raspberry to note that games from retro consoles are under Pi 4 was a pain. Even though Raspberry Pi 4 came out in copyright no matter their age. If you don’t personally June 2019, RetroPie didn’t officially support it for nearly own the cartridge/board and rip a copy of your own, a year and there were some manual steps you needed downloading and distributing these ROMs may violate to take to make it work. Now, not only can you install laws in your country, so proceed at your own risk. RetroPie on a Raspberry Pi 4, but you can do it using the On your computer create a folder called retropie on a Raspberry Pi imager. It couldn’t be easier. You can also FAT32/exFAT-formatted USB flash drive. Plug the USB flash drive into the Raspberry Pi 4 and RetroPie will create a folder structure inside the retropie/ folder on WELCOME TO THE PICADE the stick. Remove the flash drive and insert it into your computer. Copy your games to the correct system or Pimoroni’s Picade arcade cabinets have a long history of quality. console folder in retropie/roms/. For example, put Atari Coming as a laser-cut, self-assembly kit in eight- or ten-inch screen 2600 games in the /atari2600 folder. Eject the flash sizes, Picade is easy to build and can be used with all models of drive and place it back into a USB port of the Raspberry Raspberry Pi, but for best results you’ll want a Raspberry Pi 4. Pi 4. How long this will take depends on how many Because Picade uses common arcade components, it can be games are transferred over: a matter of minutes for a customised to meet your playing style and aesthetics. If you like few games; hours if transferring a large amount. microswitched buttons and joystick then When complete, remove the USB flash drive you can easily swap to get the edge in and press START. From the menu select Restart your favourite game. The Picade X HAT Emulationstation/Restart System. The games list will attaches to the GPIO of your Raspberry Pi now update and show the available computers/consoles and provides connections for the controls, for which there are now games. Bear in mind that, when USB-C power management and an audio it comes to playing retro arcade games from actual DAC connected to a 5W speaker for arcade machines, not all ROMs are compatible with all authentic arcade audio. Everything you emulators. RetroPie can run with 10 different versions of need to build your own arcade cabinet – MAME (Multiple Arcade Machine Emulator), the most just add a Raspberry Pi! A DIY kit with popular arcade emulator, and some ROMs will run on step-by-step instructions to build, wire some versions of MAME and others will work on others. and configure a custom cabinet offering The Picade is the perfect desktop RetroPie maintains a handy chart at https://retropie.org. a slice of retro gaming heaven. or bookshelf distraction. uk/docs/MAME, but if your arcade games don’t load in one MAME, try another.

38 LXF275 May 2021 www.linuxformat.com Raspberry Pi projects Environment sensors With sensors and data and neat tidy cables, that’s how our garden grows.

ast issue’s monitoring feature showed how your PC’s CPU temperature could be YOU NEED L displayed and graphed by a Pi with an LCD Raspberry Pi (any model) display. For this project we’ll take that idea a step GrovePi or GrovePi Zero further, and measure a range of environmental Adafruit 1.3-inch Bonnet (or other display) variables. Thermistors and most other components GrovePi Sensors (temperature, moisture, light) that measure such factors, are analogue in nature. Stack the display So they’re not immediately suitable for the Pi, which atop the GrovePi only has digital (GPIO) inputs. However, thanks to daughterboard, HATs like the GrovePi, it’s easy to get your Pi talking plug in some to analogue sensors. We used a high accuracy sensors and you’ll be monitoring the temperature and humidity sensor, a soil moisture environment in meter, a light sensor, but much more are available no time. and getting them working with GrovePi is super easy. We won’t cover setting up the Pi (any model will do), but you’ll probably want to get it set up for SSH and Wi-Fi access, especially if you’re planning on installing this in your greenhouse. One thing we will note is that you might have to coerce your Pi into using Python 3 by default (if it doesn’t already). This is a matter of $ sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1 stats-example): $ sudo update-alternatives --install /usr/bin/python from digitalio import DigitalInOut, Direction python /usr/bin/python3.7 2 from PIL import Image, ImageDraw, ImageFont Now we can set up the GrovePi board, and Dexter import adafruit_rgb_display.st7789 as st7789 Industries provide a script that will do this in one line: Then you can use regular PIL image and text $ curl -kL dexterindustries.com/update_grovepi | bash commands to draw the info on screen height = disp.height Vision on width = disp.width You’ll need to reboot once everything’s done, at which image = Image.new(“RGB”, (width, height)) point we can start setting up our display. There are a rotation = 90 huge range of TFT, OLED or LCD screens available for image.draw = ImageDraw.Draw(image) the Pi so this depends on your hardware. We used For this project to be useful, we need the display to Adafruit’s 1.3-inch Pi Bonnet display and to set that up continuously update. So we’ll make a loop, which clears we had to install Pip and then install its Blinka library, the screen, updates readings, pauses and repeats which enables interfacing with their CircuitPython APIs: fnt = ImageFont.truetype(“/usr/share/fonts/truetype/ $ sudo pip3 install --upgrade adafruit-python-shellwget dejavu/DejaVuSans.ttf”, 30) $ https://raw.githubusercontent.com/adafruit/ while True: Raspberry-Pi-Installer-Scripts/master/raspi-blinka. moisture = grovepi.analogRead(1) pysudo python3 raspi-blinka.py light = grovepi.analogRead(2) Adafruit’s Blinka Then reboot and you should be ready to go. draw.rectangle((0, 0, width, height), outline=0, fill=0) library enables Reading from our combined temperature/humidity draw.text((20,120), “Light {}”.format(l), font=fnt, Python to talk sensor required a bit of copying and pasting from fill=”#FFFF00”) CircuitPython, https://github.com/ControlEverythingCommunity/ draw.text((20,210), “Moisture {}”.format(m), font=fnt, a variety of TH02, since the bit-banging is a little complex. But our fill=”#00FFFF”) MicroPython used in tiny gadgets moisture and light sensors can be read with one liners: disp.image(image) and robots. import grovepi time.sleep(0.5) moisture = grovepi.analogRead(1) You can go further light = grovepi.analogRead(2) with this project, such as Having got the data from the sensors, we need to get logging and graphing it on the display. The Adafruit Python libraries enable temperatures with Gnuplot. images to be sent directly to the display, so we can Or you could connect a use the Pillow libraries to help us. Then there’s some watering system via a boilerplate to initialise the display (which we’ll omit relay and never have to here, but you’ll find it at https://learn.adafruit.com/ worry about your peonies adafruit-1-3-color-tft-bonnet-for-raspberry-pi/python- drying out again!

www.techradar.com/pro/linux May 2021 LXF275 39 Raspberry Pi projects Bitcoin Node with RaspiBlitz

Make the Bitcoin network a bit bigger and better with a Pi and a large storage device.

ou’re not going to get rich mining Bitcoin on Y a Raspberry Pi. Even with dedicated ASIC You’d be hard pushed to find a large-enough SD card to store the mining hardware it’s hard to compete with blockchain, so get yourself an external SSD. industrial operations in countries with subsidised electricity supplies. The story is the same for other a heatsink to avoid throttling or damage from cryptocurrencies too – see www.tomshardware.com/ overheating. Fetch the SD card image from https:// uk/how-to/mine-cryptocurrency-raspberry-p. github.com/rootzoll/raspiblitz, write it to an SD card Yet you can still use RaspiBlitz to turn your Pi into a (minimum 16GB), and use it to boot your Pi. Don’t full Bitcoin node. This helps the Bitcoin network be more bother connecting a monitor (it won’t work), but decentralised, and by extension more secure. If you run do connect an Ethernet cable. If you have the your own node, and store your bitcoins locally, then recommended XPT2046 display then this will be used you’re essentially self-sovereign – you haven’t entrusted automatically and will display the device’s IP address. If your keys to others and you aren’t relying on other not you can use a tool like Nmap to get this information nodes to supply correct information. To quote the and then connect from another device with, say RaspiBlitz manual: “Not your node, not your rules”. $ ssh [email protected] and using the default raspiblitz password. Put some storage in place The setup wizard will walk you through setting up Running a full node involves regularly syncing the passwords and storage, and ultimately syncing the Bitcoin blockchain, which at the present time is 350GB blockchain, which will take hours. Once you log in again and growing, so you’ll need some large external storage you’ll be presented with the options screen where you before you begin. You can get away with a mechanical can tweak settings and, optionally, set up as a node on hard drive, but life will be much easier if you can get the Lightning Network (see box, below). You can also see hold of a 1TB or larger external SSD. Ideally, you want the status screen that would be displayed if you had a your node to be online all the time, but if you have a fast display attached. Note that for others to connect to internet connection then it’s easy enough to catch up your node, you’ll need to open port 8333 on your router after some downtime. Bitcoin nodes verify new (and use a dynamic DNS service if you don’t have a transactions before sending them to miners, and record static IP at home). For Lightning you’ll also need ports new blocks as they’re mined, so they can’t do anything 9735, 10009 and 8080 to be open. You can also open useful until they’re synced. a command prompt from the main menu, but don’t It’s recommended to use a 3.5-inch LCD touch be tempted to run apt update or such. There are display to run RaspiBlitz, to display status information, instructions for updating RaspiBlitz on the project page but you can also run it headless. It’s also advised to use and if you don’t follow them there will be tears.

THE LIGHTNING SEEDS

Besides running a Bitcoin node RaspiBlitz mechanism of the main network, you is open, then you may initially lose funds, enables you to run a node on the “layer could operate a rogue node and attempt but these can be reclaimed (subject to 2” Lightning network. The Lightning to double-spend coins or otherwise both party’s approval) once your node is network permits Bitcoin transactions to cheat the system. As such there are back online. take place off the main blockchain so ominous-sounding Watchtower services they can be confirmed instantly rather that detect improperly operating than subject to the median six-minute Lightning nodes and penalise them. confirmation time that is part of the Lightning nodes are connected to Bitcoin fabric. blockchain wallets, and these must It’s possible to generate some income contain sufficient funds to cover any off- by running a Lightning node, but not chain business. If malfeasance is necessarily something you should jump detected, a so-called Justice Transaction into unawares. Since the network lacks is initiated funds are docked. If your node You can use Onion (Tor) routing to keep the IP the democratic (but lengthy) consensus accidentally goes offline while a channel address of your Lightning Node a secret.

40 LXF275 May 2021 www.linuxformat.com Raspberry Pi projects

YOU NEED Raspberry Pi 3B+, 4 or Pi Zero W 8GB (or larger) microSD card MotionEyeOS Raspberry Pi Cam, HQ Camera, Infrared Camera or webcam Learn how to build your own motion- Monitor/power supply/HDMI cable triggered home security camera.

ome security camera systems have exploded Don’t rely too in popularity while decreasing in price over much on SD cards H for storage. Cloud the past few years. Yet there are some saves will make drawbacks: first, vendors often charge a monthly files easier to fee to store your data; and second, you might not access too. want video and photos from inside your home being shared with a third party. MotionEyeOS is a distro that enables you to turn a Raspberry Pi with a camera into a home video- monitoring system, where the photos and videos can either stay on your device (and home network) or, if you choose, be uploaded automatically to a cloud-storage service such as Google Drive or Dropbox. Hardware Tom’s Here, we’ll show you how to set up a Raspberry Pi

security camera with MotionEyeOS. This software CREDIT: works with almost any Raspberry Pi (connected to the internet) and almost any webcam or Pi camera. There’s on the Pi screen. Alternatively, you can find this out no fancy coding to be done in this project; it just works. from Nmap or your router’s configuration page. Download the latest version of MotionEyeOS Enter your internal IP address into a browser window corresponding to the model of Pi you’re using from and MotionEye should start streaming. https://github.com/ccrisan/motioneyeos/releases and write it to the SD card. When the process completes, Configuring MotionEye physically remove and then reinsert your microSD card. Click the Profile icon within your browser menu to pull We do this because the software automatically ejects up the Login screen. Log in using the default credentials. the microSD card when the process completes, but we The username is admin, and the password field should need to add one file before the next step. be blank. Select your Time Zone from the drop-down Create a new file named wpa_supplicant.conf with menu in Time Zone. Click Apply. MotionEye will reboot the this text, replacing “YOUR_NETWORK_NAME” and which will take a few minutes. This step is important as “YOUR_NETWORK_PASSWORD” with your details: each photo and video is timestamped. country=gb The Frame Change Threshold setting determines the update_config=1 proportion of pixels that change before recording starts. ctrl_interface=/var/run/wpa_supplicant The intent is to set your percentage low enough to pick network={ up the movement you’re tracking, but high enough to scan_ssid=1 avoid recording a passing cloud. In most cases, this is ssid=”YOUR_NETWORK_NAME” achieved through trial and error. Start with your default psk=”YOUR_NETWORK_PASSWORD” 4% Frame Change Threshold and then move up until } you reach your optimal setting. Click the down arrow to Save the file, eject the SD card and insert it into your the right of Still Images to reveal extra settings. Do the Pi. Connect your camera, monitor and power supply to same for Movies. Set Capture Mode and Recording your Raspberry Pi and power up. If you have a monitor Mode to Motion Triggered and choose an appropriate connected your Pi’s internal IP address will be displayed period to preserve both. A week is reasonable if you’re working with an 8GB card. Click Apply to save changes. Set your Camera Name, Video Resolution and other options in the Video Device section. Click Apply to save your changes. On the live feed view you’ll see new buttons for viewing saved images and video. In the current setup this media won’t leave your local network. But if you’re okay having your media in the cloud then it’s easy to set MotionEyeOS to upload to Tom’s Hardware Tom’s Google Drive or DropBox. Alternatively, you may want to enable remote access to your Pi security cam. You’ll

CREDIT: need to configure port forwarding on your router to do This Raspberry Pi security camera can be used to record porch pirates, this. If you do this there are official iOS and Android monitor children or pets, or to watch out for burglars. apps so you can check your home when you’re out.

www.techradar.com/pro/linux May 2021 LXF275 41 IN-DEPTH Learning to program

A PARENT’S GUIDE TO PROGRAMMING Mike Bedford investigates which languages to consider if you want to help your children get a head-start in coding.

et’s start with a history languages of that era, having been We’re here to help parents to navigate lesson. The first high-level adopted for use in the home computers of their way through the language jungle to L languages – which made the late 70s and the 80s and, in so doing, come to a view about which would be the their debut in the 1950s and helped another generation learn to code. best for their children to learn. First, we’ll included the likes of FORTRAN, ALGOL While BASIC remained largely introduce several languages that are and COBOL – were designed as down-to- unchallenged for several decades, if you normally considered as educational. earth tools with little thought given to want to help your children learn to code For each, we’ll provide an introduction, education. This changed in 1964 with the today then it’s not nearly as easy to describing the main features, cover the introduction of BASIC. The language’s choose a language. For a start, there are language’s pros and cons giving, and give acronym hints at its nature, and its full now several other languages that were some thought to the age range for which name, Beginners All-Purpose Symbolic designed exclusively, or almost so, for it’s appropriate. Instruction Code further emphasises its education. Furthermore, any discussion of We’ll then move on to some of the educational credentials. beginners’ languages invariably brings up general-purpose languages that are Indeed, BASIC was designed for use various languages which, although not commonly used in an education setting. by students who had little appreciation originally intended for such, are considered Here we’ll cover much the same ground, of computers. It outlived many other to have a role in education. but with less introductory material

42 LXF275 May 2021 www.linuxformat.com Learning to program IN-DEPTH

because these languages will be much better understood than the specifically educational offerings. Throughout this article we consulted with Carrie Anne Philbin MBE, director of educator support at the Raspberry Pi Foundation, who also leads on the teach computing curriculum for the UK government-funded National Centre for Computing Education. Carrie Anne provided some useful insight into the various languages we consider here. Her opening remark is worthy of our attention. “I guess the most important information I can impart is that in education – both formal and non- formal – we do not start with a programming language”, she explained. “We always start with concepts, usually offline, before using tools that help learners make the concept more concrete in their minds.” Its block-based Scratch closely related Scratch Jr. should be the language of approach might be unfamiliar If you’ve not delved into educational languages before, choice. Scratch is used in formal education as part of to experienced it’s quite possible that you’ve not encountered block- the UK’s national curriculum, like the teach computing programmers, but based languages. In passing, that term is entirely curriculum in England, as well as in non-formal Scratch is highly different to block-structured, the concept that’s key education in homes, and in after school clubs like recommended as a first language. to structured programming and inherent in most of Code Club and CoderDojo. today’s programming languages. By way of contrast, You can install Scratch locally or run it online at a block-based language involves programming by https://scratch.mit.edu. However, Scratch Jr. is only dragging blocks – which we can think of as statements available as an app, intended for use on tablets, and is – from a palette onto the scripting area, and editing by available for iPads and Android devices. manipulating the blocks in the scripting area. In other words, it needs very little in the way of free-form typing, Blockly the requirement being pretty much limited to editing Developed and hosted by Google, Blockly is our second things like the time in a wait block or the distance in a block-based language and, although it’s sometimes move block. Ease of use is also enhanced by virtue of thought of as such, it appears that its developers didn’t the blocks being shaped somewhat like jigsaw pieces, design it exclusively for educational use. This being the an approach which slightly reduces the possibility of case, it’s probably not too surprising that it’s less basic using a block in a nonsensical context. than Scratch and, therefore, suitable for creating real Scratch is our first block-based language – it’s free, applications. Indeed, while we trust that the statement multi-platform and open source, and it was developed doesn’t consider educational resources as toys, Google by MIT’s Media Lab. Scratch is the block-based specifically say “it’s not a toy” and you can use it to language primarily recommended by Carrie Anne “implement complex programming tasks”. Despite being Philbin, who suggested that it’s suitable until a transition developed by Google, Blockly is an open source project. to text-based languages, typically at age 11 to 13. She According to Carrie Anne, Scratch dominates the told us that, in the UK, concepts like sequence, selection block-based sector, so Blockly is used when it has to be, and repetition are taught throughout the curriculum for example when programming in App Inventor from the age of five, although for ages five to seven, the (https://appinventor.mit.edu), or with the micro:bit

BEE-BOT AND BLUE-BOT

For especially young children, even those for between each step. While this certainly isn’t whom using a block-based language might programming as we normally use the word, be a step too far, Bee-Bot from www.tts- it is, of course, exactly that and it teaches group.co.uk (£59.94) or their Blue-Bot some key principles. (£83.94) might be of interest. Referred to as Turning to Blue-Bot, you can use this in programmable floor robots, and typically exactly the same way as Bee-Bot, but there’s used with floor mats that the robots can be more. First, it’s transparent and so inquiring programmed to navigate, these devices minds can get a feel for the hardware that don’t have to be programmed via a controls it, but more importantly, it has a programming language at all. Instead, they Bluetooth interface. This enables kids to can be programmed by pressing buttons on progress to controlling the robot remotely the robot’s body. So, for example, if you from a handheld device, albeit only Windows,

press the Clear button, followed by Forward iPad or Android. To cut a long story short – https://publicdomainpictures.net/en/view-image. twice, Right turn, Forward and Go, the robot and it does more – the free app makes it will move forward by 300mm (2 x 150mm), possible for children to create a program on

Bee-Bot offers young kids a fun way to CREDIT: Domain Public CC0 php?image=143737&picture=bee-bot, turn right by 90 degrees, and finally move screen via a very simple process, download program a robot by pressing the various forward by 150mm, with a short pause it to Blue-Bot and execute it. buttons on its body.

www.techradar.com/pro/linux May 2021 LXF275 43 IN-DEPTH Learning to program

it seemed appropriate to consider it. As, perhaps, the most commonly cited modern (-ish) implementation for educational use, it’s BASIC-256 (basic256 in repositories) that we’re considering here. Unlike the original BASIC command line implementations, this version takes the form of an IDE with windows for the code, textual output and graphical output. This version of BASIC was developed in 2007 specifically for teaching programming. Like BASIC of old, but unlike some of the more recent versions, flow control is pretty much limited to GOTO, GOSUB, FOR…NEXT and IF…THEN…ELSE…ENDIF. While this contributes to its simplicity, this is the source of some criticism. It’s argued that it doesn’t teach the principles Google’s Blockly is block-based, single board computer, where Scratch wasn’t supported of structured programming, instead promoting but it can be used at first. We were also told that Blockly is closer in design “spaghetti code”. To counter this, many people have for creating real to a text-based language. For that reason, it’s suitable said that they learned to program in BASIC and it applications. As for older children between the ages of 10 to 14, and it’s didn’t prevent them having a successful career in an educational not recommended for young ages. software engineering, using a range of languages. language it’s more suited for older Blockly runs in a browser from https://developers. In the light of this controversy, we elicited the views kids than Scratch. google.com/blockly and it offers the interesting feature of Carrie Anne who, while not giving a specific answer to of generating and displaying the code in a range of text- our question of whether it has any place in education based languages – specifically JavaScript, Python, PHP, today, said that BASIC isn’t a common choice anymore, Lua and Dart – that corresponds to the block-based while also stressing her earlier comment about the code. We can imagine that this could have some value basic principles coming before tools. “Learners are in the process of migrating from a block-based to a taught concepts first, not languages. Concepts can be text-based language. While Python and JavaScript are applied to any language, so the next choice is based on obvious choices in this respect, Lua and Dart might be what is freely available and comes with access to somewhat surprising. Although Scratch and Blockly resources and support.” aren’t the only block-based languages, they’re by far the ones we hear most of in education. Logo Now we’ll turn our attention to the text-based Another educational language that isn’t exactly a languages that most of us are more familiar with. newcomer is Logo. There are several versions that run locally, UCBLogo being well respected, and it can also BASIC-256 be accessed online, for example at www.transum.org/ Given that it’s 56 years old, has missed out on many of software/Logo and www.calormen.com/jslogo. Logo is the more recent programming paradigms and it draws a fully featured programming language, and is described criticism from some quarters, we were unsure whether as “multi-paradigm”, although use in education has we should include BASIC. However, since it’s still used tended to concentrate on just one element of the today professionally, albeit in its guise of Visual Basic, language. This is the “turtle” functionality that controls and it still gets recommendations as a language for kids, the movement of a so-called turtle, drawing its path on the screen and thereby producing a graphical output. Given that there are only a few turtle statements, SONIC PI Logo offers a simple introduction to text-based programming and could be a first step beyond the Sonic Pi (https://sonic-pi.net) is described as a code-based music block-based approach, perhaps for kids much younger creation and performance tool. The tool runs under Raspberry Pi OS than 11, which is the recommended age for starting with (it was developed in conjunction with the Raspberry Pi Foundation), as well as Windows and MacOS. It’s also referred to as a live coding environment. This means that performers write code on the fly to create music as they’re performing. We might think of it as enabling a digital jam session. Where things differ, though, is that it’s common to project the live code onto a screen during performances so the audience can share in the coding experience. It’s used by professional artists, but it also has educational value, especially for kids to whom its creative application appeals. According to its developer Sam Aaron, writing for MagPi magazine, “Sonic Pi was conceived and built within classrooms in close collaboration with teachers and has benefited from many design iterations based on hundreds of hours of student observation. Simplicity has even been baked into the core design philosophy by only allowing features that may be easily understood by and taught to a 10-year-old child.” And while this hints at its inherent simplicity, we should point out that it’s based on the Ruby programming language, so the sky’s the limit. BASIC certainly has its critics but, despite the controversy the BASIC-256 dialect is being promoted for educational use.

44 LXF275 May 2021 www.linuxformat.com Learning to program IN-DEPTH

means, in turn, they’re likely to use it as their text-based language in the classroom.” Building on this theme, she also referred to the fact that other resources to help teachers are overwhelmingly built around this language and are often freely accessible, like the Raspberry Pi projects (https://projects.raspberrypi. org/en). Python is considered suitable for ages 11 and older. C++ In industry, C++ is still commonly used. In fact it’s just Despite being somewhat long in the tooth, Logo still has its supporters one position behind Python in the well-respected TIOBE and, if you consider only its “turtle” instructions, it might be ideal as a index (a body that assesses the quality of software first text-based language for kids. coding), in fourth position. This is one of the reasons it’s recommended as a suitable language for use in text-based languages. What’s more, programming to education. After all, if it’s so commonly used, it’s argued, create a graphic output appeals to young minds. a knowledge of C++ will provide students with good job But we had nagging doubts about why it receives prospects or a good grounding for further education. less attention than it did a few decades ago. Might this Another plus point, according to some be because more modern languages are much better educationalists, is that it provides students with a good suited to its particular niche? Carrie Anne was certainly enthusiastic about the use of turtles. “The use of turtles is very common in programming education”, she THE BENEFITS OF LEARNING RUBY suggested, “from using Bee-Bots in primary schools to understand sequence and algorithms, to building “Ruby is accessible as a language, while Raspberry Pi robot buggies in secondary schools to solve more complex mazes.” its simple syntax makes it more Python accessible to young people” With our next language we progress from those that were designed first and foremost for education to general-purpose languages. As today’s third most understanding of how computers work because it’s a commonly used language, that reason alone might be much lower-level language than most of the other enough to guarantee it a place in education, but there’s languages promoted for use in education, in the sense more. In particular, Python is commonly recommended of being just one step up from assembly code. for educational use – and in particular as a first text- based language – primarily because it’s much simpler Other languages to learn that many other languages. While we’ve probably covered the programming Carrie Anne suggested that ease of use isn’t the only languages that are most commonly used in factor in its popularity in education. Other reasons for education, they aren’t the only ones. A brief the popularity of Python include the fact that it’s free, mention of a few alternatives is appropriate – cross platform and open source. She also pointed out indeed Carrie Anne mentioned a couple. the many IDEs that have been developed over the years, Her first suggestion is probably somewhat which meet the needs of education, like Mu (https:// surprising since the language is only in 14th place codewith.mu – described as a simple Python editor for in the TIOBE index. However, it has to be admitted that beginner programmers) and trinket (https://trinket.io, it’s necessarily a show-stopper in education since, for which is browser-based). Resources for teachers are example, Scratch is down at position 21. “Ruby is also important, leading to its use in schools and becoming more popular in education. Sonic Pi is a good therefore underlining Python’s suitability for home example of an accessible tool that helps you code learning. “At the NCCE, much of our professional music, which is also used to help teach programming development is based on Python”, she said, “which concepts to young people, based on Ruby. It’s accessible as a language, while its simple syntax makes it more accessible to young people,” she said. To conclude, we feel compelled to reiterate Carrie Anne’s view that understanding concepts is more important than learning specific languages. This being the case, in addition to considering the pros and cons of the various languages that we’ve presented, and making sure you don’t introduce your kids to languages that aren’t appropriate for their age, it’s also valid to think about what languages you feel confident to teach. Even so, if you’ve recently been employed maintaining legacy systems so you’re up to speed with vintage languages, With Python, we come to a language that’s widespread in industry, but we’re really not too sure that teaching COBOL to your its simplicity means that it’s also a good choice for educational use. five-year old would be the wisest approach.

www.techradar.com/pro/linux May 2021 LXF275 45 Pi USER

Nicole Parrot is the director of Register now for the technology at Modular Robotics. Coolest Projects 2021

BACK IN THE Individual and team entries are now open so you TECH SADDLE can show off your amazing builds to the world!

It’s 2012. I had been a stay-at- pen to everyone in the world up to Projects don’t even need to be completed home, home-schooling mum for the age of 18, Coolest Projects by the registration data, Coolest Projects is all 15 years already. The kids have O showcases any and all projects about celebrating the creation process of grown up. Time for me to figure created by young makers across the globe. projects as much as finished creations. As out what I would do with the Registration is already under way and you always with the Raspberry Pi Foundation, this rest of my life. have until Monday 3 May to sign up for any event is backed up with a host of learning In a time B.C. (before children) of the contest’s six categories: hardware, materials and live broadcasts. There’s a basic I’d been a C developer but in the Scratch, mobile apps, websites, games and booklet on getting started with project tech world 15 years away is an advanced programming. building ideas (http://bit.ly/lxf275book), eternity. The web revolution various live-stream events and a pile of video happened while I was home, both guides on the Raspberry Pi Foundation’s the original web and Web 2.0. YouTube channel (www.youtube.com/c/ I hadn’t coded anything in an RaspberryPiFoundation) and more than eternity. Then I heard of this little 200 existing guides on enhancing your digital board coming out of the UK skills at https://projects.raspberrypi.org. meant for kids who were The main event will be held in June as a interested in computers. I ordered streaming broadcast that everyone can join. two (for my teenagers, obviously). Interested? Then register by 3 May here: The Raspberry Pis arrived in https://online.coolestprojects.org/take-part. Canada between Christmas and New Year. I’m sorry to say they Get involved now – find out more at https://online. were a bust. I was unable to get coolestprojects.org or just watch in awe! anything going! I had completely forgotten Unix, along with most computer notions I ever had. I was devastated. I joined the ranks Dual Ethernet Pipe dream of a growing online community where experimenting and Double the network fun! Block-based projects learning is encouraged for all. Trying to be a good example to hy take one Ethernet port into the iper Make is the latest project from my kids, I learned Python. Nested shower when you can have two! Piper Learning .It comes as a free loops gave me nightmares but W Designed for the Compute Module 4 P online service or as part of a monthly surprisingly, recursivity was a this Seeed Carrier Board adds two Gigabit subscription service. Piper Make is a browser- breeze. Obviously, some concepts Ethernet ports for maximum networking but based editor and scheme of lessons designed just needed a little push to come also dual-USB 3.0 ports, plus an additional to introduce MicroPython via the Raspberry Pi back to the surface. USB 3.0 header, microSD slot, micro HDMI Pico. See https://make.playpiper.com. Armed with that bit of Python, I and camera/display CSI/DSI. All powered managed to blink my first LED at from USB C and priced around £45. More at age 47 and I was hooked. www.seeedstudio.com. Eventually, I got hired to write curriculum, based on my years of home-schooling and running workshops, and moved up the ladder. Against all odds, I had managed a come-back into the tech industry! I can say without any doubt that the Raspberry Pi Piper Learning is the catalyst that let me

succeed. It’s not just for kids. An interface CREDIT: maestro! Subscription-based block learning. CREDIT:DIT: SeSeeedstudio.comeedstudio com

46 LXF275 May 2021 www.linuxformat.com Linux distribution REVIEWS MX-Fluxbox Pi 21.02.20 Les Pounder is always on the lookout for a new slice of Pi and with MX Linux he discovers something fresh from the oven.

e’re no strangers to MX Linux. The distribution IN BRIEF has resurrected our older Thinkpads for general A version of W use on more than one occasion. So when we saw the lightweight that there was a beta for MX Linux on the Raspberry Pi MX Linux (Fluxbox-RaspberryPi Respin “Ragout” is the project’s full distribution for name) we had to take the opportunity to take it for a spin. the Raspberry Pi MX Linux for the Raspberry Pi is a community respin 3, 4 and 400. compatible with Raspberry Pi 3 and above machines Based upon including the Raspberry Pi 400. It uses a unique Raspberry Pi implementation of Fluxbox, with a pinch of Gnome, Xfce OS, MX Linux and LXDE thrown in for good measure. Under the hood provides great it’s Raspberry Pi OS (formerly Raspbian) and so we can Press the Super key to access this applications menu. compatibility update and manage our system using the apt packaging with existing tool and enjoy compatibility with HATs and add-ons for We tested the GPIO with the Python 3 GPIO zero library software and the Raspberry Pi. Also present is the Raspberry Pi and had a blinking LED in just a few moments. We add-ons Configuration tool. From here we can enable interfaces, extended the test to our trusty Pimoroni Explorer HAT Pro designed for the tweak our GPU and setup localisation for our Pi. board and after installing the Python 3 library we were Raspberry Pi. able to use every feature present on the board. We also The Fluxbox A familiar look and feel tested the official Raspberry Pi Camera and after enabling window MX Linux is Raspberry Pi OS with bells and whistles but the interface and rebooting our Pi we were able to take manager is it does run a little slower than Raspberry Pi OS from a pictures and video. lightweight and micro SD card. For best results a USB 3.0 SSD would MX Linux comes with the usual mix of productivity simple to use, prove a wise investment. The user interface “feels like apps such as LibreOffice. Classics such as GIMP and while offering a Linux”: there are the usual application trays, system Inkscape are missing, but they’re only an apt command retro-inspired trays and so on. A right-click menu enables you to away. If coding is more your thing, MX Linux comes with experience. call common applications such as web browser, file the latest version of Thonny so if you’re looking to use manager and the terminal. The Super (Windows) key MX Linux to power a Raspberry Pi Pico development also brings up a searchable menu of applications and environment, then you are in luck. If you are more of a we found this menu was the quickest way to navigate C or C++ developer then we managed to install and setup around. In fact this was the only way that we could find Visual Studio Code ready for Pico development. At a casual the monitor config tool for setting our resolution. On the whole, MX Linux for the Raspberry Pi is rather glance, MX Linux In general use, MX Linux works well. We were able to good. It’s as easy to use and light as what we’ve used on doesn’t look like plug in our Ethernet cable and get online, we then tested our Thinkpads. For a community project in beta we must much. It harks Wi-Fi and our 2.4GHz network was detected straightaway, recognise that they’ve nailed down the look and feel of back to a golden but our 5GHz network was nowhere to be seen – strange, MX Linux on such low-power hardware. It offers the age of Linux, while offering an but not a deal breaker. We tested Bluetooth and were able compatibility that we desire for our projects and add-ons enjoyable road to to send a file from our mobile device to the Pi. while breathing fresh air into the Linux distros on offer for the future. Can we use MX Linux for GPIO projects? Yes we can. the Raspberry Pi. It may not be 100 per cent of the way there yet, but it’s only a matter of time before this distro is up there with other contenders such as Twister OS.

VERDICT DEVELOPER: MX Linux WEB: https://mxlinux.org/mx-linux-blog LICENCE: GNU GPL v3

FEATURES 8/10 EASE OF USE 8/10 PERFORMANCE 7/10 DOCUMENTATION 8/10

The compatibility of Raspberry Pi OS, merged with the fun of classic Linux. Take this for a spin on your Raspberry Pi 4. Rating 8/10

www.techradar.com/pro/linux May 2021 LXF275 47 TUTORIALS Code in Scratch

SCRATCH 3 Escape from the evil space squids! Captain Les Pounder of the USS Rentaprize has to evade the clutches of the evil space squids, but can he do the maths to escape the planet?

lock-based coding is a great way to introduce B the concepts of coding, via an easy-to- understand mechanism. Blocks of code are stacked to create a flow, and if we encounter a mistake, we can easily pull the code apart to “debug”. OUR Scratch is a popular block editor and in this tutorial we’ll create a space escape game, where our rocket is EXPERT trapped on an alien world and we need to calculate the Les Pounder correct thrust for lift-off. If we get it wrong more than 10 is associate times then the evil space squids will get us. editor at Tom’s Scratch 3 should come pre-installed on your Hardware and Raspberry Pi OS image, but if it’s missing it can be Our finished game is a colourful and engaging way to test number a freelance installed from the main menu, under Preferences> skills and logic, but sadly it won’t get us into outer space. maker for hire. Recommended Software. Scratch 3 is found in the He blogs about Programming category; place a tick in the box and click to x: y: block so that it connects with the previous. Now his adventures Apply to install. Once installed,Scratch 3 can be found in when the game starts, the rocket returns to the planet. and projects the main menu under Programming. The next three blocks are all from Looks. The first is at bigl.es Open Scratch 3 . Before we write any code, let’s Switch costume – drag this and connect to the understand the interface. On the left are a series of previous blocks. Change the costume to rocketship-e . colour-coded, categorised blocks of code. These blocks Now drag two Say ___ for 2 seconds blocks and connect fall under categories that identify what they do: Motion to the previous. In the first Say block, we tell the player YOU NEED to move a sprite, Looks to change their appearance, that aliens are coming; in the next block we instruct the Control to create the logic for our code. The blocks are player to calculate the thrust for take-off. Any dragged into the centre area and then assembled into a Raspberry Pi project. In the top right of the screen we have the Stage Feeling gravity’s pull Raspberry Pi – this is where our code will run, we see things move Next we go to Variables and create three variables. The OS and we can interact with the code. Finally, in the bottom first is called gravity. Drag Set gravity to 0 and connect Breadboard right is where all of the sprites, the characters in our to the previous block. From operators drag the Pick LED game and the backdrop of our stage can be edited. random block and place it over the zero of the Set 330 Ohm We’ll start in the bottom right of the screen. The block. Change the numbers to be from one to 20. Create resistor default sprite is Scratch the cat, but for this game we another variable, Acceleration and repeat Pick random (Orange- can delete the cat by clicking the trashcan icon in the but keep the numbers as one to 10. So now we have two Orange-Brown- top right of the sprite. If you look to the bottom right variables that will generate random numbers for our Gold) there’s a blue cat icon. Click this icon to add a new game. The third variable is called force and for now we 2 x female- sprite. Search for rocket to use the sprite. Repeat just need to create it – we’ll use it later. to-male this process and search for a sprite to act as our alien – We need to give the player a clue to escape the jumper wires we chose a squid. Just to the right is a blue icon that planet. For this we use another Say block, but this time Code: changes the look of the stage, a backdrop. Click the we go to Operators and drag a Join block over the text https://github. icon and select a space-themed backdrop. of Say . In the first blank of Join we say Sensors show com/lesp/ Make sure that your rocket sprite is selected, left the gravity is , and in the second we drag the gravity LXF275- click the sprite. We’ll start writing the code for our game. block from Variables. This block updates with a random PiUser- First we go to Events and drag When Green Flag value each time the game starts. Next we drag Set force SpaceEscape/ Clicked . This will start our game when the green flag from Variables and connect it to the previous. In our archive/main. above the stage is clicked. Drag the rocket sprite so that case force is a calculation, so we need to go to zip it’s resting on the planet. Go to Motion and drag the Go Operators and drag __ * __ into the Set block. Then

48 LXF275 May 2021 www.linuxformat.com Code in Scratch TUTORIALS

drag the gravity and acceleration blocks from Variables so that force = gravity * acceleration. Note we only want the gravity variable visible. To turn off the others click the tickbox next to their name in Variables. Ten chances and counting… So we have the data now we need to code the game mechanism. For this we need to give the player 10 chances for take-off. From Control drag repeat 10 into the coding area and connect to the previous blocks. We now need a means for the player to make their guess – Sprites are characters in a game. In our case the rocket and squid alien are sprites. Each sprite can for this we go to Sensing and drag the Ask __ and wait have its own programming and they can talk to one another. block into the repeat 10 loop. Change the text to read Thrust calculation? . Each time the player guess, their calculations… , then go back to Looks, drag Say and answer is stored in a special variable called answer alter the text to BLAST OFF . which is located in the Sensing section. Again, back to Looks. We chose switch the costume Force is the Next drag three if blocks and place them to rocketship-a , which changes the sprite so that we mass of an underneath the question, inside the repeat 10 loop. have a plume of fire thrusting the rocket upwards. To object multiplied Ensure they’re stacked upon one another and not inside give the rocket motion, drag the rocket to the top centre by acceleration, each other. Each if is a question to check the player’s of the screen, so that only the plume of fire is visible. Go but our game guess against the answer stored in the force variable. to Motion, and drag glide _ secs to x: _ y: _ into the is just a The if statement has a hexagon-shaped box, in which code. The x and y values will be populated by the maths guessing we’re going to drag a block that compares two values. current position of the rocket. The final block inside this game, and not something used Found in Operators, we first drag __ > 50 and place it in if statement is Stop all and it’s found in Control. for future space the first if hexagon. From Sensing we drag the answer The final block in this game is outside the repeat 10 missions. block and place in the first blank. Then from Variables and if statements. From Events we drag broadcast and we drag force and place that over the 50 . So this change the message to read attack . This broadcast will statement checks if the user’s answer is greater than signal our alien sprite. the force needed to escape. If that is correct (true) Click the alien to start writing code for that sprite. inside that if statement we place a say block from The first block is from Events and it’s When I receive __ Looks and we change the text to alert the player that , drag this and change it to attack . This means the code there’s too much thrust and we must abort. will run when the player loses. From control drag a For the next if statement we repeat the same repeat 10 block and inside place the following blocks process, but use a __ < 50 and change the text to say from Looks, Show , change color effect by 25 , next that there’s insufficient thrust for take-off. The final if costume and change size by 10 . Lastly from Control statement checks to see if the user’s guess is the same place wait 1 seconds inside the loop. Change the as the answer stored in the force variable. This uses duration to 0.5 seconds. Our last piece of code uses the __ = 50 block from Operators and the same answer When Green Flag Clicked from Events, and from Looks and force blocks as before. If this statement is correct, we use hide to make sure the alien hides until the end! we go to Looks and drag the think block into the if Click the Green Flag to start the game, and try to statement. We alter the text to Checking thrust escape from the evil space squids!

SCRATCH 3.0 AND THE GPIO

Scratch is much more than just for making games. We can also use the GPIO from Scratch 3.0. In the bottom left of the screen there’s a blue folder icon. Click this to open the Extensions menu. Scroll down to Raspberry Pi GPIO and click to install. This adds another set of blocks to the menu. Next we need to connect an LED, 330 Ohm resistor to a breadboard, and using two male-to-female jumper wires connect to the GPIO (see download for a detailed diagram). In Scratch go to Events and drag When Green Flag Clicked into the coding area. Then from Control drag repeat 10 . From the Raspberry Pi GPIO drag set gpio 0 to output high and place it inside the loop. Change the 0 to 17 because we’re using GPIO 17. Now drag wait 1 seconds from Control and change to 0.1 seconds. Drag another set gpio 0 to output high and change 0 to 17, and high to low. Place another wait 1 seconds into the loop. Change the duration to 0.1 again. When you’re ready, click the green flag to start the code and If conditional statements are questions in code. They check to see if you’ll see a flashing LED. something is true, and if so then a section of code is activated.

GET YOUR Pi FILLING HERE Subscribe now at http://bit.ly/LinuxFormat www.techradar.com/pro/linux May 2021 LXF275 49 TUTORIALS Ohm measurement

The code PI PICO Get it from linuxformat. com/archives and part New tricks for one! the Pico voltmeter Tam Hanna expands his basic Raspberry Pi Pico voltmeter to improve accuracy and add a resistor measurement capability.

he voltmeter built at the end of the last issue If lsim1==lsim2, UR1==UR2 T introduced basic metrology. It suffered from 1N4148 low accuracy because the input current of the 21 Raspberry Pi Pico caused high voltage losses across the D1 protection resistor. In this follow-up instalment, we’ll use 22++11Sim1 Sim2 an operational amplifier to solve this problem. We’ll also R R R1 OUR R2 add a mode for measuring resistances. 11-- 22I_CONST I_CONST EXPERT Just as in last month’s issue, the goal of this tutorial Tam Hanna isn’t to create the perfect tabletop multimeter. Instead, A current source doesn’t care much about additional protective has developed, we want to demonstrate additional metrological elements, such as diodes. prototyped and concepts and inspire you to perform more experiments manufactured on your own. Fortunately, such a component exists in the form of hardware for an operational amplifier. An OpAmp is a highly versatile various civil The current must flow component that can be configured to act as a buffer. and military A resistor in series with the ADC input turned out to This configuration is commonly called a voltage buffer applications. be a great way to make the multimeter more resilient. or voltage follower (see diagram, bottom-left). Connecting 5V to the ADC input would normally destroy We need to make the necessary adjustments and the Raspberry Pi Pico, but our system survived even perform a quick test. First, connect the output to the with the reduced value of the protection resistor. This, 3.3 voltage rail. This should trigger the low mode that however, isn’t ideal. Practical multimeters regularly worked perfectly before – unfortunately, we see a value face hundreds or even thousands of volts in spurious of about 2V. This problem is caused by the presence of inputs. Undoing this resistor value reduction would be the operational amplifier. The next attempt involves beneficial for the longevity of the product, but we need connecting 5V – switching action doesn’t take place. to solve the problem of the ADC input current. This behaviour is caused by limitations of the To recap, our problem is caused by the current OpAmp circuitry, because reel-to-reel operation (the flowing into the ADC. It’s a piece of circuitry that output being able to reach both ground and the positive performs a relatively complex computation. Logic supply voltage) isn’t possible on the LM324. This dictates that this requires current. commonly available and affordable operational amplifier Solving this problem sounds easy in theory. If we states that about 1.5V of headroom must remain could integrate another component that handles the between the positive supply and the maximum voltage output current of the ADC then all of our accuracy possible on the output pin. problems would vanish in the blink of a flashing LED. While we could address this problem by selecting a different operational amplifier, we’ll instead accept the limited range. This requires us to adjust the value for +3V the lower switching limit, which now looks like this: if switchval > 37000 and low_on == 1: 4 47K 3 low_on = 0; ADC0 2 1 mode_lovol.off() #CAVE SEQ! R3 LM324AN 2 1 mode_hivol.on() 2 If you kept the circuit from last issue’s instalment, C1

1 100nF you can now proceed to connecting either 3.3V or 5V to the input. In both cases, switching will take place and the results returned will be accurate. Adding this circuit solves the current flow problem. Given that the current flowing through the protection resistor is now significantly smaller, we could return to

50 LXF275 May 2021 www.linuxformat.com Ohm measurement TUTORIALS

undoing the circuit modifications. We could increase the Measurement is protection resistors value to something like 50K. We greatly simplified could also increase the value of the lower resistor from by a current source architecture. 68K, which would give us a wider input range. This text intentionally skimps on these improvements in order to make circuitry flaws in the ohmmeter easier to spot. If you plan to use this circuitry productively then please, by all means, adjust your resistor values. It’s all about the ohms! It’s straightforward to introduce current measurements to a voltmeter. Add a set of shunt resistors, route the OpAmp current to be measured through them and then voltage reference. Figure four (overleaf) shows the production measure the voltage. Another challenge involves adding resulting circuit that looks similar to a voltage divider. is a highly ohmmeter functionality to our little experiment. The ADC voltage input is connected across the competitive For the following steps, we shall assume that the unknown resistor (commonly called Z). We measure a market. device to be tested is a classic resistor whose behaviour voltage determined by the selected range resistor, the This leads to excellent is fully described by Ohm’s law. If we know the values reference voltage and the value of Z. Given that our datasheets for voltage and current then we can easily determine multimeter has significant computational resources, we and useful the resistance. can use a circuit model to obtain a reasonably accurate component If we were working on a desktop-class multimeter, swipe at the unknown resistor’s value. selection web the next step would be simple. We would create an The next question at hand determines the resistor pages. If you adjustable current source that can produce a variety of values. Given that we want the maximum change over feel like learning highly accurate currents. the active range, it’s obvious that one known resistor more about Selecting a current source has practical benefits. It can’t handle all values. Bear in mind that our ADC only the magic means that we don’t have to worry about protective has a limited amount of resolution, and is happy to see of OpAmps, elements such as diodes placed in series between the “motion” over the measuring range. visit Analog Devices, Texas current source and the resistor. The voltage drop Be that as it may, this author decided to use a 1K and Instruments, caused by the protective element would be a 100K resistor. The actual modifications to the circuit or STMicro- compensated for by an increased drive voltage in the are relatively simple: we added two more relays, along electronics and current source (see diagram, left). with two additional GPIO pins for the relay driving circuit see what options This, incidentally, also explains why we need different we discussed in last month’s tutorial. are available. current levels. If the drive current is high and a high- Next, we return to the Thonny IDE to modify our value resistor drops by, then our current source would micrometer’s firmware. Because this isn’t going to be a need to settle to an insanely high (and dangerous) tutorial in user-interface design, the mode change drive voltage. between voltmeter and ohmmeter takes place in Using the current source configuration simplifies firmware. Should you want to add a professional touch measuring very low resistances. The testing leads that to this little product, consider adding a switch to the connect the multimeter to the resistor under test have breadboard installation. resistance, which results in a voltage drop. A current source permits the configuration that’s shown in the sketch (above right). The grey wires carry OPERATIONAL AMPLIFIERS the drive current and experience a significant voltage drop. The green wires carry the small sensing current An operational amplifier wants to have a voltage difference of zero driving analog to digital converter. between inverting and non-inverting input. Inputs being inputs, the They’re connected as close as possible to the OpAmp can’t affect the voltages present. Instead, it modifies the resistor under test, leading to relatively accurate output and hopes that a feedback circuit supplied by the developer measurements - this author’s YouTube channel has a enables it to achieve its goal. In the case of our buffer circuit, the video tutorial at www.youtube.com/watch?v=LAmc1_ situation is simple. The output voltage is equal to the voltage at the PtYAs on the topic. terminal Vminus – given that the input voltage is applied to Vplus, setting Vout to Vplus satisfies the condition. Do it cheaper! Fortunately, using operational amplifiers usually doesn’t require a Having a solid grasp of the fundamentals of electrical deep level of technical knowledge. In many cases, it’s enough to take a engineering greatly simplifies metrological tasks. An well-known application circuit and modify the values of the passives. ingenious approach to resistor measurement has been A common example for this would be an adder, subtractor, inverting in low-end meters for quite some time. It became or non-inverting amplifier. possible thanks to cheap, high-performance Both electronics books and electronics YouTubers provide dozens microcontrollers. Software and modelling could then be of different approaches to the OpAmp question. It’s worth mentioning used to improve measurement accuracy. that OpAmps are quite cheap, so there’s plenty of opportunity to do The idea behind this approach is to use a set of some breadboarding if you’re unsure about how a concept works. known resistors, which are connected to a known

SET UP YOUR OWN RESISTANCE Subscribe now at http://bit.ly/LinuxFormat www.techradar.com/pro/linux May 2021 LXF275 51 TUTORIALS Ohm measurement

The following changes need to be made to the code: if low_ohm_on == 1: mode_ohmlo = Pin(14, Pin.OUT) r = 1000 Cheap mode_ohmhi = Pin(15, Pin.OUT) z = ( -1 * r * voltage_seen)/(voltage_seen - 5) commodity low_ohm_on = 0; else: multimeters oled = SSD1306_SPI(128, 64, spi, dc, res, cs) r = 100000 usually come adc = machine.ADC(0) z = ( -1 * r * voltage_seen)/(voltage_seen - 5) with limited . . . oled.text(str(voltage_seen) + “volt”,15,15) documentation. mode_ohmlo.on() oled.text(str(z) + “ohms”,5,5) Lygte-Info mode_ohmhi.off() Understanding the code isn’t difficult. Just as in last from Denmark First, we need to configure two more GPIO pins – month’s instalment, we start by grabbing four samples provides they control the behaviour of the ohmmeter circuitry. from the ADC and averaging them to eliminate noise. detailed analysis Should you want to play it safe, feel free to run a quick Next, a bit of conversion is done to ensure that value in of low-end products. Visit test by switching the relays for a few times. Ohms can be shown on the organic display. The formula https://lygte- Second, we need to return to the measurement loop. can be derived from the law of voltage dividers. info.dk/info/ As before, it’s responsible for collecting input and With these modifications, we can proceed to run a DMMDesign moving it to the SSD1306 display: few tests. Let’s start by shorting the input terminal to Protection while True: ground. The unit will now see about 0.14 volts, giving us UK.html and reading = adc.read_u16() * conversion_factor a computed value of around 30 Ohms. We can use this click through to . . . information to make a small “nulling” correction – learn more. voltage_seen = 0 asking users to perform a manual null was common in if low_on == 1: older, high-end test equipment: voltage_seen =reading / 4; voltage_seen = voltage_seen - 0.14 else: z = 0 voltage_seen =reading * 7.8 / 4; After this change we measured a few resistors. z = 0 Nominal Measured, RPi Pico 220 Ohms 217 Ohms REF 1k 617/1,127 Ohms, volt range switches 4k7 5,600 Ohms 10k 13,600 Ohms 2 2 2 47k Negative value (open circuit) 1 SW1 1 1 SW2 SW3 Schliesser Schliesser Schliesser At this current stage our multimeter has two problems: first, the permanent switching when confronted with a 1K resistor; and second, the lack of a 2 2 2 mode that’s well-suited to higher resistors. Let’s address the second problem first; the following R2 R R3 R R4 1 R 1 1 bit of code switches ranges on demand. It’s interesting in that it uses the actual measured value for switching. This is an approach that can save a lot of effort with conversion of data: oled.text(str(z) + “ohms”,5,5) SENSE 2 if z > 2500 and low_ohm_on = 1: low_ohm_on == 0; R1 R mode_ohmlo.off() Let’s take 1 mode_ohmhi.on() advantage of the humble elif z < 2500 and low_ohm_on = 0: voltage divider. low_ohm_on == 1;

CIRCUIT TRICKERY INSPIRATION

Getting more value out of our little Given that we already have an ground (usually) is but a voltage level multimeter can be achieved by a variety operational amplifier in our circuit, why defined as such. of steps. Incidentally, selecting more not use an adder to expand the Another improvement would be to accurate resistors isn’t high on the multimeter to being able to measure replace the affordable but a bit clunky bucket list – in modern metrology, negative voltages. If you have an input Songle relays with a more modern temporal stability beats accuracy range of, say, -1.5 V to +1.5 V, adding equivalent. Depending on the circuit every time. +1.5V yields an ADC range of 0 to 3V. configuration, analog switches (of good Instead, making maximum use of the Alternatively, “levitate away” the quality, mind) have found use in various ADCs input range would be nice. Use a ground potential of the Raspberry Pi Pico high-performance multimeters. more modern operational amplifier with to offset it from the input range. As long Finally, why not make use of the rail-to-rail capabilities to achieve as your trinket isn’t connected to the organic display’s graphic capabilities to improvements in this area. physical earth or mains ground, then create histograms or a trend view?

52 LXF275 May 2021 www.linuxformat.com Ohm measurement TUTORIALS

mode_ohmhi.off() Given that we have a total measuring resistor bank of mode_ohmlo.on() 78K, we apply the law of parallel resistances to the pair. At this point, we can repeat a test. It delivers It gives us an equivalent resistance of 43.82 kOhms, Interactions improved values, but these still aren’t perfect. which is very close to our measured value. between test Interestingly, almost all values measured in the high All the rambling about software correction now gives equipment range are far too small. us one last hurrah: the law of parallel resistors enables and the device under test are Nominal Measured, RPi Pico us to compute the measurement resistor’s impact. Ignoring inaccuracies in the 10 per cent range – the a interesting 220 Ohms n/a resistors used for this project were notoriously phenomenon. 1k n/a inaccurate, cheap ones – we can proceed like this: An old Austrian adage states z = 0 4k7 2,600 Ohms that the brain of if low_ohm_on == 1: 10k 6,700 Ohms the metrologist r = 1000 must never 47k 27,600 Ohms z = ( -1 * r * voltage_seen)/(voltage_seen - 5) be switched Metrology is fascinating because it’s a highly intricate else: off during science: improving parameter A can influence B and C r = 100000 metrology. Keep negatively. The offset correction we applied above z = ( -1 * r * voltage_seen)/(voltage_seen - 5) this in mind if now bites us. The best solution involves removing the z = 1/((1/z) - (1/78000)) something is subtraction for now, yielding the improved situation in oled.text(str(voltage_seen) + “volt”,15,15) behaving oddly, or it might be the following table: oled.text(str(z) + “ohms”,5,5) your multimeter At this point, the measurement of the 100k resistor Nominal Measured, RPi Pico or oscilloscope turned out to be more accurate. However, the accuracy 220 Ohms 256 Ohms that’s affecting for smaller values has become even worse. Given that the circuit’s 1k 733/1,300 Ohms (switches around) many of these values already were too small before, operation. 4k7 5,500 Ohms calibration and/or an analysis of the amplifier is required. This is a topic that’s beyond the scope of this 10k 9,900 Ohms article for now. 47k 31,000 Ohms Nominal Measured, RPi Pico 100k Negative value At this point, we find out that switching to the high 220 n/a ranges isn’t always accomplished. If the meters leads 2k n/a are left open (aka infinite, or almost infinite resistance), 4k7 6.1k Ohms then we see a negative value. Given that high values are 10k 11.6 kOhm always best handled in the High mode, modify the switching routine like this: 47k 63 kOhm if z > 2500 and low_ohm_on == 1: 100k 113 kOhm low_ohm_on = 0; Have the following steps always taken the most direct mode_ohmlo.off() way to the target? Definitely not. Have our experiments mode_ohmhi.on() shown a variety of valuable mental approaches to elif z < 0 and low_ohm_on == 1: problems? Hopefully yes! Developing electronics is an low_ohm_on = 0; iterative process – more than one prototype that initially mode_ohmlo.off() looked hopeless turned out to be a successful mode_ohmhi.on() consumer or military product. We hope that our little elif z < 2500 and low_ohm_on == 0: experiments have motivated you enough to take further low_ohm_on = 1; steps into the realms of metrology… mode_ohmhi.off() mode_ohmlo.on() +5V At this point, we can try the 100k resistor once again

– it consistently reads as 45k or so. 3 5 1 2 RE1 1N4148

D1 1 Improving operations SONGLE 4 2

It takes but a cursory glance at the table to realise that ENABLE LOW R2 the very high values are starting to become inaccurate. 1 T1 1 2 R4 1K This isn’t caused by contamination of the resistors, 1100 2 2 3 BC547 though. While high-value resistors don’t like being in Z_HIGH contact with skin, the amount of fat an average person’s +5V fingers can deposit isn’t enough to explain these value changes. In addition to that, the difference wasn’t visible 3 5 1 on the Keithley 177 that was used for comparison. So, 2

something else is afoot. RE2

1 1N4148 SONGLE 4 2 D2 Understanding the problem requires us to take a R1 step back. Earlier, we discussed how test equipment ENABLE_HI 1 2 R5 1 T2 100K affects the behaviour of the device under test. In the 1 2 2 BC547 Adding ohmmeter 100 3 case of the ohmmeter, the unknown resistor is switched mode isn’t all in parallel to our measuring resistor chain. that difficult.

www.techradar.com/pro/linux May 2021 LXF275 53 ALL YOUR DATABASE ARE BELONG TO US With the help of Patrick McFadin, the Datastax database guru, Jonni Bidwell gets a handle on the wherefore and why of Kubernetes.

t the risk of overextending an equally expensive infrastructure. Now, thanks already slightly dubious to Astra – Datastax’s managed Cassandra metaphor, Kubernetes (k8s) is offering – anyone can have a go. There’s even A fast becoming the operating a free tier for those looking to get started. But system of the cloud. But how did we get as we’ll hear, the evolution continues and to this point? And how do complicated K8ssandra is at the cutting edge of it. projects migrate to it? Leveraging the power and of We were lucky enough to chat to Patrick Kubernetes, and using knowledge from Astra, McFadin, VP of developer relations at Datastax it makes it possible for organisations to run and K8ssandra (an open source, cloud-native Cassandra how and where they like. Be it in distribution of Apache Cassandra) developer. the cloud, on premises, or in some sort of As far as projects go, they don’t come much hybrid arrangement. more complicated than the Cassandra Using K8ssandra as a case study, we’ll database, it powers everything from Facebook discover why Kubernetes has become the de to Netflix to the New York Times. facto standard for cloud native computing, In the past, deploying Cassandra required and why Cassandra is such a marvellous an expensive team of eggheads and some NoSQL database.

54 LXF275 May 2021 www.linuxformat.com Patrick McFadin IN-DEPTH

e like Docker because we can run programs easily and run them anywhere. In the past we W might have had to jump through compilation hoops to get the latest version of Blender working on Slackware; now we can run it with a single command. And thanks to trends like Microservices and DevOps, enterprises have also been embracing containers. But wherever you have a distributed system, beyond a cluster in your basement, you have complications. Writing code that isn’t tied to an individual host isn’t something that comes naturally to most people. But some people relish in challenge, and one of them is Patrick McFadin. He told us how he got involved in Linux, and in particular databases. “My degree was in distributed computing, and I did that back in the 90s when Sun was big. I was fanatical about them and their ‘the network is the computer’ maxim. So my computer science career grew up in terms of the Internet, which was pretty unique. But it was interesting because it was always these three things: the operating system, the out, and that was just one of those seminal papers that If you want to delivery mechanism and the database. Those were the says, ‘Ah ha. Here’s some computer science about how get started with three things needed by every Internet thing. we store data across distributed systems, maintain Kubernetes then check “I started out in infrastructure – I was a Linux Kernel consistency, maintain availability and build to scale.’ Two out minikube, contributor back in 93 or 94. I was working in university of the authors of that paper went and built Cassandra, microk8s or Kind and we were putting network cards into Linux servers. which was built on a lot of core ideas in the Dynamo – all suitable for Of course, when you get a brand new network card paper, but added a more useful data model on top of it. deployment on a single host. from 3Com, there’s no driver for it. So my boss would “When that explosion of NoSQL happened, it was throw it on my desk and say, ‘Figure it out.’ But that’s around that time when Facebook were saying, ‘We’re how we did internet back in the 90s. After that I going to have a billion users.’ Google was doing things at migrated over to the database side, just because it incredible scale, and companies like Netflix were coming was a more interesting field for me. That’s where you up quickly behind them. These are the scale companies, got to use the really cool hardware – the Sun hardware.” the early adopters of scale. Not scaling would have ended their companies, so figuring this out was crucial. Database disruptor “I got involved in the project in 2011. I was working as You may not have heard of Cassandra, but you’ve the chief architect at an education company, and we almost certainly used it if you’ve looked at any major were having the same problems. I couldn’t afford to websites in the past 15 years. Born and open sourced by have a database fail, and if I needed downtime I had to Facebook and adopted by Apache in 2009, Cassandra schedule it for 3am on a Sunday morning – it was shook up the database landscape, as Patrick explains. always at crazy times. If the database went offline, even “Databases traditionally were on a single server and for just a little bit, it would cause havoc. it became clear in the mid-2000s that we were running So I was looking at how I could get systems that out of database faster than we were running out of would never fail. But also ones that would scale. And anything. It was turning into the bottleneck for every that’s how I came across Cassandra. I had a smaller interaction that we had. If you look at the 2005-2010 system that I didn’t have to change too much to put into timeframe, there was a great explosion of distributed Cassandra. Then we had this high load event, and the database thought. In 2005 the DynamoDB paper came only database that held up throughout it was

CASSANDRA, THE CURSED ORACLE

Distributed computing isn’t something Even though my background was in distributed systems fail in complex and that comes naturally to most people, but distributed computing, most of what I different ways that you’re probably not the benefits, particularly to databases, had to manage was on a single server. prepared to deal with. It’s a competency are enormous. We let Patrick tell all. When we start talking to systems that you learn over time. “Cassandra is a distributed system administrators about distributed “My first day on the job I was working and I think most distributed systems systems it takes some work for us to with this huge company and they told come with a bit of a tax. We’ve built start thinking in terms of, well, systems. me, ‘We’re going get rid of every bit of systems around this idea that CPU and “When I deploy a server, it’s just a part Oracle and replace it with Cassandra.’ memory are expensive resources that of a team. That’s not strictly new I did that for almost a year. we have to manage carefully, and we thinking, but it’s a niche way of doing “That’s been the consistent thing with build systems on a single servers. systems administrations when you’re Cassandra: we can’t afford downtime, “Most of my career I was building doing distributed anything. Cassandra and we need to be able to scale when we things on a single server that might talk falls into that bucket for sure. One of the need it. That’s what that database is to another server for some interaction. most important things you realise is that really good for.”

www.techradar.com/pro/linux May 2021 LXF275 55 IN-DEPTH Patrick McFadin

Cassandra. All the other databases were struggling and It appears Patrick has succeeded, but not one to rest failing. What was amazing to me was the system that on his laurels, because he’s taking Cassandra to new was watching them all, Cassandra, was perfectly fine. heights. We asked him what his day-to-day job involves. The second thing that was interesting was this “I do developer relations, a lot of developer strategy. database was all deployed on Amazon in 2012, and Right now one of the main things I’m working on in Amazon had a huge outage in one of their Availability making Cassandra more accessible to developers. Zones. And I didn’t even notice. I came in on Monday, Developer relations isn’t just about talking and giving saw a node was offline, and my colleagues told me what presentations to developers. It’s also going inside the happened and it was just amazing to see that it didn’t company and advocating for developers. So devs who bring down other systems. That’s when I knew this was want to use Cassandra tell me this is a hard thing to do. the database for me! Because it could put up with Operators are a hard thing to deploy. So I do a lot of Amazon’s crappy infrastructure. And that’s when I talks. I also do a lot of work in engineering and product joined DataStax, I wanted to make this database the teams. I’m working on K8ssandra, which is our attempt best in the world.” to make Cassandra as easy as possible to deploy, without compromising. That’s using Kubernetes.” Learning from history Ah and there’s the rub. Kubernetes was launched by Google in 2015 and aims to automate, standardise and perhaps revolutionise container orchestrations. Patrick’s take on this: “As an infrastructure person, I’m always going to be sceptical until I see what it does. Let’s do the Wayback Machine thing. We went through this before with virtualisation. I think in the early 2000s it started to go mainstream. You can stack a bunch of virtual machines on a single piece of larger hardware and get better use of your infrastructure. That’s where VMware and Xen and VirtualBox took off and VMs became the norm. Then we start doing this container thing, which is a cleaner way of virtualising workloads. “So we were in this world where we were good at Patrick does a lot deploying VMs, and then containers came out, we of talking, seen here in Japan, but realised this is probably the right way to do it but we he does a lot of have a very bad way of doing it. The thing that I see developing too. Kubernetes presented, and Mesos and Nomad did this

AD ASTRA

The K8ssandra effort was essentially “Last week we just released the me as an open source guy, is that we’re born out of a DataStax-managed serverless version of Cassandra in Astra. doing this in Astra right now. But after Cassandra service, dubbed Astra. We got I think this is going to be groundbreaking. the Cassandra 4.0 release we’ll be Patrick to tell us more about this. First, it puts Cassandra more in line with publishing our proposal to the project as “As a developer advocate I love Astra, how people expect to consume the a means to move Cassandra closer to and not just because it makes Cassandra cloud. Instead of dreaming up a Kubernetes. Inside Astra that’s all that’s a lot easier for everyone to use. provisioning strategy, thinking, ‘I need going on, Kubernetes and Cassandra. Cassandra relies on thoughtful this much Cassandra’ and paying for it “We’re learning how to make contributions from an engaged every single month, and paying more if Cassandra better inside Kubernetes and community. And we’re now involved you need more, with serverless Astra you we want to share that with the open some of the biggest-scale Cassandra just pay for what you need. The compute, source community.” deployments out there. So we get it, and storage and networking the things we’re doing for the Cassandra are all in separate parts DataStax Astra product from an effort standpoint are and you pay for those was a precursor around that. as you use them. So if to K8ssandra. “In product terms, DataStax Astra you need a million is Cassandra as a Service. It’s also an writes per second for 10 opportunity for people who’d never minutes, you pay for use Cassandra. If they need scale and that, and if you stop, uptime and elasticity in their database, then you just pay for the they’d probably be a little nervous storage. That’s what about using Cassandra because of the people expect. operational headache. Now you can just “The second thing, leave that to us. which is really cool for

56 LXF275 May 2021 www.linuxformat.com Patrick McFadin IN-DEPTH

The type of too, was that it enabled you to create virtual storage that you datacentres. This is like the next layer down. use will make or “So you can virtualise all your infrastructure, you break a database, have software defined networking, containers says Patrick. attachable storage, virtual storage. But how do we orchestrate all of that? In a virtual datacentre. And of those three that were vying in this space, Kubernetes shot to the top because of the way that it saw stateless workloads. At the time those were the hardest things to deploy at that scale. So that’s what fed it and made it take off. I can create a YAML file with a complete description of my datacentre, deploy it, and it’s stored in Git. We went over the line a bit storing our configurations with DevOps, but that was deploying a single server, or maybe a group of servers, but still a different proposition. We want to make sure that when we deploy something, in infrastructure, that it has code. “The three things for any infrastructure are network, compute and storage. And how to consume those. I’ve gotten confused by Docker volumes before, and container networking was like going back to the old Cisco IOS days – it was horrible. But you have to understand that this wasn’t built for humans to tinker with, this was built to be deployed by code. And composed too. It’s now composable as network, compute and storage. “So for a database, you want to make sure your kinds of blocks that are important too. Once you realise compute and your storage are closely aligned. Storage that, it makes more sense in how you deploy them. is the most important concept for any database. When “What’s interesting is that Kubernetes is becoming you’re deploying a web application, a Wordpress server more just a standard operating system for deployments. or the like, storage is ephemeral. Those stateless If you’re using Amazon or Google or Azure, they have applications that require state, the storage doesn’t have Kubernetes engines ready to go. So if you create a to be interesting, it just has to be available. So when you Kubernetes deployment, everything from the frontend do a write operation, data is committed to some block storage somewhere. Databases are a different story, because you will make or break your database based on ON CONTAINER FLASHBACKS the type of storage you use. “This has been a challenge and some really “I’ve gotten confused by Docker interesting parts of Kubernetes address this, such as stateful sets and persistent storage choices. This is a volumes before, and container fast-moving field right now. There’s a special interest group around storage in Kubernetes. The way that a networking was like going back to the container system like Docker or container works, is that every container needs to have an attached storage. old Cisco IOS days – it was horrible.” That way they just ask what kind of storage you want to attach. Does it need to stay there, be persistent, or does to the backend, you can take that to any cloud. And it need to be ephemeral? So we can get really simple that’s really interesting stuff. When we think about what with our questions and just define those in a document.” K8ssandra needs to be doing is to be a part of that, it’s not the only thing you’re deploying. But if we’re thinking Ready when disaster strikes about the maximum portability of your infrastructure, So, we wondered, what happens in K8ssandra when a virtualising entire datacentres, what if I want to take container or a pod (we learned some new nomenclature my datacentre to another provider? Well, let’s make it for this feature) falls over? And Patrick explained: as easy as possible. No database deployment should “That’s one of the things about K8ssandra that’s ever be a one-off. That’s not interesting anymore. You important – when you’re deploying a Cassandra should be developing applications that do things and workload, a good portion of that is how it manages the not winning awards for deploying a very critical piece storage attached to the compute. And keeping you from of infrastructure. having problems when a container goes offline. If that “I’m an old-school infrastructure guy and it took happens, it reinitialises the compute, attaches to the me a while to get my head around Kubernetes. A lot of same storage and sets up the network properly again. my home automation network now is running inside So it patches everything back together again just right. Kubernetes containers, but that’s cuz I’m crazy. Once “That’s getting into the world where I want more you get into this mode of ‘I was deploying virtual servers automation. I want that robot in my datacentre. before and now I’m deploying virtual datacentres,’ that’s Containers are like LEGO blocks, but there are other Kubernetes. Everything else is details.”

www.techradar.com/pro/linux May 2021 LXF275 57 TUTORIALS BYOBU Terminal multiplexer Shashank Sharma is enthralled by screen multiplexers, and Byobu presents an elegant and efficient approach to managing multiple windows.

erminal multiplexers such as Tmux and Screen are part of the daily routine for most T command-line warriors. These amazing tools can be used to run multiple shell sessions within a single terminal, or display more than one application in OUR a single window. But these tasks are beyond the capabilities of regular terminal emulators, and you must EXPERT use multiplexers. Shashank Although multiplexers such as Screen have been Sharma around since the late 1980s, they aren’t exactly is a trial lawyer in welcoming to new users or CLI novices. Byobu aims to New Delhi and an bridge the gap by providing a wrapper over multiplexers avid Arch user. such as Screen and Tmux, as well as add some features He’s always on to appeal to even new users. the look-out Released under the GPLv3 Licence, Byobu started its for geeky journey as a wrapper for Screen, and was only available The Byobu configuration files are stored under the ~/.byobu or the memorabilia. for Ubuntu. It has since adopted Tmux as the default ~/.config/byobu directory, depending on your distribution. underlying multiplexer and can be found in the software repositories of most popular distributions such as Byobu is a Japanese word that refers to a folding, Debian, Fedora, Arch and Gentoo. decorative, multi-panel screen typically used as If you’re running Debian or Ubuntu, or a derivative room dividers. It’s not a multiplexer itself, but an distribution, you can install Byobu with the sudo apt enhancement of the rather vanilla Screen and Tmux install byobu command. The sudi dnf install byobu multiplexers. It aims to provide a simplified and more command can similarly be used to install the project on welcoming user interface to these robust utilities. Byobu RPM-based distributions. While it’s possible to build it also stands out from these tools because of its status from source, the project itself recommends using your bar, located at the bottom, which is used to display distro’s package manager to install it. useful system information.

MAKING SENSE OF THE COPY MODE

Enter the copy mode Select text Paste selected text 1 You can enter the copy mode in any 2 To select text, first press Space and 3 You can paste the selection made Byobu screen or split pane by pressing then use the arrow keys to select all the text from one pane to another pane on the same Alt+PgUp. You’ll notice that you can now you’re interest in. You can select text across window, or onto a different window. Switch use the arrow keys to freely move through multiple lines. Next, press Enter to copy the to the target pane/window and then press all the text on the current pane. text and exit the copy mode. Alt+Insert.

58 LXF275 May 2021 www.linuxformat.com Terminal TUTORIALS

You can run Byobu by invoking the byobu command, Although it’s fairly easy to navigate between the without any command options. While Byobu defaults to different windows and split panes using the keybindings, Tmux as the underlying multiplexer, you can run the you can also enable mouse support within Byobu. Once If you find byobu-screen command instead if you prefer Screen. done, you can left-click to select the different panes and the default The latter command only works if you already have also drag-and-drop to increase or decrease the size of keybindings Screen installed. If not, make sure to install it using any pane. on Byobu the package manager on your distro or Byobu will exit You can exit a Byobu session, but still maintain the interfering with an error. layout of the different panes/windows. This is especially with some of the other If you’ve never used a multiplexer such as Tmux or useful because it saves time having to relaunch all the command- Screen, you should know that these tools enable you to different panes and windows that you require. To exit line tools or easily split the terminal into different panes. Each of the Byobu, but leave the session running in the background applications different panes acts as an independent terminal. This such that you can return to it anytime you want, press that you prefer makes it possible for you to perform myriad tasks from F6. This detaches the Byobu session, but keeps it to use, you can a single interface. quietly active in the background while you tackle more toggle them on/ After starting Byobu, you’ll be dropped to the shell pressing tasks. off by pressing prompt, with the status bar at the bottom of the Alt+F12. screen showing a wealth of information. The status bar Advanced usage shows, from left to right, the name and version of your There’s still more that you can do with Byobu, especially distribution, uptime, CPU and memory info, total disk if you spend a lot of time on the terminal. If your Byobu space and current date and time. screens and panes produce a lot of output, you can Before anything else, press the F9 key to launch search through it all using Byobu’s scrollback mode. Byobu’s Configuration menu. It has four entries. Your Press F7 to enter the scrollback mode. You can now first step should be to look through the Quick Start search backwards through the selected pane/window Guide from this Configuration menu. This lists all the by typing ? . You’ll notice that at the bottom of the keybindings that you can use with Byobu, such as screen, just above the status bar, a new (search up) bar pressing Ctrl+F2 to split the screen vertically or appears. Type the text you wish to look up, and hit Enter. Shift+arrow keys to navigate between the different split Byobu will automatically highlight all matches. panes. The easy availability of the Quick Start guide is a The scrollback mode defaults to searching useful addition by Byobu to multiplexers. downwards, but you can also confirm this by pressing / You can also use the Configuration Menu to change after entering scrollback mode. The bar at the bottom the information displayed in the status bar, by selecting now reads (search down). Toggle Status Notifications and pressing Enter. You can Once you have a split layout that you enjoy working then select the info you wish to be displayed in the with, you can save it for future use by pressing status bar. In addition to the information displayed Ctrl+Shift+F8. You’ll be prompted to provide a name by default, you can also make visible the IP address, for the layout. You can save different layouts, for battery status and more. different tasks, each with differently sized split panes. You’ll figure out the different keybindings with time, You can display a list of all saved layouts by running the but here are some of the most useful ones to help you byobu-layout list command. You can then restore a get started: saved layout by running the byobu-layout restore Useful Byobu keybindings command. Keybinding Function F2 Launch a new window F3 Navigate between the different windows Ctrl+F2 Create a vertical split on the current window Shift+F2 Create a horizontal split on the current window Shift+arrow Navigate between the splits on the current keys window F6 Exit Byobu, but keep it running in the background Ctrl+F6 Close the selected window/pane Shift+F8 Toggle between the layout grid templates Shift+F12 Toggle on/off Byobu keybindings Alt+F12 Toggle on/off mouse support Ctrl+Shift Toggle through random background +F5 colours for the status bar We’ve used the copy mode to select text in the first pane, and also decided to save the spilt layout for future use by pressing Ctrl+Shift+F8.

ENHANCE YOUR TERMINAL-FU Subscribe now at http://bit.ly/LinuxFormat www.techradar.com/pro/linux May 2021 LXF275 59 TUTORIALS Video conferencing

Credit: https://jitsi.org/jitsi-meet JITSI Run the perfect video- conference session Move over Zoom, Skype and all the rest – Nick Peers reveals how to set up your own public (and private) group video chats for free with Jitsi Meet.

hen it comes to web conferencing, Jitsi is king For this reason we’re going to concentrate on Jitsi W of the hill. Don’t believe us? Back in LXF217 it Meet, but if you’re desperate to run Jitsi Desktop then won our video-conferencing group test hands check out the box (page 62) for the workaround down with five-star ratings across the board. Take a trip required to get it up and running in your current distro. to the project’s home page at https://jitsi.org and you Why Jitsi Meet? OUR might be forgiven for thinking it’s a slightly fragmented project with a multitude of different tools, but ultimately The obvious reasons to choose Jitsi Meet over other EXPERT Jitsi can be boiled down to two basic products. web conference platforms are the fact it’s both open Nick Peers These days, Jitsi is focused on its web-based Jitsi source – so completely transparent – and free for both wonders why Meet platform (https://jitsi.org/jitsi-meet), designed personal and commercial use with support for up to 50 more people as an open-source and free alternative to the likes of participants. All calls are encrypted, and the service don’t use Jitsi to Zoom. The other product is a throwback to Jitsi’s early provides all the tools you’d expect from any good stay in touch. He existence as a multi-platform chat tool, but while Jitsi web-conferencing platform: pop-up chat, the ability can’t praise it Desktop still has its own website (https://desktop.jitsi. to share screens and even the opportunity to remotely highly enough! org), development ceased four years ago. control another participant’s desktop. It’s also easy to use – you can set up a meeting in Navigating your conference room seconds and share an invite with anyone who has a webcam and web browser. They don’t need to install any software, although free tools for desktop and mobile (Android and iOS) are available. Most people will be happy with Jitsi’s own servers, 1 but if you’re looking for a video-conferencing platform you can host yourself, check out Jitsi VideoBridge, which can be deployed on your own server should you wish to host your own conferences for privacy, security or 2 performance reasons. See the box (right) for details. Quick-fire Jitsi 3 You can set up a quick Jitsi Meet conference for home or work purposes without having to install any software 4 5 6 or set up an account. Open your web browser, go to https://meet.jit.si and then start typing the name of your meeting into the box. If you’re joining someone else’s meeting you can type the name of the meeting 1 Network status 4 Conference tools From this window you can get a quick-fire From left to right: open the public chat you were given, click the link they sent you or go directly look at your connection from the icon – green window, set up screen sharing, and put up your to https://meet.jit.si/MeetingName to join. is good, red is bad. hand to speak. If you’re setting up a meeting from scratch then you’ll see a message appear as you type, warning you that 2 User thumbnails 5 Core controls When you’re in full-screen view, click These enable you to quickly mute or the meeting room name is unsafe (in other words, easily someone else’s thumbnail to focus on their unmute your microphone, turn your video on guessable). This indicates how anyone will be able to join video screen. and off, or leave the conference. your meeting by entering it into the same box you did. We’ll reveal how to lock out unwanted ‘guests’ in a mo. 3 Control meetings 6 Additional options Roll your mouse over a participant’s Toggle tile view, invite more participants, Click Start Meeting. The first time you join, Jitsi will thumbnail to reveal more options for managing set security options for the conference and prompt you to give your microphone access, which you them during the call. access more options. can do as a one-time thing or tick Remember this

60 LXF275 May 2021 www.linuxformat.com Video conferencing TUTORIALS

decision to give all future Jitsi meetings access automatically. Repeat for your webcam. Next, enter your name as it will be displayed to others and either click Join meeting or – if you don’t want to be heard – click the down arrow next to the button and choose Join without audio’ You’ll find yourself in the main meeting, ready to welcome and – if necessary – invite others. Get set up in a jitsi… Before going further, let’s secure your meeting. Roll your mouse over the main window to reveal the various controls and click the yellow and orange shield icon at the bottom. From here you can secure your meeting by enabling a waiting room, which means anyone who attempts to join will have to wait for you to wave them Gallery view enables you to give all participants (including yourself) equal viewing space. in, plus add a password, which you’ll need to tell your participants about so they can join your meeting. participants, plus ensure your video is always the A third – experimental – option only shows up in primary one on show (tick Everyone follows me). browsers based on Chromium 83 or later, along with the Choose View Jitsi Meet desktop tool. Enable End-to-End Encryption Send an invite shortcuts makes it possible to lock your meetings down even Once you’re ready, click the people button next to the from the More tighter, but there are trade-offs. Several features security icon and you’ll be shown a link with option for actions menu to provided by the Jitsi servers, such as recording, live copying it so you can send it via instant message, plus reveal a slew of streaming and phone participation, won’t work. a Share meeting invitation drop-down that provides handy shortcuts to speed up Participants will also need to ensure their browsers additional options for placing the invitation in a pre- navigating Jitsi. support ‘insertable streams’ to gain access – which written email using one of your default client, or online For example, W seems to preclude mobile apps as well as Firefox users. Google, Outlook or Yahoo! accounts. Finally, the Embed toggles tile view You’ll also see a vertical ellipsis button – click this to this meeting option provides you with an iframe code on and off, while reveal settings on the More options menu, some of snippet for dropping into a web page or blog post. D enables you which you’ll want to examine now before you start your When people click the link to join your meeting, to quickly meeting. There’s a ‘Manage call quality’ option if you’re they’ll be prompted for the meeting password if you switch between on a low-bandwidth connection and wish to reduce the specified one, then will either come directly into the video and resolution of your stream to boost performance. meeting or be placed in your waiting room. If you’ve screen sharing. The Blur my background option will attempt to blur created the latter, a pop-up message will inform you everything except your face. There’s a performance that person is ready to enter. When you’re ready, you penalty involved, and your video’s frame rate will be can invite them in or kick them out. noticeably reduced, but if your browser is running with As people arrive, Jitsi will highlight one person’s video hardware acceleration enabled (and most are), then it while all other feeds are shown as thumbnails in the may be a trade-off you can live with. The option can right-hand pane (look for the > at the bottom to hide easily be toggled off from the same menu item. and show this pane). A new option will appear next to Before inviting other people into your meeting, take the invite button enabling you to switch between this the time to explore the options under Settings. Change and gallery (or tiled) view, where all feeds are shown your camera, mic and speaker settings via the Devices side-by-side. Each participant can choose their own tab if necessary. If you’re planning to use Jitsi to deliver layout unless you’ve chosen Everyone follows me. a remote presentation, switch to the More tab where If you opt to show one primary feed at a time, click you’ll find options enabling you to mute and hide other any other thumbnail to make that the default view

HOST YOUR OWN CONFERENCE

By default, Jitsu will host all your video from hosting their own meetings for free Rather than tread over old ground, chats on its own meet.jit.se platform, at your expense. we’ll direct you to page 34 of Jonni’s Build but it’s equally at home providing you Crucially, self-hosted Jitsi servers a Smart Home Office feature from LXF268, with the tools you need to build your aren’t too taxing on your hardware – which provides a quick-fire guide to own secure conferencing server, too. they’re run by Jitsi Videobridge, which getting going on the Raspberry Pi. You’ll There are several compelling reasons to simply forwards all audio and video feeds also find setup guides for Ubuntu Server do so (other than the obvious – “why directly to participants rather than mixing and Docker at https://jitsi.github.io/ not?”). Aside from the privacy angle, self- them first – that work is handled by each handbook along with the configuration hosted Jitsi servers can be configured client. This approach reduces latency, required to unlock ‘bonus’ features such specifically for your needs – for example, improves quality and makes Jitsi more as being able to set a specific moderator you can set up a secure domain that scalable. It’s WebRTC compatible too, for a conferencing session. This is, requires authenticated users to start and provides native packages for Ubuntu something that’s not possible with meet. new meetings to prevent drive-by users and Debian as well as a Docker container. jit.se-hosted conference calls.

www.techradar.com/pro/linux May 2021 LXF275 61 TUTORIALS Video conferencing

instead. Look out for icons showing on each thumbnail – you’ll see which person is speaking, whether someone If you’re running has raised their hand to speak, plus view the quality of a WordPress each person’s connection. website and would like to extend Jitsi Chat free-for-all meeting rooms Look out for another More options button as you roll to your site’s your mouse over a thumbnail. Here you can adjust the members, then person’s mic volume, mute them or mute everyone else install the free so they can be clearly heard by all. You can forcibly Buddymeet remove someone (you have no authority here!–ED) from plugin (https:// the conference by clicking Kick out, plus send a private wordpress. message to that person. It’s worth noting that these org/plugins/ controls are accessible to all participants, so you could There’s a visible performance penalty, but Jitsi’s background blur buddymeet), be kicked out of your own meeting! The solution – you’d function does a good job of reducing distracting background clutter. which makes it think – would be to appoint someone as a moderator, easy to embed conference but this isn’t supported when hosting meetings on the Click the Wave button and a notification will pop up rooms into meet.jit.se platform, only self-hosted ones. on everyone else’s screen telling them you’d like to your site via Once your participants have joined the chat, what speak (in addition, a blue hand icon will appear in the shortcodes. features are available to them? There are obvious tools person’s thumbnail, which will remain here until you for muting (and unmuting) both microphone and click the button again to lower your hand). camera as well as leaving the conference, and in the On the left is the Chat button – click this and a public bottom left-hand corner you’ll find three further buttons chat message box will slide into place. Anything typed that are worth investigating. here can be read by everyone, and when someone adds to the conversation, other people’s chat icons will turn blue as a form of notification. This is in addition to the WHITHER JITSI DESKTOP? private chat option outlined above.

Once upon a time Jitsi was far more than a simple web-conferencing Share your screen solution. The full-blown Jitsi Desktop package worked like any other One of Jitsi’s most useful conferencing tools is the ability chat tool, with users able to combine one-to-one chat, audio and to share part or all of your screen with others. When you video messaging with group calling features across SIP, XMPP and click the middle button you’ll be asked whether you Google Talk platforms. But since 2017, Jitsi development has pivoted want to share your entire desktop or a specific program away firmly in favour of Jitsi Meet, and the Java-based program is now window. Make your choice and your video will disappear, effectively discontinued. to be replaced by the window in question. Once you’re If you’re desperate to use it, head over to https://desktop.jitsi.org/ done sharing it, click the Share your screen button again Main/Download.html and download the Ubuntu package directly to to revert to your standard video. your PC. Once done, double-clicking the .deb package will enable What sets Jitsi apart from many other conferencing you to install the program through the Software Centre. But when tools is that you’re not restricted to just one screen you attempt to launch it, you’ll find Jitsi hangs on startup at the share at a time from a single individual. Jitsi can NimbuzzAvatars screen, because it only works with version 8 of Java. accommodate multiple screen shares from any number To fix this, open System Monitor and kill the Java process to close of individuals dialled in on computer. the program. Now open Terminal and issue the following command: $ update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/ And there’s more jre/bin/java If you open the main More actions menu again in the Jitsi Desktop will now work as it should, enabling you to connect to bottom right-hand corner of the screen, you can now your chat accounts for the purpose of staying in touch with others. explore three additional conferencing options. If you click Share a YouTube video then you’ll prompted you to enter the URL of your chosen video, and then it’ll be streamed to your conferencing partners as an additional video feed. During playback you’ll have access to all the usual YouTube playback controls as well as easy access to related content on YouTube. When you’re done, choose Stop YouTube video to end the feed. You can also record your conference as a video for playing back later by selecting Start recording. Note that this option requires you to have a Dropbox account, and once logged in you’ll be told how much available storage you have on your account, and how many minutes recording that translates to (approximately 10MB is required for each minute of footage). Click Jitsi Desktop still works in later versions of Ubuntu, but you’ll need to get around a Start recording and wait until the voiceover confirms compatibility problem first. recording has started. When you’re done, select Stop Recording from the More actions menu.

62 LXF275 May 2021 www.linuxformat.com Video conferencing TUTORIALS

The final option – Start live stream – enables you to the main https://meet.jit.si page under Calendar – just link your conference to your YouTube account to stream click it to join or set up the meeting. it live to an audience. You’ll find Install desktop client documentation Set up scheduled conferences While Jitsi Meet works well in your browser, if you plan to for Jitsi Meet You can integrate Jitsi with your Google and/or use it regularly, we advise downloading the standalone at https:// Microsoft calendars to plan – and receive reminders of desktop client. Two advantages of doing so are the ability jitsi.github.io/ – upcoming meetings. At the time of writing, the feature to set up key preferences that apply to all meetings by handbook. Use the Getting only works in Chromium browsers – attempting to default, plus the fact Jitsi Meet displays a history of Started and connect either service through the desktop client or recently accessed meetings on the main page. This is a User Guides Firefox results in failure. handy tool if you need to rejoin a meeting or want to set to learn more When you first log into a meeting in Chromium you’ll up a new meeting with the same details as before. about Jitsi’s key be prompted to install a Chrome extension. This makes The guide (below) reveals how to get Jitsi Meet features, and it easy to schedule Jitsi Meetings into your calendar – running as a desktop tool. It works in mostly the same the Self-Hosting once installed, simply open the extension, opt to create way as the browser version, with one key improvement Guide if you a calendar meeting on your chosen platform and it’ll over the browser version. When you want to share your want to host create an event for you, which you can review, edit and screen or a window, it provides thumbnail previews of your own Jitsi share with others. This information will then appear on each option to help you identify which one you want. server.

INSTALL JITSI MEET AS AN APPLICATION

Run as a portable program Install via Flatpak 1 The quickest and simplest way to run Jitsi Meet from your 2 There’s no repo or snap version of Jitsi Meet, but if you’re a desktop is as a portable AppImage package. Download the Flatpak user then you can install it through that. Set up Flatpak as package from https://github.com/jitsi/jitsi-meet-electron/ outlined at https://flatpak.org/setup/Ubuntu (skip step three) releases and save it somewhere sensible, such as your Home and then install Jitsi Meet: folder. Don’t forget to right-click the program and choose $ sudo flatpak install jitsi Properties>Permissions, then tick Allow executing file as program Keep answering Y to each question until it’s downloaded and before running it. installed on your system.

Configure personal settings Log on 3 Launch and run through the quick tour. Once done, click the 4 Next, type your meeting name into the main window and Settings button to set up your display name and whether to mute click Go. Jitsi Meet will then change the view to mirror what you’d microphone and camera by default. Expand Advanced Settings to see if you were logging in through your web browser, which means access third-party server logon details if relevant, along with an all the techniques you’ve learned in the browser will work in the option to remove the Always on Top Window, a thumbnail that’s program, too. Another bonus: after logging out, you’ll find previous displayed whenever the main window loses focus. meeting names are listed, enabling you to dive back in quickly.

MEET US EVERY MONTH! Subscribe now at http://bit.ly/LinuxFormat www.techradar.com/pro/linux May 2021 LXF275 63 BACK ISSUES BACK ISSUES MISSED ONE?

ISSUE 274 ISSUE 273 ISSUE 272 April 2021 March 2021 February 2021

Product code: Product code: Product code: LXFDB0274 LXFDB0273 LXFDB0272

In the magazine In the magazine In the magazine Ramp up the Machines Enjoy a fresh security of your Linux system and within machines are the order of the FOSS start with the latest version of make it an impregnable fortress. day as we show you how to run a Ubuntu, plus encode video more We also have practical fun with a VM. Discover how to construct a efficiently, remake Angry Birds in Raspberry Pi Pico, explore the best mind map, emulate a BBC Micro and Python, emulate the Classic Apple window managers, code a Space we explain Active Directory. But it’s Mac, transform your command line Invaders-style game in Python, not all work: we review five game life, and get into astronomy with our emulate 486 PCs, set up a rock- engines, connect a gamepad to a Pi review of star-gazing software. solid backup system, and more! and explore chess engines! DVD highlights DVD highlights DVD highlights Ubuntu 20.04 LTS (64-bit) and Bodhi Linux Mint 20.1 and Sparky 5.14. Manjaro 20.2 and Gecko Linux 152. Linux 5.1 (32- and 64-bit).

ISSUE 271 ISSUE 270 ISSUE 269 January 2021 December 2020 November 2020

Product code: Product code: Product code: LXFDB0271 LXFDB0270 LXFDB0269

In the magazine In the magazine In the magazine Discover how Get up to We explain how you can get Linux up and running on speed on how hackers operate – to stream your videos, music and your laptop and mobile devices! We then turn their tactics against them. photos from a home server, review also explore the chat tool Jami, We also show how to build a power-user distros, set up a live- provide essential tips for Firefox, powerful Linux gaming system, put streaming session, code Naughts use a Raspberry Pi as your daily together an audio library, emulate and Crosses in Python, get creative driver and reveal how to become a the Atari ST and code a classic card with the Pi camera, and work package maintainer. game in Python. We also get our collaboratively with NextCloud. hands on the Raspberry Pi 400! DVD highlights Digital download highlights Pop!_OS 20.04 LTS and Fedora 33 DVD highlight 4MLinux 34 and Enso OS 0.4 distros (both 64-bit). Kali Linux 2020.3 (64-bit only) (both 64-bit only).

To order, visit www.magazinesdirect.com Select Single Issues from the tab menu, then select Linux Format. Or call the back issues hotline on 0330 333 1113 or +44 (0)330 333 1113 for overseas orders.

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

64 LXF275 May 2021 www.linuxformat.com UK subs READING IN THE USA? turn to p24 SUBSCRIBE! Don’t wait for the latest issue to reach your local store – subscribe today and let Linux Format come straight to you. Faster, cheaper and with DRM-free archive a s

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

USA RESTOFTHEWORLD EUROPE From $132 From $137 From €100 For 13 issues For 13 issues For 13 issues IT’S EASY TO SUBSCRIBE! Click: www.magazinesdirect.com/linux-format Call: +44 0330 333 1113 Lines open Monday-Friday, 9am-5pm, UK time

www.techradar.com/pro/linux May 2021 LXF275 65 TUTORIALS Blender basics

Credit: www.blender.org Part One! Don’t miss BLENDER next issue, subscribe on Getting started in page 24! 3D using Blender Even if you’ve never used Blender before, Michael Reed will have you blending like a pro by the end of this tutorial.

here’s no doubt about it, Blender is an amazing menus and panels. So hang around while we stretch T piece of software. It’s a complete 3D graphics that cube, spin it around and make it dance for us. creation application with sections for modelling and sculpting, texturing, animation, physics simulation Getting started and many other areas. Whatever area of 3D graphics Let’s start our journey to becoming masters of the OUR and animation you’re interested in, once you have cube, and eventually, moving beyond it. When you first Blender installed, you have a professional-level load up Blender, you’re in what’s called Object mode. EXPERT application at your disposal. This enables you to select and manipulate objects that Michael Reed However, as good as Blender is, it’s necessarily you can see in the main area of the screen (called the has been complicated because 3D graphics is a complicated Viewport). You can orbit the starting cube by moving the exploring Linux subject. We’re going to take you though the basics of mouse around while holding down the middle button, since first modelling in Blender and give you an introduction to the and you can move around the scene by holding down trying his hand program in general. Shift while moving the mouse. Zoom in and out by with Slackware When you first load the program up, you’re presented scrolling the mouse wheel. in 1996. with a 3D cube and what seems like millions of icons, Let’s start doing things to the cube. Click the left mouse button on the cube to select it. It should now Understand the Blender interface be outlined in yellow. Hover over the main toolbar (left-hand side of the viewport) until you find the 5 Move icon and click it. You should see red, green and blue arrows coming out of the cube. Click and 6 drag those arrows to move the cube around in each of the three axes. 3 Try the tool below the Move tool, which is the Rotate tool. You should see red, green and blue circles around the cube. Click and drag those to rotate the cube in one 2 of three axes. Next down the toolbar is the Scale icon, and it works in a similar way to the tools that we’ve already 1 encountered. You can scale an object in one of three 4 axes or scale the entire object at once by clicking and dragging on the white circle. Locate the Object Properties tab in the Properties Browser on the lower right-hand side of the screen. Viewport. Properties browser Note that as you change the position, rotation and 1 This is where you interact with objects 4 A series of icons down the left-hand scale of an object, the corresponding fields in the panel and scenes within the 3D world. side allows you to choose what world or object also change. property you are editing. It’s possible to become confused about which axis 2 Toolbar. is which, or you can find yourself needing a rough idea Look closely, and you can see that it is, Access your editors itself, subdivided into sections, starting with the 5 A series of tabs for switching between about aspects such as size and position. In those cases, selection tools at the top. different editors. We’re going to stick with the it’s often easiest to move things around, visually, in the Layout Editor for now. Viewport, using the tools that we’ve discussed and 3 Outliner. then make the precise changes in the Object Properties This tool is handy for selecting objects Selection modes if the viewport is cluttered. It’s recommended 6 Face, edge, vertex selection mode and a tab afterwards. that you rename objects here as you go along series of drop-down menus followed by the For example, if you wanted to turn an object on its to keep things organised. shading mode icons.. side by rotating it 90 degrees, it’s often easiest to rotate

66 LXF275 May 2021 www.linuxformat.com Blender basics TUTORIALS

it manually first, to get a rough idea, and then change the rotation to exactly 90 degrees in the panel. Access Edit mode Start by selecting File>New>General from the menu bar, to set us back to the beginning, with the default cube in the default position. So far, we’ve been playing around with Object mode, so let’s take a trip into Edit mode. Select the cube and then select Edit mode from the mode selector above the toolbar (or press Tab). The first thing that you might notice about Edit mode is that the toolbar has extended itself with extra tools. You will also notice that the cube itself has extra details on it. You can also see that each corner of the cube is now marked by a square dot. When working with 3D graphics, these nodes are called vertices. A vertex (to Challenge: see use the singular) is simply a point in 3D space. A cube sharp to look realistic. We can start softening it up by if you can make has eight vertices, and if you join these together you end adding what’s called a Modifier, which is a powerful these shapes out of the basic cube up with 12 edges, and these form six faces. Vertices, Blender feature. using the tools edges and faces are fundamental to how a 3D object Click the wrench icon on the Properties Browser to and modifiers. (a mesh) is stored in Blender. edit the Modifier Properties for the object. Click Add Edit mode starts off in Vertex Selection mode. Click Modifier and select Bevel from the list of modifiers. the Select Box icon on the toolbar and then try selecting Change Segments to four. Lower the Amount to around one of the corners of the cube (a vertex). Now select the 0.04m. Note that you can alter these fields by clicking Constraints are Move tool, and move the vertex. This will deform the the number and dragging with the mouse, as well as useful when cube. As you can see, Edit Mode is the primary mode typing in directly or using the increase and decrease you want to in which we alter shapes by moving parts of them and icons. You should now have an object that has bevelled keep objects adding new parts. edges rather than the harsh ones that we started with. in alignment. Undo the changes you’ve made (Ctrl+Z) so that the There’s a little icon of a TV within the Modifier pane Locate the Snap cube looks like it did at the beginning. Next to the mode and you can use this to toggle the modifier visibility on icon in the top bar to limit selector (that still says Edit mode) there are three icons and off to gain a clearer idea of what it’s changing. This movements to for vertex, edge and face selection mode. Change to also reveals part of the beauty of the Blender modifier the resolution Face Select mode and click one of the faces of the cube. system: it’s non-destructive. In other words, you haven’t of the current From here, you can apply the standard tools that we’ve actually changed anything when you added the Bevel grid. Movement already covered. So for example, you could move the modifier, it just appears different while the modifier is can be limited face around, scale it or even rotate it. Give each of active. There’s an icon with four nodes in a square next to a single axis these a go, to really mess up the cube and to become to the TV icon, and that toggles whether or not the by pressing the accustomed to using these tools. modifier is active during Edit mode. It’s sometimes x, y and z keys. easier to work with the raw, unaffected object in that Modifiers mode, but it’s handy to be able to tab back to Object Go to File>New>General to start from scratch, select mode to get a better idea of what the finished object the cube and make sure you’re in Object mode. One will look like. thing you’ll notice about the start cube is that it doesn’t Another way of getting a clear idea of what the look much like a real-world object. For one thing, it’s Bevel modifier is doing to the mesh is to look at it in shaded in a simple way. For another, the edges are too Wireframe mode. You can do this by selecting it using

LIGHTS, CAMERA... PRESS F12!

Ultimately, you’re probably going to want camera at the objects in the scene. This Rendering itself has its own tab in the to render the finished product so that can be a fiddly job, so press Numpad 0 to Properties Browser. Because it’s a slow you can show it to people. If you hit F12, get a camera eye view of the scene. Then process, try enabling the Cycles and the current scene will be rendered into a hit Shift+` (the key above the Tab key) to GPU acceleration. new window. enter first-person mode for WASD The first problem you’re likely to controls. Try pressing F12 again to encounter is that the framing won’t produce the finished render. match the viewport you’ve been working The position of the light is another with. To frame your scene, you need to thing you might try adjusting and you manipulate the camera, and this is done manipulate it in the same way as the in the same way as manipulating other camera. In addition, the camera has its objects in the scene. So, zoom out with own tab in the Properties Browser. Here the middle mouse button and locate and you can alter the type of light and how then select the camera. Now use the powerful it is. Add more than one light You can insert the measurements and coordinates Move and Rotate tools to point the with the Add menu (or Shift+A). for an object into the Object Properties tab.

www.techradar.com/pro/linux May 2021 LXF275 67 TUTORIALS Blender basics

one of the four circular Viewport Shading icons in the top right of the viewport. Blender is a Let’s make it look even more like a real-world complex tool. object. Switch back from Wireframe mode into Solid If you want mode again. Then right-click the cube and select to get good Shade Smooth. You should have an object that with it, work looks like it’s made of clay, rather than a hard-edged through tutorial geometric shape. examples. Then come back later and try to Cubes cubed do it all again You’re probably seeing cubes when you close your eyes from memory. by now, and we’ll move on from them soon, we promise! If you see an However, add another cube to the scene first. To do this, Moving an individual vertex of a shape in Edit Mode, in Wireframe interesting 3D select Add>Mesh>Cube from the menu bar (or press shading mode for clarity. object online, Shift+A). If you haven’t moved your first cube, the new try to recreate one will now be inside the existing one. No problem – (probably called something like Cube.001, which is the it in Blender use the Move tool to move the new cube out of the only other object in the scene). using the skills way. However, you’ll need to let it overlap a little bit We’ve got a problem now because, as modifiers you have. because we’re going to use it to cut a chunk out of are non-destructive, we can’t move the cutting cube the first cube. Make sure it’s moved up a bit as well to out of the way. To get around this, make the change show the full effect. permanent by clicking the down arrow (next to the Once you have the cubes overlapping, select the camera icon in the Bevel Modifier panel) and click Apply. original cube and add the Boolean modifier to it. In the Now, if you move the cubes apart, you can see that Boolean modifier properties click the Difference button. you’ve cut a chunk out of one of them. Remember, you Then click the Object field and select the other cube add the boolean modifier to the object that you want to affect. You might want to have a play around with the Intersect and Union buttons to see the effects that they produce compared to Difference. Note that we now have two objects in the scene, if we go into Edit mode, we can only edit the currently selected object. That’s part of the beauty of Edit Mode because you can’t affect an object that you’re not working on. From cube to cylinder? Let’s add a different type of object to the scene. Start again with a new scene as before and delete the starting cube by clicking it and pressing X. Go to Add> Mesh> Cylinder, and don’t click anything else. This is easy to miss, but in the bottom left-hand side of the viewport Now the cube has a lovely squidgy look to it, thanks to smooth shading and bevelling there’s a pop-up menu that’s collapsed. In this case, it

SCULPT A CUP IN BLENDER

Create the cylinder Select faces and extrude Smooth it off 1 In Object mode, add a cylinder to the 2 Next, go to Face Select mode and 3 Go back to Object Mode and apply scene. Then change to Edit mode. Choose then press A to select all of your object. the Bevel modifier with an angle limit (as we Face Select selection mode and select the Now click and hold the Extrude tool (which did with the cylinder). About 0.06m for the top face of the mesh. Now press X to see can be accessed from the left-hand Amount and choose four Segments. Add the Delete menu and select Faces to delete toolbar) to select the Extrude Along the Subdivide modifier with two levels then the top. This gives you a bin-shaped object. Normals option. You should now see a select Smooth Shade. From here, you could Rotate around it and you’ll see the problem: stem. Drag the stem inwards – doing this drag-select the top rim in Edit mode and the sides have no width. will create the walls of the cup. then scale it to make it a little bigger on top.

68 LXF275 May 2021 www.linuxformat.com Blender basics TUTORIALS

has the words Add Cylinder on it, and we can only use it when first adding a new mesh. Press the little triangle next to those words to open the menu up. Change the depth from 2m to 3m. We’ll leave everything else as it is this time, but as you can appreciate, it’s complicated to change the number sides of the object at a later date. Again, our object lacks a realistic look because it only has 32 sides to it, but once again, we can bevel it and shade it. To make it look more realistic, we’ll add the Bevel modifier, as we did with the cube example earlier on. An Amount of 0.01m is about right for the look we’re going for with three Segments. Simply bevelling the edges doesn’t solve the problem of there not being enough faces, so add the Subdivision Surface modifier. This subdivides faces into smaller faces, making the object more complex and easier to smooth, and this should be apparent if you look around the top edge of the cylinder. However, the faces on the sides of the cylinder are still obvious for some reason. Plain, bevelled and smoothed, metallic material shown at the front row of cylinders. Behind them What we need to do is to go back to the Bevel modifier. are edited vertices and the wireframe modifier. As it stands, it’s trying to bevel the edges between the side faces, which we don’t want. So, on the Bevel and then select the Material Properties tab on the modifier panel, go to Limit Method and select Angle. Properties Browser. On this editor, click the +New Immediately, we should have smoothly shaded sides button to add a new material. Once you’ve done this, If there’s when we select Smooth Shading by right clicking you can colour an object by simply clicking the white something you the cylinder. area next to the Base Color field. This pops up a do a lot of in Try putting a floor underneath your object. Add a standard colour selector. Sure enough, when you Blender, it’s Plane Mesh (Add>Mesh>Plane) to the scene and use change this, the colour of the object will change to worth learning the Move tool to manoeuvre it under the cylinder. Go to match it. the keyboard the Object Properties tab (right-hand panel) and change Without leaving the Material tab, click the little yellow shortcuts. If you can’t find the X and Y scale of the plane to about 10 each. dot that’s part of the Base Color field and select a particular Checker Texture. This, as you might have guessed, function, hit Vary your materials assigns a checkerboard texture, much loved in F3 to search all Either stick with the cylinder you have from the last computer graphics rendering. You can choose the two functions. section, or create a new one from scratch for the next colours used by making use of Color1 and Color2 fields, part. Up until now, we’ve been working in the ‘solid’ and you can remove the effect by clicking the yellow shading mode which gives everything a slightly dot of the Base Color field again and using the Link – reflective putty-like appearance. If we want to change Remove option. If you fancy a chromed metallic look to the characteristics of the surface of an object, such as your object, choose white as your base colour and then changing the colour or adding a texture, we need to turn the Metallic option up all of the way up. Then, bring create and assign a ‘material’ to it. the Roughness field down to about 0.175. Switch to the Material Preview mode by locating and Hopefully, we’ve introduced you to the basics of clicking the icon next to the Wireframe and Solid modes modelling in Blender along with a general introduction to that we’ve already used. You’ll see that the object that the program as a whole. From here, you can start to we have looks bright white because it doesn’t have a explore the rest of the application. material assigned to it yet. To do so, select the object GETTING HOLD OF BLENDER

Blender is free software. We used a 2.9 series (current stable) build for this tutorial. Our advice is to visit the Blender website and compare the latest release (www.blender.org) with the version in your distribution’s repository. You can go cutting edge, if you’re really curious about the latest features, but that option isn’t for the faint of heart. The safest possible option is to look at the LTS (Long Term Support) version (www.blender.org/download/lts), which will receive updates without changing significantly for two years after release. Blender can also be installed using the Snap system and it’s even available (for free) via Steam. Blender underwent major changes to its layout starting with the 2.8 series, so bear that in mind when looking up information. Chopping into one cube with another cube. It’s cubicide!

GET US IN SOLID RAYTRACED 3D! Subscribe now at http://bit.ly/LinuxFormat www.techradar.com/pro/linux May 2021 LXF275 69 TUTORIALS Apple II emulation

Credit: https://paleotronic.com/software/microm8 EMULATION Run an Apple II on your Linux system Les Pounder steps into his time machine and travels back to 1977, and not just to watch Star Wars on the big screen for once.

he Apple II (often referred to A typical 1977 Apple ][ setup, with a cassette player and T as the Apple ][) was released monochrome monitor. The in June 1977. It was one of the Apple ][ had plenty of space first successful mass-produced for upgrade cards computers and Apple’s first personal OUR computer aimed squarely at the consumer market. The hardware was EXPERT designed primarily by Steve Wozniak and Les Pounder the case by Steve Jobs, who were the is associate founders of Apple. editor at Tom’s In 1977 there were three machines Hardware and vying for attention and inclusion in our a freelance lives: the Commodore PET 2001, TRS-80 creative and the Apple II. Powered by a MOS technologist. Technology 6502 CPU running at He blogs about 1,023MHz and available with between his discoveries four and 64KB of RAM, the Apple II at bigl.es. spawned a series of machines from 1977 to 1992, ending with the Apple IIGS. 4.0, BY-SA CC FozzTexx, Our favourite Apple II models in the series are the CREDIT: Apple IIc and the IIc Plus. You might be thinking, “Why?”. https://commons.wikimedia.org/wiki/File:Apple_II_typical_configuration_1977.png Well, these models both featured a built-in floppy disk that we’ve seen with other retro computers, where drive (5.25- and 3.5-inch, respectively) and they were they’re emulated on the web via JavaScript. designed to be portable. They are by no means a laptop, Using this online emulator we can write code in but they took up very little space, and offered plenty of BASIC and play some of the included demos, but we power and compatibility with software. The downside of can’t run any real games or applications. For this we these machines was that they lacked the space to need an emulator, again written in JavaScript. Apple ][js install aftermarket add-ons. This didn’t stop some (www.scullinsteel.com/apple2) comes with a series of ingenious individuals, who managed to squeeze CPU applications and games accessible via the disk menu. accelerators and RAM upgrades into the casing without Using this emulator we’re going to write a little code, ruinning the clean aesthetics. but rather than use BASIC we’re going to use Logo, an In the UK, the Apple II didn’t make much of a dent educational programming language that was designed In Logo we used (just me then? – Ed) in the saturated home computer in 1967 by Wally Feurzeig, Seymour Papert, and Cynthia commands to scene. They were expensive compared to machines Solomon. Logo is a language to introduce concepts in move around from Acorn, Sinclair and Commodore. But in the US the a graphical and logical manner. Our goal is to draw the screen. For example, Apple II was adopted and loved by a generation of objects upon the screen. To load Logo via the emulator FORWARD coders. Right now the cost of original Apple II hardware click the Open Disk icon, then go to Programming and and LEFT. has skyrocketed and so to take our first steps with this then click the Apple LOGO. Click Open to load the disk. But we can great machine, we once again look to emulation and From the start we are left at a blinking cursor, and shorten these sometimes we find emulators in the strangest of places. from here we shall enter some commands to draw a commands for square. Logo is a high-level language, and commands ease of use. FD Emulating an Apple ][ are written in English. Here is the command to draw a and LT perform We start with the easiest means to emulate an Apple II, square 40 pixels in size. the exact same specifically Applesoft BASIC (www.calormen.com/ FORWARD 40 functions. jsbasic), which uses JavaScript. It continues a trend LEFT 90

70 LXF275 May 2021 www.linuxformat.com Apple II emulation TUTORIALS

FORWARD 40 Rescue on LEFT 90 Fractalus, playing FORWARD 40 on an emulated Apple ][ in a LEFT 90 browser via FORWARD 40 JavaScript. Let How can we shorten this code? Ordinarily we would that sink in for use a For loop that iterates a set number of times, in this a moment! case four times to create the square. Logo’s version of a For loop is REPEAT, similar to Scratch. To run the same code as above, but using just one line we first need to clear the screen. CLEARSCREEN Then run this command which repeats the instructions, contained within the list. REPEAT 4 [FORWARD 40, LEFT 90] We have a square, but can we draw something a little more difficult? Triangles may have only three sides, but we need to do a little maths to determine the angle at which we turn. Before we start, clear the screen. CLEARSCREEN We start by drawing the base, 40 pixels long. designed by John Kemeny and Thomas Kurtz and was LEFT 90 released at Dartmouth College in 1964. In basic terms FORWARD 40 (no pun intended) BASIC is a human readable language At any time in Right now we may be thinking that we need to that uses words common in the English language. microM8 we change our angle to 60 degrees to draw an equilateral The BASIC Interpreter was stored in ROM, a can click in the triangle, but wait! Logo, and Python’s Turtle library, use common thing for 1980s home computers, and was top-left corner the EXTERNAL angle so we need to divide 360 degrees called Integer BASIC. As you can probably guess from of the screen, where a floppy by the number of sides (three), to determine the the name, Integer BASIC supports integers, but it disk icon will external angle, which is 120 degrees. doesn’t support floats – numbers with decimal places – appear and RIGHT 120 a choice made by Apple co-founder Steve Wozniak. load a menu. FORWARD 40 Applesoft BASIC is our preferred choice. From here we We’re at the top of the triangle so now let’s turn To run BASIC we can either use the Applesoft BASIC can change around and head back to the base. Again we need to in the JavaScript website (www.calormen.com/jsbasic) applications, rotate 120 degrees and move 40 pixels. or we can install a dedicated emulator on our machine. reboot the RIGHT 120 We chose the latter for this tutorial, but the code will run machine or FORWARD 40 just as well in the JavaScript emulator. switch to a totally different Going even further, let’s mash up a little of our code, We downloaded microm8 (https://paleotronic.com/ computer. and add something new. Logo refers to Functions as software/microm8). This is an Apple II emulator that Procedures, so let’s define a procedure that will draw a works with Linux, Windows and Mac. Download and hexagon. This procedure also requires the user to extract the file to a location in your home directory. specify the forward distance, essentially controlling the Right-click the extracted file, and select Properties. Look size of the hexagon. Remember to clear the screen for the Permissions tab and click “Allow executing file as before starting. an application”. Close the window and double-click the TO HEXAGON “LEN REPEAT 6 [FD :LEN RT 60] END OTHER APPLE ][ EMULATORS Our procedure HEXAGON is ready to be used. We’ll draw a hexagon where each side is 30 pixels in length. There are many other ways to emulate an Apple II. On Linux we can HEXAGON 30 use LinApple (http://linapple.sourceforge.net), which is an open Our final section of Logo code uses the HEXAGON source Apple II emulator. It does require installation of a few extra procedure inside a repeat loop. This loop will iterate 18 packages, chiefly those to build the source files into an executable, times, each time drawing a hexagon with sides of 30 but there’s plenty of help in the INSTALL and readme file. pixels in length, it then rotates the cursor 18 degrees to Raspberry Pi fans can use a version of LinApple for Raspberry Pi OS the right before repeating. called Linapple-pie (https://github.com/dabonetn/linapple-pie) and REPEAT 18 [HEXAGON 30] RT 18] there’s also a version for Windows (https://github.com/AppleWin/ Apple LOGO is a great way to introduce the structure AppleWin). One thing to note on these emulators is that they’re all of code. It may not be a useful language to solve a quite old, with some last receiving an update in 2015. This isn’t too problem, but it offers a quick and easy first step into much of a worry, but something to bear in mind. controlling a computer. If your interest in the Apple II is purely game related then you’re once again in luck because a port of LinApple is part of the RetroPie Apple II BASIC emulation distribution. All you need to do is place the Apple II disk BASIC is a great language and we’ve covered many image files in /home/pi/RetroPie/roms/apple2/ and the OS will versions of this language over the past months. But just detect and display the list of games via the EmulationStation front- in case you’re new to BASIC, it’s a general-purpose, end. More details at https://retropie.org.uk/docs/Apple-II. high-level language and the original version was

www.techradar.com/pro/linux May 2021 LXF275 71 TUTORIALS Apple II emulation

icon to load microm8. On first boot it will need to update, so be patient. Both of versions Once it’s finished updating, microm8 will restart and of BASIC on present a rather retro 3D menu. From the menu we can the Apple ][ select two BASIC interpreters: Applesoft BASIC or come with tab Integer BASIC. Select Applesoft BASIC by pressing A. completion – The interpreter will open and we are ready to write something we some code. take for granted Our BASIC project this time is a number-guessing on Linux. Type game. We have 10 chances to guess the correct number in the first before the game ends. If we guess too high, the game few letters of will tell us so, and the same is true if we guess too low. a command and you’ll see We start the code at line 10 by creating a variable, N. a suggestion Inside the variable we store a random integer between The file catalog found inside microM8 is a wealth of nostalgia. It appear. 0 and 50. contains hundreds of games and applications for the Apple ][. Press TAB to 10 N = INT(50*RND(1)) complete. Line 20, and in the game we use this to give 40 FOR C = 1 TO 10 instructions to the player. We can optionally swap the Using input, we capture the player’s guess and store text for N and have it display the number while we it inside a variable, G. debug the game. Line 30 asks the player for their guess. 50 INPUT G A complete Apple 20 PRINT “YOU HAVE 10 TRIES TO GUESS THE Lines 60 to 80 check the players guess, G against ][ BASIC emulator CORRECT NUMBER” the randomly chosen number, N. If G is more than N, it in JavaScript, 30 PRINT “WHAT IS YOUR GUESS?” will print “Too High”. If G is less than N, it prints too low. including an easy- Line 40 sees the start of a For loop that will iterate 10 For both of these lines the value of our loop counter to-use text editor C where we can times, each time storing the current loop number inside will increase by 1. If the value of G is the same as N, then write out code. a variable, C. the code will jump to line 130. 60 IF G > N THEN PRINT “TOO HIGH”; 70 IF G < N THEN PRINT “TOO LOW”; 80 IF G = N THEN GOTO 130 Line 90 checks the value of C, our loop counter. If the value of C isn’t equal to 10 then the player still has a chance to guess the correct number. Note that the “TRY AGAIN” message has an intentional space at the start to prevent it joining other messages on the screen. Line 100 iterates the value of C and loops back to line 40, the start of the for loop. 90 IF C<>10 THEN PRINT " TRY AGAIN” 100 NEXT C If the player runs out of chances, then line 110 prints a game over message to the player,including another intentional space. Line 120 will end the game. 110 PRINT " I’M SORRY YOU FAILED...GAME OVER!” 120 END HOW BASIC LED THE WAY AT HOME Line 130 is where the game ends if we have guess the number correctly. A message is printed to the screen In the 1980s as the home computer market boomed (and eventually and then line 140 ends the game. went bust) there was one language that dominated every machine. 130 PRINT “YOU GUESSED CORRECTLY” BASIC (Beginners’ All-purpose Symbolic Instruction Code) was the 140 END Python of the era. It was easy to read, write and could be ported When ready, type RUN to start the game. across machines with very little effort. At the time there were thousands of books on the market, each offering the skills and Playing a game knowledge of BASIC that we sought. The Apple II had many great games, some of which were Yet of all these books it was the Usborne/Scholastic books series ports from arcades and other consoles, while others that captured the imagination of a generation, including this author. were made directly for the Apple II. Luckily for us These books taught us the syntax of BASIC via games and puzzles microM8 comes with an extensive catalogue of games. served up via a comic book. These books are available via auction From the microM8 menu screen press B to open the sites, sometimes for a bargain price but often for extortionate prices. disk catalog. Alternatively if you have any disk images, So if you want to read these books, what’s the best way? Usborne these can be dropped directly onto the menu, from books has made PDFs available for all of the 1980s-era computing where they’ll run. books: https://usborne.com/books/computer-and-coding-books. The Disk catalog is a file manager. Look in here for These books are still under copyright, but for personal and appleii and double left mouse click to open. In the next educational use they’re a great source of inspiration and learning. screen single click the disk images folder. We can now Could you convert one of these BASIC games into a Scratch game, or see folders for games, applications, demos and go even further and adapt them for Python? operating systems. Click Games and then select a letter from the list to show games starting with that letter. We

72 LXF275 May 2021 www.linuxformat.com Apple II emulation TUTORIALS

chose R, for Rescue on Fractalus! This is a classic game auctions but at this time there are few machines on Rescue your allies from Lucasfilm that involves the player rescuing pilots offer and those that are command high prices. If you on the planet Fractalus in this who are stranded on a mountainous alien planet. You already own an Apple II then you can pick up floppy 3D game, running have to fly though a pseudo 3D environment while emulators, similar to SD2IEC, which can store on a 40-year-old dodging hostile fire and other hazards. thousands of disk images on a single SD card. Websites computer. If you get tired of a game, move the mouse to the top such as https://a2heaven.com have a plethora of left of the window and a disk icon appears, click the disk options for your vintage hardware including extra cards and go to File Catalog to choose another game. for audio and MIDI output and a VGA output card to output video via a VGA monitor. Demoscene The Apple II was, and still is a great machine. It was The Apple II uses hardware designed in the late 1970s adopted by US-based educators, and found a place in and as such it takes a gifted coder to get the best from the home. It was your entertainment, educator and the hardware. At Demosplash 2018, Deater and a team workmate all rolled up into a neat package – one that of coders created Apple II 64k Cycle Counting existed far longer than most machines of the era. Megademo, which won first place in the category of retro demo at the event. The demo may seem simplistic compared to that of a Commodore 64 or an Amstrad, but we have to remember that this is running on much older hardware that didn’t have custom chips for audio and graphics. We took the demo for a spin in microM8 and it did require a little tinkering for it to work properly. Chiefly there were scanlines and garbled text that we removed via the top-left disk menu options for video. Download the demo from www.deater.net/weave/vmwprod/ megademo or you can watch the video on YouTube. Apple in ][0][1 The Apple II scene is alive and well in 2021. The scene enjoys the same activity as other computers of the era and this is reflected in YouTube videos from Adrian’s Digital Basement, Jan Beta and The 8-Bit Guy. For the MicroM8 is a great emulator and it takes seconds to install. It offers the best that the Apple ][ consumer, origin Apple II hardware is available via online series has to offer, and it also emulates 48k and 128k Spectrum computers.

WE EXCEL AT THE BASICS, SO… Subscribe now at http://bit.ly/LinuxFormat www.techradar.com/pro/linux May 2021 LXF275 73 TAKE COMPLETE CONTROL OF YOUR LINUX BOX Got root? Then get the Linux Format Annual and get the most from your distro and its free and open source software today!

ON SALE NOW

Orderin line at:

Or ge geti it fromrom selec selecteded supermarke supermarketss & newsagents n THE BEST NEW OPEN SOURCE SOFTWARE ON THE PLANET

Alexander Tolstoy wheels out another set HotPicks of carefully selected Photoflare Qytdl KWipe GabTag Fvid Draw.io and tested open Spech 0 A.D. Quadplay Guitar Sonice source applications

IMAGE EDITOR Photoflare Version: 1.6.6 Web: https://github. com/PhotoFlare/photoflare

here are several categories of open source image editors. Usually we recommend Gimp for T advanced users, Krita for digital artists and a whole variety of Paint-like tools for basic drawing, cropping and other common tasks. There’s certainly a gap in the market for a beginner-friendly photo editor Photoflare contains a range of popular image-editing tools, and they’re are within easy reach. that’s simple to use, but contains advanced options should you need them. If you’re struggling to think of a Find your way around the Photoflare interface program that meets these requirements, then struggle no more as we take a look at Photoflare, a feature-rich 1 open source image editor for Linux. 2 Photoflare looks like an advanced image viewer, but it’s designed for editing images instead of merely 3 browsing them, and is ideal for quick edits and enhancements. The main window’s toolbar has an extended set of utilities for changing brightness, contrast, hue, saturation, as well as flipping and rotating. Many more tools can be accessed from the Adjust and Filter sections of the program’s menu. Photoflare boasts a rich set of filters for making the image softer, sharper, fixing blemishes and dust, and also turning an 5 ordinary photo into a painting. All filters are applied immediately, with no configuration windows. That makes Photoflare less advanced than Gimp, but also keeps things straightforward for those new to image editing. The program lacks layers functionality or a freehand selecting tool, but there are plenty of 4 transformation options, a good colour tool and a wealth of filters and effects. Extended main toolbar and makes it possible to quickly switch from The right-hand panel gives you access to some 1 From here you can access a range of one to another. brushes, erasers and also the Stamp tool for cloning colour modes, image and canvas resizing tools, a text tool and the automation feature. Don’t overlook the Status area parts of the image. This makes Photoflare ideal for 4 Some filters take a long time to apply removing dust and scratches from old photos, and it’ll More tools in the second row (depending on your system’s processing also do a great job at making underexposed or pale 2 This is Photoflare’s Filterbar that you can power). Keep an eye on this area to see when vacation shots look more vivid. The program sports a turn on and off under View. Colour adjustment the Working status changes to Ready. tools and some frequently used filters and tabbed interfaces and enables you to keep several effects can be found on this feature. Essential painting tools at your images open at once. There’s also the adjustable 5 fingertips grid view, a text tool and even a built-in batch image Organise your workflow with tabs Brushes, sprayers, fillers, smudge and the Clone processor. A superb offering in one compact package! 3 Photoflare can keep lots of images open Stamp tools can be accessed from this area.

www.techradar.com/pro/linux May 2021 LXF275 75 HOTPICKS

Qytdl is a decent YOUTUBE DOWNLOADER GUI front-end to Youtube-dl that will be a useful addition to your desktop Qytdl accessories. Version: GIT Web:https://github.com/ jahendrie/qytdl

ne of our favourites command line tools in Linux is Youtube-dl, an incredibly useful line O utility that enables anyone to download YouTube videos and store them locally. Youtube-dl’s popularity and ease of use is also the source of inspiration for numerous graphical front-ends that aim In essence, all you need to do is get the URL, decide to bring even more comfort to your Linux desktop. It’s if you want the best quality or not (or maybe just the not difficult to find dozens of graphical Youtube-dl clients audio in MP3) and add the URL to the list in Qytdl. The at Github, but some are ugly, some are abandoned, application is designed in such a way that it expects you some misbehave or don’t work at all. to drop video links to the list (there’s even the dedicated One of this issue’s Hotpicks is Qytdl, and despite the button for pasting), and then download the entire list fact that no one knows how to pronounce its name, the at once. The quality presets include four MP4 variants program is up-to-date and works just as you would and the audio-only MP3 option. The latter is useful expect. The program focuses on just one task: grabbing for grabbing files that don’t have any video and are the video from the YouTube URL that you copied from intended for listening only, such as songs. your web browser. Under the bonnet Qytdl is based around PyQt5 and However, we were also happy to find some other the Python3 package named youtube-dl. Make sure you useful features connected with downloading, such as have both of these dependencies installed – either the list of URLs, the destination directory selector, the check your package manager, or obtain them via format and quality menu, and a proper progress bar Pip3. The installation procedure is as simple as running for both current video and the entire list. $ sudo make install in the Qytdl root directory.

For even better DATA WIPER control over deletion, you can customise the algorithm in this section of the KWipe KWipe settings. Version: 3.0.3 Web: https://github. com/PyCoder/KWipe

e should all be aware of sensitive information: those data files that you should protect and W also carefully wipe when they’re no longer needed. Erasing a file or directory in the normal way is like throwing a piece of paper into a waste basket: in both cases it’s easy to recover that information. KWipe may want to wipe. There’s always a small chance of is a solution to purge any data completely, without accidentally wiping the wrong device. KWipe makes it traces. By completely we mean overwriting the storage possible to add off-limit data sources to the list of medium in such a way that no investigation software – “locked devices”, which is a good data protection from the open source Photorec to expensive commercial measure anyway (find it under Settings>Devices). products – would recover anything useful. The full power of KWipe becomes apparent when it We looked at KWipe in LXF243, but since then this comes to managing lots of drives and other storage utility has improved in many areas. For instance, there devices. The application is multi-threaded and thus are now more wiping modes, available from the menu in supports secure deletion of multiple devices in parallel. the top-right corner of KWipe. The default method is The lower part of the window hosts the panel with the Zero, but there are more options including Gutmann, list of tasks and is ideal for monitoring the overall Bruce Schneier and a good variety of UK, Canadian, US progress. The application is also now easier to get up and Russian state-approved wiping modes. and running because it’s based on PyQt5 and has no In addition, KWipe now works with devices instead of external dependencies. Just run the executable with partitions, which makes things a bit simpler in general. root privileges (for example, sudo/kdesu ) and you’re The main window shows the list of available devices you ready to securely erase some data!

76 LXF275 May 2021 www.linuxformat.com HOTPICKS

Gabtab is not just AUDIO TAGGING TOOL about text tags: you get album art GabTag and lyrics as well! Version: 2.1Web: https://github.com/ lachhebo/GabTag

e live in the subscription era where many things including music are not products but W services. However, those old-fashioned folks (are you calling us old?–Ed) who stubbornly keep using their local music libraries (this author included), The program’s window consists of two halves, with sometimes need an offline desktop application for the left for the list of tracks and the right for their tags. editing tags in audio files. There’s a good choice of such Although it’s easy to fix tags manually here, Gabtab tools in Linux: for instance, we reviewed Kid3 in LXF211, offers you to fetch album and track details from and it’s still a decent option. MusicBrainz and lyrics.wikia. The first is a great aid in While Kid3 is a KDE-friendly tagger, we now want identifying the ‘unknown artist’ tracks, whereas the you to try Gabtag, a Gnome-friendly tagger. This is a second provides lyrics for identifying songs. Editing is a compact and easy-to-use tool for filling in blank MP3/ two-step operation: your text is just a draft until you AAC tags, or editing existing tags. The main reason why press the Save Modification button. It’s also possible to you might want to use Gabtag is that it enables you to introduce many edits here and there and finally hit the edit tags in a bulk. A common issue with tags is that all Save All button in the Gabtab header bar. tracks in a ripped album may have recurring problems, We liked Gabtab and had a great time with it using such as a wrong album name, or a track number in the our messy music library. We also approve of the name field. Instead of attempting to fix problematic program’s clean design. Gabtag can be installed with fields in each track, you can save a lot of time by loading almost no extra efforts because it’s available at Flathub, the track list in Gabtab and applying changes to a so no code compilation is required, unless you’re willing selection of tracks in one fell swoop. to contribute to the project.

Fvid obscures your FILE ENCODER data and will also resist any further compression. Fvid Version: 1.0.0 Web: https://github.com/ AlfredoSequeida/fvid

ecently, there was a Reddit thread with a new suggestion for data encoding and storage. The R idea was to represent any file in a binary form, then use this data to draw QR-code-like bitmaps and finally assemble those images in a video. Uploading these videos to YouTube could provide unlimited, free cloud storage. A daring attempt to hack the world order! Let’s take a closer look. First, we’ll install Fvid itself: The implementation of this concept turned out to be $ pip3 install fvid --user relatively simple: a little bit of Python3 coding resulted Now try to encode some data, such as a text in Fvid. This utility can encode any single file into a fake document, a media file or a ZIP file: MP4 movie, and then decode it back to the original $ fvid -i /path/to/input.file -e state. Compared to the hexadecimal (and thus multi- Depending on the size of the input file, encoding coloured) method, the binary way is quite inefficient in may take a while. The default output should appear in terms of disk space: for example, a 5MB input file the current directory as file.mp4. Optionally, you can results in a 90MB video after processing with Fvid. protect it with a password by adding the --password However, it survives almost any image optimisation and “your_password" to the encoding command. You can filtering that YouTube or any other video service can recover the original file using the following command: apply in auto-mode. Colour correction and altered $ fvid -e /path/to/file.mp4 -d shades of black and white won’t ruin the encoded data, Use Fvid to protect and store any kind of information so you’ll be able to download that video and decode it and protect it from unwanted retrieval. back with no issues.

www.techradar.com/pro/linux May 2021 LXF275 77 HOTPICKS

Want to create DIAGRAM CREATOR complex diagrams and flowcharts? Then Draw.io is the Draw.io program for you. Version: 14.4.2 Web: https://github. com/jgraph/drawio

inux users often complain about the poor selection of business-orientated graphics tools L for our beloved OS. Granted, programs such as Inkscape, LibreOffice Draw and Karbon can help to plug the gap, but it’s still tricky to connect two rectangles section offers ready-to-use draw.war files that you can with an arrow without having to resort to drawing the run on your own web server. For instance, we put that arrow by hand. file in the webapps directory inside our Apache Tomcat Luckily, things are getting better, and in no small installation and then we were able to run Draw.io at measure thanks to open source tools such as Draw.io. http://localhost:8080/draw. This is a web-based application designed to run in When you want to create a new flowchart in Draw.io, your web browser. It’s powerful enough to meet most you can access a dialog that features a collection business graphics requirements, and can create of professional-looking templates. At this stage, you flowcharts, plans, schemes, diagrams and basic can also import existing XML or SVG files, or continue plots. There are plenty of shapes, connectors, fillers, working with your previous flowcharts saved in the arrangement options and other features that MS Visio .drawio format. The editor makes use of integration plug- users will be familiar with. ins with Google Drive, MS One Drive, Dropbox and few Draw.io looks more like an enterprise-class add-on to more cloud storage providers, but each option requires Microsoft Office Online, yet it’s available to anyone via the API to be set up in case you run Draw.io on your own. Github. Obviously you can play with Draw.io right away We found that saving and loading local files works just by visiting https://app.diagrams.net. However, it’s also fine in any case, which is often more than enough for easy to get hold of a personal local copy. The Releases your diagram and flow chart tasks.

Although there are SPELL CHECKER some false positive results, Spech generally does a Spech very good job. Version: 0.2.1 Web: https://github.com/ megahertz/spech

e all make mistkaes in our written language, even if it’s our mother tongue. If we’re using a W foreign language then writing anything error- free becomes more of a challenge. While there are good FOSS spell checkers (Hunspell, Aspell...), it would be better to have a super-checker that combines the Let’s now see Spech in action. First, we need to grab power of several spell-checking providers in one tool. the source and run $ npm install in its directory to Spech is a Node.js package that enables spell and fetch Spech’s dependencies and install the spech grammar checking from the command line. It also executable. You can run either $ npx spech or provides its own API, which means any web developer $ ~/node_modules/.bin/spech without any can include it in their project. To be more specific, Spech arguments – this way Spech will recursively search can use Hunspell, Yandex Speller and GrammarBot for *.md in the current directory and check all found simultaneously for both spelling and grammar checks Markdown documents against Hunspell’s American against text files, or a text string passed as an extra English dictionary. A more advanced command with a command line argument. Spech is a zero-config different language may look like this: application and works with all three providers out of the $ spech -p hunspell -p yandex -p grammarBot -l box. Both Yandex Speller and GrammarBot have certain ru-RU /path/to/file limitations for the number of requests a day, but you If you want to add extra Hunspell dictionaries then can extend these limits by obtaining your own API keys you’ll need to install the appropriate Node.js packages from those services and adding them to the spech. first (for example, run $ npm install --save-dev config.js file – see the Spech documentation for details. hunspell-dict-ru-ru ).

78 LXF275 May 2021 www.linuxformat.com Games HOTPICKS

STRATEGY GAME 0 A.D. Version: Alpha 24 Web: https://play0ad.com

ne of the finest open source strategy games has recently been updated. Alpha 24 is a long- O awaited update to 0 A.D. ,a spectacular and If you dive into 0 A.D.’s graphics settings, you’ll Growing animals is a good way to Age of Empire finely crafted remake of the original game. notice the presence of more advanced renderer quickly gain more It’s been over three years since we reviewed the controls. Having a decent video card enables you to food. Try to collect Alpha 22 version in LXF229, and since then 0 A.D. has access high-profile anti-aliasing settings that help to as many resources received plenty of fixes and improvements. It remains remove sharp edges around objects, which helps to as possible, so that centred around building and developing an ancient take the game’s playability to another level. you can resist the enemy onslaught. civilisation where you, playing as the governor, needs The in-game resources have also been improved to manage civil development and your military forces. here and there, including the models of the Although 0 A.D. has strong support for multiplayer characters. Horsemen, archers and pikemen are now matches, a better way for new players to get to grips more detailed and have smoother outlines – it’s with the game may be to start with a single-mode game. worth taking a closer look at them by zooming in In most cases games against the 0 A.D. bot have been with the mouse wheel. rebalanced – single-player games from earlier 0 A.D. One aspect that has remained the same releases were pretty remorseless! While you were throughout all recent 0 A.D. releases is a remarkably admiring the stunning graphics, zooming in on beautiful high quality of the game’s artwork and resources. rural buildings and slowly extending your nation’s Trees, animals, buildings and even stones look so capabilities, at some point a far more developed enemy natural and true to life, that it leads unexperienced would swoop in and easily defeat you. The game’s A.I. players to spend time enjoying the landscape instead now gives you more of a fighting chance. of preparing their troops for an enemy attack!

GAMES CONSOLE Quadplay Version: Beta update 65 Web: https:// github.com/morgan3d/quadpla

mall arcade or adventure games are good for a short break, but they rarely grow into serious S time-killers. We suggest entering the magical world of Quadplay, a fantasy console that comes with the full source code, the IDE, the comprehensive developer’s manual and nine cool indie games – all within the same single Github project! Aim, cast, hold on Quadplay is an impressive attempt to create a virtual console simulator in the corner. Everything feels very and reel in to catch gaming device that could compete with real-world professional and well made to attract possible game more fish! Don’t consoles. It’s possible to run it on a desktop Linux contributors. To enjoy those nine bundled games, miss other fun machine, a tablet, an Android-powered smartphone, a first copy them from the games folder of the main games too! Raspberry Pi and many more devices. The project Quadplay directory to ~/my_quadplay. Next go to the supports external controllers from Xbox, PlayStation, IDE, select Tools>Open Game and choose any item SNES, Stadia, Switch and others, so you can quickly from the list. Launch the console with the play button, start using a fully fledged open source gaming console. switch to the full-screen mode, and you’re all set up. Let’s see what we can play right away on a desktop. The included small games have a retro-feel, and Grab the code and run $ npm install to fetch the are fun and well designed. For instance, Funny Fishing dependencies. After that launch the server part with will appeal to those fond of fishing in ponds and lakes. $ ./quadplay and wait while your web browser loads Up until now we’re only featured one fishing game in the Quadplay control panel. You’ll see a version of a the magazine: Mouse Boat in LXF219. The FOSS fishing game-dev IDE with a project tree, code editor and the haul has just doubled in size!

www.techradar.com/pro/linux May 2021 LXF275 79 HOTPICKS

GIT CLIENT Guitar Version: 1.2.0 Web: https://github.com/ soramimi/guitar

ames can be deceiving, and this is exactly the case with Guitar. No, it’s not about guitar tuning N or even anything acoustic. Instead, Guitar is a graphical client for Git – perhaps the most faithful and fetch, pull, push the code, see if your local copy is up Guitar brings better control well designed of all the attempts we’ve seen so far. to date with the master, launch a terminal or a file over Git branches Guitar is a fully fledged native desktop application manager and even switch Guitar to its offline mode. and sports a with no signs of wrapping Github or any other web page If you’re used to browsing a code tree with a web superb commit for the sake of imitating a desktop program. It’s ideal browser, Guitar makes your life easier by showing the history view! for developers and all other code contributors who structure of the recent code commits. The main participate in Git projects. Not only coders, of course: section of the program’s window is dedicated to the the program brings a lot of comfort and convenience to commit history, and therefore it’s easy to see and anyone who needs to grab a Git code tree with the aim track any change mode to the code. Guitar makes it of compiling it on their machine. straightforward to manage Git branches, review The application is quick to start, and is easy to get commits, merge pull requests, review patches and registered using your existing Git credentials once you keep track of a project’s development. decide to push the code upstream. On first launch To find the full list of supported features, look in the Guitar will show a wizard that needs to identify some Repository menu. As you may notice, Guitar isn’t a CLI command on your machine and asks a few more code editor in any regard – it only enables you to view questions, and after that you’ll be ready to go. Guitar the project files. However, you can always hit the has got all its essential features within easy reach on Explorer button on the toolbar and access the project the main toolbar. As expected, you can clone a Git repo, directory with the file manager.

With Sonice there AUDIO CONTROL TOOL are even fewer reasons to leave your favourite Sonice web browser! Version: 2.2.1 Web: https://github.com/ sunny/so-nice

any Linux enthusiasts tend to hop from one distribution to another until they find their M perfect choice. The same is true for audio players. This month we have a media-related open source tool that may help you finally make a decision on what audio player to use with your setup. Once that’s done, find the Sonice executable Sonice is a tiny web server that works as a remote somewhere inside ~/.gem/ruby and launch it. control for various audio players. The list of supported Without any arguments Sonice will fire up a web programs includes iTunes, Spotify and select Linux server at http://localhost:3000 that will automatically players such as Rhythmbox, Amarok, XMMS2 and MPD. connect to a running and supported audio player. The inclusion of MPD also means support for a bunch Sonice is a great tool for controlling remote players of MPD front-ends and forks that many Linux users within the local network: for instance, you can set up run every day. The idea of Sonice is to give you a web audio playback on a small, low-power device with interface that shows details of the currently playing MPD and control it from another machine. It’s song, the appropriate album cover, and provide possible to remove the playback controls and only playback buttons. It enables you to pause/resume, view the current track, and also use the tool with a change volume or look up the artist’s details without different port. Both options can be enabled using: switching away from the web browser. $ SONICE_CONTROLS=0 SONICE_PORT= sonice the default Gems repository, so installation is simple: Sonice is quick to launch and consumes few $ gem install sonice --user-install system resources – a double-whammy!

80 LXF275 May 2021 www.linuxformat.com

TUTORIALS Photo effects

Credit: www.gimp.org GIMP How to add special effects to photographs Fancy getting more creative in your photography? Mike Bedford offers some inspiration by introducing a few special effects for you to explore.

he phrase “special effects” in photography how quickly things are moving, you might need to leave T can mean different things to different people. a longer gap. For some it means using an app on a phone Turning to the post-processing, load your three to distort your selfie or, perhaps, to add a dog’s nose photos into GIMP as layers. As with all our instructions and tongue to your face. Others use PC software here, you could use any fully featured photo editor, but OUR or smartphone apps to generate a range of you’d have to figure out for yourself exactly how to pre-determined effects with a press of a button. perform each function that we describe. EXPERT However, there’s plenty of scope for applying effects With the first photo selected, choose Components> Mike Bedford using photo-editing software such as GIMP. This is our Extract Component… from the Colors menu. Then, in loves all things theme here but with one key caveat. Our emphasis is on the Extract Component dialog, select RGB Red as the related to effects that’ll exercise your grey matter rather more Component before clicking OK. That layer will change to technology, than, for example, just adjusting the Hue in an image’s a black and white image, specifically one containing the but as this HLS colour definition to introduce some bizarre colours. red component of the colour photo. Now, in much the introduction to We don’t say that from a patronising or disapproving same way, extract the green component from the special effects viewpoint but, quite simply, because if anything is so second photo and the blue component from the third. reveals, he’s simple to achieve then it’s likely to be an overused At this stage, while all three layers appear to be also a fan of effect. Indeed, the word “Photoshopped” has almost greyscale, the image will actually be RGB but, for the traditional taken on a derogatory meaning in some quarters. next step to work, it must genuinely be greyscale. To photographic So, having spelled out some of the effects we’re convert it, select Greyscale from Image>Mode. Finally, methods. not going to cover, we ought to say just what we are covering, but that’s not easy to sum up because we’re using the scattergun approach. All our techniques can be effective, and by introducing such a diverse range of effects, we trust that your creative juices will start flowing. This tutorial won’t show you “how to do special For general- effects photography”. However, we do provide you with purpose fluorescence sufficient guidance to reproduce our selected methods photography to provide a practical introduction to special effects, you need a which you can explore in your own photo projects. moderately high-powered Tricolour images UV torch. You We struggled to come up with a descriptive name for should buy a our first effect, but it offers the interesting combination so-called near of a photo that mostly looks normal, but with moving longwave UV objects “jazzed up”. This can be as subtle or as extreme light source because these as you like, depending mostly on the scene. In common are fairly cheap, with some of our other effects, this can’t be done just by and because post-processing, so you need to consider it when you medium- and take your photos. shortwave UV First, you need to take three identical photos of (as required, for the same scene, so that means using a tripod. In our example, to get example, it didn’t matter how long we left between some minerals those three exposures, so we took them as rapidly as Combining the red, green and blue channels of three shots of the to fluoresce) is possible, so the lighting wouldn’t change between them. same scene can produce subtly dramatic results, like this, or a much more harmful. Depending on your subject, though, and in particular more startling effect.

82 LXF275 May 2021 www.linuxformat.com Photo effects TUTORIALS

select Components>Compose from CREDIT: the Colors menu and then, in the

Compose dialog, accept the default Luis Argerich values and click OK. The result is an image in which the stationary parts look normal, but with a splash of colour in anything that was moving. Invisible light Back in LXF248 we provided guidance on taking photographs in infrared – that portion of the electromagnetic spectrum just longer in wavelength than red light. No mention of special effects photography could be complete without reference to this technique. Traditional infrared photography is a form of black and white photography, although our tutorial also investigated methods by which an infrared and a cheap. For this reason, it’s not commonly used for Many cameras, normal colour shot of the same scene can be combined artistic purposes but for scientific use and forensics. when fitted with to create various false colour effects. Unlike anything However, while we can’t easily take photos using UV, an infrared filter, capture an image that could be done from a single colour photo by it’s possible to photograph an effect produced by UV. that can be post- editing, it has a unique effect by virtue of it making use That effect is called fluorescence and is the emission of processed to give a of the infrared light that our eyes just can’t see. visible light by some substances when they’re surreal false colour A technique we didn’t cover, however, involves illuminated with UV. The effect can be impressive with infrared effect. processing a single image taken with an infrared filter fluorescing objects appearing to glow. over the lens, and takes account of the fact that the red, Fluorescence photography is often used by green and blue elements of some camera’s sensors mineralogists because many minerals exhibit respond differently to different parts of the infrared fluorescence, but there are artistic opportunities here spectrum. For best results, this requires the camera to too. Ideally, we suggest that you arrange for some non- undergo an infrared conversion, although it’s not fluorescent objects to be in the scene too, illuminated necessarily impossible without doing so. This can give with ordinary light, so there’s a contrast with the create some impressive effects, albeit quite bizarre in fluorescent content of the scene. This requires careful nature as you can see from the example shown here. lighting or, alternatively, you could merge two photos: one taken in white light and the other in UV. Infrared versus ultraviolet You do need something fluorescent, of course, and Talk of infrared might raise the question of whether you for your initial experiments you might like to use a gin can photograph in ultraviolet, this time the invisible light and tonic as we’ve done here (see page 84). Actually, just shorter in wavelength than violet light. Well, yes you you don’t need the gin – it’s the quinine in tonic water can but, for various reasons, it’s not easy and it’s not that fluoresces. Having tried your hand with tonic water,

EXPERIMENT WITH COLOURED SHADOWS

It might sound obvious if we were to say that Like our blurry effect, this technique shadows are black but, paradoxically, they doesn’t involve post-processing. However, if aren’t always, and this is key to an artistic you need persuading that this artistic effect effect. For although shadows will be black if has a place in Linux Format, just read on. there’s just a single light source, if there are While you can buy light sources with remote multiple light sources – each a different controls, enabling you to select any colour, if colour and illuminating a subject from a you’re a Raspberry Pi enthusiast then there’s different angle – then each light will colour a cheaper and more interesting solution that the shadows cast by the other lights. will generate enough light for shooting fairly What’s more, if those lights are red, green small subjects. and blue, the subject will be illuminated in The solution is to get hold of a few RGB the three primary colours. It’ll appear fairly (red, green, blue) LED modules and drive naturally coloured, in total contrast to the these from the Raspberry Pi’s GPIO. A bizarrely coloured shadows. Alternatively, possible product is the £2.50 / $2.95 you might find that concentrating just on the Adafruit 3W RGB LED (ID2530), but we’ve Multiple coloured lights can cast coloured shadows and omitting the object(s) that cast not tried it out so we can’t vouch for shadow. Using software-controlled them could provide an impressive and how large a scene a few of these could coloured lights offer some interesting commonly abstract result. illuminate adequately. photographic opportunities.

www.techradar.com/pro/linux May 2021 LXF275 83 TUTORIALS Photo effects

for more variety in the colour of fluorescence, you’ll need to get hold of some fluorescent dyes that fluoresce Although you’ll in a different colour to the blue of tonic water. probably want to experiment Coloured line drawings with lots of Our next form of special effects photography will special effects, exercise your artistic skills rather more. This is another there’s also technique that doesn’t require any special attention a case for when taking the initial shot, although you’ll need to focusing on know what types of subject will provide the best results one. Many pro – something you’ll soon learn by trial and error. Initially, photographers though, go for scenes with bold shapes and lots of have done this: perfected a contrast. In a nutshell, we’re now going to convert the single technique photograph to something that looks like a colour- Although capturing ultraviolet light is tricky, UV causes fluorescence in and then washed line drawing. some subjects, enabling some dramatic effects to be captured. made it their The first stage in the process is to convert the colour signature style. image into a black and white line drawing. There are Having carried out the edge detection, the result still software solutions that will do this with a single click or, doesn’t look much like a line drawing. First of all, there’ll perhaps, which require you to make only a few probably still be some colour in the scene so the next decisions. GIMP doesn’t offer this process as a single job is to select Desaturate>Desaturate… in the Colors operation, but because some of the steps have their menu and accept the defaults in the Desaturate dialog own settings it means that you have a lot more scope to before clicking OK. Second, for most of the edge fine-tune the result. detection options your line drawing will be white on With your photo opened in GIMP, your first step is to black, but we need the opposite. In that case, select select an edge detection tool. Although we’ll later Invert from the Colors menu. convert the image to black and white, we’re using the We’re now getting closer to the effect we need but Outline tool first so it’s able to take account of you can further fine-tune it using the Curves tool in the differences in colour as well as differences in brightness. Colors menu. Unlike using this tool in normal photo There are several such tools under Edge-Detect in the editing, you’ll probably need to edit the default straight Filters menu, and to start it might be a good idea to try line curve substantially, probably to a curve that starts them out to get a feel for what each of them does. Some horizontal in the bottom-left corner and ends close to of them have settings that will affect the width of the vertical at the top-right. As with all aspects of creative lines in the resultant line drawing. special effects photography, once you understand the principles, just play around with the setting until you produce a pleasing solution. B&W-COLOUR HYBRIDS Once you’re happy with the line drawing, the final job is to colour wash it and here there are lots of options. A striking technique is to desaturate the background to an object in a You could mimic the colours in the original photo, you scene, the end result being a black and white photograph with one or could adapt that process by colouring only parts of the more objects appearing in colour. To generate this effect, you only image leaving the remainder as just the black and white need the one photograph, but it’s important to recognise scenes line drawing, or you could abandon reality entirely, where this technique works well. All rules have their exceptions but, in colouring the scene to achieve an artistic effect. the main, this effect is particularly effective in scenes that contain a Your next step is to add a new layer by selecting New single object – or perhaps just a few – that are predominantly a single Layer… from the Layer menu. Then, in the Create a New bold colour, such as the novice Buddhist monk in our example. Layer dialog, select Darken only as the mode – this will In GIMP, open your photo and open another copy of it as a second cause anything you paint on that layer to only colour the layer. Now convert one of the layers to a black and white image by white areas while leaving the black lines black – and reducing the saturation using the choose the fill colour before clicking OK. Often that fill Colours>Saturation tool. Now, colour will be white, although if you want to colour large with the black and white image parts of the scene in a particular colour, choose that as the top layer, and with a colour to reduce the amount of painting you’ll have to transparency mask applied to it, do later. In choosing colours to paint on the new layer, make that mask transparent in although we wouldn’t want to stifle your creativity, we those areas where you want the suggest initially that you start with desaturated colours colour to show through. This is a to better emulate the colour washing effect. standard technique but, if you’ve Finally, with the new layer selected, paint the scene not used it before, see our as you wish. If you feel that your colours are a bit too tutorial on photo stacking in garish, you can make the effect more subtle by reducing LFX272 where we describe the the opacity of the layer on which you added the colour. method in detail. Intentional blurring Generally speaking, sharp photos are considered good Colour is good, and black and white is also good. However, there’s something rather while blurred photos are thought of as failures. As with special about combining the two. many things, though, we’d like to suggest that there are exceptions to that rule and, in particular, a blurred photo

84 LXF275 May 2021 www.linuxformat.com Photo effects TUTORIALS

panning the camera, you should zoom the lens while you’re shooting. Before saying any more, though, we need to point out that this isn’t for everyone. Deliberately Specifically, this won’t be possible on a device in which blurring a photo zooming is controlled using zoom-in and zoom-out requires a buttons. Instead, you need a camera that’s zoomed by moderately long rotating a ring on the lens, so that pretty much limits the exposure, but technique to a DSLR or a so-called mirrorless camera. there’s a limit to how long you It’s fairly obvious what sort of effect this will produce can achieve, below – but if it’s not just take a look at our example ( ) – even with a and except for pointing out that you ought to use a small aperture, tripod, the only bit of guidance we’ll give is on suitable if it’s a bright subjects. Anything with strong perspective – for example day. If you can’t Line drawings can be generated from a photo by a single click, but a street scene, with a viewpoint looking along the street get anywhere GIMP offers a lot more in the way of artistic opportunities. – is always popular, as are objects with rotational close to the symmetry such as a close-up of a flower head. one second we can be a good one, in an artistic sort of way. However, The third method is to rotate the camera while you’re suggest, try we’re not talking of just a bit of blur, but of some rather shooting. Having discussed pan and zoom blur we don’t using one or more neutral excessive blurring and there are at least three way you think we need to say any more about rotation blur, so density filters could achieve that. we’ll leave you to come up with your own ideas. And that reduce Before we begin, we need to admit that this effect finally, irrespective of what method you use to induce the amount of doesn’t involve any photo processing at all. However, blur, we have to emphasise that you probably won’t light entering despite us being passionate about all things computing- have immediate success, but practice makes perfect. the lens. related, we thought it would be rather narrow-minded to Before leaving the topic of blurring, we need to make include only special effects involving software. Indeed, an admission. Despite our saying that these effects we believe that a well-rounded photographer will make don’t involve post-processing, they can be added to an use of all available techniques irrespective of whether ordinary photo using GIMP, even though our preference photo processing is involved. is to achieve the effect while you’re shooting. It’s not as easy to do it in the camera, but the major advantage is Methods of blurring the subject that you know immediately whether you’ve got the The first way of introducing blur is to use a moderately effect you want. In contrast, if you’re relying on post- long exposure and to pan the camera while you’re processing then there’s an element of doubt as to shooting. You’ve probably seen photos in which the whether the base photo is suitable. photographer has panned a fast moving Formula One We said in our introduction to this tutorial that we car, thereby compensating for its movement and wouldn’t show you “how to do special effects rendering it sharp, while the background appears as photography” and we’ve been true to our word. blurred lines suggesting speed. However, we’ve certainly shown you how to achieve Our suggested effect is similar although it doesn’t several particular special effects, and we trust that you’ll necessarily involve panning a moving object. Instead, have some fun trying them out. you might pan a totally static scene, rendering it all as a More than that, though, we hope that this linear blur to provide a somewhat abstract effect. This investigation of special effects photography will inspire method has been used effectively, for example, in you to think outside the box. This might lead you to scanning upwards while shooting a forest scene, adapting some of the effects we’ve shown here. You the end result echoing the shape of the tree trunks, might find ways of combing more than one effect or albeit with a look that’s not too dissimilar to an develop your own unique techniques. One way or impressionist painting. another though, it’s our hope and expectation that this The second way of introducing blur also involves will represent a small step in your escaping from the using a reasonably long exposure, but instead of uniformity of “me too” photography.

Blur doesn’t have to be a bad thing although the result of zooming while you’re shooting is, perhaps, an acquired taste. This effect can be as slight or extreme as you like.

NEED MORE REASONS TO BUY GIN? Subscribe now at http://bit.ly/LinuxFormat www.techradar.com/pro/linux May 2021 LXF275 85 TUTORIALS Co-editing documents

Credit: https:/onlyoffice.com ONLYOFFICE Co-editing documents with Confluence Integration of OnlyOffice Docs with Confluence enables multiple users to edit office documents in a single interface, as Kseniya Fedoruk reveals.

owadays, nobody can imagine their work N without content management, file exchange, and document editing and co-authoring. One of the possible solutions for these purposes is the combo of Confluence and OnlyOffice Docs. OUR Confluence is a collaborative program that enables project work to be organised around files. It’s also EXPERT capable of building a collaborative content creation Kseniya Fedoruk environment combined with the knowledge platform is a document that includes wiki, discussions, blogs and calendars. specialist from OnlyOffice Docs is an open-source office suite that OnlyOffice. She comprises web-based viewers and collaborative editors spends all day for text documents, spreadsheets and presentations demonstrating compatible with OOXML formats. The suite contains The OnlyOffice configuration settings within Confluence. documents and editing, formatting and styling tools along with multiple all night dreaming collaborative features. OnlyOffice Docs can be connected Once done, your copy of Confluence will be available about them. with Confluence via the integration tool. This makes it on http://localhost:8090. possible for multiple users to collaborate on documents in real time and save the changes back to Confluence. Installing OnlyOffice Docs You need an instance of OnlyOffice Docs that’s resolvable Installing Confluence and connectable both from Confluence and any end The easiest way to get Confluence is using an installer. clients. OnlyOffice Docs must also be able to post to You can download the installer for your operating Confluence directly. system from www.atlassian.com/software/confluence/ The easiest way to start an instance of OnlyOffice download. Then you need to run the installer, choose Docs (OnlyOffice Document Server) is to use Docker. the installation type and enter your licence details. Install the latest Docker version and Document Server It’s also possible to get Confluence Server up and with all the required dependencies by running the running using a pre-configured Docker image: following commands: docker pull atlassian/confluence-server sudo apt-get install docker-ce docker run -v /data/your-confluence-home:/var/ sudo docker run -i -t -d -p 80:80 onlyoffice/ Additional atlassian/application-data/confluence documentserver configuration --name="confluence” -d -p 8090:8090 -p 8091:8091 By default, OnlyOffice Docs listens to the port 80. You options such atlassian/confluence-server can change the port for OnlyOffice Document Server if as activating you’re planning to use it instead of the default one: HTTPS or sudo docker run -i -t -d -p :80 setting --restart=always onlyoffice/documentserver environment variables can It’s strongly recommended to store logs, certificates, be found in the cache, and databases outside the Docker containers on github.com/ the host machine. Doing so enables you to easily update ONLYOFFICE/ OnlyOffice Docs once the new version is released without Docker- losing any of your data. Document To gain access to your data located outside the Server container, you need to mount the volumes. This can repository on be done by specifying the -v option in the Docker GitHub. The Confluence environment, with fellow collaborators. run command:

86 LXF275 May 2021 www.linuxformat.com Co-editing documents TUTORIALS

sudo docker run -i -t -d -p 80:80 --restart=always \ -v /app/onlyoffice/DocumentServer/logs:/var/log/ onlyoffice \ -v /app/onlyoffice/DocumentServer/data:/var/www/ onlyoffice/Data \ -v /app/onlyoffice/DocumentServer/lib:/var/lib/ onlyoffice \ -v /app/onlyoffice/DocumentServer/db:/var/lib/ postgresql onlyoffice/documentserver Installing Confluence connector The OnlyOffice integration tool for Confluence is distributed under the Apache Licence 2.0. You can download the latest connector version from the official Atlassian Marketplace or from GitHub. To install the integration tool, log into your Confluence instance as an administrator. Click the Service will use to verify commands from the client/ OnlyOffice Docs admin drop-down and choose the Manage apps option. editor. In the OnlyOffice Docs config file, specify the working within Confluence. Then, click Find new apps on the left panel. Search for same secret key to enable the validation. ONLYOFFICE Connector for Confluence – results will include the versions of the tool compatible with your Connection to the demo server Confluence instance. Click Install to download and You can test OnlyOffice Docs within Confluence without install the connector. Once done, click Close in the an installation of OnlyOffice Document Server. To do that, Installed and ready to go dialog. download and enable the integration tool, and check the An alternative way to obtain OnlyOffice Connector for Connect to demo OnlyOffice Document Server box. A Confluence is to compile the program yourself. You’ll public test server will be available within 30 days. need 1.8.X of the Oracle Java SE Development Kit 8 and Atlassian Plugin SDK. To compile the package, run: Using Confluence atlas-package Once installed, OnlyOffice Connector for Confluence will Once ready, upload the compiled target/onlyoffice- create a new Edit in OnlyOffice action within the confluence-plugin-*.jar file to Confluence on the Manage document library for office documents. You’re able to: apps page. Create new text documents, spreadsheets, and presentations (DOCX, XLSX, PPTX) on your Configuring the Connector attachments page. Just click the New document button Once you’re done with the installation process, go and select the required format. A new file will be created ahead with the configuration. and opened with OnlyOffice Docs. Find the uploaded OnlyOffice Connector for View and edit DOCX, XLSX, and PPTX files. Confluence on the Manage apps page. Specify the Convert ODT, DOC, ODP, PPT, ODS, and XLS files to the address of the machine with OnlyOffice installed in corresponding Office Open XML formats. the Document Editing Service address field. Make Share documents with other users. sure the Confluence server address is accessible from Co-edit documents choosing between real-time and OnlyOffice Document Server for correct work. paragraph-locking co-editing modes, use tracking Sometimes your network configuration might not changes, commenting, built-in chat, and more. allow the requests between installed Confluence and Go back to the Attachments page right from the OnlyOffice Document Server using public addresses. document you are working on by clicking the Open file The Advanced server settings section enables you to location button in the upper right corner of the editors: set the OnlyOffice Document Server address for internal As you can see, connecting Confluence and OnlyOffice requests from Confluence and the returning Confluence Docs is simple thanks to OnlyOffice Connector, which address for internal requests from OnlyOffice. works like a bridge between two services. You can also protect your data and secure your traffic using the JSON Web Token (JWT) standard. To do so, set up a Secret key in the corresponding filed to be USE ONLYOFFICE ON ANY PLATFORM used for generating a token that the Document Editing Confluence is only one of the services you can connect OnlyOffice with. You are also able to use OnlyOffice Docs with other popular sync and share platforms like Nextcloud, Alfresco, ownCloud, Seafile, Plone, SharePoint, Liferay, HumHub and many others. You can install the free version of OnlyOffice’s online editors or choose the scalable commercial build and then just connect the editors with the required service using ready-to-use integration tools. If you need professional editing features for a family-size team, opt for Home Server, a special tariff plan that’s intended specially for non- commercial home use. Detailed information about OnlyOffice Docs can be found on the official website: www.onlyoffice.com. The New Document button for ONLYOFFICE Docs.

www.techradar.com/pro/linux May 2021 LXF275 87 CODING ACADEMY PYTHON Immerse yourself in a first-person shooter Calvin Robinson looks to the iconic PC games Doom and Wolfenstein 3D for inspiration, in the latest instalment in his Python coding series.

his issue we’re going to have a go at designing T a first-person shooter. Wolfenstein 3D (1992) and Doom (1993) are arguably the most notable early successes of the three-dimensional first- person shooter (FPS) genre. Both were released by OUR id Software and designed by John Romero and John EXPERT Carmack. These games featured the player seeing the game world through the eyes of a protagonist, roaming Calvin around levels looking for bad guys to eliminate. The Our client and server will confirm the handshake and connection. Robinson graphics were, of course, pseudo-3D because true 3D is a former graphics hardware hadn’t been invented yet. A lot of the fancy techniques for creating a multiplayer FPS assistant isomorphic project and trickery with sprites was used to game world, including textured raycasting with threaded principal and create an illusion of three dimensions. We’re going to sockets to handle data packets to/from multiple clients. computer replicate that method. PVP Raycast includes textured raycasting, which will science To get started, we’ll need a few things: Python, enable projectiles and player sprite casting; scoreboards teacher with Pygame, and pvp-raycast engine. To install Python, open to monitor kills and deaths; wall shadowing for and a degree a Terminal and type sudo apt-get install python3 , perceived depth; respawning; mini maps and a few in computer followed by sudo apt-get install pip3 . Then you can additional handy features. It’s a great toolset to get us games install Pygame with pip3 install pygame . Finally, grab a up and running promptly. design and copy of pvp-raycast by Raul Vieira from github with git programming clone https://github.com/raulzitoe/pvp-raycast . Import Python modules Pygame provides a lot of useful modules for drawing Open up Python IDLE, hit File>New to create a new shapes and such, and Raul’s raycast engine includes all Script and begin by setting up the modules we’re going to import: import pygame from game import Game import constants as c import socket import time import pickle from sprite import Sprite import threading Instead of setting up our constants at the top of our code, as we normally would, we’ve set up a module to keep them separate. In an additional file called

Our game is up and running, we can move around and shoot bullets. Waiting for the opposition… otherwise known as moving targets!

88 LXF275 May 2021 www.linuxformat.com First-person shooter CODING ACADEMY

constants.py we’ve got our colour variables and other globals, such as screen resolution and the game map. Next we set up our constant variables: BLACK = (0, 0, 0) WHITE = (255, 255, 255) BLUE = (0, 0, 255) GREEN = (0, 255, 0) RED = (255, 0, 0) GRAY = (127, 127, 127) SCREEN_WIDTH = 800 The Kill Counter SCREEN_HEIGHT = 600 paths. We’ve only created one map to begin with, but we in full effect along TEX_WIDTH = 64 could use this array method to produce several different with a top-right TEX_HEIGHT = 64 levels for our game. Try implementing game_map2 etc. mini map. MAP_WIDTH = 24 to introduce more levels. Of course, the challenge of MAP_HEIGHT = 24 each level could increase as the game progresses if you Here we’re clearly defining the colours we intend to were to focus on a single player game, but since this is use in our game, but feel free to custom these as you mostly a multiplayer game we might want to instead see fit. The RGB colour scale we’re using incorporates add different perspectives to each level. For example, red, green and blue pixels much like a paint palette, but different vantage points that the players might want to in reverse with 0 being black and 255 being full colour. fight over for a slight or even perceived advantage. Imagine we’re using a prism and deciding how much of The mini-map itself is set up in minimap.py: each light to let through. 255,255,255 is white because import pygame it allows the full amount of red, green and blue, whereas import constants as c 0,0,0 is black because it allows no light through whatsoever. 255,0,0 would be red, and using numbers in class Minimap: between would alter the shade until it becomes a def __init__(self, square_size): different colour entirely. self.square_size = square_size self.surface = pygame.Surface((self.square_size*c. Get mapping MAP_WIDTH, self.square_size*c.MAP_HEIGHT)). After setting up the colours, we declared our screen convert() resolution at 800x600, which is a retro pre-high self.x = c.SCREEN_WIDTH - self.square_size*c. definition screen res. We also decided the size of our MAP_WIDTH map. We now need to define our game map in self.y = 0 constants.py. Map is another word for level, and not to be confused with the game’s mini-map. def draw(self, destination, world_map, player_x, game_map = ( player_y, dict_sprites): (8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8), (8,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,8), self.surface.fill(c.GRAY) (8,0,0,0,0,0,0,0,0,2,0,0,0,0,2,0,0,0,0,0,0,0,0,8), for i, row in enumerate(world_map): (8,0,0,0,6,6,6,6,6,6,2,0,0,2,6,6,6,6,6,6,0,0,0,8), for j, elem in enumerate(row): (8,0,0,0,6,6,6,6,6,6,0,0,0,0,6,6,6,6,6,6,0,0,0,8), (8,0,0,0,6,6,6,6,6,6,0,0,0,0,6,6,6,6,6,6,0,0,0,8), (8,0,0,0,6,6,6,6,6,6,0,0,0,0,6,6,6,6,6,6,0,0,0,8), PUT THE MULTI INTO MULTIPLAYER (8,0,7,7,6,6,6,6,6,6,0,0,0,0,6,6,6,6,6,6,7,7,0,8), (8,0,0,0,6,6,6,6,6,6,0,0,0,0,6,6,6,6,6,6,0,0,0,8), Setting up a multiplayer game requires a client/server configuration. (8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8), Open the ip_port_to_connect.txt file and alter the second line to (8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8), include your player’s name or alias. The third line will be the IP (8,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,8), address of the computer running the server program, and line //you get the idea four will be the port the server program is running on, awaiting (8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8), connections. The first line will have to be changed from ‘no’ to Think of this as a birds-eye view, where numbers ‘yes’ if you want to enable multiplayer. represent walls with different sprites, and zeroes are Launch server.py on the server machine, then get the client(s) to connect to it. If all goes well, we’ve got a multiplayer game up and running. You’ll see “Connected? Yes” on both the client and the server console if the connection was successful. We hard-coded this information into a configuration file for testing purposes The next step will be to ask the player to enter their alas and the IP address and port of the computer they wish to connect to. As a tip, IP addresses beginning with 192.168.x.x will be local area network addresses. 127.0.0.1 is the IP address of your local computer, known as home, which can be used for testing purposes but no one else will be able to use that address. You can use your PC’s external IP address, and will need to do so if you want clients to connect over the Internet. To find your IP addresses, type ifconfig into Terminal. A second player has joined our game. Prepare to fight!

www.techradar.com/pro/linux May 2021 LXF275 89 CODING ACADEMY First-person shooter

Back in our client.py and first let’s get Pygame working, set up the game clock speed, screen resolution and run the game module: pygame.init() screen = pygame.display.set_mode((c.SCREEN_ WIDTH, c.SCREEN_HEIGHT)) clock = pygame.time.Clock() game = Game() We’ll also want to hide our mouse cursor and set Our server monitors if elem: Pygame to ‘grab’ the mouse input and recognise it as connections to pygame.draw.rect(self.surface, c.BLACK, the player’s movement: the game (j*self.square_size, i*self.square_size, self.square_size, pygame.mouse.set_visible(False) self.square_size)) pygame.event.set_grab(True) # Draw Player Next, we’ll want to read our config file to work out dot_x = (player_x / c.MAP_WIDTH) * self.square_ whether we’re connecting to either a remote game size*c.MAP_WIDTH on a server (the ip address file that we referred to dot_y = (player_y / c.MAP_HEIGHT) * self.square_ earlier) or a local game. size*c.MAP_HEIGHT f = open(“ip_port_to_connect.txt”, “r”) pygame.draw.circle(self.surface, c.BLUE, (int(dot_y), CONDITION, PLAYER_NAME, IP, PORT = f.read(). int(dot_x)), self.square_size//2) splitlines() # Draw Sprites print(“1: {} 2: {} 3: {} 4: {}”.format(CONDITION, PLAYER_ for player_id, sprites_list in dict_sprites.items(): NAME, IP, PORT)) for sprite in sprites_list: if CONDITION == “YES” or CONDITION == “Yes” or if not sprite.is_player: CONDITION == “yes”: dot_x = (sprite.x / c.MAP_WIDTH) * self. game.is_connected = True square_size*c.MAP_WIDTH print(“Connected? {}”.format(game.is_connected)) dot_y = (sprite.y / c.MAP_HEIGHT) * self. PORT = int(PORT) square_size*c.MAP_HEIGHT f.close() pygame.draw.circle(self.surface, c.RED, We used standard file opening and line reading (int(dot_y), int(dot_x)), self.square_size//2) functions. This is English A-Level Python content, for destination.blit(self.surface, (self.x, self.y)) those interested. See our feature on page 42, for We’re simply drawing the map on to a surface, as we insights into coding at school education level. would any other sprite. We’ve done a similar thing with the game engine itself, called game.py. This features the Multiplayer actions input handling, sprite casting and drawing. We have a If we’re planning to run a multiplayer game then we’ll file called ip_port_to_connect and server.py, which we’ll need to open a socket for the connection, send some use later for multiplayer settings. Minimap.py controls details (name and ID) and thread to establish a real- the drawing of our mini map, as the name would imply. time connection: Scoreboard.py sets up the fonts ready to draw text on if game.is_connected: the screen, displaying our player’s score. Sprite.py is a client = socket.socket(socket.AF_INET, socket.SOCK_ very simply class holding sprite information for the STREAM) player and projectile objects. Spritesheet.py is the class addr = (IP, PORT) using Pygame to display images on our screen from a client.connect(addr) sprite sheet, stored in the assets folder. The assets client.send(str.encode(PLAYER_NAME)) directory contains all the images we’ll display, including val = client.recv(8) walls, objects, projectiles, players and the floor. print(“Received id: {}”.format(val.decode())) Changing these will alter the look and feel of our game. game.my_id = int(val)

CUSTOM CROSSHAIR

Modern FPS enable you to customise your gun’s crosshairs. Here, we can clearly alter the size by adjusting the initial This wasn’t the case with the original shooters. If we want to variable ( cross_size ). If we ask our user to input their choice update our game to provide that level of functionality, we’ll have cross_size = input(‘Please enter a crosshair size: ‘) then to edit our game.py and look our for the code below: remember to use a space after the colon, for neatness. cross_size = 20 We could also do this to affect the colour of the crosshairs, pygame.draw.line(screen, c.RED, (c.SCREEN_WIDTH//2 - but we’d have to be sure to change both lines, otherwise the cross_size//2, c.SCREEN_HEIGHT//2 + 20), vertical and horizontal of the crosshair would be different, (c.SCREEN_WIDTH//2 + cross_size//2, c. which could prove a distraction when aiming at a moving SCREEN_HEIGHT//2 + 20)) target during gameplay. pygame.draw.line(screen, c.RED, (c.SCREEN_WIDTH//2, We might want to implement some new settings commands c.SCREEN_HEIGHT//2 - cross_size//2 + 20), to enable the user to change these and more. For example, (c.SCREEN_WIDTH//2, c.SCREEN_HEIGHT//2 + we’d look out for the tilde key (`), which is synonymous with cross_size//2 + 20)) settings inputs.

90 LXF275 May 2021 www.linuxformat.com First-person shooter CODING ACADEMY

A multiplayer first- person shooter in full glory.

t = threading.Thread(target=network_data_handle) game.sprites = sprites_dict_data.copy() t.start() game.scoreboard_data = scoreboard_data.copy() We end our code with the main game loop – this will keep events running until the loop is ended. That means except Exception as e: that our game will continue ticking by at the FPS we print(e) set, draw our graphics on the screen and monitor try: mouse/keyboard input consistently until we send the projectile_data = 0 quit command. if game.shoot: while not game.done: game.shoot = False events = pygame.event.get() projectile_data = Sprite(game.posX, game.posY, game.draw(screen) game.dirX, game.dirY, 0, 0.2) game.input_handle() send_data = pickle.dumps((game.posX, game. pygame.display.flip() posY, projectile_data)) clock.tick() client.send(send_data) pygame.quit() except Exception as e: Now, we have one more class to implement in the print(e) client.py file. It would be best to do this after importing time.sleep(0.001) modules and before the rest of the open code. We are, client.close() of course, programming in an Object Oriented method Here, we’re monitoring and handling input and in order to keep things neat and tidy, because it’s best output data over a network, most probably the Internet. practice. It’s also OOP that enables us to cut down on We’re threading and decoupling loops into Python to code repetition, and link into the class files that we set handle the data, so that our connection doesn’t affect up earlier. the game’s frame-rate. That means our player should The class we’re setting up now is used for handling have a smooth gaming experience – even over a network traffic in our multiplayer games. network – with very little lag. Threading is what enables global client, game us to run multiple processes at the same time. Okay, while not game.done: time to lock and load, and take down the enemy! try: data = client.recv(2048) Fire those bullets sprites_dict_data, death_info, message, at opposing players scoreboard_data = pickle.loads(data) to kill them! if message: game.message = message

for key, sprites in sprites_dict_data.items(): for sprite in sprites: if sprite.is_player: sprite.image = game.player_image else: sprite.image = game.projectile_image if death_info[0] and death_info[1]: game.posX, game.posY = death_info

TAKE AIM AT OUR SUBS AND KILL! Subscribe now at http://bit.ly/LinuxFormat www.techradar.com/pro/linux May 2021 LXF275 91 CODING ACADEMY Directory trees

The code Get it from PYTHON 3 linuxformat. com/archives and on the Monitoring cycles DVD in directory trees Mihalis Tsoukalos sips a cold Mythos in the Greek sun while working with dictionaries, os.walk(), files, symbolic links and directories.

e’re going to use Python 3 to write Linux Before getting into the meat of the subject let’s W command line utilities that work with files and understand the various types of files that can be found finds cycles in directory trees. The thinking in Linux. Remember that UNIX treats everything as a here is that it’s faster to write in Python 3 than to use C. file, even hardware devices such as mice, keyboards However, the tutorial presents some directions for and printers. OUR developing the same utility in both C and Go. Let’s start Some of the files that can be found in Linux are EXPERT by understanding the problem we’re trying to solve. regular files, directories, symbolic links, sockets, named The idea behind the utility is that with UNIX symbolic pipes and block devices. Almost every programming Mihalis; links it’s possible to create cycles (aka loops) in language offers specialised functions or other ways for Tsoukalos filesystems. Put simply, without symbolic links, there determining the type of file or path. What interests us is a systems would be no cycles problem. This can perplex back-up are directories and symbolic links to directories. engineer and software such as tar or utilities such as find and it can A symbolic link is a file that links to another directory technical writer. sometimes have security implications: for example, or file by using its path. Although you can create He’s also the accessing files outside of the designated directory tree. symbolic links programmatically, you usually use the ln author of Go FScycles.py, the utility we’ll be focusing on in this utility for this task. Systems tutorial, attempts to inform us about such situations. Finally, bear in mind that you need to have the Programming The screenshot (below) shows a directory tree using necessary permissions to examine some system and Mastering the tree utility – it’s the ~/go directory where Go puts locations, files and directories. This can limit the output Go. Contact him external packages. Because this directory doesn’t of all utilities that traverse directory trees, including the on @mactsouk. contain any symbolic links, create some using ones shown here. $ ln -s ~/go/bin /tmp/link-to-directory $ ln -s ~/go/bin/golint ~/go/symb-link-to-file Processing arguments $ ln -s ~/go/src ~/symb-link-to-directory As we need to obtain user input, this section illustrates $ ln -s ~/tmp ~/go/symb-link-to-directory how to process command line arguments in Python 3. $ ln -s ~/go/src/github.com ~/go/symb-link-to-src The important thing to remember is that command line $ ln -s /tmp ~/go/symb-link-to-tmp arguments, including the name of the Python script, are kept in sys.argv. The path of the script can be accessed using sys.argv[0] . The following code excerpt from the cla.py script shows how to process command line arguments: for v in sys.argv[1:]: if isInteger(v): print("Integer:”, v) elif isFloat(v): print("Float:”, v) Here’s our This code processes all command line arguments directory structure apart from the first one, which is using a for loop. If the used for testing. value is an integer, as checked by the user-defined It’s good practice isInteger() function, the script prints the relevant to test system message. Similarly, isFloat() checks whether the given utilities before applying them input is a valid floating point value. Because every on production integer is also a valid floating point number, the machines. isInteger() check should be executed before isFloat() .

92 LXF275 May 2021 www.linuxformat.com Directory trees CODING ACADEMY

Running cla.py produces the following output: Here’s the traverse.py utility $ ./cla.py 1 2.0 a exploring the Integer: 1 /etc/apt directory. Float: 2.0 Sometimes you We now need to learn more about dictionaries… might need to filter the long output to get what you Not ones from Oxford really want. Dictionaries or hashes are data structures that associate a key with a value. Dictionaries are illustrated in diction.py and the most important code of diction.py is the following: if k in data: data[k] = data[k] + 1 else: data[k] = 1 Apart from adding new elements to the dictionary Bear in mind that each directory in a Linux filesystem which is as simple as writing dictionary_name[key] = , the aforementioned code shows how to check directory is a shortcut for the current directory whereas Choosing k .. whether a key ( ) exists in a dictionary named data the directory is a shortcut that points to the parent between or not using the if k in data statement. This is an directory. ow.walk() doesn’t visit the .. directories using C and a important task because if you try to obtain the value of because this would mean that it would go outside the programming a key that doesn’t exist, the code is going to crash. So, if specified directory tree. language such key k can be found in dictionary data, then it exists and With all this information in mind, in the next section as Go, Python we increase its value. Otherwise, we insert key k to the we’ll create a utility that traverses directory trees. or Ruby for data dictionary. creating system Running diction.py produces this output: Traversing trees utilities isn’t a $ ./diction.py 1 5 60 This section teaches you how to traverse all files and straightforward decision. 2 13 directories under a given root directory with the help If speed is 1 8 of the os.walk() function. your main 3 19 The most important code of traverse.py is the concern then 5 11 implementation of the find() function that does C might be the 4 9 all of the searching: better option. In the case of the utility that’s going to be def find(directory): Otherwise, use implemented in this month’s tutorial, we want to keep for root, dirs, files in os.walk(directory): a programming each directory that we visit in a dictionary as the key, print("**”, root) language and an integer value that signifies the times that for file in files: that will particular directory was visited. When a key is found in pathname = os.path.join(root,file) increase your productivity. the dictionary, then we have a cycle. But before that, if os.path.exists(pathname): we’ll learn about the handy os.walk() function that print(pathname) enables us to visit directory trees. You can see the three values returned by os.walk() and how we print all the elements of the files list. Finally, os.walk() on by… Python provides the os.walk() function for walking on directory trees. The signature of os.walk() is the USING GO following code: os.walk(top, topdown=True, onerror=None, You can use Go to perform the same tasks as Python 3 because Go followlinks=False) is well suited to systems programming. The logic behind a Go version The default behaviour of os.walk() is not to walk into of the Python 3 utility discussed here is the same: you traverse the symbolic links that point to directories. This behaviour entire directory tree and keep visiting all directories, including changes by setting the followlinks parameter to True. symbolic links to directories, until there’s no directory left to visit. However, this can lead to infinite recursion due to cycles, Go offers the filepath.Walk() function for traversing directory which is the reason for creating our utility in the first trees. However, filepath.Walk() doesn’t traverse symbolic links, so to place. It’s important to remember that os.walk() doesn’t avoid cycles we need to specifically tell the Go utility to visit symbolic keep track of the directories it’s already visited. This is links to directories by calling filepath.Walk() more times. the job of the developer – we’re going to implement this The IsDir() method of the os package (https://golang.org/pkg/os) feature on our own later on. enables you to identify directories whereas the FileMode data type The topdown option specifies that os.walk() walks makes it possible to determine whether you’re dealing with a the directory tree top-down instead of bottom-up. The symbolic link or not. Finally, the filepath.Abs() function (https:// topdown option isn’t used in this tutorial. golang.org/pkg/path/filepath) returns the absolute representation of os.walk() returns a tuple containing three distinct a path, which helps us resolve the real path that a symbolic link points elements. The third element of that tuple is a list of all to. Given the real path of a symbolic link, we can call filepath.Walk() the files in the current directory. The second element is and continue the process. a list of all subdirectories that are found in the current When developing complex command line utilities in Go, consider directory. The first element is the directory that’s using the cobra package (https://github.com/spf13/cobra). currently being visited.

www.techradar.com/pro/linux May 2021 LXF275 93 CODING ACADEMY Directory trees

we print each directory that we visit with the print("**”, root) statement – it’s good to be able to tell which A great book for entries are directories and which are files. learning about Running traverse.py creates the following output: development $ ./traverse.py . in UNIX is ** . The UNIX ./diction.py Programming ./dirOnly.py Here’s the dirOnly.py utility in action. By using the os.path.realpath() Environment. The previous output shows that we’re walking the and os.path.isdir() functions, the utility is able to tell whether a Two other symbolic link points to a directory or not. helpful books current directory, which only contains regular files. This for developing is the expected output so there’s nothing unusual here. system utilities The screenshot on the previous page also shows So far we’ve learnt that the utility improves findType. are Advanced traverse.py in its full glory when scanning the /etc/apt py by processing directories and symbolic links that Programming directory of a Debian machine. point to directories. in the UNIX Although traverse.py is handy, it can’t differentiate The Python 3 code that does the desired job can be Environment between directories, files, special files or symbolic links. found in the following: and The Linux The next section shows how to perform that task. for v in sys.argv[1:]: programming if os.path.islink(v): interface. t = os.path.realpath(v) Although all Differentiate file types these books use After being able to traverse a directory tree structure, if os.path.isdir(t): C, they’re great we need to be able to identify the type of file we’re print('Symbolic Link:’, v, “– guides on how processing. Once again, bear in mind that everything in real path:”,t) the UNIX OS Linux is considered a file, including regular files, elif os.path.isdir(v): operates. directories and symbolic links. This is illustrated in print('Directory:’,v) findType.py that processes its command line arguments else: one by one. print('Not a Directory:’, v) The most interesting code in findType.py is as follows: If a command line argument is a symbolic link, then for v in sys.argv[1:]: we can identify its real path. If the symbolic link points if os.path.islink(v): to an actual directory, we print that as well. However, if if os.path.exists(v): the symbolic link doesn’t point to a directory, then we print("Symbolic Link:”, v, “->”, os.path.realpath(v)) print nothing. elif os.path.isdir(v): Being able to specify the actual destination of a print("Directory:”, v) symbolic link is key because it enables us to know when one or more symbolic links point to the same path. p = pathlib.Path(v) The screenshot (above) shows output from the if p.is_block_device(): dirOnly.py utility. Note that both symb-link-to-directory print("It is a block device:”, v) and symb-link-to-file are symbolic links. However, the The previous code uses os.path.islink() to utility is able to determine that symb-link-to-directory determine if a path is a symbolic link and os.path. points to a directory whereas symb-link-to-file doesn’t exists() to make sure that the symbolic link points point to a directory. This screenshot also shows the to something that actually exists. Similarly, it uses ln(1) commands that created the two symbolic links. os.path.isdir() to make sure that a path is a directory We’re now ready to develop the final version of the and is_block_device() to check whether a file path desired utility. We need to have a data structure to keep is a block device or not. the full paths of the directories that we’ve already Running findType.py generates the following type visited so far. If a directory is found for the second time, of output: then we have a cycle in the directory tree. If a directory $ ./findType.py /tmp /dev/nvme0n1 /sbin path appears more than three times, we end the utility. Directory: /tmp At this point, the user should fix the existing cycles It is a block device: /dev/nvme0n1 before continuing. Symbolic Link: /sbin -> /usr/bin The screenshot (below) shows findType.py in action Inside the Python 3 code using more examples. As you might have guessed, the code is based on the functionality offered by os.walk() . The idea behind the implementation is that we let os.walk() do its job, which is visit directories and follow symbolic links (this is implemented by setting the value of followlinks to FileType.py in True). If a real directory path is visited more than once, action. Note then we have a cycle. how the script processes the / The single most important function of the utility is dev/nvme0* findCycle() : argument, which def findCycle(directory): is automatically for root, dirs, files in os.walk(directory, expanded by the followlinks=True): shell in order to include all key = os.path.realpath(root) file matches. if os.path.islink(root):

94 LXF275 May 2021 www.linuxformat.com Directory trees CODING ACADEMY

print("**”, root) if key in data: USING C data[key] = data[key] + 1 if data[key] >= 3: Most UNIX utilities are written in C or in machine code – this part of return the tutorial explains the basic C system calls for working with the else: UNIX filesystem as well as directories and for visiting all files and data[key] = 1 directories under a given root directory. Because we’re not interested in files, we don’t The most important system call is opendir(3) , which opens a process the files list that’s returned by os.walk() and directory and associates a directory stream with it, enabling you to only work with the root return value (the first return process the directory’s contents. After that you should use multiple value of os.walk() ). calls to the readdir(3) function that returns pointers to the directory By instructing os.walk() to follow symbolic links entries of the path that was passed as an argument to opendir(3) . to directories, we make sure that we’re going to keep The readlink(2) function resolves the value of a symbolic link. visiting directories until there’s nothing left to visit or Additionally, the realpath(3) system call returns the canonicalised until we discover cycles in the directory tree. However, absolute pathname of its argument. This can be useful for as stated before, it’s our job to do something when a determining whether the given argument is outside of the current directory is visited more than once because otherwise directory tree or not, because realpath(3) can resolve symbolic links the utility will most likely never end. to their real paths. Following that symbolic link is as simple as calling The call to os.path.realpath() translates each visited opendir(3) again. However, to make sure that a given path is a path, being a regular directory or a symbolic link, into its directory, you should use the stat(2) system call. real path – that real path is used as the key to the data Once again, it’s the developer’s job to stop searching once a cycle is dictionary. If a real directory path is visited more than found. Additionally, the programmer should make no assumptions three times, it means that we’ve already found a cycle about the order that the files and directories are searched or returned that keeps showing up, so we might end the process. from the OS, which is true for all programming languages. Therefore, the findCycle() function returns to the Should you wish to learn more about traversing directory main() function and the traversing process ends. hierarchies, you can look at the source code of the find utility. The screenshot (below) shows the Python code of FScycles.py. If you execute the utility without any The output shows command line arguments, it begins by using the current the symbolic links directory as the root of the directory tree that’s being that were found tested for cycles. and might be the cause of the cycles Using the utility in a directory tree. Now we’ll show FScycles.py in action using the filesystem shown in the screenshot on page 92 (with the additional symbolic links) as an example: $ ./FScycles.py ~/go ** /home/mtsouk/go/symb-link-to-tmp wish to fix the cycles, you should begin by examining ** /home/mtsouk/go/symb-link-to-tmp/link-to- and maybe deleting the symbolic links one by one – this directory is the reason for displaying them on the screen. ** /home/mtsouk/go/symb-link-to-src The screenshot (above) shows FScycles.py in action Found 411 cycle(s). using more complex directory trees. Because the number of cycles can be pretty big, the script just prints the total number of entries of the data Final thoughts dictionary that were visited more than once, which is Systems programming is a critical part of UNIX this case is 411. The utility also prints the symbolic links programming and includes areas such as working that were found because some of these symbolic links with files and directories, system files and configuration are responsible for the discovered cycles. Should you files, process control, signal processing, network programming and File I/O. Python 3 can help you create system tools or prototypes of system tools quickly, securely and productively. Although the C version of FScycles.py might have a faster execution time, it would involve writing more lines of code. As always, it’s the problem that dictates your choice of programming language. However, it’s always good to have lots of tools in your programming arsenal and Python will not disappoint you. Learn more about os.walk() at https://docs.python.org/3/library/os. html#os.walk. If you want to learn Python 3, you can By using the functionality of os.walk(), the FScycles.py utility is read books like Think Python, Python Cookbook: Recipes straightforward to implement. for Mastering Python 3 and Effective Python.

GO ROUND IN CIRCLES WITH US… Subscribe now at http://bit.ly/LinuxFormat www.techradar.com/pro/linux May 2021 LXF275 95 DOWNLOAD YOUR DVD Get code and DVD images at: www.linuxformat.com On the disc /archives Discover the highlights from this month’s packed DVD!

ENCHANTING DISTRO START HERE MIN SPECS: 2GB RAM, 20GB DISK

USING THE LXFDVD Using Linux for the first time can be very confusing. It’ll most likely be Mageia 8 64-bit unlike anything that you’ve operated before, especially if you’re ageia’s roots go way back to Mandrake to so by unchecking boxes. This edition of used to Microsoft Windows or Apple and Connectiva in the late 90s, which Mageia uses Kernel 5.10 and Plasma 5.20, which macOS. M merged to become Mandriva in the are by no means old, but since this is a static Generally our DVDs are designed to 2000s, which Mageia became a fork of in 2010. release these numbers will start to seem low as be run directly, which is to say that when you first power on your PC (or If you remember any of Mageia’s pioneering the months pass. Also if you want to install Mac, see below) it should ‘boot’ predecessors, you’ll probably find their echoes Steam you’ll need to enable 32-bit repos. from the DVD – so before Windows in Mageia. Perhaps in the thoughtfully Mageia is an RPM-based distro and comes or macOS even starts to load – with customised KDE desktop (others are available) with the RPMdrake graphical package manager. Linux running directly from the DVD. This trick is known as a Live Disc. It or the undeniably useful Mageia Control Centre. You can also install Dnfdragora, or use Dnf (the enables you to try out the various Mageia has a friendly installer that will have modern replacement for Fedora’s Yum) directly. versions of Linux without having to your system ready in a matter of minutes. One The initial install is fairly complete. We were install or change anything on your slightly odd thing is that users aren’t set up until pleased to see the Clementine music player PC. Just remove the DVD, restart after you reboot into the new OS. Then you get included, and GIMP too, which many distros your PC and it’ll be exactly as you left it. to make accounts for root and a regular user. today are eschewing in favour of lighter While many systems will boot Mageia doesn’t use sudo to elevate privileges, so alternatives. If you need help, just fire up the from a DVD when it finds one, many you might need to get used to using the root Konversation IRC client and it will connect will not. See below for the standard account if you’re coming from Ubuntu. straight to the #mageia channel. process for enabling booting from a There’s a wealth of software in Mageia’s It’s been nearly two years since Mageia 7 was DVD on various desktops and laptop PCs. repositories, which are divided into Core (free released, so we were keen to get the new release software), Non-free (proprietary software and on to the DVD and our testing rigs. One thing we The alternative option is to locate the ISO file on the DVD and write drivers), Tainted (multimedia codecs) and forgot about since back then, and which nearly this to your own USB thumb drive Backports (for newer software). By default, all derailed DVD-production, is that Mageia uses and attempt to run that. We except Backports are enabled, but if you wanted quite a funky boot process. As a result, we had to recommend using Etcher from to be closer to free software ideologies you could hack our own initrd image so that it would work https://balena.io/etcher that’s available for Windows, macOS and with our boot menu. This Linux. Good luck! worked for us and hopefully it works for you too. But if it doesn’t don’t worry, we BOOT THE DISC have the ISO file intact in Many PCs should boot the Mageia/ folder on the automatically if they’re turned on with a disc in the drive. If not, many DVD. So just write that to a offer an early Boot Menu accessed USB stick (see our DVD by tapping a key while powering up support page) and then you from cold: F9 (HP), F12 (Dell, can run Mageia as team Lenovo), F8 (Amibios) or F11 (Award BIOS). Alternatively, use the Mageia intended. BIOS/UEFI to adjust the boot order to start with the optical drive. Again, Mageia’s stylish Control Centre will this is accessed by tapping a key enable you to configure everything during power up, usually Del but to your heart’s content. 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 then 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 Mac owners: Hold the C key www.linuxformat.com/dvdsupport. Unfortunately, we’re unable to offer advice on while powering on your system using the applications, your hardware or the operating system itself. to boot from the disc.

96 LXF275 May 2021 www.linuxformat.com AND MORE! SPACE-SAVER MIN SPECS: 256MB RAM, 4GB DISK THE LXF LIBRARY

Advanced Bash Scripting Guide AntiX 19.3 32-bit Go further with shell scripting. Bash Guide for Beginners hat with all the DVD-palaver this month something a little different. It also comes with Get to grips with the basics antiX very nearly didn’t make it onto tools for mastering your own custom antiX- of Bash scripting. W the disc. Which would have been a spins. That’s ideal if you want to make a live USB Bourne Shell Scripting great shame, not just because of efficient DVD rescue medium. First steps in shell scripting. usage, but because it’s probably our favourite There are also tools for editing window The Cathedral and distribution for older machines. It’s based on manager and Conky settings, which is great the Bazaar Debian stock so it’s not going to break, and it will because configuring these things by hand is Eric S. Raymond’s classic text explains the advantages of be supported until 2024, by which time there’s a fairly daunting for new users. Antix also makes it open development. good chance your 32-bit hardware will have easy to switch between window/desktop clocked its last CPU-cycle. managers, so if you’d rather use SpaceFM over The Debian Book If you don’t like systemd, then good news! Rox, it’s just a couple of cascading menus and Essential guide for sysadmins. AntiX still uses SysV-init scripts, or you can clicks away. Of course, you’re not going to find Dive Into Python switch to the Runit init system. The default the user friendliness of modern desktops here, Everything you need to know. desktop uses the ultralight IceWM window but there are utilities for setting up network Introduction to Linux manager together with Rox (which draws icons, shares and hardware/drivers and an enthusiastic A handy guide full of pointers the panel and the desktop background). You’ll community too. Because of space we’ve only for new Linux users. see system stats gloriously displayed on the included the base edition here (which you’ll see Linux Dictionary desktop via Conky, and you’ll probably note the is a featherweight 450MB), but you’ll find any The A-Z of everything to do initial memory footprint is ridiculously low – software you need in the Debian repositories. with Linux. around 100MB. This release, dubbed Manolis Glezos, is Linux Kernel in a Nutshell Of course, just because it’s so light doesn’t actually from back in October, but since it’s An introduction to the kernel mean you have to use it on old systems. A 64-bit based on Debian stable this is neither here nor written by master hacker Greg Kroah-Hartman. release is available, so if you’re fed up of Gnome there – it’s not a distro for those seeking the and KDE eating all your memory you might find latest packages. If you are hoping to run this on The Linux System antiX pleasantly refreshing. The desktop uses very old hardware, then you’ll be pleased to hear Administrator’s Guide bold icons, so lightweight doesn’t mean lacking that antiX doesn’t require a CPU with PAE Take control of your system. in style. There are also a choice of other window (Physical Address Extension), so you might even Tools Summary managers, Fluxbox and JWM, if you want get it running on your 486. Overview of GNU tools. GNU Emacs Manual Six hundred pages of essential information!

Producing Open Source Software Everything you need to know.

Programming from the Ground Up Take your first steps.

Not only does antiX make it easy to install the Nvidia driver, you can also use Windows wireless drivers via ndiswrapper.

NEW TO LINUX? START HERE… Never used a Linux before? Here are some handy resources: Read our quick-install guide http://bit.ly/LXFinstall Looking for an answer? https://askubuntu.com Want to delve more deeply? https://linuxjourney.com

www.techradar.com/pro/linux May 2021 LXF275 97 The #1 open source mag

Future Publishing Limited, Quay House, The Ambury, Bath, BA1 1UA Email [email protected] EDITORIAL Editor Neil Mohr LateLateLate editor Jonni Bidwell Art editor Efrain Hernandez-Mendoza Operations editor Cliff Hope Group editor in chief Graham Barlow ESCAPE Senior art editor Jo Gulliver Editorial contributors Mike Bedford, Neil Bothwick, Tam Hanna, Matthew Hanson, Jon Masters, Nick Peers, Les Pounder, Michael Reed, Calvin Robinson, Mayank Sharma, Shashank Sharma, Zak Storey, Mihalis Tsoukalous, GOOGLE PHOTOS Alexander Tolstoy Cover illustration magictorch.com Raspberry Pi is a trademark of the Raspberry Pi Foundation. Google is stopping free photo storage Tux credit: Larry Ewing ([email protected]) and The GIMP. ADVERTISING Media packs are available on request Commercial sales director Clare Dove in June 2021. We explore the open [email protected] Senior advertising manager Lara Jaggon [email protected] Head of commercial – Technology Dave Randall source options for photo backup. [email protected] Account director Andrew Tilbury [email protected] INTERNATIONAL LICENSING Linux Format is available for licensing. Contact the Licensing team to discuss partnership opportunities. Head of Print Licensing Rachel Shaw [email protected] NEW SUBSCRIPTIONS & BACK ISSUES Web www.magazinesdirect.com UK 0330 333 1113 World +44 (0) 330 333 1113 EXISTING SUBSCRIPTIONS Web www.mymagazine.co.uk UK 0330 333 4333 World +44 (0) 330 333 4333 CIRCULATION Head of newstrade Tim Mathers PRODUCTION AND DISTRIBUTION Head of production UK & US Mark Constance Production project manager Clare Scott Senior ad production manager Jo Crosby Digital editions controller Jason Hudson THE MANAGEMENT Chief audience and ecommerce officer Aaron Asadi MD, tech specialist Keith Walker Head of art & design Rodney Dive Commercial finance director Dan Jotcham LXF276 Printed by Wyndeham Peterborough, Storey’s Bar Road, Peterborough, Cambridgeshire, PE1 5YS Distributed by Marketforce, 5 Churchill Place, Canary Wharf, London, E14 5HU www.marketforce.co.uk will be on Tel: 0203 787 9001 Linux® is the registered trademark of Linus Torvalds in the U.S. and other countries. sale GNU/Linux is abbreviated to Linux throughout for brevity. Where applicable code Tuesday printed in this magazine is licensed under the GNU GPL v2 or later. See www.gnu. org/copyleft/gpl.html. All copyrights and trademarks are recognised and respected. 4 May 2021 Disclaimer All contents © 2021 Future Publishing Limited or published under licence. All rights reserved. No part of this magazine may be used, stored, transmitted or reproduced in any way without the prior written permission of the publisher. Future Publishing Limited (company number 2008885) is registered in England and Wales. Registered office: Quay House, The Ambury, Bath BA1 1UA. All information contained in this publication is for information only and is, as far as we are aware, correct at the time of going to press. Future cannot accept any responsibility for errors or inaccuracies in such information. You are advised to contact manufacturers and retailers directly with regard to the price of products/ Easy server admin services referred to in this publication. Apps and websites mentioned in this publication are not under our control. We are not responsible for their contents or any other changes or updates to them. This magazine is fully independent and not affiliated in any way with the companies mentioned herein. We’re lazy around here, so there’s nothing more we like 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 than a good ol’ GUI-based administration console. any/all issues and/or editions of publications, in any format published worldwide and on associated websites, social media channels and associated products. Any material you submit is sent at your own risk and, although every care is taken, neither Future nor its employees, agents, subcontractors or licensees shall be liable for loss or damage. We assume all unsolicited material is for publication unless otherwise stated, and reserve the right to edit, amend, adapt all submissions. All contents in this magazine are used at your own risk. We accept no liability for any loss of data or damage to your systems, peripherals or software through the use of any guide. Better browsing Notes: the font server was entirely broken by the new OpenType Benton Sans, which was fun. Still using Internet Explorer? Of course you’re not, so we look at 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 the big-name, full-fat web browsers to power your daily browsing. produced from sustainable managed forests, conforming to strict environmental and socioeconomic standards. The manufacturing paper mill and printer hold full FSC and PEFC certification and accreditation.

You too can Gentoo Future is an award-winning international media group and leading digital business. We reach more than 57 million international consumers a month and create world-class It’s the fastest of penguins… we show you how to get to grips content and advertising solutions for passionate consumers with the compile-it-yourself distro and reap the speed rewards. online, on tablet & smartphone and in print. OpenStreetMaps We revisit the awesome, crowd-powered, open source

Future plc is a public Chief executive Zillah Byng-Thorne world-mapping project, which has passed one million edits. company quoted on the Non-executive chairman Richard Huntingford London Stock Exchange Chief financial officer Rachel Addison (symbol: FUTR) www.futureplc.com Tel +44 (0)1225 442244 Contents of future issues subject to change – we may be still browsing photos from 2001.

98 LXF275 May 2021

9000 9001