B & 7G 9.2 4. t 1 in m
Raspberry Pi projects!
D x EE V la FR D s
Enhance your maker skills with these cool builds GPIO Web control PC to Pi copy Easy-build bots
The #1 open source mag
landed! Land Linux safely on your PC with our full guide to a perfect, smooth install
pages of tutorials & features
Guacamole – the tastiest remote desktop solution Collabora’s
Olivier Crête Meet the man who powers your multimedia streaming dreams
Low-level access with assembly
minecraft turtles Use Python and turtle graphics for drawing fun
Discover the best lightweight distros to run Fully power Android with the Linux terminal
Welcome Win a secure Nitrokey Storage 2
who we are This issue we’re getting a perfect install with Mint 19.2, so what’s the first software you need to have installed on a fresh desktop setup? Neil Bothwick I‘m tempted to say Emacs, just to irritate all those with a preference for a weird text editor, but it’s probably ZShell. I do like my terminal. If you’re talking about graphical desktop software, maybe Chromium, as I love sharing all my browsing history with the world.
Nick Peers It has to be BitWarden, my password manager. Once that’s in place, I’m able to log into other accounts and download other tools, whether it’s Signal for secure desktop messaging or Handbrake for ripping DVDs.
Aaron Peters For Internet things, I’ll install Google Chrome straight away (yes, I’m aware of Chromium). For writing, Emacs and Pandoc come next. Finally, Git for version control. With these three programs, I can jump into work, and install others if I find I need them.
Calvin Robinson On a fresh install of any distro I like to grab Spotify, even before installing my favourite text editor or IDE. I can’t begin coding without some decent background music! The Ubuntu client runs perfectly well on Mint, but if I’m running a non-Debian based distro I’ll use the web client.
Alexander Tolstoy I usually go for Oracle’s VirtualBox, which lets me run various Linux distros and test hot open source software picks without putting my host system at risk. After that I get the Extension pack for it.
Send your thoughts to the Linux Format dungeon server at firstname.lastname@example.org and secure your chance to win a 32GB Nitrokey! It’s the complete open hardwareencrypted storage solution! Learn more at www.nitrokey.com.
Mo Mint, mo problems There’s no better, friendlier introduction to using Linux than Linux Mint. If you’re picking up this magazine for the first time, hello and welcome to Linux: the open, smart, friendly way to use a modern PC. Best of all, it’s all been freed for you to use – liberated, you could say – so you’re free to install it, use it and modify it however you would like to. Linux and the accompanying library of open source tools means you’re no longer locked to a single OS vendor, a single desktop or a single app store. Coded and maintained by an army of developers across the globe, this sometimes means things might not be as slick as under macOS or Microsoft Windows, but we think that’s more a strength of the Linux open ecosystem – and it’s one that even Microsoft has had to start to embrace. With the recent release of the new Linux Mint 19.2 we’ve decided to visit how best to install it for a perfect setup. Hopefully both newbies and longtime Linux users will get useful insights into how to better set up their systems and get started guided by our tamed Linux expert Jonni. As in every issue there’s so much to explore, and it covers a massive range of experience – from basic app installation to assembly coding for accessing Linux system calls. We’ve also got both 32- and 64-bit distros this issue, so older machines can stay supported – while we’re looking at lightweight distros in our Roundup, so you can keep older systems running. We’re also wondering where the world could be headed in the form of the new open source Google OS called Fuchsia with its new Zircon micro-kernel. Could this eventually supplant Linux, or are we just turning pink with envy? It’s a lot to take in as always, but have a play around and enjoy!
Neil Mohr Editor email@example.com
Subscribe & save! On digital and print – see p26
October 2019 LXF255 3
This ISSUE: IBM gives you the Power Microsoft gets you exFAT Godot hearts Vulkan KDE hearts GNOME Pine64 pays out
IBM makes its Power ISA open source The OpenPOWER consortium also becomes part of the Linux Foundation. BM’s Power CPUs have been powering systems since the 1980s, and the company has now made the Power ISA (Instruction Set Architecture) open source in a bid to make the chips more widely used. The move will enable hardware manufacturers to build their own processors based on IBM Power CPUs, like the Power9, without having to pay royalties. The move will, according to IBM, make the company the “only processor vendor and POWER the only architecture with a completely open system stack, from the foundation of the hardware through the software stack.” The move is a welcome one, and certainly makes a lot of sense, with the increasing popularity of the open-source RISC-V ISA. RISCV’s success has also lead to its competitor Arm being encouraged to open up its licensing – so IBM could have sensed which way the wind was blowing and decided to make the move early in a bid to remain relevant. IBM has also open-sourced reference designs for its Open Coherent Accelerator Processor Interface (OpenCAPI) and the Open Memory Interface (OMI). Following the move, Computer Business Review interviewed Mendy Furmanek, Director of OpenPOWER Processor Enablement at IBM about IBM’s motives (read the full interview at http://bit.ly/LXF255IBMInt 1). According to Furmanek, “Open sourcing hardware reference designs enable faster adoption of new technologies and accelerates hardware innovation across the ecosystem.” Furmanek also denied that this move was to counter RISC-V’s growing popularity. “IBM is a
member of the RISC-V Foundation [and] while there could be some overlap between RISC-V and POWER architectures over time, current implementations are focused on different segments of the market, and we believe that there is room in the industry for both architectures to grow.” IBM also the OpenPower Foundation (https://openpowerfoundation.org), an open technical community based on the Power architecture and led by IBM, will become part of the Linux Foundation. Ken King, general manager for OpenPower at IBM, told TechCrunch (https://techcrunch.com) that “We are taking the OpenPower Foundation, and
IBM has made its Power CPU architecture open-source in a bid to drive adoption and innovation.
“Open sourcing hardware reference designs enable faster adoption of new technologies” we are putting it as an entity or project underneath The Linux Foundation with the mindset that we are now bringing more of an open governance approach and open governance principles to the foundation.” Adding the OpenPower Foundation into the Linux Foundation community will help boost innovation, while increasing adoption. It’s definitely a positive move from IBM that looks like it should benefit both he company and the wider open source community, while offering an alternative to RISC-V and tightening the screws on Intel’s dominance in the processor market.
The Open Power Foundation has now also joined the Linux Foundation.
1) www.cbronline.com/news/ibm-power-isa-linux-foundation 6 LXF255 October 2019
Got a burning question about open source or the kernel? Whatever your level, email it to firstname.lastname@example.org
address Q Unauthorised I have installed CentOS 7 in VirtualBox. I tried to send an mail using the mail command like this: $ echo “Test mail” | mail -s “Mail Status” email@example.com
But I get this error message: The IP you’re using to send email is not authorized......
I tried clearing the IP mentioned in the above error logs from SPAMHAUS and no luck. What could be reason I am not able to send email from my Linux server to any external email account? What is needed to get this resolved? Julie Pirouet
The mail command needs an SMTP server in order to send mail. If you haven’t specified one on the command line, I will assume you are using Postfix running locally, as that is the default configuration of CentOS. So mail (the command) sends your email to Postfix, which then determines how to send the email to the recipient and tries to do so. The last part is causing the problem and is most likely because you are using a residential IP address. Many servers reject mail coming from residential IP addresses because they are often spam from a
compromised Windows system. The answer is to send your email through your ISP’s mail server, which is trusted by the rest of the internet. Check your ISP’s help pages for their outgoing mail server address – probably mail.isp.com or smtp.isp.com – and tell Postfix to use this by setting relayhost in /etc/postfix/main.cf, like this: relayhost = mail.isp.com
After restarting or reloading Postfix, you should find that your mail reaches its destination. This affects all mail sent through Postfix, except mail bound for the local network. It is possible to set up transport mappings in /etc/postfix/ transport to specify a relay only for those domains that you know require one, or to not use a relay for domains that do not need one. However, this will be timeconsuming to maintain as the number of domains blocking residential addresses is increasing, and you risk important mail not being delivered when you find out about changes. I tried fighting this battle many years ago and soon concluded that it was simplest to send all external mail through your ISP’s relay. If you have privacy concerns about sending your mail through a third party’s server, remember that all mails can take
Neil Bothwick has kernels compiling every hour of the day!
any valid route through any servers and that private emails should be encrypted before sending.
servers Q Mobile I have a server running ownCloud, a server running a website and a house control server, all on Raspberry Pis. They are all running on a landline with modem port-forwarding. However, I will be moving soon and for a period of time staying in a caravan where I only have access to mobile data using the Three network. Is there a way I can use all my servers on the mobile network with the problem with all providers using cgnat and having no fixed IP? Ray Hughes
It is possible to do what you want, but you will need a publicly accessible server with a fixed IP address in order to do this. You can get a virtual private server (VPS) for a few pounds a month. You don’t need anything fancy or powerful, just a server running a standard Linux distro with a fixed IP address. Then you can set up reverse SSH tunnels between the VPS and each of your local servers. As the tunnel is set up from the local server, it doesn’t matter what its IP address is, or whether it is hidden behind NAT. Let’s call your two machines vps.com for the remote, publicly accessible system, and homeserver.lan for your local web server. The first step is to log into the remote server and edit /etc/ssh/sshd_ config to include: GatewayPorts yes
A home automation server running through an SSH tunnel, and it looks exactly the same as when run directly.
12 LXF255 October 2019
This is needed for port forwarding. The default is no , so either change the existing setting or add the above line to the end of the file. You should also enable passwordless root logins and copy the local servers’ public keys to /root/.ssh/ authorized_keys. Root access is needed if you want to forward ports below 1024, otherwise you can do this as a normal user. Then restart the server. Now, on your local server, open a terminal or SSH session, and
Reviews Single board computer
Banana Pi Pro and SAVE 5%
Banana Pi Pro
with the code LXFPiPro5 at: RobotShop.com
Mike Bedford investigates how this SBC compares to its similarly named competitor… Specs OS Lubuntu, Raspbian, Android and others CPU Arm Cortex A7, 1GHz, dual core GPU Arm Mali 400 MP2 RAM 1GB HDD microSD slot Display Fullsized HDMI, DSI USB 2x 2.0 (fullsized), 1x 2.0 OTG (micro) GPIO 1x 40-pin header (RPi compatible) Ports CSI (camera), SATA 2.0, analogue audio I/O infrared, microphone Comms Ethernet, Wi-Fi (802.11 b/g/n – 2.4GHz) Size 92 x 60mm
he success of the Raspberry Pi family of single board computers has spawned a large number of other low-cost SBCs, many of which can be considered compatible with the RPi at one level or another. Some competitors aim to provide RPi performance at a lower price, while others target their products at a higher performance level. From its name, it seems reasonable to assume that the Banana Pi family of products claims compatibility with the RPi. However, a quick glance at the specification would seem to suggest that the Banana Pi Pro (sometimes called just the Banana Pro) doesn’t compare too favourably with the Raspberry Pi on either specification or price. First impressions can sometimes be deceptive, though, so we were keen to take a more in-depth look and put it through its paces.
Performance Right from the start, getting the Banana Pi to work wasn’t quite as easy as we’ve grown accustomed to with Raspberry Pi products. In fact we couldn’t get it to boot at all, so we ended up consulting the support team, who suggested trying a different microSD card. Despite being sceptical – because the card we used was of the required class and worked on a RPi 3 B+ – swapping to another card got us up and running. The bottom line, therefore, is that’s it’s rather annoyingly fussy in this respect. For many applications, performance isn’t everything with an SBC but some of the Banana Pi Pro’s headline figures do appear to be somewhat dated, especially when we bear in mind that the Cortex A7 is a 32-bit architecture. The processor sub-system could be described as a two-core version of the four-core Raspberry Pi 2, with a slight boost to the clock speed. The boot time wasn’t as bad as we’d feared, however; with Lubuntu, from power-on it took 36 seconds to the login prompt, and then a further 18 seconds until the complete desktop was displayed. Benchmarking with Sysbench, however, painted a rather grim picture. Calculating prime numbers up to 20,000 on both cores took 420 seconds, averaged over a few runs. By way of comparison, the Raspberry Pi 3 B+ completes this in about 90 seconds, and the new RPi 4 in 63.
Interfacing Depending on your aims and aspirations, expansion capability could be as important, if not more so, than raw speed. While the Banana Pi Pro falls behind the RPi 4 in terms of the number of USB and HDMI
Despite some advanced I/O facilities, the Banana Pi Pro costs a lot for what you get.
ports, it has a DSI port for an LCD panel and a CSI port for a camera – RPi features that don’t appear on all lookalikes. For those who want to dabble with hardware interfacing, it has that all-important 2 x 40-pin GPIO header. What’s more, that header is RPi compatible – again, not something that’s universally true. The BananaPi also has some interfacing options that aren’t found on the RPi. First up, and most unusually for SBCs, is a SATA 2.0 port for interfacing hard disks or SSDs. For storage-heavy applications, this will offer a big improvement over a flash memory card – so if you have a spare disk, this could be handy. Of course, a USB 3.0 disk, which some SBCs support, offers similar performance, but if you’re building your board into a case, this option would mean the disk has to be external and thus transported with the SBC. Also unusual is its on-board infrared receiver and microphone, plus an analogue audio output. This could be handy if you intend to use the Banana Pi for some handheld applications.
VERDICT Supplier: RobotShop Web: www.robotshop.com Price: £58.22 Features 8/10 Performance 5/10
Ease of use 7/10 Value 6/10
Lacklustre performance compared to modern Raspberry Pis, but with some interesting interfacing options, including a SATA interface for high-speed hard disks or SSDs.
Rating 7/10 * Terms apply: Offer available 18 September to 18 December 2019. Orders limited to one per customer. Subject to availability.
20 LXF255 October 2019
subscribe Save money today!
Sign up today and get your
White Eclipse 3-Way USB Charger Charge multiple devices at maximum speed with the Eclipse 3-Way USB Charger. This easy-on-the-eye charger is a three-port USB charging hub that keeps 6m of cables neatly wrapped inside when not in use, while providing neat pop-up access with a press of its top.
YOUR GIFT! Worth £69.99
Don’t miss out, subscribe now!
Product Features Three devices at once No more messy cables Holds 6m of cable Smart-IC Technology High-speed charging
SUBSCRIBE NOW! www.myfavouritemagazines.co.uk/lin/eclipse19/
Call: 0344 848 2852 26 LXF255 October 2019
Overseas subs on p67
PLUS: Exclusive access to the Linux Format subs area! 1
! don’t miss ars Now with 5 ye & of Linux User er op el ev D issues
CHOOSE YOUR PACKAGE! Quarterly print
£16.25 Quarterly print by Direct Debit
Annual print and digital
Every issue comes with a 4GB DVD packed full of the hottest distros. Plus your Eclipse 3-Way USB Charger
Get both the print and digital editions with a 4GB DVD. Plus your Eclipse 3-Way USB Charger
22% That’s just £5 per issue!
Annual print and digital by Direct Debit
That’s just £5.54 per issue!
Terms and conditions: This offer is only available for new UK subscribers. Gift is subject to availability. Product pricing stated is RRP at original print date. Please allow up to 60 days for the delivery of your gift. In the event of stocks being exhausted we reserve the right to replace with items of similar value. Prices and savings quoted are compared to buying full-priced print issues. You will receive 13 issues in a year. You can write to us or call us to cancel your subscription within 14 days of purchase. Payment is non-refundable after the 14-day cancellation period unless exceptional circumstances apply. UK calls will cost the same as other standard fixed line numbers (starting 01 or 02) or are included as part of any inclusive or free minutes allowances, if offered by your phone tariff. For full terms and conditions please visit www.bit.ly/magterms. Offer ends 31 October 2019.
October 2019 LXF255 27
1) Only available to MyFavouriteMagazines.co.uk subscribers.
1,000s of DRM-free PDF back issues and articles! Get instant access back to issue 66 (May 2005) with tutorials, interviews, features and reviews. At linuxformat.com
roundup Lightweight We compare tons ofdistros stuff so you don’t have to!
Roundup antiX BionicPup BunsenLabs Tiny Core Q4OS
Shashank Sharma By day Shashank is a New Delhi trial lawyer, but by night he’s an open source vigilante!
Lightweight distros Inspired by his hike across the US’s East Coast to cut the flab, Shashank Sharma decides to give the same treatment to his desktop.
how we tested… For some, a lightweight distro is one that has a minimal footprint on a computer’s resources (memory, processor and storage), while for others it’s all about the size of the downloadable ISO image. Then there are those who think of lightweight distros as ones they can lug around on a portable USB key. First and foremost, we’ll pick lightweight distros not because of their app selection or their default desktop environment, but only because they identify themselves as such. Secondly, our selection may or may not be frugal in terms of their bouquet of apps, and might not even be light in terms of the size of their ISO. They will, however, be misers when it comes to leaving a footprint on the physical resources of the computer, which is what helps to save these computers from ending up in a landfill.
28 LXF255 October 2019
Diminutive little machines that have served us faithfully for years now line our attics – and all because they can’t cater to the needs of resource-guzzling releases from the mainstream distributions. But you can’t really blame the distributions. The projects have to appeal to a large number of users, which forces them to make unprecedented demands on the hardware. Many also lack the resources and manpower to support hardware that’s not in vogue anymore. That would explain why many popular projects – everything from beginner distros such as Solus and elementaryOS to the privacy-centric Tails
Linux – don’t support the 32-bit platform. Even mainstream projects like Arch and Ubuntu no longer offer installation ISOs for 32-bit machines. Ubuntu even considered dropping support for the 32-bit platform altogether, but had to backpedal after outrage from the community. The desire to put these old, otherwise abandoned machines to good use has fuelled the demand for ‘lightweight’ options, both for individual apps and for complete distributions. We’ll look at some of the best lightweight distros in this roundup that’ll help you push your trusty old workhorse back into active service.
Lightweight distros roundup
Package management Can you flesh them out easily? e don’t all use the same apps on our computers, which s why package management is one of the first things we test on any distro. All the projects featured in this Roundup are pretty much equally efficient in this aspect, though for different reasons. BunsenLabs makes it easy to install popular apps by adding entries to fetch and install them within the application menu itself. The distro also makes it a point to let users know that they shouldn’t install software from outside the official sources, and particularly advises against adding Ubuntu PPAs. Tiny Core has a unique package-installation process. When installing a new application, you can choose between having the package load into the distribution automatically at boot time or on demand. Choosing to load a package at boot makes it available to you immediately after a reboot. On the other hand, choosing to load it on demand will speed up boot times, as the app isn’t loaded – or mounted, in Tiny Core parlance. To use an on-demand app, you’ll first have to load it manually. Packages in BionicPup are called pets and have a PET extension… awww. You can install packages using the distro’s custom Puppy Package Manager tool. By default, the package manager fetches apps from Ubuntu’s repositories, but you can configure it to download packages from other Puppy repositories as well. You can also download SquashFS files (compressed environments) for some popular apps like Kodi, KdenLive, LibreOffice, WPS Office and more.
Besides the package manager, BionicPup includes the Quickpet app to install popular apps.
Q4OS is the only other distro that bundles its own custom app center, which you can use to install about 19 mainstream apps including Synaptic, which you can then use to pull any other package from the Debian’s repositories. Finally there’s antiX, which also uses the Synaptic package manager but still ranks higher than the other distros because of its Package Installer app, which can be used to install popular applications in over 30 different categories. This includes individual applications, complete desktops and even different kernels. It also has proprietary apps such as the Spotify player and Steam. The tool is so extensive that you really don’t need to use a package manager unless you need a particular library.
VERDICT antiX 9/10 Q4OS 8/10 BionicPup 9/10 Tiny Core 7/10 BunsenLabs 8/10 You can tweak the default bouquet of apps in all the distros quite easily.
Suitability How well do they perform on underpowered hardware? his is another area where the candidates are more or less equally matched, with some slight differences. As all the distros cater to underpowered machines, they ship with a large number of lightweight apps. For instance, antiX boots into a IceWM desktop by default and uses the Rox file manager, but it boasts about a dozen other combinations of lightweight window and file managers. It even offers a core edition that ships with just enough applications to help you build your desktop from scratch. BionicPup uses JWM, which is one of the lightest window managers and most of the productivity is derived from resourcerespecting custom apps. The lightweight edition of Q4OS uses the Trinity desktop and requires anything upwards of a 300MHz processor and 128MB RAM. However we found it to be quite sluggish, even on a machine with three times more resources than the minimum requirements. Similarly, BunsenLabs – which features the Openbox window manager with the tint2 panel and Conky system monitor on the desktop – can theoretically boot on machines with 256MB of RAM, but it wouldn’t really be much fun to operate.
Bunsen’s 32-bit build uses a PAE-enabled kernel, but the hybrid ISO doesn’t require PAE support in the CPU, making it suitable for older machines.
Tiny Core however, true to its name, performs exceedingly well on antiquated machines: it’ll run on a i486 computer with just 48MB RAM. For a smoother timne though its developers recommend a Pentium 2 or better computer with 128MB of RAM. Those are some pretty impressive minimum requirements.
VERDICT antiX 8/10 Q4OS BionicPup 8/10 Tiny Core BunsenLabs 7/10 There’s no beating Tiny Core when it comes to antiquated hardware.
October 2019 LXF255 29
Perfect Linux install
Perfect your Linux
install Before disappearing off the edge of the screen for a sabbatical, Jonni Bidwell delivers important guidance on Mint.
ver get the feeling that your current Linux set up is just ‘okay’? Maybe it’s functional, maybe even tidy, but lacking that je ne sais quoi that would make it awesome, outstanding, something your friends would be jealous of. Well, on sait quois – or we at least know a few things that could help you towards desktop satori. Whether you’re planning to install the freshest edition of Linux Mint, or revamp your existing install (be it Mint or otherwise), we’ve got some guidance for you. We’ll deliver the low-down on theming and other customisations. We’ll cover flexible partitioning with LVM, so you can add extra distros with ease. Sometimes things go wrong, but we’ll show you how to do swift GRUB repairs
and restoration of backups using the Mint live disc. As you may infer from all that, we’re big fans of Mint. But there’s lots of wisdom we’ll impart that can be applied to any distro. We’ll cover adding desktop environments and customising them to
but if you’re one of those people whose ears prick up at the prospect of booting five seconds quicker, we’ll show you how to analyse and optimise boot times with evil Systemd. If you’re not one of those people, maybe our insight will turn you into one. Beyond that, we’ve got a delicious cornucopia of little tips that we wished we’d known about before – everything from lesserdocumented command line frobs to Mint’s oh-so-simpleto-use firewall. There’s something to be said for sticking with default settings, and out-of-the-box setups are designed to offend as few people as possible. But there’s a lot to be said for making your home your own too. Right, let’s get on with it then…
don’t start from scratch “Your existing install can be tweaked, maybe even perfected, by following tips and exploring variations thereof in this feature.”
34 LXF255 October 2019
your whim, and we’ll furnish you with some lesser-known apps that you really should get to know better. Linux boot times are pretty impressive these days,
Perfect Linux install
What is perfect? Only you can make your install perfect, but we can show you a few pointers towards desktop satori. hankfully, installing Linux isn’t the perilous adventure it used to be. Gone are the days where even if you followed the instructions you’d carefully downloaded, printed and annotated (because you only had one computer and it was entirely likely to be deprived of network or GUI access for hours to come), there was still a chance your machine would end up broken. Today, most Linux installs happen without a hitch and the whole process takes about five minutes. On any given day our hard-working writers (who’s that? – Ed) may have installed Linux twice before breakfast. Still, we get enough angry or bewildered letters every month to understand that sometimes things don’t go to plan. Even when they do, one is often left with a few gripes and niggles that aren’t easily remedied. Often the solution is simple, but getting to it involves hours of trawling through log files or Linux fora. Well, we’ve put in those hours of trawling and combined the fruits of those labours with the years of experience of Team LXF to bring you our guide to perfecting your Linux install. If you already have a perfectly serviceable Linux install, but not a perfect install, don’t worry. There’s probably no need to re-install and lose your precious settings. Your existing install can be tweaked, maybe even perfected, by following tips and exploring variations thereof in this feature. It’s a little tricky if, say, you decide you want to move your existing root filesystem into an LVM partition, whereas setting up LVM is trivially easy to do if you’re doing a fresh install. On the other hand, moving /home to a separate partition, something commonly thought to require re-installing, is actually pretty straightforward and at a pinch can be done without even rebooting. We’ll show you how to do it using the Mint live environment. Users continue to enjoy Mint’s Cinnamon desktop (or MATE if you like) as an alternative to the now-dead Unity. Gnome 3 – the most contentious of desktops – and indeed Ubuntu’s customisation of it is also perfectly useable these days. Whatever your desktop preferences, we’ll show you how to install Gnome and a few other desktop environments later on.
Whatever your perfect install is, it probably involves some kind of unbridled naturalbeauty landscape as the background.
Diagnosing issues Obviously your setup is unique, and it’s possible you’ll encounter an issue or an error that’s hard to remedy. As a beginner it can be hard to know what to do next, and often the natural response is to type some angry comments into the nearest forum. This doesn’t help anyone, and probably just makes you look silly. Typing some keywords (or the whole error message) into a search engine is a better start, but don’t go blindly following the first solution you find unless you’re sure it applies. Try to understand what any command does before copying and pasting it. Mint has one of the friendliest communities, so do use the forum at https:// forums.linuxmint.com. Make sure to study the posting guidelines so you make a good first impression. If you want to conduct your own investigations then Systemd’s journal is the best place to look for clues. Open up a terminal and type journalctl -b to look at the log for the current boot (use journalctl -b -1 to see logs from the previous boot) and use the arrow keys to scroll through. Search by pressing / and typing some terms. Hit Q when you’re done trawling through journal output. Also, don’t worry – lots of programs issue scary-looking but harmless warnings, so don’t go chasing waterfalls, or something. If you want to see only errors then use journalctl -b -p err .
If you have two displays, you can have two backgrounds. Setting this up is easy with Mint.
This GRUB error on install is the bane of a lot of people’s lives, and it’s documented in the release notes.
October 2019 LXF255 35
Interview Olivier Crête
I dream OF
Jonni Bidwell talks to Collabora’s Olivier Crête about everyone’s favourite open source multimedia framework.
42 LXF255 OCtober 2019
Olivier Crête Interview
livier Crête leads Collabora’s multimedia team and has been working on GStreamer since 2007. As far as we know, this is the only Linux software to reference the classic western The Good, the Bad and the Ugly in its package naming scheme (look it up). Olivier has also worked for the Gentoo project for the best part of a decade, which we found odd because other than that he seemed pretty normal. He was good enough to share some of his erudition with Jonni the one time we let him out last year to attend the Linux Foundation’s Open Source Summit in Edinburgh. Check out Olivier’s ‘GStreamer for Tiny Devices’ talk from the same conference a year earlier at http://bit.ly/lxf255gstreamer 1. Olivier is also a veteran of instant messaging, having worked on GnomeICU – which some of our more seasoned readers will no doubt remember. Now that we’ve got you all nostalgic about IM clients gone by, cheer up and hear about the future: PipeWire, GStreamer and royalty-free codecs.
Linux Format: How long have you been at Collabora – are you one of the old-school people there? Olivier Crête: I’ve been there for 12 years now, so a little longer than Daniel. I was employee number six and there are now only two people left who’ve been there longer than I have. And there are over a hundred Collaborans now. When I was in university I maintained Gnome ICU – it was an ICQ client. Philippe, the co-founder of Collabora, was working on aMSN. So that’s how we met: we were both doing IM clients for different protocols and we ended up collaborating on system tray icons for these. Later, he started Collabora and a year later he calls me up and says “Hey, are you looking for a job?”. I was super happy. He remembered I had all this instantmessaging experience and at that time that was most of Collabora’s business. So I signed the contract and showed up for my first day. He said “My team” – which at the time was just him, essentially – “deals with the video side of things, and we do everything with GStreamer”. I said “That’s cool, but I know nothing about GStreamer”, so my first day was spent reading introduction manuals. And that was 12 years ago now. Sheesh.
Do you remember ICQ? Olivier does.
LXF: Did you get into coding quite early? OC: Yes, my dad programmed with punchcards in the ’70s. When I was a kid we had one of the original IBM PCs, before Compaq and everyone started making PC clones. He taught me BASIC, then there was QuickBASIC, then I got into learning C, and the rest is history. LXF: I learned to program in BASIC, but now I’ve exchanged lots of BASIC bad
of what we do is help people to use GStreamer, mostly on embedded hardware. This involves integrating the hardware encoders and decoders with the video capture and video display parts of the device. Things like recording from a camera, encoding it and then streaming it over the internet. Or, conversely, receiving a stream from the internet, decoding it and displaying it on the screen. But we also deal with more
the gstreamer dream team “We help people to use GStreamer, mostly on embedded hardware. This involves integrating the hardware encoders and decoders with the video capture and video display parts.” habits for lots of Python bad habits. Actually I don’t really program much any more – I write about other people’s programming. So it’s nice to come here and see what people are up to. OC: Actually my job now involves quite a bit of management, and a lot of it’s about enabling other people to program – then there’s a bit of sales and talking to clients about how we can help them. It’s interesting in a different way. LXF: So tell me about what multimedia projects Collabora are up to. OC: Collabora’s main focus in our multimedia team is GStreamer, so a lot
advanced cases: [with] professional video equipment, things like video calls are complicated because of the low latency requirement [it entails]. LXF: There’s a lot of talk about low latency, and how to get it even lower, at this conference. Is this exciting? OC: It depends. Low latency really means different things to different people. For example, I was talking to some people from the BBC’s R&D team. They’re doing a GStreamer-based project, and they say they want low latency, which to them is less than satellite TV, which is six seconds [three up and three down]. If you were in
October 2019 LXF255 43
in-depth Google Fuchsia
The Fuchsia is bright (pink)!
Tam Hanna’s career saw him use a wide variety of embedded operating systems. Let him guide you through a quick look at Google’s new OS. aving a background in the aerospace industry helps with understanding other market trends: much of the recent operating system development can be analogised by looking at the TU-334 and MD-9x aircraft series. Both of them fizzled out at the end of their relative career, as they were overtaken by rivals based on more modern airfoils. Operating systems face a similar situation. Standards such as POSIX might have tamed the wild growth of UNIX platforms in the past, but has since become both benefit and curse. For example, implementing POSIX in its entity on a small microcontroller is not particularly entertaining. It, furthermore, has consequences on latencies which can be catastrophic. At the start of my development career, microcontrollers were slow and
cumbersome. Dedicated real-time operating system vendors made a killing with products such as FreeRTOS or ThreadX – they offered extremely stringent latency demands, but had little in terms of GUI or network stacks. In the past, embedded designers used combinatorial process computers not dissimilar to the Arduino Yun. A classic desktop operating system handled user interaction, while a real-time core managed system control. The miracle of semiconductor engineering ensured that microcontroller performance increases steadily. Present-day STM32 controllers can outrun 20-year-old workstation, for instance. Google’s Fuchsia is, in some way, the natural continuation of this trend. Based on cutting-edge research in theoretical informatics, the operating system is intended to be as efficient as possible while still offering developers a wide range of APIs and services. Recent developments help this trend: developers have, by and large, forgone C++ for higher-level languages which are interpreted at run time.
Credit: Google 48 LXF255 October 2019
Google Fuchsia in-depth inux is, in principle, a highly reliable operating system – but it does also have some weaknesses of its own. Firstly, the GPL licence is not to everyone’s liking; the realities of the market show that keeping your source code secret can lead to significant benefits in many scenarios. Fuchsia avoids this problem – most of the operating system is under a three-clause BSD licence, while the Littlekernel used as the base of Zircon is MIT-licensed. Problem number two stems from the development of computer hardware: Linux got started on 32-bit microprocessors with next to nothing in terms of graphics acceleration. Fuchsia’s kernel is strictly 64-bit, while the graphics uses Vulkan. This, incidentally, is why support for the Raspberry Pi 3 was dropped last year. Multithreading and multi-core SoCs put an emphasis onto simultaneous multiprocessing and its support in the operating system. Dennis and Van Horn’s famous paper Programming Semantics for Multiprogrammed Computations introduced the world to the idea of capability-based kernels – an interesting way to handle permissions by a ‘token’ data structure. Fuchsia uses this design pattern instead of the ACLs found in other operating systems, and finally switched to the microkernel pattern. This means that most drivers (such as file systems) live outside of the kernel – binary blobs provided from vendors are less critical and can be integrated more easily. In short, Fuchsia does bring theoretical concepts to life. Let’s take a look…
Getting Fuchsia Google currently does not provide ready-to-run images for the Fuchsia project. Developers must, instead, compile the code themselves – not a trivial task due to the immense complexity of the codebase. We used our trusty AMD FX-8320 octacore, which was taxed to the max. We used Ubuntu 18.04 LTS on the host – older versions might also be able to do the trick. The first step is to download a few components and fire off the bootstrapper script provided by Google: sudo apt-get install build-essential curl git python unzip golang curl -s “https://fuchsia.googlesource.com/ fuchsia/+/master/scripts/bootstrap?format=TEXT” | base64 --decode | bash Done creating a Platform Source Tree at “/home/ tamhan/fuchsia”. Recommended: export PATH=”/home/tamhan/ fuchsia/.jiri_root/bin:$PATH” When done, the current working folder will contain a subdirectory called fuchsia. It acts as home for the downloaded files, which are around 24GB in size – don’t worry if the download process takes quite a bit of time, due to various updates being installed. Should you dislike modifying your PATH settings, feel free to enter the emitted command into every Terminal window you intend to use with the Fuchsia tools: export PATH=”/home/tamhan/fuchsia/.jiri_root/ bin:$PATH” At this point, setting up swap is highly recommended. While most of the compile needs less than 10GB, memory demands skyrocket to over 32GB at one point: if your 16GB RAM machine does not have enough swap, all kinds of madnesses and unresponsiveness will take place.
The following sequence creates a 20GB swap file and enables it – make sure to delete it when done, and to re-enable it after reboots: sudo swapoff -a sudo fallocate -l 20G swapfile tamhan@TAMHAN18:/$ sudo mkswap swapfile mkswap: swapfile: insecure permissions 0644, 0600 suggested. Setting up swapspace version 1, size = 20 GiB (21474832384 bytes) ... sudo swapon ./swapfile The sources downloaded must, next, be parametrised via the set command. It is responsible for setting the target architecture and packages required: fx set core.x64 --with //bundles:kitchen_sink ... Generating compile_commands took 624ms Done. Made 28103 targets from 2263 files in 13059ms At this point, we are ready to command a deployment by entering fx build – by default, the compilation toolchain will use all cores of your machine, used the -j flag to limit core use. Keep in mind that the source code will expand to more than 100GB – on our box, the size of the folder is almost 110GB: fx build -j 7 . Now that the compilation process has run its course,
The Acer Switch Alpha 12 is officially supported for Fuchsia development.
Run on real hardware QEMU is not a bad emulator, especially when run with KVM acceleration on a somewhat recent workstation. It is, however, sorely lacking in the graphics department – if you need high graphics performance, look elsewhere. Should you feel like performing significant Fuchsia development, running the product on real hardware is definitely recommended. As of this writing, Google sadly doesn’t support single board computers based on 64-bit Arm processors. Instead, only the following three bits of hardware are officially supported: Acer Switch Alpha 12, Intel NUC, Google Pixelbook Tests by ArsTechnica revealed generally good performance on the Pixelbook, at least as long as a release build was deployed; with debug builds, the GUI stack was quite slow. Should you be able to get your hands on one of these, simply follow the installation instructions found at http://bit.ly/lxf255fuchsia. Just make sure the network link between your workstation and the target is fast – debugging over Wi-Fi is really not fun, to say the least.
October 2019 LXF255 49
TutorialS Web control
Controlling the Pi from a web-based app Les Pounder shows us how to create a web app using pure Python to control the Raspberry Pi GPIO. e’re going to create a web interface using Anvil that uses just Python. This interface will enable us to control real components: a red and blue LED along with a buzzer, connected to a Raspberry Pi. The hardware build for this project is just two LEDs, one connected to GPIO17 and the other to GPIO27. We used a 330 Ohm resistor to connect each LED to the GND pins of a Raspberry Pi 4. The buzzer is connected to GPIO22 and GND, and requires no resistor. Please see the diagram in the download for this project for detailed information.
our expert Les Pounder is a freelance maker who works with organisations such as the Raspberry Pi Foundation to promote maker skills.
You need Any model of Raspberry Pi A desktop/ laptop Internet connection Breadboard 2x 330 Ohm resistors (Orange, Orange, Brown, Gold) 2x LEDs Buzzer 6x femaleto-male jumper wires Code: https:// github.com/ lesp/LXF255/ archive/ master.zip
Writing the code
On a PC visit https://anvil.works and create a free account by clicking Start Building. Follow the sign-up instructions, then click Create App,appear then select the theme Material Design. In Anvil the layout is as follows. On the left is an App Browser used for configuration. In the centre is where our app – called a form in Anvil – is designed using elements from the top right of the screen, called the Toolbox. You will see ‘Material Design’ as the name of the app in the top left of the screen; change this to ‘GPIO Control’ by clicking the text. Next we need to add three buttons to the form. The Button tool can be found in the toolbox, just hover the mouse over the icons to identify them. Drag each button over to the form and place them next to each other. For each button change the ‘text’ field in the properties menu (bottom right of screen) to the following values: RED BLINK, RED TOGGLE, MUSIC. The next step is to place a Label from the toolbox under
54 LXF255 October 2019
Anvil apps are made using a design tool, but accessing the code underneath is just a double-click away.
the buttons, and then change the label text to “Blue Brightness”. To go with this label we need a TextBox; drag it so that it’s horizontal next to the label and change the placeholder text to “Please enter a value between 0 and 1, eg 0.4”. Now add another button, this time placed underneath the previous components. Change the text to “SET BRIGHTNESS”. To enable this app to communicate with our Raspberry Pi we need an API key. In the top left of the screen is a cog settings menu. Click it and select Uplink. There will be a button to get your server API key. Click the button and copy/save/write down this key. With that complete we can now write some code for the Anvil web app. Double-click the RED BLINK button. This will automatically take us to the appropriate section of code, which is a function. Replace pass with the following code, make sure that it is indented to match how pass was formatted. anvil.server.call(“red_blink”) Make a note of red_blink as we shall be reusing that
on the Pi. To go back to the form, click Design. Now change the code for the two other buttons in the same manner as before. RED TOGGLE: anvil.server.call(“red_toggle”)
The final button is SET BRIGHTNESS and for this we need to add a different line of code. Double-click the button to edit. anvil.server.call(“blue_brightness”, float(self.text_ box_1.text))
This will call a function on our Raspberry Pi called blue_brightness and it will pass a value stored in the The Anvil editor is laid out with an App Browser, Form and Toolbox, which hide a wealth of features and functionality.
TextBox that will control the LED on our Pi. That’s all of the code for Anvil, but before we move on to the
TutorialS File transfers
Copying files from your PC to your Pi Swapping data between a Raspberry Pi and your PC can be tricky. Christian Cawley shows you all the useful options. ne of the key aspects of using a Raspberry Pi involves copying data to it. This could be anything, depending on your use; perhaps you have a Bluetooth audio streamer project on the go, or a digital picture frame. You may need to send over a directory of MP3 files to play, or PNG images to view. Dumping the files to a USB stick on your PC then dragging them from the flash storage on your Pi is one option. It’s straightforward, but lacks finesse, and adds too much physical interaction. Instead, it’s smarter to use a network option, taking advantage of the local network to beam the data wirelessly or over Ethernet from your PC to your Pi. You might even set up a network share and make your Pi available to move data to and from, using any device on your network. These methods should work with all Raspberry Pi models, although some will be more suited to the later devices.
our expert Christian Cawley A former hardware and software support engineer, Christian has eight Raspberry Pi Model Bs in captivity. He plans to add a Model A.
Communicating with a Raspberry Pi over SSH from Windows 10 no longer requires PuTTY. Instead, simply install the OpenSSH client in PowerShell. Do this in Settings > Apps > Manage optional features. Click ‘Add a feature’, then select ‘OpenSSH Client’. Reboot Windows to install, then open PowerShell to start an SSH session.
You can stick it! Before we look at the high-tech alternatives, however, it’s worth going through the basics. Say you have a bunch of files you need to copy from a PC to your Raspberry Pi. All you should need to do is insert the USB drive in to your PC, wait for it to mount, then drag the files to it. Safely eject the USB stick once the data has been copied, then insert it into your Raspberry Pi. At this point, it should be automatically mounted in the Raspbian operating system – the results may vary with other OSes, though. If the USB stick doesn’t automatically mount, open the terminal and find the UUID (Universal Unique Identifier ) of the device: ls -l /dev/disk/by-uuid
The USB device will probably be labelled sda1; keep a note of the name regardless. Next, create a mount point like this: sudo mkdir /media/usb
Next, set the Pi user as the folder owner. sudo chown -R pi:pi /media/usb
Finally, mount the drive with: sudo mount /dev/sda1 /media/usb -o uid=pi,gid=pi
All you need to do now is open the file manager, find the device in the left pane, and click to browse. You can then drag the files from the USB flash device to the intended directory on your Raspberry Pi. When you’re
56 LXF255 October 2019
Email attachment limits will prevent you from sharing too much data from your PC to your Raspberry Pi, so keep an eye on file sizes.
done, use the eject button in the file manager to remove the USB stick. If you manually mounted, enter: sudo umount /media/usb
With microSD cards, things are a little different. Sure, you can use the /boot directory to copy data from your PC without disrupting the main file system, then drag it into place when the Pi is running. But if you want to use SD storage with a USB adaptor, you’ll need to install software that lets Raspbian access drives in the exFAT format. SD storage is almost always formatted in this way as the file table has been optimised for SD cards. The tools you need are exfat-fuse and exfat-utils. These work together to mount exFAT drives as well as format in exFAT format. As ever, start with an update and upgrade: sudo apt update sudo apt upgrade
Once complete, install exfat-fuse and exfat-utils. sudo apt install exfat-fuse sudo apt install exfat-utils
This is particularly useful if you’re planning to set up a Samba server or any other project that requires removable flash media.
Browsing by Another straightforward option for copying files from a desktop computer to your Pi is to use the browser. Two
Accessing RSS feeds in the terminal
Shashank Sharma has long aspired to do just about everything from the comfort of his beloved terminal. Accessing RSS feeds is no exception. lthough browsers drove them to the brink of extinction, dedicated RSS readers are making a comeback, thanks in part to Firefox ending native support to read RSS feeds. If you prefer working on the terminal, whether because of the functionality, the speed or versatility, you’ll quickly become enamoured with Newsboat. Forked from Newsbeuter, the MIT-licensed project is available in the software repositories of most Linux distributions such as Fedora, Ubuntu, Arch, Debian and others. As the tool depends on a handful of libraries such as libcurl, stfl. and other lightweight projects like pkgconfig and SQLite3, you can easily install Newsboat by compiling it from source, on the off chance your distribution doesn’t offer it in the software repositories. Even better, you can install it using the Snap package by running the sudo snap install newsboat command.
our expert Shashank Sharma is a trial lawyer in New Delhi and avid Arch user. He’s always on the hunt for budget-friendly geeky memorabilia.
Get anonymous with Tor Newsboat itself doesn’t ship with an anonymising feature, so all your browsing is susceptible to snooping and the inherent risk of connecting to the internet. If you’re interested in protecting your identity online, you must connect Newsboat with a proxy server. You can even configure it to work with Tor, but the process might be slightly more involved depending on your distribution of choice. Another issue with installing Tor using the software management tool on your distribution is that although most distributions ship it in the software repositories, it isn’t updated as often, so the latest version might not be available for a long time. But this is a distrospecific problem, and might not be a factor for all users. Once Tor is running and socksport is set to the default port 9050, you can connect Newsboat with Tor by adding the following lines to the ~/.newsboat/config file:
Once installed, you can launch Newsboat by running the newsboat command.
Poot poot, all aboard! Fortunately, getting the tool to work doesn’t involve perilously mucking about with config files, tweaking settings and adjusting parameters. When you first run Newsboat, it will complain of not being able to find any feeds in the ~/.Newsboat/urls file. This is the default location for all feeds. You can alternatively run the newsboat -u <url-file> command to get Newsboat to fetch feeds from a different file. While you don’t have to fiddle with any other settings to get the tool to work, if you would like to personalise Newsboat, you can do so using the user specific config file located at ~/.Newsboat/config. A fresh installation doesn’t create this file automatically, so you must do it yourself. For a list of all configurable parameters, head to the documentation at http://bit.ly/newsboat-help, or refer to the man page. A typical configuration might look like this: delete-read-articles-on-quit no download-retries 2 feed-sort-order lastupdated desc notify-beep yes
Even if you haven’t yet scrolled through the
use-proxy yes proxy-type socks5 proxy localhost:9050
The first line tells Newsboat to use a proxy server. We next define the type of proxy, in this case socks5 , and finally the port number. You must also remember to define the download-retries parameter in the ~/.newsboat/config file, especially when using Tor.
60 LXF255 October 2019
Newsboat supports a number of different keybindings such as Enter, /, n, ^K and so on. If you need a refresher on the keybindings, press ?.
Tutorials Manage your software
Install and manage apps in Ubuntu distros
Nick Peers reveals where to find apps, but more importantly how to install, update and – if necessary – purge them from your system. hat is Linux without the various applications and programs you run on it? There’s a rich collection of programs covering just about every aspect of your computing life waiting to be discovered, and in this tutorial we’ll reveal everything you need to know about tracking down apps and installing them, along with removing unwanted programs when you’re done with them and ensuring Ubuntu (and its spin-offs) cleans up behind itself.
our expert Nick Peers is no longer confused by snaps, flatpaks and appimages. But as for .sh scripts…
Where to find apps The first place to start looking for apps is your distro’s software centre; in Ubuntu it’s easily accessible from the Favourites bar. This provides a convenient graphical
The Synaptic Package Manager interface 1 4
frontend to all the software repositories installed on your PC. Repositories are convenient storage locations for finding, installing and updating software on your PC, and come in the form of ‘package lists’, which include the package names and version numbers. When you first launch Ubuntu Software you’ll see a home page providing shortcuts to six categories of application, along with some recommendations. Click one to read a description and view ratings and reviews – pay particular attention to the Details section, where you’ll be warned if an app requires ‘unconfined’ access to all personal files and system resources. If you like the look of it, click Install, enter your user password and wait for the program to be downloaded and installed. Once installed, you see a row of buttons, including options for launching and removing (uninstalling) the program. You may also see a Permissions button – click this to set up specific permissions for the app. For example, Audacity enables you to grant access to files in your home folder, play and record sound and read/write files on removable storage devices. View previously installed apps – including those that came with Ubuntu – by selecting the Installed button at the top of the Ubuntu Software window. Apps are divided into three sections: regular apps at the top, system apps in the middle (these cannot be removed as they’re required for the Gnome desktop) and any addons. A third button provides a convenient shortcut to any outstanding updates, although Ubuntu’s default setting will ensure apps are kept updated alongside Ubuntu itself (see below).
Manage repositories Reload button 1 This effectively issues an ‘apt-get update’ command to refresh the package lists. Sections Filter the view by category (and repo, whose name is displayed in brackets).
Choose a filter These buttons let you pick different filters: status allows you to filter by various types of installed app, for example.
62 LXF255 October 2019
App list 4 Click an app to select it or tick it to mark it for various bulk actions, such as installation or removal. App description The currently selected app’s description is here, complete with handy links to screenshots and change logs.
App properties Click the Properties button to view detailed information about the highlighted item.
The easiest way to view and manage software repos is through the Software & Updates package. Open the launcher and search for ‘software’ – you should find Software & Updates is the second package in the list. If Ubuntu Software is already open, you can also open it quickly via the Ubuntu Software menu (choose ‘Software & Updates’). This will open a multi-tabbed window; the first two tabs are of interest to us. The ‘Ubuntu Software’ tab enables you to pick and choose which of Ubuntu’s main four repos you want to use: main, universe, restricted
Tutorials Linux on Android Part Two!
Don’t miss next issue, subscribe on page 26!
Put a little Linux into your Android device
Aaron Peters, never satisfied to leave well enough alone, needs more mobile Linux tools in his Android phone – and so do you! eady? It’s time to up your Android device’s Linux game, and provide a much more fullyfeatured Linux environment. We’re going to take a look at some technology that supports ‘Linux-onAndroid’ functionality. Then we’ll dive into an app called Termux that’s easy to install, while still bringing a feature-filled command line to your Android device. In the interest of ‘eating our own dog food’ (erm... Brexit? – Ed), this article was drafted on a Samsung Note 5 running Termu, in Org-Mode format, using Emacs and the terrific Spacemacs distribution. See our tutorial in LXF241 on using Emacs’ Org-mode. We’ll focus on the command line during this article. There are options to bring you a full Linux desktop experience as well, which we will dive into in a forthcoming issue.
our expert Aaron Peters is a mobile device aficionado (nut?) who’s been toying around with handheld Linux since 2005.
Root vs non-root Did you notice that we’re not using the sudo command to install Termux packages? Remember, pRoot is a userland implementation of chroot, which means its permissions are already reduced to a normal user level.
There are a multitude of apps that enable you to add a Linux environment to your Android device. Some of them focus on a particular distribution, while some are designed to be installers for a variety of flavours. However, a number of these require you to ‘root’ your device – in other words, modify it so that you have access to the entire device, as if you were a Linux root user. In general these provide a more powerful solution, in that many provide a full Linux installation, including all the packages. However, rooting your Android device isn’t something to be taken lightly. First and foremost, doing so can leave your device unusable – in a state wryly
BusyBox takes a wide variety of basic Linux commands and wraps them all into a single binary for easy installation.
68 LXF255 October 2019
known as ‘bricked’. While this process has become easier, and there are some point-and-click tools for it, there is still some risk involved. At the very least, rooting your device will lessen or completely eliminate support from the manufacturer. If you’re using a phone, it may mean your network won’t offer support either. See the article by Neil Mohr in LXF179 (who dat? – Ed) for some more detail on the pros and cons of rooting. After all this, if you’re still willing to take the leap, here are a couple highly rated Android apps to install Linux on your device. DroidBug GNU/Linux FREE (http://bit.ly/ LXF255droidbug): This app enables you to install a variety of full Linux distributions, including Ubuntu, Debian and Fedora. Linux on Android (http://bit.ly/LXF255installer): Supports Ubuntu, Debian, Fedora, Arch, Kali and openSUSE. Note, however, that this was last updated in 2016, and requires some in-app purchases. BusyBox for Android (http://bit.ly/ LXF255busybox): In contrast to the above items, this app will only install the BusyBox package onto your Android device. “Install” in this context means downloading the BusyBox binary over the network, installing it, and optionally creating links to it. BusyBox Pro (http://bit.ly/LXF255busyboxpro): Like the above item, this app will download and install a BusyBox executable for you. These are just a few of the options available, though there are some that have been highly rated or have been around for a while. But if the thought of rooting your very expensive smartphone makes you a little squeamish, there are also some options that don’t require that step. In some ways they’re not quite the full experience that rooted devices can provide, but they’re plenty for all but the most discriminating Linux user. Terminal Emulator for Android (http://bit.ly/ LXF255term): A straightforward app providing a very basic command line interface to access built-in commands. Terminal Emulator Free (http://bit.ly/ LXF255terminal): Similar to the above – the developer calls it a “remake”– with some additional functionality for users who have rooted. Qute (http://bit.ly/LXF255qute): Something of a
Tutorials Apache server
Set up a productionready web server Mark Chisholm guides you through the process of installing and configuring your own web server. irstly, what do we mean by “productionready”? We’re taking the assumption that you’re setting up a server with some critical data, where wasted time means wasted money if it were to collapse or otherwise break down. Uptime is paramount to a fully functioning web server. Of course, there are a lot of different types of Linuxbased operating systems to choose from, so what would make a good base for a web server? Well, we need it to be rock-solid stable, with few breakages (and preferably none at all) during a package upgrade or kernel installation. Debian or Ubuntu are both good choices for this, and while there isn’t anything actually stopping you using Arch or Gentoo, they’re probably best avoided – we’re looking to make it rock-solid, rather than anything like a Jenga tower. Statistics show us that over 80 per cent of websites and web applications are powered by opensource web servers. With stability being one of Debian’s main points, it’s easy to see why we’ve chosen to use it for this tutorial.
our expert Mark Chisholm has been running his own web servers for about five years.
Backups are essential for administering a fully functioning webserver. Be sure to back up any directories from which Apache serves content, and any and all configuration files to which you may later need to revert.
Server choice You may have heard the term ‘LAMP stack’ when referring to web servers; this simply means a collection of software including Linux, Apache (the HTTP server itself), MySQL (for database management) and a ‘P’rogramming language such as PHP. An alternative is a LEMP stack, where Apache is replaced by the Nginx server. (Developers love to make things more complicated than necessary, so “Nginx” is pronounced as “Engine x”, hence the E.) Good old Apache might be
If something goes wrong it might be worth checking Apache’s status with ‘systemctl status apache2’.
72 LXF255 October 2019
Apache has a default site – or rather single web page – which you can check at http://localhost or your LAN address. This is ideal for checking that everything is working as intended.
a bit long in the tooth, but it’s still more than capable of powering high-traffic websites easily. The Apache HTTP server project aims to be a modern, open source web server for all operating systems – even Windows. It’s designed to be powerful and flexible, working in environments that require different feature sets. Apache 2.0 introduced multi-processing modules – MPMs – that are responsible for binding to the network ports and accepting requests. To a user they appear much like the other Apache httpd modules you may be familiar with. The only difference is that one, and only one, MPM can be loaded onto the server at any time. This results in a secure, efficient and extensible framework that complies with all HTTP standards. Apache is still arguably the de facto web server if you intend to host multiple sites on one server. This is where Apache maintains its edge, but it can still lose out in performance terms to web servers such as Nginx. While Nginx is also an open source web server, it offers an Nginx+ option with software-based load balancing, a content cache and even an API gateway. The catch is that you pay per instance for this option. There are other alternatives such as (see Roundup LXF245) lighthttpd, which is fully open source under a revised BSD licence. Its developers are quite modest in their own description of the web server, saying it powers just “several” of the websites in existence today. However, it’s still actively updated and maintained, and
hotpicks The best new open source software on the planet
Alexander Tolstoy rolls out another selection of high-quality open source software that he has personally tested for this issue.
Sweet Home 3D LibreOffice Olivia FreeTube Dynamic Wallpaper Editor Cloaker Latte NRedneck Pekka Kana 2 Community Edition Interior design app
Sweet Home 3D Version: 6.2 Web: www.sweethome3d.com ometimes it’s not easy to explain your vision for a new room layout using just words. Whether that’s because of your limited artistic skills or the complexity of the design itself, we recommend transferring your thoughts to a 3D plan using Sweet Home 3D. It is of inestimable value since there are virtually no other open source applications of this kind. At first, this application seems to be just a specialised version of a vector editor, where you can draw your room and arrange smaller rectangles that act as furniture items or appliances. It still requires spatial thinking to imagine how things will look in real life, though, so next it’s time to make use of the 3D. Below the flat, top-view, editing area there is a 3D view of the room. Use the green arrows at the top-left corner, or your mouse, to change camera view and zoom in/out. By default the isometric view is infinite and any item placed on the canvas will be shown hanging in the air. It’s good to start by drawing walls and floors and proceed with furniture after you have shaped the surroundings. Sweet Home 3D has a decent library of items available right out of the box: showers, shelves, bottles, mirrors, hangers and so on are all waiting. The application’s website also hosts extra models made by community – there are hundreds of valuable extras. New users of Sweet Home 3D are advised to explore other people’s designs published online. Such examples usually have complex planning with several rooms and plenty of small details. Altering a previously mastered plan is a perfect way to learn about using Sweet Home 3D and discover its features. The software is based on Java and works equally well on any supported OS. If something goes wrong and you realise you forgot to save your work, Sweet Home 3D restores your unsaved design on the next run. Sweet!
76 LXF255 October 2019
Create a dream house with Sweet Home 3D – or maybe just a bathroom.
Exploring the Sweet Home 3D interface 1 2 3
4 Essential tools Define your room’s dimensions, build walls and add captions using this toolbar.
Your inventory Hundreds of models available for placement are grouped in this area.
Main view Drag items from the inventory onto this area and perform adjustments.
5 Manage added furniture This is the list of furniture and other items that were added. Double-click an item to open its properties window.
3D view The sweetest part. Right-click for extras, like the ‘Virtual visit’ mode, which takes you inside the house.
Tutorials Remote connectivity
Client-free remote desktop access for all Kevin Wittmer shows how to build and configure the Apache open-source project Guacamole – from zero to running-code hero. uacamole is a open-source software project consisting of a client and server component that work together to enable remote connectivity to server environments from a web browser. In fact, this open-source project goes back as far as 2010, having spent several years being maintained on SourceForge, with varying periods of development and interest from the Linux community. The project reached a milestone 1.0 release at the beginning of 2019. In its current state, Guacamole is a nicely matured open source project with high-quality code and runtime components that have a straightforward configuration model, yet it also offers a more advanced configuration and enterprise integration to bolster security and user management, for example. Guacamole offers ready to run installation packages for distros such as CentOS or Debian. However, the thrust of this article will be to illustrate fetching the source code from GitHub and moving through the series of steps required for local compilation, configuration and deployment of the server-side components – it’s not too difficult. Beyond introducing you to this very nice open source project, we also want to help you to follow this project at the source code level and encourage you to continue to follow this project.
our expert Kevin Wittmer is a senior technologist at the Bosch Group, who enjoys all things Linux.
Tasty features of Guacamole
Server-side libraries and services are available for remote desktop protocols RDP and VNC in nearly all Linux distros.
82 LXF255 October 2019
It has broad enterprise integration capabilities, including LDAP authentication, Duo two-factor authentication, TOTP two-factor authentication, CAS Authentication, OpenID Connect Authentication, HTTP header authentication and RADIUS. Ready-to-run Docker image containing the Guacamole client/server bits.
The Guacd daemon acts as a proxy and does the work of translating between instructions and arguments specified in the Guacamole protocol and arbitrary remote desktop protocols. The contents of the Guacamole protocol along with other browser/server
Assembly language coding academy Part Two
Missed part one? Get a back issue on page 66!
Low-level system calls with the GNU C library
John Schwartzman shows how to write assembly language code that calls Linux kernel services and the C run-time library. ast issue we used assembly language to access Linux kernel services. Now we’re going to use the C run-time library, glibc, instead of calling the kernel services directly. The glibc functions are in many cases thin wrappers around the Linux kernel services. This is the preferred way to access Linux kernel services. Kernel system calls are limited to six arguments, but that’s not enough for the C library. We use almost the same six registers that we used for kernel system calls: RDI, RSI, RDX, RCX (instead of R10), R8 and R9, but any number of additional arguments can be passed to C library functions on the stack. We populate the registers listed above with the arguments to the function. We then PUSH the remaining arguments onto the stack and remove them from the stack after the C library function returns. You’ll see this in environment.asm. When using the kernel system calls we called a common location using the software interrupt instruction SYSCALL and passed the ID of the specific service in the RAX register. When using the C library, we link to and call the specific function we want by name – though RAX still returns success or failure status to the caller.
our expert John Schwartzman is a long-time engineering consultant to business and government. He also teaches computer science at a local college.
The best way to follow along with this guide is to get the files for this tutorial from the DVD or from https:// github.com/ jschwartzman/ asm-tutorial.
Our next programs are cmdline.c (Figure 1, above right) and cmdline.asm (Figure 2, page 92). When a main function is invoked it has a few parameters that the user types on the command line. If you type ./cmdline alpha beta goldfish at the command prompt, Linux will execute the program cmdline . The program will receive as parameters, argc , which is the total number of string arguments (four in this case) followed by an array of pointers to the strings on the command line which are in an array of arrays called argv . In this case, cmdline will receive as strings ./cmdline , alpha , beta and goldfish . Cmdline.c and cmdline.asm read and print argc and the argv strings. Since this is Linux, you can guess how we receive these parameters. RDI will have the integer argc (the first argument), and RSI will have the vector of pointers, argv .
Figure 1: cmdline.c. A C program that prints all of the arguments it receives on the command line.
Cmdline.c should be easy to understand. The prototype for main is: int main(int argc, char* argv) . After printing argc , we use a for loop to print each parameter index, i , followed by the string parameter argv[i] . That’s it. Execute ./a.out alpha beta goldfish . Now do the same thing in assembly language. Execute ./cmdline alplha beta goldfish . At the beginning of cmdline.asm we define some constants. Some programmers are lazy and omit the constant declarations – they simply insert the appropriate numbers in the assembly code. The effect of this is to confuse the human readers of the program. These values look like ‘magic numbers’ when they’re just sprinkled into the code. We urge you to use LF , EOL , TAB and ARG_SIZE instead of 10, 0, 9 and 8. All programs should be self-documenting and a liberal use of constants improves the documentation. Highlevel languages are somewhat self-documenting, but assembly language needs a lot of documentation! Our main function calls printf , so main is a caller of printf – but main itself is called by the C startup code, so main is also a callee. Therefore, main must save and restore any callee-saved registers that it uses. Notice that we PUSH R12, R13 and RBX at the beginning of main and then POP them in reverse order at the finish label, before main returns. Before that, however, we have some boilerplate code. We PUSH
October 2019 LXF255 87
coding academy Turtle graphics
Drawing with turtles Calvin Robinson mods Minecraft Pi to work on desktop Linux, so we can all code Minecraft mods with Python at our leisure. inecraft is one of the most creative video games of our time. With virtual environments spanning acres of procedurally generated random biomes, the world and its contents are left to the player’s imagination. In survival mode, we’re left to fend for ourselves in a Darwinist experiment of resource-gathering, while fending off bad guys – make sure you build a shelter before nightfall! Creative mode opens up a world-building toolset where a childhood spent with Lego proves to be a transferable soft-skill. However, in Minecraft the limits of one’s creativity is usually the provided tools. Now, thanks to the release of the Raspberry Pi version of Minecraft, we’re finally able to hook directly into the API with Python and program away to our heart’s content. Combining Raspberry Pi Jam, developed by Alexander Pruss, with community project Forge we’re able to use the Raspberry Pi Minecraft API on any desktop Linux distro. We’ve put together a package called McPiFoMo (Minecraft Pi Forge Mods) that does all of this for you: http://rogerthat.co.uk/McPiFoMo.rar. McPiFoMo includes MCPiPy by fleap and bluepillRabbit of MCPiPy. com. We’ll also be using Minecraft Turtle this issue, which was put together by Martin O’Hanlon (<swoon>– Ed) of www.stuffaboutcode.com. You will need to download, install and prepare your Minecraft installation with McPiFoMo. Instructions are in the last issue of Linux Format, where we also learnt how to implement chat commands, spawn pre-fabricated creations, move the player character around the world with X, Y, and Z coordinates, and likewise spawn blocks at a player’s location, among other things – see page 66 for a back issue or subscribers can head to the archive. Turtle Graphics is a familiar Python module. In fact it’s one of the first things we teach in school, as it’s particularly useful for demonstrating visual outputs from Python without having to code a GUI. In order to get Turtle Graphics working in Minecraft we’re going to need to download and install a library:
our expert Calvin Robinson is a former assistant principal and Computer Science teacher with a degree in Computer Games Design and Programming BSc (Hons).
When using Turtle Graphics, to check if your pen (or paintbrush) is up or down at any given time, use print teddy.isdown() , where teddy
is the name of your turtle.
cd ~ git clone https://github.com/martinohanlon/ minecraft-turtle.git cd ~/minecraft-turtle python setup.py install python3 setup.py install
This ensures we’ve got Minecraft-turtle installed for both Python 2 and 3. If you’ve used Turtle Graphics before you’ll get along with the following code just fine.
92 LXF255 October 2019
2D turtles can only travel forwards and backwards – that’s why we rotate in degrees.
Imagine you stuck a paintbrush in the mouth of an actual turtle. Everywhere that turtle moves, it drags the paintbrush along, drawing a path. That’s the basis of Turtle Graphics. You’re drawing vector graphics with a relative cursor, across a virtual canvas. We direct the turtle where to go, and it leaves a trail of lines behind it. In Minecraft those lines will be represented by blocks. Traditionally, Turtle Graphics programs can move forward and backward, but not necessarily left or right. We instead rotate left/right in degrees, and move forward/backward to draw our lines in the direction we need. Minecraft Turtle, however, has an additional dimension, with up and down commands moving toward to the sky/ground accordingly. Here is a list of the basic commands that we’ll be using to traverse our virtual canvas: Walk forward: turtlename.forward(distance) Walk backward: turtlename.backward(distance) Rotate left: turtlename.left(angle) Rotate right: turtlename.right(angle) Move up: turtlename.up(distance) Move down: turtlename.down(distance) Stop drawing: turtlename.penup(distance) Start drawing: turtlename.pendown(distance) In these commands, turtlename is the name of the object name you’ve assigned to your turtle and the variable for said movement. For example, teddy. forward(60) would move a turtle named teddy forward 100 spaces, and teddy.right(90) would turn the same turtle right by 90 degrees.
Hatch your own Turtle Open Python IDLE and press File > New File to create a blank script window, or open your favourite text editor and code the following: from mcturtle import minecraftturtle
On the disc
Download your dvd Get code
and DVD images at: www.linuxform at.com /archives
Discover the highlights from this month’s packed DVD!
START HERE using the LXFDVD
Using Linux for the first time can be very confusing. It’ll be unlike anything that you’ve likely operated before, especially if you’re used to Microsoft Windows or Apple macOS. Generally our DVDs are designed to be run directly, which is to say that when you first power on your PC (or Mac) it should ‘boot’ from the DVD – so before Windows or macOS even starts to load – with Linux running directly from the DVD. This trick is known as a Live Disc. It enables you to try out the various versions of Linux without having to install or change anything on your PC. Just remove the DVD, restart your PC and it’ll be exactly as you left it. While many systems will boot from a DVD when it finds one, many will not. See below for the standard process for enabling booting from a DVD on various desktops and laptop PCs. The alternative option is to locate the ISO file on the DVD and write this to your own USB thumb drive and attemp to run that. We recommend using Etcher from https://balena.io/etcher that’s available for Windows, macOS and Linux. Good luck!
extra strong min specs: 1GB RAM, 15GB Disk, 1024x768 display
Mint 19.2 Cinnamon here’s very little that gets us more excited than a new Mint release, especially when it happens with plenty of time to get it on the disc and write a cover feature all about it. In keeping with tradition, this release has a female codename, Tina. For users of 64-bit machinery, we present the flagship Cinnamon edition of Mint 19’s second point release. The base of these releases follow the Ubuntu point releases, so there’s all the brand new software and gubbins from there, as well as the option to install the latest hardware enablement (HWE) stack for a newer kernel and video drivers. But there’s also a whole heap o’ features on which Team Mint have been hacking away over the past six months. The keen-eyed among you will notice that the official Ubuntu font is now used by the default Mint Y theme and its predecessor Mint X. Cinnamon has seen a not inconsiderable volume of other cosmetic and not-so-cosmetic improvements. For one, it uses
less RAM and thanks to window manager (Muffin) improvements, it should feel much smoother and more responsive. There’s better support for Flatpak, both in terms of theming and in terms of handling a situation where both a Flatpak and a regular package of the same application are installed. This could result in identical menu entries, which was annoying. Speaking of annoying, one of the myriad newfangled desktop things that defy a lot of people’s thinking is overlay scrollbars: ones that only pop to their full width when you hover over some infeasibly small margin. These can now be configured or neutered entirely. There’s also improved Samba support in the Nemo file manager, which might be good news if you’ve built a NAS device recently – perhaps inspired by our storage feature in LXF252. If you’re already running Mint 19.1 and don’t fancy a reinstall, you can upgrade directly by following the instructions on the Mint blog at https://blog.linuxmint.com/?p=3792.
boot the disc
Many PCs should boot automatically if they’re turned on with a disc in the drive. If not, many offer an early Boot Menu accessed by tapping a key while powering up from cold: F9 (HP), F12 (Dell, Lenovo), F8 (Amibios) or F11 (Award BIOS). Alternatively, use the BIOS/UEFI to adjust the boot order to start with the optical drive. Again, this is accessed by tapping a key during power up, usually Del but sometimes F1 or F2. Some new UEFI PCs require access via Windows: holding Shift select its Restart option. If you’re still having problems using the DVD visit: www.linuxformat.com/ dvdsupport Mac owners: Hold the C key while powering on your system to boot from the disc.
96 LXF255 October 2019
There’s another tranche of great backgrounds with this release. They look much better than these tiny thumbnails.
Defective discs: For basic help on running the disc or in the unlikely event of your Linux Format coverdisc being in any way defective, please visit our support site at www.linuxformat.com/dvdsupport. Unfortunately, we’re unable to offer advice on using the applications, your hardware or the operating system itself.
AND MORE! your new best mate
the LXF library
min specs: 1GB RAM, 15GB Disk, 1024x768 display
Mint 19.2 MATE ot wanting 32-bit users to be left out in the cold (even if, as we write this, it looks like summer’s over), we’ve got the slightly less demanding Mint MATE edition as well. Yes, the minimum requirements are the same, but we think MATE runs smoother on older video cards. There’s an Xfce edition of Mint
If you want full top-bar cascading menu nostalgia, install MATE Tweak and choose the Gnome 2 layout.
too, which might be even lighter, but we opted for MATE this time because all-caps names annoy our art team (and me – Prod Ed). Our enamouredness with the MATE desktop is a matter of public record: it evokes memories of the good ol’ days of Gnome 2, while bringing with it all the best bits of modern desktops and none of the bloat. Apart from all the goodness that’s been added to the Mint 19.2 core, some of which you can read about in the cover feature on page 34, this one comes with a whole new version of MATE. If you liked Gnome 2, you’ll like that MATE now supports newer themes for Metacity – Gnome 2’s window manager, also used by Gnome Flashback. There have also been numerous fixes to Marco (MATE’s own window manager), the Caja file manager, the Engrampa archiver and all the other bits that are critical to a workhorse desktop.
live and tiny
limey. It’s been a whole 12 issues since Slax last featured on our disc, and to be honest there’s very little else that would’ve fitted into the 500MB of space left after our Mint double bill. We’ve gone with the 32-bit edition so everyone can benefit from this tiny gem. If you ever need to boot to a working desktop in a hurry, Slax is your friend. It’ll fit on a 512MB USB stick, and boot to a clean desktop in seconds. There’s no bloat with Slax; in fact there’s not much more than Chromium, the VLC media player and a bare minimum of utilities. Slax is a live-only affair, so there’s no (official) means to install it to a hard drive. You can use it straight from the DVD, or put it on a USB stick and use the Persistent Changes option when booting to enjoy the luxury of saving any changes you’ve made. It’s also possible to export such changes as a .sb module and import them into a new live session.
ash Guide for Beginners B Get to grips with the basics of Bash scripting. ourne Shell Scripting B First steps in shell scripting. he Cathedral and T the Bazaar Eric S. Raymond’s classic text explains the advantages of open development. he Debian Book T Essential guide for sysadmins. ive Into Python D Everything you need to know. I ntroduction to Linux A handy guide full of pointers for new Linux users. inux Dictionary L The A-Z of everything to do with Linux. inux Kernel in a Nutshell L An introduction to the kernel written by master hacker Greg Kroah-Hartman. he Linux System T Administrator’s Guide Take control of your system.
min specs: To boot: 486 or newer CPU, 128MB RAM. To run Chromium: CPU with SSE2, 512MB RAM
dvanced Bash A Scripting Guide Go further with shell scripting.
32-bit As the name hints, Slax was originally based on Slackware, but now it’s not. It’s based on Debian. Note that Slax won’t boot if you write the whole DVD ISO to a USB, so just use the ISO in the Slax directory. For electronic edition readers, you may as well just download Slax directly from https://slax.org. Who knows, there may even be a new version.
ools Summary T Overview of GNU tools. NU Emacs Manual G Six hundred pages of essential information! roducing Open P Source Software Everything you need to know. rogramming from P the Ground Up Take your first steps.
You could count the number of bundled apps on the fingers of two hands, or the digits of two tetradactyl-y paws, even.
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
October 2019 LXF255 97
You can subscribe to this magazine @ www.myfavouritemagazines.co.uk