Page 1

Store, search and edit your photos with open source

PLUS!

3 Pi projects

serial control get animating use EasyGUI

B 7G D 9 4. A201

The fastest ways to backup and deploy

EE NLOx FR W inu DO li l ka

disk clone photo tools

The #1 open source mag

voice controlled

smart home

Use Linux to add true smarts to your home with security and open protocols

pages of tutorials & features

65 Omoju Miller on how GitHub is using machine learning sounds fun

Better Audacity audio editing

Vector drawing Create better, scalable diagrams with LibreOffice

Make Arch as easy to use as Ubuntu Get perfect Steam gaming with the Pi


Welcome Win a secure Nitrokey Storage 2

who we are This issue We’re looking at building a open source smart home, so what’s the smartest thing in your life right now?

Jonni Bidwell More and more I find myself focusing on the not-so-smart things, so this is a really tricky question. I dunno though, Vernier calipers are pretty smart. Oh, and the people that do the Royal Institution lectures.

Christian Crawley Sorting out the kids’ dance lessons, telling me where I need to be (and where to go) while working to resolve the concerns of residents as a local Councillor, the smartest thing in my life is without doubt my wife, Ceri.

John Knight I don’t have any ‘smart’ gadgets at home, but I have ideas for an off-grid cabin powered by renewables. A collection of Raspberry Pis would be excellent for regulating power and lighting, and their low-power consumption would be perfect for computer usage without draining watts.

Les Pounder The smartest thing in our home is Dexter the dog. However, he has started to become unresponsive to voice commands. The only recognised commands are “walkies” and “dinner.” Previously working commands “bath time” and “vets” are no longer starting the correct processes. The error log is full of “woof” and “bark.”

Mayank Sharma The voice recognition in my car is not smart, it’s evil. It’ll change tracks and dial numbers correctly, as long as it isn’t me talking. When it hears me, it’ll always dial relatives I don’t want to talk to – even when all I want it to do is change tracks.

www.techradar.com/pro/linux

Send your thoughts to the Linux Format dungeon server at linuxformat@futurenet.com and secure your chance to win a 32GB Nitrokey! It’s the complete open hardwareencrypted storage solution! Learn more at www.nitrokey.com.

Control everything! Sat up here in our ivory Linux Format Tower, it’s easy to pour scorn on those lesser non-Linux-using types, hopelessly switching their lights on and off with their phones, asking little round speakers what the weather is like outside their windows and checking if their milk has gone off by looking at their smart-fridge display. But why shouldn’t someone be able to remote-control their lights, control their heating or ask a system what the weather is in complete digital safety? We’re exploring how open source can solve the IoT problem by combining the Mycroft and OpenHAB projects to create a smart, secure voicecontrolled open source home. Heck, it even ties into Google Home and Alexa, if that’s your thing. But digital Luddites of the world fret not, if having a smart home isn’t for you, we’ve got a healthy pile of smart things to do with your install of desktop Linux. These range from the Roundup of disk cloning tools, so you can do smarter backups and deployments of systems, to our very own Jonni attempting to annoy the Arch Linux community by explaining how to turn it into Ubuntu. Some may say that’s not very smart at all. For projects and tutorials we have more good news, from getting started in making music with Audacity, organising your photos in Shotwell, drawing useful diagrams with vectors and streaming games with Steam, to creating stop-motion animations with a Pi, exploring the new Webassembly language and troubleshooting serial connections. There’s something for everyone who likes to tinker with computers, so enjoy!

Neil Mohr Editor neil.mohr@futurenet.com

Subscribe & save! On digital and print – see p26

May 2019 LXF249     3


contents On your free DVD

Raspberry Pi User Raspberry Pi news 

Kali Linux 2019.01 64- & 32-bit Page 96

50

Quantum computing on the Pi, power issues and running x86 programs.

Raspberry Pi Compute Module 3+  51 Les Pounder wonders what makers can do with this much power?

Using EasyGUI 

52

CREDIT: IBM

Les Pounder shows us how to use Python to search Google to gain inspiration for our next maker project.

Stop-motion studio 

tutorials Terminal: FFF 

54

Christian Cawley plays with some Lego and a Pi camera to make a movie – although it’s not quite that simple…

Debug serial comms 

60

Not all file managers look the same, as Shashank Sharma discovered while using FFF – a Bash-based file manager.

shotwell: Build a photo library 

58

Sean Conway walks you through the process of troubleshooting communication problems between a PC and a serial device.

audacity: Audio editing 

Coding Academy Check your Git repos 

90

apache: Secure and static sites 

92

DRAW: Vector illustrations 

Regulars at a glance 6

Linux user groups 

11

Les Pounder explains exactly what goes on in Linux Presentation Days.

Mailserver 

12

Too much praise – we’ve gone red, scarily clever solutions, hacking RC cars, and we’re going to cover firewalls again.

Answers 

14

Minolta printer drivers, best scanning solutions, Mint won’t shutdown, using ZFS, and Peppermint upgrades.

www.techradar.com/pro/linux

76

Create technical and business diagrams and illustrations without paint packages, as Mike Bedford demonstrates.

steam: Game streaming 

Google offers the bad news that CPU Spectre bugs will never be fixed in software, FireFox Send service, Pure OS movements and no more web Skype for Chrome OS.

72

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

Mihalis Tsoukalos looks at the next-gen web language WebAssembly, how to develop apps for it in Rust and Go, and how to use them with the help of JavaScript.

News 

68

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

John Schwartzman shows you how to write a Bash shell script that can keep track of all of your Git repositories.

Webassembly and Rust 

62

Nick Peers reveals how to bring order to your chaotic photo and video library with Ubuntu’s default photo organiser.

Subscriptions 

26

Back issues 

66

Overseas subs 

67

HotPicks 

83

Alexander Tolstoy would never even imagine posting anything negative online about any glorious government – he’s far too busy critiquing and testing only the best in free and open source software like: Digikam, Olive, Cygwin, LibreOffice, ODrive, Quaternion, Klogg, Hyperfine, Friture, Underrun, Sandspiel.

Your free DVD 

96

Next month 

98

80

Push your Linux gaming to your big TV for real gaming fun, with the help of Alex Cox and Steam In-Home Streaming.

In-depth Turn Arch into Ubuntu 

46

Jonni Bidwell has spent years perfecting his Arch install, and he’s begrudgingly going to share some insights that make it as easy as Ubuntu to use…

May 2019 LXF249     5


Newsdesk

This ISSUE: Google has a meltdown Nginx is worth a lot PureOS converges Firefox Send Skype issues EU router rules

Hardware security

Can Meltdown and Spectre bugs ever be fixed? ore than a year ago, the Meltdown and Spectre bugs were revealed to affect some of the most widely used processors in the world – and throughout 2018 and even into this year, new variants and threats based on the bugs have continued to be found. The vulnerabilities, which appear to be present in chips from nearly every manufacturer, enable potential malicious users to access protected data on a victim’s device, and exploit speculative execution and caching features of a CPU. While there have not been any known attacks using these vulnerabilities, their existence has caused shockwaves throughout the technology world – and beyond – due to the prevalence of the vulnerabilities. Since the revelations about the bugs were disclosed, a number of manufacturers moved quickly to release patches to mitigate the problem. However, these software fixes aren’t ideal, mainly because Meltdown and Spectre affects features of the CPU which are designed to improve performance, and applying the patches results in a noticeable degradation. At the end of February 2019, open source hardware experts at Phoronix noted that Linux 5.0 kernel performance was worse than previous kernel releases (read the full article at http://bit.ly/LXFPhoronixLinux5). This is a worrying trend, as kernel updates should improve performance, and some readers pointed out that this performance loss corresponds with Meltdown and Spectre mitigations being included in Linux 5.0.

M

6     LXF249 May 2019

In fact, looking at Phoronix’s benchmark results, there’s a clear dip in performance starting from Linux 4.15, with another large dip between Linux 4.20 and Linux 5.0. As Phoronix points out, the Spectre/Meltdown vulnerabilities were made public around the time of Linux 4.14, and in-kernel mitigations such as PTI and Retpolines were added – which supports many people’s fears that if we want to be protected against Spectre/Meltdown, we’re going to have to live with the performance implications that come with software patches. Google has been even more pessimistic,

Image credit: TechRadar

The ramifications of Meltdown and Spectre continue, with Google suggesting that there will never be a software-based fix.

Spectre will be plaguing processors for the near future, according to Google.

Meltdown and Spectre affects features of the CPU which are designed to improve performance recently releasing an analysis of Spectre which comes to the conclusion that Spectre-like vulnerabilities will never be fully eradicated by software patches. In fact, Spectre could continue to impact processors for the foreseeable future, while software-based mitigations will have an even greater impact on performance. Read the entire paper at http:// bit.ly/LXFGoogleSpectre. For the moment at least, it looks like we’re going to have to accept performance hits as a price to pay for security.

www.linuxformat.com


LUGS

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

Linux Presentation Day

Find and join a LUG Build Brighton Thursday evening is open night. www.buildbrighton.com Cornwall Tech Jam Second Saturday of the month, alternating between Bodmin and Camborne. www.cornwalltechjam.uk Glasgow Makers and Hardware Hackers Mitchell Library, Glasgow. https://m.facebook.com/ groups/115303729096198 Huddersfield Raspberry Jam Meet every month at Huddersfield Library, typically on the fourth Saturday of each month. https://huddersfieldraspberryjam.co.uk Horsham Raspberry Jam Parkside, Chart Way, Horsham. www.facebook.com/hackhorsham Leeds Hackspace Open night every Tuesday 7pm-late, open day second Saturday of the month, 11am-4pm. www.leedshackspace.org.uk Medway Makers 12 Dunlin Drive, St Mary’s Island, Chatham ME2 3JE. www.medwaymakers.com New Jersey Linux User’s Group Last Tuesday of every month, at Panara Bread, 165 Route 4 West, Paramus, NJ. http://njlnux.org PLUG – Perth Linux Users’ Group Once a month, at Spacecubed, 45 Saint Georges Terrace, Perth, Western Australia. www.plug.org.au rLab Reading Hackspace Unit C1, Weldale ST, Reading, Wednesday from 7pm. http://rlab.org.uk Teesside Hackspace Tuesday Evenings at Teesside Hackspace. www.teessidehackspace.org.uk The Things Network Reading Walkabout Bar, Reading, 2nd Tues 7pm. ttnreading.org

It’s a bit like a school open day… hances are that you discovered Linux many years ago and since that day you have enjoyed the fruits of what was initially a laboured introduction. Moving from Windows to Linux introduces a new way of thinking and working – software from a central repository versus a random EXE download being the first hurdle. But what if you’re new to Linux? Well, on Linux Presentation Day you can meet like-minded individuals (how do you know what I’m thinking?–Ed) who want to help everyone to enjoy using Linux. Originally begun in Germany in 2015, Linux Presentation Day takes place twice per year in locations across Europe. The events are free of charge and are a way to introduce Linux to the public via installfests, lessons and social events. The main goal of the project is to help visitors decide on whether Linux is the correct option for their future. The team from Bristol’s Linux Presentation Day have been in contact to let us know about their event. Sebastian tells us: “It will be Sunday 19 May – yes Sunday, not Saturday – between 2pm and 7pm at the

C

Prince Street Social in central Bristol. That’s the Prince Street Social, 37-41 Prince Street, Bristol, BS1 4PS.” There is still time to join, tell your friends or organise your own day – all you need to do is pop over to http:// int.linux-presentation-day.org and follow the link for your country. If you run a LUG, hack- or maker-space then throw open your doors to the public, show them how wonderful Linux is and how it can be used from everyday internet browsing to controlling laser cutters and CNC machinery. If you’re in the Bristol area, head over to their event and say hello to Sebastian and the team. See more at www.linux-presentation-day.org.uk.

“And then you just click there. No, not there, there. THERE!”

Community events news family for a fun day out and learn a new skill. We’ve been to previous years and this is a great venue. so spend the day there! Tickets and details can be found via: www.scienceandindustrymuseum. org.uk/take-part-makefest-2019.

Manchester Makefest 2019 Taking place on Saturday 25 and Sunday 26 May at Manchester’s Science and Industry Museum, this two-day event celebrates the various groups and skills in the maker community. From Arduino to artisan crafts, this weekend is packed with lots to see and do. You can take the

www.techradar.com/pro/linux

MIXIT Taking place on 23-24 May in the French city of Lyon, this event is truly a mix. There are talks and workshops covering Ethics, Makers, Design and Lifestyle from the world of technology. The whole ethos of the event is to “discover new things and meet nice people.” This is clear to see thanks to a great lineup of speakers,

including our own Les Pounder. The event is open and accessible to all, including those outside of the community. More details at: https://mixitconf.org/en. Preston Raspberry Jam The person responsible for starting the whole Raspberry Jam community, Alan O’Donohoe, has run a successful Jam every month since 2012! Sadly, due to other commitments the April and May 2019 Jams have been cancelled, but we’re promised that the Jam will return in June: www.eventbrite.co.uk/d/unitedkingdom--preston/raspberry-jam/

May 2019 LXF249     11


Answers

Answers

Neil Bothwick

Got a burning question about open source or the kernel? Whatever your level, email it to lxf.answers@futurenet.com Q Document scanning workflow After using Linux for technical work and development for a while, I’d like to completely move all office-related tasks to Linux (Manjaro KDE) as well. Besides some minor issues with printers, the main impediment is how to set up my document scanning workflow. Currently I scan all incoming documents in one go, manually ‘staple’ them into individual multipage PDF documents and store them to Evernote. Could you recommend document scanner hardware and corresponding software to manage the workflow and store the documents? Roland Stadler

A

As far as hardware is concerned, any scanner with an automatic document feeder (ADF) that is supported

by Linux should do the job. Check the list of supported hardware at http://saneproject.org and pick a device that suits your needs and budget. I have used a Brother (same here–Ed) laser printer and scanner in the past and it worked well. Now I use an HP all-in-one device that has the benefit of duplex scanning, without having to feed the pages in twice. HP devices are supported by the hplip driver package. This is open source but the scanners need a binary firmware file too. Hplip’s setup utility takes care of downloading and installing this, but it is something of which you should be aware if you have a strict policy on using only open source software. For software, I haven’t found anything better than Gscan2PDF (http:// gscan2pdf.sourceforge.net). This will scan a multi-page document and save it as a single PDF file – although it also

Minolta PagePro driver Q

Do you know if there is a Linux driver for my Minolta QMS PagePro 1200W laser printer? Anna Brand

A

As with most things printerdriver-related on Linux,   the answer can be found on openprinting.org, specifically   www.openprinting.org/driver/ min12xxw. This is a third-party driver for your printer, so don’t expect support from the manufacturer. On the plus side, this driver has been around for a good number of years and has been reported to work well. Download the relevant file for your operating system: 32-bit or 64-bit according to your processor, DEB  or RPM according to the package manager used by your operating system. If you aren’t sure of the package format, Debian and its derivatives, such as Ubuntu, Mint, Peppermint and others use DEB.

14     LXF249 May 2019

Fedora, openSUSE and Manjaro are among the distros that use RPM. Your system may offer to automatically install the package after downloading, but usually it just saves it to your ~/Downloads folder. To install it, open a terminal and change to your downloads folder by typing $ cd Downloads

Type ls followed by Return to make sure the file is there, then install it with one of the following commands. $ gdebi openprin2xxw $ rpm --install openprinting-min12xxw

The first command is for use with DEB files, the second for RPMs. Press Tab then Return after typing either one. Pressing Tab autocompletes the file name, so this will work for any version or architecture, without having to type the full filename. Once installed, there should be options for several Minolta PagePro models when you use your distro’s printer configuration tool to add a new device.

counts FOSS problems   in his sleep.

supports several other formats. The software enables you to save various profiles, covering resolution, size, colour depth, single- or double-sided and more, which means setting up for a particular type of document is as simple as pressing the scan button, selecting a profile and pressing Go. There is also quite extensive postprocessing support. It can use unpaper to clean up and de-skew scans, it can also apply OCR (optical character recognition) software to the scanned image, and save a text copy of a page as a hidden layer behind the scanned image. Although this layer is hidden, it’s searchable, so you have multi-page scanned images that can be searched for a particular word or phrase. There is no option to save to Evernote, but if you use this service you probably already have software to sync it with your desktop, like NixNote, so you can simply save to a directory that is synced with Evernote. If you are saving sensitive material to a cloud service, you should consider encryption. You can passwordprotect PDF files with pdftk and this could be added as a post-processing hook in Gscan2PDF, for example.

Eternal shutdown I’m a happy user of Mint 19, but there are a couple of things that intrigue/bother me in Cinnamon. When booting, it shows a message like this for a few seconds: [0.004000] doIRQ: 1.55 No irq handler for vector [2.378397] Couldn’t get size: 0x800000000000000e

Gscan2PDF has plenty of options when it comes to scanning and archiving documents.

www.linuxformat.com


Reviews First person shooter

Dusk

Management are nervous again, as Ian Birnbaum appears to be ignoring their memo not to go in the ruins… SPECS

Minimum: OS: Ubuntu 12.04 64-bit CPU: 2.4GHz dual core MEM: 2GB GPU: GeForce 9800GT or equivalent HDD: 2GB Recommended: CPU: 2.4GHz quad-core Mem: 4GB GPU: Geforce GTX 460 or equivalent Notes: Don’t go in the ruins

So little time, so much to kill.

24     LXF249 May 2019

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

T

www.linuxformat.com


subscribe Save money today!

Subscribe! Sign up today and get your

SoundMAGIC e11c earphones

YOUR GIFT! Worth £50

Don’t miss out,   subscribe now!

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

IT’S EASY TO SUBSCRIBE! www.myfavouritemagazines.co.uk/lin/e11c

Call: 0344 848 2852 26     LXF249 May 2019

www.linuxformat.com


Overseas subs on p67

PLUS: Exclusive access to the Linux Format subs area! 1

includes

ars Now with 5 ye & r se U x nu of Li Developer issues

CHOOSE YOUR PACKAGE! print edition

digital edition

PLUS!

print + digital

PLUS!

Every issue comes with a 4GB DVD packed full of the hottest distros. Plus your SoundMAGIC e11c earphones

The cheapest way to get Linux Format. Instant access on your iPad, iPhone and Android device.

Get both the print & digital  editions + DVD, for one low price. Plus your SoundMAGIC e11c earphones

Only £76

Only £25

Only £90

Annual print by Direct Debit

Every six months by Direct Debit

Annual bundle by Direct Debit

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

www.techradar.com/pro/linux

May 2019 LXF249     27

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 Cxxxx We compare tons of stuff so you don’t have to!

Roundup Clonezilla Deepin Clone G4L WereSync

FOG Project

Shashank Sharma By day Shashank is a New Delhi trial lawyer, but by night he’s an open source vigilante!

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

how we tested… A disk cloning tool requires quite a bit of hardware to be tested effectively, particularly hard disks. This is why virtual hardware is ideal for testing their capabilities. For this Roundup we’re using several virtual machines with multiple hard disks of various sizes. We’ll use them to image a small disk to a large one, which is one of the most popular uses of a disk cloning tool. Secondly, we’ll clone a large disk with lots of empty space to a smaller one with enough room to accommodate the used sectors of the larger disk. The Clonezilla, G4L and FOG Project tools have been tested on Manjaro, Fedora and Ubuntu installations. WereSync was installed on Manjaro and Deepin Clone was tested atop a Deepin 15.9 installation for best results. The network-based FOG Project was installed on a Ubuntu Server installation as per its documentation.

28     LXF249 May 2019

anaging a network of computers is an involved process. The constant barrage of repetitive tasks such as running checks, troubleshooting errors, replacing dead hard disks and doing fresh installations over and over again can sap the energy out of any system admin, irrespective of the size of your realm. Even before you can tackle the problem of actively monitoring the machines, you have to install an operating system on each of them. This is a timeconsuming task even for a small network with, say, 10 computers. Computer cloning involves setting up the operating system, drivers, software and data

M

on one computer, and then automatically replicating the same setup on other computers. The technique, also known as ghosting or imaging, is used by system admins for rolling out multiple identical machines over the network. The cloning tools on test here are a blessing for harried admins who want to put their feet up every now and then. With these tools you can image and clone machines without breaking into a sweat. We’ll look at tools that, besides cloning, will also help take the pain out of everyday admin tasks such as installing software, and can scale up to work over large networks and multiple locations.

www.linuxformat.com


voice controlled

smart

home If you utter “Siri”, “Alexa” or “OK Google” in Jonni Bidwell’s home, all the lights go off and the router disconnects. ep, we’re pretty cynical about voice assistants here at LXF Towers. Our (nameless) sister magazines rant and rave about the latest Alexa additions and how they make ordering tat from Amazon even easier. They quietly forgive the chaos that ensues when Siri’s name is spoken on the television, as all the fruity phones within earshot frantically start offering to help. Tech pundits wax lyrical on the importance of shoving a network stack deep into every single appliance in your

Y

34     LXF249 May 2019

house so that it can be ‘smart’, so that the ‘smart’ appliances can all chatter among themselves about their dumb masters. If you’re in the isolated enclave known as the UK, your utility providers would dearly love you to have smart meters installed. They tell you this will help monitor your usage, save money and not be subject to wildly varying usage estimates. That may be true in individual cases, though we bet a lot of people will find their water bill increasing post-smart meter. But mostly it’s because they can generate more

profit by not having to pay people to drive around reading meters. Instead they’ll have to pay people to drive around fixing them on a regular basis. Be that as it may, voice assistants and network gadgets are here to stay, and as the old saying goes, if you can’t beat ’em, make an open source equivalent and have said equivalent control your home. So here’s our guide to the FOSS-powered smart home, featuring the Mycroft voice assistant, openHAB, Home Assistant and more. Let’s get to it…

www.linuxformat.com


Interview Omoju Miller

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

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

42     LXF249 May 2019

www.linuxformat.com


in-depth Arch Linux

Arch Linux Tips Jonni Bidwell has spent years perfecting his Arch install,  and he’s begrudgingly going to share some insights… ou’ve carefully followed the lengthy install guide on the Arch Wiki and installed Arch Linux. Amazingly (or maybe as a result of hair pulling, shouting or other creative problem solving), everything works – network, display, your keymap is even correct. You’re all ready to use your fresh new install, but all it does is boot to a terminal prompt. This is, of course, expected behaviour: Arch is what you make it, after all. But some guidance, after this arduous installation pilgrimage, on exactly what it can be made into might be helpful. You go back to the Arch Wiki, but the post-installation section links you to a somewhat overwhelming list of ‘general recommendations’. You should certainly

Y

46     LXF249 May 2019

study this list, and the Arch Wiki is truly one of the greatest Linux resources (alongside LXF?–Ed) out there. But if you want the LXF lowdown on how to quickly get going after a successful install, read on! We won’t presume you’re an Arch expert, but even if you are you might find some handy tips to get your setup closer to perfection. For this tutorial we’re going to assume you’ve got a working Arch install. We’ll further assume you’ve done some bread-and-butter setup tasks: setting up a user, local mirrors, networking and getting all your partitions set up in /etc/fstab. All this is in the Arch Wiki if you need guidance – we will often refer you there throughout this article where appropriate, rather than parroting its contents.

www.linuxformat.com


TutorialS Search Google

EasyGUI

Get inspiration for your projects with Google

Les Pounder shows you how to use Python to search Google to gain inspiration for your next project. ach issue we write a new Raspberry Pi project and each issue we try to be inventive and unique. But there are times when inspiration is not with us, and in those moments we turn to searching Google with key phrases or words, and often they are quite ridiculous. These ‘mashups’ are there to fire the imagination; just as a child given construction blocks can make anything they dream of, we can use these silly searches to think up new and unique ideas. In reality this project is really just three for loops and two lists that store and iterate over user input while it searches Google. Then it opens a random page in our web browser.

E

our expert Les Pounder is a freelance maker who works with organisations such as the Raspberry Pi Foundation.

You need Any Pi Raspbian Code: https:// github.com/ lesp/LXF249InsPIration/ archive/ master.zip

Let’s get mashing! Before we can write any Python code we first need to install two extra libraries of code. These are called packages or modules, and they contain pre-written code that we can reference in our project. The first library will install a way in which we can search Google from Python. The second library is an easy to use graphical user interface toolkit. In a terminal enter the following command. $ sudo pip3 install google easygui

This will take a few moments. Once it’s complete, close the terminal window. To write the code we need to use a Python editor – in this project we’ll use the

Python 3 editor found in the Programming section of the Raspbian menu. When the editor opens, click File > New to create a new blank document. Now immediately save the file using File > Save, call it inspiration.py and remember to save often.

Easy now GUI We start our project by importing a series of libraries/ modules. Firstly we import the search function from the googlesearch library, then we import the choice function from the random library. We next import the webbrowser library to enable us to open a browser window. Finally we import the easygui library, but we shorten the library name to ‘eg’, as ‘easygui’ can be tricky to type at speed. from googlesearch import search from random import choice import webbrowser import easygui as eg

The first step in this project is to ask the user a message, and to do this we use easygui’s msgbox (message box) function. Here we can ask a message ( msg ), give the dialogue box a title and change the text in the ok_button to ‘Inspire Me!’ eg.msgbox(msg=”Tell me what you would like in a project and I shall search Google for you. This will trigger 3 pop up windows”, title=”InPIration”, ok_ button=”Inspire Me!”)

Next we need to create two blank lists. One will contain the things that we want to search for, the other will store the suggestions that our Google search finds. Lists in Python are called arrays in other languages. They can contain lots of pieces of data, for example strings, integers, floats and variables, but not exclusively these. We can call data from a list by using its index number. A list starts the index from zero and can go on and on.

Our app is a simple tool to use silly keywords to fuel our imagination for another cool project.

52     LXF249 May 2019

things = [] suggestion = [] In the msgbox we instruct the user that we are

going to ask them for three things to search for – these are the items that they wish to use as inspiration. To do this we need to use a for loop with a range. In this case it will create a variable called i and each time the loop goes round it will iterate (add) one to the variable until it

www.linuxformat.com


TutorialS Stop-motion animation

pi camera

Build a Raspberry Pi stop-motion studio

Christian Cawley plays with modelling clay and a Raspberry Pi camera to make a movie – although it’s not quite that simple… ver sat guffawing at Terry Gilliam’s bizarre subversion of Victorian-era greetings cards in Monty Python’s Flying Circus, or egging on unlikely heroes Wallace and Gromit? Then chances are you’ve spent a few moments thinking about how those animations are made. There was a time when stop-motion photography was beyond the reach of most people. Overhead cameras mounted on rostrums were expensive, and unless your school or college had one, your best bet was to take some photos and make a flick-book instead. As with everything, time and technology has revolutionised the production of stop-motion photography, and now making a film with a digital camera or mobile device is child’s play. The Raspberry Pi Camera Module offers a superb low-cost digital option. While time-lapse photography is popular, it’s easy to overlook its illusory bedfellow. After all, creating a stop-motion animation with figures, household objects or simply toys is intensive work. Often the results aren’t very good, and even getting to the point where you have enough shots to create a short movie clip can be pretty back-breaking. Fortunately, there are some shortcuts you can take, which we’ll explain here.

E

our expert Christian Cawley A Raspberry Pi owner since 2012, he’s nurtured 13 devices to date, seeing them blossom into media centres, retro gaming systems, and portable radio broadcast stations.

You need Raspberry Pi 2 or later Raspbian Stretch Pi Camera Module Dual-state push-button Breadboard Monitor Mouse and keyboard Tripod or secure mount Something to animate: clay figures, Lego, action figures and so on

54     LXF249 May 2019

Stop, it’s motion time… It’s a good idea to allocate time to your stop-motion project – say a few days. Shoots are famously slow;

Planning to animate Lego minifigs? Use base pieces or putty to keep the figures stable for each shot.

Be careful connecting the jumper wires to the GPIO – ensure the Raspberry Pi is powered off before hooking up the button.

you’re going to be snapping around 24 frames for each second of footage, so having an area that remains undisturbed when you’re not using it is vital. This ‘hot set’ should remain untouched by others, too. Your studio area should have enough space for the tripod- or rostrum-mounted Raspberry Pi and Camera module, along with the objects you’re filming. In the case of 2D, paper-based animation, this should be an area of table big enough to fill, or almost fill, the lens. Also useful for overhead shooting is a sheet of clear plastic or glass. This keeps the papercraft pieces in place when taking a shot, as well as helping them to look flat and uniform and dealing with any curled edges. If it was good enough for Terry Gilliam, it’s good enough for you! In order to shoot clay models, fruit, toys or whatever 3D objects you plan to animate, you’ll need an area large enough to build a set. There should also be space around the table for you to move in to aid with the animation of your characters. Remember that stopmotion animation requires very slight movements in every frame for each of the characters or objects you’re shooting. The aim is to get the character from one position to another, while creating the illusion of motion. Access to the character from every angle will help you to achieve this. Whether you’re using an overhead camera or a standard tripod-mounted shoot, the project needs to be well-lit. See ‘Lighting balance’ box (over the page) for some handy lighting tips.

www.linuxformat.com


TutorialS Debug serial comms

comms

Debug serial comms Sean Conway walks you through the process of troubleshooting communication problems between a PC application and a serial device. he itch for an article on troubleshooting USBto-serial connections needed to be scratched, after working on a request for assistance from a local model railroad group (see LXF239). This tutorial will provide the knowledge to troubleshoot communication (comms) issues from an app on a PC to a serial device, using a USB-to-serial cable/interface. In the diagram shown below, there is a PC running an application that requires a serial interface. The PC is connected to the serial device, shown on the far right side of the drawing, using a USB-to-serial cable/ interface. The drawing contains a few additional details that will be introduced as our discussion expands. Hardware in the PC supported serial comms; at one point during the evolution of the PC, a minimum of two DB9 ports (the 9-pin COM port) was considered standard. The red highlighted text in the diagram are some examples of COM port communication needs. But all things come to an end, and the ubiquitous USB port soon replaced COM ports. To consolidate all the different serial device comms requirements, a USB-toserial cable/adaptor came into play. Unfortunately, this generic serial comms doesn’t always work, and it can be frustrating trying to isolate the root cause of serial communication failure. After connecting the USB-to-serial cable to the host PC, the first step is to determine if the OS recognises the USB-to-serial adaptor. In Linux, the dmesg command reveals information regarding hardware detection, driver assignments and communication port allocation. It is important to take note of what COM port (COM1, 2, 4 or so on) is used – this will be needed to support our efforts, as well as set up the application.

T

our expert Sean D. Conway is a retired IT security specialist who now exercises his brain by mining knowledge through Raspberry Pi projects.

Serial Application (Putty)

The easiest way to determine if the operating system detects the USB cable/adaptor device is to install the device after a reboot. Installing it before a reboot causes the device details to be consolidated inside other boot message content. From a command line interface type dmesg . If the cable/adapter was plugged into the PC before bootup, the details we want are embedded in the dmesg listing. For the novice it’s much easier to plug in the cable/ adapter after a reboot and then run dmesg. The new device details will be at the end of the listing. From the information returned you can extract which chipset/UART is in the cable/adapter. The details will also identify which communication port has been assigned. You are looking for something like ‘ttyUSB’, suffixed with an assignment number – for example, ttyUSB0 . For the next step in troubleshooting we are going to use an application called Putty – its UI makes it easy to configure the ports. The goal is to confirm that software on the host PC can communicate through a USB-toserial adapter. Once Putty is installed, open the application. Select ‘Serial’ in the ‘Connection type’ choices. In the ‘Serial line’ field, enter the COM port details you have recorded previously. Proceed to the serial connection screen. The most common, default setup is 9600baud 8N1. The number sequence translation means: eight bits of data, no stop bits, one parity bit. Give the session configuration a name and save it. The session configuration is not saved by default when you leave the application; if you don’t save the session, you’ll need to input the configuration again next time.

Serial Connection (USB to Serial cable/adapter) CD UART/RS232/ RS485/RS422

Data

2 RxD

TxD 3

3 TxD

DTR 4

4 DTR 5

SG

6 DSR

RTS 7

7 RTS

(jumper for testing) CTS 8

8 CTS

DB9 Connector

RI

9

9

Device Connector

2wire/4wire synchronous serial

5

DSR 6

5

58     LXF249 May 2019

1 CD

RxD 2

SG EPP parallel and MEM parallel

9

CH341 Chip

PC

USB Connector

Parallel printer to USB printer

Data –

Serial Device (DCC)

1 6

+

Serial connection path mapping, with additional landmarks shown.

1

NULL Modem (Optional)

RI

www.linuxformat.com


Tutorials FFF

Discover a blazingly fast file manager Not all file managers look the same, as Shashank Sharma discovered while working with FFF – a file manager written in Bash. hat sets FFF apart from other file managers is its non-conventional user interface… and its name, of course. It’s not every day one comes across a tool with an expletive for a name, which we won’t repeat here for obvious reasons. You will have to point your browser to the project’s home page at https://github.com/dylanaraps/fff for that. FFF doesn’t exactly have an interface to speak of. Instead it provides a directory or file list, and lets you perform various file operations such as copy, paste, cut and so on. As a shell script, the project also doesn’t have large dependencies, and you can set it up on any Linux distribution – and even BSD and macOS – without any hassles. For all of its file operations, the tool relies on the coreutils package. You can optionally install the w3m-img package, which will let you view

W

our expert Shashank Sharma is a trial lawyer in Delhi and an avid Arch user. He’s always looking for geek memorabilia.

Command-line file managers Text-based file managers aren’t new; in fact, graphical managers could be considered the new kids on the block. Two of the most popular file managers for Linux users, Midnight Commander and Ranger, are command-line utilities. Unlike FFF, these feature a multipane interface, and some even more advanced features. For instance, you can use Midnight Commander to recover deleted files, and search for files or the content of a file as well. Unlike FFF and Ranger, however, Midnight Commander uses Emacs-style keybindings. As with FFF, you can also create bookmarks, called Hotlists, and can also connect with remote FTP clients and browse contents of archives such as RAR and ZIP – something FFF can’t do. If you’re running Ranger or Midnight Commander in a terminal emulator on top of a graphical environment, you will also be able to use your mouse to navigate around the interface, which is another feature not available with the vanilla FFF file manager. Another alternative is vifm, which as the name suggests is another tool that supports vi-style keybindings. As with Ranger and Midnight Commander, vifm features a multi-pane interface. While it doesn’t offer the advanced features of Midnight Commander or Ranger, a lot of people will appreciate its undo and redo feature, which can be used for many different operations such as copy, delete, rename, move, change permissions, owner/group change and so on.

60     LXF249 May 2019

image files from within the terminal emulator itself, using the w3m browser. The w3m-img package and other optional dependencies listed on the project’s GitHub page are readily available in the software repositories for most distributions. To install FFF, open the terminal and run git clone https://github.com/dylanaraps/fff.git, which copies the FFF repository into the current directory. To be able to access FFF from anywhere in the terminal, you must place the script somewhere in $PATH, such as the /usr/sbin directory. You can run the sudo cp fff /usr/ sbin command to do so. Alternatively, you can source the script from your ~/.bashrc file: $ echo “alias fff=”/path/to/fff-script”” >> ~/.bashrc $ source .bashrc

Of course, you can create a more convenient alias if you prefer, such as fm or even f: $ echo “alias fm=”/path/to/fff-script”” >> ~/.bashrc $ echo “alias f=”/path/to/fff-script”” >> ~/.bashrc $ source .bashrc You can now launch FFF by running the fff

command from the terminal, or using your alias. If you’ve ever worked with the popular vi text editor, you’ll quite enjoy navigating with FFF. In addition to vi-like keybindings, the project also uses the arrow keys to help you navigate around. The key() function in the FFF script describes the various bindings.

The search feature also produces real-time results, and is indeed fast enough to justify the project’s expletive-riddled name.

www.linuxformat.com


Tutorials Organise photos

Shotwell

How to build a photo library in Shotwell Nick Peers reveals how to bring order to your chaotic photo and video library with Ubuntu’s default photo organiser. igital photography has been become both a blessing and a curse. It’s almost inconceivable to remember the time when every photo was precious, eagerly awaited with a mixture of anticipation and dread. Nowadays, digital clutters up your hard drive with dozens – if not hundreds – of photos for every major life event, never mind the rest. Thankfully, there’s a tool that can help bring order to your chaotic collection. Shotwell doesn’t simply bring your photos into a single library: you can use it to organise them a myriad of different ways, from datebased events to keyword tags. It even offers a selection of handy image-editing tools to help lift lacklustre

photos through creative use of colour and light correction, cropping, straightening and even removal of the dreaded red-eye. Shotwell is included by default with both Ubuntu and Mint, but it’s an old version (0.28.4). Step one, therefore, is to ensure you’re running the latest version – 0.30.1 at time of writing. Open a Terminal window and issue the following commands:

D

our expert Nick Peers is looking forward to finally being able to bring some sense of order to the chaotic ‘pile’ of photos he has amassed.

$ sudo add-apt-repository ppa:yg-jensge/shotwell $ sudo apt-get update $ sudo apt-get install shotwell

Close the Terminal window and launch Shotwell from the applications list. It will immediately search your

View and edit photos in Shotwell 1

6

3 If files in the Shotwell library are moved, deleted, or – with removable media – disconnected, they become ‘missing’ and disappear from the main view. You can check these under Library > Missing Files. Either restore the file(s) manually, or select them all and click ‘Remove from Library’ to delete them.

62     LXF249 May 2019

2

4

5

Filter photos Use the options in the left-hand pane to filter the list of photos in various ways, including by event, tag or flag.

Crop options Click to select the aspect ratio of your selection, or switch between portrait and landscape orientation using these tools.

Basic information When you select a photo to view, its basic file information is displayed here.

Toolbar Context-sensitive options appear here – when you’re viewing a file, various editing tools plus the zoom slider are displayed.

Crop tool The crop tool enables you to cut out superfluous detail: click and drag on the crop square to resize or move it.

Extended information Press Ctrl+Shift+X to display additional information not shown by the Basic information tool.

1

2

3

4 5

6

www.linuxformat.com


Tutorials Audio editing

Audacity

Advanced audio recording and editing John Knight returns to his old recording friend Audacity once again, and finds things have become a little more advanced. ig audio suites are great, but they can be intimidating to say the least – sometimes you just want something that works without having to think too much about it. Enter Audacity, from: www.audacityteam.org. Audacity has become popular on all desktop platforms, and has started popping up on YouTube tutorials quite a bit. Known for its ease of use and intuitive interface, Audacity is perhaps the audio equivalent of Microsoft Paint (erm…–Ed) – it can’t do deeply complicated tasks, but then it was never intended to do so. It’s designed around simple controls that most people can guess their way around… though that doesn’t mean you can’t achieve some great results!

B

our expert John Knight writes ebooks on how to play the drums, when he’s not playing with a Commodore 64 emulator.

Audacity’s interface 1 3

5

6

2 4

Main Toolbar Where your primary tools are kept, such as Selection, Time Shift, Zoom and Envelope.

Collapse Button Squishes up any track into a kind of sliver which can be expanded later.

Track Controls Tools for muting, soloing tracks and changing the gain and the pan. This is where you really shape your soundscape.

Zoom Controls Dedicated buttons for specific zoom functions, including zooming into a selected portion of a wave, or zooming out 100%.

Track Menu Provides a bundle of more advanced controls, such as mono-stereo conversion, as well as renaming and moving tracks.

Recording Options Choose which audio system you want to use, which device to record from, mono or stereo, and change the playback device.

1

2

3

68     LXF249 May 2019

4 5

6

Although technically Audacity can record multichannel digital audio, the interface really isn’t designed for it – it’s meant for simple recording in mono or stereo. If you’re looking for a Pro Tools replacement, Audacity isn’t it: try Ardour or QTractor instead. But if you’re looking for an easy to use wave editor and a fast, simple way of making stereo mixes, it may be what you’re looking for. Audacity lets you get deep into the wave form and perform easy cuts and edits, making it very popular among technicians who want to cut together quick edits, and apply basic effects without getting bogged down by a complex interface. Nevertheless, Audacity has undergone some changes lately, and at first glance some long-time users might have their nose put out of joint. So for the new users we’ll give you a walkthrough of the major features, and for the veterans we’ll show you what’s changed and how to adapt to it. We won’t be showing you all the features, but we will cover enough of the essentials to start a workflow.

Sounds good In order to show you how Audacity works, we first need to have some audio to play with. You can either import some existing audio or just record random sound (blank silence is fine) – it doesn’t really matter, as long as there’s an audio track of some sort. If you want to add some existing audio tracks, you can run through a maze of GUI prompts if you really like, or you can just click and drag them onto the editing field. As for recording audio, just hit the Record button in the main toolbar, and if you’re using an internet mic, clap your hands a few times – that should show up on the waveform. Press Stop when you’re done and we’ll be able to look at Audacity properly. The Device Toolbar lets you change which sound card you want to use, and which audio host will run the system – likely ALSA, maybe with the option for JACK. For your recording device, you will probably have options for Default (most likely an ALSA device) or Pulse. ALSA will probably run quicker and be kinder on the system, though Pulse will likely be easier to get working if your system is already configured around it. Perhaps of chief importance is the number of Recording Channels. Here you can choose between

www.linuxformat.com


Tutorials Audio editing

A cool feature veterans may not know about is the Wave Color entry in the dropdown menu, which has four different colours, and is meant for easily differentiating between instruments.

Default or Pulse. Default will probably use ALSA, which will run much faster, but if you’re using Pulse audio, open the properties for your sound card. In KDE we had to open the Advanced tab in the Audio Volume section, and from the Profile drop-down box, we used Analogue Stereo Duplex. If you’re using digital speakers, just try anything that enables an analogue input. Once you have something that works, write down what you did and don’t mess with it – record everything you can while it’s working! After this, Audacity should be smooth sailing. Now to tweak the recording levels. The smaller the wave in height, the worse the signal-to-noise ratio will be, making the track hissy and probably muffled. The louder the recorded input, the more likely it will ‘clip’ the edge of the waveform and sound horrible and distorted. You want to strike a balance where a good amount of space in the wave form is used, but leave room in the dynamic range for sudden loud notes, such as a big cymbal crash. Keep turning up your instrument, input or mixer desk until your waveform is getting near the edge, and back it off

The Envelope tool lets you make smooth and continual transitions to volume over time, such as a long fade-out.

Recording With JACK Running Audacity with JACK rather defeats the purpose of its simple interface, but maybe there’s some kind of effect chain you want to create, or some kind of MIDI program you need to use, and the only way to do it is JACK. First, you need to make sure JACK runs properly. We recommend installing QjackCtl, which provides a straightforward GUI for starting and configuring JACK. If you try to start JACK and get an error, first try specifying your soundcard by clicking Setup, and in the Settings tab will be the Interface drop-down menu. Change the setting from ‘(default)’ to your soundcard’s actual device name. If this doesn’t work, make sure Driver is set to ‘alsa’ instead of ‘dummy’, and if it still doesn’t work, try disabling ‘Realtime’. To change Audacity from using ALSA to using JACK, open your system settings by choosing Edit > Preferences and in the Devices tab will be the Interface section. For Host, open the drop-down menu and change the entry from ALSA to ‘JACK Audio Connection Kit’. It’s best to leave everything at default settings and see if you can record as-is. If you need more JACK connectivity, you change Audacity’s Playback and Recording devices to JACK, though you may need to manually connect ports in QjackCtl’s Connect window. JACK is messy and temperamental at the best of times. Don’t use it with Audacity unless you really need to!

70     LXF249 May 2019

if it starts clipping. Depending on your underlying audio system, you may be able to turn the recording levels back down with the slider in the top-right of the window.

Running tracks Recording a piece of audio is great, but you can do that on just about anything. What makes Audacity so popular is that it does multi-track layered recording, and probably makes it easier than any other program out there. If you’re new to the concept of multi-track recording, it allows you to record sounds one at a time in layers, slowly building up a soundscape. For instance, the most common usage is in music where you may record each musician in isolation, rather than recording the band as a whole. You may lay down a drum track first, and with that first drum track in their headphones, the bassist can record their track in a new second layer. Then the guitarist could hear the drums and bass playing through their headphones and record their guitar in a third layer. With the instrumentals finished, the singer can record their vocals. If you’re a seasoned Audacity user, you need to know that things have changed. When you hit the Record button, Audacity used to create a new track automatically and start recording in that. Now when you click Record, Audacity will start recording on the end of the current track, and just keep on adding to it. If you would rather record into a new track, use the keyboard instead of the mouse. Pressing R records onto the end of the current track, but Shift+R records into a new track. If you’re determined to have things the way they used to be, you can change it by choosing Edit > Preferences from the main menu. Open the Recording section and in the Options field, click ‘Always record on a new track’. Note that Audacity now has latency correction builtin, but some audio device settings may result in an error regarding latency timing. If this is the case, you can also tweak your latency correction settings in the Preferences window. In the Devices section, you can tweak the buffer length and ‘Track shift after record’ settings in the Latency field.

Track-on-track action Not only can Audacity do multi-track recording, but you can also edit each recorded layer individually, making tweaks to any layer without upsetting the others. Going back to the band example, if you simply recorded them in one live image, you would have to mix them together as a whole and you wouldn’t be able to make many adjustments. But with separate tracks you can correct mistakes and tweak each recording individually. For instance, if the guitarist plays a bum note or the drummer coughs during silence, you can simply mute their second of bad audio and the rest of the song will be unaffected. Or, if one instrument is too loud, you can turn the volume down on just that track without affecting the volume levels of any other musician. If you want to turn a track up or down, just move that track’s Gain slider. If you wish to mute a second of audio, simply highlight the portion of audio you don’t want and press Ctrl+L, or click Edit > Remove Special > Silence Audio. For more advanced users who want to do volume automation, there is the Envelope Tool in the main toolbar. This lets you make smooth volume

www.linuxformat.com


Tutorials WordPress to static HTML

Apache

Part Two!

Building a secure website to host sites

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

Stuart Burns shows you how to create a secure web server on which you can host statically generated WordPress sites on a secure Apache server. ne of the great things about dealing with static content is that having no PHP or database dependencies, this means that not only are the sites more performant, they consume less resources and therefore are not only less expensive but backing up the important data is trivial. There are many VPS (Virtual Private Server) providers you can choose for this task. For this instance we are going to use DigitalOcean (www.digitalocean.com) as they are very fast, easily accessible and inexpensive. This second instalment builds on the previous tutorial around creating performant static websites from a local WordPress instance. It is assumed at this point the reader is able to create and successfully export the WordPress site as a zip file containing the static Worpress export files using the SimplyStatic tool. The next step is to create an internet facing webserver for this purpose, which is what we’re going to cover here. The first step is to create an account with DigitalOcean, which is pretty simple and straightforward – you can also use an existing Google account if you prefer. Once you’ve signed up, select Ubuntu 16.04 LTS as the distribution choice. Select the starting plan and

O

our expert Stuart Burns specialises in large-scale infrastructure management and virtualisation technologies, and writes about new and emerging technologies.

Simply Static’s output generation.

select the $5 instance. Choose an appropriate datacentre (we suggest choosing the one that’s most geographically close to you) and click the green Submit bar. Shortly after submitting the request you should receive an email with the root password. It’s possible to use public/private keys to log in, but the specifics may vary by vendor. We’ll implement a public/private key setup for our server manually. The email should contain both the server IP and address and root password. Log in to the server using the following command in the terminal window: ssh root@<ip address>

Assuming you trust this IP, it will ask you to accept the fingerprint. On initial login you’ll need to change the password. Enter the password and confirm it. All being well you’ll be logged into the server as root. This can be confirmed by using the command whoami . This will confirm the current user logged in. The first step is to update the server to include the latest patches and reboot. Perform this with the following commands: apt-get update && apt-get upgrade -y reboot

The next step is to configure users, because being logged in as the root user for most purposes is not a good idea from a security stance. Create a user with the following command and set a password for it. useradd -m adminuser -s /bin/bash passwd adminuser

The next step is to add the user to the sudoers, the users who can elevate their rights and run administrative command using the sudo command. Luckily, this is quite straightforward: usermod -aG sudo adminuser

Verify this is working by using the command: id adminuser

This command should give a list of the groups the user belongs to: one of them should be sudo. It should now be quite straightforward to log in using the admin user and the new password, using SSH as we did before: ssh adminuser@ip_address . Test that the sudo elevation works by using the command sudo su . If it does work, you can move on to making the environment a bit more secure. One of the first things to do is to disable the abilities of the root user. Open the

72     LXF249 May 2019

www.linuxformat.com


Tutorials Vector graphics

LibreOffice Draw

Creating diagrams and illustrations

There’s a much better way of creating technical and business diagrams and illustrations than with a paint package, as Mike Bedford demonstrates. hoto editing packages, also known as painting applications, are widely used, but often inappropriately. They’re far from ideal for producing diagrams, flow charts, logos and illustrations for scientific, technical and business purposes. Instead, the tool of choice for this sort of job is drawing software, otherwise known as vector editing software. In LXF248 we ran a Roundup of five vector graphics offerings, all of which are freely available under Linux, and most of which are open source. Here we’re offering some hands-on guidance on how to use one of these tools for a few typical applications: LibreOffice Draw, which is a very capable package. Ironically, you might think, our chosen tool isn’t the one which scored the top spot in our review. However we believe it offers all that most users need. In addition, LibreOffice Draw is probably already installed on your PC, and it’ll easily work in conjunction with other LibreOffice tools because of the commonality of file formats. Even if you choose to use different software, many of the basic principles covered here still apply.

P

our expert Mike Bedford The content of a document might be paramount, but Mike reckons that appearance is vital to make a good impression. Or at least that’s his excuse for being obsessed with drawing software.

Vector editing principles

Dimensioning shows the sizes of objects as they appear on the page – so nothing larger than 210mm horizontally on an A4 page. This isn’t very useful if you’re designing a kitchen, so use the scale options to adjust this.

76     LXF249 May 2019

Before starting with any hands-on instructions, it will be helpful to discuss, in broad terms, what vector editing software provides and how it’s fundamentally different from paint software, which can also be thought of as bitmap-editing software. Although paint software now offers some of the facilities that were previously the sole domain of vector editing software, this type of package operates primarily at the level of individual pixels. While editing pixels is the obvious way forward for photos – which are, after all, nothing more than a bunch of pixels – for diagrams, the vector approach of working with objects is much more appropriate. In referring to objects, we mean mainly geometric shapes such as lines, boxes, circles and text, all of which can be further defined by the colour and thickness of any outlines, and the colour of any fill. What makes the vector approach so valuable, though, is what happens when you draw an object such as a box. Instead of it being stored internally as a set of pixels, it’s defined by its position, its width, its height, its rotational angle, the width and colour of its outline if any, the colour of its fill and so on.

Of course, to be displayed on screen, it does have to be rendered as pixels – as it also has to be if it’s printed – but the basic definition is just a small amount of data. This has huge advantages when the box is edited or deleted. If a box is defined purely by its pixels, adding that box to the image obliterates the pixels that had previously been in its position on the page. If you then edit the box’s shape, it isn’t possible to reinstate the pixels that formerly occupied that area of the image. If you remove a box stored as its basic parameters – a vector graphic – on the other hand, the complete image can be recreated using the definitions of all the remaining objects, with no loss of information. You can think of it as destructive (bitmap editing) versus non-destructive (vector graphics). Vector graphics editors usually provide a degree of support for bitmaps – paradoxically, you might think. In most cases, though, they don’t provide the same extensive facilities for editing bitmaps as photo editing software does. Of primary importance, though, bitmaps are treated just like the objects we’ve already looked at, so you can adjust their size and position and rotate them. It’s not difficult to imagine how the inclusion of bitmapped images could brighten up a basic line drawing. For example, a diagram illustrating the electronic control system in a car could certainly benefit from using pictures of the engine, gearbox, wheels and so on, instead of just plain boxes with text labels.

For engineering illustrations, room layouts and similar mechanical drawings, the dimensioning feature ensures that dimensions remain correct following any size changes.

www.linuxformat.com


Tutorials Steam streaming

Steam

Stream your Steam games at home Push your Linux gaming to your big TV for real gaming fun, with the help of Alex Cox. alve’s Steam Link was an odd little device. Frequently discounted to just a couple of quid, and much-maligned for producing inconsistent results, the now-discontinued black box aimed to beam your games from your desktop PC – presumably residing in a dirty corner of your home – to your living room TV. That’s not a new concept, certainly – you can do it with an Xbox or PlayStation, or with tech such as GeForce Go, or even Steam from PC to PC – but a damn convenient one if you have a library full of Steam games and an insatiable yearning for your sofa. Good news, then: Steam Link is dead, but long live Steam Link, now reborn as a chunk of Linux code suitable to run on a Raspberry Pi 3. Yes, you’ll be investing more – you need a Raspberry Pi 3B or 3B+ (£34, plus all the other bits you require) – but once it’s hooked up, you’ll get the same effect, and there’s nothing to stop you installing other stuff on your Pi to give it a second job. RetroPi, anyone? Plex or Kodi? It’s up to you.

V

our expert Alex Cox is a tech expert and writer, inexorably drawn to tinkering with, and inevitably breaking, anything put in front of him.

Prepare your Pi You absolutely need a Raspberry Pi 3B or 3B+. We didn’t try this on a Pi Zero or a previous version of the main Raspberry Pi branch, because we weren’t feeling masochistic enough; it’s unlikely to work at all, but if that’s all you’ve got, you’re welcome to try it. You also need an Ethernet connection (we’ll come to this later on) and, at least initially, a keyboard and mouse, before you replace them with a controller. A large SD card isn’t a primary requirement (we installed on an 8GB card we had lying around), but if you want to do more with your

Use Etcher to write your SD card.

80     LXF249 May 2019

A Raspberry Pi 3B or 3B+ can replace the old Steam Link.

Steam Link box, you’ll want to give yourself a little more breathing room. Lastly, don’t skimp on the power supply: you need something that puts out at least 2.5A, because if your Pi doesn’t get the relevant juice, it’ll descend into a mess of glitches. Consider also adding a heatsink kit to your box to prevent it frying itself.

Get carded Unlike the case with some single-use Raspberry Pi setups, there’s no special distro needed to be installed on your SD card: the Steam Link app installs and runs on top of Raspbian Stretch, the Pi’s default OS. Download the desktop version www.raspberrypi.org and unzip it, then grab Etcher from www.balena.io/ etcher to get the OS image onto your SD card. Insert the card into your reader, run Etcher, drag and drop the ISO image onto the window, and proceed with the writing procedure. Make sure you’ve extracted everything you need from that SD card, as this is a 100 per cent destructive procedure. When the write’s done, pop the card into your Raspberry Pi and boot up – it should drop you straight to Raspbian’s Pixel desktop.

Install Steam Link Open up a terminal and type sudo apt update to make sure your OS install is as current as it can be, and to ensure Raspbian’s knowledge of its repositories is up to date. Then type sudo apt install steamlink to download the whole thing and install it automatically. That’s the installation process done with – you should see a Steam Link icon appear on your desktop, and the program’s ready to run. You can now either doubleclick that icon, or run steamlink within the terminal window. If you have a controller, you can plug it in and configure it now; Steam Link on the Raspberry Pi

www.linuxformat.com


The best new open source software on the planet

HotPicks

Alexander Tolstoy almost broke the Matrix after firing up Cygwin on ReactOS. Luckily, everything ran inside a VM.

DigiKam Olive Cygwin LibreOffice ODrive Quaternion Klogg Underrun Sandspiel Hyperfine Friture Image organiser

DigiKam Version: 6.0 Web: www.digikam.org ne of the reasons why digiKam evolves so rapidly is its constant participation in Google Summer of Code, which is hard to underestimate. We’ve extolled the enormous power of digiKam in the past, and it’s only getting better. Its key feature is the ability to mark images with tags and create sorted catalogues of photos. Tagging is incredibly useful; it lets you navigate huge image libraries to quickly find the desired files. digiKam is also very capable at importing photos from various sources. The import window has dozens of options, but perhaps the key one is automatic creation of albums based on dates. This way you can turn a single folder with thousands of files into a much more appealing set of subdirectories sorted by date. Last but not least are built-in ‘dark’ and ‘light’ rooms designed for processing RAW shots. It is impossible to list all the goodness delivered with the latest digiKam 6.0. The update is really big, with the gorgeous Time-Adjust tool (batch-fix timestamps of your files), export to Pinterest, OneDrive and Box webservices, new icon-view customisation tool and more. The new digiKam 6.0 can play your videos right inside the application without switching away, so in some sense videos are now as easy to organise and watch as still photos are. Another well-timed update lies in the Lighttable component, which sports a wider list of supported devices that can shoot in RAW. digiKam now correctly parses RAW shots from recent Samsung Galaxy and Apple iPhone devices, as well as some new DSLRs. But video support is perhaps the main hero of the digiKam 6.0 changelog. We added our ~/Videos directory to the library and tested it with digiKam. The application integrates a very smooth with its robust video player module, which doesn’t slow things at all, even with large amounts of ‘fast previews’ for our videos. A tagged video catalogue in digiKam instead of a plain Videos folder in a file manager? Give it a try!

O

www.techradar.com/pro/linux

You can click a video to play it. Tag, sort and organise them just like photos without having to go to a separate player app.

Navigate around the digiKam interface

3

5

2

4

1

All albums at your fingertips The albums tree view is the most popular default view in digiKam. You can treat it like a file manager.

1

Main thumbnail view Select an item in the left area and see its contents in the main part of the digiKam window. Click an image or video for a larger preview of it.

2

3

Expand other view modes Lots of hidden power here: tags, dates,

timeline, people, similarity checker and even an integrated Marble globe. Configure digiKam your way The app sports a packed Configure dialogue. Adjust the RAW handler, colour profiles, templates, database location and much more here.

4

Extra information about the current file Not only file properties, but also colours, versions, filters and manipulation tools are all withing your reach.

5

May 2019 LXF249     83


coding academy Keep track of Git

Shell scripts

Check the status of your Git repos John Schwartzman shows you how to write a Bash shell script that can keep track of all of your many Git repositories. it is a version control software system that keeps track of all of the changes you’ve made to your source code and enables you to revert to a previous version at any time. It’s important to keep Git up to date by checking in (committing) your source code frequently – whenever you have made changes that you’ve tested and are happy with. This is particularly important in continuous integration/ deployment environments. This git-checking script stemmed from a current C++ project has seven different source directories, with a single Git repository that spans all the directories. To put these projects under Git source control, we’d open a terminal in the project’s base directory, ~/ Development/UDS (the ultimate parent of all of the source directories) and issue the Git init command. This makes the base directory a Git repository. Then going to each of the project source directories issue Git add * to stage the files. Finally, going back to the project base directory and issue Git commit -am “initial version” to commit all the staged versions. If you have certain artifact files that show up in all your source directories, you can tell Git to ignore them and not treat them as untracked files. The Eclipse IDE places a .cproject file, a .project file and a .settings directory in each of the source directories. You can create a .Gitignore file containing the names of these items and place it in the Git repository directory. When you’re working in many different directories at the same time, it’s easy to get confused and forget just what you’ve changed and what you haven’t. Git enables you to go to each of your source code directories, one at a time, and use the Git status . command to tell you what hasn’t yet been committed to the repository and whether there are any new files in the directory that haven’t yet made it into source control. You can also use the Git diff command to tell you exactly what has changed between a source file in the directory and a source file in the Git repository. To commit your changes to Git, use the command Git commit filename -am “Your comment goes here” . Meanwhile, the gitk command shows you a GUI view of

G

our expert John Schwartzman is a software engineering consultant to business and government. He also teaches Computer Science at a local college.

Git isn’t only for C++ projects. You may have Perl, Python, C, shell scripts, text files, make files, configuration files or magazine articles that you want to keep track of. You probably already have Git installed on your system. Try typing git --version at the command line.

90     LXF249 May 2019

The output from the gitStatus shell script is designed to be instantly readable, with the use of colour coding.

your repository. General confusion led to the decision that it would be useful to have a single command (a Bash shell script) that would summarise the status of the repository of the seven source code directories and would indicate which directories need attention. The image above shows the output of the shell script, which we’ve called gitStatus. The green items are up to date and need no attention. The yellow and red items do need attention. They tell you that the utility directory has one or more untracked files: source code files that were never put under version control. That may not be a problem so we indicate that condition in yellow – as in caution. They also tell you that the transport source code directory has two files on disk that are different from the versions under source control. Two files in the

www.linuxformat.com


coding academy Speed up web apps

WebAssembly + Rust

Speed your web apps with WebAssembly

Mihalis Tsoukalos explains how to develop WebAssembly applications from Rust, and how to use them with the help of JavaScript. avaScript has been the dominant programming language among web developers for a long time now. WebAssembly wants to become the new king of web development – not as a programming language, but as a virtual and portable compilation target. Therefore WebAssembly is not here to replace JavaScript entirely, but to work with JavaScript. The two biggest advantages of WebAssembly are portability and good performance. This tutorial is about writing Rust code, compiling it into WebAssembly and using that WebAssembly code. At the time of writing, the latest Rust version is 1.32.0. However, you should not have any problems executing the code of this article even with older Rust versions. At the end of the tutorial we’ll see how to create WebAssembly code from Go, so we can compare the Rust way with the Go approach.

J

our expert Mihalis Tsoukalos is a UNIX person and the author of Go Systems Programming and Mastering Go. You can reach him at www.mtsoukalos. eu and @ mactsouk.

Get the code for this project on the LXFDVD or visit www. linuxformat. com/archives and grab teh code pack.

Installation As always we’ll need to install WebAssembly on our Linux machine in order to use it with Rust. First, you will need to install the standard Rust toolchain, which includes rustc, the Rust compiler; rustup, the Rust toolchain installer; and cargo, which is the package manager for Rust. The easiest way to install all these is to follow the instructions at www.rust-lang.org/ tools/install. If you prefer, you can use your favourite Linux package manager instead. After installing the Rust toolchain, you should install wasm-pack by following the instructions at http://bit. ly/lxf249rust2 1. Then you will need to install cargogenerate to make creating WebAssembly projects in Rust simpler and easier. As cargo-generate is just a Rust crate, it can be installed by executing cargo install cargo-generate . Be prepared for a lengthy installation process; it includes the execution of the following: $ sudo curl https://sh.rustup.rs -sSf | sh $ sudo curl https://rustwasm.github.io/wasm-pack/ installer/init.sh -sSf | sh $ sudo apt install libssl-dev pkg-config $ cargo install cargo-generate

Figure 1 shows a small part of the output of the commands from the installation process. Note that all

Figure 1: A small part of the installation process of the Rust WebAssembly support, which is a pretty lengthy task.

Rust tools are installed in ~/.cargo/bin, so ensure that ~/.cargo/bin is in your PATH environment variable. The output of the rustc --version command will verify that everything is OK with your Rust installation. If you try to execute cargo generate without first installing the required Rust crate, you’ll see the following error: $ cargo generate error: no such subcommand: `generate` This happens because cargo generate is not a

standard command of the Cargo tool. Installing WebAssembly support for Rust is the most difficult and challenging task you will find in this tutorial; at the end of it, we’ll see that this isn’t the case with WebAssembly and Go, as WebAssembly is just another supported architecture for Go. In a moment we’ll look at a simple Rust project that generates WebAssembly code, which is going to be served using HTML and JavaScript. You will need to use nmp (Node Package Manager) to be able to test the generated applications on your local machine. As npm is installed with Node.js, you need to install Node.js to get npm on your computer. Therefore, it would be a good idea to install Node.js at this point. For the Ubuntu machine used in this tutorial, installing Node.js and npm is as simple as executing apt install npm with root privileges – this installs both components.

1) https://rustwasm.github.io/wasm-pack/installer/ 92     LXF249 May 2019

www.linuxformat.com


9000

On the disc 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.

pen-testing distro

Kali Linux 2019.1 nce again we have only a single distribution this month, but this time we’re not neglecting our 32-bit users, with 64- and 32-bit versions of Kali Linux. It’s been a while since the last Kali release – the end of October 2018, in fact – and we like to encourage our readers to hack all the things (in a totally legal and responsible way, of course), so here we are. The main event in this new release is version 5.0 of Metasploit Framework, released in January 2019, but there’s all sorts other goodies. We’ve gone for the MATE release this time, because we like it. This is the full-fat edition with all the tools ready to go. There’s only so much you can fit on a DVD, so we’ve got the Xfce-based Kali Light for 32-bit users. This has all the basic tools, and you can add anything you like (subject to available

O

64- & 32-bit

memory) to the live environment with apt. Speaking of the live environment, you may notice that those are the only available options when booting the disc: the installation options are all conspicuously absent. That’s because we removed them, much as we did eight issues ago, because they don’t play nice with our multi/ hybrid booting menu system. Given the choice, we’d rather have a disc that boots to a nice live environment than one that offers broken options, promises and dreams. Kali Linux is often run straight from a live medium anyway, but if you do want to install it, just burn/write the Kali ISO (located in the Kali/ or Kali-light32/ directories on the disc) to a DVD-R or USB stick. Writing the whole disc (either using dd or using a program like Unetbootin or Rufus) won’t work, partly because We took away the installation options and added a warning. We are a cruel and heartless bunch.

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 www.balena.io/etcher that’s available for Windows, macOS and Linux. Good luck!

boot the disc

Many PCs should boot automatically if they’re turned on with a disc in the drive. If not, many offer an early Boot Menu accessed by tapping a key while powering up from cold: F9 (HP), F12 (Dell, Lenovo), F8 (Amibios) or F11 (Award BIOS). Alternatively, use the BIOS/UEFI to adjust the boot order to start with the optical drive. Again, this is accessed by tapping a key during power up, usually Del but sometimes F1 or F2. Some new UEFI PCs require access via Windows: holding Shift select its Restart option. If you’re still having 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     LXF249 May 2019

Important Notice!

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.

www.linuxformat.com

Profile for Future PLC

Linux Format 249 (Sampler)  

You can subscribe to this magazine @ www.myfavouritemagazines.co.uk

Linux Format 249 (Sampler)  

You can subscribe to this magazine @ www.myfavouritemagazines.co.uk