DOKK Library

Linux Voice [Issue 10]

Authors Linux Voice

License CC-BY-SA-3.0

Plaintext
       FIRST LOOK: RASPBERRY PI MODEL A+




FREE DVD                        January 2015
                                DUAL BOOTING                  LEGAL                   RASPBERRY PI
INCLUDES ISSUE 1
& UBUNTU 14.10                  GRUB 2                        PATENTS                 BISCUITS
                                Work with multiple            How the US courts are   Build a snack protection
                                operating systems             finally seeing sense    system with Python




     How your Linux
     box beats
     Windows 10
     hands-down
                                                                               34+ PAGES OF TUTORIALS
SYSTEMD Understand the changes that are coming to Linux
                                                                                         Januar y 2015 £5.99 Printed in the UK




OGGCAMP Inside the UK’s biggest hackery-makery happening
GIVE IT AWAY How we’re going to share our profits with the community

 GOOGLE CARDBOARD                                   INTERVIEW

 DIY 3D                                             TIM BRAY
 Turn your phone into                               He takes your
 an Oculus Rift                                     privacy seriously
                                                                                                                            WELCOME



The season of goodwill
The January issue



Linux Voice is different.
Linux Voice is special.
Here’s why…                                                                           GRAHAM MORRISON
                                                                                      A free software advocate
      At the end of each financial                                                    and writer since the late
 1
      year we’ll give 50% of our                                                      1990s, Graham is a lapsed
profits to a selection of                                                             KDE contributor and author
organisations that support free                                                       of the Meeq MIDI step
software, decided by a vote among                                                     sequencer.
our readers (that’s you).


                                          T                                                                           SUBSCRIBE
                                                   his is our tenth issue, and as per our crowdfunding promise
       No later than nine months                   when we launched the magazine, it marks the release of
  2
       after first publication, we will
relicense all of our content under
                                                   issue number one under the terms of a Creative Commons
                                          licence (you’ll find it on this issue’s DVD already). The licence we
                                                                                                                      ON PAGE 62
the Creative Commons CC-BY-SA             chose was CC BY-SA, which means you can do pretty much
licence, so that old content can          anything you like with our content – even sell it, as long as you
still be useful, and can live on even     credit the source. We all feel like we’re breaking new ground with
after the magazine has come off           this approach, and we know of no other magazine that does the
the shelves.                              same, let alone a magazine funded by the community, available on
                                          international newsstands, and run by a few people from their
      We’re a small company, so           kitchens and bedrooms.
 3
      we don’t have a board of               As our first year draws to a close, we’re also starting to think
directors or a bunch of                   about how we’re going to give our profits away, and we’ve outlined
shareholders in the City of London        a prototype for the process on p36. Now is the time to get involved
to keep happy. The only people            if you want to have a say, and we’d love to have your input. Take a
that matter to us are the readers.        look at our redesigned LinuxVoice.com for further details, and as
                                          ever, feel free to contact any of us directly.

THE LINUX VOICE TEAM                      Graham Morrison
Editor Graham Morrison                    Editor, Linux Voice
graham@linuxvoice.com
Deputy editor Andrew Gregory

                                          What’s hot in LV#010
andrew@linuxvoice.com
Technical editor Ben Everard
ben@linuxvoice.com
Editor at large Mike Saunders
mike@linuxvoice.com
Games editor Liam Dawe
liam@linuxvoice.com
Creative director Stacey Black
stacey@linuxvoice.com
Malign puppetmaster Nick Veitch
nick@linuxvoice.com
Editorial contributors:
Russell Barnes, Chris Brown, Mark
Crutch, Marco Fioretti, Josette Garcia,   MAYANK SHARMA                     BEN EVERARD                          MIKE SAUNDERS
Juliet Kemp, Vincent Mealing, Simon       My biscuits are always being      The Raspberry Pi Foundation          Ben combines robots, artificial
Phipps, Les Pounder, Tariq Rashid,        stolen. Which is why Les          gave us exclusive access to their    intelligence and a competition in
Adam Saunders, Valentine Sinitsyn         Pounder’s early warning system    new A+ model, which they’ve          an ace tutorial about building
                                          is so completely awesome. p78     made even cheaper. p28               your own Skynet. p104



                                                           www.linuxvoice.com                                                                    3
                CONTENTS


                                                                                                                                 January LV010
   Spreading the word of Linux since 2014. Wait – it still is 2014!
                                                                                20     REGULARS
SUBSCRIBE                                                                                    News
                                                                                       06
ON PAGE 62                                                                                   Italians won’t have to pay the
                                                                                             Windows tax any more, plus
                                                                                             Microsoft loves us.
                                                                                       08    Distrohopper
                                                                                             Netrunner, Knoppix, BackBox
                                                                                             and Picaros Diego all come
                                                                                             under the microscope.

                                                                                       10    Gaming
                                                                                             Borderlands: the Pre-Sequel

                          Linux vs Windows                                                   – coming to a Linux machine
                                                                                             near you.
                                                                                             Speak your brains
                      Why we’re so, so glad we’re not                                  12
                                                                                             Another Vim convert, a silly
                        using Windows any more.                                              typo and a call for freedom – all
                                                                                             written by you lovely lot.

                                                                                       16    LV on tour
                                                                                             Brought to you by Python in
                                                                                             Dublin, OpenRISC in Munich
        42                                                                                   and Open Rights in London.

                                                                                       18    OggCamp
                                                                                             The biggest Geekfest in the
                                                                                             UK extends its warm embrace
                                                                                             to us all.

                                                                                       36    LV profit sharing
                                                                                             We promised we’d give away
                                                                                             half our profits – here’s how

        Tim Bray
                                                                                             we’re going to do it.

                                                                                       56    Group test
        The man behind the                                                                   Six of the best lightweight
                                                                                             Linux distros whittled down
        XML spec wants to                                                                    to one champion.

        talk to you about                                                              62    Subscribe!
                                                                                             It’s not just an operating
        online privacy…                                                                      system, it’s a way of life.
                                                                                             Join us today!

                                                                                       64    Core technologies
                                                                                             Dr Brown unearths access
                                                                                             controls: groups, users and
                                                                                             permissions.
                                                                                       68    FOSSpicks
                                                                                             Freer than a radical with a
                                                                                             dangling covalent bond, (but
                                                                                             not as damaging to cells).
                                                                                       110   Masterclass
                                                                                             The tools to rip DVDs to video
   28
        PI MODEL A+            40   FAQ: RISCOS            32
                                                                PATENTS                      files and the knowledge to use
        Meet the latest             No, this is not an          Praise be for the US         them to do just that.
        product from                OS for skydivers or         Supreme Court being    114   My Linux desktop
        the Raspberry Pi            fans of the Japanese        sensible in the face         Enter Lennart ‘man behind
                                                                                             Systemd’ Poettering’s Bauhaus
        Foundation – the all        delicacy, fugu. It’s        of a load of patent          den of geek.
        new Model A+.               reduced and open.           nonsense.


   4                                                 www.linuxvoice.com
TUTORIALS                                                                    REVIEWS
  76                                     78




                                                                             48   Ubuntu 14.10
                                                                                  The biggest distro pauses to
i3: Learn a tiling                     Raspberry Pi: Use                          draw breath before next year’s
                                                                                  big Mir/Systemd release.
window manager                         different kinds of input
Make better use of your screen     Use your Pi to protect a plate
space and kill the mouse for good. of biscuits from interlopers.

  82                                     86




                                                                             50   Fritzbox
                                                                                  If you’re looking for the end of
                                                                                  level boss of routers, we may
                                                                                  just have found it for you.

                                                                                  OpenBSD 5.6
Markdown: Write once,                  Linux 101: Get the best
                                                                             52

                                                                                  Try an alternative Unix
publish anywhere                       out of Systemd                             derivative with a focus on
                                                                                  stability and security.
Publish your content in a simple       Love it or hate it, Systemd is here
format that looks here to stay.        – you might as well use it.

  90                                     94




                                                                             53   Google Cardboard
                                                                                  Google now wants to control
                                                                                  your senses, with its homespun
                                                                                  3D headset for smartphones.

Grub 2: Heal your                      Olde code: Atlas – the                54   Books … and a film
bootloader                             UK’s supercomputer                         masquerading as a book!
                                                                                  Citizen Four, about the
How to fix a broken installation       The transistor revolution brought          Edward Snowden leaks.
without losing all your data.          supercomputing to Manchester.
100
      Code fractals     102
                              Code ninja: Stdin    104
                                                         Robocode:
      with Python             and stdout                 AI warfare
      Introducing the         Chain commands             Program primitive
      Julia set.              together for fun.          robot brains.



                                              www.linuxvoice.com                                                     5
    ANALYSIS




NEWSANALYSIS
The Linux Voice view on what’s going on in the world of Free Software.
Opinion



The code audit mirage
What does it take to keep open source code secure?

                          Simon Phipps             undocumented functions.
                          is president of the      Audit is a reasonable way to
                          Open Source Initiative
                                                   give customers of this
                          and a board member
                          of the Open Rights       proprietary code confidence
                          Group and of Open        that it behaves in the way
                          Source for America.      the vendor describes. But
                                                   open source code is not a
                                                   product until a vendor
                                                   packages it as one. Until
                                                   then it is a tool, waiting to be



I
    n the wake of Heartbleed and other             deployed by a suitably
    serious bugs found in open source code,        knowledgeable person.
    I keep hearing calls for “audit”. For
example, the European Commission is                What should we do?
considering whether to budget for security         First, we should be demanding of
audits as part of its encouragement of open        suppliers who deploy open source
source software adoption. That’s something         code as part of a deliverable with
I never heard in all my years at technology        security aspects that they audit the
corporations. We discussed testing                 code. If your supplier does not
strategies, deployed “pen testing”, did            employ committers on the code they are
automated code scans, used assertions in           trying to sell you, or at very least have a
code to back up several of those test              paid business relationship with someone
strategies, and so on. But “audit”? I never        who does, don’t buy.
remember hearing it mentioned.                         Second, as community developers we
   An audit is exactly the wrong strategy for      should be performing regular scans of the
open source. It spends money on finding            code we share using a tool like Coverity Scan.    One of the major reasons Heartbleed happened
fault without fixing anything. It reflects a       It’s a free-of-charge proprietary offering that   was a lack of new eyes coming into the
worldview that open source software is a           analyses even the largest codebase and            OpenSLL project
product someone else is responsible for,           identifies common programming errors like
rather than a shared resource everyone is          uninitialised pointers, buffer over-runs,         diversity of communities. A project that has
responsible for. If you don’t trust the code,      unreachable code and so on. It produces a         very few different sources of external
you should be pointing your finger at              detailed, actionable report that community        motivation for its committers – all the same
whoever deployed it, not at the code. The          programmers can then cherry-pick to fix the       employer, for example – can easily neglect
only time to fall back to an audit is when the     serious issues identified. Coverity Scan also     the steps necessary to keep quality high.
collaborative developers refuse to co-             produces a useful code quality metric, which        Open source code is neither more nor less
operate, as happened with TrueCrypt.               allows tracking of code improvement trends        secure intrinsically -- all code has bugs, and
   All code has bugs. Secret code can also         as well as highlighting regressions.              sometimes they lead to security exposures
have intentional back-doors and                        Third, we should keep an eye on the           and subsequently to exploits. But open
                                                                                                     source, properly maintained in a diverse
                                                                                                     community, can have them fixed faster and
“An audit is exactly the wrong strategy – it spends                                                  can use tools that publicly expose issues.
money on finding fault without fixing anything.”                                                     Let’s make the code better and not allow
                                                                                                     open source to be misrepresented.



6                                                               www.linuxvoice.com
                                                                                                                ANALYSIS


    Debian • Italy • Tor • MS loves Linux • Adobe • Ubuntu is 10 • HTML 5




CATCHUP                                         Summarised: the biggest news
                                                stories from the last month

          Debian fork proposed due                      Italian Supreme Court                      Tor Browser 4.0 released
   1      to Systemd adoption                    2      bans “Microsoft tax”                 3     with Meek transports
           Systemd (see page 86) is                       If you buy a PC with Windows               Thanks to the new Meek
being adopted by most major distros           pre-installed, but never even boot that     pluggable transports, Tor can relay
now, but not everyone is happy with           OS and install Linux instead, you won’t     data via third-party servers such as
the change. A group of “veteran Unix          have much luck getting a refund for         content delivery networks and cloud
admins” have suggested that it’s time         the unused software. But times are          hosting services, making it harder for
to fork Debian, after the distribution        changing: the Italian Supreme Court         governments to block Tor connections.
decided to use Systemd. The website           has ruled that this “Microsoft tax” is      www.torproject.org
at www.debianfork.org outlines their          illegal, and anyone should have the right
reasons – but it has already been             to get their money back if they buy a PC
parodied on www.forkfedora.org. Given         and use a different operating system.
the vast size and scope of the Debian         The Free Software Foundation has a
project, a successful fork would be a         more detailed explanation here:
mountain of work, but let’s see…              http://tinyurl.com/klgp5gj




          Microsoft CEO Satya                           Adobe discontinues                         ChromeOS drops ext
   4      Nadella: “We love Linux”               5      Reader for Linux                     6     support, puts it back in
           No, this isn’t a delayed April                  We know that plenty of Linux             This might not seem like a hot
Fool’s joke. Microsoft’s new-ish boss         and FOSS users aren’t big fans of           news story, but it shows how effective
has proclaimed that the company now           Adobe, especially given the horrendous      a vocal community can be. Developers
loves Linux, given that 20% of its Azure      bloatware its PDF Reader has become.        working on Google’s ChromeOS
cloud platform customers are running          Now Adobe has pulled the plug on            platform quietly dropped support for
the open source OS. This is in stark          Reader for Linux – not a big deal for       Linux’s native ext filesystems, so you
contrast to the remarks made by               many people who are using arguably          couldn’t use them on external media
Nadella’s predecessor, Steve Ballmer,         superior programs like Evince, but          such as SD cards or USB keys. This led
who famously described Linux as a             frustrating for others. We asked our        to much gnashing of teeth online, with
“cancer”. Nadella sees things differently     Twitter followers what they thought,        a huge number of complaints being
though: “I don’t want to fight old battles.   and many of them still need Adobe’s         made, so Google relented and put the
I want to fight new ones”. A real change      tool for filling in certain forms which     filesystem support back in. “We’ve
of heart, or just empty words?                don’t work well in the FOSS equivalents.    heard you loud and clear”, said one dev.




          Ubuntu turns 10!                                                                         W3C finalises HTML 5
   7       Yes, the distro that                                                              8     standard, finally
           introduced many millions                                                                 This isn’t directly related to
of people to Linux and FOSS has                                                           Linux, but it’s big news for OSes that
just hit double digits. Over a decade                                                     use web apps, such as Firefox OS. After
ago, Mark Shuttleworth pored over                                                         eight years of work, the World Wide
archives of the Debian mailing lists,                                                     Web Consortium (W3C) has finalised
gathered together some of the                                                             the HTML5 standard. Sure, many web
distro’s most notable developers, and                                                     browsers have been implementing
decided to get Linux onto mainstream                                                      HTML5 features for a while, such as
desktops. The first release was the                                                       improved media support, but now
Warty Warthog (aka 4.10), shown on                                                        that the standard is finished, browser
the right. Remember that chocolatey                                                       devs can be sure that the specs won’t
brown theme? Anyway, happy birthday                                                       change beneath their feet.
Ubuntu – here’s to another 10 years!                                                      http://tinyurl.com/ohlz4x6




                                                       www.linuxvoice.com                                                            7
     DISTROHOPPER




DISTROHOPPER
Our pick of the latest releases will whet your appetite for new Linux distributions.

Picaros Diego
Linux for children.


T
         here are a few distributions aimed at
         children: Doudou springs to mind,
         and there’s also Sugar on a Stick.
Both of these are based on the idea that you
need to protect children from the
complexities of the computer (and protect
the computer from the children). Picaros
Diego is different. There’s nothing stripped-
down or shielded from view. Instead, it’s a
normal Linux distro with a brighter, more
kid-friendly interface.
   The desktop wallpaper perhaps best             We were too busy playing Secret Mario on Picaros Diego to write a witty or interesting caption.
exemplifies this. On one hand, it’s a colourful
cartoon image designed to interest young          file manager. In the programming category,         little young for a system like this, but the it
children. Some of the images on the               we were slightly disappointed to discover it       may well work for children on the upper end
landscape are icons for games, and this           only had Gambas (a Visual Basic-like               of that age range.
should encourage children to investigate the      language), and not more popular teaching               Overall, we like the philosophy of wrapping
system rather than just relying on menus.         languages like Scratch or a Python IDE.            Linux is a child-friendly package, but not
On the other hand, it still displays technical    However, it’s based on Debian, so you do           dumbing it down. Picaros Diego won’t work
details such as the CPU usage and the RAM         have the full range of software available          for every child, but if you have a budding
and Swap availability.                            through apt-get, so this isn’t a problem.          geek in your midst, it could be the distro to
   It has kids’ games and more technical             The project website lists it as suitable for    bridge the gap between highly simplified toy
software such as the Midnight Commander           children aged three to 12. We think three is a     distros and normal operating systems.




BackBox
Penetration testing never looked so lovely.


B
        ackBox is a distro for people             even though they’re command line-based,
        interested in computer security (call     and clicking on them brings up a terminal
        them whatever you like: crackers,         window with the help text of the tool. This
hackers, penetration testers or annoying          might seem a little strange to people used to
sods who cause you to have to deal with           regular Linux distributions, but it makes it       For most of the time we’ve known about this
selinux). It’s based on Ubuntu with a             much easier to get started with the tools.         distro, we’ve been pronouncing it Blackbox. We
customised LXDE graphical environment,            Especially if – like this author – you have a      apologise to all concerned.
and a whole lot of tools to help you crack,       terrible memory for commands you only use
sidestep or otherwise bypass security             occasionally.                                      PPAs for just about anything) and it’s
measures. There are also additional tools             We’re relative newcomers to Backbox, but       lightweight. If you’re completely new to this
for pentesters such as the MagicTree              it’s quickly becoming our favourite                field, you might be better off with Kali, as
reporting software.                               penetration testing environment. It looks          there’s more support for this distro, but if
  As is customary in pen testers’ distros, the    nice, it’s easy to use, it’s got the full set of   you’re fairly familiar with Linux, you shouldn’t
applications menu includes all of these tools     Ubuntu software available (you can add             have any trouble at all with Backbox.



8                                                             www.linuxvoice.com
                                                                                                                                  DISTROHOPPER



Netrunner Rolling Release
A surprise find on our torrent server.


W
             e’re running a Torrent server at
             Linux Voice, partly to help take
             some of the bandwidth load off
individual distro projects, but also because it
provides us with a useful insight into what’s
popular at the moment. One of the surprise
successes has been Netrunner Rolling
Release. After Knoppix (see below) and Tails,
the distro for the privacy-conscious, it has
the highest share ratio of any of the distros
we’re hosting. Share ratios are an odd
statistic (they provide a rough indication of
the number of times something has been
uploaded), and aren’t an accurate
representation of popularity. Still, this is a
high position for a relatively unknown distro.
   The main version of Netrunner is based
on Kubuntu, while the rolling version is
based on Manjaro (and by extension, Arch).                Netrunner Rolling also comes with a few games such as BurgerSpace to help you unwind after a
This means that underneath, there’s quite a               stressful upgrade by smashing hamburgers.
lot of difference between the two, even
through they both carry the Netrunner                        Firefox in Netrunner comes with Adblock             There’s space for distros that package the
name. Both have a great KDE interface – not               plus installed, and DownloadHelper (an                 vanilla versions of software, but we prefer it
just the usual defaults, but an interface                 extension to help you grab images and                  when distro maintainers put their personal
that’s been crafted to look nice out the box              videos to watch later). It’s little tweaks like        stamp on the software and help the user get
– but below this they have little in common.              these that make using Netrunner pleasant.              set up with a good system.


  Knoppix The original live Linux distro is still going strong

  There was a time – far back in the distant past – when you couldn’t
  try Linux without installing a distro. Then along came Knoppix, with
  the revolutionary concept of running Linux directly from a DVD
  without installing anything, and the live distro was born.
     These days, of course, almost every distro comes as a live CD (or
  DVD) that you can try before installing directly from the live session.
  So is there still a place for a live-only distro like Knoppix?
     Absolutely! The simple reason is that while many distros can run
  live, most aren’t designed to do so as a matter of course. Knoppix is.
  This means that it comes with a walloping bundle of software that
  should be sufficient for almost any situation. For example, it comes
  with everything you should need to get online on almost any type of
  connection. ISDN line? Fine. 3G dongle? No problem. Need to start
  an SSH server? Included. In fact, it’s hard to find an area that
  Knoppix doesn’t come with software for. It can help you recover a
  broken machine, or operate as a main operating system in a machine
  with no hard drive.
     With a live distro, you’re also stuck with the look and feel that
  comes pre-configured (unless you want to make changes every time
  you reboot). This means it’s that even more important than normal
  that it looks good. Knoppix has a slightly unusual combination of
  LXDE (usually known for its minimalism) and some pretty heavy
  graphical effects that we’re more used to seeing on KDE. However,
  the end result is an nice looking desktop that should run reasonably
  on most hardware.
     Knoppix is one of those distros that you should always have a
  copy of, because sometime, probably when you’ll least expect it, it’ll
  get you out of a sticky situation.                                           The Knoppix desktop might be a little unorthodox, but it works well.




                                                                            www.linuxvoice.com                                                               9
     GAMING ON LINUX




GAMING ON LINUX
The tastiest brain candy to relax those tired neurons

 DON’T PANIC!
                                           Borderlands: The Pre-sequel
                                           Shoot ’n’ loot on the moon.


                                           N
                                                      ot finding enough loot in Borderlands 2?
                                                      Well we have you covered, as
                                                      Borderlands: The Pre-sequel has been
                                           released on Steam for Linux.
                                               Borderlands: The Pre-sequel is a mix of frantic
                                           first person shooting with RPG mechanics that
                                           works out rather nicely. As you shoot and loot
 Liam Dawe is our Games Editor and
 the founder of gamingonlinux.com,         your way through the game you will be able to
 the home of Tux gaming on the web.        level up, and unlock special abilities.
                                               The Borderlands series is known for injecting a


 A
          re you feeling nervous about     fair bit of comedy into the game, so don’t go
          Steam Machines and               thinking this is some sort of Call of Duty-class
          SteamOS? Are you worried
                                           serious shooter.                                      them a quick invitation on Steam, and like magic
 about what will happen to Linux
 gaming if they fail? We are here to           What makes the Borderlands series so different    they enter your game world.
 settle those worries over a hot cuppa     is a mixture of a few things, the most important         The day has come for Linux gamers to truly
 with some thoughts of our own.            of which is the loot system. Each gamer could         show our numbers. This is the first time we have
    Let’s start with some facts about      end up with a completely different arsenal of         been able to give a major publisher sales
 where Linux gaming is right now;
                                           weapons compared with your friends online. Are        statistics from Linux gamers to compare them
 Valve’s juggernaut of a store is now
 serving up over 700 Linux-compatible      you jealous of their sniper rifle that does fire      properly side-by-side with Windows & Mac, so it’s
 games with no sign of slowing down.       damage? No problem: just show off your assault        time to show them our numbers!
 Only recently have some big               rifle grenade launcher (and yes that’s a thing!).
 AAA-class releases hit Linux too, so          The online modes are also what makes it a           Publisher 2K Developer Gearbox/Aspyr Media
 not only are we getting more, but we                                                              Release Date 17 October 2014 Store http://store.
                                           great experience, as it’s all completely seamless.
 are getting games with much bigger                                                                steampowered.com/app/261640
 budgets too.                              Teaming up with people is as simple as sending
    GOG deserves an honourable
 mention now as just recently it hit
 100 Linux games in its catalogue, and       This is Linux’s first ever AAA
 considering that it has only                same-day Linux release.
 supported Linux since July of 2014
 that’s a pretty quick jump. GOG will
 also support Linux with its recently
 announced Steam-like client called
 ‘Galaxy’, and since it has no ties with
 Valve and Steam it will continue
 supporting Linux regardless of what
 happens with the Steam Machines.
    Why are we noting all of this? Well,
 this success has all come without a
 single Steam Machine being released,
 so with all this happening for us
 gamers we think that Linux gaming
 will carry on being perfectly healthy
 even if Steam Machines are a flop.
    A Linux-based gaming machine
 won’t exactly be an overnight success
 anyway, but with Valve we should see
 a slow and steady push to increase
 Linux games to help them succeed
                                           “Borderlands: The Pre-sequel is a mix of frantic
 with their Linux-based initiative.        first-person shooting with RPG mechanics.”

10                                                               www.linuxvoice.com
                                                                                                                     GAMING ON LINUX


Super Win The Game                                                                                   ALSO RELEASED…
Here comes the nostalgia train!


R
          emember the days of being              Game which is also available on Steam for
          frustrated trying to complete          Linux, and it expands on it rather a lot with
          platformers on your old games          a lot more content.
consoles? Well Super Win The Game                    Unlike the free game that came before
should bring back a lot of memories, as          it, Super Win The Game is not just a
it seeks to emulate the look and feel of a       standard platformer, as it blends a mix of
lot of retro games, so you could call it a       adventure gaming along with some slick
homage to retro games, and in our eyes           platforming moves.                                  Eufloria HD
it’s one of the best at achieving this effect.       There is no combat in this game, so             A revamp of a well-received ambient strategy
    The game comes with full game-pad            if you’re a pacifist looking for some non-          game that is now on Linux. A great way to relax
support as standard, so it can really feel       violent fun, this is for you.                       your tired mind with lovely ambient music, and
the part and a game like this feels better                                                           easy to learn strategy controls make it a
                                                                                                     winner this issue.
with one too.                                      Publisher Minor Key Games Developer Minor            The style of the game is just beautiful with
    Super Win The Game is the sequel to the        Key Games Release Date 1 October 2014 Store
                                                   http://store.steampowered.com/app/310700/         the minimalistic, but gorgeous graphics.
free hit indie game You Have To Win The                                                              Now, go spread your seeds across the universe!
                                                                                                     http://store.steampowered.com/app/221180

                                                               The game uses a CRT effect to
                                                                      simulate old monitors




                                                                                                     Windward
                                                                                                     Landlubbers need not apply. Windward is a
                                                                                                     procedurally generated (it’s all random) naval

0 A.D.                                                                                               combat and exploration game designed to be
                                                                                                     played either by yourself, or team up in co-op
                                                                                                     with friends.
Setting the future standard for open source games.                                                       You can fight against pirate ships, do a little



0
                                                                                                     trading or just explore the high seas.
       A.D. has unleashed its 17th alpha                                                             It’s currently in ‘Early Access’, so it’s not yet
       version of the open source real                                                               complete, but early reviews are positive.
       time strategy title that aims to be                                                           http://store.steampowered.com/app/326410
historically accurate.
   0 A.D. is aimed at fans of games like
Microsoft’s Age of Empires series of
games, and plays a lot like them. The
major difference is that you don’t upgrade
through different ages like in the AoE
series of games.
   The new release is a whopper with                New features are but a tip of the iceberg
a major rebalance to the combat, but             for this latest alpha as 0 A.D. has seen
formations have been removed for the             a wave of performance enhancements
moment to be reworked. It also includes          too, so you should notice a better overall          Screencheat
a much smarter AI that can now deploy            framerate, and this is probably one of the          Do you like to play co-op with your friends and
naval transport ships to hop to different        most important fixes as the late-game got           peek at their screens? We do too! Lucky for us
islands, so the AI will no longer stall on       rather sluggish in previous alphas.                 Screencheat has been released in full on
                                                                                                     Steam, and the main hook for it is you actually
naval-based maps. Combat units can now                                                               need to use other people’s screens to find
garrison walls directly for extra defence,         Developer Wildfire Games (and contributors)       them, as everyone is invisible. Madness!
and when you do this you can even see              Release Date No ETA for the final release Store   http://store.steampowered.com/app/301970
                                                   http://play0ad.com
them on top of the walls.



                                                                 www.linuxvoice.com                                                                        11
     MAIL




                            YOUR LETTERS
                              Got something to say? An idea for a new magazine feature?
                              Or a great discovery? Email us: letters@linuxvoice.com



              LINUX VOICE STAR LETTER
  FREE YOUR CARPALS
  This is my first letter/email            I think I have got the areas
  ever to a magazine but I              I need to target but knowing
  felt compelled to write it as         which shortcuts to learn
  Linux Voice is such a good            straight away and which to
  read (subscription to it from         ignore or put lower down on
  my girlfriend – an amazing            the priority list is very much
  present).                             prone to trial and error (my
     This year, spurred on by           desktop environment is
  your magazine, I have been            KDE which can be baffling
  compelled to try as much as           at times) Learning a whole
  possible to banish the mouse.         slew of new shortcuts can be
  I am doing my damnedest to            terminally off putting. Is there
  remove the rodent from my             a site/book/font of knowledge
  desktop to increase long term         that can help with prioritising
  productivity. However, I am           which shortcuts to learn
  finding it very tricky.               first to dramatically increase
     It’s tricky as there does          productivity. I do recommend           There’s a learning curve with all-singing, all-dancing text editors like
  not appear to be a clear              people reduce mouse usage.             Vim, but once you’re used to living with it, you’ll never look back.
  and obvious path to doing             Its amazing what the meta key
  this. Increased use of the            and a cursor key can achieve           composed in Vim – I’m a new            to go cold turkey on the mouse
  command line (using Yakuake           together.                              convert.                               (RSI gets a bit much when
  and Terminator), changing/            Laurie James, London                                                          you’re constantly clicking and
  learning desktop environment             PS Thank you for the great          Mike says: Hurray! Another             typing), Terminator is brilliant for
  shortcuts and software                Vim tip of always pressing the         convert for the Vim cause.             anyone wishing to improve their
  shortcuts are the areas I am          Esc key after inserting text.          Welcome to our ranks, Laurie.          productivity – if you haven’t tried
  concentrating on.                     PPS This email was                     While we do occasionally try           it yet, give it a go!



MORE TO LATEX
Of course it’s important to               Clamtk is a useful graphical front
understand the principles of              end, but some distros only provide
markup of TeX and LaTeX, as Dr            ClamAV, which needs use at the
Sinitsyn elucidates [in LV009], but       command line.
the easiest way is surely to use          Dave Postles
LyX, which should be available in         From my Trisquel Linux desktop
all distro repositories. As for virus
checking, it is useful to do so to        Andrew says: Cheers Dave – although
avoid passing on any infected             there are no viruses out there for
document which some Windows               Linux, it’s good if you’re running a mail
user might have sent to you and           server to help keep the internet clean      If you want most of power of Latex but with a shallower learning
which you distribute further.             for poor old Windows users.                 curve, give its graphical cousin Lyx a go.


12                                                               www.linuxvoice.com
                                                                                                                                        MAIL


IT’S ONLY WORDS                                                                                               AN ODD TYPO
In your December edition you                                                                                  I looked at your Issue 8 DVD
replied to Richard Bosworth about                                                                             and the envelope for it and was
explaining free software to ‘the                                                                              surprised to see a typo in what
masses’.                                                                                                      seemed an unlikely place – the
    In a somewhat similar situation                                                                           legal disclaimer. “Legal: Linux
I finally worked out that the                                                                                 Voice cannot accept s for any
message was not so much not                                                                                   disruption, damage and/or
getting through as being totally                                                                              loss to your data or computer
inverted in translation. The person                                                                           that may occur while using
I was talking to turned out to treat                                                                          this DVD.” Granted, this is the
‘free’ as a synonym for ‘worthless’                                                                           typical legalistic covering of your
and ‘volunteer’ as meaning                                                                                    posterior. Your readers most likely
‘someone who isn’t serious’. Given                                                                            understand that and would never
                                                                                  The ethical stance taken
that to him ‘proprietary’ meant        same problem. The Free = Worthless                                     consider giving you any S. I can
                                                                                  by Richard Stallman
‘valuable’ and only a company          interpretation is fixed in many people’s   and the Free Software       only guess what other letters of
could possibly be relied upon for      heads by years of experience, so it’ll     Foundation is exactly       the alphabet you wouldn’t want to
support and that was it: I was         be hard to overcome. Next issue we’ll      right – it’s just getting   accept.
snookered.                             go back to basics with a look at why       it across to the masses     Roy Birk
Tom Groves, Ashford, Kent              free software matters – not just an        that’s proving difficult.
                                       exploration of the features (though                                    Andrew says: Hmmm. It’s true, we do
Mike says: We’ve had a few replies     do feel free to turn to page 20 for our                                not accept any S. We prefer pounds,
on this subject, and it’s troubling    thoughts on Windows vs Linux), but                                     euros or dollars. Or bottles of whisky.
that so many people are finding the    as an ethical choice.                                                  I’m as baffled by that as anyone.



PRAISE. KIND OF
I love your magazine and podcast,         If you move on to page 46, there
keep up the great work!                is a review of CentOS 7. Obviously,
   However in reading issue #6, I      it was available in time for a review
found something that my pedantic       to make it to print. Thanks again
nature could not reconcile. On         for the hard work and dedication to
page 9 when discussing Red Hat         the open source community.
Enterprise Linux 7, the article        Todd Campbell
ends with “The CentOS team are
working on the community build,        Graham says: Rations have been
which may even be available by         reduced and the team will be flogged                                   Rest assured that we won’t be
the time you read this.”               until performance improves.                                            accepting any S relating to this issue’s
                                                                                                              DVD either.




                                                             www.linuxvoice.com                                                                    13
     MAIL



MORE TINKERING!
I would first like to congratulate
your entire team for a job well
done. I got interested in Linux
Voice the moment I saw your
second issue, and have since
become a subscriber. Just the
core technology section makes
the magazine a must read. I am
a hardcore Windows user and
though I use Linux at work I wasnt
particularly attracted to it until I
started reading your magazine. LV
has encouraged me to try out new
distros in the past few months and
after trying CrunchBang, Bodhi,
Manjaro, CentOS and Arch I have
finally settled down with Gentoo.
Formatted my Windows box and
put in Gentoo! And loving every
moment of it. Thanks a ton LV!
   I would like to request that
                                                                                                                          There’s more tinkery fun
you include an article type for        hardware diagnostics utilities etc.     Linux and are loving it, despite the
                                                                                                                          in the pipeline – like the
tinkerers like myself in every         Saptarshi                               culture shock. We’d really like to delve   driver we wrote for this
issue which could be about say                                                 deeper into some subjects/projects,        USB toy car.
writing your own Linux device          Graham says: Wow! Welcome! I            as you suggest, and we’ve got some
driver (something a little more        know a few hardcore Windows users       great plans for longer form projects
in-depth than issue 2 or perhaps a     and none would give up their OSs        that spend more time relishing in the
series) or tinkering with Awesome      without a fight, so it’s wonderful to   details. If anyone has a great idea for
WM’s configuration or just some        see you’ve found your way over to       an in-depth project, let us know.




                                       YOUR AD
                                       HERE
14
                    Email andrew@linuxvoice.com to advertise here
                                                                                                                             MAIL



WHAT DISTRO?
I started using Linux with              need serious attention, but a basic
Slackware 96, or was it 3.0, and        distribution, without updates,
went through Red Hat and Gentoo         would give me, at least, some
but failed with Arch Linux. Now I’m     relief.
running Linux Mint 17 – with KDE,       Ron Petch, East Gosford NSW
of course.
   My requirements are simple, the      Andrew says: Clem Lefebvre, the chief
internet, some games, email and         boss of Mint, says “As a general rule...
multimedia. I do have a PostgreSQL      unless you need to, or unless you
database using Tcl and Tk.              really want to, there’s no reason for
   With progressive upgrading           you to upgrade”, which is probably a
and updating I have not gained          good sign that you shouldn’t. We’ve
in functionality, but have lost         started to fall out of love with Arch
things. I can’t get Compiz to do        recently due to some breakages, so I
the impressive rotating cubes           wouldn’t recommend that. How about
anymore, giver has been and gone,       Debian? You get the security updates,
and now World Of Goo ( I was            but there’s no risk that the developers
up to chapter 2 ). I get segment        will rush forward a feature causing
faults, which I presume means           your software to break.
incompatible libraries.
   Where can I find a distribution,
which is stable and “old
fashoned”, to get these back? I         Slow and steady wins the race, if the
can understand security and UEFI        race is all about not breaking things.



WE HAPPY FEW
I first became aware of and             sandwiched between them.                   struck me as more than a little odd
interested in Linux some years          (Come back Jonathan Roberts,               to expect a magazine devoted to
ago through Micro Mart magazine,        all is forgiven!) And there among          Linux to be expected to promote
which I read for three or four years.   the contributors another familiar          something which, I quote, “has
However, gradually there was less       name, Mayank Sharma. What I                nothing to do with Linux.” I was
to interest me in it than hitherto.     have read so far I have understood.        not all that surprised that you have
Then I spotted a Linux magazine,        I like the style and appearance of         ignored it.
which must remain unidentified,         things so I fancy you have just            A Geoffrey Mort
and I started to take it on a regular   gained a regular reader.
basis (despite the wife’s tut-tutting       I have an issue you may well           Andrew says: If you’re looking for a
about the cost!). However more          be able to help me with. I have for        version of Linux to choose, you could
recently I have found that more         the last two years been intending          do a lot worse than try Lubuntu from
of the content has been ‘over my        to install a Linux distro on my            this issue’s DVD. It’s low on system
head’ (I’m not in the first flush of    machine. At the moment I use               requirements and we’ve included
youth) and I had begun to wonder        Windows (excuse the language!)             it in its 32-bit version, which, if
whether I ought to overcome my          XP and have absolutely no                  your machine is still running XP,
innate product loyalty thing and        intention at all of upgrading.             I’m guessing will probably fit your
discontinue.                            However, not being overly                  hardware better than the KDE version.
    Last week in WH Smith’s I           knowledgeably about computers                  And if you’re looking for help with
noticed Linux Voice 008, but            and computing, I have yet to take          Linux, the north west of England
didn’t pick it up. Until, that is, in   the plunge. I wondered if there            is a fantastic place to be. Preston
the supermarket on Friday, when I       might be an experienced Linux              and Blackpool have active hacker
saw it again and decided to have a      user in the Bolton area, which is          communities, and the Manchester
look. And there, to my amazement        where I live, upon whose guidance          Raspberry Jam (the Raspberry Pi is
was a familiar face, Graham             and help I could call. If there is         just a Linux box, remember) is one of
Morrison, no less, and then             someone they can email me at               the biggest around – not sure about
three more familiar faces hirsute           AGeoffMort @tiscali.co.uk.             Bolton itself, but I’m sure there are
editions of Andrew Gregory, and             Finally, I noticed the letter in       people near you to offer a helping
Mike Saunders, with Ben Everard         Linux Voice by David Walker. It            hand. And I’m glad you’ve found us!



                                                              www.linuxvoice.com                                                    15
     LUGS ON TOUR




LUGS ON TOUR
ORCONF 2014
Mike Saunders finally becomes an alpha geek by hanging out with CPU designers.


I
     f you’ve not heard of OpenRISC
     before, turn to p40 for our
     introduction to this open source
processor design. OpenRISC has
been around for well over a decade,
but in recent years it has seen a
surge in popularity – partly thanks
to the overall increased interest
in open source, but also due to
the boom in mobile devices. So
for the last three years, OpenRISC
developers, users and curious
onlookers have gotten together for
their annual conference, and this
year it took place on the 11–12
October in Munich.
   Why Munich? Well, OpenRISC
is used extensively in the city’s
Technical University for research
into processor designs. Stefan
Wallantowitz, a research assistant
at the university, gave a talk
about OpTiMSoC, the “Open
Tiled Manycore System-on-Chip”
framework (www.optimsoc.org).
This is a pretty complicated topic,
but essentially it lets you work with
building blocks, such as CPU cores,
                                        Most of the talks were very technical, but there was plenty of opportunity to ask questions and learn more.
memory chips, I/O modules and
other bits ’n’ bobs, and plug them
together to create system-on-chip       update on toolchain support for                                       hardware. Indeed, one attendee
designs. Like OpenRISC, OpTiMSoC        OpenRISC – that is, the current                                       grumbled that the breaks between
is primarily created in the Verilog     state of GCC, Binutils and LLVM/                                      presentations were too short,
hardware language, though it’s not      Clang. And Sebastian Macke                                            because everyone was enjoying
intended for production purposes.       demonstrated his fascinating                                          meeting other people and having
                                        JavaScript emulator for the chip,                                     one-on-one discussions! Of course,
Open hardware                           which lets you boot a fully working                                   the free beer during the day helped
Meanwhile, Olof Kindgren and            Linux-on-OpenRISC installation                                        in that respect too.
Stefan Kristiansson gave updates        inside your web browser.
on the status of the OpenRISC              Various other talks and
project, specifically the OR1K core;    presentations were given                                                TELL US ABOUT YOUR LUG!
they talked about plans for the         (see http://tum-lis.github.io/
future, such as a new execution         orconf2014 for the full list), and                                      We want to know more about your
pipeline and improved 64-bit chips.     although it was a fairly small event                                    LUG or hackspace, so please write
                                                                                                                to us at lugs@linuxvoice.com and
Simon Cook from Embecosm, an            with around 40 people turning up, it
                                                                                                                we might send one of our roving
embedded systems company that           was great to see so much passion                                        reporters to your next LUG meeting
sponsored the conference, gave an       and enthusiasm around open



16                                                           www.linuxvoice.com
                                                                                                                          LUGS NEWS



PyCon Ireland 2014
Josette Garcia is surprised not to see Google sponsoring its local Python event…


P
         yCon Ireland gathered 300       very happy to hire qualified
         of Ireland’s best and           foreigners.
         brightest Pythonistas             The first talk was “The Real
together to share knowledge,             Unsolved Problems in Data
develop their skills, discuss with       Science”, given by Ian Ozsvald.
peers and hopefully have some fun.       According to Ian, data science was
We should not forget the people          described as “the sexiest job of the
who came from further lands –            21st century” by the Harvard            PyCon Ireland started with a modest 70 delegates in 2010, but by
Belgium, Hungary, France,                Business Review. All that I heard       2014 has grown to over 350 atendees.
Germany, Poland and Turkey to            was, “Clean your data, clean your
name but a few.                          data” – nothing new or 21st century     hardware to people of all levels of
   For €70, you get two days of          here and definitely not sexy. What is   experience. With their education
talks, breakfast and lunch –             new, though, is how Ian highlights      team they are creating resources
corporate tickets are a little more      the gritty problems and proposes        and training teachers who in turn
expensive but students pay a lot         ways for Pythonistas to tackle and      will teach kids to start
less. As we all know, Ireland offers a   solve these issues to keep Python       programming at a tender age.
lot of opportunities to the big          as the go-to language for practical        With over 650 members, Python
high-tech companies such as              data science work. Ian wrote about      Ireland has had a really successful
Amazon, Apple, Cisco, Dropbox,           his talk on http://ianozsvald.com       year. The monthly meetups have
eBay, Facebook, PayPal, Twitter and      where you can also find his slides.     been very well attended with
many more who in turn offer lots of        One of my favourite talks was         generally no less than 50 attendees
jobs and helped the Irish economy        given by Ben Nuttall – “Pioneering      turning up on the night. Talks are
to grow by 3.5% this year. I had a       the Future of Computing                 given on a variety of topics from
long chat with the guys from             Education”. It is nice to see the       computer science, finance, big data
Brightwater Recruitment who said         involvement of the Raspberry Pi         and more, with a focus on Python-
that the demand for techies was          Foundation, which is leading the        related technologies. Preparations
very difficult to fulfil – too many      way in the computing in schools         for the 6th PyCon Ireland start next
posts, not enough people. They are       revolution by providing affordable      month. Hope I meet you there!




Open Rights Group hack day
James Baster reports from a group using data for the power of good.


O
          pen Rights Group (ORG) is      are erroneously blocked. There was
          a UK-based organisation        a nice moment at the start of the
          that campaigns on digital      hackathon where volunteers who
issues. Recently they held a             had been working virtually for
hackathon in London to work on           months finally got to meet in
technical projects, and a small but      person! This project is of course
keen crowd gathered in Mozilla’s         open source.
donated office (Thanks!).                   Other projects worked on
    Mobile phone operators and ISPs      included a “Kickstarter for
now offer filters, which block sites     elections”, templates to help people
that may be harmful to children.         make requests for their personal
                                                                                                                          The Open Rights Group
The problem is that no-one knows         data, and tools for making people       understand issues like tracking and      used the hack day to put
which sites are filtered and the         aware when they are in areas            encryption to get her back.              some of its ideas into
filters aren’t perfect and often block   covered by CCTV or other tracking.        Open Rights Group needs our            action.
perfectly harmless content. So ORG       A calendar of campaign events is        support to continue its work –           Photo credit: Jim Killock
recently launched www.blocked.           being tested, and a game specially      check out https://www.                   (CC BY-SA)
org.uk, which was created by             designed to teach players about         openrightsgroup.org, visit your
volunteers. This project places          digital issues was shown – your         local meetup or join the volunteers
machines on connections so it can        hacker daughter has been taken          email list and get involved before
test and publicise which websites        and your character has to               the next hack day!



                                                             www.linuxvoice.com                                                                17
     SHOW REPORT OGGCAMP
                                                                                        As well as spending time with some top-class geeks,
                                                                                        we managed to sell a few T-shirts and mugs – which
                                                                                        you can now buy at shop.linuxvoice.com.




                                   Probably the largest event of its kind in
                                      the whole entire United Kingdom.
                                                                                                           2014
         F
                  irst, a little disclosure; we, along with Canonical   evening events, venue and accommodation, and the
                  and the OggCamp community, were Gold                  countless other tasks and processes we don’t know
                  Sponsors at this year’s event – you may have          about. Without these incredibly dedicated people, the
         seen the adverts we ran on OggCamp’s behalf in                 event simply wouldn’t happen. So firstly, a huge thank
         earlier issues. We did our best to promote what was            you to them.
         happening and all of us here at Linux Voice attended,             OggCamp is an un-conference that’s free to attend,
         running a stall in the exhibitors’ area, meeting lots of       but contributions are gratefully received and genuinely
         incredible people and drinking slightly too much beer.         help make the event a success. This year it was held
         The sponsorship also gave us the chance to record a            at The Oxford Hotel, some distance from the famous
         live podcast on the Sunday afternoon (you can listen           city centre. The conference takes place over a
         on LinuxVoice.com).                                            Saturday and a Sunday, but a great number of people
            We love what the OggCamp team does and why                  arrived on the Friday evening and converged at the
         they do it. Everyone who helps is a volunteer and they         local public house, The Plough Inn. The landlords
         all work incredibly hard putting the event together;           looked terrified at the hordes of monochrome T-shirts
         from the original planning, the merchandise, dealing           but dealt patiently with the introverted beer orders. It
         with registration and payments, the room re-                   was a beautiful evening with lots of friendly faces that
         organising, staging, audio engineering, lighting,              could have lasted longer had we not drunk the pub dry




18                                                         www.linuxvoice.com
                                                                                                   OGGCAMP SHOW REPORT

and forced them to close early. Which was definitely a   Just some of the
good thing, as we all needed to get to the conference    blinkenlights brought by
early for a day of talks, and talking.                   Reading’s MakerSpace
                                                         (RLab).
Bring and buy
Our table in the exhibitors’ room was next to Mark and
Vince from Peppertop Designs (www.peppertop.
com), the immensely talented duo behind our own
Elvie comic strip. They create all their illustrations
using open source software, releasing all of their
assets under a Creative Commons licence, and this
was the first open source/un-conference they’d been                                                                   As OggCamp is an
to. We have them to thank for the pen and the paper                                                                   unconference, the sessions
                                                                                                                      themselves are both
we needed to write prices on our mugs and T-shirts,
                                                                                                                      proposed and voted on in
as well as the general advice we needed at an event                                                                   real time.
like this.
    On our left were the equally wonderful Steph and
Stacey from Ragworm (http://ragworm.eu), printing
up their own circuit boards and assorted electronics
paraphernalia. We also met with Swindon
Hackerspace. They’d brought a long an ingenious




                                                                                                                                             HUGE THANKS TO TONY HUGHES FOR THE PHOTOS CC BY 2.0
Twitter to Teletype machine, whose tappings sounded
exactly like the 1980s sports results teleprinter on
BBC’s Grandstand. This relic must have something to
do with Swindon Hackspace being located in               Do you have a PCB design
Swindon’s Museum of Computing, and we promised           you want made flesh? Give
to pay them a visit after the current deadline receded   Ragworm a bell. They also
and find out for sure.                                   do learner kits aimed at
    There were several other hacker spaces in            getting electronics
                                                         hardware teaching into
attendance, including Oxford Hackspace, the Surrey
                                                         schools.
and Hampshire hackspace and Reading’s
MakerSpace (RLab). There was also a fantastic
soldering workshop hosted by OpenTRV, whose
founder, Damon Hart-Davis, gave a talk at the event.
OpenTRV is an incredibly ambitious project that’s        theoretical run time of 1.5 hours, and spent a long
attempting to cut the UK’s entire carbon footprint by    while talking with the various volunteers representing
10% with a rather neat and geeky solution. In the UK,    Hacker Public Radio.
many of us have hot water radiators and yet they’re         The high-tech online system for determining talks
normally all controlled by a single thermostat           suffered a few hiccoughs, leaving attendees to the
positioned somewhere in the house. This governs          quaint but far more colourful method of “Post-It Notes
whether the whole system is on or off regardless of      on a Pull Down Metal Awning”. As you’d expect, there
whether you use a room or not, or whether the            were many great presentations over the two days;
temperature in other rooms is below the heating          Stuart Langridge talked about cross-platform app
threshold. OpenTRV is a project based on the             development, Alan Pope talked about the ‘Ubuntu
installation of thermostatic regulating valves on your   Phone: the story so far’, Andrew Katz about open
radiators. These talk to a server, which allows you to   hardware, and while it’s difficult to believe we missed
manage when, where                                                                       it, there was a reportedly
and how the heating is                                                                   fantastic talk on ‘Hop
applied to your house.    “OggCamp overwhelmingly                                        Hackers’ and open
    We also learnt about adelivered in positivity, hackery                               source beer. We also
                                                                                         have to give special
great idea called ‘Repair
Cafe Reading’. This is    and sheer attendee friendliness.”                              credit to Steve Engledow
where local experts help                                                                 who actually camped. At
you fix your own stuff, including bikes, tools,          OggCamp. There was also an excellent podcast panel
computers, electronics, clothes and mechanical           and a raffle to round the whole weekend out, leaving
things. We thought this sounded like a fantastic         us all happily exhausted. OggCamp overwhelmingly
project, not just because it gives equipment another     delivered in positivity, hackery and sheer attendee
life, but because it could teach a whole new set of      friendliness. We just hope that the awesome
skills. We saw the HyPi – a hydrogen powered             organisers have recovered enough from the weekend
Raspberry Pi – powering a HDMIPi display, with a         to do the same thing next year. See you then!



                                                           www.linuxvoice.com                                                                19
     FEATURE LINUX VS WINDOWS




                                       It’s not enough to just
                                      be better – you have to
                                      know why you’re better.

         I
               f you’re reading this, then the chances are that       The list looks very different today than it would have
               you’re already pretty fond of Linux. However, it’s   done a couple of years ago. Some things are just as
               always good to stop and look around every once       great as they’ve always been (like package
          in a while to take stock of the situation, and ask        management and the shell interface), but others have
          yourself: is Linux still                                                                      got a lot better recently.
          the best choice for
          me? We think that the   “The more we looked at it, the                                           Obviously, everyone
                                                                                                        will rate each area
          answer’s a resounding   more we realised that there wasn’t                                    differently. For some of
          yes, and this month
          we’re reminding         just one reason we use Linux.”                                        you, freedom will be the
                                                                                                        most important reason;
          ourselves just why we                                                                         for others, it’ll be
          use Linux.                                                security or flexibility. If you’re a gamer, programmer,
             The more we looked at it, the more we realised that    office worker or sysadmin, you’ll have different
          there wasn’t just one reason we use Linux. It’s better    priorities, but we’ve looked at areas that we think are
          in loads of different ways – too many to cover fully in   important to everyone. Read on and remember
          one article, but we’ve done our best.                     exactly why Linux is the best OS around.



20                                                      www.linuxvoice.com
                                                                                                                         LINUX VS WINDOWS FEATURE


Online
The internet is a scary place… unless you’re a Linux user.


L
         et’s be honest, the internet is built on
         Linux and open source. Even if you
         happen to be using Windows and
Internet Explorer, if you’re browsing the web,
then really, you’re using Linux. The majority
of the servers generating the content are
running Linux, and your Windows machine
is just an output device.
   It isn’t a coincidence that Linux runs the
back-end of most of the internet. The
modern web wasn’t created by big
companies, but by little companies that
dreamed big. At least two of the biggest
companies in the world today (Google and
Facebook) were started in college dorms
less than two decades ago. Small
companies like these need flexibility and
cost effectiveness, and that just doesn’t
come from large companies with complex
software licences.                                            Three shells running on three different computers spread out across the UK. Beat that, Windows.
   The bureaucracy of proprietary solutions
means that they just can’t keep up with the                   requiring Microsoft’s Silverlight. With the                  (Heartbleed and Shellshock spring to mind),
level of innovation in Linux. Whether it’s                    advent of HTML 5 though, more and more                       but these were patched quickly, and neither
featureful filesystems, advanced                              sites are pushing rich content through open                  one has had a significant effect on web
virtualisation or containers, open source                     standards rather than through proprietary                    users, since they primarily targeted servers.
OSes have led the way since the web                           add-ons.                                                     We shouldn’t worry too much.
became popular. This innovation has                              It’s not just about what you can access,
allowed companies building their servers on                   there’s also the issue of what can access                    More than the web
Linux far more flexibility in how they deploy,                you. The web is a dangerous place, or so                     The internet isn’t all about browsing the web
and in the internet age, flexibility in your IT is            some people tell say. The truth is that we’ve                though. There are myriad methods for two
a commercial advantage.                                       been using Linux for so long that we’ve                      computers to communicate, including FTP,
                                                              forgotten all about internet-based malware.                  SSH, SCP and RSync. Almost all of these
Client side                                                   Drive-by downloads, infected adverts and                     protocols interact seamlessly with Linux.
Now it’s true that there are a select few                     others attacks simply don’t bother us, not                      Of course, most of these protocols work
things that you can only do online if you                     because we use antivirus software, but                       with Windows too, but they’re often wrapped
happen to be using a closed source desktop                    because we use Linux. So far, at least this                  in ineffective GUIs, or you have to download
-- Adobe’s Air and Active X spring to mind                    operating system has proved to be far more                   them from a website without being able to
-- but these are getting fewer in number                      resilient against attacks than Windows.                      verify their origins (see next page). Only on
each year. Recently, the Pipelight plugin has                    There have been a few scares around                       Linux and other Unix systems do you have
enabled Linux users to interact with sites                    internet security on Linux recently                          full access to a wide range of power users
                                                                                                                           network tools out of the box.
                                                                                                                              There is no perfect OS for the internet.
  Tails
                                                                                                                           Linux is more powerful and more secure,
  Some of the biggest benefits of Linux come from             could be used to de-anonymise it. The zero-cost              while there are still a few sites that require
  its flexibility, and few things show this as well           access also means that it can be shared freely,              Windows or OS X to run. However, when
  as Tails, the live distro designed to help people           copied and handed out without any restrictions.              everything is balanced out, we’re far happier
  securely and anonymously access the internet.                   Of course, Tails isn’t only great because it’s free,     running on Linux.
      It’s free as in zero cost. While this is always nice,   it’s also great because it delivers what it promises
  it’s actually an important aspect here. If tails were       (a secure anonymous operating system). While it’s
  built on some commercial software (like Windows),           not impossible to do that with commercial OSes,               TOP 3 REASONS
  it’d be a security hole, as a payment almost always         it is quite hard to do. The internals are locked off          LINUX IS BETTER
  creates a record. Especially if it’s done over the          to the extent that even making a live bootable CD             FOR USE ONLINE
  internet using a credit card (Bitcoin could help            is difficult, let alone customising it so as to make
  alleviate this, but it’s still not widely used). This       it anonymous. Even if they were no backdoors or               1 Servers
  would enable credit card companies to track who             spyware compromising your system you could                    2 Security
  had access to the anonymising software, and this            never verify it – which is why free software wins.            3 Flexibility



                                                                             www.linuxvoice.com                                                                       21
     FEATURE LINUX VS WINDOWS


Desktop
You should feel comfortable in your computing environment.


W
              e’re sure that there’s someone
              who likes how Windows 8 looks,
              but we haven’t found them.
Ultimately, the problem with the Windows
desktop isn’t that you may like or dislike how
a particular version of Windows looks, but
that you’re stuck with the desktop
environment that Microsoft thinks you
should use. Some people like traditional
desktop environments with a taskbar along
the bottom and a menu in the lower-left
corner, while other people like tiled window
managers. Some people have embraced
Gnome Shell and Unity, while others think
they’re an aberration of all that is good in this
world. It doesn’t really matter what you like
– what matters is that it should be up to you
to decide what desktop environment you              Netflix now works natively on Linux using HTML 5 video. That’s one less reason to dual boot.
like, not some multinational corporation
that’s primarily interested in profit.              with the other updates on your system, so          can go to to download quality software
   It’s not just looks that makes the Linux         you (as the user) are being constantly asked       and be sure of its origin. Or, at least, that’s
desktop better than Windows though.                 to download yet more software. And this is         what it should be. In reality, Microsoft’s
There’s one thing that always shocks us             without mentioning all the intrusive browser       management of the store has meant that
about Redmond’s OS: the complete lack               toolbars and other ad- (and spy-) ware that        few software vendors have decided to use
of package management. If you want new              can come bundled in these updates.                 it. As a simple example, we searched for
software, you have to download it from a                                                               office software. There are many good pieces
website and install it by hand. Of course, this     Some progress                                      of office software available for Windows,
means there’s also no centralised update            It would be remiss of us not to mention that       from the open source suites (Libre and
system: the software you download may               the situation in Windows is improving. With        OpenOffice), to closed source suites (Kingsoft
or may not have a mechanism to stay up              Windows 8, Microsoft introduced an app             and Softmaker Office) to smaller products.
to date. Even if it does, it will be out of sync    store. This is a centralised place that users      The results of the search were (as ordered
                                                                                                       by the store)
                                                                                                           One Note (Microsoft’s note taking
                                                                                                           application).
                                                                                                           Office Depot (A map showing the location
                                                                                                           of Office Depot stores).
                                                                                                           Office Evolution (A table showing which
                                                                                                           applications have been in which version of
                                                                                                           MS Office).
                                                                                                           Office 365 Garage Series (A list of videos
                                                                                                           for Office 365).
                                                                                                           Office Academy (A tool to help you use
                                                                                                           MS Office).
                                                                                                           The list goes on in much the same
                                                                                                       fashion. There’s almost nothing useful,
                                                                                                       and almost everything is a simple wrapper
                                                                                                       around online content. None of the useful
                                                                                                       office software we mentioned before is
                                                                                                       available on this app store.
                                                                                                           Compare this to the list we got when we
                                                                                                       put the same search term into Ubutu 14.04:
                                                                                                           Zoho Webservices Presentation.
                                                                                                           Zoho Webservices Spreadsheet.
                                                                                                           Zoho Webservices Wordprocessor.
The Windows store does have some good games, but otherwise it seems woefully barren.                       Extra Office applications (a menu for



22                                                              www.linuxvoice.com
                                                                                                               LINUX VS WINDOWS FEATURE

   Ubuntu Studio).
   Office Worker (a game).
   LibreOffice Base.
   The list goes on to show the rest of the
LibreOffice suite and other useful software.
Admittedly, this list isn’t the order we’d ideally
put Linux office software in. What’s more,
the Ubuntu store is built on top of a package
manager. The two pieces of software are
often confused, but they ultimately server
different purposes. A software store (or
software centre) is a place a company can
publish software, usually accompanied by
details about the software, screenshots
and user reviews. A package manager, on
the other hand, is a system for installing
packages and keeping them up to date.
   Microsoft has promised a package
manager for Windows 10. However, it won’t
have the power of a Linux package manager.
In fact, it will be little more than a command
line wrapper around install files, and so
won’t really make the situation much better.             Windows 10 brings some sanity back to the Windows desktop after the clusterfail that was
                                                         Windows 8, but users still only have one desktop environment to choose from.
Gaming
Just a few years ago, if you’d dared to                  company that created the OS in direct                   using more and more advanced hardware.
suggest that Linux was a good gaming                     competition with many companies that                    Others built weird and wonderful machines
platform, you’d have been laughed at. Now,               created software for the OS. However,                   out of old PCs with just enough muscle to
industry leaders such as Gabe Newell are                 this wasn’t the only factor pushing games               run modern games. Even games started to
claiming this very thing. To understand why,             towards Linux.                                          become more customisable, with some
you have to look a little at the history.                   As games consoles were changing, so                  publishers actively encouraging players to
  Traditionally, gaming has been done on                 too were regular computers. PCs became                  create new levels and artwork. However, on
two distinct types of machines: consoles                 the dominant platform, and PCs are more                 top of this was always Windows, and this
and multi-purpose computers. Consoles are                hackable than the computer that came                    has become more and more locked down
stripped down computers with everything                  before them. You could replace the CPU,                 with each version. Ultimately, with a
not necessary for games removed. However                 motherboard, storage, or just about anything            community that was used to ever-increasing
over time, the hardware differences between              else in a PC with parts from a wide range of            hackability and an OS that was becoming
games consoles and general purpose                       manufacturers. You could even build your                ever more restrictive, something had to give.
computers got smaller.                                   own from parts.                                             The final tipping point came in 2012 when
  When Microsoft released the first Xbox                                                                         Valve released its Steam games distribution
console in 2001, it was really just a PC in              DIY ethos                                               platform for Linux. Since then, Valve has
a different box with a different interface.              This hackability was something that PC                  been encouraging games makers to release
By releasing a games console, Microsoft                  gamers took to heart. Some people                       their titles for Linux.
became a games publisher. This put the                   relentlessly pursued ever-higher frame rates                Linux is a natural choice for PC gaming.
                                                                                                                 It’s the only OS that fully supports the
                                                                                                                 hackable philosophy of PC gaming. The
  Hardware support
                                                                                                                 number of games available has exploded
  Unfortunately, there are some manufacturers that       by kernel developers when changes are needed to         in the last couple of years with three new
  only support Windows. There are even some that         ensure they work with the latest kernel.                major sources of games (Steam, GOG and
  actively hamper development of Linux drivers by           Hardware drivers on Windows, however, are            Humble Store), as well as the faithful stores
  people in the community who want to create open        developed entirely by the hardware manufacturer,        that have been selling Linux games for years
  source drivers. The situation is getting better, but   and usually included on a disk that comes with
  it’s far from perfect.                                 that hardware. On the one hand, this is convenient,
                                                                                                                 (such as Desura).
      However, this doesn’t mean that Windows            but on the other hand, it means that the hardware
  has better drivers than Linux. The situation is        manufacturer can force you to install all sorts          TOP 3 REASONS
  a little complex, and there are a few things you       of weird software just to use the hardware. The          LINUX IS BETTER
  need to consider. Most Linux drivers are part of       manufacturer may also not update drivers for older
                                                                                                                  ON THE DESKTOP
  the main kernel project. This means that they’re       hardware for newer versions of Windows, meaning
  automatically available without the user having to     that you can get stuck with either a computer you        1 Flexibility
  download anything additional. It also means that       can’t upgrade or hardware you can’t use – both           2 Games
  they’re subject to quality checks, and are updated     problems that just don’t arise with Linux.
                                                                                                                  3 Hardware



                                                                       www.linuxvoice.com                                                                  23
     FEATURE LINUX VS WINDOWS


Power users
There’s only one operating system for those who like a little power.


M
             icrosoft is as ubiquitous as x86
             processors. It could even be
             argued that it owes its success
and dominance to their existence, going all
the way back to 1981 when Microsoft’s
PC-DOS and MS-DOS were sold for use on
IBM PCs and non-IBM (yet still compatible)
PC clones. And while those very early
machines used Intel 8088 CPUs, they were
closely related and quickly supplanted by the
8086 as the market exploded, creating the
foundations for what is Microsoft and the
PC market today.
    When you look at it this way, it’s not
surprising that Microsoft hasn’t embraced
other architectures, and the much
anticipated ARM version of Windows 8 has
done little to change this. Windows RT, as
it is known, looks and feels like Windows        Linux works on all kinds of hardware, which means the skills you learn on the desktop are
8 but its transformation to ARM has more         incredibly transferrable – here’s Raspbian running on an ARM-based Raspberry Pi, for example.
to do with providing something for the
tablet market, rather than new territory         anyone will try and get it running on almost      substantial projects that have taken a piece
for Windows developers; Windows RT is            anything – from toasters to robots, games         of consumer hardware and subverted its
fundamentally the Windows 8 experience           consoles to weaponry, space stations to           Linux kernel into a much more open and
running on slower hardware, which misses         sous-vides, Linux is everywhere. Debian           ambitious project. If a piece of hardware is
the point behind Linux’s incredible success      has official ports for ARM, MIPS, PowerPC,        using Linux, you’ve got a far better chance
on other platforms.                              IBM’s S/390 servers and Sun SPARC, while          of being able to get access to its innards –
                                                                                                   whether that’s unlocking frequencies in a
                                                                                                   commercial oscilloscope (a Rigol DS1052E
“From toasters to robots, games consoles to                                                        hack), adding web access to a digital video

weaponry and space stations, Linux is everywhere.”                                                 recorder, or just putting XBMC on your
                                                                                                   favourite ARM-based mini-PC.

  Linux has never had any kind of problem        the unofficial ports still include code for       Development
running on non-x86 hardware, and we’re           processors such as the venerable Motorola         Writing code isn’t for everyone. But software
sure that’s because it’s open source. When       68000, for instance. But it’s the ARM ports       development is not only vital for native
anyone can use this source code, almost          that have perhaps had the biggest impact,         development, it’s also vital if a platform is to
                                                 because the ARM ‘System On A Chip’                succeed as a working environment for
                                                 packaging has transformed the embedded            cross-platform development. Visual Studio
                                                 market – a complete Linux PC that fits into       and Microsoft’s associated toolkits actually
                                                 a tiny low-powered space, whether that’s          provide a world-class development
                                                 Android on smartphones and tablets or             environment just as vital to many
                                                 Raspbian running on a Raspberry Pi.               businesses and corporations as Microsoft
                                                    Regardless of the architecture, if you’re      Word. The use of .Net and DirectX have
                                                 using GNU/Linux, you’re using the same            created industries in their own right.
                                                 underlying operating system. That means              But over the last decade, open source
                                                 you can use many of the same skills you           toolkits and development models have
                                                 learnt for playing media on your desktop          transformed the industry. It’s not just about
                                                 to create a media streaming device that           open source compilers, or the GNU toolkit,
                                                 attaches to your television. Or the same          or that you can even code on a Raspberry
                                                 skills you used to install OwnCloud on a          Pi. It’s about creating a shared resource –
If you think Gnome has shutdown problems,        virtual private server. This also expands to      something that you couldn’t have done with
look at Windows 8. Move the mouse                development and the ease with which you           Microsoft’s development environment 15
somewhere then click on ‘Settings’ – only then   can hack your own software and hardware.          years ago. Open APIs are the backbone of
will you find the fabled shutdown button.        Linux is unparalleled for this. There are many    the internet, whether that’s Google probing



24                                                           www.linuxvoice.com
                                                                                                           LINUX VS WINDOWS FEATURE


                                                       OpenWrt
                                                       OpenWrt is one of the best known custom
                                                       firmware replacements for commercial
                                                       hardware (and even the Raspberry Pi), as it
                                                       replaces the default operating systems for
                                                       many standard routers. This is a vital job, not
                                                       only because it adds a layer of trust that only
                                                       open source audited code can provide, it also
                                                       adds features often restricted to far more costly
                                                       devices. There’s an SSH server, for example,
                                                       which is very handy when it’s built into your
                                                       router, as it enables you to create simple VPN       OpenWrt started life on Linksys’ original
                                                       tunnels to your network, and there are many          WRT54G (the later WRT54GL show here), and
                                                       other packages that can be installed, much like      used the GPL code released by Linksys [image:
                                                       you can with a regular Linux distribution. But
                                                                                                            CC BY-SA Vidarlo ENWP]
                                                       even in a commercial setting, OpenWrt is used
                                                       to replace enterprise-grade hardware costing         This couldn’t have happened any other way, and it’s
The Windows Explorer file manager can also be
                                                       £1,000s, even if it’s just to use the traffic        not even the only time this happened with wireless
replaced, but because most users don’t bother,         shaping features of the new firmware. And all        routers. Another custom firmware, dd-wrt, is also
your options are limited.                              of this is thanks to Linux being open source and     available for certain Linksys models and offers a very
                                                       because Linksys had to release its own firmware      similar feature set, and there are even more choices
your emails for advertising potential, or for          when it was built upon the original GPL code.        for other hardware platforms/routers.
the latest responsive web frameworks.
    Linux is at the heart of this. It’s the native
environment for web site creation, and with          finally changed with Windows 7 when the                  context of the data you’re working with. It
IDEs like Eclipse, the native environment for        ‘Power Shell’ became an integrated part                  works brilliantly with Microsoft’s object
many kinds of cross-platform development             of the update. PowerShell is a much closer               models and is a highly useful extension to
too. And what’s more important is that with          approximation of the Linux command                       the latest version of Windows.
many computing curriculums changing to               line, and has succeeded in becoming an                      But it’s not a Unix shell. For example, tools
focus more on programming and hacking                essential too for Windows sysadmins.                     such as Emacs or Vim were designed to
your own hardware, the combination of                There’s even an update for Windows 10, in                maximise the Unix-alike environment they
Linux and something like the Raspberry Pi            the form of keyboard shortcuts. But it’s still a         were running in, and it’s the same for the
is unbeatable. It’s the best kind of lock-in,        vastly different beast to the Linux/Unix shell.          vast majority of tools you can run from any
because we’re getting the next generation of                                                                  command line. You can still perform any
coders exposed to open source and Linux,             It’s about choice…                                       task on your computer from the command
and once you’ve experienced that freedom,            Most importantly, with Linux you have a                  line, regardless of the GUI environment you
it’s very difficult to move to a development         choice. Bash is installed by the majority of             might have installed. PowerShell isn’t trying
environment that offers less.                        distributions, but every user is free to change          to compete with that functionality, which
    The command line is still simply the             their default command environment, or                    means Windows is still missing out.
easiest way to perform many kinds of tasks.          change whenever they want, as each shell                    Which brings us to another point. With
But in its attempt to distance itself from           does things differently. PowerShell could or             Linux, you’re never forced to upgrade, or
the old DOS days, and to emphasise the               should be another one of those options,                  have an application force an upgrade,
point-and-clickiness of Windows, the DOS             because it’s actually good at some very                  or be left with files that don’t load into
prompt became a 90s relic. After being               Windows/Microsoft specific tasks. It’s                   anything you can’t afford to buy. And
in development for a couple of years, this           excellent at piping output and keeping the               many proprietary formats change from
                                                                                                              one version of an application to another,
                                                                                                              meaning you’ll need the same version of
                                                                                                              Photoshop, or the same version of Word, to
                                                                                                              get the same data when you share a file.
                                                                                                              This just doesn’t happen with open source
                                                                                                              because the emphasis is always on open
                                                                                                              standards and interoperability – it’s why, for
                                                                                                              example, LibreOffice supports many more
                                                                                                              formats that Microsoft Office.


                                                                                                                TOP 3 REASONS
                                                                                                                FOR POWER
                                                                                                                USERS
                                                                                                                1 Hackability
                                                                                                                2 The degree of control
                                                                                                                3 Choice
PowerShell is a great addition to Windows. But it’s not a replacement for the Unix mentality of Bash.



                                                                  www.linuxvoice.com                                                                             25
     FEATURE LINUX VS WINDOWS


Interoperability
Can’t we all just get along…


M
            icrosoft Windows is and always
            has been widely used in business.
            And this isn’t likely to change.
Many companies, especially older ones,
have a long history with the software, its
capabilities and its licensing. And
companies don’t like change any more than
the users do, especially when Microsoft
does create rather good business software.
Ignoring the usability and graphical
overhauls, Windows is a perfectly good
operating system when you need to get
things done, and ignoring the cost, there’s a
good reason its business-focused
applications are the backbone of its
business. They’re industry standards
because they work well.
   But there is a change coming, and it’s
one we think Microsoft is going to find
increasingly difficult to attack. As the
desktop becomes less important, and users
now have more than one device, more
than one machine, and more of one way           The Free Software Foundation is running a campaign to highlight the free alternatives to Adobe’s
of working, issues besides functionality        default PDF reader and icons – that’s why we’re supporting their use on LinuxVoice.com.
and performance become more relevant.
In particular, open computing and data          and openness remains relevant. By getting           of an open source licence, and continuing to
standards are finally being recognised          other people to use Linux, you’re keeping           develop – usually with a different emphasis,
as being important, after decades where         this forward open momentum going. It’s              or maintainer, or community. The ability to
proprietary formats have ruled in local         the same reason Microsoft fought so hard,           do this is enshrined within open source, and
government, health and education.               and succeeded, to ratify its own Office Open        it’s completely different to the closed and
In the UK, for example, government              XML format, despite an open format (ODF)            proprietary development model of
documentation in its static form has to         already existing. It needed its own formats         companies like Microsoft and Apple. To the
be provided as PDF/A, which is an open          in place in order to control the way people         greatest extent, they view their code and
format that can be read by lots of different    shared documents created and edited with            their software as their intellectual properly,
                                                                                                    and increasingly, they’re not selling us an
                                                                                                    application, they’re selling us the licence to
“After decades, open computing and data standards                                                   use their property for a period of time.

are finally being recognised as important.”                                                             Forking has resulted in lots of duplicity
                                                                                                    and choice, which isn’t always a good thing.
                                                                                                    But it means that if users don’t like the way
kinds of software. In Switzerland, the open     its own software, regardless of whether             Ubuntu is going, they can create a fixed
source community has just crowdfunded           that meant the format was open or not.              version of Ubuntu. It will either thrive or fail
approximately €8,000 to pay for LibreOffice     And of course, it was always going to be in         depending on whether other users agree,
developers to add digital signatures to         Microsoft’s best interests to do so. There’s        and that’s why we have distributions like
PDF/A documents. This is a requirement          nothing wrong with that – it’s the best             Mint. It also safeguards the software –
for PDF documents to be legally binding,        possible way of safeguarding its business           LibreOffice is a fork of OpenOffice.org, created
and is another great step towards making        interests. But when open standards make             when the future of the original project was
digital documentation and facilities            all of our lives easier, Microsoft’s stance isn’t   unclear. X.org, the display system used by
available to as many people as possible         always going to be in our best interests.           most installations, is a fork of XFree86, from
(the campaign is still accepting money                                                              a time when development had stalled and
until the end of the year: http://wilhelmtux.   To fork or not to fork                              other operating systems were advancing
ch/?MID=11&PID=93).                             Another more tangible advantage that Linux          quicker than Linux.
   Of course, none of this has anything         has is the power to fork the operating                  It’s a completely different kind of
to do with Linux specifically, but by using     system. Forking refers to the act of taking         development, and one we think results in
Linux you are ensuring this interoperability    the source code, copying it under the terms         simply better software. It’s also an attitude



26                                                          www.linuxvoice.com
                                                                                                         LINUX VS WINDOWS FEATURE

that rails against the burgeoning patent war
of the big software creators, along with the         Convergence
constant battle to keep software patents out         Both Microsoft and Apple are trying hard
of Europe.                                           to make their users an integral part of
    Which neatly leads us on to education.           their services, and part of this strategy is
We’re going to argue that skills learnt on           convergence – multiple devices acting as one,
Linux are more transferable, and that’s why          like being able to use Word on both your tablet
                                                     and your desktop. Or your tablet becoming
it’s important that educators use Linux or           your desktop. There are Linux projects and
open source software. If you learn how to            distributions promising to do the same, with
create digitally signed PDFs with LibreOffice,       Ubuntu’s imminent phone being perhaps
for instance, you can now use LibreOffice on         the best example. But another aspect to
many different types of platform and from            convergence is the shared data services for          Ubuntu has re-used many of the same ideas in
                                                     your device, whether that’s for the documents        its desktop, netbook and smartphone versions.
many different types of computer.                    that you edit, the photos you take or the
                                                     applications you purchase.                           same services provided by Microsoft and Apple. The
Education, education, education.                        As with everything else, Linux differs because    great thing is that your operating system won’t be
But this also works at a lower level. Many           you have a choice. You may choose to run             held hostage to this choice, and neither should your
educational authorities are changing their           OwnCloud on a server somewhere and manage            data. And you also get to choose where and when
                                                     your own shared files and devices – there are        you use these services, whether that’s on your own
computing curriculums to reflect the way we          OwnCloud apps that run on both Android and           hacked tablet, or BusyBox running on a NAS device,
now use computing and to hopefully                   iOS devices, so this works even with mixed           or a router with a custom firmware. And we think
emphasise the need for computing science.            hardware. Or you can even choose to use the          that’s the best definition of convergence.
This September in the UK, for example,
marked the start of a new curriculum that
throws out much of the style curriculum. Or        them how to code,and how to create their                 likely to be why the Raspberry Pi has been
in the words of the UK’s Education Secretary       own programs; not just how to work a                     such a success, and why it uses Linux as
at the beginning of the year, “ICT used to         computer, but how a computer works and                   the default operating system. It doesn’t
focus purely on computer literacy –                how to make it work for you.”                            matter that it’s Linux, just that it enables you
teaching pupils, over and over again, how to                                                                to do whatever you need to achieve a
word-process, how to work a spreadsheet,           Tomorrow belongs to us                                   specific educational goal.
how to use programs already creaking into          There’s only one operating system we can
obsolescence; about as much use as                 think of that teaches “how a computer                      TOP 3 REASONS
teaching children to send a telex or travel in     works and how to make it work for you, ” and               LINUX WINS AT
a zeppelin.”                                       that’s Linux. Better though, is that these                 INTEROPERABILITY
   He then explained how he wanted it              skills won’t lock you into Linux. They’ll give             1 Standards compliance
to change, “Our new curriculum teaches             you a lifetime of perspective whenever you                 2 Education
children computer science, information             use technology, whether that’s a cash                      3 Convergence
technology and digital literacy: teaching          dispenser or the latest Macbook Pro. This is




          TWELVE REASONS WHY LINUX WINS                                                                       TOP 3 REASONS LINUX
                   You knew it was a forgone conclusion.                                                      IS BETTER FOR . . .


A
                                                                                                                                  USE ONLINE
         fter all that, it feels like we’ve only   our comparison has become                                                      1 Servers
         scratched the surface. What’s             more ‘heuristic’ for a good reason;                                            2 Security
         also interesting is how things have       technology is now shaping almost every                                         3 Flexibility
changed. Ten years ago we may have                 aspect of our lives and it’s no longer about
started a comparison like this as a feature-       one company or operating system. It’s about                                    USE WITH LINUX
by-feature comparison of the two operating         your data, control, freedom and choice, and                                    1 Flexibility
systems, as if the desktop was the only way        these are ideas that don’t align with our old                                  2 Games
                                                                                                                                  3 Hardware
one operating system could ever come to            way of thinking.
dominate over another – or win, as we’d               They’re also ideas that we feel strongly
have put it at the time. Many of us still use      about, which naturally leaves us with only                                     POWER USERS
                                                                                                                                  1 Hackability
Windows, and it still does a great job in the      one choice of operating system. We know
                                                                                                                                  2 The degree of control
millions upon millions of places it’s installed    we’re preaching to the choir when we say                                       3 Choice
and used. It’s a huge accomplishment and           Linux wins in so many different ways, but it’s
a testament to the skills of the corporation       important to remember why, and just why
                                                                                                                                  INTEROPERABILITY
behind it.                                         GNU, Linux and Free Software are getting                                       1 Standards compliance
   But side-by-side comparisons are no             stronger and more relevant with each                                           2 Education
longer relevant. We hate using the word, but       passing decade.                                                                3 Convergence



                                                                www.linuxvoice.com                                                                               27
     FEATURE RASPBERRY PI A+




                         TOP MARKS FOR
         RASPBERRY PI
                           Russell Barnes speaks to the founder of the
                        Raspberry Pi Foundation to find out why he thinks
                         the Model A+ is their most exciting release yet…
                                                                                                                     A+
          E
                   ben Upton came up with the idea of an            computers for kids and we started putting some
                   affordable credit card-sized Linux PC while      thought into what we could do about it.”
                   working as the Director of Studies in Computer     As he talks Eben brandishes the latest offering in
          Science at St John’s College, Cambridge. Part of his      the Raspberry Pi line-up, the Model A+. It looks rather
          role was to manage and                                                                     different to its
          monitor undergraduate                                                                      predecessors, almost as
          admissions, something      “The model A+ looks as if                                       if someone’s taken a
          Cambridge appeared to
          be fast running out of.
                                     someone’s taken a hacksaw                                       hacksaw to a Raspberry
                                                                                                     Pi and lopped an end
             “It wasn’t a case of me to a Pi and lopped an end off.”                                 clean off. As it turns out,
          waking up one day                                                                          that’s almost exactly
          wanting to make a credit card-sized computer, but         what happened, but there’s a bit more to the story
          waking up one day and realising we’ve got no              than that…
          computer science students and wondering why,”               For a start, this isn’t the first time the Raspberry Pi’s
          explains Upton. “Ultimately we came to the conclusion     winning formula has been tweaked. Earlier this year
          that there was a distinct lack of programmable            the Foundation launched the B+, an improved version



28                                                     www.linuxvoice.com
                                                                                                          RASPBERRY PI A+ FEATURE


  Eben Upton: Quickfire Q&A

          What’s your favourite thing about                 Does the $20 make the Pi more of               massive gulf between the two products.
          the model A+?                                     an Arduino competitor?
         It’s amazing what ergonomics can                   We’re just about in the range of                      Will the Raspberry Pi Compute
          do for the popularity of a product.               official Arduinos in terms of price. Of               Module ever take off with
  One of the things people love about the B+         course we’re not an Arduino competitor. I             industrial partners?
  is the fact it looks nice. It’s got the rounded    don’t think there’s a great deal of overlap                  We don’t want to push people to the
  corners, the mounting holes and the                between what the Raspberry Pi is the right                   Compute Module until they’re ready.
  connectors are all lined up with the edge of       product for and what the Arduino is the               I think the Compute Module is well suited
  the board – it’s just nicer.                       right product for. The Arduino still                  to industrial solutions, so if someone
     I’m really obsessed with the rounded            consumes less than power than an A+ and               needs 10k of something it’s definitely
  corners [laughs]. It’s a little thing and it’s     it has analog inputs. The Raspberry Pi on             worth doing a small amount of R&D so you
  really easy, but it makes such a difference        the other hand drives a display and has               can go for a Compute Module, but it takes
  on the A+.                                         more processing power. There’s still a                time to make that transition.



of its 3.5 million-selling Model B. It’s the board Upton      overnight. “Even though it was only a couple of weeks
refers to as the ‘deluxe model’, because while the            from when the B+ came out, we sold more Raspberry
Model A is the Foundation’s affordable flagship Pi            Pi’s in that half of July than we’ve ever sold in any
priced at $25, the B comes with the added                     single month before,” enthused Upton. Today the
convenience of extra USB ports and Ethernet                   Raspberry Pi is selling over 100 thousand per month
networking for an extra $10. The dream was to                 and the Foundation is on the brink of selling its four
produce a $25 computer powered by open source                 millionth Linux-powered PC.
software, but it seems the vast majority of geeks and
educators were more than happy to pay an extra ten            Do we need a Model A?
bucks for the privilege.                                      With the Model A selling less in its entire lifetime than
   Thanks to the massive success of the Model B, the          the Model B sells in a month, it wouldn’t be outside the
team employed by the charity has positively ballooned         realm of reason to wonder if the Model A line is worth
over the last 12 months (even so the entire workforce
can be counted on two hands and one foot). One of
those new employees was Director of Hardware,                   Original Model B goes back into production
James Adams, who was tasked to taking over from
                                                                The old Model B is once again rolling off the       “After putting the B+ out there what we
founding member Pete Lomas to create the                        production line at Sony’s facilities in Wales.   found was that a lot of people who were
Raspberry Pi Plus line.                                            “Obviously when we started the Model B+       putting the model B into their products were
   With a combination of user feedback and raw                  we wanted to make sure our channel               saying, ‘actually we’re pretty happy with the
common sense, Adams utilised the new economies                  partners weren’t stuck with lots of Model B,”    Model B, can we keep buying it?’. It’s great
                                                                says Upton. “We’ve got a lot of small            that we’ve got industrial customers that turn
of scale and reputation the Foundation had achieved
                                                                businesses that started around the Pi and if     around and ask for 10,000 more Model Bs.”
to really go to town with the Model B+ improving the            you leave them with lots of old inventory it        But what about the original Model As?
board layout, adding more General Purpose Inputs &              could cause them lots of problems. We told       “We’re definitely not going to make any more
Output (GPIO) pins, doubling the number of USB ports            them all about the B+ and made sure they         As. Industrial demand for As hasn’t been
and massively improving power consumption among                 could move their old stock before we put the     anywhere near as strong, so I really don’t
                                                                B+ on sale.                                      want to restart the A line.”
other things. And all this happened at the same retail
price as the original Model B.
   It was just the ticket too. The B+ became the fastest
selling credit card-sized PC in the world almost




The key benefit of the Model A+ isn’t just the low price –
it’s the low, low power consumption.



                                                                www.linuxvoice.com                                                                           29
     FEATURE RASPBERRY PI A+

                                                                                                    model since it’s only an extra $10,” explains Upton. “I
                                                                                                    feel like some people missed out on why the lower-
                                                                                                    power model like the Model A can make sense. If
                                                                                                    you’re building something with robotics, or essentially
                                                                                                    any project that doesn’t need Ethernet networking, it’s
                                                                                                    a great fit.”
                                                                                                      Eben also thinks it would make a mockery of the
                                                                                                    original $25 computer promise if they didn’t continue
                                                                                                    with the Model A: “It’s also really important to us
                                                                                                    because it’s our flagship product. It was our original
                                                                                                    stake in the ground and where it all started.”

                                                                                                    Chopping the end off the B+
                                                                                                    While some tech firms would be nervous to have
                                                                                                    another try at a less successful model, the Foundation
                                                                                                    is very excited about the release of the A+. A look over
                                                                                                    the specs shows it’s a big improvement over the
                                                                                                    flagship Raspberry Pi, but the groundwork for the A+
                                                                                                    started when the B+ was still the drawing board.
                                                                                                        Upton says: “James Adams came over to see me
                                                                                                    [with a Model B+] and said ‘you know we can chop the
                                                                                                    end of this board off, right?!’”
Check out those corners –
                                   continuing at all. Indeed, the $25 credit card-sized PC              It transpired that Adams actually designed the
see how round they are.
                                   for schools is barely in any schools, despite there              Model B+ with the Model A+ in mind, making it a trivial
                                   being a good number of more expensive Model Bs to                board design tweak to shave quite a large amount off
                                   be found in the education sector.                                one end of the board for the A+.
                                       As it turns out, it’s only really hardcore hackers that          “Where the original Pi had ad hoc mounting hole
                                   make any real use of the Model A. People like Dave               positions, the B+ has these nicely positioned square
                                   Akerman (www.daveakerman.com). Dave regularly                    mounting holes on the body of the board, then an
                                   attaches Model A Pis to weather balloons so he can               extension on the right that contains the Ethernet and
                                   take pictures with the Camera Board from an altitude             USB ports, which are ‘outboard’ of these mounting
                                   of around 35km – right on the edge of space. With                holes,” continues Upton. “James basically explained
                                   projects of this magnitude every milligram and                   that we can chop the board off at the mounting holes
                                   milliwatt really count and the Model A’s lighter load in         and find room on the board for a single USB
                                   terms of weight and power consumption makes it the               connector, meaning we could make an A+ board that
                                   ideal candidate.                                                 was markedly smaller than the B+.”
                                       Eben is the first to admit the Foundation failed to              It certainly feels impressive in your hands. The
                                   communicate the benefits of the Model A beyond its               mounting holes are in the same place as the B+, but
                                   cheaper price, and it’s something the team are                   with the shorter board they’re located in all four
                                   determined to rectify with the new Model A+.                     corners, making it a shade off being totally square.
                                       “It’s easy for people to look at the Model A and think           Since it has the same improved GPIO as the B+, it’s
                                   it’s just a cheaper variant of the B. When they look at it       also still compatible with the new Hardware Attached
                                   like that they might as well just go for the deluxe              on Top (HAT) standard for Raspberry Pi add-on
                                                                                                    boards. In fact, the outline of a Model A+ and a HAT
                                                                                                    board is identical, making an A+ with HAT a very
  Model A+ essentials
                                                                                                    compact and mobile combination.
  With only one USB port, getting by with a            Touchpad – £26 (www.thepihut.com)                “We set about making a mock-up of the design and
  Model A with anything more than an SSH               This tiny wireless keyboard with touchpad    we all agreed that it made a really quite attractive
  connection over Wi-Fi can be tricky. Here are     will give you decent control over your Model
  a few add-ons designed to help…                   A+ with a full qwerty keyboard, a built-in
                                                                                                    product,” continues Upton. “It really adds something to
     Broadcom WiFi adapter & 2 port USB hub         touchpad, backlit keys, multimedia controls     the mix and it adds something to its uniqueness too.
     – £9.99 (www.pi-supply.com)                    and even an integrated laser pointer.           It’s cheaper than the B+, it consumes less power, but
     The fact that the drivers for Broadcom’s          USB sound adaptor for Raspberry Pi           now it’s quite a bit smaller too.”
  range of Wi-Fi adapters have only just               – £3.99 (www.modmypi.com)                        Not jut smaller in the X dimension either – it’s
  appeared in the Raspberry Pi’s official distro,      Want to use your Model A+ as a decent
  Raspbian, is a minor embarrassment, but           audio player or a voice recorder? Although
                                                                                                    almost half the height too. Until it was replaced in the
  perhaps by way of making up for the               the A+ and B+ have improved audio support,      Model B+ by a dual-purpose 3.5mm audio and
  oversight you can now buy this two-port USB       there’s no microphone input and the audio it    composite jack, the Raspberry Pi’s board height was
  hub with built-in Wi-Fi. OK, it’s not going to    outputs is still low-definition. The only way   dictated by the massive (not to mention bright yellow)
  win any awards for design, but you can use it     around either of these problems is to use a     composite video port. Now the limiting factor on the
  turn your Model A+ into B+ at a whim.             USB audio card, like this affordable little
     Riii Miniature Wireless USB Keyboard with      fellow from ModMyPi.com.
                                                                                                    height of the board is the low-profile USB port, bringing
                                                                                                    the Z dimension down from 21mm to 12mm.



30                                                                      www.linuxvoice.com
                                                                                                         RASPBERRY PI A+ FEATURE


  Side by side How the Model A+ and B+ stack up




  Model A+ specs                          Expansion:                             Model B+ specs                        Expansion:
  Price: ~£15/$20                         1 x Micro SD card slot                 Price: ~£27/$35                       1 x Micro SD card slot
  Dimensions: 65 x 56 x 12mm              40 GPIO pins                           Dimensions: 85.6 x 56 x 21mm          40 GPIO Pins
  SOC: Broadcom BCM2835 (700MHz)          1 x USB port                           SOC: Broadcom BCM2835 (700MHz)        4 x USB ports
  Memory: 256MB RAM                       Power consumption:                     Memory: 512MB RAM                     Power consumption:
  Networking: None                        200mA under load                       Networking: Ethernet 10/100           370mA under load

  (left, Model A+; right: Model B+)


  Like the Model A, the A+ features just one USB port,             possible to make. That said, the Foundation hasn’t
256MB RAM and no Ethernet port. Besides this (and                  rested on its laurels with the A+. In fact, they ripped up
the size of the board) Eben says it’s ‘electrically                their own ‘$25 computer’ rule book.
identical’ to the Model B+. This means the A+ now                     “I had a great conversation with [Google boss] Eric
benefits from the B+’s improved power chain,                       Schmidt last year when Google gave us a large
meaning you don’t need the mother of all micro USB                 donation to help us distribute Raspberry Pis to school
power adaptors to keep your Pi running or a powered                children,” says Upton. “We had a really good
USB hub to enable the use of USB storage. On top of                conversation and we were talking about price and
that, if you’re looking to run a project from batteries            performance among other things and he said to me
you’re in for a massive boost in longevity.                        ‘try and be as cheap as possible… try and get as close
  We’ve yet to put the Model A+ through the wringer                to free as you can.’
on a benchmarking test bed, but we know it draws                      “I found it really inspirational to have someone like
about 200mA from the 5V power with a keyboard                      Eric not just say ‘well done; you’ve got a great product’,
plugged in, running ‘hello_teapot’ over a HDMI monitor.            but ‘why aren’t you asking yourself how to be
Compared to the already impressive 370mA from the                  cheaper?’”
Model B+ it’s head-turning stuff.                                     It wasn’t long until the Foundation ran off the
                                                                   prototypes of the board and he and the team really
The $20 credit card-sized PC                                       took to the new design. “It’s just a great product,”
The Raspberry Pi Foundation has always been                        exclaims Upton. “I almost don’t care how many of
ambitious when it comes to price, and the A+ already               these we sell. The A+ went from something we knew
just about the cheapest single-board computer it’s                 we had to do to something that we’re actually really
                                                                   enthusiastic about.
                                                                      “It gives people a really low-cost way to come and
                                                                   play with Linux and it gives people a low-cost way to
                                                                   get a Raspberry Pi. We still think most people are still
                                                                   going to buy B+s, but it gives people a way to come
                                                                   and join in for the cost of 4 Starbucks coffees.”
                                                                      According to Upton they’re really bumping up
                                                                   against the limits of how much you can build a
                                                                   significantly high-tech product for and not have
                                                                   people lose money in the process.
                                                                      “It’s already about the cheapest thing you can get
HDMI out, and the potential it brings for displaying video         that does this kind of thing by some margin, but we’ll
to your television, is a strong factor in favour of the Pi.        never be complacent about that,” he concludes.



                                                                     www.linuxvoice.com                                                         31
     SOFTWARE LITIGATION



                                                                    LITIGATION VS
                                                                    FREE SOFTWARE
                                                                        A flurry of patent lawsuits has affected
                                                                        the landscape for open source software
                                                                        developers and businesses operating in the
                                                                        United States. Adam Saunders examines
                                                                        the state of play.




          T
                    he United States is a popular region for patent       relating to Android. The patents covered a variety of
                    litigation for a few reasons. There are some          areas, including one that could read on natural
                    courts, such as the Eastern District of Texas,        address translation, one that could read on
          that have earned a reputation for being “plaintiff-             notification shades in mobile devices, and one for
          friendly” when it comes to patent cases. That is, if            GUIs to handle VPNs. For example, the drop-down
          someone brings a patent infringement lawsuit there,             shade that the user pulls down on Android phones
          they’re more likely than not to win it. The payouts are         and tablets to check your notifications implements
          also pretty high in the United States for a victorious          ideas that Rockstar claims to own.
          plaintiff; awards can be in the hundreds of millions of            Google fought back in December 2013 to try to get
          dollars, with the highest award given weighing in at            the case pulled out of the plaintiff-friendly Eastern
          over $1.6 billion (US).                                         District of Texas and switched to the Northern District
             As an individual admitted to practice law in my              of California, by requesting a declaratory judgment of
          jurisdiction (Ontario, Canada) and an open source               non-infringement. That is, asking the California court
          enthusiast, I have the background in the English                to declare that Google isn’t infringing. After almost a
          common law system (a basic foundation shared by                 year, and a formal request made to the US Court of
          most English-speaking countries) to analyse and                 Appeals for the Federal Circuit, Google did manage to
          understand these cases.                                         get the case switched to California from Texas; a
                                                                          major victory.
          Rockstar v Google et al                                            Huawei settled confidentially with Rockstar in
          A ruling in this case could chill commercial efforts            January 2014. Samsung, HTC, ASUS, LG, ZTE, and
          around the open source Android operating system.                Pantech would fight on; they moved to get the suit
              Rockstar                                                                                       dismissed on a
          Consortium Inc., a                                                                                 jurisdictional
          non-practising patent     “Rockstar’s business model is                                            technicality.
          holding company
          (sometimes known as
                                    based solely on extracting money                                            The Northern
                                                                                                             District court ruled in
          patent trolls) owns a     from patent licensing deals.”                                            April in favour of
          large number of                                                                                    Google’s motion to
          patents. Rockstar was                                                                              move the jurisdiction
          formed by a group of major IT corporations including            there. But the Eastern District of Texas court refused
          Apple, Blackberry, Sony, Microsoft, and Ericsson to             to accept this, so Google asked the Court of Appeals
          buy patents collectively as part of an auction of the           for the Federal Circuit to move the case to the
          Nortel Networks bankruptcy sale in 2011. Nortel                 Northern District.
          Networks was a Canadian telecommunications                         With Rockstar’s business model based solely on
          corporation with operations around the world, making            extracting money from patent licensing deals or
          routers, computer hardware, and software. Over its              lawsuits, this lawsuit may go on for years to come.
          lifespan, it filed for thousands of patents relating to its     We’re still waiting for the technical merits of the case
          work.                                                           to be assessed! Open source developers should follow
              In late 2013, Rockstar sued essentially all the major       this case, as the results may encourage or
          Android phone and tablet OEMs, including Samsung,               discourage commercial development of Android-
          Huawei, ASUS and Google for patent infringement                 based devices.



32                                                         www.linuxvoice.com
                                                                                                                   SOFTWARE LITIGATION

Octane v Icon and Highmark v Allcare
The rulings in these cases dealt significant damage to            Copyright litigation to watch:
patent trolling in the United States.
                                                                  As well as patent action, there’s been some      issue in this case. It wants the Supreme
    The issue in Octane – a battle between two fitness            recent copyright litigation affecting open       Court to answer this question: “Whether
equipment companies over patents on elliptical                    source, particularly Oracle v Google. Oracle     copyright protection extends to all elements
machines – was the standard by which a “court in                  sued Google for patent and copyright             of an original work of computer software,
exceptional cases may award reasonable attorney                   infringement relating to Google’s use            including a system or method of operation,
                                                                  of Java in Android (Oracle acquired the          that an author could have written in more
fees to the prevailing party.” The Supreme Court of the
                                                                  Java copyrights when it bought Sun               than one way.”
United States held unanimously in favour of the                   Microsystems, which created Java in 1995.             If the Supreme Court hears this case,
plaintiff, Octane, to the benefit of those fighting               This litigation has been going on for a couple   it’ll affect not only open source software,
against patent trolls.                                            years now, with an appeals court ruling that     but the freedom of all software developers
    Supreme Court Justice Sonia Sotomayor, who                    Application Programming Interfaces (APIs)        working in the United States or for the
                                                                  can be subject to copyright.                     American market. If the court says that such
wrote the decision for the court, began by tracing the
                                                                     In early October of this year, Google         protection does extend, then we could see
history of the rules for attorney’s fee awards in patent          formally applied to the Supreme Court to ask     sharp limits on third-party developers trying
litigation. The most recent change to the rules, Section          that they hear an appeal on the copyright        to reimplement APIs of all sorts.
285 of the Patent Act, essentially inserted two words
— “exceptional cases” — into those rules. Sotomayor
noted that the Supreme Court of the United States                  This ruling will weaken patent trolling, as it gives
had previously ruled that those two words merely                much more leeway to the lower courts to throw out a
clarify the rules:                                              patent case if they suspect a troll. By making appeals
    Following the addition of an appellate court for all        less attractive for trolls, it lowers the chances of them
patent matters in the US — the Court of Appeals for             dragging out litigation, making them much less
the Federal Circuit (CAFC) — in 1982, the status quo            threatening to potential victims.
was largely upheld for over 20 years; that is, “the                The Highmark case dealt with how much deference
Federal Circuit [...] instructed district courts to consider    appeals courts should give to district courts that
the totality of the circumstances when making fee               award attorney’s fees in patent infringement cases.
determinations under §285” (page 5). But when the               Speaking again for a unanimous SCOTUS, Sotomayor
CAFC came across a particular case nine years ago               ruled, in light of the Octane decision, that there should
— Brooks Furniture vs Dutailier — it decided on its own         be considerable deference given to the lower courts:
to implement a new standard: a defendant could only             “[Section]285 commits the determination whether a
get attorney’s fees if the lawsuit was done “in                 case is ‘exceptional’ to the discretion of the district
subjective bad faith and [...] [it was] objectively             court [...]” (page 4). This effectively means that a
baseless (page 8).                                              higher court reversing an award of attorney’s fees will
    The Supreme Court has now cast aside that                   become quite uncommon; a significant disincentive to
restrictive standard. After looking at dictionary               potential patent trolls.
definitions of “exceptional”, SCOTUS decided on this
standard:
        That an ‘exceptional’ case is simply one that stands
    out from others with respect to the substantive
    strength of a party’s litigating position (considering
    both the governing law and the facts of the case) or
    the unreasonable manner in which the case was
    litigated. District courts may determine whether a
    case is ‘exceptional’ in the case-by-case exercise of
    their discretion, considering the totality of the
    circumstances. (pages 7–8)


  What is the ITC?
  The International Trade Commission (ITC) is an American
  administrative body that handles complaints about unfair
  competition in international trade as defined by law. One
  type of unfair competition that it can issue administrative
  rulings against are products made from competitors,
  imported from abroad for sale in the USA, that infringe
                                                                                                                                    The US Supreme Court
  one or more patents. One remedy that the ITC can award
                                                                                                                                    may seem remote to non-
  to successful complainants is a ban on the importation
  of those infringing products. While it does not have the                                                                          Americans, but the US is
  authority to award damages (ie money), combining an ITC                                                                           such a huge market that
  action with a lawsuit seeking damages can be a powerful                                                                           its decisions affect us all.
  legal attack against a competitor.                                                                                                Photo by yeowatzup CC-A
                                                                                                                                    2.0 Generic.


                                                                  www.linuxvoice.com                                                                           33
     SOFTWARE LITIGATION

                                                                                                          of exchanging obligations (the media claims)” (page 3
                                                                                                          of the ruling).
                                                                                                             Thomas then goes on to cite the court’s recent
                                                                                                          ruling in Mayo vs Prometheus, which established a
                                                                                                          test to determine which inventions incorporating
                                                                                                          abstract ideas are patent-eligible: “First, we determine
                                                                                                          whether the claims at issue are directed to one of
                                                                                                          those patent-ineligible concepts” (page 7). If it is so
                                                                                                          directed, then the court looks at “the elements of each
                                                                                                          claim both individually and ‘as an ordered
                                                                                                          combination’ to determine whether the additional
                                                                                                          elements ‘transform the nature of the claim’ into a
                                                                                                          patent-eligible application” (page 7). This is what
                                                                                                          Thomas refers to as “a search for an ‘inventive
                                                                                                          concept’” (page 7).
                                                                                                             The court then applies this “Mayo test” to Alice’s
                                                                                                          patents. Beginning with the first step of the test,
                                                                                                          Thomas notes that these patents do incorporate an
Google also bid on the
Nortel Networks patents,
                                    Alice v CLS                                                           abstract concept, as “these claims are drawn to the
but lost out to Rockstar,           Alice Corporation, a non-practice patent-holding entity,              abstract idea of intermediated settlement” (page 7).
which bought them for               held patents on a method, system, and process for a                   Thomas cites previous Supreme Court case law,
$4.5 billion (US). Photo:           particular type of financial risk hedging: namely, that               emphasising its ruling in Bilski v Kappos (another
Kenneth Lu, CC-A 2.0                one party to a set of financial transactions won’t pay                case, which threw out a patent on financial risk
Generic.                            at one or more stages in the set. This risk is known as               hedging), as illustrating examples of other patent-
                                    “settlement risk”. Alice’s patents describe using a                   ineligible “inventions”. Intermediated settlement is an
                                    computer to keep track of the transactions between                    old, abstract financial idea: “Like the risk hedging in
                                    the parties. If the computer determines that a party                  Bilski, the concept of intermediated settlement is ‘a
                                    does not have sufficient funds to pay their obligations               fundamental economic practice long prevalent in our
                                    to the other side, then the transaction is blocked.                   system of commerce’” (page 9).
                                    Litigation against CLS Bank International for alleged                    Thomas then applies the second step: looking at
                                    infringement of these patented ideas started in 2007,                 what else is in the patent claims to see if there’s
                                    eventually winding its way up to the Supreme Court of                 anything more to Alice’s “invention” than this abstract
                                    the United States.                                                    idea. The method claims don’t pass the court’s test
                                       Writing for a unanimous court, Supreme Court                       because they “merely require generic computer
                                    Justice Clarence Thomas begins with a brief                           implementation” (page 10). In what might be the most
                                    description of what the patents claimed. There are                    important part of the ruling, Thomas emphasises that
                                    effectively three different types of claims made: “(1)                while some inventions involving computers may be
                                    the foregoing method for exchanging obligations (the                  patent-eligible, just because a computer is used as
                                    method claims), (2) a computer system configured to                   part of an “invention” is not, on its own, enough to get
                                    carry out the method for exchanging obligations (the                  a patent out of an abstract idea (pages 13–14):
                                    system claims), and (3) a computer-readable medium                       There is no dispute that a computer is a tangible
                                    containing program code for performing the method                     system [...] or that many computer-implemented
                                                                                                          claims are formally addressed to patent-eligible
                                                                                                          subject matter. But if that were the end of the
  Post-Alice software patent cases                                                                        [Section]101 inquiry, an applicant could claim any
                                                                                                          principle of the physical or social sciences by reciting
  There have been a number of software                    which described using computers to
                                                                                                          a computer system configured to implement the
  patents rejected by lower and appeals courts            communicate automatically with
  for invalidity in the wake of the Alice vs CLS          individuals to see if they are completing an    relevant concept. Such a result would make the
  judgement. Here’s a look at three of them:              assigned task. This was challenged in           determination of patent eligibility “depend simply on
   1 Comcast vs Sprint. (United States District           court by McKinley, a warehouse and              the draftsman’s art” [...]
     Court for the District of Delaware)                  loading company and a defendant they               The remainder of the patents, which are the system
     Comcast’s patent claim it launched                   sued. The patent was rejected as invalid
                                                                                                          and media claims, didn’t hold up either. Alice argued
     against Sprint Communications described              for being a mere abstract idea.
     asking a telephone caller if they’d like to      3   Dietgoal Innovations vs Bravo Media.            that the system claims depend on a particular
     make another connection. It was thrown               (United States District Court for the           computer hardware configuration. When the court
     out on the grounds that it is “drawn to the          Southern District of New York) Dietgoal’s       looked at that configuration, it found only a generic
     abstract, and fundamental, idea of a                 patent, which described meal planning as        general-purpose computer. Since Alice had stated in
     conditional decision.”                               implemented by a computer, was rejected
                                                                                                          an earlier brief that if its method claims fail, so do its
   2 Eclipse vs McKinley (United States District          as invalid for being an abstract “do-it-on-a-
                                                          computer” patent and thus “drawn to             media claims, the court threw out the media claims as
     Court for the Central District of California).
     Eclipse IP owned some patents, one of                patent-ineligible subject matter”.              well. Having demonstrated the court’s rationale for
                                                                                                          invalidating Alice’s patents, Thomas conclude the



34                                                                          www.linuxvoice.com
                                                                                                            SOFTWARE LITIGATION

ruling by upholding the Court of Appeals for the
Federal Circuit’s decision to throw out the patents.       What’s the difference between patents and copyright?
  Justice Sotomayor also gave a one-paragraph
                                                           A patent is a legally granted, time-limited      patentee gets a commercial monopoly. Some
opinion concurring with the court, which was joined        monopoly over the use, manufacture, and          particular ideas can’t be patented; in general,
by Justice Ruth Ginsburg and Justice Stephen Breyer.       distribution of an invention. It’s not a right   things like mathematical formulas or mere
A concurring opinion means that some judges agreed         to practice the patented idea, it’s a right to   abstract concepts on their own.
with another opinion (in this case, the unanimous          exclude others from practicing the invention.       A copyright is a legally-granted, time-
                                                           While patent laws differ across the world,       limited near-monopoly over a creative
opinion of the court), but that they wanted to note
                                                           there are some generalities that we can          expression. This includes software (in both
another view that they had. In that opinion, Sotomayor     speak of.                                        binary and source code forms), paintings,
notes that the three of them would completely throw           A patent has to be on a new, useful,          music, sculptures, and novels. It’s a near-
out business methods as unpatentable.                      and non-obvious invention. The idea is           monopoly because most jurisdictions offer
  This ruling has already had an impact, leading           that patents are supposed to encourage           some form of “fair use” or “fair dealing”
                                                           innovation and reduce reliance on secrecy to     exceptions, which let the public use these
judges to throw out several cases.
                                                           the overall benefit of the public. In exchange   expressions without having to get a licence.
                                                           for a thorough description of the invention      These vary by jurisdiction, but often include
NVIDIA vs Samsung et al                                    to the public (through a patent office), the     uses like parody, news reporting, or satire.
In September 2014, Nvidia launched two patent
infringement actions against Samsung and
Qualcomm. Claiming infringements of seven patents,       devices, are infringing (page 3). The company also
which read on basic GPU functionality, this litigation   lists Samsung products, which “include, but are not
can’t make comfortable reading for those considering     limited to, mobile products such as mobile phones
opening up their graphics device drivers.                (including the Galaxy Note 4, Galaxy Note Edge,
   According to Nvidia, it was negotiating with          Galaxy S5, Galaxy Note 3, and Galaxy S4) and tablet
Samsung for a patent licensing agreement. These          computers (including the Galaxy Tab S, Galaxy Note
talks failed after Samsung blamed its hardware           Pro, and Galaxy Tab 2)”.
suppliers (eg Qualcomm) for infringing, claiming no         There are two separate actions here: a complaint at
responsibility themselves. Nvidia then decided to take   the International Trade Commission (ITC) and a
legal action against both Samsung and Qualcomm.          lawsuit in the US District Court for the District of
   Nvidia wants money, but it also wants to ban the      Delaware. While the ITC can’t award damages (ie
importation and sale of particular processors and        money), it can stop importation of patent-infringing
devices. In its complaint to the International Trade     devices and components. The lawsuit in Delaware
Commission (ITC), Nvidia has a non-exhaustive list of    also seeks a ban on the allegedly infringing products,
Qualcomm products: “These processors include             but seeks damages too. This double whammy is an
Qualcomm’s Snapdragon processors using Adreno            increasingly common tactic in the mobile device
GPUs” (page 12). Nvidia also alleges that “Samsung’s     patent wars.
Exynos processors,” which “use Mali GPUs or                 Those interested in timelines for these processes
PowerVR GPUs”, found in several of its mobile            may not be surprised to hear that they are often
                                                         drawn-out actions. The ITC decided on 6 October
                                                         2014 that it will investigate Nvidia’s complaints. This
                                                         type of investigation could take months or years; we
                                                         will find out by the end of November when the ITC
                                                         estimates its investigation will finish. The worst
                                                         outcome for Qualcomm and Samsung here would be
                                                         a ban on importing and selling the devices that Nvidia
                                                         complained about in the United States, which is
                                                         clearly a lucrative market.
                                                            The Delaware action may also be lengthy. We can
                                                         expect time-consuming motions back and forth from
                                                         both sides. When you add on to that briefs and
                                                         memoranda, a pretrial conference, discovery,
                                                         depositions and oral arguments (not to mention any
                                                         requests for deadline extensions), a trial could easily
                                                         be a year away (if it comes to that). The worst
                                                         outcome for Qualcomm and Samsung here is a US
                                                         ban on selling the devices Nvidia complained about
                                                         along with a hefty damages payment to Nvidia.
                                                            The impact these proceedings could have might be
                                                         a further chill on graphics hardware innovation. It may
US Supreme Court Justice Sonia Sotomayor is one of a     also prove to discourage companies from opening up
number of SCOTUS judges fighting back against patent     their graphics device drivers, as they may fear that
trolls. Photo by Cknight70 CC-A 2.0 Generic.             that would open them up to litigation.



                                                           www.linuxvoice.com                                                                             35
     FEATURE LINUX VOICE AWARDS




                                                             THE



                                   AWARDS
                                     2015


                                   Get involved in choosing who benefits
                                     from our profits sharing scheme.



          I
              t’s been 10 months since the first issue of Linux      with issue 1. Head over to LinuxVoice.com and grab a
              Voice went on sale. So much has happened and it        copy, if you haven’t already.
              feels like we’ve barely started. But it’s not long       Our third promise was to give 50% of our profits
          before we reach our first major milestone (after hitting   back to Free Software and Linux communities. And
          our crowdfunding target) – the end of our first year.      the best thing about this was that you – our readers
             We made three promises during our campaign. One         – get to choose who gets to benefits. And with only a
          was to create the best                                                                    couple of months to go
          Linux and Free Software                                                                   before our first year’s
          magazine available, and    “We promised to give 50% of                                    accounts, now is the time
          while there’s always
          going to be room for
                                     our profits back to Linux and                                  to get started on the
                                                                                                    process. However, we
          improvement we think       Free Software communities.”                                    want the process to be
          we’ve hit this target. Our                                                                as open and as adaptable
          second promise was to release the entire contents of       as possible. Like the magazine, we want to get as
          each issue under the terms of the Creative Commons         close as possible to the ideal solution, but we also
          Share-Alike licence and release each issue within nine     want to be open and transparent enough that we can
          months of them going on sale. As this very issue           improve the process with your help. Which is why
          circulates the globe, that’s exactly what we’ll be doing   we’re starting a little early.



36                                                      www.linuxvoice.com
                                                                                                        LINUX VOICE AWARDS FEATURE


  Issue 1 is now yours All of our work for the first issue has been relicensed under the terms of Creative Commons
  As per our promise during the Indiegogo              One example of what can be done with
  campaign that launched this magazine,            the content is that a few of us here on the
  our first issue, from February 2014, is now      magazine and many from the Linux Voice
  available completely free. But just like         community have taken those words and
  open source, we don’t mean just in the ‘free     turned them into a freely distributable audio
  beer’ cost sense, but also in the freedom        recording. We’ve split the recordings by
  sense. We always felt this was incredibly        article and also made a complete RSS file
  important for a magazine about free and          if you wanted to grab the long play version.
  open source software, and we always wanted       It’s not bad for a first effort and it’s brilliant
  to be a magazine that gave back in the           hearing everyone’s contribution. We’re all
  same way, with a similar commitment to           extremely grateful for the support from the
  the same principles that drive open source       various people who have made their own
  development.                                     recordings (you only need a microphone and
     This is also the reason why we chose the      a copy of Audacity if you want to help with
  Attribution-ShareAlike variant of the Creative   our next issue). Not only does the audio
  Commons licences. This allows you to take        version make our content more accessible,
  our content and copy and redistribute on         we also think that the spoken version makes
  any medium or in any format. Just like open      an excellent time killer for long journeys and
  source, you can also edit, transform and         train delays. Take a look at LinuxVoice.com
  build on any of our work for any purpose –       for more information.
  even commercially! The only conditions are
  that you need to give us credit (attribution)
  and document any changes that you’ve
  made. And also like open source, you need        Download, modify, share and
  to make those changes available under the        upload our very first issue, thanks
  same terms.                                      to the Creative Commons.


   Central to our strategy are the 114 comments we                    into the selection pool. For that reason, we want to
received from our blog post “Giving Profits Back:                     split the process into three stages. The first stage is
Where and How”, which we put online in November                       going to be open to everyone who may want to
2013. As you might expect when you ask a question                     participate, and we’ll use this stage to formulate a
like this, there are many different points of view, many              shortlist of projects that go into the second stage. The
of which may be incompatible with one another, or                     second stage will be the voting process where our
even have the potential to cause conflict. This is the                readers will decide on which projects they’d like to see
absolute last thing we want to happen from doing                      succeed, and the final stage will be the awards
this, so we want to tread carefully. At least for our first           themselves.
year, as we expect profits to be modest, and we can                      The list of potential projects out of those mentioned
fine-tune the process and set a firm foundation for                   in the “Giving Profits Back” story comments is huge,
future Linux Voice awards.                                            mostly split between what we’d call organisations (24
   Apart from the many specific projects, communities                 from the original post, including FSF, EFF, Mozilla, etc.),
and foundations that were mentioned in that original                  distributions (nine in the post, including Debian,
post, there was a central point that was repeated by                  Slackware, Crunchbang) and an enormous variety of
many: both large and small projects should benefit.                   individual software projects. We thought about
This was primarily because most of us agree that                      splitting this huge category into sub-categories –
large projects, such as the Free Software Foundation                  maybe one for graphical applications, another for APIs
or the Electronic Freedom Foundation, should still be                 or frameworks and another for desktop environments,
supported, but so too should the smaller projects,                    for example, but we’re guessing this would get
perhaps to help with web hosting, or to help a                        complicated quickly and maybe add a little
developer attend a conference. That means we’ve got                   unnecessary conflict when people argue over our
to split the overall contributions into different
categories, and for that, we’re going to need a shortlist
of both categories and the projects within them.

Voting process                                                                                                                      The Open Rights Group
We’ve got our own strong ideas about the kinds of                                                                                   has similar aims to the
projects and communities we’d like to support. We’ve                                                                                EFF but UK-based and
                                                                                                                                    focused on UK activism,
spoken about and spoken to many of the people and
                                                                                                                                    including fighting the
communities we’d like to see, and we’ve covered a                                                                                   Digital Economy Act
handful of our favourites over the last 10 months. But                                                                              and the default use of
it’s vitally important that our readers get to choose not                                                                           content filters. www.
only who wins any awards, but also what projects go                                                                                 openrightsgroup.org


                                                                         www.linuxvoice.com                                                                   37
     FEATURE LINUX VOICE AWARDS

                             arbitrary categorisations. But it does seem like we       balance of proposals, we’ll put the most popular 10
                             could make a sensible split by putting the                proposals for each into the two categories, creating
                             organisations and the distros into one pool, and the      those two shortlists. We’ll do this publicly so that
                             huge variety of software projects into another. This      everyone can see the progress of their favourite
                             would allow us to reward more projects, and reward        projects until we have a final list at some pre-
                             both big and small at the same time – depending on        determined cut-off point.
                             the final vote of course.                                   We’re going to restrict voting to just our subscribers.
                                With two categories – one for organisations (where     This is because it will be a lot easier for us to manage
                             we include distros), and another for software projects,   – we’ll be able to easily add the voting interface to the
                             we now want to create two smaller shortlists that can     online subscriptions page for each subscriber, for
                             be put to a final vote. The reduction to a smaller        example, and this limitation also recognises our
                             number is because we don’t want an unmanageable           subscribers for the contributions they’re making. Our
                             pool of proposals, and to give everyone a better focus    plan is to then have three different awards for each
                             on the final projects that have contention. As this       category – one main ‘winner’ and two ‘runners up’
                             issue goes out, we’ll ask again what organisations,       – making six awards in total, which we’ll announce
                             distros, software, projects and developers people         after we’ve hired an accountant and we know how
                             would like to see supported, and depending on the         much we have to give away.



Suggested projects
A quick overview of many of the projects, distros and software proposed
online when we asked which our readers would like to support.
                               Accessible Computing Foundation Making                    Gnome Foundation Furthers the goals of the
                               technology accessible to people suffering from            Gnome project by coordinating releases,
                               various disabilities that normally make conventional      sponsoring GUADEC and liaising with both
                               computing extremely difficult, if not impossible.         commercial and non commercial organisations
                               http://accessiblecomputingfoundation.org                  interested in Gnome. www.gnome.org
                               Document Foundation Primarily supports                    Hacker Public Radio Releases a new community
                               LibreOffice.org in attempting to give everyone            produced podcast Monday – Friday with no
                               access to office productivity tools free of charge.       restrictions on length or content as long as the
                               www.documentfoundation.org                                subject is likely to be of interest to “hackers.”
                               EFF Defending our civil liberties in the digital age,     http://hackerpublicradio.org
                               the Electronic Frontier Foundation champions              KDE eV This is the non-profit that represents the
                               privacy, free expression and innovation.                  KDE desktop and the KDE community securing
                               www.eff.org                                               cash, hardware, and other donations to aid
                               FSF Promoting computer user freedom and the               development and promotion. https://ev.kde.org
                               rights of free software users, the FSF is also the        OSI The Open Source Initiative is a global non-profit
                               custodian of the GNU project and licences.                curating and promoting the definition of open
The Free Software
Foundation Europe is a         www.fsf.org                                               source and the licences that fit its description.
separate organisation from     FSFE Sharing all the same principles as the FSF, the      http://opensource.org
the FSF, and doesn’t get       FSFE works with the European Commission and               Outreach Programme for Women Annual
the credit it deserves.        Parliament to create a positive environment for Free      internships to help women get involved in Free and
                               Software and Open Standards. http://fsfe.org              Open Source software. http://gnome.org/opw
                                                                                         Practical Action Using technology to challenge
                                                                                         poverty in developing countries by building skills
                                                                                         and knowledge. http://practicalaction.org
                                                                                         Software Freedom Conservancy Promotes,
                                                                                         improves and frequently defends Free and Open
                                                                                         Source software. Projects under its wing include Git,
                                                                                         Inkscape, phpMyAdmin, Samba, SugarLabs, Wine and
                                                                                         many more. https://sfconservancy.org
                                                                                         Young Rewired State An independent global
                                                                                         network, based in the UK, that helps kids ages 18
                                                                                         and under to use open data to make websites, apps
                                                                                         and algorithms for solving real-world challenges.
                                                                                         https://youngrewiredstate.org



38                                                          www.linuxvoice.com
                                                                                        LINUX VOICE AWARDS FEATURE

Distributions
  Crunchbang A Debian-based distribution with a
  great blend of “speed, style and substance” thanks
  to its use of the Openbox window manager
  http://crunchbang.org
  Debian Announced in 1993 with a first release in
  1996, Debian is one of the pillars of the GNU/Linux
  distro community thanks to its emphasis on
  community and stability http://debian.org
  FreedomBox A private server that integrates strong
  privacy and encryption to deliver many of the same
  features you find from online cloud servers and
  services http://freedomboxfoundation.org
  Linux Mint One of the most popular distributions
  using either Ubuntu or Debian as a back-end and
  responsible for the development of the Cinnamon
  desktop and the Gnome 2.x fork, Mate.
  www.linuxmint.com
  Manjaro Based on the newbie-impenetrable Arch
                                                                                                                   Organisations such as
  and using the Xfce desktop, this is a rolling release     Blender A 3D sculpting, animation, rendering and
                                                                                                                   Young Rewired State are
  distro with an emphasis on ease of use and                games engine that rivals software costing              doing a fine job of plugging
  installation http://manjaro.org                           thousands and is quickly becoming an industry          the gap in the UK’s IT
  Replicant A fully open source version of Google’s         standard. www.blender.org                              curriculum.
  Android operating for certain specific mobile             Gpodder A popular choice for listeners to our own
  devices system that promoted freedom, privacy             podcast. It downloads and plays new episodes
  and security issues www.replicant.us                      automatically. http://gpodder.org
  Slackware The oldest currently maintained Linux           Inkscape A wonderful vector drawing application
  distribution, Slackware is still a benchmark for          that’s capable of brilliant professional results and
  simplicity, security and stability                        even better output. https://inkscape.org
  www.slackware.com                                         MediaGoblin: A decentralised media publishing
  Sonar GNU/Linux An accessible distribution that           platform trying to compete with YouTube,
  bundles assistive technology like a screen reader,        SoundCloud and Flickr. http://mediagoblin.org
  magnification, on-screen keyboard and a dyslexic-         Meld Compare text/code files and visually spot the
  friendly font http://sonargnulinux.com                    differences between them. Great for deciphering
  Trisquel GNU/Linux Based on Ubuntu but with a             drunken coding sessions. http://meldmerge.org
  commitment to remove all proprietary and non-free         Nouveau These drivers give Nvidia owners graphics
  elements, it’s one of the few distros recognised by       acceleration without resorting to closed proprietary
  the FSF as containing only free software.                 drivers. http://nouveau.freedesktop.org/wiki
                                                            OpenSSH This secure remote shell is as essential
Software                                                    as oxygen to anyone using Linux on a remote
  Audacity As used by podcasters the world over.            device. www.openssh.com
  cross-platform audio waveform editing unrivalled          Scribus Desktop publishing that can take your
  by functionality or price.                                words and images and turn them into something as
  http://audacity.sourceforge.net                           magical as a printed publication.
                                                            www.scribus.net
                                                            VLC Media Player: It plays everything, streams
                                                            everything and runs on almost everything. It’s the
                                                            media player most of us rely on the most.
                                                            www.videolan.org
                                                            Xmonad: Tiling window managers make you look
                                                            cool. Yes. But they also make you incredibly
                                                            productive by keeping distractions and mouse
                                                            clicks at bay. http://xmonad.org
                                                            ZoneMinder: Home security is normally expensive,
                                                            which is why this fantastic open source solution
                                                            starting with just a webcam is such a great project.
                                                            http://www.zoneminder.com
                                                          Now it’s up to you – have a think about which projects
                                                          you’d like us to support, and keep an eye on
A few readers reckon Gimp could do with a bit of cash.    LinuxVoice.com for he revised shortlist.



                                                            www.linuxvoice.com                                                             39
     FAQ OPENRISC




         OPENRISC
Open source software is all good and well – but how about open source CPUs?

                                              with each generation adding more and        you’re willing to pay giant licensing fees
MIKE SAUNDERS                                 more layers of cruft onto the original      to Intel or AMD, this probably isn’t an
                                              design. You end up with some CPU            option. And even then, you wouldn’t
        So, this is free software clone       instructions taking just a few clock        necessarily get to share your changes
        of a certain famous board             cycles to execute, whereas others take      with the rest of the world.
game, with some kind of pun in the            far longer.                                    Now, imagine if the entire design of
title, right?                                   RISC, however, opts for a much            your CPU were open. Imagine if the
        No, this has nothing to do with       smaller range of instructions (and          community could work together on
        Risk. It’s all about CPU cores here   therefore fewer transistors on the          improving its performance, features and
– and specifically, RISC (reduced             chips), and these instructions are highly   power management. Imagine if this
instruction set computing) ones.              optimised. Fewer instructions doesn’t       could work in tandem with an entirely
OpenRISC is a project that designs            mean less capability though; after all,     free software stack, so that every byte
completely open processors, which you         CPUs just move numbers around in            and electron of your computer was free
can study, modify, and have produced in       memory and perform calculations on          as in speech.
factories. Well, providing you have           them. And today, RISC has won: ARM
enough money to do that, of course…           chips are built with RISC architecture              That sounds like heaven for
                                              and are absolutely everywhere, and                  Richard Stallman, but how
        Hang on a minute! Reduced             even though x86 CPUs are still regarded     many geeks really want to fiddle
        instruction set? Why would I          as complex (Complex, rather than            with CPU designs?
want that? Give me more, more,                Reduced Instruction Set Computing) in               Just because it seems like a
more instructions!                            their architectures, modern ones break              black art, or an obscure subject, it
        Actually, RISC designs go back a      instructions down into smaller              doesn’t mean that nobody is interested
        long way, and have nothing to do      components, in a RISC-like fashion.         in it. On the contrary – at the time of
with the overall power of a CPU. They’re                                                  writing, the third annual OpenRISC
all about designing the processor so                  OK, but CPUs are hardware –         Conference (ORCONF 2014) was taking
that it has fewer jobs to do – but it can             how do you make them open           place in Munich, Germany. Forty
do them more quickly and efficiently          source? And why would you want to?          developers from around the globe
than in other designs. Historically, x86             Yes, hardware doesn’t grow on        gathered together to discuss the
CPUs have been complicated beasts,                    trees (unless you have some         current state of OpenRISC, share
                                              fancy wood panelling for your PC case),     projects that they’re working on, and
                                              so initially it might seem odd to apply     contemplate ideas for the future – see
“RISC designs go back a long                  FOSS principles to it. But consider
                                              designs: can you take your current PC
                                                                                          page 16 for a full report.

way, and have nothing to do                   or laptop processor, get a complete              So, how are OpenRISC chips
with a CPU’s overall power.”                  specification for it, change a few parts
                                              and make your own version? Unless
                                                                                               made? How is development
                                                                                          done, and who produces them?



40                                              www.linuxvoice.com
                                                                                                       OPENRISC FAQ

        OpenRISC came to life in 1999,
         the work of a few computer
science students in Slovenia, and
received a small amount of financial
backing in the early 2000s. Today, the
OpenRISC project is much bigger and
has a few chip designs (known as
“cores”), but currently the focus is on the
OpenRISC 1000, also known as OR1K:
http://opencores.org/or1k. This CPU is
focused on networking and embedded
tasks, with special emphasis placed on
simplicity and low power consumption.
Its design is constructed using the
Verilog hardware description language
– and indeed, you can see the source
code for yourself at https://github.
com/openrisc/mor1kx/tree/master/
rtl/verilog. This code is released under
the GNU Lesser General Public Licence,
so you’re free to base your own chip on
it, as long as you make your designs          Experiment with OpenRISC in your browser: try the JavaScript-based emulator (running a
available for everyone else.                  Linux kernel) at http://s-macke.github.io/jor1k.
    For development purposes, the OR1K
design can be implemented in FPGA             OpenRISC has been implemented in            chip. There’s even some interest in
(field-programmable gate array)               many SoC (system on a chip) designs         porting FreeBSD to OpenRISC, although
development boards, which means you           – that is, chips that include all the       we’d wager that NetBSD will get there
can hook up an OpenRISC processor to          components needed for a standalone          first, given that it already runs on a
various peripherals and create a fully        computer. Most notably, Samsung has         staggering number of platforms…
working computer. The GNU toolchain           used it in various digital TV models,
has been ported so that it can produce        while the Allwinner A31, a SoC used in a           OK, you’ve sufficiently whetted
OpenRISC binaries, and work is                large range of mobile phones, tablets              my appetite, and now I want to
underway to get LLVM/Clang to the             and smart TVs, has an OpenRISC core         make big bucks as a CPU designer.
same state as well. The Linux kernel          doing power management work.                Where do I start?
itself has been able to run on OpenRISC          OpenRISC has even gone into space               Well, we can’t guarantee that
since version 3.1, and a few other            as part of the TechEdSat project, which            you’ll be the Chief CPU Architect
real-time operating systems such as           is a satellite designed by students at      at Intel after playing around with
eCos have OpenRISC ports as well.             San Jose State University – it needed to    OpenRISC for a few months, but it’s a
    OpenRISC is popular in embedded           be cheap, so OpenRISC was a natural         great way to dip your toes into the vast
devices, and at ORCONF one developer          choice. It could be used in many other      wold of processor design. A good place
talked about a project using OpenRISC         devices and projects as well, that we       to begin is the Getting Started guide at
chips in TV set-top boxes to convert          don’t even know about, just as Linux        http://kevinmehall.net/openrisc/guide
satellite video data to internet streaming    and the BSDs are often chugging away        – and note the requirements in
formats. Other embedded chips had             inside networking and embedded              particular. You should have a solid
been considered, but it was important         hardware, without any fanfare.              grounding in the workings of a Linux
for the set-top box manufacturer that                                                     installation, along with knowledge of
the chips could run the Linux kernel, so             Is OpenRISC finished, or is it       Verilog and C (the language used to
OpenRISC was chosen.                                 still a work in progress?            code the Linux kernel).
    Another area in which OpenRISC is                With 80,000 lines of Verilog            The guide also explains how to run
well known is academia. The Technical                behind the design, there’s still     or1ksim, an OpenRISC CPU emulator,
University of Munich uses it in research      plenty of room for tweaks, performance      and how to use the chip on an FPGA
(which is why the conference was held         improvements and power savings. A           development board. You can pick up
in the city), while many other                team of developers is beavering away        one of these boards for around £50 to
universities teach courses based on it.       on a new CPU pipeline – that is, the        £100; see http://opencores.org/or1k/
                                              series of stages used to process            FPGA_Development_Boards for a list of
    What about the chip in the real           instructions. Ideally, it will support      boards that work with OpenRISC. But if
    world, though – are there any             out-of-order execution, along with          you really want to dive in at the deep
commercial implementations?                   dynamic branch prediction. Another          end, try the Architecture Manual at
    You bet! This isn’t just a play toy       topic that came up at the conference        http://tinyurl.com/qj6pjfc – just bear in
    for hackers and students.                 was improving the 64-bit version of the     mind that it’s 358 pages long!



                                                www.linuxvoice.com                                                              41
     INTERVIEW TIM BRAY




< TIM
BRAY />
Graham Morrison meets the co-author of XML, a
fierce privacy advocate, an encryption hacker and
the owner of many hats.

W
            atching Tim Bray talk             talked about most things to do with
            to an audience is a little        technology. He’s even making his own
            intimidating. He talks            security contributions to the amazing
fast and every word counts. And               open source Android email application,
he wants action – he wants his                K-9. His keynote at OSCON 2014 was
audience to change the world After            about threats – threats to our privacy,
founding companies, co-authoring              threats to our online freedoms and
the XML specification, working at             threats to our data, and “Now is the
Sun Microsystems and then Google              time for sensible, reasonable, extreme
(leaving because he famously didn’t           paranoia,” as he puts it. Which is
want to leave Canada for Silicon              exactly what we wanted to talk about
Valley), Tim has seen, thought and            when we met with him.



       How do we balance the                  of technology, it’s purely an issue of
       advantages of big data with            policy. Now in the US, they have such
healthcare systems and privacy?               regulations, the most visible of which is
And how can PGP help with this?               called HIPAA, which is widely used and
Tim Bray: Well Larry (Wall, the creator       strictly enforced in the healthcare
of the Perl programming language)             sector. And, whereas I think almost
certainly puts things into sharp              anybody would agree that it’s
perspective. You know, if you’re willing      reasonable to have such regulations,
to trust people with your health data         the HIPAA itself is not actually very         the way people are. So I think that we,
maybe we can save a lot of lives, and         good. In particular, it does things like      as a profession, have a responsibility to
yet there are a substantial number of         mandate the use of specific                   do the ethical thing by default and not
people who are reasonably paranoid            technologies such as passwords when,          surprise people with what happens to
about trusting their data to anybody. So      quite possibly, better alternatives to        the information they share. As you point
if you’re going to do that, you should be     passwords would be more secure and            out, OpenPGP is a well established, fully
transparent about how you’re going to         less onerous are available.                   debugged cryptography framework
handle the data, how you’d protect it            So I would probably appeal to a            that is highly implementable and has
and who you’d share it with, and so on.       combination of market forces and              been implemented lots of times, and
   But I don’t think that’s anything like a   public regulation to assume the default       yet its penetration among the non-geek
complete answer, because the vast             action is the right action, is the ethical    community is more or less zero
majority of people don’t really have the      action, is the action that produces the       percent. If we’re not going to make it
education or tools to understand what         least surprise on users. If we’ve learnt      easy to use by default, then we’re not
the data protection options are, and          one thing, no matter how many                 going to have privacy by default and I
what the consequences of sharing are.         information popups you put there              think our profession owes the
And we shouldn’t expect them to. It’s a       saying what you’re going to do with the       community, the people that use our
hard area of expertise and not one that       information and what the                      stuff, privacy by default.
we should expect civilians to have. So I      consequences are, a high proportion of
think there’s actually quite a strong role    people will say ‘ah, where’s the OK                If you look at HTTPS (ignoring
for the public sector in here to establish    button, I just wanna get through this’.            Heartbleed), even people
regulations, because this is not an issue     And whether you like it or not, that’s just   without technical knowledge can



42                                                             www.linuxvoice.com
                                                                                                      TIM BRAY INTERVIEW




                                                                     “We owe Mr Snowden a lot of credit
                                                                     for exposing people to the fact that
                                                                     their governments are doing things
                                                                     of questionable legality, morality
                                                                     and effectiveness.”


        understand that a site is encrypted,          being brute-force decrypted. It is plenty           But it’s taken a couple of years
        at least in principle. The certificate        good enough. And yes I agree with you               to get it into the latest alpha.
        sharing is all done transparently and         that people are starting to be educated      TB: Well, one of the problems with
        there’s an authority that deals with          about what the little lock means.            cryptography is key management, and
        the authentication of the certificate.           One of the things that I’m                how do you find the key for the person
        Maybe that’s what we need?                    disappointed about though is the             you want to send a secure message to.
        TB: Whenever anyone mentions                  community of developers that are still       Historically, the cypherpunk community
        HTTPS, flawed though it is, I have to         offering services over HTTP without          who invented all this stuff were a little
        push back a little bit. Yeah, it’s possible   even allowing HTTPS let alone requiring      bit guilty of letting the perfect be the
        to screw up the installation and              HTTPS. What they should all do is go to      enemy of the good, and so they set up
        deployment and so on, so that it doesn’t      their legal department and ask a legal       this web of trust mechanism, which
        work properly. But when it is deployed        opinion, ‘Hey, we’re offering our services   never worked – ordinary people won’t
        properly, which is not that hard, there is    in such a way that anyone sent onto the      go to key signing parties. I’m sorry, it’s
        not a known instance of HTTPS data            company can spy on us – is that legally      not going to happen.
                                                      OK?’ Well, you know what, it very               So I’ve been super interested in this
                                                      probably isn’t!                              thing called keybase.io, which provides
“We, as a profession, have a                               Even on Android, we don’t
                                                                                                   a pretty nice solution to the problem of
                                                                                                   acquiring a key with good reasons to
responsibility to do the ethical                           know of an email client with            believe in it. And, what’s great about it is
thing by default.”                                    decent S/MIME PGP support.
                                                      TB: So K-9 is getting it.
                                                                                                   that you don’t even have to trust
                                                                                                   keybase.io. They present everything



                                                        www.linuxvoice.com                                                                  43
     INTERVIEW TIM BRAY




  “I don’t care if Apple has signed
  it, I want to download an app
  that has previously been
  audited and found to be safe.”


that you need to know in proofs that           huge proportion of internet traffic. We       experience more private and safe for
you can independently verify if you            did not know they were tapping into           all the people that are going to come
want to. I thought the difficulty of           Google’s data centre.                         after us.
actually discovering and acquiring keys
might be the single largest remaining                And you worked at Google for a                 But even with all the data
logjam, or one of them anyhow, in                    while…                                         anonymised, there’s no one
making quality cryptography available.         TB: Yeah, and I tell you, the people at       accepting anyone’s word that it’s
Now I think we’re ready to make that           Google were livid when that one came          anonymised, and even when it is
one go away, and so I’m optimistic.            to the surface. So I think we owe Mr          anonymised, you only need
                                               Snowden a lot of credit for exposing the      something like three trig points to
      GnuPG for email clients can              larger population to the fact that their      find people. There’s just so much
      work completely transparently            governments are doing things that are         data out there. It seems to us like
as far as key exchange and key                 of questionable legality, morality and        the cat’s already out the bag.
discovery go. You don’t even have to           effectiveness.                                TB: Well sure, you can take that
know anything about the keys.                                                                attitude. And also you can say that
TB: And particularly in the case of                   In the UK – thanks to the              anyone who carries a mobile phone is
keybase, you just go ‘I’m looking for a               European Court of Justice – it         revealing their location at all times. But I
key for you’, and it says ‘Oh, here’s a key,   is illegal to harvest data from ISPs          think the notion that the cat’s out the
which is also controlled by the person         on a large scale and that’s why               bag and we should all roll over and give
who controls your Twitter account and          they’re rushing through these very            up is just barshit. I think that every time
your GitHub account’. OK, that’s good          quick surveillance laws to make it            we increase the proportion of the traffic
evidence, I’ll believe that that key is a      ‘not’ illegal.                                that is privacy-enabled, we are doing a
good one to encrypt my message with.           TB: Right, the DRIP [Data Retention and       public service. We are driving up the
                                               Investigatory Powers] law. We’re having       cost to those who have been abusing
      When do you think this became            a similar problem in Canada, although         the existing transparency, and I think
      such a big issue? Has it always          one of our courts found that it is illegal    that’s something we should do. We
been an issue, or has it become                for ISPs to provide usage data without        have no excuse for not doing it.
more an issue as the internet has              a warrant, which is a change in the
become so much a part of our lives?            landscape.                                          But we’re in the minority. The
TB: I would offer a lot of credit to Ed                                                            new generation are used to
Snowden, who started this                              Do you think it’s too late?           Facebook and everything about their
conversation. I think a lot of people,                 Do you think the cat’s out of         lives being online.
security professionals and people close        the bag?                                      TB: From what I hear, the younger
to metal, kind of knew what was going          TB: Oh no, not in the slightest. We’re        generation is increasingly less
on. Knew that, you know, government            still in the first generation of people who   Facebook-centric and one of the
agencies were in fact scooping up a            live on the internet. We can make the         reasons for that is they don’t like that



44                                                              www.linuxvoice.com
                                                                                                     TIM BRAY INTERVIEW

        creepy feeling that their information is     equipped to make it, so why don’t you        happening for reasons that are actually
        leaking. Just because an opinion one         just do the safe thing and make              good. Native mobile apps offer more
        holds is in the minority, doesn’t mean       everything private. And that’s an            responsiveness and a lot of UX options
        we should give up and stop pursuing it.      unanswerable argument now that               that are not available in browser apps.
        And, like I said earlier, I don’t think we   HTTPS is very low cost and low               They also have an important advantage
        should expect the general population to      difficulty to deploy. I’m quite optimistic   that we’re not giving enough credit to,
        have educated opinions about internet        actually. I’m not arguing in favour of       which is that they also have a superior
        safety any more than they have               absolute privacy; there can never be         developer experience. However, there
        educated opinions about emission             such a thing. All we can ever do is move     are two important advantages of the
        control systems in automobiles or air        the needle and increase the proportion       browser-centric world that we’re losing.
        traffic control regulations, and that kind   of things that are privacy enabled, and I    One of course is the speed of update. If
        of thing. It’s our responsibility as         think we’re doing that.                      you have a bug that you need to fix fast,
        professionals to ascertain what the             I notice that there are excellent         in the case of Android you’re looking at
        most beneficial behaviour is and build       OpenPGP libraries available now for          a latency of hours and in the case of
        things in that way.                          Ruby and Python and JavaScript and           Apple you’re looking at a totally
                                                     Node. There are not for Java itself or for   unpredictable latency of potentially

“I’m not arguing in favour of                        .Net, which is a problem that we need
                                                     to address. I know that people are
                                                                                                  weeks, whereas if you’re web-centric
                                                                                                  you can fix an applet in minutes. And
absolute privacy; there can                          working hard over at Google and some         that’s huge. Secondly, the issue you

never be such a thing.”                              other places about trying to do crypto in
                                                     the browser. Which is, if you can do it, a
                                                                                                  raised is important to me. I think the
                                                                                                  internet is better when anyone can
                                                     super interesting enabler of a bunch of      deploy anything on it without asking for
              It’s one thing to say it, but          interesting things, but there’s a severe     permission. And anyone can go and get
              we’ve known about this for a           question of trust. When can you trust        it. And I do not like the app store as
        long time and it hasn’t happened.            an app that you download over the air?       intermediaries through which you go to
        TB: I’m disturbed by your counsels of        Those problems are not insuperable.          find anything. I’m less offended by the
        dispair. The proportion of things being                                                   Google app store than by Apple’s
        transmitted over HTTPS is                          Do you think we can counteract         because of its exclisivity – when Apple
        monotonically increasing. And we still             the new app-centric frontier by        says we’re not going to sell something,
        encounter people saying ‘oh, my stuff is     using stuff like Firefox OS?                 they’re not saying they’re not going to
        shareware, it doesn’t need to be             TB: It is clearly the case that the          sell it, they’re saying you can’t have it. If
        HTTPS’. And to that I say, ‘well, yeah,      browser is becoming less central as          Google doesn’t like something, well you
        but the decision as to whether               part of the software delivery ecosystem      can still get it off the project’s website,
        something needs to be private is             because a very high proportion of            right? How much impact is something
        complicated and very context                 things are migrating into native mobile      like Firefox OS gonna have? Well, I hate
        dependent, and most people aren’t            apps. And to some extent that’s              to say it, but that probably depends on
                                                                                                  price performance of the hardware it’s
                                                                                                  running on.

                                                                                                         We lament the loss of what the
                                                                                                         internet had at the beginning
                                                                                                  of its life.
                                                                                                  TB: Think about it this way, the volume
                                                                                                  of traffic on the internet is unimaginably
                                                                                                  vast. So whether you are an over
                                                                                                  enthusiastic government agency or
                                                                                                  whether you are a hacker trying to steal
                                                                                                  credit card numbers, every time we can
                                                                                                  impose a non-zero cost on surveillance,
                                                                                                  the volume is so high that there will be
                                                                                                  entire class of surveillance or an entire
                                                                                                  class of crime, that it becomes
                                                                                                  uneconomic. And, given that, why
                                                                                                  would we not do it? Every time you
                                                                                                  increase the proportion of traffic with
                                                                                                  HTTPS up by 5%, you drive a certain
                                                                                                  class of undesirable behaviours into
          Tim’s a fan of the way apps make things
                                                                                                  uneconomic territory. You don’t have to
          easier for developers – but not of the
          disadvantages they present to users.                                                    win to win, you just have to make things
                                                                                                  better to improve the environment.



                                                       www.linuxvoice.com                                                                  45
BUY          MUGS AND T-SHIRTS!




      shop.linuxvoice.com
                                                                                                                             INTRO REVIEWS




                                                 REVIEWS
                                                 The latest software and hardware for your Linux box, reviewed
                                                 and rated by the most experienced writers in the business


                                                  On test this issue...
                                                     48                                                        50



Andrew Gregory
So this is what bandwidth shaping looks like.
Thanks BT, thanks a lot.




O
         ne of he few good things to
         have come out of the recent/             Ubuntu 14.10                                              FRITZ!box 7490
         current Gamergate campaign               Ben Everard is bemused by the newbie                      Paranoid BT customer Graham Morrison
of harassment is that Kathy Sierra has            distro par excellence offering upgraded                   switches router to a device that won’t
returned to the internet, this time to            developer tools in its latest offering.                   send all his data to GCHQ.
introduce (to me, at least) the concept
of the Kool-Aid point. This imaginary
construct is that point at which                     52                                                        53
something achieves a degree of
popularity; trolls are then given licence
to attack the idea/person/thing merely
because it’s popular. The merits of the
thing in question go out the window; all
that matters is that if it’s popular, it is by
definition inferior in some way.
   Ubuntu is popular. It’s still the Linux
distro with the biggest chance of
getting through to the masses, and                FreeBSD 5.6                                               Google cardboard
there’s a predictable queue of critics            The grass may not always be greener, but                  After a greasy pizza, Ben Everard sticks
lining up to slate it for any number of           Mike Saunders does like to look at an                     the box on his face and pretends he’s in
reasons, both real and imagined.                  alternative OS to Linux now and then.                     The Lawnmower Man. Thanks Google!
Likewise Google. Google is an
advertising company. Its key revenue
driver is advertising, built off the back of      BOOKS AND GROUP TEST
the best search engine in town. It
                                                  One of the best things about Linux from an ethical
doesn’t need to make 3D cheaper for
                                                  point of view is that it runs on old hardware. Linux
everyone, or provide free translation             and free software has the potential to keep tonnes of
services, or do any of the other things it        rare metals out of the landfill site (and save you a
does that make our lives easier. By all           few quid in the process), and it’s all thanks to
means knock them for the creepy                   lightweight Linux distributions such as those tested
                                                  on page 56. If you have a machine gathering dust,
privacy invasions, but Canonical and
                                                  install one of these and marvel at the resurrection.
Google aren’t privatised state                    And over in book reviews there’s a filmic interloper in
monopolies like BT – we can’t knock               the shape of patriot/traitor Edward Snowden biopic
them just for being successful.                   Citizen Four. Seek it out; it’s rather good.
andrew@linuxvoice.com



                                                                   www.linuxvoice.com                                                                  47
     REVIEWS UBUNTU 14.10



Ubuntu Utopic Unicorn (aka 14.10)
Long-term Ubuntu user Ben Everard discovers whether Deckard was a replicant.


                                T
                                          he biggest news about the Utopic Unicorn
 DATA                                     isn’t what’s included in it, but what isn’t. Mir (a
 Web
                                          display server) and Systemd (an init system
 www.ubuntu.com                  – see page 86 for much more) are both coming to
 Developer                       Ubuntu, and they’ll both have a profound effect on
 Canonical                       how it works. However, they’re both going to arrive in
 Price                           the release after this (15.04, aka Vivid Vervet). Without
 Free under various
 licences
                                 these, Utopic Unicorn is a boring release in many
                                 ways. Without Mir, there’s no Unity 8, so the desktop
                                 environment hasn’t changed significantly from 14.04
                                 (though it does work better on High DPI displays)
                                    In fact, as far as desktop users are concerned,
                                 the biggest changes are the inclusion of the latest
                                 packages.                                                        Unity will still include online results in searches in the
                                    Linux 3.16 The kernel upgrade brings some                     Dash – a move that angers many privacy campaigners.
                                    performance improvements.
                                    Firefox 33 Brings some significant performance
                                    improvements to web browsing.                                 a big problem, but if both Systemd and Mir arrive
                                    LibreOffice 4.3 This has improved DOCX support                on schedule, they’ll both be coming in 15.04. This
                                    Other than this, the updated versions of Libnss               means that by choosing to install 14.10, you are
                                 means that Netflix will now work out of the box with             effectively choosing to switch to Systemd and Mir in
                                 Chrome. Unlike the previous release (Trusty Tahir                a few months’ time. Even if you like the idea of these
                                 aka 14.04), Utopic is not an LTS (Long Term Support)             technologies, the first version of a distro containing
                                                                         release. This            them is likely to have a few problems. Unless you’re

“Anyone wanting to develop on                                            means that it will
                                                                         only be supported
                                                                                                  prepared to endure these problems, a more prudent
                                                                                                  approach would be to install 14.04, which will be
cloud services may find that                                             for nine months.         supported until April 2019.

Utopic is the best distro for them.”                                     Since releases
                                                                         come out every           Developers developers developers!
                                                                         six months, this         There is, really, only one significant release from
                                 means that users either have to upgrade every time,              Canonical in 14.10, and that’s the Ubuntu Developer
                                 use an unsupported system or switch to another                   Tools Centre (UDTC). The idea behind this tool is that it
                                 distro altogether. Usually, upgrading each time isn’t            will enable developers to quickly set up common
                                                                                                  development environments. The first environment is
                                                                                                  for Android development including the various tools
 Flavours
                                                                                                  from Google. It’s not hard to set these up, but there are
 Of course, Ubuntu isn’t just about the            Plasma 5 and experience the future.            a few bits that need to be downloaded, and
 default version with the Unity desktop: there     Xubuntu Not much has changed in Xfce,          dependencies installed. UDTC acts like a sort of
 are seven official flavours of Ubuntu with        but Xubuntu users can upgrade to take          package manager that enables you download
 different desktop environments. Canonical         advantage of the latest packages.
 hasn’t released any information about how         Lubuntu LXDE only gets some bugfixes
                                                                                                  everything and set it up in one go.
 popular they are, so we’ve ordered them by        this version, as most of the development is       This is useful – it slightly reduces the amount of
 the number of people seeding the ISO on           going into LXQt. This is another distro with   work that a small minority of people will have to do
 BitTorrent.                                       a big change coming up.                        after installing Ubuntu – but it’s not really a killer
    Ubuntu Gnome The newest official flavour       Ubuntu Kylin The Chinese version of            feature. After all, not many people will even need it.
    of Ubuntu has proved to be very popular,       Ubuntu comes with a more tweaks than
    and shows that many Ubuntu users would         just the language. For example, WPS Office
                                                                                                  We can certainly see it becoming more useful over
    like to stick with the distro’s roots.         ships as the office suite because it’s more    time. For example, if it becomes easy to define the
    Unfortunately, the release schedules of        popular than LibreOffice in China.             environments that get installed, you could create
    Ubuntu and Gnome just fell out of sync, so     Ubuntu Studio As well as the usual raft of     custom ones for particular projects so the whole team
    14.10 ships with Gnome 3.12 instead of         changes, the new kernel brings ALSA            can easily stay updated, and new members could
    the slightly newer 3.14.                       support for firewire devices.
    Kubuntu KDE is also in for a big upgrade       Mythbuntu This hasn’t released a 14.10
                                                                                                  instantly get everything they need. However UDTC is
    soon. By default, Kubuntu still ships with     version as there weren’t enough changes        still some way off this ideal.
    Plasma 4, but intrepid users can switch to     to make the non-LTS release worthwhile.           If you’re using Ubuntu 14.04 and like the sound
                                                                                                  of the UDTC, you don’t need to upgrade your whole



48                                                                  www.linuxvoice.com
                                                                                                                  UBUNTU 14.10 REVIEWS


  Desktop next
  As we’ve mentioned, 14.10 is, well, a bit of a boring release
  for the desktop. But this doesn’t leave the thrill-seeking
  distrohopper without an exciting version of Ubuntu. As we’ve
  mentioned, there are a lot of changes stacking up for the next
  version (15.04, aka Vivid Vervet), and there are already images
  of this distro that you can install.
      Given that this is still months away from release, you
  should expect quite a lot to be broken, and even more to
  break with upgrades, so it probably isn’t suitable for a main
  computer yet even if you do know what you’re doing. However,
  if you want to see what’s going to happen next release, fire
  it up and have a look. In some versions of Virtualbox, it’s not
  starting correctly. If you end up with a screen of colourful
  characters instead of a desktop, press right-Ctrl+F1,then
  right-Ctrl+F7.



distro; you can get it by adding the PPA:
sudo add-apt-repository ppa:didrocks/ubuntu-developer-tools-
center
  After years of seeing Ubuntu as a newbie-friendly                 The Dash is Unity’s most powerful feature. It’s a central place that enables you to search
distro, it seems strange to be talking of Utopic Unicorn            a wide variety of sources. Here, it’s searching both installed, and available applications.
as a distro for more technical users, but it seems to
be the more experienced Linux users who will benefit                   Openstack
most from this release. As well as UDTC, there are a                   While many people often think of Ubuntu as a
number of rapidly developing new technologies that                  desktop distro, it’s also one of the most popular
have been updated:                                                  Linuxes for running cloud services, and it’s Ubuntu’s
  Containers                                                        tight integration with technologies like these that
  Juju                                                              have earned it this spot. Of course, not many
                                                                    sysadmins are going to be rushing to switch their
                                                                    servers to a distro that’ll only be supported for nine
                                                                    months. However, anyone looking to develop on
                                                                    these technologies may find that Utopic is the best
                                                                    distribution for them right now even if they release on
                                                                    a different system later on. This release of Ubuntu is
                                                                    also a great place for anyone looking to learn these
                                                                    tools (and learning these tools is a great idea if you
                                                                    plan on being in the sysadmin or cloud computing
                                                                    world in five years time).

                                                                    Keep calm and carry on
                                                                    Overall, Utopic isn’t an exciting release for most
                                                                    desktop users. In fact, we’d go so far as to
                                                                    recommend most desktop users stick with Trusty
                                                                    Tahr (the most recent LTS version) for now. The
                                                                    exception to this is anyone interested in the developer
                                                                    tools, whether this is the UDTC or the cloud computing
                                                                    software. For these people, Ubuntu is becoming a very
                                                                    attractive option. That doesn’t mean it’s time to write
                                                                    Ubuntu off as a boring distro. There are big changes
                                                                    afoot. It’s too soon to say whether they’ll be for better
                                                                    or worse, but this will probably be the last boring
                                                                    Ubuntu release for quite some time.


                                                                      LINUX VOICE VERDICT
                                                                      An unexciting release with a short
                                                                      support period… but be prepared for
KDE users with a long memory will be wary of a new                    big changes to come.
major version, but Plasma 5 on Kubuntu looks good, even
if it’s not the default version yet.



                                                                      www.linuxvoice.com                                                                    49
     REVIEWS FRITZ!BOX 7490



FRITZ!Box 7490
Graham Morrison’s distrust of his ISP’s standard router has led him to a German
alternative with a rather self-deprecating name.

                              T
                                        his is a beast of a router. It’s also quite       occasional unrecoverable errors that the HomeHub
  DATA                                  expensive and nowhere near as open as a           didn’t, but equally, it could go for weeks without a
  Web
                                        device running the OpenWrt distro for             single problem. A firmware update that came late
  http://en.avm.de            embedded devices. But it’s worth considering for a          October (6.20) seemed to improve stability again, and
  Manufacturer                couple of reasons.                                          added more feedback about the connection.
  AVM Computersysteme            Most importantly, it can be used to replace the
  Price                       devices supplied by the UK’s biggest fibre provider, BT     Such numbers, wow!
  £240
                              Infinity. BT provides a proprietary and vendor specific     The feedback you get from the FRITZ!Box is fantastic.
                              unit it calls the ‘HomeHub 5’ to its customers – a          There are more geeky statistics on the quality of your
                              wireless access point and VDSL modem combined.              connection than on any other router we’ve seen. An
                              They’re powerful, stable and more than adequate,            online monitor shows both a downstream and an
  SPECIFICATIONS
                              especially in the fifth revision now being sent out.        upstream chart split by category of the data flowing
  VDSL or ADSL                But BT also has a dubious record with its customer’s        into and out of your network. This is very useful if you
  IP or analog phones         privacy, including reports of ‘remote diagnostic tests’,    want to immediately see how much bandwidth Netflix
  4 x gigabit Ethernet
                              its collusion with a commercial service that scanned        is consuming, as well as how much headroom you’ve
  WAN on LAN 1
  Wireless AC (1300           your network packets to deliver tailored advertising,       got for playing Borderlands 2 with your friends. There
  Mbit/s)                     and rumours of BT allowing a government back-               are charts showing the signal-to-noise ratio across the
  Wireless N (450 Mbit/s)     door, NSA-style, into its hardware. The second and          broadband spectrum, a page of statistics, and a page
  2 x USB                     less tinfoil-hat reason is that the FRITZ!Box 7490 is       that allows you to adjust the signal-to-noise ratio,
  Handles 6 DECT
                              much more powerful, giving you far greater control          impulse noise protection and radio frequency
  handsets
  ISDN S bus                  and feedback over your connection and replacing a           interference to create a faster or more stable
  Average power: 9.3W         multitude of devices within your home.                      connection. These had no effect with VDSL, but they
                                 The most important feature for a device like this        were able to make a troubled ADSL connection more
                              is the speed and stability if its internet connection.      stable for us.
                              Every other feature hangs off its success, and we’d            We also like the simplicity of Access Profiles. These
                              even forgo our privacy issues and stick with the            are a basic whitelist/blacklist system that can be
                              HomeHub if it made the difference between watching          grouped into profiles and applied to specific devices,
                              Taylor Swift’s videos in 1080p/60Hz, 24 hours a day,        or guest networks, on your network. You can filter
                              or ordinary standard definition at tea time. We’ve          on applications and by websites and block them
                              tested the unit with both a slower ADSL connection          completely or for a specific day and time. These lists
                              and a fibre-based VDSL connection, and we had               provide a no-fuss way of locking down a child’s device
                              good results over weeks of use. VDSL suffered from          or cutting off their connections at a specific time. The
                                                                                          firewall is equally well specified, allowing services
                                                                                          and ports of your own creation through to specific
                                                                                          devices, and there’s a great overview of what devices
                                                                                          are connected, what they’re doing across the network,
                                                                                          and at what speed they’re connected. Other network
                                                                                          features include access to the NAS and a portal that
                                                                                          can make your router configurable from the internet.
                                                                                          The NAS feels a little simplistic, and we don’t think it’s
                                                                                          going to challenge QNAP and Synolgoy devices, but
                                                                                          it offers most features you’d expect, including access
                                                                                          control and UPnP for media streaming. Just plug in a
                                                                                          USB storage device and go.

                                                                                          Cable metropolis
                                                                                          The unit has four Gigabit Ethernet ports, and the 4th
                                                                                          can be used to access the ‘Guest’ profile to limit
                                                                                          access to any services running on your LAN. Wireless
                                                                                          is via both a 2.4GHz frequency network and a 5GHz
                                                                                          network. Without scientific testing, we’d say coverage
It looks like something out of Elite Dangerous, and the FRITZ!Box 7490 connected to our   wasn’t as good as the HomeHub, but we had better
VDSL at the native speed for our line – 80 kbit/s download and 20 kbit/s upload.          throughput performance, especially after restricting



50                                                             www.linuxvoice.com
                                                                                                                   FRITZ!BOX 7490 REVIEWS


  Hack your FRITZ!box
  There’s a surprising amount you can do with the FRITZ!box if
  you’re willing to hack around a little. Telnet can be enabled,
  for instance, by pressing ‘#’ on a connected phone, and
  dialling 96*7*. You’ll even see a message to tell you it’s
  enabled (switch the 7 to an 8 to disable it). You can now
  connect to your router from the command line by typing telnet
  ip_address, and entering your web admin password. You’ll
  now find yourself in a fairly recognisable Linux command line
  environment. You can ls or type top and take a look around
  the filesystem. wget is also available and there are ways of
  installing user-compiled packages like ‘DropBear’, but we
  wouldn’t suggest doing this.
      Instead, we’d recommend taking a look at the Freetz. This
  is a collection of open source modifications that can be made
  to your router’s default firmware, turning it into a much more     If the default firmware doesn’t give you enough
  flexible and hackable device (and likely voiding the warranty      control, you can access the OS with Telnet or install
  at the same time). You need to create a virtual machine with       an open source update called Freetz.
  a specific build environment and then pull the latest files from
  a GitHub account before building it all from a basic menu          hardware, and the ability to make your own firmware changes,
  system. Nearly all the important and relevant information          it’s worth the effort. We found it particularly useful to add
  is in German, making the task that much harder if you don’t        wider VPN functionality, including OpenVPN, as well as easily
  speak the language. But if you want greater control over your      adding SSH and other applications.



5GHz to our faster devices. You can also turn the                    to your configuration, turning any connected phone
wireless off to a schedule and create a separate                     into an IP phone. We tested this with a free account
network for guests, which is a feature we really like.               from www.voiptalk.org and it also worked perfectly.
    There are several supporting apps you can install                You can block, divert and forward calls, depending
on your Android phone, and one is called ‘WLAN’. This                on simple rules, and manage which network is used
gives exceptional diagnostic information about the                   for dialling. If you want to trust the internet portal
strength and frequencies of any networks overlapping                 forwarding, you can even see your missed calls and
yours, including the field strength over time and the                messages from outside your network, making the box
ability to beep when it gets out of range. We found                  a good contender for a small business.
this an excellent tool for fine-tuning the network and                   The best thing about the FRITZ!box is the huge
making up for the weaker performance on the router.                  amount of
    As mentioned earlier, you can also pair the router
with your DECT-compatible phones and connect your
                                                                     information
                                                                     and control it
                                                                                           “The best thing about the FRITZ!box
land line to your router to accept calls. You need to                provides, and         is the huge amount of information
make sure you get the UK version for the UK cable, as
it’s a weird mix of broadband and phone that might
                                                                     it’s a refreshing
                                                                     change from
                                                                                           and control it provides.”
not be easily found otherwise. You can enable both                   the limited data
a fax and an answer machine on the FRITZ!box,                        spat out by the routers shipped with most ISPs. For
and best of all, another app on your Android device                  example, there’s plenty of control over power usage,
will turn your mobile into yet another phone. When                   allowing you to reduce the speed of the network, or
connected to the WLAN, the app will allow you to                     the wireless, or the DECT phones to save electricity.
answer and make landline calls, listen to messages,                  There are still trust issues with proprietary firmware,
make internal calls and see any missed messages,                     of course, and we missed specific ‘Quality of Service’
as can any other connected phone. This system                        controls, but we feel a lot less paranoid while running
works brilliantly, and we forgot we were answering a                 the 7490 in place of our normal HomeHub 5.
landline call from our mobile thanks to the app being                    This is an expensive router, but if you’re looking to
so transparent. You can also add internet telephony                  replace an old DECT phone system, a NAS server and
                                                                     media player, in a box that can handle FTTC and ADSL
                                                                     connection (including Annex M), or you run a small
                                                                     business, it pays for itself.


                                                                       LINUX VOICE VERDICT
                                                                       Expensive, but more Linux-friendly than
                                                                       your ISP’s default, and it can replace
There are two USB 3 ports for printers and storage media,              more than one device.
as well as analogue phone ports for telephones,
answering machines and a fax.



                                                                       www.linuxvoice.com                                                   51
     REVIEWS OPERATING SYSTEM



OpenBSD 5.6
Bang on schedule, another release of OpenBSD is here.
Mike Saunders pits it against the current crop of Linux distros.

                            O
                                     penBSD has a lot in common with Linux. It’s
  DATA                               Unix-like (actually a descendant of BSD Unix),
  Web
                                     it’s open source, it’s reliable, it’s secure, and it
  www.openbsd.org           runs most of the software you’re familiar with: Gnome,
  Developer                 KDE, Firefox, Apache, MySQL and so forth. But it’s a
  The OpenBSD Project       much smaller project, with a comparatively tiny
  Licence                   development team, so is it fair to compare it with
  BSD, ISC, GPL and more
                            Linux? We think so, given that it does a very similar job
                            to Linux, and many OpenBSD advocates recommend
                            making the switch. But we understand that it doesn’t
                            try to be an all-singing, all-dancing desktop OS like
                            many of the big-name Linux distros.
                                OpenBSD 5.6 is available for several platforms,
                            including x86, x86-64, PPC, Sparc and various ARM               OpenBSD’s manual pages are fantastic, and document
                            boards. An absolute minimum installation requires               virtually every aspect of the OS.
                            just 32MB of RAM and 200MB of hard drive space, so
                            it’s great for turning an old box into a router, firewall or        The biggest change in this release is the inclusion
                            small server – tasks at which OpenBSD excels.                   of LibreSSL, the OpenBSD project’s fork of the hack-
                                                                                            filled OpenSSL codebase. Some pundits criticised
                            Out with the old, in with the new                               OpenBSD for forking and not simply submitting
                            As with previous releases, the installer in 5.6 is plain        patches, but as we’ve seen with OpenSSH (another
                            text and to the point, and it’s hard to get stuck               OpenBSD project that’s now used everywhere), the
                            because the documentation is so good. OpenBSD                   developers know what they’re doing. On laptops, the
                            prides itself on having clear and correct                       Intel and Radeon DRM drivers now have improved
                            documentation, and although its developers and                  suspend and resume support, while Sendmail has
                            users are often accused of chanting “RTFM” (read the            been dropped from the base system in favour of
                            fine manual) all too often, that’s understandable. The          OpenSMTPD. Other cleanups include the removal of
                            installation guide is very thorough, and the “afterboot”        Kerberos and the old Apache-based web server, with
                            manual page provides an excellent introduction to               the latter being replaced by a small daemon based
OpenBSD is pretty bare
out of the box, but point   configuring your new OpenBSD setup. Very little is              on relayd. Old-school FTP and tape installations have
$PKG_PATH at a mirror of    installed by default, but there’s a large range of binary       faced the chop as well in this release.
packages and run pkg_add    packages for desktop, office, server and development                Now, OpenBSD prides itself on being extremely
xfce to get this.           jobs just a few pkg_add commands away.                          secure, beyond Linux and the other BSDs. We often
                                                                                            see newly discovered exploits that wreak havoc on
                                                                                            other OSes, but are more contained or simply don’t
                                                                                            work on OpenBSD. This is great, but keeping the
                                                                                            system up to date is so much more work. OpenBSD
                                                                                            doesn’t have official binary updates – so when a bug
                                                                                            or hole is discovered, you have to manually patch and
                                                                                            recompile the kernel and/or userland yourself. There
                                                                                            are some third-party providers of binary updates,
                                                                                            but when you compare the work involved to apt-get
                                                                                            update && apt-get upgrade, it’s a bit off-putting. We
                                                                                            understand that the OpenBSD team is small and
                                                                                            very busy, so we won’t knock them. It’s just worth
                                                                                            considering before making the switch.

                                                                                              LINUX VOICE VERDICT
                                                                                              Plenty of old cruft removed, plus
                                                                                              some minor updates. We still hope
                                                                                              for binary updates one day though.




52                                                            www.linuxvoice.com
                                                                                                 GOOGLE CARDBOARD REVIEWS



Google Cardboard
Ben Everard builds a virtual reality headset from an old pizza box.
Forget jetpacks and hoverboards – this is the future.

T
          he idea behind Google Cardboard is simple:
          take a mobile phone, place it close to your
          eyes and use one half of the screen to display
an image to one eye, and another half of the screen to
display an image to the other eye. This creates a
stereoscopic 3D image that has half the horizontal
resolution of the phone.
    Google Cardboard does this with a piece of folded
cardboard that fits onto your face and includes a
pair of plastic lenses to help your eyes focus on the
screen. There’s also an NFC tag so your phone can tell
it’s in the device and a pair of magnets to provide input
to the device.
    You can buy kits with the cardboard pre-cut (from
Amazon, DX.com or others), or you can just get the
lenses and NFC tag (and magnets as well if your
phone is compatible), then download the design files
                                                                                                                             Anything that can output
and make it from any pieces of cardboard you have             is only really suitable for simple applications and not
                                                                                                                             two images side by
lying about.                                                  serious 3D work. This is a shame, and we hope that a           side can be used with
    The biggest problem with Cardboard is how                 solution is found.                                             Cardboard. This is the
incompatible it is with many devices. More or less any                                                                       rollercoaster from http://g.
phone should be able to display 3D images and video.          What would MacGyver do?                                        co/chromevr
The best source of these is probably YouTube (search          The magnetic switch is probably the least reliable part
for SBS 3D to find glass-compatible videos). Phones           of Cardboard. This should work with the Nexus 5, with
with a hardware gyroscope can also do head tracking,          other phones hit-and-miss at best. Without the
enabling you to look around the 3D world.                     magnetic switch, the method of getting input into the            DATA
    In fact, the gyroscope is probably the biggest            phone is to poke your finger through the nose hole
                                                                                                                               Web
problem with Cardboard at the moment. Not only                and tap the screen. This is inelegant, but it works.             https://cardboard.
do many phones (even some listed as ‘partially-               Apparently, you can use a strip of copper tape to                withgoogle.com
compatible’ on Google’s website) not have one, but            conduct a touch from outside the device to the                   Developer
those that do often have calibration problems that            screen, but we’ve been unable to test this.                      Google
                                                                                                                               Price
leave the 3D world slowly spinning (a problem known              Cardboard feels like (and it is) a hacky prototype
                                                                                                                               No official price. Various
as gyro drift). It might be possible to correct (or at        stage. It’s far from a consumer-ready device, and                unofficial options from
least minimise) this problem in software in the future,       there’s not a lot of software available for it yet.              about £5.
or this might prove too complex. For now, at least,           However, given the price it’s selling at, we think that
this problem means that head tracking in Cardboard            this is acceptable (gyro-drift aside). In fact, playing
                                                              with Cardboard is ridiculously good fun partially
                                                              because it feels so hacky. It literally is a virtual reality
                                                              headset that you can build yourself, and that alone
                                                              is enough to get us excited. There’s just something
                                                              about being able to use a device you’ve built to look
                                                              around in a 3D world that restores our child-like
                                                              wonder in computing far more than any closed off
                                                              device you can pick up off a shop’s shelf. We’re giving
                                                              Cardboard a maximum score because its such a joy
                                                              to use, not because it works perfectly.

                                                                LINUX VOICE VERDICT
                                                                The most fun you can have with
                                                                an old pizza box. Just don’t expect
The standard Cardboard (shown here) should fit most             everything to work perfectly.
phones, but there’s an unofficial large version that claims
to fit phones up to 7 inches in size.


                                                                www.linuxvoice.com                                                                      53
     REVIEWS FILMS



Citizen Four                                            FILM
Ben Everard didn’t use Tor to book his cinema tickets
and has now been flagged as a troublemaker.


I
      n mid-2013, a trio of journalists boarded     directly into the hotel suite in Hong Kong for
      a plane to Hong Kong to meet a                the meetings. We see Ed’s reactions as the
      mysterious person who had recently            story blows up, but it’s told subtly. Viewers
delivered a small cache of classified               have to watch closely to see how his body
documents from the NSA. The source                  betrays his stoic words.
promised to reveal more once they met.                 The footage of Snowden is interspersed
Those three people were Glenn Greenwald             with speakers on privacy and encryption
(a lawyer turned blogger and columnist),            including William Binney (the former NSA
Ewan MacAskill (a reporter for the Guardian)        leaker), Jacob Appelbaum (Tor developer,
and Laura Poitras (a documentary film               journalist and privacy campaigner), and
maker). The person they met turned out to           Ladar Levison (former owner of Lavabit).
be Edward Snowden and the rest, as they             Together, these help give an idea of the
say, is history.                                    impact that total surveillance can have on
   Or is it? Many words have been spoken            a society.
about Ed (as he likes to be known), but little
has been said. Up until now, the three people       The human element
who met him in Hong Kong have, for the              There’s little about the details of the leak –
most part, kept their reporting to the leaks,       it’s been well covered elsewhere and film        “My name is Edward Snowden. I go by Ed”.
not the leaker. Although the mainstream             isn’t the right medium to explore them.
media has dug through his past, he hasn’t           Instead, the film adds a human element to        something is sent encrypted, we see gpg
yet told his story, and while the history books     the saga. This has been much missed up           spit our seemingly random alpha-numeric
are full of details of the data leaked, there are   until now (with, perhaps, the exception of the   characters (no, we don’t know if these are
still some gaps in the public knowledge of          excellent book The Snowden Files by Luke         actually the encrypted files). When it shows
the leak itself.                                    Harding, but that book focused on the            the command line, what else would you
   Citizen Four doesn’t completely change           impact on the media establishments and           expect, but Tails’:
that – it’s ultimately a film about the actions     journalists working at them, not the four        amnesia@amnesia
of the American surveillance state, and             people holed up in a crowded Hong Kong              These are of course small details, but the
Poitras’s experience with that, rather than a       hotel room).                                     accuracy there gives us confidence in the
biography of Edward Snowden – but it does               The geek viewer will appreciate that         accuracy of the film as a whole. Another
offer a few glimpses round the side of the          the technical scenes aren’t faked (as so         nice touch was the inclusion of Tor, Tails
media firestorm. Poitras takes the viewer           often seems to happen in films). When            and Debian Gnu/Linux in the film’s credits.
                                                                                                     Eagle-eyed viewers will also learn that Ed’s
                                                                                                     reading material of choice in Hong Kong
                                                                                                     was written by Cory Doctorow.
                                                                                                        The film concludes with a confirmation of
                                                                                                     the much-rumoured new leaker from within
                                                                                                     the American surveillance establishment.
                                                                                                     Few details are given, but much is hinted
                                                                                                     at. Linux Voice attended the UK premier
                                                                                                     which included a Q&A session with Potrias
                                                                                                     where someone asked the director for any
                                                                                                     new details. Her refusal to answer gave us
                                                                                                     reason to suspect that we could be in for
We appreciated the accuracy of some of the technical details, like including a real command line     some more exciting (and worrying) news
rather than the fake ones you normally see whenever Hollywood touches on tech.                       stories in the future.



“Citizen Four is ultimately a film about the actions                                                   LINUX VOICE VERDICT
of the American surveillance state rather than a
                                                                                                       Footage from inside the hotel room as
                                                                                                       Edward Snowden leaked the NSA’s secrets.

biography of Edward Snowden.”
                                                                                                       Need we say more?




54                                                              www.linuxvoice.com
                                                                                                                    REVIEWS BOOKS


Jaquard’s Web: How a hand loom led to                                                             ALSO RELEASED…
the birth of the information age
19th century programmable clothing? Ben Everard is intrigued.



T
         here was one interface that
         remained virtually unchanged
         from before Charles Babbage
designed the Analytical Engine to well into
the 1960’s: punched cards.                                                                                                   Curiosity has spent
   These were first used by innovative                                                                                       over a Martian year
weaver Joseph-Marie Jaquard to improve                                                                                       (687 Earth days) on
                                                                               Don’t be fooled                               its new home .
the speed at which silk could be woven
                                                                               by the cover
into designs. These looms inspired                                                                Mars Rover Curiosity
                                                                               – surprisingly
Babbage in his ultimately futile quest                                         little of this     If you’ve built Ben’s ice cream carton robot
to build a mechanical computer, they                                           book is actually   from issue 4, and you’re looking for a new
were instrumental in the pre-computer                                          about weaving      challenge, this book is going to provide the
                                                                                                  perfect insight. Written by Curiosity’s Chief
calculation machines, and they were                                            clothes.
                                                                                                  Engineer and endorsed by Buzz Aldrin, it’s got
considered essential components in                                                                to be a must read.
almost all early computers.                      LINUX VOICE VERDICT
   Essinger follows this narrative and           Author James Essinger
encourages us to follow the links from           Publisher OUP Oxford
looms that weave silk to machines                ISBN 978-0192805782
                                                 Price £9
that weave information. Overall, it’s an
                                                 A slightly unusual angle that forces us to
enjoyable read, and even people with quite       think about the data rather than the machine.
a bit of knowledge of computing history
will probably learn something from it.                                                                                            The 2nd
                                                                                                                                  edition dumps
                                                                                                                                  Bukkit in

Metasploit: The Penetration
                                                                                                                                  favour of the
                                                                                                                                  CanaryMod
                                                                                                                                  library
Tester’s Guide                                                                                    Learn to program with Minecraft
Ben Everard learns how to exploit computers using PDF files.                                      Kids love Minecraft. It’s amazing. This second
                                                                                                  edition of a proven child-friendly title promises



A
                                                                                                  that no prior coding experience is necessary,
           nyone interested in computer                                                           and that your firstborn will soon be creating
           security will have come across                                                         flaming cows, flying creepers, teleportation,
           Metasploit. It’s a framework that                                                      and interactivity.
can help with just about every aspect
of penetration testing from information
gathering to post exploit work. However, to
                                                                             HD Moore – the
do all this, it has become quite a complex
                                                                             founder of the
beast. Learning to use Metasploit is more
                                                                             Metasploit
like learning to use a new programming                                       project –
language than learning to use most other                                     endorses this
applications.                                                                book in the                                          SVG is a long
   Metasploit: The Penetration Tester’s Guide                                forward.                                             way from the
is well titled: it’s a guide to Metasploit for                                                                                    turtle graphics
penetration testers. It isn’t written for                                                                                         we cut our
                                                 LINUX VOICE VERDICT                                                              teeth on.
people with no pen testing experience,
                                                 Author David Kennedy, Jim O’Gorman, Devon
but it does start at quite a basic level and     Kearns and Mati Aharoni                          SVG Essentials
while it assumes the reader understands          Publisher No Starch Press                        SVG is about more than being a scalable image
                                                 ISBN 978-1593272883
basic principals about how computers                                                              format. It can be used for animations, charts,
                                                 Price £32.50
and networks work, it doesn’t assume any                                                          web design and includes transforms and
                                                 A great introduction to the software, but        gradient, all from its text-based XML. This is a
prior experience with Metasploit. It’s a very    you’ll need some knowledge of penetration        book aimed at designers that doesn’t ignore
practical book, and a large proportion is        testing to get the most out of it.
                                                                                                  the complex stuff, making your output visually
taken up with code examples that are well                                                         and functionally more powerful.
annotated and explained.



                                                              www.linuxvoice.com                                                                    55
     GROUP TEST LIGHTWEIGHT DISTROS




     LIGHTWEIGHT
         DISTROS
                     GROUP TEST
                      Mayank Sharma is on the lookout for distros tailor made to infuse
                      life into his ageing computers.



 On Test                                                       Lightweight distros
                                                               T
                                                                         here has always been a            some text editing, and watch some
 Linux Lite                                                              demand for lightweight            videos. These users don’t need
              URL www.linuxliteos.com                                    alternatives both for             the latest multi-core machines
              VERSION 2.0                                      individual apps and for complete            loaded with several gigabytes of
              DESKTOP Xfce                                     distributions. But the recent advent        RAM or even a dedicated graphics
              Does the second version of the distro            of feature-rich resource-hungry             card. However, chances are their
              does enough to justify its title?
                                                               software has reinvigorated efforts          hardware isn’t supported by the
                                                               to put those old, otherwise obsolete        latest kernel, which keeps dropping
 WattOS                                                        machines to good use.                       support for older hardware that is
              URL www.planetwatt.com                              For a long time the primary              no longer in vogue, such as dial-up
              VERSION R8                                       migrators to Linux were people              modems. Back in 2012, support
              DESKTOP LXDE, Mate, Openbox                      who had fallen prey to the easily           for the i386 chip was dropped from
              Has switching the base distro from               exploitable nature of proprietary           the kernel and some distros, like
              Ubuntu to Debian made any difference?            operating systems. Of late though           CentOS, have gone one step ahead
                                                               we’re getting a whole new set of            and dropped support for the 32-bit
 SparkyLinux                                                   users who come along with their
                                                               healthy and functional computers
                                                                                                           architecture entirely.

              URL www.sparkylinux.org
              VERSION 3.5
                                                               that just can’t power the newer             New life
              DESKTOP LXDE, Mate, Xfce and others              release of Windows.                         In addition to pruning the resource
              Multiple flavours with different desktops           Plenty of hardware is good               requirements of mainstream
              – is there one for you?                          enough to run the mainstream                software, a large number of open
                                                               Linux distros without any issues.           source developers are working to
                                                               However, the modern Linux desktop           make obsolete hardware usable
 LXLE                                                          is a fairly resource hungry beast           again. There are lightweight apps
              URL www.lxle.net                                 as well, and your hardware might            that consume a fraction of the
              VERSION 14.04                                    not have enough juice to power              resources of their full-featured
              DESKTOPLXDE
                                                               Unity or Gnome 3. In addition to            alternatives and distros that
              What can this Lubuntu-based distro do
                                                               users who have hardware that’s              perform blazingly well on low-spec
              that its parent cannot?
                                                               been outdated fairly recently, there’s      machines. In this group test we
                                                               another kind who are holding on             look at some of the best distros
 TinyCore                                                      to their workhorses from the last           that are designed from the grounds
              URL www.tinycorelinux.net                        decade. They usually just use their         up to use the meagre hardware
              VERSION 5.4                                      computer to browse the web, do              resources on dated computers.
              DESKTOP FLWM
              Will it live up to its name?                       DATING HARDWARE
                                                                 Defining hardware as “older” is tricky.   onboard graphics. A couple of years
                                                                 New software is always levering on the    ago, mainstream distros would perform
 Slacko Puppy                                                    pace of hardware developments and         adequately on these machines, but not
                                                                 rendering even relatively newer           anymore. Nowaday, you need special
              URL www.puppylinux.org
                                                                 hardware obsolete. Examples of these      purpose distros to make good use of
              VERSION 5.7                                        relatively recent attic-ready hardware    such hardware. We tested these distros
              DESKTOPJWM                                         would be single-core or dual-core AMD     on a 1.6GHz Intel Atom netbook with
              It’s the leading distro for old computers,         Athlons and Intel Pentiums with about     1GB of RAM and on a dual-core 2.1GHz
              but can it win this challenge as well?             1GB of RAM that they share with           laptop with 2GB of RAM.




56                                                         www.linuxvoice.com
                                                                                     LIGHTWEIGHT DISTROS GROUP TEST



Lightweight alternatives
T
         here are two things that are              developed. Other featherweight contenders         than Unity, Gnome 3 and KDE 4. LXDE and
         common to every lightweight distro        include the Midori web browser, Xpdf PDF          Xfce are two of the popular options that are
         -- a lightweight desktop environment      viewer, Fotoxx image editor, CMPlayer media       used by many distros. There’s also Mate,
and/or lightweight apps. There are                 player, and App Grid software centre, among       which is a continuation of Gnome 2. Then
lightweight alternatives for every type of         others. Some distros, most notably Puppy          there’s Enlightenment, which includes some
software. Office apps, such as the AbiWord         Linux, also replace the stock apps with           bling as well. Some distros, instead of using
word processors and the Gnumeric                   custom ones optimised for the minimal             a full-fledged desktop environment, just use
spreadsheet, are a popular replacement for         environment they are running under.               window managers such as Openbox. Other
mainstream full fledged suites like                   Similarly, there are also desktop              lighter but esoteric window manager are
LibreOffice and Calligra and are still being       environments that are lighter on resources        IceWM, Fluxbox, FVWM, and JWM.




WattOS R8
Desktop computing for cheap.


F
        or a long time WattOS delivered the
        goodness of Ubuntu to low-powered
        machines. However, the distro has
now switched to Debian and is based on the
current stable Wheezy branch. It’s available
in three flavours: there’s one with the Mate
desktop and another with LXDE, which both
weigh in at around 800MB. There’s also an
even lighter Microwatt edition.
   Being based on Debian, installation duties
are handled by Debian’s graphical installer,
which is pretty simple and straightforward.
The WattOS developers have modified the
installer with tips borrowed from the LMDE
and Point Linux projects, but it still isn’t as
intuitive as Ubuntu’s Ubiquity installer, with a
manual partitioning step that might confuse
new users. Once installed the distro
occupies about 3GB of hard disk space.
   Both the LXDE and the Mate flavours ship
with the Iceweasel browser, which is Debian’s
trademark-stripped fork of the Firefox
browser. Both flavours also include the            The distro also includes power management utilities like PowerTOP to optimise power consumption.
Shotwell image organiser, FileZilla FTP,
Transmission BitTorrent client, Audacious             Both distros were quick off the blocks and     sports the conky system monitor and a
audio player and Xfburn media burner. The          we got to the desktops pretty quickly with        simple panel at the bottom of the screen
LXDE flavour also includes the VLC media           Mate leading LXDE by a good 10 seconds.           that houses open windows.
player, which is oddly missing from the Mate       Once loaded though LXDE took up about                The developers have done a wonderful job
version.                                           100MB less RAM than the fast-booting              in picking up the right apps that don’t gorge
                                                   Mate. App launch times were fairly similar        on resources and don’t compromise
Missing in action                                  and both flavours performed as advertised.        usability as well. While the distro might be
One app that was conspicuous by its                Even after several hours their memory             designed for older computers, we wouldn’t
absence was an office suite. All you have are      footprints remained impressively low.             shy away from recommending it as a lighter
basic text editors -- Mate has Pluma and              If you want something lighter still, there’s   Debian alternative for regular use.
LXDE has Leafpad, and these are both quite         the Microwatt edition. Instead of a full-
stripped down. On the upside though you            fledged desktop manager, this flavour uses a       VERDICT
                                                                                                      A wonderful distro that
have the full Debian repository at your            customised Openbox window manager in               could put a spring in the
disposal that you can install additional apps      place of the PekWM window manager in               step of any computer.
from via the Synaptic package manager.             earlier versions. The bare-minimum desktop



                                                               www.linuxvoice.com                                                              57
     GROUP TEST LIGHTWEIGHT DISTROS


Linux Lite 2.0
Can lite be right?


T
         he Linux Lite distro is based on     (it’s also preconfigured here to connect
         Xubuntu 14.04 LTS, which             to the LinuxDistroCommunity.com’s
         brings along two very important      Mumble server, so you can engage with
components -- Xfce 4.11 and the               other community users immediately.
excellent and easy-to-handle Ubiquity             Another unique aspect of the distro is
installer. One of the first things you’ll     its collection of well-designed scripts to   Linux Lite is wonderfully stocked for everyday use, but this
notice after installation is the distro’s     add and remove programs. The Install         comes at the cost of relatively sluggish performance.
beautiful login manager followed by the       Additional Software script gives a list
aesthetically pleasing all-white theme.       of 25 apps, including Google Chrome                         Ubuntu 14.04’s official repository as
The desktop is clean and uses the Xfce        and Chromium browsers, Google Talk                          well as several PPAs. This is also the
desktop’s Whisker menu. The                   Browser Plugin to video chat via Google                     first release which uses the Linux
developers have tweaked the desktop,          Hangouts, Dropbox, Netflix, Skype, Wine,                    Lite’s own repositories for managing
and the right-click menu includes             PlayonLinux, and more. There’s also a                       its custom apps. One of these custom
options to create shortcuts, launch the       corresponding Remove Software script                        apps, the Lite User Manager, helps make
task manager, and take screenshots.           that’ll remove any software installed                       managing accounts a little easier for
  At first glance, Linux Lite looks and       using the previous script.                                  new users to comprehend. New users
feels like a regular heavy-duty distro.           There’s also the Synaptic package                       will also appreciate the bundled support
The list of pre-installed apps doesn’t        manager and the distro is tuned into                        and help manual.
include any of the traditional lightweight
apps and is instead brimming with the
usual suspects such as Gimp, Firefox,
                                              “One unique aspect of Linux                                   VERDICT
                                                                                                            A good distro for

VLC and LibreOffice. There’s also the         Lite is its collection of scripts                             someone who’s new to
                                                                                                            Linux, but not necessarily
Mumble open-source VoIP software
that’s often compared with TeamSpeak
                                              to add and remove programs.”                                  lite.




LXLE 14.04
Luxuriously light.


T
         here’s a lot of similarity between   as its terminal emulator rather than
         Linux Lite and LXLE. Both are        Lubuntu’s LXTerm.
         based on the latest Ubuntu              The distro is overflowing with apps.
14.04 LTS release and neither include         Besides the usual apps such as Gimp,
any of the usual lightweight apps,            Shotwell, Claws email, FileZilla, Pidgin,
instead relying on their desktops. In that    Transmission, LibreOffice, there are         The distro includes a whopping 100 wallpapers, and you
aspect, LXLE, which is based on               several unusual ones like KeePassX,          can cycle through them with a button in the bottom panel.
Lubuntu and uses the LXDE desktop             Marble, Anki memory training, Simple
scores over Linux Lite by trimming            Image Reducer, BitTorrent Sync, Gitso                       includes both the Lubuntu Software
almost 10 seconds of the latter’s boot        VNC, Linphone, Homebank, Osmo, FB                           Center, which is LXDE’s answer to the
time. However, installing LXLE takes a        Reader ebook reader, BleachBit, Florence                    Ubuntu Software Center, as well as
lot longer than other distros. But that       Virtual Keyboard, and the GSpeaker                          Synaptic. Both are configured to fetch
isn’t a surprise considering it installs      frontend for espeak.                                        packages from the official Ubuntu
almost 2,000 packages.                           In stark contrast to many of its                         repos and several other PPAs. LXLE
   The desktop is a pretty standard           peers, the distro also includes several                     also includes a graphical PPA manager
LXDE affair. It includes a panel at the       multimedia apps such as Audacity,                           using which you can add and manage
bottom and a Unity-like launcher on           Arista transcoder, the Openshot video                       additional PPAs.
the left that reveals itself when you         editor and Minitube for watching
mouse-over that part of the desktop.          YouTube videos on the desktop.                                VERDICT
Some important information about the          Another pleasant surprise is the                              Despite its long list of
                                                                                                            apps, the distro performs
system is also displayed on the desktop       inclusion of several games, from simple                       well on hardware with
via the Conky system monitor. However,        card games to the Steam client. For                           limited resources.

the distro uses the malleable ROXTerm         package management, the distro



58                                                             www.linuxvoice.com
                                                                                   LIGHTWEIGHT DISTROS GROUP TEST


SparkyLinux 3.5                                                                               Other options
Give your computer a jump start.
                                                                                              The low-fat graphical options
                                                                                              that aren’t necessarily aimed
                                                                                              at older hardware


                                                                                              T
                                                                                                       here are several other distros that use
                                                                                                       the lightweight desktops that are often
                                                                                                       included on the distros we’ve tested
                                                                                              here, not because of their size benefits, but for
                                                                                              their similarity to the classic desktop
                                                                                              metaphor, such as the Mate-powered
                                                                                              Debian-based Point Linux.
                                                                                                 Another lightweight distro is Elementary
                                                                                              OS, which uses its own custom desktop
                                                                                              environment along with a host of other
                                                                                              custom tools, and is popular for its Mac
                                                                                              OS X-like look and feel. However, the distro
                                                                                              is designed primarily as a replacement for
SparkyLinux includes the SparkyCenter settings manager to house its custom apps.              Windows and Mac, and wouldn’t perform well
                                                                                              on dated hardware.



U
           nlike other Debian-based distros        Being based on Debian, the distro also        Some distros – most notably Ubuntu
           in this group test, SparkyLinux is   includes Debian’s forked trademark-free       – have official spins based on LXDE and
           based on the distro’s testing        version of Firefox and Thunderbird, namely    Xfce, namely Lubuntu and Xubuntu, that are
branch (called Jessie) and also borrows         IceWeasel and IceDove. The browser is         designed for hardware that doesn’t have the
Debian’s installer. SparkyLinux is available    equipped with plugins to handle all kinds     power to run the main edition. There’s also
in several flavours, each based on a            of content including Flash, QuickTime,        Trisquel Mini (a cut-down version of Trisquel,
separate lightweight desktop                    DivX, RealPlayer and more.                    the distro made entirely with free software –
environment. While the size of the ISO                                                        even the non-free elements of the Linux kernel
image and the number of installed               Shiny desktops                                have been removed) for the free software
packages vary from one flavour to               The Enlightenment flavour uses the latest     purists, and VectorLinux Light, which uses
another, installing them all took longer        E19 desktop. However, the live                JWM and Fluxbox. Another distro that uses
than the other distros in this group test.      environment performed terribly on the         Fluxbox is the Debian-based AntiX, which also
   Another common factor between all            netbook and took aeons to install. Even       relies heavily on custom tools.
the SparkyLinux flavours is its collection      afterwards moving the mouse wasn’t               The SliTaz distro also uses a bunch of
of custom apps. There’s the SparkyAPTus         smooth and animations were jerky; so, the     custom tools but needs to be configured and
app, which is a simple front-end to the         Mate, LXDE, and Xfce flavours are the         set up before it can be used as a functional
command line apt-get and dpkg tools.            distro’s leading contenders. You can use      desktop. Finally, there’s Porteus, which
You can use this tool to edit the package       them in various languages and they all        is primarily designed for installation on
repositories, install and remove apps and       have a similar looking desktop with the       removable mediums like USB disks and CDs,
upgrade the whole system with a single          Conky system monitor and the Wbar quick-      but can also be installed on to a hard disk. The
click. SparkyAPTus Extra is a new app with      launch dock at the bottom.                    distro is small because of its modular nature
which you can install popular apps such            The distros are also loaded with           and incredibly fast since it runs from the RAM,
as Dropbox, Skype, Steam, Tor Browser, and      apps including LibreOffice, PlayonLinux,      but it does involve a learning curve.
more with a single-click.                       Gimp, Camorama webcam, Hotot Twitter
   The distro also includes custom apps         client, gFTP, Pidgin, Gnome MPlayer,
to back up and restore app settings.            RecordMyDesktop screencaster, VLC media
All you have to do is select the app            and more. For system admins there’s
whose settings you wish to you wish to          GParted, Boot Repair, a graphical front end
back up, and the app saves them in a            to manage systemd and a graphical front
compressed archive. You can then use            end to install windows wireless drivers via
the complementary Restore app to point          Ndiswrapper and the Gufw firewall.
to this archive to restore the settings.
There’s also an app to securely and              VERDICT
permanently delete files, a Wine wrapper         Performs admirably well
                                                 on resource-deprived
to install Windows .exe files, a manager         computers despite its                        Check out PepperMint Linux if your bandwidth is
for the Conky system monitor and tools to        gamut of apps.                               good enough that you can live off web apps.
manage users and passwords.



                                                                www.linuxvoice.com                                                          59
     GROUP TEST LIGHTWEIGHT DISTROS


TinyCore 5.4 vs Puppy Linux 5.7
The most esoteric distros of the lot.


T
          hese two distros are arguably          intuitive in the business. You’ll also have
          our first choice for powering          to browse through its documentation
          computers that are light on            to familiarise yourself with the distro’s
resources. However, both distros are             peculiarities, irrespective of your
designed for advanced users, TinyCore            experience with Linux.
more so than Puppy. Also, while both
distros will revive literally any computer,      Puppy Linux
their approach to addressing the                 Puppy Linux’s approach is in stark
problem is different.                            contrast to TinyCore. The project
   TinyCore’s sole developer, Robert             currently has three official versions.
Shingledecker was earlier involved               There’s Wary Puppy, which is designed
with the once-popular but now-                   especially for older hardware, followed
dormant Damn Small Linux project.                by Lucid Puppy, which is built from           TinyCore includes a remaster tool with which you can
The distro is available in three flavours.       Ubuntu’s binary packages; and Slacko          create your own remix of the distro.
There’s a miniscule 9MB core edition             Puppy, built from Slackware. Slacko is
designed for servers, followed by                the recommended distro and the                               can perform with a desktop computer.
the recommended TinyCore edition                 current 5.7 is built on of Slackware 14.                     However, most of these are Slacko’s
that weighs in at 15MB, and a 72MB                  Instead of a full-fledged desktop                         own custom apps instead of the
CorePlus edition that has additional             manager, Slacko uses JWM, which                              popular ones that users are familiar
drivers for wireless cards, a remastering        is one of the lightest window                                with. Slacko has all kinds of multimedia
tool and internationalisation support.           managers. Installation is handled                            apps include graphics viewers and
   True to its name, TinyCore bundles            by Puppy’s custom installer, which                           creators and apps to playback, edit and
just a terminal, a text editor, and an           is well documented but has enough                            even create multimedia. Furthermore
app launcher on top of the light-                peculiarities to intimidate first-time                       there are apps to block website ads
weight FLWM window manager. It                   users. For starters it lacks any                             and for internet telephony, a podcast
has a control panel to manage bootup             automated partitioning tool and                              grabber, a secure downloader, a DVD
services and configure the launcher.             instead fires up GParted for the user to                     burning app and lots more. The distro
If you need anything else, you’ll have           manually format the disk.
to pull it in using the distro’s package
manager, including the installer if you
                                                    To its credit though, GParted is very
                                                 verbose and each step has enough              “There’s no beating Puppy
want to install the distro full-time on to       documentation for the user to carry           Linux Slacko for out-of-the
                                                                                               box functionality.”
your hard disk.                                  out the task at hand. Also, once the
   Due to its minuscule size, TinyCore           installation has completed, users will
boots blisteringly quickly. But the              have to manually invoke a tool to install
distro’s stellar performance comes at            the Grub bootloader.                                         ships with several multimedia players,
the price of usability. For starters, you’ll        There’s no beating Puppy for out-                         including Gnome MPlayer, to play all
be spending quite a lot of time with its         of-the-box functionality and there’s an                      sorts of media formats. The included
package manager, which isn’t the most            app for virtually every task that you                        Firefox browser is equipped with all
                                                                                                              kinds of plugins and the distro also has
                                                                                                              a custom app to download and install
                                                                                                              the Flash plugin.
                                                                                                                 Puppy also scores for its ample
                                                                                                              documentation. Slacko bundles help
                                                                                                              documentation on several topics
                                                                                                              such as working with Microsoft Office
                                                                                                              files, how to add codecs, software
                                                                                                              and more and contains links to the
                                                                                                              documentation pages for most of the
                                                                                                              apps in its menus.

                                                                                                               VERDICT
                                                                                                               TinyCore: Ideal for all   Slacko Puppy: One of
                                                                                                               kinds of hardware but     the lightest around, but
                                                                                                               setting it up is an       loses out for relying on
                                                                                                               involved process.         its custom apps.

Puppy is very explicit in its instructions and verbose in its output.


60                                                                 www.linuxvoice.com
                                                                                             LIGHTWEIGHT DISTROS GROUP TEST




  OUR VERDICT
                                                                                            1st Sparky Linux 3.5 Mate
                                                                                            Version 2.0

                                                                                            www.sparkylinux.org
                                                                                            The perfect balance of speed and functionality in this Mate
                                                                                            powered distros that’s chock-full of apps.


Lightweight distros                                                                         2nd LXLE 14.04
                                                                                            Version R8



I
     f this were a group test of         which is almost twice that of                      www.lxle.net
     distros specifically for older      the winner. However, if you have                   A close second to Sparky Linux and the best lightweight distro
     hardware, then Slacko Puppy         the RAM to spare, then LXLE is                     based on the LXDE desktop.
would have been top dog followed         our favourite LXDE-based distro
by TinyCore, which is lighter but has    around and it’s even faster than
a more involved setup process.           SparkLinux’s LXDE flavour.                         3rd Linux Lite 2.0
However, the real test of a                                                                 Version 3.5
lightweight distro is on a machine       Sparktastic
                                                                                            www.linuxliteos.com
that’s not necessarily old, just not     SparkyLinux is available in a
                                                                                            The distro works well to free up resources on newer machines
adequately stacked. This is why we       number of editions with almost                     but doesn’t feel comfortable on older ones.
rated the distros based on their         every lightweight desktop
performance on the dual-core             environment and window manager.
netbook, and the table below             But the performance varies greatly                 4th WattOS R8
reflects numbers as measured on          between its various editions. The                  Version 14.04
this computer.                           Enlightenment edition is fastest but
    WattOS Mate edition was quick        lacks any real apps, and also felt                 www.planetwatt.com
                                                                                            The Mate edition of this distro boots faster than all others but
off the blocks, but lacked any           lethargic, much like the Xfce flavour.
                                                                                            lacks any meaningful apps.
useful apps. The LXDE edition of         The mouse movement on both
the distro does include VLC but          editions was jerky, and navigating
loses snappiness. We’ve rated            through the menus wasn’t smooth                    5th Slacko Puppy 5.7
it lower than the slow-starting          with the sub-menus revealing                       Version 5.4
LinuxLite because at least the latter    themselves only after a brief pause.
welcomes the user to a much                 The Mate and LXDE editions                      www.puppylinux.org
richer desktop experience. In fact,      were very usable and highly                        Our favourite distro for revising older computers, but it loses
                                                                                            out in this challenge for its reliance on its custom apps.
LinuxLite would be a good distro to      recommended. On these editions,
introduce new users to Linux.            you could further trim the boot
    This group test would have easily    times by tweaking some defaults,                   6th TinyCore 5.4
been won by LinuxLite. It’s one          like disabling the Wbar panel at the               Version 5.7
of the fastest distros and loads         bottom. Even without any tweaks,
to a very usable desktop straight        the Mate edition of the distro offers              www.tinycorelinux.net
out of the box. But it loses out to      the right compromise between boot                  The lightest Linux distribution of them all, it loses out for its
                                                                                            involved setup process.
SparkyLinux despite being faster         times, memory footprint and pre-
because of its memory usage,             installed apps.

                           Boot time    Used memory         Total Packages   Desktop Environment   Package Management        Office Suite         Multimedia app

Linux Lite 2.0                41.2s      501 MB       1389                   Xfce 4.11               Synaptic               LibreOffice           VLC

WattOS R8 Mate                14.6s      332 MB       1125                   Mate 1.8                Synaptic               None                  None

WattOS R8 LXDE                23.4s      231 MB       1118                   LXDE 0.5.5              Synaptic               None                  VLC

LXLE 14.04                    34.5s      775 MB       1931                   LXDE 0.5.6              Synaptic               LibreOffice           Several

Tiny Core 5.4                 7.5s       46 MB        ---                    FLWM                    Custom                 None                  None

Slacko Puppy 5.7              17.2s      112 MB       333                    JWM                     Custom                 AbiWord, Gnumeric     Gnome Mplayer

Sparky Linux 3.5 e19          31.6s      285 MB       1267                   Enligtenment e19        Synaptic               None                  None

Sparky Linux 3.5 Mate         37.2s      357 MB       1894                   Mate 1.8                Synaptic               LibreOffice           Several

Sparky Linux 3.5 LXDE         41.3s      342 MB       1994                   LXDE 0.5.5              Synaptic               LibreOffice           Several

Sparky Linux 3.5 Xfce         38.2s      418 MB       2019                   Xfce 4.10               Synaptic               LibreOffice           Several




                                                                      www.linuxvoice.com                                                                           61
     SUBSCRIBE




SUBSCRIBE              shop.linuxvoice.com
                                                                        Introducing Linux Voice,
                                                                        the magazine that:
                                                                          Gives 50% of its profits
                                                                        back to Free Software
                                                                          Licenses its content
                                                                        CC-BY-SA within 9 months

                                                                        12-month subs prices
                                                                        UK – £55
                                                                        Europe – £85
                                                                        US/Canada – £95
                                                                        ROW – £99

                                                                        7-month subs prices                               DIGITAL
                                                                        UK – £38                                          SUBSCRIPTION
                                                                        Europe – £53
                                                                        US/Canada – £57
                                                                                                                          ONLY £38
                                                                        ROW – £60


         Get 116 pages                                     Access our                                         Save money on
          of tutorials,                                  rapidly growing                                       the shop price
      features, interviews                            back-issues archive                                    and get each issue
          and reviews                                 – all DRM-free and                                        delivered to
          every month                                  ready to download                                         your door

               Payment is in Pounds Sterling. 12-month subscribers will receive 12 issues of Linux Voice a year. 7-month
            subscribers will receive 7 issue of Linux Voice. If you are dissatisfied in any way you can write to us to cancel your
                      subscription at subscriptions@linuxvoice.com and we will refund you for all unmailed issues.



62                                                         www.linuxvoice.com
                                                                                                                                         NEXT MONTH



                                 NEXT MONTH IN



ON SALE                                                                                   EVEN MORE AWESOME!
 THURSDAY                                                                                                                                   Samba 4
18 DECEMBER                                                                                                                                 Now the power of
                                                                                                                                            Microsoft’s Active
                                                                                                                                            Directory can be
                                                                                                                                            yours to command,
                                                                                                                                            as Linux admins,
                                                                                                                                            finally, can use it at
                                                                                                                                            work with Windows
                                                                                                                                            admin accounts.

                                                                                                                                            Scribus
                                                                                                                                            This free software
                                                                                                                                            tool is a superb
                                                                                                                                            design application,
                                                                                                                                            but how well can it
                                                                                                                                            integrate with a
                                                                                                                                            proprietary software
                                                                                                                                            workflow?



                                                                                                                                            Picademy

FREEDOM ISN’T FREE                                                                                                                          Our mole at the
                                                                                                                                            Raspberry Pi
                                                                                                                                            Foundation has
We take it for granted that Free Software is                                                                                                revealed something
                                                                                                                                            amazing: they’re
important – well, we shouldn’t. This is our                                                                                                 teaching IT teachers
manifesto. This is what we believe.                                                                                                         how to teach IT!
                                                                                                                                            Imagine that!




       LINUX VOICE IS BROUGHT TO YOU BY
Editor Graham Morrison           Editorial consultant Nick Veitch                through the use of advice in this magazine.   Copyright Linux is a trademark of Linus
graham@linuxvoice.com            nick@linuxvoice.com                             Experiment with Linux at your own risk!       Torvalds, and is used with permission.
Deputy editor Andrew Gregory                                                     Distributed by Marketforce (UK) Ltd, Blue     Anything in this magazine may not be
andrew@linuxvoice.com            All code printed in this magazine is licensed   Fin Building, 110 Southwark Street, London,   reproduced without permission of the editor,
Technical editor Ben Everard     under the GNU GPLv3                             SE1 0SU                                       until June 2015 when all content (including
ben@linuxvoice.com                                                               Tel: +44 (0) 20 3148 3300                     images) is re-licensed CC-BY-SA.
Editor at large Mike Saunders    Printed in the UK by                                                                          ©Linux Voice Ltd 2014
mike@linuxvoice.com              Acorn Web Offset Ltd                            Circulation Marketing by Intermedia Brand     ISSN 2054-3778
Creative director Stacey Black                                                   Marketing Ltd, registered office North Quay
stacey@linuxvoice.com            Disclaimer We accept no liability for any       House, Sutton Harbour, Plymouth PL4 0RA       Subscribe: shop.linuxvoice.com
                                 loss of data or damage to your hardware         Tel: 01737 852166                             subscriptions@linuxvoice.com

                                                                    www.linuxvoice.com
      CORETECHNOLOGY




                                  CORE
A veteran Unix and Linux
enthusiast, Chris Brown has
written and delivered open
source training from New Delhi
to San Francisco, though not on
                                  TECHNOLOGY
the same day.                     Prise the back off Linux and find out what really makes it tick.

Access control
Get to grips with file access controls in Linux as we take “rwx” to the max.


C
          heck into a hotel, and the chances             In my list, items 2 and 3 are implemented                 meaning of these three permissions as
          are you’ll get a little plastic card. Take   by rules in userspace (ie within the code of                applied to files and directories. The meaning
          the lift to your room, slot the card in      the server itself), whereas items 1 and 4 rely              of the execute bit, in particular, is totally
the door, and either it will let you in or you will    on decision-making code in the kernel.                      different for files and directories. You should
have to retrace your steps to the check-in               It’s the bottom layer (item 4 – file access               also notice that you need to have both read
desk to get a new card. That’s access                  control) that I want to focus on here. The                  and execute permission to have any sort of
control. Within an operating system, it can            detail of how this works is a well-travelled                useful access to a directory, and they
be applied at various points. Consider the             road and probably familiar to you. But I’ll try             invariably go together; you are very unlikely
common scenario of browsing to a website               to turn over a few stones along the way that                to come across a directory that has one but
that’s delivered by a LAMP stack. Access               you haven’t looked underneath before.                       not the other.
controls are applied at several places in the                                                                         This is pretty basic stuff. “Sure”, I hear you
data path:                                             Burn after reading                                          say. “I knew all that”. But do you really
 1 Packet filtering rules in the Linux kernel          A good place to start is by examining a                     understand how it works? Consider this:
   can block incoming traffic except to a few          couple of lines from ls -l:                                 $ ls -l test
   favoured ports, or from a favoured IP               # ls -ld /home/chris /etc/shadow                            -r--rw-rw- 1 chris chris 0 Sep 19 16:10 test
   address range perhaps.                              -rw-r----- 1 root shadow 1284 Sep 29 13:51 /etc/              My question is, can I (chris) as the owner
 2 The Apache web server can apply access              shadow                                                      of the file, write to it? Before you read on,
   controls based on directives in its config          drwxr-xr-x 93 chris chris 4096 Sep 29 12:08 /home/          have a guess!
   file. For example, “allow from” and “deny           chris                                                         Then try this:
   from” rules control access based on the               The first field of the line includes the                  $ echo hello > test
   client machine identity, and it also                classic nine permission bits, the third and                 bash: test: Permission denied
   supports user logins to restrict access to          fourth fields show the owner and group of                      …which will convince you that you can’t. It
   parts of the site to specific authenticated         the file. The table ‘rwx explained’ shows the               is tempting to think that because members
   users. Many servers such as Samba and
   Postfix can impose similar rules.
 3 The PHP code on a web page queries a
                                                         Create a shared directory
   back-end database, probably MySQL. Here               Our mission here is to create a directory that can          Now make sure that andrew and graham are
   again, there’s a need to authenticate, and            be used as a shared read/write resource by two            members of the group (we assume they already
   there’s a fine-grained set of privileges              users: andrew and graham. We will accomplish              have accounts):
                                                         this by making them both members of the group             # usermod -a -G editors andrew
   defined in MySQL’s grant tables.                      “editors”, and the directory will be /home/editors.       # usermod -a -G editors graham
 4 Underneath it all, we have the Linux
                                                            First, create the group:                                  Finally, establish a umask of 007 for andrew and
   filesystem. Again, access control decisions           # groupadd editors                                        graham by adding a line:
   are made based on the file’s ownership                   Now create the directory and set its group. Then       umask 007
   and permissions, and on the identity of the           set its setgid bit so that files created here will have   in the ~/.profile file of the two users. This will
                                                         the group “editors”:                                      ensure that files they create are accessible by the
   process attempting the access.                        # mkdir /home/editors                                     group but not by others. Allowing the files they
   Indeed, there are so many points along                # chgrp editors /home/editors                             create to be group writable is OK because outside
the way at which something might say “no”                # chmod g+ws,o-rwx /home/editors                          of /home/editors any files they will create will have
that it’s a miracle it ever works at all. And               It should now look like this:                          their regular primary group (andrew or graham)
don’t even get me started on the mandatory               # ls -ld /home/editors                                    and only the accounts andrew and graham will
                                                         drwxrws--- 2 root editors 4096 Sep 29 20:38 /home/        have membership of those groups. For more on
access control mechanisms like SELinux                   editors                                                   umask, see Command Of The Month.
and App Armor.



64                                                                   www.linuxvoice.com
                                                                                                                            CORETECHNOLOGY

of the file’s group (and for that matter
everyone else) have permission to write to              The rwx permissions: files vs directories
the file, then you should too. But it doesn’t             Permission           On a file                                       On a directory
work that way. If I am the owner of the file, I           r (read)             Read the file. (Make a copy of                  List the names of the files in a
see the first set of permissions. End of story.                                it, display it, compile it.)                    directory.
The tests are not applied in a hierarchical
way. In practice this situation almost never              w (write)            Write to the file. (Edit or                     Create file (links) in the
                                                                               append to it or copy over it.)                  directory, or remove them.
arises. It is very rare (and not particularly
useful) for the permissions to become                     x (execute)          Run the file as a command.                      Access the files in the directory,
more liberal as you move from left to right                                    (Applicable to compiled                         use the directory in a pathname.
(owner/group/other). It’s usually the other                                    programs or to scripts.)
way round.
   The other interesting question is “Can the
owner (chris) delete the file?” Have another          known as the “set user ID bit”, the “set group            the effective privileges of its owner – in this
guess, then try this:                                 ID bit”, and the “sticky bit” which are less well         case root. The program is said to run “setuid
$ rm temp1                                            understood. The “set user ID” bit (setuid to              to root”. As root, of course, it can do
rm: remove write-protected regular empty file         its friends) is probably the most interesting,            anything, including writing to the shadow
‘temp1’? yes                                          and by way of introducing it, consider these              file. Once the program terminates, you’re
$                                                     three facts:                                              back to your normal identity at the shell
    You will get a warning from rm about               1 Passwords in Linux are stored in a file                prompt. This mechanism lies at the heart of
deleting a file on which you don’t have write            called /etc/shadow. (Actually, it’s the                all “privilege escalation” events in Linux. It’s
permission, but if you answer ‘yes’ it will do           password hashes that get stored.)                      how commands like su and sudo work, for
it. The point is this: whether you can delete a        2 The shadow file is heavily protected                   example. It’s also used by programs like
file does not depend on the permissions on               -- ordinary users can neither read or write            ping, not because they need to elevate their
the file itself; it depends on the permissions           to it.                                                 access into the file system, but because
on the directory you’re trying to delete it from       3 Users can change their passwords                       they need to reach right down to the IP layer
(you need write permission). This is logical if          without administrative help.                           and construct unusual network packets,
you think about it – we’re not actually trying           So how does this work, exactly? The                    which only root processes can do.
to write to the file, we’re just trying to write to   following commands give us a clue:                           The setuid bit was invented by the late,
the directory (to remove the link). But in the        $ which passwd                                            great Dennis Ritchie while he was working
training classes I run I usually see a few            /usr/bin/passwd                                           for Bell Telephone Laboratories. They
raised eyebrows and wrinkled noses when I             $ ls -l /usr/bin/passwd                                   obtained a patent (US patent 4135240 –
explain this. The fact is, there is no “you can       -rwsr-xr-x 1 root root 47032 Feb 17 2014 /usr/bin/        look it up of you’re interested) though they
delete me” file permission in Linux.                  passwd                                                    never charged licensing fees and later
    The warning you receive from rm in this              The thing to notice is the s in the fourth             placed the invention into the public domain.
case is not characteristic Linux behaviour.           character position, where the x would                     Interestingly, the operation of setuid was
The usual philosophy of these commands is             normally be. This is the famous setuid bit.               explained on the patent by a diagram of
“if you asked to do it, and if you have               Let me explain.                                           logic gates and signals, it being unclear at
permission to do it, I’ll do it”. For example, if        If a file is executable, and it has the setuid         the time whether a software algorithm could
you have files foo and bar, neither of these          bit set, then while it is running it runs with            actually be patented.
commands will raise a query:
$ cp foo bar
$ mv foo bar                                                                   Firewall                 Access control                    Login and
even though both of them will result in the
                                                                                rules                     directives                   privilege grants
loss of the original file bar.
  The nine “rwx” mode bits on a file are well
known, but there are actually three more,                                                                        Apache                          MySQL
                                                                                                                  web                           database
                                                                                                                 server                          server
  Fool your boss!
  Do you have to contend with an insufferable
  Linux know-it-all at work? Would you like to
  outsmart them? Then try this:
  $ touch temp                                                                  File access
  $ chmod 7000 temp                                                             permissions
  $ ls -l temp
  ---S--S--T 1 chris chris 491 Jun 30 15:49 temp                                                                         Filesystem
    Ask them to do an ls -l on the file then
  explain the permissions. Of course, there’s a
  small risk that they’ll actually know, in which
  case they’ll become even more insufferable!         Linux applies access control at several points within a LAMP (Linux, Apache, MariaDB/MySQL,
                                                      PHP/Perl/Python) stack, some in the kernel and some in userspace.


                                                                      www.linuxvoice.com                                                                            65
     CORETECHNOLOGY


  Finding out who you are
  We can demonstrate the effect of the setuid bit with       No surprises here. 1000 is the UID of my regular        $ sudo u-s uiddemo
  a trivial C program using the getuid() and geteuid()     account. Now try this:                                       Now wrap the program in a tiny shell script
  system calls, which report on the real and effective     $ sudo chown root uiddemo                                 called uuidemo-bash like this:
  UID of the process respectively. Here’s the code:        $ sudo chmod u+s uiddemo                                  #!/bin/bash
  #include <stdio.h>                                       $ ls -l uiddemo                                           ./uiddemo
  main()                                                   -rwsrwxr-x 1 root chris 8620 Sep 28 18:52 uiddemo         and make the shell script itself run setuid to root:
  {                                                        $ ./uiddemo                                               $ sudo chown root uiddemo-bash
    printf(“Real ID = %d\n”, getuid());                    Real ID = 1000                                            $ sudo chmod u+s uiddemo-bash
    printf(“Effective ID = %d\n”, geteuid());              Effective ID = 0                                          $ ls -l uiddemo-bash
  }                                                           Now that the program is running setuid to root, it     -rwsrwxr-x 1 root chris 24 Sep 28 18:57 uiddemo-bash
    I won’t insult your intelligence by dissecting this!   reports an effective UID of zero, and at this point, it   $ ./uiddemo-bash
  Now compile and run it:                                  is all-powerful.                                          Real ID = 1000
  gcc uiddemo.c -o uiddemo                                    The setuid bit is not honoured on shell scripts. To    Effective ID = 1000
  $ ./uiddemo                                              demonstrate this, begin by resetting the ownership           The output shows clearly that the script is owned
  Real ID = 1000                                           and mode of uiddemo back to what it was:                  by root and has the setuid bit on; nonetheless, no
  Effective ID = 1000                                      $ sudo chown chris uiddemo                                privilege change has occurred.



   Programs that run setuid to root need to                system to keep it loaded in memory after                  format from ls -l to consider changing it
be coded with great care to avoid design                   use, thus speeding things up the next time it             now. The assumption is that the ‘x’ bit that’s
flaws, buffer overflows, or other                          was run. These days, a program’s code is                  underneath is set (for example it doesn’t
vulnerabilities which would put them at risk               paged in as part of the virtual memory                    make sense to set the setuid bit on a file if
of being subverted.                                        management, and the sticky bit’s original                 it’s not executable). If the underlying ‘x’ isn’t
   You can find all the setuid programs on                 role has long been redundant. It has,                     set, you’ll see an upper-case S or T instead
your system with the command:                              however, found an important retirement job                (see the box “Fool your boss!”) but you need
$ sudo find / -user root -perm +4000 -ls                   when applied to directories.                              to be pretty eagle-eyed to spot this.
  Hopefully, you shouldn’t find too many.                     As we have seen, you can delete any file if
And if you claim to be a security-conscious                you have write permission on the directory                The scoop on groups
system adminstrator, you really ought to be                you’re deleting it from. This doesn’t work too            Every user has a primary group. The primary
able to say what all of them are for.                      well for world-writable directories (/tmp is              group assigned to them when they log in is
  The “set group id” (setgid) bit is similar.              the obvious example; you may find a few                   taken from the fourth field of /etc/passwd.
Whilst the program is running, it runs with                others) because you would be able to delete               On many systems, adding a user account
the effective group of its owner. Again, find              other peoples’ files. The sticky bit changes              will, by default, add a new group with the
will locate these for you:                                 the rules so that you can only delete files               same name, so that each user has a
$ sudo find / -perm +2000 -ls                              that you own.                                             personal primary group that only they
   You’ll probably see quite a few                            The way that ls -l shows you these three               belong to.
administrative group ownerships showing                    extra bits (putting an s or t over the top of             However, it’s easy to create new groups and
up in this list. Running setuid is potentially             the ‘x’ bits) is confusing to say the least. It           assign a user any primary group of your
more dangerous than running setgid, and                    would have been better, perhaps, for ls to                choice when you create their account. A
running setuid to root is most dangerous of                squander three more character positions on                user can also have a number of secondary
all. But using setgid effectively takes more               the line to represent them explicitly, but I              group memberships. These are defined in
thought about setting file groups and                      guess there are too many scripts out there                /etc/group. For example, if you see this line
permissions. And sometimes setuid-to-root                  that make assumptions about the output                    in /etc/group:
is necessary to get the job done.
   The setgid bit has a totally different
meaning when applied to a directory.
                                                               Octal values
Normally, when a file is created, its group is
                                                                 4000     2000     1000    400      200       100     40       20         10      4        2         1
taken from the primary group of its creator.
However, if the file is being created in a                                                                            r w x r w x
directory that has the setgid bit set, the                      s g t                       r w x
group will be inherited from that of the
directory. (This obscure feature makes a                                                                                      Group                   “Rest of world”
wonderful Linux interview question, by the                                       sticky             Owner                  permissions                 permissions
way!) See the box Create A Shared Directory                                        bit           permissions
for an example of how to exploit this feature.
                                                                         setgid
The sticky bit                                                  setuid
In the very early days of Unix, the “sticky bit”
would be set on a frequently used
executable to encourage the operating                      Every file and directory carries these 12 access control bits; each can be identified by its octal value.



66                                                                       www.linuxvoice.com
                                                                                                                               CORETECHNOLOGY

editors:x:1002:andrew,graham
then andrew and graham have “editors” as a                The three “extra” mode bits -- less well known but very important
secondary group.                                            Permission            On a file                                       On a directory
  You can create a new group like this:                      s (setuid)          Run an executable file with                      Unused
$ sudo addgroup editors                                                          the effective user privilege of
Adding group `editors’ (GID 1002) ...                                            its owner
Done.
 And you can give a user secondary group                     g (getuid)          Run an executable file with                      Files created in this directory
                                                                                 the effective user privilege of                  will inherit their group from the
membership like this:
                                                                                 its group                                        group of the directory
$ sudo usermod -a -G editors andrew
   When a user creates a file, the file’s group              t (sticky bit)      Unused                                           Only allow users to delete files
is normally set to the user’s primary group                                                                                       from this directory if they own
(for an exception to this see the box Create A                                                                                    the file
Shared Directory). When a user accesses a
file that he’s not the owner of, if the file’s
group matches any of the user’s groups,                    This command starts a new shell with the                # gpasswd hackers
(primary or secondary) then he’ll see the               new primary group identity. (And by the way,               Changing the password for group hackers
group permissions on the file. In effect, you           newgrp runs setuid-to-root to allow it to do               New Password:
are “in” all your groups simultaneously.                this.) The following sequence of commands                  Re-enter new password:
                                                        shows newgrp in action. Assume andrew                        The password hashes are stored in
Move users around                                       has just logged in, and pay attention to the               /etc/gshadow, analogous to /etc/shadow
So for example, user andrew with primary                group of the files f1 and f2:                              for user passwords. Now, if andrew tries to
group “andrew” and secondary group                      $ touch /tmp/f1; ls -l /tmp/f1                             make hackers his primary group, although
“editors” will be able to read the file                 -rw-rw-r-- 1 andrew andrew 0 Sep 29 14:33 /tmp/f1          he’s not a member, he’ll succeed if he knows
/tmp/target with ownership and                          $ newgrp editors                                           the password:
permissions like this:                                  $ touch /tmp/f2; ls -l /tmp/f2                             $ newgrp hackers
$ ls -l /tmp/target                                     -rw-rw-r-- 1 andrew editors 0 Sep 29 14:33 /tmp/f2         Password:
-rw-r----- 1 root editors 24 Sep 29 13:47 /tmp/target     You can set a password on a group,                       $ id
  It’s also possible for a user to switch his           though hardly anyone uses this feature. If                 uid=1001(andrew) gid=1004(hackers) groups=1001(
primary group to be any of his secondary                you do, a user can make any group his                      andrew),1002(editors),1004(hackers)
                                                                                                                      Be aware, though, that telling someone
                                                                                                                   the password for a group is not the same as
“It’s possible for a user to switch his primary group                                                              making them a member of the group.
to be any of his secondary groups.”                                                                                   Although file permissions are not the only
                                                                                                                   place that Linux applies access controls,
                                                                                                                   they are absolutely essential to system
groups, though this feature is rarely used in           primary group as long as he knows the                      security. In my experience a high proportion
my experience. So, for example, andrew can              password. Let’s try. First, we’ll add a new                of system problems or security holes come
switch his primary group to be “editors”, like          group called “hackers”:                                    down to misunderstanding or misapplying
this:                                                   # groupadd hackers                                         file permissions. Knowing how they really
$ newgrp editors                                        Now we’ll set a password on it:                            work is important.




Command of the month: umask
Strictly speaking, umask isn’t a command,                 Now if we create a directory and check its               drwxr-x--- 2 andrew andrew 4096 Sep 29 21:20 test2
it’s a shell built-in, but I don’t mind thinking of     permissions we see something like this:                      We see that the bits that are set in the
it as a command if you don’t. The umask                 $ mkdir test1                                              umask (we might represent it as ----w-rwx)
setting (usually established in a shell startup         $ ls -ld test1                                             are NOT set in the file’s permissions. To be
file such as ~/.profile) is used to limit the           drwxrwxrwx 2 andrew andrew 4096 Sep 29 21:20               exact, to compute the permissions that will
permissions that will be assigned to any file           test1                                                      be assigned to a file when it is first created,
you create. It’s a bit confusing because it                Notice the very liberal permissions on the              take the one’s complement of umask and
sort of works ‘upside down’ – the                       directory. Now let’s tighten things up by                  perform a bit-wise logical and operation with
permission bits that are set in umask will be           setting a umask and repeating the                          the permissions requested by the program
withheld from any files you create.                     experiment:                                                that created the file. Also, you should
    Maybe a couple of examples will help.               $ umask 027                                                understand that umask only takes effect at
First we’ll set our umask to zero:                      $ mkdir test2                                              the instant a file or directory is created. It
$ umask 000                                             $ ls -ld test2                                             doesn’t apply retrospectively to existing files.



                                                                         www.linuxvoice.com                                                                           67
     FOSSPICKS




FOSSpicks                                                                                            Sparkling gems and new
                                                                                                     releases from the world of
                                                                                                     Free and Open Source Software

              Mike Saunders has spent a decade mining the internet for free
              software treasures. Here’s the result of his latest haul…
Partition manager


GParted 0.20
V
          ersion numbers are funny        The latter is what we’re looking at
          things. Some developers         here, as it’s very useful to have
          would argue that they don’t     around on a spare CD-R or USB key
mean much, but end users often            for emergencies.
infer a lot from them. We know of            The ISO weighs in at a touch
quite a few FOSS programs that            under 200MB, and when booted, it
have surprisingly low version             asks for your keyboard layout and
numbers, given their quality and          language. Then it drops you into a
feature set, such as Inkscape. It has     rather ugly Fluxbox desktop, with
been around for years, has loads of       some dreadful desktop icons. Sure,
features, is used by professionals        glitz and fancy effects aren’t
for real work, and yet it’s only at       important here, but a bit of work on
0.48. The same could be said of           the presentation would be welcome,
GParted: it’s a hugely useful and         especially when you’re using it to fix
mature tool, yet its 0.20 version         someone else’s system.
number suggests it’s barely at               Anyway, GParted itself pops up,       This panel shows the range of filesystems that are supported, and
alpha stage.                              showing the layout of your hard          operations available for them.
    That might scare some users           drive. (If you have multiple drives,
away, especially given its job of         you can select the one you want to                                    partition in the list to select it, and
performing (potentially risky)            edit via the drop-down menu on the                                    then use the toolbar at the top (or
filesystem operations. In our             top-right of the window.) Click on a                                  the right-click menu) to perform an
experience over the years, though,                                                                              operation on it. Note that GParted
GParted is a tool you can rely on. It’s
a GTK-based program for managing
                                          “GParted is very useful to have                                       doesn’t perform its operations
                                                                                                                straight away – instead, it batches
partitions on your hard drive, and        around on a spare CD-R or USB                                         them up until you click the Apply
it’s available in two flavours: as a
standalone app, or as a live distro.
                                          key for emergencies.”                                                 button at the top.
                                                                                                                  GParted is tremendously versatile,
                                                                                                                supporting over 20 filesystem
                                                                                                                formats, although not every
                                                                                                                operation is available for each
                                                                                                                format. But for the common
                                                                                                                formats (ext*, btrfs, NTFS, FAT32,
                                                                                                                HFS+) you can create, copy, resize
                                                                                                                and relabel partitions. In many
                                                                                                                cases you can also perform checks
                                                                                                                on partitions, and attempt to
                                                                                                                recover deleted ones. It’s a great
                                                                                                                toolbox for working with hard
                                                                                                                drives, and an essential part of a
                                                                                                                sysadmin’s armoury.
                                                                                   The GParted Live distro
                                                                                   isn’t a feast for the eyes
                                                                                                                 PROJECT WEBSITE
                                                                                   and looks very late 90s,
                                                                                                                 www.gparted.org
                                                                                   but it gets the job done.



68                                                             www.linuxvoice.com
                                                                                                                                               FOSSPICKS


Operating system


Minix
A
         lthough it’s not very well               parts of the system exchanging
         known, Minix played a                    messages all the time, performance
         major role in the early days             can be impacted significantly. So
of Linux. It was created by                       the debates continue today, but
computer science professor                        Minix 3 is a good example of a
Andrew Tanenbaum as a learning                    genuinely useful all-round OS built
tool, and Linus Torvalds used it to               on a microkernel design.
build the very early releases of his
kernel. The two hackers got into a                A bit of this, a bit of that
fascinating online debate about                   Minix 3 is now regarded as an
kernel design – a debate that has                 alternative to Linux and the BSDs
become so famous, it even has its                 for embedded devices and low-spec
own Wikipedia page: http://tinyurl.               hardware and it runs many FOSS
com/b2us8t. Tanenbaum argued                      apps you’re familiar with. To install
                                                                                                Minix 3 is the first
that microkernels are the future,                 it, you’ll need at least 64MB of RAM                                        releases. Indeed, Minix also uses
                                                                                                release to support ARM
and Linux was already obsolete                    and an i586 or newer processor                chips, and specifically       NetBSD’s Pkgsrc system, so a wide
before it had even taken off.                     along with 675MB of drive space.              BeagleBoards (image:          range of software is available with
Torvalds disagreed, of course.                        Minix 3.3 is provided as a 288MB          Mapper 07, Wikipedia).        just a few commands. However, X
  But what is a microkernel?                      compressed ISO image, which                                                 wasn’t working at the time of
Essentially, it’s a very small kernel             extracts to 578MB, so it can be                                             writing – the developers were still in
that does a handful of vital jobs:                burned to a regular CD-R. After                                             the process of moving away from
mapping memory, controlling                       booting, you’ll be prompted to log in                                       the crusty old XFree86 codebase.
processes, and enabling processes                 as root (without a password), and                                              Ultimately, Minix feels a lot like
to communicate with one another.                  then run setup to begin installation.                                       Slackware and Debian from the
Everything else, including hardware               This is all plain text, and there are no                                    mid-90s. It’s surprisingly usable and
drivers, networking protocols and                 hand-holding wizards, but if you                                            interesting to explore, and the
so forth, are run in “userspace”,                 have some Unix experience you                                               documentation isn’t bad either. It
where they can’t interfere with the               won’t find it too daunting.                                                 won’t be challenging Linux or
inner workings of the kernel.                         By and large, Minix has a familiar                                      FreeBSD any time soon, but if
Contrast this to Linux, where a good              Unix-like userland, which isn’t                                             you’re interested in exploring
chunk of the OS’s functionality is                surprising as much of it has been                                           alternative kernels or just want to
provided directly inside the kernel.              taken from NetBSD in recent                                                 expand your Unix knowledge, give it
  So a microkernel should, in                                                                                                 a go in VirtualBox or Qemu. (Note:
theory, be more reliable, as parts
can be swapped out more easily in
                                                  “Minix 3 is now regarded as an                                              for the former, create a virtual IDE
                                                                                                                              hard drive image.)
the event of a bug wreaking havoc.                alternative to Linux and the BSDs
But when you have more things
happening in userspace, and major
                                                  for embedded devices.”                                                       PROJECT WEBSITE
                                                                                                                               www.minix3.org




How it works: Installing Minix3




  1 Boot                                                     2 Install                                               3 Wait
       You can use a real PC, but it’s easier to just use         Log in as root and enter setup to begin the             If you can devote the whole drive to Minix, use
VirtualBox or Qemu to boot the ISO image – and at           process. You’ll be prompted for your keyboard layout,   the automatic mode. The files will be copied over, and
this menu, hit Enter to boot up Minix.                      and then move on to drive partitioning.                 then you can reboot into your new Minix installation.



                                                                         www.linuxvoice.com                                                                           69
     FOSSPICKS


Old school terminal emulator


Cool-retro-term
H
          ollywood typically depicts      bunch of extra packages. The
          “hackers” as bespectacled       interface is built around Qt 5.2, so
          geeks sitting in front of       you’ll need an up-to-date distro to
green text terminals with all sorts of    build the source code – we used a
incomprehensible gobbledygook             test release of Fedora 21. We
scrolling by. They’ll use these           followed the instructions to the
cliches even in films set in the          letter, but we still had to install
current decade, despite how daft          some extras manually.
they are. But go back to the 70s and         Anyway, once it’s running, it’s
80s and you would actually find           pretty awesome. The developers
these flickery, eye-strain-inducing       have done a great job of recreating
displays hooked up to mainframes          an old-school text terminal, beyond
                                                                                   Top tip: enable this
and minicomputers.                        just making everything pixellated to                                simply didn’t work. It’s not clear
                                                                                   full-screen on your
   If you want something today that       the extreme. There’s a fuzziness                                    whether this is due to a bug in the
                                                                                   laptop, go into a coffee
really harks back to the good old         around the characters, irregularity      shop, and watch as         program or the mid-development
days of Unix, try Cool-retro-term. Its    in the lighting, twitches from the       everyone assumes           status of Fedora 21, but we couldn’t
name says it all: it recreates an         virtual CRT, and warping at the          you’re the l33t3st h4x0r   explore some of the extra features.
old-school terminal on your               edges (simulating the bulge of a         in the world.              Still: you can normally customise
desktop, and it’s pretty cool.            non-flat screen). Even if you never                                 the font size and colour scheme,
   Well, apart from compiling it. The     used a Unix box in the 70s, it may                                  and switch into a full-screen mode.
developers have provided a helpful        still remind you of 8-bit computers
list of dependencies on the project’s     hooked up to 80s TV sets.                                            PROJECT WEBSITE
website, but if you’re not running           Unfortunately, we couldn’t access                                 https://github.com/Swordfish90/
                                                                                                               cool-retro-term
KDE you’ll be pulling in a giant          any of the settings; the menus


Screenshot taker


Maim
O
        ne of the best command               You can use the program straight
        line tools for taking             away by entering, for example,
        screenshots is Scrot. With a      maim foo.png to save the whole
command line tool you can take            screen as foo.png. You’ll probably
batches of screenshots, selecting         want to get the terminal window
specific areas, which is very handy       out of the way first, though, so add
when you need to do repetitive jobs       -d followed by a number to delay
(such as collecting images for            the screenshot-taking process for
software documentation). Maim             the specified number of seconds.
claims improve on Scrot with some            If you want to grab a part of the
features that the former lacks.           screen, you can specify coordinates
   The main dependencies are              using the -x, -y, -h and -w flags; in
                                                                                   Maim makes off-screen
Imlib2, libXrandr and libXfixes;          many cases, though, you’ll want to       areas transparent,         extra settings. It’s also possible to
these are available as libimlib2-dev,     select an area yourself. Maim can’t      which is useful if you     select a specific window using the
libxrandr-dev and libxfixes-dev on        do this on its own, but if you install   have multiple monitors     -i flag. This requires the window ID,
Debian-based distributions. With          Slop (linked to on the project’s         with different             which you can get by running
those in place, grab the latest           website) then the -s flag lets you       resolutions.               xdotool selectwindow, clicking on
source code and build it like so:         either click and drag to select an                                  the window you want to capture,
git clone https://github.com/naelstrof/   area, or click on a window’s titlebar                               and noting the number. Enter maim
maim.git                                  to take a screenshot of just that                                   --help for the full list of options.
cd maim                                   window. The selected window is
cmake ./                                  highlighted with a grey border,                                      PROJECT WEBSITE
                                                                                                               https://github.com/naelstrof/maim
make && sudo make install                 which you can customise using



70                                                             www.linuxvoice.com
                                                                                                                               FOSSPICKS


Atari-like virtual machine


Aranym 0.9.16
T
         here are many Atari ST/TT/       location of the file you downloaded
         Falcon emulators doing the       (eg /home/mike/etos512k.img)
         rounds, and most of them         and start Aranym again. All being
have very good compatibility with         well, you’ll arrive at the desktop.
the original machines. Aranym (a             From here, you can go about
contraction of “Atari running on any      setting up your virtual Atari as you
machine”) is slightly different in that   wish. You can reedit the
it doesn’t emulate a specific model       configuration file to enable hard
from the ST series; it just emulates      drives using disk images or
the best hardware suitable for an         directories, and also tweak the
open source version of TOS, the           video settings as well. Note that         Aranym features JIT (just-in-time) translation for the emulated
ST’s old operating system.                Aranym completely takes over your         CPU, so it runs lightning fast.
   After you’ve installed Aranym,         mouse input when you’re using it,
you’ll also need to get a TOS image       so if you need to get the cursor                                      apps, and you can also enable
from http://emutos.sf.net. Like the       back for other Linuxy work, press                                     networking and get it online. Even if
original TOS, EmuTOS is a single-         left Shift, left Control, left Alt and                                you didn’t have one of the machines
tasking operating system with             Escape at the same time.                                              at the time, it’s still great fun to play
certain limits, but it’s completely          Aranym is compatible with many                                     around with an OS that’s half a relic
open source and works really well         original ST/Falcon games and                                          of yesteryear, and half being kept
with Aranym. Fire up Aranym for the                                                                             alive thanks to the passion of open
first time, and then close it; you’ll                                                                           source hackers.
now have a file called .aranym/           “Aranym is a contraction of
config in your home directory. Edit
this to point the EmuTOS line to the
                                          ‘Atari running on any machine’.”                                       PROJECT WEBSITE
                                                                                                                 http://aranym.sf.net




Text-mode Twitter client



Rainbowstream
A
          command line Twitter            let Rainbowstream read and post to
          client may seem like a          your feed.
          crazy idea, but in most            Back in the terminal, you can now
cases it works perfectly well. After      begin using Twitter. Enter h to
all, tweets are really just plain text,   display a list of help topics, which
and if you’ve ever spent much time        you can then follow with another
with Mutt, WeeChat and similar            word – for instance, h tweets will
tools, you’ll know that text-mode         show you how to compose new
programs can be faster and more           tweets. Entering home (optionally
efficient than their GUI equivalents.     followed by a number) will show the
Rainbowstream is written in Python,       most recent tweets on your
                                                                                    If you guessed this is a
so the quickest way to get it is:         timeline, while mentions will show                                    terminal, but it’s a lark nonetheless.
                                                                                    Raspberry Pi,
pip3 install rainbowstream                tweets that mention you. It doesn’t       congratulations – you       Enter config to see a list of
   The main dependency is Pillow, a       take long to master, and if you           can now apt-get remove      configuration options for
fork of the Python Imaging Library.       spend a lot of time on Twitter, you’ll    your X server.              Rainbowstream, and then enter:
Once you have it installed, enter         appreciate its speed and efficiency.                                  config IMAGE_ON_TERM=True
rainbowstream and your web                   Certain features aren’t enabled by                                   Now, when you view the most
browser will pop up, prompting you        default, such as the ability to display                               recent tweets from a user (eg view
to authenticate on Twitter. What’s        inline images, as shown in our                                        @linuxvoice), linked images will be
going on here? Well, Twitter doesn’t      screenshot. This is really more of a                                  displayed inline.
let random applications use your          novelty than anything else, as the
                                          images are inevitably low-resolution                                   PROJECT WEBSITE
account, so first it performs a
                                                                                                                 www.rainbowstream.org
check, confirming that you want to        given the constraints of the



                                                                www.linuxvoice.com                                                                    71
     FOSSPICKS


Mail client


Alpine 2.11
W
             e’ve given plenty of         with patches. When you start Alpine,
             kudos to the Mutt email      you’ll note that it’s more welcoming
             client in previous issues    than Mutt, with a menu-driven
of Linux Voice, so some readers           interface. However, like Mutt, there
have asked us to also give Alpine a       are keyboard shortcuts for various
mention too. And for good reason          options – these are displayed along
– it’s a great program, and this          the bottom. If a shortcut looks like
author used it as his primary mail        ^X, that means you have to press
client for much of the early 2000s.       Ctrl+X to activate it.
To explain its history, however, we          So, what makes Alpine great?
                                                                                      Alpine is easy and quick
need to take a deep breath: Alpine is     Well, it’s very fast to use: once                                      the configuration can be achieved
                                                                                      to set up, and doesn’t
a continuation of Pine, an email          you’ve learnt the keybindings, you          require extensive          via the menus, so if you like the idea
client that started life in 1989 and      can whizz around your mailboxes,            hacking of config files.   of a text-mode email client but don’t
was influenced by Elm (Electronic         reading, replying to and sorting                                       want to spend hours hand-crafting
Mail) before it. However, Alpine          mails in a fraction of the time it                                     configuration files, you’ll love this.
development ceased in 2008, and           takes with the mouse. It’s also                                           Alpine supports POP, IMAP and
since then users have made                highly customisable, and you can                                       SMTP servers out of the box, and
patches to add new features, along        create colour themes for different                                     can even browse NNTP groups. It
with a fork (re-Alpine).                  types of messages. Almost all of                                       can render HTML emails, albeit
   Are you following? In practical                                                                               without much formatting, and
terms, it doesn’t really matter: if you                                                                          supports several mailbox formats.
install Alpine from your distro’s         “Alpine is a continuation of Pine, an
package repositories, you’ll almost
certainly get an updated version
                                          email client that started life in 1989.”                                PROJECT WEBSITE
                                                                                                                  http://patches.freeiz.com/alpine




Source code analyser


PMD 5.2.0
E
        veryone makes mistakes,              Both tools are written in Java, so
        especially when you’ve been       extract pmd-bin-5.2.0.zip and
        hacking away on the same          jump into the pmd-bin-5.2.0/bin/
piece of code for several hours. You      directory. You’ll need to provide a
may think you’re working well, but        ruleset against which the code
niggling bugs could be creeping           should be checked, along with a
into your code. If you’ve got a           directory containing source code
deadline to reach and simply can’t        files. For instance, if you want to
take a break, it’s worth running a        check some JavaScript in
source code analyser on your work         /var/www/foo, you’d use:
                                                                                      Here’s CPD in action,
before you ship it.                       ./run.sh pmd -R ecmascript-basic -d /var/                              use something like this:
                                                                                      spotting repeating
   PMD is one such analyser. It aims      www/foo                                     sections of PHP code.      ./run.sh cpd --minimum-tokens 100 --files
to find flaws in your code such as           Many other rulesets are available                                   /var/www/foo --language php
unnecessary object creation,              – see the project’s website for a full                                    Ideally, this should help you to
unused variables, empty catch             list. PMD will spit out its findings to                                reduce duplication, and stop bugs
blocks and other bloopers.                stdout, or you can redirect them to                                    from being repeated across other
Currently it only works with Java,        another file by adding > list.txt to                                   areas of the program. Plugins are
JavaScript, XML and XSL, but an           the end of the command.                                                available to integrate PMD and CPD
additional tool called CPD (the              To run CPD, you need to specify                                     with various IDEs, including Eclipse,
“copy-paste detector”) is provided,       the language it should check, along                                    NetBeans and JBuilder.
which identifies duplicated code in       with a location and the minimum
                                                                                                                  PROJECT WEBSITE
more languages including C, C++,          token length, which should be
                                                                                                                  http://pmd.sourceforge.net
C#, PHP and Ruby.                         reported as a duplicate. So you’d



72                                                               www.linuxvoice.com
                                                                                                                              FOSSPICKS


  FOSSPICKS Brain Relaxers
https://launchpad.net/pybik/
 Flight simulator


 FlightGear 3.2
 H
            ow many games can            If you’re running an Ubuntu variant,
            boast a 60,000 word          there’s a PPA that has this latest
            manual? Fortunately,         FlightGear release
 you don’t need to read it all to        (ppa:saiarcot895/flightgear).
 play FlightGear, but if you want to        If you’ve ever tried a complex
 get the most out of the simulator,      flight sim before, you might’ve given
 you’ll spend a lot of time with it.     up before even getting off the
 FlightGear is serious business: it      ground, thanks to the sheer number
 has been in development for             of controls involved. FlightGear is no
 nearly 20 years, it’s incredibly        different, but at least with the
 detailed, and it has realistic          smaller aircraft like the Cessnas,        “Hello, this is your captain speaking. We regret to announce
 physics. Well, apart from the           you can enjoy some simple flying          some minor technical issues with this Ryanair flight to Málaga.
 crashes...                              fun without burying your head in          Normal service will be resumed soon.”
    It’s also huge. You’re looking at    the docs. Hit S to start your engine,
 around 2GB for the complete             hold 9 to ramp up the throttle, and                                  the crashes aren’t very realistic
 game, which includes over 30            when you’ve got some speed, tap 8                                    – you just bounce around on the
 aircraft and hundreds of airports       to lift off. Then use the 0 and Enter                                ground.) Still, if you manage to
 around the world. Getting it is a       keys to control the rudder.                                          take off and land a 777, write in
 bit difficult, as there’s no standard      You won’t get far this way, as                                    and let us know…
 bundle for all Linux distros, so        there are many more controls to
                                                                                                                PROJECT WEBSITE
 you’re left to your own distro’s        master, but at least you’ll have a bit
                                                                                                                www.flightgear.org
 repositories or third-party repos.      of fun before crashing. (And really,




 Multi-dimensional Scrabble game



 Scrabble3D
 S
           crabble, like most popular       In its default mode, Scrabble3D
           board games, has been         lets you play a regular game with
           done to death now. Sure,      two, three or four players, dragging
 it’s still a great game, but from the   tiles from the top-right of the
 squillions of computer versions         window onto the board on the left.
 we’ve seen over the years, there’s      The game asks for your language
 little to differentiate them. Until     when you first start it, so that it can
 we came across Scrabble3D, that         download the relevant dictionary,
 is. This adds another dimension         and you can change this later on. If
 to the proceedings, and thereby a       you’ve got bored with the regular
 whole other level to the                Scrabble rules, some alternatives
 gameplay. The program is written        are available: Clabbers (which lets
 using the Lazarus Pascal IDE,           you place anagrams of words) and
                                                                                   Click Game > Run demo
 which means that packages are           Cambio Secco (whereby you can                                         the slider under the 3D view on
                                                                                   to see the CPU play
 available with both GTK and Qt          exchange all of your tiles, once per      against itself in the 3D    the right to select a plane before
 interfaces. The 64-bit Deb file         match, without losing your turn).         mode.                       dropping a tile. It’s a bit fiddly at
 worked fine on our Ubuntu 13.10            To find the 3D mode, go into                                       first, but the manual on the
 test machine; if you’re running an      Configuration > Settings, choose                                      project’s site explains it well.
 RPM-based distro such as                Advanced mode, go to Board >
 Fedora, you’ll also find suitable       Configuration, and select 3D. After                                    PROJECT WEBSITE
                                                                                                                http://scrabble.sourceforge.net
 packages at the project’s website.      starting a new game, you can use




                                                               www.linuxvoice.com                                                                      73
     LISTEN TO THE PODCAST



     WWW.LINUXVOICE.COM




72
                                                                                                                             TUTORIALS INTRO




                                                  TUTORIALS
                                                  Dip your toe into a pool full of Linux knowledge with eight
                                                  tutorials lovingly crafted to expand your Linux consciousness


                                                   In this issue…
                                                      76                                   78                                   82



Ben Everard
is using technology as an excuse not to venture
out into the cold, dark world.

                                                   i3                                   RPi Input                            Markdown

I
    t’s this time of year that technology          Ditch your mouse and                 Les Pounder takes a                  There’s no need for fancy
    seems most important to me.                    switch to a keyboard-driven          Raspberry Pi, a PIR, an              word processors: you
    During the long days of summer, it             desktop. Ben Everard has,            ultrasonic distance sensor           just need a text editor
sometimes feels like the solution to life’s        and it’s made him more               and a reed switch and                and a bit of Markdown.
problems lies away from my desk and                productive than ever.                builds a biscuit protector.          Marco Fioretti explains all.
outside in the fresh air. Then October
comes like a hard dose of reality with its
cold winds and rain, and by November
                                                      86                                   90                                   94
I’m ready to swear off nature for good
and retreat to the comforting glow of an
LCD screen. This time of year I like to
pick a project to see me through the
long nights until spring comes around
again and brings with it the desire to
step back out into the world.
   This does, of course, beg the
                                                   Systemd                              Grub                                 Atlas
question of what technology to focus               It’s the most controversial          Don’t wait until your                Learn to program one of
on this winter (last year was Python               program in Linux, but how            bootloader breaks before             the world’s first transistor-
and the Raspberry Pi – and launching a             do you get it to work?               you learn how it works.              powered supercomputers
magazine of course). I haven’t quite               Mike Saunders braves a               Follow Mayank Shama’s                with Juliet Kemp’s hands-
decided yet, but I think it might be time          flamewar by investigating.           guide today.                         on guide.
to get my Arduino out of its summer
storage and start putting it to use again.
Perhaps I should just buy a load of                PROGRAMMING
components and start experimenting.
Hmm, does the cat needs an automatic               Python                               Stdin and Stdout                     Battle robots
cat flap? Is the temperature in our                 98 In part two of this series,       102 These two concepts are key      104    Are you the best
house monitored as accurately as it                       we delve deeper into the             to all Unix-based systems,           programmer around? Can
                                                   world of fractals. Depending on      and you use them every time you      you prove it? No, not by beating a
should be? Will this be the year I finally
                                                   your perspective these are either    use Linux (even if you don’t know    benchmark, but in the white-hot
get round to setting up a persistence of           complex mathematical constructs      you do); but how do we write         heat of warfare! We introduce
vision system on my bike wheels? Oh,               that reveal hidden truths about      software that interacts with them?   Robocode, programmable tank
there’s too much tech to play with, and            nature, or pretty pictures. Either   In this Code Ninja, we use Python    warfare, and challenge you to see
not enough time. Why did I ever leave              way, they’re a great way of          to recreate a few classic            who can write the most powerful
                                                   exploring programming concepts       command line tools and learn         tank. (No penguins were harmed
the house in summer?
                                                   with Python.                         about Stdin and Stdout as we go.     in the writing of this article).
ben@linuxvoice.com



                                                                    www.linuxvoice.com                                                                            75
     TUTORIAL i3



                           i3: TILING WINDOW
         TUTORIAL
                           MANAGEMENT
                           Forget about touchscreens for a moment, put the mouse down and
 BEN EVERARD
                           control the desktop with your keyboard.


                           I
                               f you’ve always used a stacking window manager          screen space, but this is just because you haven’t
WHY DO THIS?
                               (one in which windows overlap each other – most         learned to use it well yet.
• Work more efficiently.
                               window managers are stacking), then the concept            Once you’ve got used to the system, you should
• Keep carpal tunnel
                           of a tiling window manager may seem a little strange.       find that you can do all your window management
  syndrome at bay.
                           Using a tiling WM, you don’t have much control over         tasks without your fingers ever leaving the keyboard.
• Get value for money
  from your high-          window placement, and there’s usually no taskbar for        This is much faster than flicking back and forward
  resolution monitor.      minimised windows. Instead the whole thing is driven        to the mouse. Don’t worry though, you won’t have to
                           by keyboard commands. At first, this can seem               abandon your computer’s rodent – you’ll still be able
                           archaic. When you first use a tiling window manager,        to use it for graphical applications. Now, let’s get stuck
                           you’ll probably find that it doesn’t make good use of       in so you can see what it’s like for yourself.


                               Step by step: Get working with i3
                           1
                               Getting started                                         2
                                                                                           Windows and containers
                           You can install multiple window managers on a single        Most of i3 is driven through a modifier key. This can
                           distro, so you can try i3 without losing your current       be either Alt or the Windows key depending on the
                           setup. All you have to do is grab the package through       setup (you may have been asked to choose when
                           your package manager (usually called i3). It’s available    starting i3). The first thing we’ll do is open a terminal.
                           in all major distros. If you’re using Debian or Ubuntu      This is done with Mod+Enter. Try with both Alt and
                           (or a derivative of these), you can adjust your             Windows to see which way you have it set up.
                           repositories to get the latest version of i3 by following      You’ll find that the terminal takes up the whole
                           the guide at https://i3wm.org/docs/repositories.            screen, and that there are no window decorations
                           html; however, this isn’t necessary if you just want to     for resizing, moving or closing it. That’s because i3
                           try it out.                                                 is a tiling window manager, and it handles all the
                              Once you’ve got everything installed, you just need      placement and sizing.
                           to switch desktops. Log out of your current session            To get an idea of how this works, press Mod+Enter
                           and you should be able to select i3 as an option on         again. You should find that i3 opens another terminal
                           the login screen. This will take you into i3. You should    either next to, or below the previous terminal.
                           see a desktop wallpaper with a black bar along the          Whenever you open a new window in i3 it splits the
                           bottom. There’s no graphical menu (or anything else         space of the current one to fit the new one in. If you
                           you might click with your mouse) as i3 is primarily         press Mod+H before creating the new window, it will
                           keyboard-driven. If you’re used to doing most of your       split the window horizontally, if you press Mod+V
                           work with the mouse, it may take a little while to get      before, it will split vertically. This is the basic way of
                           used to this, but many people find that they end up         organising your windows on the screen.
                           preferring a keyboard-driven interface.




76                                                         www.linuxvoice.com
                                                                                                                       i3 TUTORIAL

3
    Select the active window                               4
                                                               Other applications
With multiple windows open on the screen, you can          So far, we’ve only been playing with terminals. This is
use the mouse to select the one you want to use.           useful to get a feel of how the desktop works, but it’s
However, this isn’t very efficient. It’s usually much      not very good for general use (unless, of course, you’re
better to move around using the keyboard. You can          a true Unix ninja). You can, of course, just start
move between the different panes (known as                 programs from terminals, but this means you have to
containers), either by using Mod+arrow key or by           have terminals spewing out the output of the
using Mod+J, K, L or ; for left, down, up and right (the   graphical programs.
same as in the Vi text editor).                               Although i3 doesn’t have a graphical applications
    Once you’re in a container, you can use Mod+F          menu, it does have a menu. To open it, press Mod+D,
to make it full-screen, or Mod+Shift+<num> (where          then start typing the name of the program you want
<num> is a number) to send it to another workspace.        to start. This works a little like tab completion in the
You can then go to the workspace by pressing               command line. Unlike a desktop environment (such
Mod+<num>. If you do find yourself using the mouse,        as Gnome or KDE), i3 doesn’t come with any specific
you can switch between workspaces by clicking on           applications. All Linux software should work with i3,
the numbers in the bottom left-hand corner of the          but it’s worth thinking about which applications fit
screen. One final use of the mouse is that you can use     in best with the keyboard-driven way of working. For
it to resize containers by clicking and dragging the       example, the Ranger terminal-based file manager can
border between them.                                       be easier than a graphical tool like Nautilus or Dolphin.




5
    More controls                                          6
                                                               Configuration
What we’ve covered so far needs to become second           Since i3 is mostly aimed at advanced computer users,
nature to you, so now’s a good time to start practising.   it’s highly customiseable. This is done through
Once you know all these key bindings automatically,        modifying the config file ~/.i3/config or ~/.config/i3/
you should be able to use i3 for most work. However,       config. In it, you should see that all the keybindings
there are still some more advanced features that can       can be changed to whatever you want them to be. .
come in handy.                                                 As well as configuring i3, you can also get extra
   Rather than tile a group of containers, you can         software to help you. I3pystatus (https://github.
have them stacked or tabbed to give more screen            com/enkore/i3pystatus) is a replacement for the
real-estate to the currently active container. You can     status bar that’s extensible in Python. There’s also
switch between the various options with Mod+S, W or        QuickSwitch (https://github.com/proxypoke/
E (for stacking, tabbed or default respectively).          quickswitch-for-i3) which is a utility to help you find
   You can also resize containers by using Mod+R           and control windows in i3.
to enter resize mode. Once you’ve pressed that, you            If you get stuck, i3 has good documentation at
should see Resize Mode appear in the bottom-left           http://i3wm.org/docs/. There’s also a stackoverflow-
corner. You can then use the arrow keys or J, K, L and     style FAQ at https://faq.i3wm.org/questions which
; (without Mod) to resize the current container. Once      is a good place to find solutions since most problems
you’ve finished, press Escape to exit resize mode.         you face will have happened to someone before.




                                                               www.linuxvoice.com                                                    77
     TUTORIAL RASPBERRY PI



                              RASPBERRY PI:
          TUTORIAL
                              SIMPLE FORMS OF INPUT
                              It's time to play with some affordable methods of getting input into
   LES POUNDER
                              your tiny Linux machine.


                              W
                                           hen thinking input methods for a computer
 WHY DO THIS?
                                           we generally think of keyboards and mice,
 • Create a multi-sensor                   but there are many other different types of
   alarm system to protect
   coffee and biscuits.       input. For example, the use of touch and gesture
 • We will program it using   controls in mobile devices is thanks to capacitive
   Python and build a user    touchscreens and accelerometers feeding data to the
   interface using a module   system that acts on the input. Sensors are unique
   called easyGUI.
                              forms of input. They provide information about the
 • Learn about sensors
   and alternative methods    world around us and can be used to trigger alarms,
   of input.                  gather data on animals and provide valuable data for
                              scientific research.
                                 In this tutorial we will look at two sensors and a      Our final project is ready to defend against the hordes of
 TOOLS REQUIRED
                              magnetic switch, all of which are really simple forms      digestive eating enemies or hungry dogs.
 • Raspberry Pi (Any
   model).                    of input. For our sensors, we have an ultrasonic
 • Raspbian OS.               sensor commonly used to sense distance and found           enables Python to use the GPIO pins. It's called RPi.
 • PIR sensor (BISS00001      in cars' parking sensors. We will then use a sensor        GPIO, but this is rather unwieldy to use in our code so
   are very common on         commonly used in burglar alarms to detect                  we rename it to GPIO instead:
   eBay).                     movement – this is a Passive Infrared (PIR) sensor.        import RPi.GPIO as GPIO
 • HC-SR04 Ultrasonic         Our magnetic switch is called a reed switch, and these     import time
   Sensor (Less than £5 on
   eBay).                     are commonly used as door sensors.                           Next we set up the GPIO to use the logical BOARD
 • Reed Switch (We used                                                                  pin numbering system and then create a variable
   http://uk.farnell.com/     PIR sensor                                                 called PIR_PIN to contain the real GPIO pin that we
   comus/8601-0211-015/       Passive Infrared sensors operate by monitoring             will use as an input for the trigger. The last line
   switch-reed-spst-
   no-0-1a-24v-smd/           infrared light. When it detects movement, the sensor       instructs Python that we are using pin 7 as an input
   dp/2409191)                sends a high signal to your Raspberry Pi, which we         and that it should expect to receive a trigger:
 • Male to male jumpers.      have programmed to react.                                  GPIO.setmode(GPIO.BOARD)
 • Male to female jumpers.       PIR sensors are one of the easiest sensors to wire      PIR_PIN = 7
 • 1kΩ resistor.              up to your Raspberry Pi, as they only come with three      GPIO.setup(PIR_PIN, GPIO.IN)
 • Breadboard.                connections: VCC, which connects to the 5V pin of            Now we have a little fun and print some funny
                              your GPIO (pin 2); GND or ground, which connects to        system messages to the console:
                              pin 6; and finally Output (the pin that sends the alert    print("Welcome to the LV Biscuit Barrier - System Loading
                              signal to our Pi), which connects to pin 7 of your Pi.     Please Wait")
                                 With the sensors connected, let's build the Python
                              code that will enable us to use it.
                                                                                           Installing EasyGUI
                                 Using the PIR sensor with Python is relatively
                              straightforward, requiring nothing more than telling         We’ve covered EasyGUI in previous issues of Linux Voice. It
                              the Raspberry Pi which GPIO pin the PIR sensor is            is the simplest method of creating a user interface, and can
                                                                                           be inserted into existing code with relative ease.
                              attached to and to watch the status of that pin for any
                                                                                               There are two ways to install EasyGUI: via your package
                              changes. We start by importing two modules: the first        manager and via a special Python package manager.
                                                                                               First of all let us use the Raspbian package manager,
                                                                                           which is called apt.
                                                                                               To install EasyGUI open a terminal and type in the code
                                                                                           below followed by the enter key
                                                                                           sudo apt-get install python-easygui
                                                                                              We can also use a Python package manager called PIP to
                                                                                           install the packages and keep them up to date. But first we
We used ultrasonic
                                                                                           need to install PIP using the apt command.
sensors to detect distance
                                                                                              In a terminal window type
to the biscuit – they also                                                                 sudo apt-get install python-pip
make a great pair of eyes                                                                  sudo pip install easygui
for a robot.


78                                                           www.linuxvoice.com
                                                                                                                 RASPBERRY PI TUTORIAL


time.sleep(2)                                                  Resistors
print("Scanning for intruders")                                Resistors are an essential part of electronics,    components would have a shorter life span
  The last segment of code is the loop that                    and are used to reduce the electrical current      and we could damage our Raspberry Pi.
continually looks for a trigger on the PIR_PIN. Once           flow and in turn reduce the voltage passing        Resistors come in a series of colours meant
someone tries to steal a biscuit they trigger the trap         through a circuit. A simple example of             to identify their resistance value, measured
                                                               the use of resistors is the humble Light           in Ohms (Ω). Common resistors used with
and a message is printed to the console informing us
                                                               Emitting Diode (LED). They work with the           the Raspberry Pi are
of the situation. With the alarm triggered, the system         3.3V voltages used on the Raspberry Pi but            220Ω = red, red, brown, gold
waits for 1 second before resetting and waiting for its        run hot and bright, just like Rutger Hauer in         1kΩ = brown, black, red, gold
next incursion:                                                Blade Runner. Using a resistor inline with            10kΩ = brown, black, orange, gold
while True:                                                    the power from the Raspberry Pi pin we can            If you would like to know more about
                                                               reduce the current and voltage, extending          resistors, there is a great Wikipedia article
  if GPIO.input(PIR_PIN):
                                                               the life of our LED. Without resistors,            http://en.wikipedia.org/wiki/Resistor.
     print("Motion Detected near the biscuits")
  time.sleep(1)
                                                             ready to receive the alarm trigger:
Reed switch                                                  reed = 26
A reed switch is a small glass tube containing two           GPIO.setup(PIR_PIN, GPIO.IN)
strips of metal separated by about 1–2mm of space            GPIO.setup(reed, GPIO.IN)
but overlapping. The switch has a “normally open”              There are no changes made to our system starting/
position, but when a magnet is introduced the two            greeting message:
strips of metal snap together and complete a circuit         print("Welcome to the LV Biscuit Barrier - System Loading
thus allowing the current to flow through the switch.        Please Wait")
Remove the magnet and the switch opens, breaking             time.sleep(2)
the circuit and stopping the current flowing.                print("Scanning for intruders")
  Wiring up a reed switch is extremely simple, and is          Here we see the most significant addition to our
very breadboard friendly. Connect the 3V3 pin from           code – we create a second condition, that of the reed
your Raspberry Pi to one end of the reed switch using        switch being triggered. If this condition is true then the
a breadboard – either end of the switch can be used.         code will print the word “Trigger” in the console:
The other end of the switch connects to pin 26 on            while True:
your Raspberry Pi via the breadboard.                          if GPIO.input(PIR_PIN) == True:
  Using a reed switch with Python is just as                      print("Motion Detected near the biscuits")
straightforward as the PIR sensor, and we will reuse                      time.sleep(1)
some of the same code. Let's take a look at the                elif GPIO.input(reed) == True:
additions made for the reed switch.                               print("Biscuit tin has been opened CODE RED!!!")
  The first part of the code remains the same:                            time.sleep(1)
import RPi.GPIO as GPIO
import time                                                  Ultrasonic sensors
GPIO.setmode(GPIO.BOARD)                                     Ultrasonic sensors have two 'eyes' – one is a trigger
PIR_PIN = 7                                                  that sends a pulse of ultrasound towards an object,
  In a similar way to the PIR_PIN variable, we use           which then bounces off the object and returns to the
another variable to store the GPIO pin used for the          other eye which is called echo. The distance is
input, which is then configured to be an input pin           measured using a simple calculation:
                                                             Distance = Speed * Time
                                                               The most common ultrasonic sensor is the
                                                             HC-SR04, which can be found for a few pounds on
                                                             eBay. They come with 4 pins:
                                                               VCC 5V power from your Raspberry Pi (Pin 1).
                                                               GND Ground (Pin 6).
                                                               Trigger Receives a signal from the Raspberry Pi to
                                                               send a pulse of ultrasonic sound (Pin 11).
                                                               Echo Receives the reflected ultrasonic pulse and
                                                               sends a signal back to your Raspberry Pi (Pin 13).
                                                               Because we are working with 5V power we need to
                                                             protect the GPIO pins of our Raspberry Pi, as they can
                                                             only work with 3.3V or less. To do this we use a
                                                             resistor to reduce the voltage down to something
                                                             more Pi friendly. We’ll use a 1kΩ resistor which has a
                                                             colour code of BROWN, BLACK, RED, GOLD.
A reed switch is an open switch inside a glass vial – when     To enable the ultrasonic sensor to work with our
a magnet is introduced the switch closes.                    existing Python code we need to make quite a few



                                                               www.linuxvoice.com                                                                                 79
       TUTORIAL RASPBERRY PI

                                                                                                         Our next line is a conditional statement that checks
                     PIR sensor
                                                     HC-SR04 ultrasonic                               to see if the sensor is detecting anything, if not then
                                                     sensor
                                                                                                      the code continues. To enable the sensor to 'settle' we
                                                                                                      introduce a delay using time.sleep of 0.3 seconds.
                                                                           3V power ONLY to
                                                                           reed switch
                                                                                                         The next line instructs our Raspberry Pi to send an
                                                                                                      ultrasonic pulse, via sending a high signal to the
                                                                                                      trigger pin of our ultrasonic sensor. We then delay for
                                                                              Reed switch             10 microseconds, which is just enough time for a
                                                                                                      pulse of significant length to be sent. Then we turn off
                                                                                                      the trigger pin and flow into two while statements.
                                                                                                         While the echo pin is not receiving an ultrasonic
                                  Ground to – rail
                                                                                                      pulse it updates the variable signaloff with the current
                                                                                                      time, and a similar construction is used for signalon
     5V Power to – rail
                                                                                                      when we receive the ultrasonic echo pulse.
                                                                                                         With the two times recorded we now do a little
                                                                                                      maths. Subtracting the signaloff time from signalon
                                                                                                      time gives us the time taken for the pulse to be sent
                                                                                                      and return to the ultrasonic sensor, and this is saved
                                                                                                      as the variable timepassed:
                                                                                                      def reading(sensor):
                                                                                                        global distance
                                                                                                        if sensor == 0:
                                                                                                           time.sleep(0.3)
Here's how the circuit is
                                          changes. The imports remain the same as in previous              GPIO.output(trigger, True)
built – a larger version is
available in the project’s                sections, but you will notice two new variables called           time.sleep(0.00001)
GitHub repository, see box                trigger and echo. These new variables identify the               GPIO.output(trigger, False)
for details.                              GPIO pins used to send (trigger) and pulse from the              while GPIO.input(echo) == 0:
                                          ultrasonic sensor and receive (echo) an ultrasonic                 signaloff = time.time()
                                          pulse. On the last line you will see something called            while GPIO.input(echo) == 1:
                                          global distance. This is a variable available outside              signalon = time.time()
                                          and inside of a function and, without adding the global          timepassed = signalon - signaloff
                                          element, we would not be able to use the variable              Now we perform another calculation, using the
                                          inside of a function that we create later in the code:      school equation distance = time * speed. Our
                                          import RPi.GPIO as GPIO                                     distance variable stores the answer to the time
                                          import time                                                 passed multiplied by 17,000 (the speed of sound) for
                                          GPIO.setmode(GPIO.BOARD)                                    a half second, so a full second is 34,029 centimetres
                                          PIR_PIN = 7                                                 travelled. Why a half second? Well, we halve the time
                                          reed = 26                                                   taken as we need to know the distance from the
                                          trigger = 11                                                object, not the time taken to get there and get back.
                                          echo = 13                                                   We then print the distance in the console. Our last line
                                          global distance                                             in the function is the end of the if..else conditional
                                            Next we configure the pins used for the ultrasonic        logic and is used to capture any errors:
                                          sensor: trigger is an output and echo an input. We              distance = timepassed * 17000
                                          also instruct the trigger GPIO pin to be “Low” (in other            return distance
                                          words start the program with no power being sent to           else:
                                          that pin), to reduce the chance of a false reading:             print "Error."
                                          GPIO.setup(PIR_PIN, GPIO.IN)                                  Now we're on to the home straight and back to the
                                          GPIO.setup(reed, GPIO.IN)                                   main loop of our code. We keep the first two sensors,
                                          GPIO.setup(trigger, GPIO.OUT)                               our PIR_PIN and reed the same, and we introduce
                                          GPIO.setup(echo, GPIO.IN)                                   another elif statement that checks to see if the
                                          GPIO.output(trigger, GPIO.LOW)                              variable distance is less than 10cm. If so, it prints
                                              We keep the system startup message the same:            “Biscuit Thief” in the console:
                                          print("Welcome to the LV Biscuit Barrier - System Loading   while True:
                                          Please Wait")                                                 reading(0)
                                          time.sleep(2)                                                 if GPIO.input(PIR_PIN) == True:
                                          print("Scanning for intruders")                                  print("Motion Detected near the biscuits")
                                            Next we create a function called reading that                          time.sleep(1)
                                          controls the use of the ultrasonic sensor. We reuse the       elif GPIO.input(reed) == True:
                                          global distance variable, thus linking the variable and          print("Biscuit tin has been opened CODE RED!!!")
                                          enabling it to be used in our code.                                      time.sleep(1)



80                                                                             www.linuxvoice.com
                                                                                                                   RASPBERRY PI TUTORIAL

   elif distance < 10:
             print("Biscuit thief has struck again, deploy
ill-tempered jack russell terrier")
So far our code is just outputting the responses to the
console which is good but not great. So how can we
make our project great? A great user interface will help
users to quickly use the project.
  So where do we need a user interface in our
project? First of all a cool splash page that shows off
the Linux Voice logo and what the project is all about.
After that we need three dialog boxes, one for each of
the inputs, that will respond to any of the triggers that
may occur when our biscuit thief strikes.                                                                                             Version 2 uses EasyGUI
                                                                 Line 74                                                              to create a simple user
Coding our splash screen                                         else:                                                                interface that's a lot
Using EasyGUI we need to replace the system starting                         print("EXIT")
                                                                                                                                      friendlier to use.
text with a custom splash screen. To do that we need                Next we create three dialog boxes that will handle
to create a folder called Images and download the                the reporting of incursions in our project. Our three
Linux Voice logo (these files are included in the project        triggers are a PIR sensor, a reed switch and an
files from GitHub). So in our code we first need to add          ultrasonic sensor, and we created three conditions in
one more variable in the form of:                                our code that look like this:
logo = "./Images/masthead.gif"                                     #First condition this handles the PIR sensor being tripped
  And a list that contains the possible responses to a             if GPIO.input(PIR_PIN) == True:
simple yes, no question.                                              print("Motion Detected near the biscuits")
activate = ["Yes","No"]                                                       time.sleep(1)
 With those additions made, our focus turns to the                 #Second condition handles the reed switch being triggered by
welcome message that we earlier coded:                           our magnetic biscuit tin lid
print("Welcome to the LV Biscuit Barrier - System Loading          elif GPIO.input(reed) == True:
Please Wait")                                                         print("Biscuit tin has been opened CODE RED!!!")
time.sleep(2)                                                                 time.sleep(1)
print("Scanning for intruders")                                    #Our third and final condition uses the output from the ultra()
   We can replace it with:                                       function to tell us if the thief's hand is less than 10 cm away
splash_title = "Linux Voice Biscuit Security System V2"            elif distance < 10:
splash_msg = "Would you like to protect the biscuits?"                        print("Biscuit thief has struck again, deploy ill
start = buttonbox(title=splash_title,image=logo,msg=splash_      tempered jack russell terrier")
msg,choices=activate)                                              For each we used a simple print function to handle
   So we have a title in the form of the variable                the reporting, but instead of this let's use a GUI dialog
splash_title for our dialog box, and a question for our          box. So for:
users in the form of splash_msg. The potential                   print("Motion Detected near the biscuits")
answers are stored in the list activate and this answer          print("Biscuit tin has been opened CODE RED!!!")
is saved as a variable start, which we will use in the           print("Biscuit thief has struck again, deploy ill tempered jack
next piece of code.                                              russell terrier")
   Our focus now shifts to line 58 of the code, which is           Replace with:
the start of an if...else statement. We use the answer           msgbox(title="Motion Detected", msg="--ALERT-- I have
to the splash question to drive the activation of the            detected movement")
project. If the user answers yes, then the main body of          msgbox(title="Biscuit tin has been opened CODE RED!!!",
code is run; else if the user answers no, then the               msg="--ALERT-- I have detected that the tin has been opened")
program exits:                                                   msgbox(title="Hand in the biscuit tin", msg="--ALERT-- Biscuit
Line 58                                                          thief has struck again, deploy ill tempered jack russell terrier")
if start == "Yes":                                                 We can see that the msgbox function has a simple
…                                                                syntax, and that it needs a title for the dialog box and a
                                                                 message to report to the user.
                                                                   We have learnt how three different types of input
   Where can I find the completed code?
                                                                 work, how they are wired up to our Raspberry Pi and
   I've made the code for this project publicly available via    how we can create a Python program that will enable
   Github. For those that are familiar with Github you can       us to track down our biscuit thief. Yum!
   clone the repository at https://github.com/lesp/LinuxVoice_
   Biscuit_Security or for those unfamiliar you can download
                                                                  Les Pounder is a maker and hacker specialising in the
   the archive as a zip file from https://github.com/lesp/
                                                                  Raspberry Pi and Arduino. Les travels the UK training
   LinuxVoice_Biscuit_Security/archive/master.zip                 teachers in the new computing curriculum and Raspberry Pi.




                                                                   www.linuxvoice.com                                                                           81
     TUTORIAL MARKDOWN



                              MARKDOWN: WRITE ONCE,
          TUTORIAL
                              PUBLISH ANYWHERE
                              Stop wasting time with word processors and follow the Markdown
MARCO FIORETTI
                              way to future-proof your words.


                              M
                                          arkdown is just one of many plain text            content, automating as much as possible of the work.
 WHY DO THIS?                             markup systems available as Free Software         To really understand how and why Markdown is great,
 • We produce more and                    (we’ll return to that definition in a moment).    we have to remember the implications of the current
   more text every year,      Writing in Markdown is simple enough to understand,           “What You See is What You Get” (WYSIWYG)
   and never know how it      but the real challenge behind Markdown is in                  paradigm. In order to give you WYSIWYG, modern
   will be reused.
                              understanding why it was created, why it can be good          word processors automatically add tons of data and
 • Even Free Software can
   become obsolete, but a     for you, and above all, how to change your writing and        instructions to all the files they save in their native
   source format as simple    publishing habits in order to get the greatest                formats, and these instructions often aren’t all that
   as Markdown will always    advantage from it.                                            portable between formats. The result is more things
   remain usable.
                                 If you don’t regularly create significant amounts of       that could go wrong whenever something changes,
 • If you produce lots of
   text, your productivity    text of whatever nature, from poetry to company or            more temptation to make things look “just right”
   will increase. Trust us.   parish newsletters, Markdown will be of little or no          manually, and more work to move from one format to
                              relevance for you. But if you do, or even if you just edit,   the other, eg from OpenDocument to HTML or PDF.
                              manage and publish texts written by others,
                              Markdown can be a real blessing, for two big reasons.         Separate style and substance
                                 The first Markdown goal is to separate content             A plain text file, instead, is a file that contains only the
                              from formatting as much as possible, to save time             bytes corresponding to the actual letters, punctuation
                              and concentration. After decades of word processing,          and typographic “operators” – that is spaces, tabs and
                              and seeing too many “professionally formatted” texts          newlines – that we type into it using a text editor.
                              looking horrible on the Web or in our smartphones, we         Such files sure don’t look as pretty on screen as the
                              have all learned that all too often, many of the              pages of commercial magazines, but we should learn
                              functions in traditional office suites produce just a big     not to care. They are extremely portable and,
                              waste of time and energy. We obsess ourselves with            consequently, much more future-proof than any other
                              fonts, margins and similar formatting details instead         alternative. They also avoid distractions: the less eye
                              of just writing clearly. Then, much of that effort goes       candy you can add or see, the more you are forced to
                              down the drain every time somebody loads what we              ask yourself if what you wrote IS worth reading.
You never know when
                              wrote into another program, or on a small screen.                Very often, however, the deliberate limitations of
you will need to republish
something you wrote – so         The second, even bigger rationale for Markdown             plain text files may hurt the clarity and readability of
why not use a multi-output    may be summarised with the slogan “Write once,                your writing. Structures and properties like
source format right from      publish anywhere”. In other words, the simpler your           indentation, lists, typefaces or embedded images do
the beginning?                initial format is, the easier it will be to reuse your        make text easier to understand, don’t they? The
                                                                                            solution is to express them by marking the text up by
                                                                                            adding normal characters with a special meaning,
                                                                                            called markers or, more frequently, tags. Let’s take the
                                                                                            italic typeface as an example – a markup user would
                                                                                            never apply it by selecting text and then clicking on
                                                                                            some “italic” button, or menu entry. They would,
                                                                                            instead, adopt a convention like “//all text between a
                                                                                            couple of slashes is meant to be italic//” and then just
                                                                                            type (and see on screen or paper!) those extra
                                                                                            characters, every time italic is needed. Primitive and
                                                                                            ugly? Maybe, but also extremely efficient.

                                                                                            Markdown, finally
                                                                                            After this long, but absolutely necessary introduction,
                                                                                            we can finally define what Markdown is, and how to
                                                                                            use it. First, it’s a set of rules to mark up plain text,
                                                                                            defined by John Gruber in 2004. See the “Flash
                                                                                            introduction to Markdown syntax” box for some



82                                                             www.linuxvoice.com
                                                                                                              MARKDOWN TUTORIAL

examples. Second, it’s the software that converts that
text to whatever target format its users need in any
given moment.                                                                                                                       Write
   The basic Markdown syntax, and all the programs
written for it, were conceived for the web, to define
and generate basic HTML. Very soon after the
appearance of Markdown, however, other developers
created syntax extensions and corresponding
applications to make it possible to convert Markdown
into ODF, Latex and more. Let’s look at the basics first,                                                                         Convert
however.                                                                             No problem!
   Markdown was designed to satisfy two non-
negotiable criteria; efficiency and, above all, readability.
If you ask your browser to show you the source of any
web page, you will immediately remember that the “M”
                                                                                                 Need another                     Publish
in HTML means just that: “Markup”. The problem is                    STOP                          format?
that writing and reading raw HTML markup is tiring,
error-prone and time consuming. By contrast, the
main rule in Markdown is that any text formatted with
it should be easily readable as-is, even by people who
                                                                                                                             This is the power of the
have never even heard of Markdown. As many                      long block of HTML that corresponds to one object
                                                                                                                             Markdown flow: once
advocates of this method say “the single biggest                (eg a table, or one preformatted chunk of source             you have written the
source of inspiration for Markdown’s syntax is the              code), and as such is enclosed by a matching pair of         source, you can repeat the
format of plain text email”.                                    tags, like <table> and </table>. Inside .md files, such      conversion and publishing
   To favour readability, all Markdown tags consist of          elements must be preceded and followed by blank              steps as many times you
punctuation characters, chosen to look as unintrusive           lines, and their enclosing tags cannot be indented with      want.
as possible. The idea is to write Web-ready content             tabs or spaces.
faster, not to insert HTML tags faster. By deliberate
choice, tags are defined only for that very small               The Markdown flow
subset of HTML that corresponds to properties or                In the real world, a complete Markdown-based
operations applicable to raw text. For any other                publishing flow will have at least these three phases:
markup, from page backgrounds to navigation menus,               1 Generate your text with all the required Markdown

you are supposed to use HTML (In practice, as we will              tags.                                                         PRO TIP
see shortly, there are ways to not perform such                  2 Run the converter that generates the HTML version
                                                                                                                              Even if you decide to not
operations manually in many cases).                                (or other formats, if needed) of your work.                use Pandoc to generate
   In a Markdown file (the standard extension is .md)            3 “Publish” that version, that is send it by email to        the output formats
                                                                                                                              of your Markdown
you can switch from Markdown to full HTML and back                 whoever may need it, put it online and so on.              documents, study and try
at any moment, without problems. The only restriction              Can you see the efficiency, power and flexibility, in      it a few times. If nothing
is for block-level elements – that is, practically every        one word: the freedom embedded in a flow like this?           else, it may help you to
                                                                                                                              convert all your text files
                                                                No? Don’t worry, here it is: there is no need to perform      to Markdown, even if
                                                                those operations all on the same computer, all by the         they are in Microsoft or
  Documentation                                                 same person, or manually, or all at once. As far as           OpenDocument formats.
                                                                phase 1 is concerned, any text editor, on any operating
  Cheatsheets? Yes, a good, detailed cheatsheet is all you
  will need to get started with Markdown after reading this     system, can be used to write Markdown (or to update
  tutorial. Don’t ask us for one, however. Search for them      Markdown files that somebody else wrote 10 years
  online and you’ll find plenty, in all possible formats from   ago). And if you’re using a halfway decent editor, it will
  Markdown (of course!) to desktop wallpapers. Once you         surely have a Markdown syntax highlighting mode. If
  have learned Markdown, study the practical YAML tutorial
                                                                you wanted to publish the log files from your server,
  at http://rhnh.net/2011/01/31/yaml-tutorial.
      Before that, however, we suggest you read the post        your email archive or any other body of plain text, you
  www.terminally-incoherent.com/blog/2012/05/25/                could write a script that converts everything to
  Markdown-for-muggles, which is a funny encouragement          Markdown, and make the whole flow automatic.
  to use Markdown. Another article to read before starting         Phases 2 and 3 can be very easily delegated to a
  is ‘Thoughts on Markdown’ (www.leancrew.com/all-
                                                                cron job, and often should be. There is also no
  this/2010/10/thoughts-on-markdown). On a more technical
  level, other useful resources are the man page ‘pandoc_       problem if years pass between one phase and the
  markdown’, which explains the differences between basic       next. Everything you produce with a system like
  Markdown and its Pandoc superset, and the lists at            Markdown is, by definition, reusable in ways that you
  https://github.com/jgm/pandoc/wiki/Pandoc-vs-                 may not even know that you’ll need one day. For
  Multimarkdown. That wiki page thoroughly compares the
                                                                example, suppose next year some blog invites you to
  two extended converters feature by feature, starting with
  the input and output formats they support.                    republish stuff you wrote in 2008. If that stuff is in
                                                                Markdown format, and the webmaster is willing to



                                                                  www.linuxvoice.com                                                                    83
     TUTORIAL MARKDOWN

                                 install the Markdown QuickTags plugin for WordPress,
                                 all you’ll need to do is copy and paste your Markdown
                                 sources in the WordPress form. Please stand back one
                                 moment in silence with us, to appreciate the
                                 awesomeness of it all!

                                 A practical example
                                 Here’s a simple Markdown source file snippet that
     PRO TIP                     mixes both HTML code (in this case for a navigation
 Whatever Markdown               menu, not the actual content!) and Markdown:
 converter you choose, you
 shouldn’t use it directly at    <!-- Navigational markup -->
 the prompt. Instead, write      <ul class=”nav”>
 a shell script that will call   <li<a href=”./”>Home</a></li>
 it automatically and save
 a log file somewhere. This      <li><a href=”contact/”>About</a></li>
 will greatly reduce the         <li><a href=”contact/”>Contact</a></li>
 possibility of mistakes,        </ul>                                                                 This is what the Markdown syntax looks like in a text
 and make you work even
 faster.                                                                                               editor. Marked text is coloured to make it even more
                                 “...MultiMarkdown provides an easy way to share formatting            readable, while embedded HTML code is left as is.
                                 between all of my devices. It’s easy to learn (even for us mortals)
                                 and immediately useful.”                                              title. The problem, of course, is that this will generate
                                 > --- David Sparks, [MacSparky.com](http://MacSparky.com/)            enough HTML to display your image, but not enough
                                                                                                       to align, frame and size it just as you wish. There are
                                 ## Why Markdown and MultiMarkdown?                                    two solutions here. One is to not use Markdown for
                                 Because life is too short to waste it *formatting* text, instead of   images, but actual HTML, with all the options you may
                                 just **writing it**.                                                  need:
                                   The image below shows the full HTML version                         <img src=”/path/to/img.jpg” width=”95%” alt=”Here you should
                                 generated by any Markdown converter, and the image                    see an image”
                                 on the facing page shows the way it looks inside a                       A much smarter way to go is to write plain
                                 web browser. See what we meant? Even without                          Markdown, and then pre-process your sources with
                                 detailed explanations, or having a cheatsheet handy,                  an extra script that replaces all the Markdown image
                                 both the original plain text and what is eventually                   tags with equivalent ones in HTML, all with the same
                                 shown by a browser are much more readable than the                    settings, CSS classes and so on.
                                 HTML.                                                                    As far as hyperlinks are concerned, the syntax itself
                                                                                                       is very simple:
                                 Images and hyperlinks                                                 This is [an example](http://example.com/ “Title”) inline link.
                                 One image is worth a thousand words, or so they say,                  This is [an example][id] reference-style link.
                                 but how do we handle them in plain text files? The                       The first line shows how to define links to a generic
                                 answer is “With a little bit of care”. You can tell your              web page: you put the URL inline between the string
                                 your Markdown converter to insert in the target file the              that will become clickable text (the part in square
                                 HTML code that displays an image using this syntax:                   brackets) and the title that will appear when a user
                                 ![Here you should see an image](/path/to/img.jpg “This is the         puts the mouse pointer over the link. Reference-style
The HTML code generated          image title”)                                                         links are much more interesting, at least for frequently
converting the Markdown            This combines three strings: alternative text for                   used URLs. The second square bracket is a pointer to
source of our snippet.           textual browsers, a path to the image, and the image                  the complete definition of the URL that goes there,
                                                                                                       which will have this format:
                                                                                                       [id]: http://example.com/ “Optional Title Here”
                                                                                                       and can be anywhere in the Markdown file! This
                                                                                                       means that you can write your own list of frequently
                                                                                                       used URL aliases, all in one file, and then append it
                                                                                                       with a script to all the Markdown sources that need
                                                                                                       any of those URLs!

                                                                                                       Templates and metadata with YAML
                                                                                                       Markdown is good, and powerful. Adding metadata to
                                                                                                       it makes it much more powerful. How? A very
                                                                                                       common way to do it is by using YAML (which is
                                                                                                       another of those annoying recursive acronyms – this
                                                                                                       one stands for “YAML Ain’t Markup Language”). This is
                                                                                                       an open standard, designed to store generic,
                                                                                                       structured textual data just like XML, but in a way



84                                                                     www.linuxvoice.com
                                                                                                                      MARKDOWN TUTORIAL

that’s much more easily readable and editable by
humans. YAML metadata is usually placed in a
separate frontmatter, at the very beginning of a
Markdown file, between two lines containing three
dashes each:
Title: My first Markdown/YAML post
date : 2014-08-01
categories: Free Software, Blogging, Open Standards
  Please note that this is a very trivial example of
YAML. As simple as it looks, YAML can store many
types of data, from lists and abstracts to associative
arrays. There are plenty of free Software parsers that
can process it, or generate YAML frontmatter from
many sources. Used together, YAML and Markdown
can handle large amounts of text in a way that is very
easy to use, but also very powerful.

Markdown editors and converters
As we already said, any halfway decent editor will
                                                                                                                                    The final result: fully
make your Markdown source files even more                        formats supported, and in the set of Markdown tags                 standard code that any
readable, thanks to syntax highlighting. When it                 they recognise and can process. Therefore, there is no             browser will render without
comes to conversion, there are many choices. You                 “best converter”. You must figure out by yourself                  problems, with a structure
can even generate HTML from Markdown sources                     which one best matches your taste or, more                         perfectly matching the
when working on somebody else’s computer, by using               importantly, the type of documents you must write.                 original Markdown file.
the official online tool, called Dingus (https://                The original converter, for example, only accepts basic
daringfireball.net/projects/markdown/dingus) or one              Markdown and outputs HTML. Pandoc, instead, is a
called Dillinger (http://dillinger.io), which you can even       generic tool that can also be used to convert to the
install on your own server.                                      Markdown format Web pages or many other
   On a Linux desktop, you can use the original                  documents.
converter, a Perl script called markdown.pl, or more                Pandoc defines extra Markdown tags to handle,
advanced tools like Pandoc (http://johnmacfarlane.               among other things footnotes, tables, flexible ordered
net/pandoc) or Multiple Markdown (MMD, http://                   lists, automatic tables of contents, embedded Latex
fletcherpenney.net/multimarkdown). They are all                  formulas, citations, and markdown inside HTML block                    PRO TIP
command line tools, well suited for automation, and              elements. When you run the converter, multiple input                Markdown is great and
relatively simple to use. Basically, you pass them the           files are concatenated automatically. Pandoc can                    may be a good reason
input file (or the Standard Input) and the name of the           even accept URLs as input files! Output goes to                     to change text editor,
                                                                                                                                     if your favourite one
output file in which they should save the result. The            stdout by default, except for complex formats like                  doesn’t highlight its tags
differences are in the number of input and output                OpenDocument or ePUB. In this way, it’s also possible               properly. We suggest you
                                                                 to generate PDF files directly from Markdown.                       try multiplatform editors
                                                                                                                                     if you haven’t already, as
                                                                    The other most useful features of Pandoc are the
  Flash introduction to Markdown syntax                                                                                              they allow you always to
                                                                 command line options that tell it to place the content              work in the same way!
  Warning! This is very far from being a complete description    of external files, for example SEO keywords, in the
  of the Markdown syntax. We only want to whet your
                                                                 header of the HTML output, or at the end of a page.
  appetite by showing how easy it is to create structured, yet
  highly readable plain text using Markdown. Besides, even          MMD is another pair of Markdown syntax superset
  if we had enough space, it would make no sense to give         and associated converter. It is optimised for handling,
  you a complete syntax primer here. The whole format is so      among other things, tables, footnotes, citations,
  simple, and already completely documented in countless         internal cross-references and equations. Cross-
  cheatsheets that it would make no sense to copy it here:
                                                                 references, for example, work in this way:
  *Single asterisks (or underscores) enclose italic text*
  **Couple of asterisks, instead, mean “bold!”**                 [This string will point to an internal link][mylink]
     Headers can be marked in two ways. The simplest is this:    ## This is where I will end up when clicking on the string above
  # Level 1 header #                                             [mylink]
  ## Level 2 header ##                                              MMD can also convert Markdown sources to Latex,
     Numbered lists:
                                                                 which is the basis for professional-quality PDFs, with
  1. Foo
  2. Bar                                                         its auxiliary tool mmd2tex. Other, extremely important
     Unordered lists:                                            output formats supported by MMD are
  * first list item                                              OpenDocument and OPML, the standard used in the
  * another list item                                            Fargo 2 blogging platform.
     > Block quotes work just like in email.
     > Put a “>” sign at the beginning of
                                                                  Marco Fioretti is a Free Software and open data campaigner
     > each of their lines.                                       who has advocated FOSS all over the world.




                                                                   www.linuxvoice.com                                                                             85
     TUTORIAL SYSTEM SERVICES



                               LINUX 101: GET THE MOST
           TUTORIAL
                               OUT OF SYSTEMD
                               It’s mightily controversial – but Systemd is here to stay.
MIKE SAUNDERS
                               Learn how to use its features, and (maybe) learn to love it too…


                               H
                                         ate mail, personal insults, death threats –         at specified intervals, and much more. It’s growing all
 WHY DO THIS?                            Lennart Poettering, the author of Systemd, is       the time, and becoming something of a “base system”
 • Understand the big                    used to receiving these. The Red Hat                for Linux – providing all the plumbing tools needed to
   changes in modern           employee recently ranted on Google+ about the                 boot and maintain a distro.
   distros.                    nature of the FOSS community (http://tinyurl.com/                Now, Systemd is controversial for various reasons:
 • See how Systemd             poorlennart), lamenting that it’s “quite a sick place to      it eschews some established Unix conventions, such
   replaces SysVinit.
                               be in”. In particular, he points to Linus Torvalds’s highly   as plain text log files. It’s seen as a “monolithic” project
 • Get to grips with units
   and the new journal.        acerbic mailing list posts, and accuses the kernel            trying to take over everything else. And it’s a major
                               head honcho of setting the tone of online discussion,         change to the underpinnings of our OS. Yet almost
                               making personal attacks and derogatory comments               every major distribution has adopted it (or is about
                               the norm.                                                     to), so it’s here to stay. And there are benefits: faster
                                 But why has Poettering received so much hate?               booting, easier management of services that depend
                               Why does a man who simply develops open source                on one another, and powerful and secure logging
                               software have to tolerate this amount of anger? Well,         facilities too.
                               the answer lies in the importance of his software.               So in this tutorial we’ll explore Systemd’s features,
                               Systemd is the first thing launched by the Linux kernel       and show you how to get the most out of them. Even
                               on most distributions now, and it serves many roles. It       if you’re not a fan of the software right now, hopefully
                               starts system services, handles logins, executes tasks        at least you’ll feel more comfortable with it by the end.


                                 1    BOOTING AND SERVICES
This tongue-in-cheek
animation at http://tinyurl.
                               Almost every major distro has either adopted                  should be the same regardless of your distro. That’s
com/m2e7mv8 portrays
Systemd as a rabid animal      Systemd, or will do so in the next release (Debian and        one of the plus points of Systemd: it obviates many of
eating everything in its       Ubuntu). In this tutorial we’re using a pre-release of        the tiny, niggling differences between distros.
path. Most critics haven’t     Fedora 21 – a distro that has been a great testing               In a terminal, enter ps ax | grep systemd and look at
been so fluffy.                ground for Systemd – but the commands and notes               the first line. The 1 means that it’s process ID 1, ie the
                                                                                             first thing launched by the Linux kernel. So, once the
                                                                                             kernel has done its work detecting hardware and
                                                                                             organising memory, it launches the /usr/lib/systemd/
                                                                                             systemd executable, which then launches other
                                                                                             programs in turn. (In pre-Systemd days, the kernel
                                                                                             would launch /sbin/init, which would then launch
                                                                                             various other essential boot scripts, in a system
                                                                                             known as SysVinit.)

                                                                                             Taking control
                                                                                             Central to Systemd is the concept of units. These are
                                                                                             configuration files with information about services
                                                                                             (programs running in the background), devices, mount
                                                                                             points, timers and other aspects of the operating
                                                                                             system. One of Systemd’s goals is to ease and
                                                                                             simplify the interaction between these, so if you have
                                                                                             a certain program that needs to start when a certain
                                                                                             mount point is created when a certain device gets
                                                                                             plugged in, it should be considerably easier to make all
                                                                                             this work. (In pre-Systemd days, hacking all this
                                                                                             together with scripts could get very ugly.) To list all
                                                                                             units on your Linux installation, enter:



86                                                              www.linuxvoice.com
                                                                                                                SYSTEM SERVICES TUTORIAL


  Timer units: replacing Cron
  Beyond system initialisation and service management,                   Here, the OnBootSec option tells Systemd to activate the
  Systemd has its fingers in various other pies too. Notably, it      unit 1 hour after the system has booted. Then the second
  can perform the job of cron, arguably with more flexibility (and    option means: activate the unit once a week after that. There’s
  an easier to read syntax). Cron is the program that performs        a huge amount of flexibility in the times that you can set –
  jobs at regular intervals – such as cleaning up temporary files,    enter man systemd.time for a full list.
  refreshing caches and so forth.                                        By default, Systemd’s accuracy for timing is one minute.
     If you look inside the /usr/lib/systemd/system directory         In other words, it will activate the unit within a minute of the       PRO TIP
  again, you’ll see that various .timer files are provided. Have      time you specify, but not necessarily to the exact second.          By default, systemctl
  a look at some of them with less, and you’ll note that they         This is done for power management reasons, but if you need          assumes that you’re
  follow a similar structure to the .service and .target files. The   a timer to be executed without any delay, right down to the         referring to services when
  difference, however, lies in the [Timer] section. Consider this     microsecond, you can add this line:                                 issuing commands, so
  example:                                                            AccuracySec=1us
                                                                                                                                          you can omit the .service
                                                                                                                                          bit in most cases. For
  [Timer]                                                                Also, the WakeSystem option (which can be set to true or
                                                                                                                                          instance, instead of
  OnBootSec=1h                                                        false) defines whether or not the timer should wake up the          entering systemctl status
  OnUnitActiveSec=1w                                                  machine if it’s in suspend mode.                                    gdm.service you can just
                                                                                                                                          use systemctl status
                                                                                                                                          gdm. The same applies
                                                                                                                                          to stopping and starting
systemctl list-unit-files                                                If you look at the unit config file in /usr/lib/                 services.
   Now, systemctl is the main tool for interacting with               systemd/system/gdm.service, you’ll see various
Systemd, and it has many options. Here, in the unit                   options, including the binary to be started (ExecStart),
list, you’ll notice that there’s some formatting: enabled             what it conflicts with (ie which units can’t be active at
units are shown in green, and disabled are shown in                   the same time), and what needs to be started before
red. Units marked as “static” can’t be started directly               this unit can be activated
– they’re dependencies of other units. To narrow                      (the “After” line). Some
down the list to just services, use:                                  units have additional            “Systemd eschews some
systemctl list-unit-files --type=service
   Note that “enabled” doesn’t necessarily mean that a
                                                                      dependency options,
                                                                      such as “Requires”
                                                                                                       established Unix conventions,
service is running; just that it can be turned on. To get             (mandatory                       such as plain text log files.”
information about a specific service, for instance GDM                dependencies) and
(the Gnome Display Manager), enter:                                   “Wants” (optional).
systemctl status gdm.service                                             Another interesting option here is:
  This provides lots of useful information: a human-                  Alias=display-manager.service
readable description of the service, the location of the                When you activate gdm.service, you will also be
unit configuration file, when it was started, its PID, and            able to view its status using systemctl status
the CGroups to which it belongs (these limit resource                 display-manager.service. This is useful when you
consumption for groups of processes).                                 know there’s a display manager running, and you want




                                                                                                                                         Use systemctl status,
                                                                                                                                         followed by a unit name, to
                                                                                                                                         see what’s going on with a
                                                                                                                                         service.



                                                                        www.linuxvoice.com                                                                         87
     TUTORIAL SYSTEM SERVICES

                                                                                                dependencies of the target via the WantedBy option.
                                                                                                So if you look inside avahi-daemon.service,
                                                                                                NetworkManager.service and many other .service
                                                                                                files, you’ll see this line in the Install section:
                                                                                                WantedBy=multi-user.target
                                                                                                   So, switching to the multi-user target will enable
                                                                                                those units that contain the above line. Other targets
                                                                                                are available (such as emergency.target for an
                                                                                                emergency shell, or halt.target for when the machine
                                                                                                shuts down), and you can easily switch between them
                                                                                                like so:
                                                                                                systemctl isolate emergency.target
                                                                                                  In many ways, these are like SysVinit runlevels, with
                                                                                                text-mode multi-user.target being runlevel 3,
                                                                                                graphical.target being runlevel 5, reboot.target being
                                                                                                runlevel 6, and so forth.

                                                                                                Up and down
                                                                                                Now, you might be pondering: we’ve got this far, and
The unit configuration
                                   to do something with it, but you don’t care whether it’s     yet we haven’t even looked at stopping and starting
files might look foreign
compared to traditional            GDM, KDM, XDM or any of the others.                          services yet! But there’s a reason for this. Systemd
scripts, but they’re not                                                                        can look like a complicated beast from the outside, so
hard to grasp.                     Target locked                                                it’s good to have an overview of how it works before
                                   If you enter ls in the /usr/lib/systemd/system               you start interacting with it. The actual commands for
                                   directory, you’ll also see various files that end in         managing services are very simple:
                                   .target. A target is a way of grouping units together so     systemctl stop cups.service
                                   that they’re started at the same time. For instance, in      systemctl start cups.service
                                   most Unix-like OSes there’s a state of the system               (If a unit has been disabled, you can first enable it
     PRO TIP                       called “multi-user”, which means that the system has         with systemctl enable followed by the unit name.
 A simple
 Xxxxx   xxxway
              xxxto
                  xxfilter
                      xxxx xxx     booted correctly, background services are running,           This places a symbolic link for the unit in the .wants
 xx xxx
 and   manipulate
          xx xxxx xxxthexxx xxx    and it’s ready for one or more users to log in and do        directory of the current target, in the /etc/systemd/
 xx xxxx using
 journal   xxx xxregular
                  xxx xx Unix
                            xxxx
 xxx xxtext
 plain    xxxtools
              xx xxxx
                    is toxxx
                           usexx   their work – at least, in text mode. (Other states           system folder.)
               journalctl
 xxx xx xxxx xxx
 redirection.        xx xxx xx     include single-user, for doing administration work, or          Two more useful commands are systemctl restart
 -b
 xxxx> log.txt
        xxx xx will
               xxx place
                     xx xxxxxx     reboot, for when the machine is shutting down.)              and systemctl reload, followed by unit names. The
 xxxmessages
 all  xx xxx xx xxxx
                 from xxxthe xx
 xxx xx xxxx
 current        in log.txt,
           bootxxx   xx xxx xxso      If you look inside multi-user.target, you may be          second asks the unit to reload its configuration file.
 you
 xxxxcanxxxsed  andxxgrep
            xx xxx       xxxxto    expecting to see a list of units that should be active in    Systemd is – for the most part – very well
 your heart’s content.             this state. But you’ll notice that the file is pretty bare   documented, so look at the manual page (man
                                   – instead, individual services make themselves               systemctl) for details on every command.


                                     2    LOG FILES: SAY HELLO TO JOURNALD
                                   The second major component of Systemd is the                 regularly whips up heated debates on the net, but it
                                   journal. This is a logging system, similar to syslog, but    has some benefits too. For instance, logs can be more
                                   with some major differences. And if you’re a fan of the      structured, with better metadata, so it’s easier to filter
                                   Unix way, prepare for your blood to boil: it’s a binary      out information based on executable name, PID, time
                                   log, so you can’t just parse it using your regular           and so forth.
                                   command line text tools. This design decision                  To view the journal in its entirety, enter:
                                                                                                journalctl
                                                                                                  As with many other Systemd commands, this pipes
                                                                                                the output into the less program, so you can scroll
                                                                                                down by hitting space, use / (forward slash) to search,
                                                                                                and other familiar keybindings. You’ll also notice a
                                                                                                sprinkling of colour here too, with warnings and failure
                                                                                                messages in red.
                                                                                                  That’s a lot of information; to narrow it down to the
A Systemd GUI exists,                                                                           current boot, use:
although it hasn’t been                                                                         journalctl -b
actively worked on for a                                                                          And here’s where the Systemd journal starts to
couple of years.                                                                                shine. Do you want to see all messages from the



88                                                                  www.linuxvoice.com
                                                                                                            SYSTEM SERVICES TUTORIAL

                                                                                                                                      Binary logging isn’t
                                                                                                                                      popular, but the journal
                                                                                                                                      has some benefits, like
                                                                                                                                      very easy filtering of
                                                                                                                                      information.




previous boot? Try journalctl -b -1. Or the one before              If you want to narrow down to messages of a certain
that? Replace -1 with -2. How about something very                  priority, use the -p option. With 0 this will only show
specific, like all messages from 24 October 2014,                   emergency messages (ie it’s time to start praying to
16:38 onwards?”                                                     $DEITY), whereas 7 will show absolutely everything,
journalctl -b --since=”2014-10-24 16:38”                            including debugging messages. See the manual page
  Even if you deplore binary logs, that’s still a useful            (man journalctl) for more details on the priority levels.              PRO TIP
feature, and for many admins it’s much easier than                     It’s worth noting that you can combine options as               We’ve been
                                                                                                                                       Xxxxx   xxx xxx
                                                                                                                                                     mostly
                                                                                                                                                        xx xxxx
                                                                                                                                                              poking
                                                                                                                                                                  xxx
                                                                                                                                       xx xxx xx
                                                                                                                                       around      xxxx/usr/lib/
                                                                                                                                                inside  xxx xxx xxx
constructing a similar filter from regular expressions.             well, so to only show messages from the GDM service                systemd/system
                                                                                                                                       xx xxxx xxx xx xxxinxxthisxxxx
  So we’ve narrowed down the log to specific times,                 of priority level 3 (or lower) from the current boot, use:         xxx xx xxx
                                                                                                                                       tutorial, butxxyou
                                                                                                                                                       xxxxmay
                                                                                                                                                             xxx xx
but what about specific programs? For units, try this:              journalctl -u gdm.service -p 3 -b                                  xxx xxnoticed
                                                                                                                                       have    xxxx xxxsimilar
                                                                                                                                                          xx xxxfiles
                                                                                                                                                                   xx
                                                                                                                                       xxxx xxx
                                                                                                                                       inside  /etc/systemd/
                                                                                                                                                  xx xxx xx xxxxxx
journalctl -u gdm.service                                             Finally, if you just want to have a terminal window              system
                                                                                                                                       xxx xx xxxas xx
                                                                                                                                                    well.
                                                                                                                                                       xxxx
                                                                                                                                                          What’s
                                                                                                                                                             xxx xx
  (Note: that’s a good way to see the log generated by              open, constantly updating with the latest journal                  xxx difference?
                                                                                                                                       the  xx xxxx xxx Well,
                                                                                                                                                          xx xxxthexx
the X server.) Or how about a specific PID?                         entries, as you’d have with the tail command in pre-               xxxx xxx
                                                                                                                                       latter takes
                                                                                                                                                  xx xxx
                                                                                                                                                     precedence,
                                                                                                                                                          xx xxxx
                                                                                                                                       so if you have two unit
journalctl _PID=890                                                 Systemd installations, just enter journalctl -f.                   files with the same names
  You can even request to just see messages from a                                                                                     in both locations, the one
certain executable:                                                  Miked Saundersd has a PID of -1, divides by zero in his sleep,    in /etc/systemd/system
                                                                     and knows how to sew on a button.                                 will be used. Generally,
journalctl /usr/bin/pulseaudio                                                                                                         the former directory is
                                                                                                                                       where installed packages
                                                                                                                                       place their units, while
                                                                                                                                       the latter is for units
  Life without Systemd?                                                                                                                created by root.

  If you simply, absolutely can’t get on with Systemd, you still
  have a few choices among the major distributions. Most
  notably, Slackware, the longest-running distro, hasn’t made
  the switch yet – but its lead developer hasn’t ruled it out for
  the future. A few small-name distros are also holding out
  with SysVinit as well.
      But how long will this last? Gnome is becoming
  increasingly dependent on Systemd, and the other major
  desktop environments could follow suit. This is a cause
  of consternation in the BSD communities, as Systemd is
  heavily tied to Linux kernel features, so the desktops are
  becoming less portable, in a way. A half-way-house solution
  might arrive in the form of Uselessd (http://uselessd.
  darknedgy.net), which is a stripped-down version of
  Systemd that purely focuses on launching and supervising          If you don’t like Sysytemd, try Gentoo, which has it as a
  processes, without consuming the whole base system.               choice of init system, but doesn’t force it on its users.




                                                                      www.linuxvoice.com                                                                            89
      TUTORIAL GRUB 2



                                GRUB 2: HEAL YOUR
           TUTORIAL
                                BOOTLOADER
                                There are few things as irritating as a broken bootloader.
MAYANK SHARMA
                                Get the best out of Grub 2 and keep it shipshape.


                                T
                                         he Grub 2 Linux bootloader is a wonderful and        executed and the order of the corresponding entries
  WHY DO THIS?                           versatile piece of software. While it isn’t the      when the Grub 2 menu is built. The 00_header file is
  • Grub 2 is the most                   only bootloader out there, it’s the most popular     read first, which parses the /etc/default/grub
    popular bootloader          and almost all the leading desktop distros use it. The        configuration file. Then come the entries for the Linux
    that’s used by almost       job of the Grub bootloader is twofold. First, it displays     kernels in the 10_linux file. This script creates one
    every Linux distribution.
                                a menu of all installed operating systems on a                regular and one recovery menu entry for each kernel in
  • A bootloader is a vital
    piece of software, but      computer and invites you to pick one. Second, Grub            the default /boot partition.
    they are susceptible to     loads the Linux kernel if you choose a Linux operating          This script is followed by others for third-party apps
    damage.                     system from the boot menu.                                    such as 30_os-prober and 40_custom. The os-prober
  • Grub 2 is an expansive        As you can see, if you use Linux, you can’t escape          script creates entries for kernels and other operating
    and flexible boot loader
    that offers various         the bootloader. Yet it’s one the least understood             systems found on other partitions. It can recognise
    customisable options.       components inside a Linux distro. In this tutorial we’ll      Linux, Windows, BSD and Mac OS X installations. If
                                familiarise you with some of Grub 2’s famed versatility       your hard disk layout is too exotic for the os-prober
                                and equip you with the skills to help yourself when you       script to pick up an installed distro, you can add it to
                                have a misbehaving bootloader.                                the 40_custom file (see the “Add custom entries” box).
                                  The most important parts of Grub 2 are a bunch of             Grub 2 does not require you to manually maintain
                                                                text files and a couple of    your boot options’ configuration file: instead it
                                                                scripts. The first piece to   generates the /boot/grub/grub.cfg file with the
 “The Grub 2 Linux bootloader                                   know is /etc/default/
 is a wonderful and versatile                                   grub. This is the text file
                                                                in which you can set the        Graphical boot repair
 piece of software.”                                            general configuration
                                                                variables and other             A vast majority of Grub 2 issues can easily be resolved with
                                characteristics of the Grub 2 menu (see box titled              the touch of a button thanks to the Boot Repair app. This
                                “Common user settings”).                                        nifty little application has an intuitive user interface and
                                                                                                can scan and comprehend various kinds of disk layouts
                                  The other important aspect of Grub 2 is the
                                                                                                and partitioning schemes, and can sniff out and correctly
                                /etc/grub.d folder. All the scripts that define each            identify operating system installations inside them. The
 Boot Repair also lets          menu entry are housed there. The names of these                 utility works on traditional computers with a Master Boot
 you customise Grub 2’s         scripts must have a two-digit numeric prefix. Its               Record (MBR) as well as the newer UEFI computers with the
 options.                       purpose is to define the order in which the scripts are         UID Partition Table (GPT) layout.
                                                                                                    The easiest way to use Boot Repair is to install it inside
                                                                                                a Live Ubuntu session. Fire up an Ubuntu Live distro on a
                                                                                                machine with a broken bootloader and install Boot Repair by
                                                                                                first adding its PPA repository with the
                                                                                                sudo add-apt-repository ppa:yannubuntu/Boot Repair
                                                                                                command. Then refresh the list of repositories with
                                                                                                sudo apt-get update
                                                                                                before installing the app with
                                                                                                sudo apt-get install -y Boot Repair
                                                                                                   Fire up the tool once it’s installed. The app will scan
                                                                                                your hard disk before displaying its interface, which is
                                                                                                made up of a couple of buttons. To follow the advice of the
                                                                                                tool, simply press the Recommended Repair button, which
                                                                                                should fix most broken bootloaders. After it’s restored your
                                                                                                bootloader, the tool also spits out a small URL which you
                                                                                                should note. The URL contains a detailed summary of your
                                                                                                disks, including your partitions along with the contents
                                                                                                of important Grub 2 files including /etc/default/grub and
                                                                                                boot/grub/grub.cfg. If the tool hasn’t been able to fix your
                                                                                                bootloader, you can share the URL on your distro’s forum
                                                                                                boards to allow others to understand your disk layout and
                                                                                                offer suggestions.




 90                                                              www.linuxvoice.com
                                                                                                                            GRUB 2 TUTORIAL

grub2-mkconfig command. This utility will parse the
scripts in the /etc/grub.d directory and the /etc/              Grub 2 and UEFI
default/grub settings file to define your setup.
                                                                UEFI-enabled machines (more or less, any          options for each removable drive – a vanilla
                                                                machine sold in the last couple of years)         option and an option tagged with UEFI. Use
Bootloader bailout                                              have added another layer of complexity to         the latter to expose the EFI variables in
Grub 2 boot problems can leave the system in several            debugging a broken Grub 2 bootloader. While       /sys/firmware/efi/.
states. The text on the display where you’d expect the          the procedure for restoring a Grub 2 install on      From the live environment, mount the
bootloader menu gives an indication of the current              a UEFI machine isn’t much different than it is    root filesystem of the broken installation as
state of the system. If the system stops booting at the         on a non-UEFI machine, the newer firmware         mentioned in the tutorial. You’ll also have to
                                                                handles things differently, which results in      mount the ESP partition. Assuming it’s
grub> prompt, it means the Grub 2 modules were                  mixed restoration results.                        /dev/sda1, you can mount it with
loaded but it couldn’t find the grub.cfg file. This is the          On a UEFI-based system, you do not            sudo mount /dev/sda1 /mnt/boot/efi
full Grub 2 command shell and you can do quite a bit            install anything in the MBR. Instead you             Then load the efivars module with
here to help yourself. If you see the grub rescue>              install a Linux EFI bootloader in the EFI         modprobe efivars before chrooting into the
prompt, it means that the bootloader couldn’t find the          System Partition (ESP) and set it as the EFI’s    installed distribution as shown in the tutorial.
                                                                default boot program using a tool such as            Here on, if you’re using Fedora, reinstall
Grub 2 modules nor could it find any of your boot files.        efibootmgr for Linux, or bcdedit for Windows.     the bootloader with the
However, if your screen just displays the word ‘GRUB’,              As things stand now, the Grub 2               yum reinstall grub2-efi shim
it means the bootloader has failed to find even the             bootloader should be installed properly when      command followed by
most basic information that’s usually contained in the          installing any major desktop Linux distro,        grub2-mkconfig -o /boot/grub2/grub.cfg
Master Boot Record.                                             which will happily coexist with Windows           to generate the new configuration file.
                                                                8. However, if you end up with a broken           Ubuntu users can do this with
   You can correct these Grub failures either by using a        bootloader, you can restore the machine with      apt-get install --reinstall grub-efi-amd64
live CD or from Grub 2’s command shell. If you’re lucky         a live distro. When you boot the live medium,       With the bootloader in place, exit chroot,
and your bootloader drops you at the grub> prompt,              make sure you boot it in the UEFI mode. The       unmount all partitions and reboot to the
you have the power of the Grub 2 shell at your disposal         computer’s boot menu will have two boot           Grub 2 menu.
to correct any errors.
   The next few commands work with both grub> and
grub rescue>. The set pager=1 command invokes the             fill in the name of the kernel and the initrd, which will
pager, which prevents text from scrolling off the             save you a lot of time and effort.
screen. You can also use the ls command which lists               Once you’ve keyed these in, type boot at the next
all partitions that Grub sees, like this:                     grub> prompt and Grub will boot into the specified
grub> ls                                                      operating system.
(hd0) (hd0,msdos5) (hd0,msdos6) (hd1,msdos1)                      Things are a little different if you’re at the grub
   As you can see, the command also lists the partition       rescue> prompt. Since the bootloader hasn’t been able
table scheme along with the partitions.                       to find and load any of the required modules, you’ll
   You can also use the ls command on each partition          have to insert them manually:
to find your root filesystem:                                 grub rescue> set root=(hd0,5)
grub> ls (hd0,5)/                                             grub rescue> insmod (hd0,5)/boot/grub/normal.mod
lost+found/ var/ etc/ media/ bin/ initrd.gz                   grub rescue> normal
boot/ dev/ home/ selinux/ srv/ tmp/ vmlinuz                   grub> insmod linux
  You can drop the msdos bit from the name of the               As you can see, just like before, after we use the ls                Grub 2 has a command
partition. Also, if you miss the trailing slash and instead   command to hunt down the Linux partition, we mark it                   line, which you can invoke
say ls (hd0,5) you’ll get information about the partition     with the set command. We then insert the normal                        by pressing C at the
including its filesystem type, total size, and last           module, which when activated will return us to the                     bootloader menu.
modification time. If you have multiple partitions, read
the contents of the /etc/issue file with the cat
command to identify the distro, such as cat (hd0,5)/
etc/issue.
  Assuming you find the root filesystem you’re looking
for inside (hd0,5), make sure that it contains the
/boot/grub directory and the Linux kernel image you
wish to boot into, such as vmlinuz-3.13.0-24-generic.
Now type the following:
grub> set root=(hd0,5)
grub> linux /boot/vmlinuz-3.13.0-24-generic root=/dev/sda5
grub> initrd /boot/initrd.img-3.13.0-24-generic
   The first command points Grub to the partition
housing the distro we wish to boot into. The second
command then tells Grub the location of the kernel
image inside the partition as well as the location of the
root filesystem. The final line sets the location of the
initial ramdisk file. You can use tab autocompletion to



                                                                www.linuxvoice.com                                                                                 91
     TUTORIAL GRUB 2

                                                                                          This command will rewrite the MBR information on
                                                                                          the /dev/sda device, point to the current Linux
                                                                                          installation and rewrite some Grub 2 files such as
                                                                                          grubenv and device.map.
                                                                                             Another common issue pops up on computers with
                                                                                          multiple distros. When you install a new Linux distro,
                                                                                          its bootloader should pick up the already installed
                                                                                          distros. In case it doesn’t, just boot into the newly
                                                                                          installed distro and run
                                                                                          grub2-mkconfig
                                                                                          Before running the command, make sure that the root
                                                                                          partitions of the distros missing from the boot menu
                                                                                          are mounted. If the distro you wish to add has /root
                                                                                          and /home on separate partitions, only mount the
                                                                                          partition that contains /root, before running the
                                                                                          grub2-mkconfig command.
                                                                                             While Grub 2 will be able to pick most distros, trying
                                                                                          to add a Fedora installation from within Ubuntu
                                                                                          requires one extra step. If you’ve installed Fedora with
                                                                                          its default settings, the distro’s installer would have
                                                                                          created LVM partitions. In this case, you’ll first have to
                                                                                          install the lvm2 driver using the distro’s package
                                                                                          management system, such as with
                                                                                          sudo apt-get install lvm2
                                                                                          before Grub 2’s os-prober script can find and add
                                                                                          Fedora to the boot menu.
To disable a script under
the /etc/grub.d, all you
                              standard grub> mode. The next command then                  Thorough fix
need to do is remove the      inserts the linux module in case it hasn’t been loaded.     If the grub2-install command didn’t work for you, and
executable bit, for example   Once this module has been loaded you can proceed to         you still can’t boot into Linux, you’ll need to completely
with                          point the boot loader to the kernel image and initrd        reinstall and reconfigure the bootloader. For this task,
chmod -x /etc/grub.d/20_      files just as before and round off the procedure with       we’ll use the venerable chroot utility to change the run
memtest86+                    the boot command to bring up the distro.                    environment from that of the live CD to the Linux
which will remove the            Once you’ve successfully booted into the distro,         install we want to recover. You can use any Linux live
‘Memory Test’ option from     don’t forget to regenerate a new configuration file for     CD for this purpose as long as it has the chroot tool.
the menu.
                              Grub with the                                               However, make sure the live medium is for the same
                              grub-mkconfig -o /boot/grub/grub.cfg                        architecture as the architecture of the installation on
                              command. You’ll also have to install a copy of the          the hard disk. So if you wish to chroot to a 64-bit
                              bootloader into the MBR with the                            installation you must use an amd64 live distro.
                              sudo grub2-install /dev/sda                                     After you’ve booted the live distro, the first order of
                              command.                                                    business is to check the partitions on the machine.
                                                                                          Use fdisk -l to list all the partitions on the disk and
                              Dude, where’s my Grub?
                              The best thing about Grub 2 is that you can reinstall it
                                                                                            Common user settings
                              whenever you want. So if you lose the Grub 2
                                                              bootloader, say when          Grub 2 has lots of configuration variables. Here are some of
                                                              another OS like Windows       the common ones that you’re most likely to modify in the
“The best thing about Grub 2                                  replaces it with its own
                                                                                            /etc/default/grub file. The GRUB_DEFAULT variable specifies
                                                                                            the default boot entry. It will accept a numeric value such as
is that you can reinstall it                                  bootloader, you can
                                                              restore Grub within a few
                                                                                            0, which denotes the first entry, or “saved” which will point

whenever you want.”                                           steps with the help of a
                                                                                            it to the selected option from the previous boot. The GRUB_
                                                                                            TIMEOUT variable specifies the delay before booting the
                                                              live distro. Assuming         default menu entry and the GRUB_CMDLINE_LINUX variable
                                                                                            lists the parameters that are passed on the kernel command
                              you’ve installed a distro on /dev/sda5, you can
                                                                                            line for all Linux menu entries.
                              reinstall Grub by first creating a mount directory for            If the GRUB_DISABLE_RECOVERY variable is set to true,
                              the distro with                                               the recovery mode menu entries will not be generated.
                              sudo mkdir -p /mnt/distro                                     These entries boot the distro into single-user mode from
                              and then mounting the partition with                          where you can repair your system with command line tools.
                                                                                            Also useful is the GRUB_GFXMODE variable, which specifies
                              mount /dev/sda5 /mnt/distro
                                                                                            the resolution of the text shown in the menu. The variable
                              You can then reinstall Grub with                              can take any value supported by your graphics card.
                              grub2-install --root-directory=/mnt/distro /dev/sda



92                                                                www.linuxvoice.com
                                                                                                                            GRUB 2 TUTORIAL

make note of the partition that holds the Grub 2
installation that you want to fix.                           Add custom entries
   Let’s assume we wish to restore the bootloader            If you wish to add an entry to the bootloader     }
from the distro installed in /dev/sda5. Fire up a            menu, you should add a boot stanza to the           For more accurate results, instead of
terminal and mount it with:                                  40_custom script. You can, for example,           device and partition names you can use their
                                                             use it to display an entry to boot a Linux        UUIDs, such as
sudo mount /dev/sda5 /mnt
                                                             distro installed on a removable USB drive.        set root=UUID=54f22dd7-eabe
Now you’ll have to bind the directories that the Grub 2      Assuming your USB drive is sdb1, and the              Use
bootloader needs access to in order to detect other          vmlinuz kernel image and the initrd files are     sudo blkid
operating systems:                                           under the root (/) directory, add the following   to find the UUIDs of all the connected drives
$ sudo mount --bind /dev /mnt/dev                            to the 40_custom file:                            and partitions. You can also add entries for
                                                             menuentry “Linux on USB” {                        any distros on your disk that weren’t picked
$ sudo mount --bind /dev/pts /mnt/dev/pts
                                                             set root=(hd1,1)                                  up by the os-prober script, as long as you
$ sudo mount --bind /proc /mnt/proc                          linux /vmlinuz root=/dev/sdb1 ro quiet splash     know where the distro’s installed and the
$ sudo mount --bind /sys /mnt/sys                            initrd /initrd.img                                location of its kernel and initrd image files.
  We’re now all set to leave the live environment and
enter into the distro installed inside the /dev/sda5
partition via chroot:                                      order:
$ sudo chroot /mnt /bin/bash                               $ exit
  You’re now all set to install, check, and update Grub.   $ sudo umount /mnt/sys
Just like before, use the                                  $ sudo umount /mnt/proc
sudo grub2-install /dev/sda                                $ sudo umount /mnt/dev/pts
command to reinstall the bootloader. Since the             $ sudo umount /mnt/dev
grub2-install command doesn’t touch the grub.cfg           $ sudo umount /mnt
file, we’ll have to create it manually with                  You can now safely reboot the machine, which
sudo grub-mkconfig -o /boot/grub/grub.cfg                  should be back under Grub 2’s control, and the
  That should do the trick. You now have a fresh copy      bootloader under yours!
of Grub 2 with a list of all the operating systems and
distros installed on your machine. Before you can           Mayank Sharma has been tinkering with Linux since the 90s
restart the computer, you’ll have to exit the chrooted      and contributes to a variety of technical publications on both
                                                            sides of the pond.
system and unmount all the partitions in the following




                                                             www.linuxvoice.com                                                                                 93
     CODING ATLAS: THE UK’S SUPERCOMPUTER



                            ATLAS: THE UK’S
         TUTORIAL
                            SUPERCOMPUTER
     JULIET KEMP
                            In the 1950s came the transistor, and with the transistor came the
                            supercomputer – here’s how to program one of the first.

                            A
                                      tlas, in Manchester, was one of the first           1955.) Once junction transistors became available, the
                                      supercomputers; it was said that when Atlas         second version of the machine was more reliable.
                                      went down, the UK’s computing capacity was
                            reduced by half. Today supercomputers are massively           Building Atlas
                            parallel and run at many, many times the speed of             After the success of the Transistor Computer, the next
                            Atlas. (The fastest in the world is currently Tianhe-2, in    challenge the team set themselves was to build a
                            Guangzhou, China, running at 33 petaflops, or over a          “microsecond engine” – a computer that could
                            thousand million times faster than Atlas.) But some of        operate at one microsecond per instruction (or close
                            the basics of modern computers still owe something            to it), so managing a million instructions a second.
                            to the decisions made by the Atlas team when they             (This is not quite the same as one megaflop, as
                            were trying to build their ‘microsecond engine’.              FLOPS measure floating-point operations, not
                               The computers of the early 1950s were built with           instructions, and are a little slower than instructions.)
                            vacuum tubes, which made for machines which                      The machine was initially called MUSE (after the
                            were enormous, unreliable, and very expensive. The            Greek letter μ, meaning one-millionth), but was
                            University of Manchester computing team already               renamed Atlas once the Ferranti company became
                            had one of these, the Manchester Mark 1 (which                involved in 1958. When Atlas was officially first
                            Alan Turing worked with), which began operation in            commissioned, in December 1962, it was one of the
                            April 1949. They were working on a smaller version            most powerful computers in the world, running at (at
                            when Tom Kilburn, director of the group, set a couple         peak) 1.59 microseconds per instruction, or around
                                                           of his team to designing       630,000 instructions/second.

“Germanium transistors were                                a computer which used
                                                           transistors.
                                                                                             Atlas was an asynchronous processing machine,
                                                                                          with 48-bit words, 24-bit addressing, and (in the
even less reliable than valves,                               The result was the          Manchester installation) 16k word core store and 96k

but were a lot cheaper to run.”                            Transistor Computer, the
                                                           world’s first transistorised
                                                                                          word drum store. It also had over a hundred index
                                                                                          registers to use for address modification. It was fitted
                                                           computer, first operational    up for magnetic tape (a big novelty at the time and
                            in April 1953. It used germanium point-contact                much faster than paper tape).
                            transistors, the only type available at the time, which          One important feature was instruction pipelining,
                            were even less reliable than valves; but they were a lot      which meant being able to speed up programs
The University of
                            cheaper to run, using much less power. It did still use       beyond merely running instructions more quickly. With
Manchester’s ATLAS
machine, photographed       valves for memory read/write and for the clock cycle,         instruction pipelining, the CPU begins to fetch the next
on 1 January 1963. Photo:   so it wasn’t fully transistorised. (The first fully           instruction while the current one is still processing.
Iain MacCallum              transistorised computer was the Harwell CADET, in             Instead of holding up the whole CPU while a single
                                                                                          instruction goes through the CPU’s various parts,
                                                                                          pipelining means that instructions follow one another
                                                                                          from point A to point B to point C through the CPU,
                                                                                          maximising the amount of work being done by the
                                                                                          CPU at a particular time, and minimising the overall
                                                                                          time. Obviously this does require appropriate
                                                                                          programming to take advantage of it.
                                                                                             Atlas’ “Extracode” setup also allowed certain more
                                                                                          complex instructions to run as software rather than
                                                                                          be included in the hardware. The most significant bit
                                                                                          of the top 10 bits of a word determined whether an
                                                                                          instruction was a normal hardware instruction, or an
                                                                                          Extracode instruction. An Extracode instruction meant
                                                                                          that the program would jump to what was basically a
                                                                                          subroutine in the ROM, and run that. This was a way
                                                                                          of reducing the complexity of the hardware while still



94                                                           www.linuxvoice.com
                                                                         ATLAS: THE UK’S SUPERCOMPUTER CODING

being able to provide those complicated instrutions
‘baked in’ to the machine (and thus easy to use for           Transitors
programmers). Extracode instructions were used
                                                              Vacuum tubes, used in all the 1940s             slightly impure becomes a semiconductor,
particularly for calculations like sine/cosine and
                                                              computers, were far from ideal. Everyone        which is what is needed for a transistor
square root (inefficient to wire into the hardware); but      in the industry was keen for something          to work. The amount of impurity must be
they were also used for operating system functions            different. In particular, Bell (the telephone   tightly controlled to create the correct effect.
like printing to output or reading from a tape. (See the      company) wanted a more reliable component       Germanium transistors were very quickly
next section for more on the Atlas Supervisor.)               for telephone systems. It put together a        replaced by junction transistors, which are
                                                              team to research transistors, based on an       more robust and easier to make.
   The first production Atlas, the Manchester
                                                              idea patented in the late 1920s by physicist        Transistors are an essential part of nearly
installation, started work in 1962, although the OS           Julius Lilienfeld. The Bell Labs team           all modern electronics, although most
software, Atlas Supervisor (see below) wasn’t fully           produced a working transistor in 1947 (a        modern transistors are silicon rather than
operational until early 1964. Ferranti and the                French team repeated this independently         germanium. The fact that they can be easily
University shared the available time on Atlas, running        in 1948). Bell Labs’ Shockley, Bardeen, and     mass-produced at low cost (more than ten
                                                              Brattain won the Nobel Prize in Physics in      million transistors can be made per US cent)
between them up to a thousand user programs in a
                                                              1956 for their work.                            has been a crucial part of the development
20-hour ‘day’. The value of the machine to the                   Fundamentally, transistors control and       of mass modern technology. These days they
University was estimated at £720,000 per year in              direct the flow of electricity. They act as     are usually part of an integrated circuit rather
1969, if they’d had to buy it in externally.                  switches (sending current one way or            than wired together as with early transistor
                                                              another, or switching it off), and they can     computers, but they’re still at the core of all
                                                              also amplify current, making the output         practical electronics. Estimates of transistors
Software
                                                              power greater than the input power. The first   made per year vary between about half a
A 48-bit Atlas instruction was divided into four parts: a     transistors were made from germanium,           billion and a billion per person on the Earth,
10-bit function code, 7-bit Ba (bits 10-16) and 7-bit Bm      which when pure is an insulator, but when       and those numbers are still going up.
(bits 17-25) index registers, and a 24-bit address.
There were two basic types of instruction: B-codes,
which used Bm as a modifier and Ba as a register            potentially onto many different devices, maintaining a
address and did integer operations; and A-codes,            list of documents to be output.
which provided floating point arithmetic.                      One of the radical innovations of Atlas was virtual
   The B index registers were used to modify the given      memory. Computers had (and still have) two levels of
address to get the ‘correct’ one (useful for moving         memory: main (working) memory and secondary
through a series of memory locations); having two           (disk; or drums/tapes back in the 1950s) memory. A
index fields meant Atlas could be double-indexed. You       program can only deal directly with main memory. For
could also test the Bm register and then do something       a programmer trying to perform a calculation (such as               Ann Moffat worked with
specific with the contents of the Ba register,              matrix multiplication) that couldn’t fit into main                  Ferranti on the Manchester
depending on the result of the test. Specifically, there    memory, a large part of the job became working out                  Atlas from 1962, and
was a general form of:                                      how to switch data in and out of secondary memory,                  in 1966 was one of the
   “if CONDITION then load register Ba with address N       how to do it most efficiently, what blocks (pages) to               earliest teleworkers – here
(and optionally act on Bm); otherwise do nothing”           divide it into, how to swap it in and out, and so on. The           seen writing programs to
   Since register B127 was the program counter, this        designers of Atlas were working programmers (as                     analyse Concorde’s black
                                                            was everyone working in computers at the time), and                 box, with her daughter.
could be used as a program operation transfer. Simply
                                                                                                                                Copyright Rutherford
set N to the location you want to jump to, and set Ba       it was very clear to them that automating this process
                                                                                                                                Appleton Laboratory
to B127. If the condition is true, B127 now contains        would make programmers’ lives much easier. Atlas’                   and the Science and
address N, and the program jumps to N.                      virtual memory had three important features:                        Technology Facilities
   Other B registers also had specific roles, and there        It translated addresses automatically into memory                Council (STFC). www.
is a comprehensive list of these registers and many            locations (so the programmer didn’t need to keep                 chilton-computing.org.uk.
other details of the system in the short book The Story
of ATLAS by Iain Stinson (http://elearn.cs.man.ac.
uk/~atlas/docs/london%20atlas%20book.pdf).
   Atlas Supervisor was the Atlas operating system,
which managed resources and allocated them
between user programs and other tasks, including
managing virtual memory. It’s been called “the first
recognisable modern OS” in terms of how it managed
jobs and resources. At any given time, multiple user
programs could be running, and it was Atlas
Supervisor’s responsibility to manage resources and
workload. The Scheduler and Job Assembler would
assemble all parts of a job and sort it into one of two
queues (requires its own magnetic tape, or does not).
The Central Executive took care of program-switching,
error-monitoring, Extracodes, and memory
management. Output Assembly handled output



                                                              www.linuxvoice.com                                                                             95
     CODING ATLAS: THE UK’S SUPERCOMPUTER

                                                                                          compile.) Next, go to Project > Properties > Compiler,
                                                                                          and make sure that the Hase directory is set correctly
                                                                                          to where you installed HASE. Finally, hit the Compile
                                                                                          and Build buttons on the menu bar.
                                                                                             Having compiled the code, you can run it (with the
                                                                                          green running person icon), then load the tracefile
                                                                                          back into the simulator and watch it run (use the clock
                                                                                          icon, and choose the relevant results file). Run it to
                                                                                          watch changes happen in the simulated construction.
                                                                                          You can also watch the pipelining happen, and the
                                                                                          virtual pages being requested and loaded.
                                                                                             If you want to look at the program instructions
                                                                                          themselves, they are found in the DRUM_STORE.
                                                                                          pageX.mem files in the model directory, starting with
                                                                                          page 0. They are structured as:
                                                                                          instruction Ba Bm address
                               track of memory locations by hand).                           The Drum Store contains the program code in page
The Atlas machine room at
                               It had demand paging: the address translator would         0, fixed-point integers in page 2, and floating-point
Chilton in 1967. Copyright
Rutherford Appleton            automatically load a required page of data into main       reals in page 3. The Core Store is empty at the start of
Laboratory and the             memory when it was required.                               the simulation, with Block 0 modelled as an
Science and Technology         It had an algorithm which identified the currently         instruction array, Block 1 as an integer array, and Block
Facilities Council (STFC).     least-required pages and moved them back into              2 as a floating-point array. As each array of code/
www.chilton-computing.         secondary memory.                                          integers/floating-point number is needed, it is fetched
org.uk.                         Fundamentally, this is still what virtual memory          in from the Drum Store.
                             does today, and it does, as expected, make                      For an explanation of the instructions used in each
                             programming massively more straightforward. It’s             model, check out the HASE Atlas simulation webpage
                             also vital for running multiple programs at the same         (www.icsa.inf.ed.ac.uk/cgi-bin/hase/atlas.pl?menu.
                             time, allowing the OS to swap parts of jobs in and out       html,atlas.html), which also has more details of the
                             of memory as they are required.                              simulation itself. The listing of the first demonstration
                                                                                          program doubles as a list of Atlas instructions.
                             Emulator                                                        You can also try the other demonstration programs,
                             An Atlas simulator is available from the Institute for       both of which do actual mathematics. V3.2 is a Sum
                             Computing Systems Architecture (University of                of Squares program, which should report in the
                             Edinburgh – www.icsa.inf.ed.ac.uk/research/                  Output window the result 3, 4, 5, (then print stopping).
                             groups/hase/models/atlas/index.html). You can                This is the solution of the equation a2 + b2 = c 2 for a,
                             download their three sample programs from their              b, c < 8. We couldn’t find any output for the Matrix
                             website. This is a simulator rather than an emulator, in     Multiplication program (updates would be welcome if
                             that it simulates the operation of the Atlas                 any readers do experiment with it!). An explanation of
                             architecture by modelling its internal state, but doesn’t    the model is at the link above.
                             pretend to give the experience of operating the whole           More information about HASE, a user guide, and
                             machine.                                                     how to create your own models, is available here:
                                To run the simulator, you’ll first need to download       www.icsa.inf.ed.ac.uk/research/groups/hase/
                             and install HASE III. There are detailed instructions        manuals/index.html.
                             www.icsa.inf.ed.ac.uk/research/groups/hase/
                             models/use.html, but basically you download the jar          Building your own program
                             file, then type:                                             If you copy the contents of one of the sample
                             java -jar Setup_HASE_3.5.jar                                 directories wholesale into another directory, and
                             at a terminal window. Run as root to be able to install      rename atlas_v*.* to my_project.* (so you’re
                             for all users of the machine, or as a user to install for    renaming the .edl .elf .params files), you can edit the
                             just that user. You can then run the bin/Hase                DRUM_STORE.page0.mem file to produce your own
                             executable from wherever you installed the program.          small program. Here’s one example:
                                To run one of the Atlas projects, download one of         A314 0 0 12288
                             the samples and unzip it, choose Open Project from           A320 0 0 12296
                             the HASE menu, then choose the relevant .edl file. So        A346 0 0 12304
                             for Atlas_V1.3, the project that demonstrates each of        STOP
                             the various instructions, choose V1.3/atlas_v1.3.edl.        nop 0 0 0 ... to end of file (must be 256 lines)
                                To compile the project, first, if you installed HASE as     This loads the value in word 1536 into the
                             root, you’ll need to make sure that the user as which        accumulator (A314), adds the value in word 1537 to it
                             you’re running has write access to hase/hase-iii/lib.        (A320), and then stores the result in word 1538
                             (This seems only to be necessary for the first               (A346). Words 1536 onwards are found at the start of



96                                                            www.linuxvoice.com
                                                                         ATLAS: THE UK’S SUPERCOMPUTER CODING




                                                                                                                       The simulator after running
DRUM_STORE.page3.mem, and are loaded into the              that won’t load! Two more Atlas machines were built
                                                                                                                       the v1.3 model. The blue
core store block 2 when needed.                            alongside the Manchester one; one shared by BP and          fast-forward button runs
  To run it, load the project, compile it, run, and then   the University of London, and one for the Atlas             the whole thing as fast as
you can watch the trace. If editing, reload the project,   Computer Laboratory in Chilton near Oxford, which           possible. The green button
then recompile.                                            provided a shared research computing service to             allows you to watch more
  Here’s the same example (adding two numbers) in          British scientists.                                         slowly, or you can step
B-instructions:                                                                                                        through one process at a
B121 1 0 3                                                 After Atlas                                                 time.
B124 2 1 4                                                 Ferranti also built a similar system, called Titan (aka
E1064 0 0 0                                                Atlas 2), for Cambridge University. Its memory was
E1067 2 0 0                                                organised a little differently, and it ran a different OS
STOP                                                       written by the Computer Lab folk at Cambridge. Titans
  This loads the value 3 (not a memory address) into       were also delivered to the CAD Centre in Cambridge,
B1 in line 0 (B121), then in line 1 adds 4 modified by     and to the Atomic Weapons Establishment at
                                                                                                                           PRO TIP
the contents of B1 to B2:                                  Aldermaston. The Manchester Atlas was
                                                                                                                        There is an emulator
B124 B-register B-modification-register Number             decommissioned in 1971, and the last of the other
                                                                                                                        (which copies external
  So in practice this adds 4 + B1 = 4 + 3 = 7 to B2        two closed down in 1974. The Chilton Atlas main              behaviour) of the whole
(which starts as zero). Line 2 uses an Extracode           console was rediscovered earlier this year and is now        thing available, but it’s
                                                                                                                        Windows-only; see Dik
instruction:                                               at the Rutherford Appleton Laboratory in Chilton;
                                                                                                                        Leatherdale’s webpage
E1064                                                      National Museums Scotland in Edinburgh also has a            at www.dikleatherdale.
to output a newline, then line 3 uses another              couple of its parts. The Titans closed down between          webspace.virginmedia.
                                                                                                                        com/atlas.html.
Extracode instruction:                                     1973 and 1974.
E1067                                                         The Atlas team were responsible for the start of
to output the contents of B2.                              numerous concepts (such as pipelining, virtual
   You can see the output 7 in the bottom window,          memory and paging, as well as some of the OS ideas
and in the main window, the 7 in the process of being      behind Atlas Supervisor) which are still important in
returned to Control as part of instruction 1.              modern computing; and, of course, at the time, the
   As mentioned above, the first test program listing in   machines themselves were of huge research
the Atlas model information (www.icsa.inf.ed.ac.uk/        importance. It’s rather a shame that it seems largely
cgi-bin/hase/atlas.pl?menu.html,atlas.html) is             to have been forgotten in the shadow of other
effectively an instruction listing. The earlier B          supercomputers such as those made by Cray and by
instructions, for example, access memory locations         IBM. It was certainly a very successful British project
rather than absolute values. Remember that A               at the time.
instructions managed floating point operations, and B         In 2012, Google produced a short film remembering
instructions the integer operations. This means that A     the Atlas, which is available online. There’s also a
instructions operate only on the floating-point values     collection of links and memories available on the
(from block 2 of the core store, word 1536 onwards,        Manchester University website. There’s some
memory location 12288 onwards), and B instructions         documentation on the Chiltern Computing website,
only on integers (block 1 of the core store, word 1024     too, including this brochure from 1967
onwards, location 8192 onwards). We’re not sure to         (www.chilton-computing.org.uk/acl/literature/acl/
what extent this exactly mirrors the real setup of Atlas   p003.htm).
memory and to what extent it is a feature of the
organisation of the simulator, but do bear it in mind to    Juliet Kemp is a scary polymath, and is the author of
                                                            O’Reilly’s Linux System Administration Recipes.
avoid getting really frustrated with memory locations



                                                             www.linuxvoice.com                                                                     97
     CODING MANDELBROT & PYTHON



                                       PYTHON: MAKE YOUR
            TUTORIAL
                                       OWN JULIA FRACTALS
  TARIQ RASHID
                                       With a smattering of Python and some clever maths you can create
                                       even more beautiful chaos inside your Linux box.

                                       J
                                               ulia sets are closely related to the Mandelbrot
                                               Set, which we explored last issue with some
                                               basic Python. All of these are produced by the
                                       code we’ll develop here from the same simple iterated
                                       function z2+c as the Mandelbrot fractals.
                                          You can see that they are different to the
                                       Mandelbrot set, and yet there’s something about
                                       them that is similar. You can also see that some
                                       Julia sets are a single object like the Mandelbrot, but
     PRO TIP                           some are many pieces, with some even becoming so
 Explore the Mandelbrot                fragmented they are almost like dust.
 and Julia fractals using
 the interactive XaoS open
                                          It might not be obvious, but while there is only one
 source software at http://            Mandelbrot, there are infinitely many Julia sets. The                 Just one look tells you that the Julia set is very closely
 bit.ly/1vLdz52 or through             recipe, or algorithm, for creating Julia sets is the same             related, but subtly different to the Mandelbrot set.
 a web browser http://bit.
 ly/1lbXYL1
                                       as that for the Mandelbrot set except for one key
                                       difference.                                                                  pass
                                          Let’s remind ourselves of the recipe for the                           pass
                                       Mandelbrot set. We choose a rectangle on the                            return iteration
                                       complex plane and test many evenly spaced points                        You can see that z doesn’t start at (0+0i) anymore
                                       to see whether they’re part of the Mandelbrot set. We                 but is a parameter passed to the function. The
                                       do this by seeing if repeated iteration of a function                 parameter c is also passed but is a fixed complex
                                       z2+c, where c is the point being tested, results in the               number and not a number representing the point
                                       orbit escaping and diverging, or not. And if it does,                 being tested, because z does that now.
                                       we colour the point according to how fast the point                     The Python program to plot Julia sets is presented
                                       diverges.                                                             here for easy reference:
                                          This recipe is essentially the same for making Julia               # loads the numerical and plotting extensions to Python
Instead of c representing              sets. The difference is that the roles of the z and c                 # needed if you’re using a locally installed IPython, not for some
the point on the complex               values are reversed (see diagram below).                              online IPython providers
being tested (as in the                   The following shows the calculating function julia(z,              %pylab inline
Mandlebrot set), it is kept            c, maxiter), based on the mandel(c, maxiter) function
constant for all the points            we developed in the last issue:                                       # set the location and size of the atlas rectangle
being tested. Similarly
                                       def julia(z, c, maxiter):                                             xvalues = linspace(-2, 2, 1000)
instead of z starting
                                         for iteration in xrange(maxiter):                                   yvalues = linspace(-2, 2, 1000)
from zero, it starts as
the complex number                          z = (z*z) + c
representing the point                      if abs(z) > 4:                                                   # size of these lists of x and y values
being tested.                                  break                                                         xlen = len(xvalues)
                                                                                                             ylen = len(yvalues)
              Mandelbrot set                                                Julia set
                                                                                                             # value of c (unique for each Julia set)
                                                                                                             c = complex(-0.35, 0.65)
                                                       2
                                            Iterate z + c
                                                                                                             # julia function, takes the fixed parameters z and c and the
                                                                                                             maximum number of iterations maxiter, as inputs
                                                                                                             def julia(z, c, maxiter):
                                         Different c                                                              # start iterating and stop when it’s done maxiter times
                                                                                               Different z
     C is point on rectangle being                           Z is point on rectangle being                      for iteration in xrange(maxiter):
     tested, varies across rectangle                         tested, varies across rectangle
     Z starts at zero (0+01)                                 C is fixed for this Julia set                       # the main function which generates the output value of z
                                                                                                             from the input values using the formula (z^2) + c



98                                                                               www.linuxvoice.com
                                                                                                          MANDELBROT & PYTHON CODING

    z = (z*z) + c


    # check if the (pythagorean) magnitude of the output
complex number z is bigger than 4, and if so stop iterating as
we’ve diverged already
    if abs(z) > 4:
       break
       pass
    pass


  # return the number of iterations we actually did, not the final
value of z, as this tells us how quickly the values diverged past
the magnitude threshold of 4
  return iteration


# create an array of the right size to represent the atlas, we use
the number of items in xvalues and yvalues
atlas = empty((xlen,ylen))
                                                                                                                                             Some Julia fractals
# go through each point in this atlas array and test to see how                                                                              are more broken up,
many iterations are needed to diverge (or reach the maximum                 pass
                                                                                                                                             while others are more
                                                                                                                                             contiguous.
iterations when not diverging)                                            pass
for ix in xrange(xlen):
   for iy in xrange(ylen):                                              # set the figure size
                                                                        figsize(18,18)
      # at this point in the array, work out what the actual real and
imaginary parts of x are by looking it up in the xvalue and yvalue      # plot the array atlas as an image, with its values represented as
lists                                                                   colours, peculiarity of python that we have to transpose the
      zx = xvalues[ix]                                                  array
      zy = yvalues[iy]
      z = complex(zx, zy)                                               imshow(atlas.T, interpolation=”nearest”)
                                                                          Try plotting different Julia sets by changing the c
    # now we know what c is for this place in the atlas, apply the      parameter. Remember it is the single parameter c
mandel() function to return the number of iterations it took to         which uniquely defines the Julia set.
diverge
    # we use 80 maximum iterations to stop and accept the               3D fractal landscapes
function didn’t diverge                                                 This section will require you to use a locally installed
    atlas[ix,iy] = julia(z,c,80)                                        version of IPython, because the online IPython services
                                                                        can’t access your OpenGL graphics subsystem to                           PRO TIP
                                                                        render the three-dimensional plots.
  Pretty as a picture                                                     Let’s try to turn the two-dimensional flat images of
                                                                                                                                              The code for the full
                                                                                                                                              programs to calculate and
  Here’s an image produced by one of the filters provided by            the Mandelbrot and Julia sets into three dimensions.                  plot the Mandelbrot and
                                                                        One way to do this is to use the colour information in                Julia fractals is online at
  the same extension that we got the Gaussian filter from. It’s
                                                                                                                                              http://bit.ly/1qpnlsE.
  beautiful – and is the cover of the author’s ebook (http://           each image array to represent altitude; the height of a
  www.amazon.co.uk/Make-Your-Mandelbrot-Tariq-Rashid-                   landscape above sea level as it were. We should then
  ebook/dp/B00JFIEC2A). See if you can recreate it yourself.
                                                                        see mountainous landscapes shaped by the values of
     The image is the result of a filter that highlights edges
  (a Sobel filter) applied to the same Julia images we created          arrays filled by the Mandelbrot or Julia calculations.
  previously. The code is at http://bit.ly/1qpnlsE.
                                                                        Surface plot
                                                                        Let’s try it on a very simple array first. The following
                                                                        code prepares a 3x2 array:
                                                                        a = zeros( [3,2] )
                                                                        a[0,0] = 1
                                                                        a[0,1] = 2
                                                                        a[1,0] = 4
                                                                        a[2,1] = 3
                                                                        print a
                                                                          Plotting a simple flat image based on these values,
                                                                        using imshow(a, interpolation=”nearest”) results in
                                                                        the simple 2D plot as expected.



                                                                          www.linuxvoice.com                                                                            99
      CODING MANDELBROT & PYTHON

                                Now let’s plot this same array in three dimensions,     three-dimensional plots, remembering to import the
                              with the third dimension given by the value of each       mayavi extension too. It’s worth keeping the previous
                              cell. To do this we need to use a new extension to        imshow() instruction to see the flat view too. The
                              Python called mayavi.                                     instructions are as follows. The warp_scale was
                                Telling IPython that we want to use mayavi uses         adjusted to 1.0 to give a reasonable height, the default
                              the import instruction, just as before. The special       setting created hills that were a little too steep:
                              paylab instruction is to ensure that the common set       mayavi.mlab.surf(atlas.T, warp_scale=1.0)
      PRO TIP                 of numerical extensions are automatically loaded in       mayavi.mlab.show()
 Don’t forget that in         the local IPython:                                          These three-dimensional height fields as some
 Python, like many            %pylab inline                                             people call them, give an interesting perspective of the
 programming langauges,
 counting elements of         import mayavi.mlab                                        Mandelbrot set.
 arrays and lists starts at      The instructions to plot a surface are simple:           Let’s try that again but with the original rectangle
 0 not 1.                     mayavi.mlab.surf(a, warp_scale=”auto”)                    zooming into details of the Mandelbrot set, and also
                              mayavi.mlab.show()                                        change the colour palette by using the interactive
                                 The first instruction prepares the surface plot and    menus. Some of these landscapes are quite haunting.
                              allows IPython to automatically scale the heights. The    Let’s try the same idea with Julia sets.
                              second instruction is needed to actually show the plot.
                              This time the result will appear in a separate window     Gentler landscapes
                              outside your browser. You can do quite a lot to this      Some of the landscapes we created were a little spiky
                              3D plot, including rotating it around and changing the    and noisy. Let’s see if we can calm them down,
                              lighting that illuminates it. The images at the bottom    smooth off the sharp edges, and reduce the
                              of the page show the above small array plotted in         cragginess a little, all in the hope of creating a perhaps
                              this way, and again rotated using the mouse. Try it       more gentle, more appealing, landscape.
                              yourself.                                                     One way to do this is to calculate a new image
                                 For easy reference, the entire code for creating a     array, based on the original one, but with each new
                              simple 3x2 array and plotting a three-dimensional plot    value somehow smoothed based on its neighbour’s
                              of it as as follows:                                      values. We want to calculate the average over a small
                              %pylab inline                                             group of neighbouring array elements, perhaps a 3x3
                              import mayavi.mlab                                        square or a bigger circle. Engineers and scientists who
                                                                                        work with images or signals do this kind of thing fairly
                              a = zeros( [3,2] )                                        often to try to reduce noise.
                              a[0,0] = 1                                                    Python provides a collection of such filters that can
                              a[0,1] = 2                                                be applied to an array of values, which is often useful
                              a[1,0] = 4                                                when they are in fact images. A common smoothing
      PRO TIP                 a[2,1] = 3                                                filter is a slightly more sophisticated version of the
 You can explore these 3D                                                               local average we just described, called a Gaussian blur
 views by rotating them       mayavi.mlab.surf(a, warp_scale=”auto”)                    filter. If you work with photo editing applications like
 and dragging them with       mayavi.mlab.show()                                        Photoshop or Gimp then you’ll be familiar with applying
 your pointer, and use the
 menus to select different      We now apply this same idea to the larger arrays        a Gaussian blur to smooth an image.
 ligthting, colour palettes   created by the Mandelbrot code we wrote earlier.              To get access to these filters, we’ll need to import
 and many other options.      We simply add the new instructions to create the          the Python extension at the top of our code as follows:




Small rotated and
illuminated 3D plotted
array.



100                                                              www.linuxvoice.com
                                                                                                          MANDELBROT & PYTHON CODING


  The intimate relationship between Mandelbrot and Julia fractals

   The Mandelbrot and Julia fractals are intimately          fractals are a single object. For values of c that                       Julia set
   connected. The relationship is illustrated in the         fall outside the Mandelbrot, the Julia fractals are
   following diagram. Each Julia fractal is uniquely         many separate pieces. The further c moves from the
   defined by the chosen value of c in z2+c. For values      Mandelbrot set, the more fragmented and dust-like
   of c that fall inside the Mandelbrot fractal, the Julia   the Julia fractals become.


                        Julia set                                              Mandelbrot set



                                                                                                                                  Connected (all in one piece)
                                                                                                                                  Julia set for c inside the
                                                                                                                                  Mandelbrot set




              Very disconnected dust-like
              Julia set for c away from the                                                                                              Julia set
              Mandelbrot set.




                                                                                                More bulbous, more
                                                                                                connected Julia set for c
                                                                                                closer to the Mandelbrot set.




import scipy.ndimage                                                  imshow(smoothed_atlas, interpolation=”nearest”)
  The following shows how the Gaussian blur filter                      Similarly we can plot the 3-dimensional landscape
can be used to create a smoothed image array from                     just as before using the mayavi extensions.
the original, which we called atlas in our previous                   mayavi.mlab.surf(smoothed_atlas, warp_scale=0.9)
code. The value 2 is the strength of the smoothing:                   mayavi.mlab.show()
smoothed_atlas = scipy.ndimage.gaussian_filter(atlas.T, 2)              We’d suggest playing with the settings for the
  We can plot this as a flat image just as before using               Gaussian smoothing filter to get an effect that works
the imshow function:                                                  for you. For example, we’ve had great results applying
# set the figure size                                                 the filter to the Julia set generated by c=(-0.768662 +
figsize(18,18)                                                        0.130477i), but there are many different variations and
                                                                      many kinds of smoothing effects you can produce.
# create a smoothed image of the original by applying a
Gaussian blur filter                                                  Try It Yourself
smoothed_atlas = scipy.ndimage.gaussian_filter(atlas.T, 2)            We’d encourage you to explore other filters to see if
# plot the array atlas as an image, with its values represented as    they make interesting images. Perhaps you might
colours, peculiarity of python that we have to transpose the          explore different functions aside from z2+c which was
array                                                                 the basis for both the Mandelbrot and Julia fractals.                       PRO TIP
                                                                         And remember, you can’t do any harm by                              You can explore more
                                                                                                                                             filters, besides the
                                                                      experimenting and playing. We hope in this series of                   Gaussian blur, to apply to
                                                                      tutorials you’ve discovered the fun and convenient                     your images at http://bit.
                                                                      IPython environment for web-based Python                               ly/1mNyMWE
                                                                      programming, and become familiar with the basic
                                                                      building blocks of Python programming. We also hope
                                                                      you’ve experienced some of the surprise, excitement
                                                                      and beauty that even simple mathematics holds,
                                                                      particularly if your experience has been of boring
                                                                      trigonometry puzzles. Now go and play with some
                                                                      maths!

                                                                       Tariq spends his time grappling with enterprise IT problems,
Add a 3D height field and a Gaussian blur to our                       informed by two decades of working with open technology.
Mandelbrot image and you get the Misty Mountains.


                                                                        www.linuxvoice.com                                                                           101
      CODING NINJA



                              CODE NINJA:
          TUTORIAL
                              STDIN AND STDOUT
                              Make your Python programs work with the Linux shell to build
  BEN EVERARD
                              your own command line utilities.


                              I
                                  f you’ve used the Linux command line for more
 WHY DO THIS?                     than the most basic uses, you’ll be familiar with
 • Understand one of              the concepts of standard in (stdin) and standard
   the basic principles of
   how the command line       out (sdtout). These are channels the shell pushes
   works.                     data through when you link commands with the pipe
 • Write your own utilities   character (|). For example :
   for the Linux shell.       dmesg | grep “USB”
 • Get more out of Python.       Here, the first command (dmesg) sends the kernel
                              message buffer to stdout. The | symbol takes the
                              stdout of one command and pushes it into the stdin
                              of the next. The grep command then goes through
                              each line in its stdin and prints out only those
                              containing the string ‘USB’. Using this concept of stdin
                              and stdout, we’ve managed to build a simple little tool
                              for checking the kernel messages about USB devices.
                                 In the Unix philosophy, as much as possible,               GNU’s cat utility has many more features than we’ve
                              programs should be simple commands that work                  implemented here, but it still works on the same basis of
                              with stdin and stdout. If they do, then they can be           reading files and sending their contents to stdout.
                              combined with the other Unix commands in a huge
                              number of ways. Working this way means you can                   Each line that we read from the file includes the
                                                           focus your program on            newline character at the end, so we include the

“In Unix, programs should be                               doing one thing well. Rather
                                                           than having to program
                                                                                            parameter end=”” to stop the print function from
                                                                                            adding a separate newline character which would
simple commands that work                                  every possible feature, you      leave a blank line between every line form the file.

with stdin and stdout.”                                    just focus on the core of the
                                                           program and the user can         In and out
                                                           use other Unix tools to gain     We can get the arguments to the command from
                              more features by chaining commands together.                  sys.argv. This is simply a list of everything that’s
                                 Let’s take a look at how we could start building our       supplied to the Linux Shell (see “Arguments” box).
                              own implementations of standard Unix tools in                 Here, we just use this to loop through every argument
                              Python that interact using stdin and stdout so they           to the command and hope it’s a file. So, the following
                              can be chained together.                                      would send the output of file1 and file2 to stdout:
                                 Let’s start with cat. This stands for catenate.            python cat.py file1 file2
                              Basically, it’s used to send the output of one or more          You can chain this with other Unix commands such
                              files to stdout. In Python, this is really easy:              as wc (word count) like this:
                              from __future__ import print_function                         python cat.py /usr/share/dict/words | wc
                              import sys                                                    wc outputs the number of lines, words and characters
                                                                                            in a file. Let’s implement that next:
                              for arg in sys.argv[1:]:                                      from __future__ import print_function
                                    with open(arg) as file:                                 import sys
                                          for line in file:
                                                 print(line, end=””)                        num_lines = 0
                                 All we have to do to send something to stdout in           num_words = 0
                              Python is print it. Here we’ve used the print function,       num_chars = 0
                              which is the standard way of doing it in Python 3. This
                              also works in Python 2 if you include the first import        for line in sys.stdin:
                              line. The reason we’ve done it this way is because we’ll        num_lines += 1
                              use some features of the print function a little later on,      num_words += len(line.split())
                              and want to keep things consistent.                             num_chars += len(line)



102                                                                    www.linuxvoice.com
                                                                                                                                            NINJA CODING


  Arguments
  Interacting nicely with the Linux command line environment           parser.add_argument(‘echo’, help=’The stuff to print on screen’)
  isn’t all about using stdin, stdout and stderr. Another aspect       parser.add_argument(“--stderr”, help=”print the stuff to stderr
  of the command line environment is properly parsing                  (otherwise print to stdout)”, action=”store_true”)
  arguments and flags. For example, in the cat Python script, we       args = parser.parse_args()
  take a list of files as arguments. We did this using sys.argv.       if args.stderr:
  This provides a list of everything that’s passed to the                            print(args.echo, file=sys.stderr)
  command (the first item in the list is the command itself; in        else:
  that example, we only included everything from the second                          print(args.echo)
  element onwards).                                                       You can now check it’s working with the following lines:
     However, if your command takes a range of options, it can         python echo.py --stderr “hello world” | wc
  be quite complex to correctly parse this. Fortunately, there’s a     python echo.py “hello world” | wc
  module to help: argparse. Let’s take a look at a simple                 The argparser module even takes care of creating your help
  example. This will be a command a little like echo, but it will      text (from the description and help parameters used when
  send the output to stdout unless the --stderr flag is present, in    creating the parser), so you can run:
  which case it will send it to stderr (this is just an example, and   $ python echo.py --help
  the normal echo command doesn’t have these flags).                   usage: echo.py [-h] [--stderr] echo
     We’ll do this using the argparser module (new in Python           echoing to stdout and stdin
  2.7, so this won’t work if you’re using an older version). Using     positional arguments:
  this, you only have to specify what options you have, and the         echo      The stuff to print on screen
  module will take care of parsing them and putting them in            optional arguments:
  variables so you can access them:                                     -h, --help show this help message and exit
  from __future__ import print_function                                 --stderr print the stuff to stderr (otherwise print to stdout)
  import argparse, sys                                                   You can fine tune argparser’s operation to almost any
  parser = argparse.ArgumentParser(description=’echoing to stdout      degree, and it has excellent documentation at: https://docs.
  and stdin’)                                                          python.org/2/howto/argparse.html.




                                                                       without corrupting the information going to stdout.
print(“\t”, num_lines,”\t”, num_words,”\t”, num_chars)                 For example, you might have used cat.py to output
  As you can see, getting input from stdin is quite                    the contents of several files, but one of them doesn’t
straightforward. It’s read in in lines just like files are.            exist. Using stderr, you still send the output of all the
  These two tools can be linked together with:                         files to the next command in the chain, but also alert
python cat.py /usr/share/dict/words | python wc.py                     the user to the problem. Let’s take a look at how to
  So far, we haven’t implemented any error checking.                   modify our cat command to deal with this:
So, if you try to cat a file that doesn’t exist, you get a             from __future__ import print_function
Python exception:                                                      import sys, os.path
$python cat.py /nosuchfile | python wc.py                              for arg in sys.argv[1:]:
   This might seem a little strange, because the error                    if not os.path.isfile(arg):
from the first Python command hasn’t been sent to                            print(“whoops, there appears to be a mistake. I can’t find”,
stdin of the second command. Instead it’s been                         arg, file=sys.stderr)
displayed on the screen. The reason for this is that                      else:
errors don’t go to stdout: instead, there’s a separate                       with open(arg) as file:
channel for them called standard error (stderr). This                          for line in file:
means that a program can send error messages                                      print(line, end=””)
                                                                          As you can see, all you have to do to print
                                                                       something to stderr is include the parameter file=sys.
                                                                       stderr in the print function, and you can print to it just
                                                                       like you print to stdout.
                                                                          Stderr doesn’t have to be printed on the screen
                                                                       though; you can send it to a file instead. If you’re
                                                                       running commands through some automated means
                                                                       such as at or cron, it can be useful to collect any
                                                                       errors. This is done with:
                                                                       command 2> file
                                                                         Anything a command sends to stdout, will be
                                                                       printed on the screen (you could also pipe it into
                                                                       further commands). Another option is to tell Bash to
                                                                       send stderr to stdout. Doing this will combine stdout
                                                                       and stderr into a single flow of text and pass it along
Even if one of the arguments to our cat program isn’t a                to any future commands:
file, it will still handle the rest correctly.                         command1 2>&1 | command 2



                                                                         www.linuxvoice.com                                                                103
      CODING ROBOCODE: ARTIFICIAL INTELLIGENCE WARFARE



                            ROBOCODE: ARTIFICIAL
          TUTORIAL
                            INTELLIGENCE WARFARE
   BEN EVERARD
                            A computer game that’s played by computers? Is this an open
                            invitation to Skynet or the future (or both)?

                            T
                                     he idea of creating robotic warriors is as old as
 WHY DO THIS?                        science fiction. However, how hard would they
 • Satisfy your                      be to make? Let’s not worry about the physical
   power cravings by        things – that’s a problem for hardware engineers –
   programming a robot      and take a look at the software side of things.
   army.
                            Robocode is an environment for tank-based
 • Learn Java in a
   well documented          autonomous warfare. That means that rather than
   environment.             controlling the actions of your tank via a joypad or
 • Give yourself a chance   keyboard during the fight as you may in a regular
   to win a Linux Voice     computer game, you have to program it to behave in
   T-shirt.
                            the way you want it to, then set it running. Before we
                            look at how to program the tanks, let’s first take a look
                            at the Robocode environment.
                               The main website is http://robocode.sourceforge.          Let battle commence! Watching battles at normal speed
                            net, where you’ll find loads of useful information that      helps you understand how the battles are fought, but
                            will come in handy if you decide to take on the              cranking up the speed lets you test your robots quickly.
                            challenge. There’s also a download link that will
                            take you to a SourceForge page where you can grab            can cd into this directory (by default it will be
                            the JAR file. To use this, you’ll need to have Java          ~/robocode), and start the software with:
                            installed (we used OpenJDK 7, but other versions             ./robocode.sh
The Robocode IDE is fine
                            may also work).                                                Robocode comes with a range of sample robots, so
for simple robots, but if
you’re creating a more         Once it’s downloaded, run:                                the first thing is to run a few battles to see how it
complicated warrior, you    java -jar robocode-1.9.2.3-setup.jar                         works, and what tactics are effective. Go to Battle >
may prefer to use a more      This will pull down all the files you need, and create     New to create a new battle. On the first tab, pick a few
fully-featured IDE.         a directory for them to live in. Once it’s finished, you     robots to fight it out (it doesn’t really matter which
                                                                                         ones; we find that about five is a good number of
                                                                                         competitors). The second tab allows you to change
                                                                                         the settings for the battle (number of rounds, size of
                                                                                         battlefield, etc). You can leave these as the defaults.
                                                                                         Press Start Battle to begin.

                                                                                         Know your robots
                                                                                         You should see that each robot uses different tactics
                                                                                         to attack the others. Some (like RamFire) are really
                                                                                         aggressive, while others (like Corners) are more
                                                                                         defensive. Essentially, there are two parts to a robot’s
                                                                                         strategy. It needs to avoid the shells from other tanks,
                                                                                         and it needs to hit other tanks with its shells.
                                                                                            Before we dive in and start writing our own robot,
                                                                                         let’s take a look at how a couple of others work.
                                                                                         Robocode has its own built-in IDE, which you can use
                                                                                         to create robots in Java. Got to Robot > Source Editor
                                                                                         to open it, then Open > Sample > RamFire.java to take
                                                                                         a look at how the RamFire robot works. It is (in slightly
                                                                                         abridged form):
                                                                                         public class RamFire extends Robot {
                                                                                                 int turnDirection = 1;


                                                                                                public void run() {



104                                                                www.linuxvoice.com
                                                      ROBOCODE: ARTIFICIAL INTELLIGENCE WARFARE CODING

           while (true) {
                 turnRight(5 * turnDirection);               Advanced tactics
      }}
                                                             Robots vary in complexity from the simple          (by energy drop tracking), you don’t know
                                                             (like the ones we’re looking at) to the mind-      what direction it’s gone in, but you can
                                                             boggling complex. Fortunately, you don’t           predict a range of directions, and work out
      public void onScannedRobot(ScannedRobotEvent e) {      have to start out from scratch when building       the rough probability of each. These areas
           if (e.getBearing() >= 0) {                        your robot. There’s lots of information on         of probability ripple outwards like waves
                  turnDirection = 1;}                        tried and tested tactics on the Robocode wiki      from a stone dropped in a lake. Wave
                                                             (http://robowiki.net/wiki/Main_Page). Here         surfing is the process of getting in the
           else {
                                                             are a few of our favourite tactics:                place of the lowest probability on this
                  turnDirection = -1;}                          Energy drop tracking Robots can’t see           wave. There’s more details at: http://
           turnRight(e.getBearing());                           when bullets are fired, but they can detect     robowiki.net/wiki/Wave_Surfing_Tutorial
           ahead(e.getDistance() + 5);                          the amount of energy other robots have. If      Bullet Shielding The aim of bullet shielding
           scan();                                              that energy drops suddenly, it’s usually        is to protect your robot by shooting your
                                                                because the other robot has fired a bullet.     opponents’ bullets out of the air. That’s
      }
                                                                This can be useful to other tactics such as     quite easy to say, but much harder to
                                                                wave surfing and bullet shielding.              achieve in practice. See http://robowiki.
      public void onHitRobot(HitRobotEvent e) {                 Wave surfing If you see a robot fire a bullet   net/wiki/Bullet_Shielding for the maths.
           if (e.getBearing() >= 0) {
                  turnDirection = 1;
           } else {                                        the RamFire robot itself. Now let’s take a look at a
                  turnDirection = -1;                      more cautious robot. TrackFire also continuously
           }                                               looks for enemies, but rather than ramming them, it
           turnRight(e.getBearing());                      just shoots at them:
           fire(1);                                        public class TrackFire extends Robot {
           ahead(40);                                         public void run() {
}}                                                                 while (true) {
   There are quite a few comments that we’ve                             turnGunRight(10);
removed for brevity. The first thing that surprised us             }
was just how simple the code is. Robocode handles             }
everything about the environment, so you only need to         public void onScannedRobot(ScannedRobotEvent e) {
decide how your robot will react to the environment
and code the AI.                                                  double absoluteBearing = getHeading() + e.getBearing();
   Standard robots extend the Robot class (there are              double bearingFromGun = normalRelativeAngleDegrees(a
other classes such as AdvancedRobot you can use            bsoluteBearing - getGunHeading());
as well), and then override the appropriate methods. In
the case of RamFire, there are only three methods.
Run is triggered at the start of the battle and is used
to define the tank’s default behaviour. In this case, if
nothing else happens to the robot, it will simply spin
around on the spot.
   OnScannedRobot is triggered when the robot’s
scanner pics up another robot. Control of the radar
(which picks up other tanks when scanning) can be a
complex topic, but in simple terms, it will just look in
the general area the turret is facing. Because the tank
will continually spin until directed otherwise, it will
always be on the look out for other tanks. This
method simply points the tank at the scanned tank,
and head straight for them.
   When the robot rams into its victim, onHitRobot()
will run. This fires the cannon at them (the code here
is simplified), and it will ram them again.
   As you can see, controlling your robot is all about
understanding the Robocode API. This is fully                                                                                  There’s an ongoing
documented at http://robocode.sourceforge.net/                                                                                 Robocode competition
                                                                                                                               at http://literumble.
docs/robocode. You don’t need to dive straight in and
                                                                                                                               appspot.com. If you think
read it all, but as you develop fighting robots, you’ll
                                                                                                                               your creation is up to
probably find yourself heading there more and more                                                                             the challenge, you can
frequently.                                                                                                                    set it against the rest of
   RamFire works by aggressively pursuing robots – a                                                                           the world and see how it
tactic that can work, but can also incur damage for                                                                            matches up.



                                                             www.linuxvoice.com                                                                          105
      CODING ROBOCODE: ARTIFICIAL INTELLIGENCE WARFARE

                                                                                                 building one. We decided to base ours on the
                                                                                                 TrackFire robot, but give it a bit more motion and the
                                                                                                 ability to run away.
                                                                                                   To start with, then, we just need to update the parts
                                                                                                 that identify the robot, so open the TrackFire robot in
                                                                                                 the source editor if you haven’t already, and change
                                                                                                 the public class line to:
                                                                                                 public class LVTrackFire extends Robot {
                                                                                                    Then go to File > Save As and save it under a new
                                                                                                 name (it should suggest LVTrackFire.java, which is
                                                                                                 fine). You now have a new robot. To make sure
                                                                                                 everything’s gone properly, go to Compiler > Compile,
                                                                                                 then (if there are no errors), go to the main Robocode
                                                                                                 window and create a new battle. You should find your
                                                                                                 robot under Sample.
The robot wiki is an invaluable source of information and inspiration for all things
Robocode. http://robowiki.net/wiki/Main_Page
                                                                                                 Added intelligence
                                                                                                 Of course, at this stage, the AI for LVTrackFire is
                                                                                                 exactly the same as TrackFire, so let’s now go back
                                      if (Math.abs(bearingFromGun) <= 3) {                       and add some more intelligence to it.
                                             turnGunRight(bearingFromGun);                          The biggest problem TrackFire has is that it stays
                                             if (getGunHeat() == 0) {                            still. We’ll add a bit of movement logic to our robot in a
                                                   fire(Math.min(3 - Math.abs(bearingFromGun),   few ways:
                               getEnergy() - .1));                                                  Under normal operation, it will move forward slowly.
                                             }                                                      This will help it avoid fire from robots far away.
                                      }                                                             If it’s hit, it will quickly get out of the way. This will
                                      else {                                                        hopefully move it out of the scan of the robot that’s
                                             turnGunRight(bearingFromGun);                          just hit it.
                                      }                                                             If it hits a wall, it will get away. This stops it being
                                                                                                    pinned in by RamFire.
                                       if (bearingFromGun == 0) {                                   We can add this logic in stages. Firstly, we’ll make it
                                             scan();                                             move forward under normal operation. To do this, just
                                       }                                                         add one line to the run method as follows:
                                   }                                                                        public void run() {
                               }                                                                                        while (true) {
                                  As you can see, this is quite simple. Rather than                                                 turnGunRight(10);
                               spinning the robot, it just turns the gun, and rather                                                ahead(10);
                               than speeding off towards its victim, it just points the                                 }
                               cannon at them and fires.
                                  There is a little complication with firing because you
                               (as the programmer) can decide how much power to                    Famous fighters
                               give the gun. The more power (the parameter to the
                                                                                                   The robots that come with Robocode are enough to keep
                               fire command), the more damage it potentially does
                                                                                                   you interested while you get started, but if you really want
                               your enemy, but the more it also heats up your gun. If              to test your skills, you may want to test yourself against
                               your gun overheats, you can’t fire until it cools down.             some more powerful opposition. Alternatively, you may just
                                  A good general tactic is to fire with more power the             want to watch some masterful killing machines at work.
                               more confident you are of hitting your enemy. In this               Whichever is your motive, you can find more robots online
                                                                                                   at http://robowiki.net/wiki/Category:Bots. A few of our
                               example, we’ll fire if the angle between where the gun
                                                                                                   favourites are:
                               is pointing, and the tank we’re trying to hit is less than             DrussGT (http://minifly.rchomepage.com/robocode/
                               three degrees. However, the smaller the angle is, the                  jk.mega.DrussGT_2.0.6.jar)
                               more power we’ll give the shot. This isn’t necessarily                 Diamond (www.dijitari.com/void/robocode/voidious.
                               optimal because it doesn’t attempt to work out                         Diamond_1.7.11.jar)
                                                                                                      Demonic Rage (http://sites.google.com/site/
                               whether the target is moving.
                                                                                                      justinsitehere/file-cabinet/justin.DemonicRage_3.4.jar)
                                  If you watch TrackFire fight a few battles, you’ll                   If you want to see some top Robocode action, put
                               probably notice that the biggest problem it has is that             Demonic Rage in a ring with DrussGT and Diamond to see
                               it can be a sitting duck. Once it turns up in an enemy’s            which comes out top. If you can build a robot that can
                               scan, it is usually destroyed fairly quickly because it             compete with these three, you’ve done very, very well.
                                                                                                       These are all open source, so you can poke around in
                               doesn’t get away.
                                                                                                   their insides and see what makes them tick. Perhaps you’ll
                                  Now you’ve seen a few robots in operation, and                   find something to inspire your own battle bot.
                               seen how a couple are written, it’s time to start



106                                                                 www.linuxvoice.com
                                                            ROBOCODE: ARTIFICIAL INTELLIGENCE WARFARE CODING

           }
   This keeps the gun spinning as before (and so
keeps it scanning for other robots), but makes it move
as well.
   The next bit of code we want is to make the robot
run away whenever it’s hit. Again, we don’t really care
where it runs away to, we just want it get away from
its current location. In this case, we could just move
forwards a certain distance. This is what the first
iteration of our robot did, but in a crowded battlefield,
we found that this doesn’t work very well. Our tank
often got stuck when it hit other tanks and didn’t run
away successfully, so instead, we made it move
forwards, turn, then move forwards again. This is
done with the following method:
public void onHitByBullet(HitByBulletEvent e) {
   for(int x = 0; x < 2; x++) {
     ahead(150);
     turnRight(50);
   }
}
                                                                                                                                             IBM’s Developer Works has
   The final bit of movement (to keep the robot away                   if (Math.abs(bearingFromGun) <= 3) {
                                                                                                                                             a series on learning Java
from walls) is done with:                                                 Reducing the value 3 will mean the gun will wait
                                                                                                                                             with Robocode at http://
public void onHitWall(HitWallEvent e) {                                until it has pointed more accurately before it fires. This            robocode.sourceforge.net/
  for(int x = 0; x < 3; x++) {                                         will reduce the rate of fire, but increase the number of              developerWorks.php. It’s a
    ahead(100);                                                        bullets that reach the target (since the target could be              little dated now, but should
    turnRight(50);                                                     moving, it’s not easy to aim accurately).                             still work.
   }                                                                      You can also adjust the firepower. None of these
}                                                                      change the fundamental operation of the robot, but by
  This is the mechanics robot complete. We were                        tuning the parameters, you can make your killing
happy with TrackFire’s firing, so we didn’t change this.               machine more effective.
You can compile it and pit it against other robots in                     Our simple robot isn’t the most devastating
battle and see how it fares.                                           opponent, but hopefully it will have whetted your
  Although it’s all done, there are still some bits you                appetite to build your own AI tank. It should also prove
can tweak to make the robot more effective.                            a fairly easy starting point to surpass as you add more
  The speed at which our robot moves is governed by                    features, you should quickly be able to superseded
the number in ahead(10) in the run method. By                          this primitive AI.
increasing or decreasing this number, you can make it
faster or slower. You can also adjust the accuracy of                   Ben Everard is the best-selling author of Learning Python With
                                                                        Raspberry Pi. He hacks robots for fun.
the aiming in the line:



                                                           COMPETITION
                                                  We’re going to run a digital Battle Royale.
  There are lots of open source robots available, so         for(int x = 0; x < 3; x++) {                            Voice winner’s T-shirt. All the
  we’re going to make our challenge a bit different to        ahead(100);                                            battles will take place on a
  most Robocode competitions to discourage the use            turnRight(50);}                                        1000x800 battlefield with a
  of these open source bots.                                  Obviously, the best tactics will depend on how         gun cooling rate of 0.1, an
     Firstly, your tank must extend the Robot class,       the battles are structured. In our war, the battle will   inactivity time of 450 and a sentry size of 450.
  not AdvancedRobot or any of the others available         take place in a series of heats. Each heat will have         All robots must be licensed under a OSI-
  in Robocode. Second, the whole robot must come in        six robots (if the number of robots isn’t divisible by    approved open source licence (we recommend
  at under 70 lines of Java. A line (for the purposes of   six, sample robots will be included to bulk up the        the GPL v3). The robot doesn’t have to be entirely
  this challenge) is a statement ended by a semicolon      numbers). Each heat will be 100 rounds, and the           your own work: borrowing chunks of code from
  (not including the separate parts of a for loop), or     top three will progress to the next round. We’ll go       other openly licensed robots is allowed, as is
  a statement that starts a new code block (such           through as many rounds as necessary to whittle the        using existing robots as a starting point for your
  as if, else, while etc). Parentheses may be put at       field down to six robots for the grand final. This will   development, although you obviously must adhere
  the beginning or end of any line and don’t need a        take place over 200 rounds and the winner of this         to the terms of the licence of any code you borrow.
  separate line. Therefore, the shortest the following     will be crowned Linux Voice Robocode champion.               Please email your robot’s source code to
  code can be is three lines:                              The winner will, of course, get an exclusive Linux        ben@linuxvoice.com by 20 December 2014.




                                                                          www.linuxvoice.com                                                                          107
      MASTERCLASS DVD-VIDEO TOOLS




                  MASTERCLASS
                  Without music, life would be a mistake. Join us as we
 BEN EVERARD      celebrate the new UK legal status of ripping your own CDs.


DVD-VIDEO: RIP AND BURN...
Now that you can legally copy DVDs, we show you how.


                  O
                           n 1 October, the UK’s copyright law caught up
      JOHN LANE            with the real world. You can now legally make
                           personal copies of your favourite ebooks,
                  music and videos that you own. So, without further                   This is just a screenshot of twitter.
                  ado, this month’s Masterclass will have you making
                  backups of your favourite DVDs in no time. We’ll
                  explain the structure of a DVD and show you how to
                  make your own so that you can now make that movie                The UK Government now communicates changes in the
                  you’ve always wanted to.                                         law of the land via the proprietary medium of Twitter. If it
                    There are two ways to copy a DVD. The first is to              is Tweeted, it must be official.
                  create an ISO image of the whole disc – an exact
                  copy. Most media players will play images just like the          most basic method – it copies the raw data from the
                  real thing and you can burn them onto blank media to             disc’s block device into an image file.
                  make an exact copy. The other way is to extract the                The following commands are equivalent, as they
                  contents of the DVD’s filesystem by recursively                  copy the entire disc:
                  copying its root directory. Again, most media players            $ dd if=/dev/sr0 of=mydvd.iso
                  will play a directory tree copied from a DVD.                    $ cp /dev/sr0 mydvd.iso
                    Before you start copying, make sure you have                     It’s possible for these methods to receive a few null
                  sufficient free storage. A typical DVD weighs in at              blocks at the end of the stream. They won’t affect the
                  around 7GB – you can see the actual size of a disc               image but, for an exact block-perfect copy, you can try
                  with the isosize command:                                        these instead:
                  $ isosize /dev/sr0                                               $ dd if=/dev/sr0 of=mydvd.iso bs=2048 count=$(isosize -d 2048
                  6654584832                                                       /dev/sr0)
                  This outputs the raw size of the disc’s filesystem in            $ head -c $(isosize /dev/sr0) </dev/sr0 >mydvd.iso
                  bytes (our optical drive is /dev/sr0).                             These use isosize to obtain the exact size of the
                    If you just want to make an ISO image, you may be              original and then copy that amount of space (the
                  able do it with the dd or cp commands. This is the               block size of a DVD is 2048 bytes). A md5sum hash
                                                                                   of the original disc and images produced this way
                    Install the packages                                           should match.

                    Some of the tools that we will use are included in the base    Authoring
                    packages of most distros (for example, things like dd and
                                                                                   If you encounter errors then you might be able to
                    isosize, which we use to make ISO images). You’ll need
                    some other tools to go beyond, however.                        overcome them by adding conv=noerror,sync to the
                      lsdvd displays the contents of a DVD; it’s a quick way to    end of the dd command. These arguments make the
                      identify the main title on a disc, because this is usually   dd command continue after errors (noerror) and
                      the longest track.                                           NUL-pad the error blocks (sync) to preserve the image
                      vobcopy copies the contents of a DVD as files and
                                                                                   size. Both these methods of using the dd command
                      directories.
                      libdvdcss decrypts titles that use the Content Scramble      provide a disc image suitable for playback on many
                      System (CSS).                                                players, such as VLC; they provide a true backup of the
                      ffmpeg is used to transcode video files into the format      whole disc, complete with any encryption and copy
                      required by DVD-Video.                                       protection they may have.
                      cdrtools provides the tools we need to write ISO images
                                                                                      If you want to modify your copy, perhaps by
                      to disc.
                                                                                   extracting only the main title to save space or by



108                                                    www.linuxvoice.com
                                                                                                   DVD-VIDEO TOOLS MASTERCLASS


                                                                     Intentionally bad sectors
                            VIDEO_TS
                                                                     The DVD copier’s nemesis is the intentional    ignored; they’re intentional and contain no
                                                                     bad sector. These are sectors that have        data so we don’t care about them. The block
                                                                     incorrect CRC checksums, and they are used     size of a DVD is 2048 bytes.
  VIDEO_TS.INFO          VTS_01_0.IFO          VTS_02_0.IFO          as a crude copy protection on some                If the image is still unplayable, extract it
                                                                     commercially produced discs. Most              with vobcopy or dvdbackup and play that
                                                                     standalone players don’t encounter the         instead. If you still want an ISO, perhaps to
  VIDEO_TS.BUP           VTS_01_0.BUP         VTS_02_0.BUP           errors because they are avoided by the disc    write to another disc, you could use mkisofs
                                                                     indexes (the IFO files) they follow but they   to make one from the extracted directories.
                                                                     are hit by attempts to image the disc.            An alternative method is to locate the
  VIDEO_TS.VOB           VTS_01_0.VOB         VTS_02_0.VOB
                                                                         There are several such schemes, with       main title and stream it into a file:
                                                                     names like ARccOS, XProtect and RipGuard.      $ lsdvd /dev/sr0
                         VTS_01_1.IFO          VTS_02_1.IFO          If you encounter such a disc, you should be    longest track is 4
                                                                     able to make an ISO from it with the GNU       $ mplayer dvdnav://4 -dvd-device //dev/sr0
                                                                     ddrescue tool, like this:                      -dumpstream -dumpfile main_title.mpg
                         VTS_01_2.BUP                                $ ddrescue -n -b 2048 /dev/sr0 mydvd.iso          ddrescue may also help you rip a
                                                                     The -n parameter causes bad blocks to be       scratched disc.
                         VTS_01_3.VOB

                                                                   x.bup are identical). The third kind of file is the VOB
Each title on a DVD has files collectively called a Title Set;     (Video Object), and these contain the actual media:
there can be up to 99 title sets on one disc. This example         video, audio and subtitles. They’re basically MPEG-2
has two; the first is divided into four VOB files and the          Program Stream files with DVD-specific limitations.
second one is divided into two.                                    Any player that can play MPEG can play unmodified
                                                                   VOB files. Because they can’t be larger than 1GB,
transcoding for playback on other devices, then you’ll             longer titles are split into multiple files. You can,
need to read the data files from the disk and work with            however, use cat to join them:
those instead. The long-standing tool of choice for                $ cat mydvd/VIDEO_TS/VTS_01_*.VOB > title.mpg                            PRO TIP
this is the vobcopy command, which requires that you                  The files follow a strict naming convention: the                  You can use cp on its own
mount the DVD first:                                               VIDEO_TS files are for the Video Manager and contain                 to copy unencrypted files
$ sudo mount /dev/sr0 /mnt                                         the control and playback information for the disc,                   from a mounted DVD.
$ vobcopy --mirror /mnt                                            referring to title sets which are the VTS_nn_n files on
  The DVD will be extracted to a new directory                     the disc. Once you understand the format, you can
created inside the current directory, whose name will              make your own DVDs by creating the appropriate files.
be determined by the titling on the DVD (usually the
name of the programme on the disc). If the files are               Authoring
encrypted and the appropriate libraries are installed              Taking regular video files and making a DVD from
then vobcopy will decrypt them first so that it can                them is called authoring. Your source material may be
copy them and the resulting copies will be free from               in various formats and will probably need to be
encryption.                                                        transcoded first; one suitable tool is ffmpeg:
                                                                   $ ffmpeg -i my_video.mp4 -target pal-dvd my_dvd_video.mpg
A look inside                                                        The simplest authoring just takes your video file                      PRO TIP
If you look at an extracted DVD-Video disc you will see            and packages it into a DVD-Video directory structure                 dvd+rw-mediainfo /dev/
that there is a directory named VIDEO_TS at its root               suitable for the PAL video system used in the UK:                    sr0 shows useful
                                                                                                                                        information about the
(there may also be an AUDIO_TS directory, which is                 $ export VIDEO_FORMAT=PAL                                            disc.
for DVD-Audio discs and is normally empty on a                     $ dvdauthor -d my_dvd -t my_dvd_video.mpg
DVD-Video disc).                                                   $ dvdauthor -d my_dvd -T
   The VIDEO_TS directory contains three kinds of                      The last command writes the DVD table of contents
files: IFO (information) files tell the player how to              and completes a basic example that will play a single
navigate the disc and have BUP backups (x.ifo and                  title when the disc is inserted. You can create an XML
                                                                   configuration file to define chapter marks and multiple
                                                                   titles or add menu systems - read the documentation
  tccat: another way to extract a title
                                                                   at http://dvdauthor.sourceforge.net to learn more.
  You can use cat to extract a DVD title, but the resulting        Before you can give that holiday video to your gran,
  MPEG header will have incorrect duration data, which can         you need to make an ISO image and put it onto a disc:
  cause confusion in some players. The transcode package
  includes a utility called tccat that offers another way to       $ mkisofs -dvd-video -o my_dvd.iso my_dvd
  achieve a similar result direct from a disc or image:            $ cdrecord -dao dev=/dev/sr0 my_dvd.iso
  $ tccat -i /dev/sr0 -T1,-1 > output.mpg                          $ cdrecord -fix dev=/dev/sr0
     The -T option specifies the track to extract. The format is     Fixating the disc is the final step and makes it ready
  -T<track>,<chapters> and specifying a chapter value of -1        for use in standalone players. If it doesn’t happen
  selects the whole track.
                                                                   automatically the last command will do it.



                                                                     www.linuxvoice.com                                                                          109
      MASTERCLASS DVD-VIDEO TOOLS



DVD-VIDEO: RIP AND BURN
The GUI way to read and write your video DVDs.


                              Y
                                       ou are somewhat spoilt for choice if you prefer
       JOHN LANE                       to use a desktop application to read and write
                                       DVD-Video media. If you’re looking for ease of
                              use the current favourite is Handbrake, an open-
                              source, GPL-licensed but Apple-flavoured video
                              transcoder. If all you want to do is extract content
                              from a DVD to watch on your phone, tablet, desktop or
                              smart television then look no further than your distro’s
                              repository.
                                 Handbrake comes in command line and GTK
                              desktop versions; the executable for the latter is called
                              ghb. When you start it, the main screen is displayed
                              and is where you select source material, desired
                              encodings and other settings.                               Handbrake at work: the Start button changes to Stop
                                 You can choose from almost any video file format         while it’s working. It takes around 30 minutes to
      PRO TIP                 supported by libavformat and libavcodec. The output         transcode a feature film.
 Handbrake writes MP4         file formats are limited to MKV and MP4, but these
 files with a .m4v
 extension so QuickTime
                              can contain various video encodings including H.264,        Start. That’s all there is to it. Because Handbrake
 and Qt 4 applications can    MPEG-4 and MPEG-2 along with the usual audio                copies and also transcodes, or converts from one
 play them properly. There    encodings that go with them. For use with most              format to another, it takes longer than a simple copy
 is no internal difference.
                              modern devices, it probably has your needs covered.         would, but it works and gets the job done without a
                                 To make it even easier for you, the right-hand side of   great deal of fuss.
                              the main window displays presets, mostly for Apple
                              and Android phones and tablets, but there is also the       Make your own DVD
                              default preset (Normal) and a general-purpose preset        One thing that Handbrake doesn’t do is DVD authoring
                              for H.264 video (High Profile), with all the bells and      – this is the preparation of video in the required
      PRO TIP                 whistles. You can also add, modify and remove               format and creating the menu system used to
 Advanced users can           presets, whether they’re built-in or your own.              navigate the disc. There are quite a few tools that
 tweak Handbrake’s x264
 encoder parameters; they        Copying a DVD is easy: place it in your drive and        purport to offer these capabilities. One of them is
 are documented at            press the Source button to select it (this is also how      called Bombono DVD and should be in your distro’s
 https://trac.handbrake.fr/   you’d choose material on your hard drive). Once             repository. Its GTK user interface is straightforward,
 wiki/x264Options.
                              selected, the disc is scanned and the title list is         having three main tabs that are used to select the
                              populated. Handbrake attempts to select the main title      source material, build a menu system and, finally,
                              for you, and you can use the Title drop-down menu to        write the disc. The writing stage can include writing
                              select any title. You can select part of the title by
                              chapter numbers, time in seconds or frames. Choose
                              your desired preset, set the destination and press            Support options
                                                                                            Handbrake benefits from decent documentation and
                                                                                            support resources. There’s a user guide, forums and you
                                                                                            can head over to #handbrake on Freenode IRC and
                                                                                            https://handbrake.fr.




Bombono’s video timeline lets you move through a title and set chapter marks.



110                                                           www.linuxvoice.com
                                                                                                 DVD-VIDEO TOOLS MASTERCLASS

the DVD directory tree, creating the disc image (ISO
file) and burning the image to a disc.
    The first stage is where you choose your content;
you don’t need to worry about its format because it
will be transcoded into the required MPEG-2 Program
Stream format that DVD-Video needs. You also don’t
need to worry about its size, because you can adjust
its bitrate to fit on the destination media. To add
media, you can either drag it on to the left-hand Media
List panel or use its Add Media Files button to select
them from a pop-up list. You can re-order selected
titles by dragging and renaming them (although this
has nothing to do with the DVD-specific names used
on the disc).
    You can right-click on a title to choose what should
happen when it ends; the default action is to return to
the menu. You also right-click and use ‘Adjust Bitrate
To Fit To Disc’ to make sure your content will fit.

Menus
The next stage is to prepare menus. You can set a
background image and write text labels or drag and
drop chapters to produce a set of thumbnails that
play from those points in the title, and there are basic
align and distribute tools to help you lay them out
neatly. Menu creation is something you could quite
easily get carried away with, but can yield good results
to give your disc a polished look and feel.
   Writing is the final stage and uses the command-
line dvdauthor utility underneath. You have to select a
working directory and it’s a good idea to create a new,           You can create menus with DeVeDe but the options are limited – there are no dragging
empty, one for this. You can choose whether to only               elements here and no submenus, but it is quick and easy.
create the DVD folder – the directories and files that
will go on the disc – to create an image or burn onto a           (no thumbnails here) and you can choose where they
disc. If your content needs to be transcoded, the                 appear: at the top, middle or bottom and either on the
process will take longer.                                         left, right or in the centre. You can also place an overall
   Another popular tool that performs similar tasks is            title across the top of the menu screen and select a
DeVeDe: you select your content, create menus and                 soundtrack and a background image (this needs to be
launch it. A little while later, your choice of a disc            prepared to the correct aspect ratio beforehand or will
structure or ISO pops out. There’s no option to burn              appear distorted). A preview window shows you what
that to a disc, so you’ll need to use something else for          your menu will look like.
that task.                                                            Once your disc image is written, you can preview it
   The menu options are more limited than Bombono’s:              in a player such as VLC to make sure it’s OK before              PRO TIP
you can only have one menu and the layout options                 using a separate burning tool to write it to a disc.          Handbrake’s preset
are much more primitive. It displays each title as text                                                                         parameters are described
                                                                  Spoilt for choice; spoiled by cruft                           at https://trac.handbrake.
                                                                                                                                fr/wiki/BuiltInPresets.
  A few alternatives                                              If you search your repositories for graphical GUI tools,
                                                                  you’ll find options of varying quality, many of which
    MakeMKV is dedicated to ripping DVD-Video to Matroska         are either abandonware that will present problems as
    MKV containers.
                                                                  soon as you try to install them, or feature-poor,
    PGCEdit is a DVD IFO and menu editor designed to allow
    the modification of the navigation commands and               knocked-together efforts that fail to meet their
    parameters of an already authored DVD structure.              objectives. This is one area of open source software
    AcidRip, a GTK wrapper for the mencoder command, is           where there is a significant amount of cruft.
    feature-rich but one for the more advanced user.                 That said, the ones that we’ve used here work well
    Brasero is a beginner-level tool that is a standard part of
                                                                  and do what they were designed to do. Have faith
    the Gnome desktop.
    K3b is the KDE application for ripping and burning media.     – the package manager will provide.
     And then there’s VLC, which can do just about anything.
  But that flexibility cost is met by complexity that may be       John Lane provides technical solutions to business
  too much for the casual user taking a backup of the              problems. He has yet to find something that Linux can’t
  occasional DVD.                                                  solve.




                                                                    www.linuxvoice.com                                                                 111
      DVDPAGES




Don’t fall behind – get the latest Linux goodness today!
                                                                                   DVD 010
                                  SAY HELLO TO THE UTOPIC UNICORN
                                  Ubuntu has had its ups and downs        installing Linux, we can highly        our very first issue under the
                                  over the years, but it remains one      recommend Ubuntu.                      Creative Commons (CC-BY-SA).
                                  of the most popular distros of all,        But it’s not just for newbies:      This means you’re free to share it
                                  and is the entry point into Linux       I personally run Xubuntu as my         and create new content based on
                                  for many people. It’s polished, it’s    main production distro. It has a       it – just give us credit for making
                                  built on a solid foundation (Debian)    great out-of-the-box experience,       it in the first place! See index.html
                                  and there are huge support              a super fast and slick desktop,        on the DVD for more information.
                                  communities on the internet in          good hardware detection and huge       Happy Linuxing!
                                  case you have problems. If you’ve       package repositories.
                                  picked up this magazine for the            On another note, as this is Linux   Mike Saunders, Disc Editor
                                  first time and you’re thinking about    Voice issue 10, we’re giving away      mike@linuxvoice.com



Distro powerpack



Ubuntu 14.10
Full 64-bit version, directly bootable from the disc


Y
         es, it’s that time of year again:            The version of Ubuntu 14.10 on our DVD
         another Ubuntu release is here. This      is 64-bit, and you’ll need at least 1.5GB
         one isn’t particularly radical in terms   of RAM and 10GB of hard drive space. If
of changes, but that’s fine with us; it’s not      you’ve never installed Linux before and you
necessary to have a giant upheaval every six       only have Windows on your drive, you can
months. Ubuntu 14.10 is an incremental and         choose to shrink the Windows chunk of the
evolutionary release, with a handful of new        drive (its partition) during the installation, to
features backed up by package updates,             make room for Linux. Then you’ll be able to
bugfixes and refinements. If you’re running a      choose your operating system when you
previous release, it’s worth the upgrade just      boot your PC. Before installing, though, it’s a
to get the latest packages – or if you’re a        good idea to back up important data!
newbie in the Linux world, it’s a great way to        If you’re looking for something with
get started. You can find out more about the       lower system requirements, or you want               mentioned below. And if you get stuck at
latest release in our review on page 48, so        to squeeze extra performance out of your             all, consult the friendly Ubuntu community
here we’ll focus on installation.                  PC, try one of the other Ubuntu variants             online at www.askubuntu.com.



  Xubuntu, Kubuntu, Lubuntu
  And there’s more! Ubuntu re-spins galore
  This month’s DVD is a quad-booter, so along       environment, generally considered the
  with the regular Ubuntu version, it can also      most flexible and featureful in the Free
  boot Kubuntu, Xubuntu and Lubuntu. Just           Software world. Xubuntu (also 64-bit) uses
  choose the one you want from the Grub menu        the faster and lighter Xfce desktop. And
  when you boot the disc, and you’ll soon arrive    for older machines, we’ve added Lubuntu
  at your choice of desktop.                        (32-bit) which only needs 512MB of RAM,
     Kubuntu (64-bit) uses the KDE desktop          and is bundled with various memory-friendly         Lubuntu (www.lubuntu.net) is great for
  instead of Unity – this is a very mature          desktop applications.                               breathing new life into old PCs.




112                                                             www.linuxvoice.com
                                                                                                                                               DVDPAGES


How it works: Installing Ubuntu 14.10 from the DVD




    Boot your PC from the DVD, and you should see this menu. (If not, you may            After choosing the Ubuntu flavour you want, you’ll arrive at the desktop.
1                                                                                    2
    need to change the boot order in your BIOS – see your PC’s manual.)                  This is live mode, so you can explore the software before installing.




    Double-click the installer icon on the desktop and the installer will pop up         Next, partition (divide up) your hard drive: dedicate it all to Ubuntu, share it
3                                                                                    4
    and ask if you want to download updates and third-party add-ons.                     with another Linux distro or Windows or something else (custom setups).




    Advanced users: if you do custom partitioning, you’ll need at least a root (/)       You’ll then be asked to set your keyboard layout and create a user account.
5                                                                                    6
    partition along with swap (twice your RAM, but no bigger than 4GB).                  You can encrypt your personal files, but it has a performance impact.




    The Ubuntu files will be copied over to your hard drive, so grab a cup of tea        And you’re done! Once the installation is complete, your system will reboot,
7                                                                                    8
    and watch the slideshow highlighting some of the distro’s features.                  eject the DVD, and start Ubuntu from your hard drive. Enjoy!



                                                                       www.linuxvoice.com                                                                            113
      /DEV/RANDOM/




Final thoughts, musings and reflections
                            Nick Veitch
                            was the original editor
                            of Linux Format, a
                            role he played until he         Club Mate, the                                                    A Yoga 13, where I boot
                            got bored and went              essential hacker                                                  the most recent Systemd
                            to work at Canonical            beverage.                                                         versions on, and hence
                            instead. Splitter!                                                                                might break frequently.
                                                                                                                              It’s running Mutt (what
                                                                                                                              else!).


                                                                                    Connected to a fall-




I
                                                                                    back desktop machine,
     t has been 10 years since the first version of                                 which runs slightly less
                                                                                    current Systemd and
     Ubuntu launched to largely unsuspecting                                        Fedora versions.
     masses. It was brown. It was easy to install.
It changed the history of Linux distros (whether
or not you ever used it) and 10 years later on is                                    Bauhaus (Mart Stam). What                 Contains memory cards,
                                                                    A Nexus 5.       Bauhaus did for architecture and          and more memory cards
more or less the most popular version of Linux in                                    design might actually be a good           are lying next to the big
the known universe. There has been controversy.                                      influence when hacking ;-)                screen, because I need
No doubt there will continue to be so. The world                                                                               to pull my pictures from
                                                                                                                               my India trip off them.
rarely changes without it. But even detractors
would have to admit that in the primary mission
of making a “Linux for human beings” it has been
tremendously successful.
   A lot of other things have changed in 10 years.
Who would have thought you would ever see a             My Linux Setup Lennart Poettering
Microsoft CEO delivering a keynote in front of a
huge screen proclaiming “Microsoft ♥ Linux”?
                                                        The creator of PulseAudio and Systemd gives us a
And yet, it has come to pass (http://goo.gl/            glimpse of his coding den.
dpJloJ). This is largely because of Azure,
Microsoft’s cloud platform, which has to be                   What version of Linux are you                which I stayed with for a long time.
Linux-friendly because various flavours of Linux              using at the moment?                                What Free Software can’t you
(notably Ubuntu) are the most popular images                  I have a laptop with current Fedora                 live without?
used in the cloud (and about 20% of Azure).                   Rawhide, which I use for day-to-day                 Uh, oh. To be honest, from time to
   A lot of other things haven’t changed. It is still   hacking. I also have a desktop with stable                time when I travel I live without any
difficult to find a choice of laptop with Linux         Fedora 20, so that I always have a                 computer or software for a month, and I
pre-installed, and even if you decide to install it     machine I can email from.                          really enjoy it… That said, if you press me
yourself, some shop staff often seem, erm,                                                                 hard I’d say Emacs, of course!
confused about what that entails (http://goo.gl/                What was the first Linux setup
Hnh4JO). But wait, things have changed here                     you ever used?                                   What do other people love but
too, as Currys reaffirmed that wasn’t their official            I got Slackware from a friend, some              you can get on without?
policy (http://goo.gl/U0DGCb).                                  time in 1996, when I was 16. It was              Hmm, good question. LibreOffice
   Who knows what may change in the next ten            awful, I really didn’t understand a thing I              Impress, maybe? I do all my slides
years? By the time we get around to Omnipotent          was doing back then, so after two weeks I          with Latex Beamer!
Owl maybe (if Systemd hasn’t morphed into               deleted Slackware again and moved back
Skynet and destroyed humanity) people will be           to Windows.                                              Is there a piece of proprietary
happy with their desktop environment, all                  A year and a half later I then bought a               software you wish were free and
hardware will ship with Linux support and Linux         shrink-wrapped box of Red Hat 5.0,                 open source?
Voice will be beamed directly to your neurons. I        together with a friend. I still didn’t get it            The Coverity static analyzer is really
bet Berlin still won’t have settled on a standard       really, but I found it interesting enough to             the only thing that comes to mind
for office software though.                             stick with it, and then switched to Debian         here for me!



114                                                            www.linuxvoice.com
Systemd Cheat Sheet



       CC-BY-SA Ivan Yossi)