Category Archives: Linux

Freedom to tinker

Talking about the way in which his embrace of Free Software has changed his attitude to computers, Bruce Byfield reaches a conclusion that rings very true for me.

All unknowing, I had wandered into the world of do-it-yourself. Originating in small groups of hobbyists who had few resources except themselves, free software naturally required more independence of its users. Far from discouraging users from tinkering, free software actually encouraged it with text configuration files and scripting so simple that it could be learned without taking classes. Because there were so many choices, it encouraged me to explore so I could make informed decisions. Just as importantly, because free software was a minority preference, the necessary compatibility with proprietary operating system sometimes required considerable ingenuity.

As a result of these expectations, I gradually lost my learned helplessness. I can’t say exactly when I shed the last of my conditioning, but after a couple of years, I realized that a major shift in my thinking had occurred. I still didn’t — and still don’t know everything about free software, but I no longer panic when a problem strikes.

Although I was using a number of open source applications before, I didn’t really start to delve into GNU/Linux until early 2007 when I installed Ubuntu on my PC alongside Windows XP. And, over the past ten years I have gone from being excessively cautious to (probably) a bit too casual.

There was never a sudden shift but, the more I have poked around the more I have found — all documented and backed by a helpful community. I have moved from really not wanting to do anything that might cause any sort of problem at all to being willing to break my install, safe in the knowledge that if the worst comes to the worst, I can just reinstall the operating system without even risking my data.

I am far from being able to claim any expertise but the openness and availability of information surrounding Free Software means that for any problem I am generally able to understand what the issue is and find or figure out how to fix it.

And that’s freedom.

Flattr this!

Learning Genie with Project Euler

I searched for Gnome Genie and was attacked by a Gnome Ninja.

I’ve recently started playing around with the Genie programming language. This is a variation of Vala but with a more Pythonesque syntax. And I do like Python.

Genie is a compiled language that uses the Vala compiler to produce C code which then compiles to an executable binary. This means that it has less overhead than programs written in Python and should run faster. This is not always a consideration but it can certainly be useful.

The inevitable Hello World program looks pretty simple:

[indent=4]
init
    print "Hello World"

The only problem I’ve found so far is that there appears to be a dearth of “Teach Yourself Genie” resources, either online or off. This is not helped by some of the results that come up when you search for “Genie” or even “Genie Gnome”.

So I’ve decided to have another crack at Project Euler. I have already solved a fair few of these problems in Python, if I can re-implement the same solutions in Genie I will count myself as having made some progress.

One down, 592 to go.

Flattr this!

Unplugging

Yesterday was Data Protection Day, which seeks to raise awareness and promote privacy and data protection best practices. Data protection and online privacy are issues that I have tended to think about in the abstract. While I am aware that my online data is exposed, I have a hard time motivating myself to do anything serious about it.

However, with the current global direction of travel, I started to think about how much of my data is going through US servers and the obvious first point of concern is Google, particularly Gmail.

Although I have a few email accounts, for the past few years I have been using Gmail as my primary email — and as my email client. The Accounts and Import page make it very easy to set up Gmail to send and receive from all of my email accounts, allowing me to easily synchronise everything across everything. It’s damnably convenient, but a complete disaster from a privacy point of view.

So today I have unplugged every other email account from Gmail. I have also installed and configured Geary on my desktop and started playing around with the default email client on my phone.

It’s not as convenient as letting Google do all the synchronisation for me, but the effort is minimal and it does mean that all of my email is no longer being pushed through the same server.

I haven’t decided whether to keep my Gmail account. It’s handy to have, but not irreplaceable. I shall watch how my email traffic changes over time and decide later. I shall also have to look into calendaring services.

But first, I shall see about scraping the Google Apps off my phone. This should be reasonably straightforward — if all else fails I just need to do a factory reset. But I must remember to take a backup first.

Flattr this!

OSPAT: The Open Source POWER Availability Tool

Here’s handy. If you are using Linux on the IBM Power architecture, the Open Source POWER Availability Tool (OSPAT) allows you to search multiple distributions for available packages.

[T]he specialty of OSPAT is that it only returns POWER package results, it does not return x86 packages in the search results. Thus, the user doesn’t have to drill deep into the search results to find the POWER packages. Also, the search results display the results across multiple distributions, helping POWER users determine whether certain packages have equivalency across multiple distributions.

Click here if you want to take a look.

Flattr this!

Switching from LightDM to GDM

Yesterday, when I updated my Antergos box, it pulled down lots of shiny new Gnome stuff. Today, when I booted up my laptop, I discovered that the greeter wasn’t working any more and I couldn’t sign in or get at any of that shiny new Gnome stuff.

I have encountered this issue before and it was caused by the Antergos LightDM greeter theme. The easiest solution, therefore, is to switch to GDM so that I am using all Gnome all of the time.

It’s a painless enough process, but I am recording the steps here so I can easily look up the steps when I need them again.

So…

CTRL-ALT-F2 to get into TTY2

Log in and switch to root. Then…

systemctl stop lightdm
systemctl disable lightdm
pacman -S gdm
systemctl enable gdm
systemctl start gdm

And you’re done.

Update

And I notice today (Friday 14th) that I now have an updated lightdm-webkit2-greeter which probably solves yesterday’s issue. That said, I will stick with GDM for now just to see how things go.

Flattr this!

Remounting a read-only filesystem on Android

Following on from my last post, I figured that copying the hosts file from my laptop to my phone would be a very good idea. In principle, this is just a case of getting the file onto my phone and then copying it to /etc/hosts.

Obviously, I need root access to do this but, with a Fairphone 1 this is not a problem.

What did catch me out, though, is that /system is mounted as a read only file system. It’s not difficult to get around, but I am noting it here so I can easily look up the steps when I next do this.

# mount -o rw,remount /system
# cp /storage/sdcard0/Download/hosts /etc
# mount -o ro,remount /system

For other phones, some pathnames may vary.

Flattr this!

Unified hosts file with base extensions

Using the /etc/hosts file to block malicious sites at the operating system level is an effective way of ensuring that none of your applications will access any of these sites, ever, and has the advantage of removing the need for a separate browser plugin for every browser you might possibly use. But maintaining the /etc/hosts file involves doing work and this is where Steven Black‘s hosts comes in handy.

This repository consolidates several reputable hosts files, and merges them into a unified hosts file with duplicates removed. This repo provides several hosts files tailored to you need to block.

Using it is simple. Clone the repository, update the myhosts file with any custom host records you may have, and add any domains you don’t want to block to the whitelist. Then build your hosts file:

python updateHostsFile.py

There are a number of switches you can use (all of which are documented in the readme file) which allow you to control which types of sites to block and whether you want to automatically replace your existing /etc/hosts file.

This all works very nicely indeed, but I’m lazy. So I knocked together a short script to grab any updates from the repository and rebuild my hosts file:

#! /bin/bash
# Automatically update hosts file

# Change to the correct folder and do a git pull
cd /home/paul/Stuff/hosts
git pull origin master

# And update the hosts file
python updateHostsFile.py -a -r

And put it in /usr/local/bin.

This means I can use a systemd service and timer to execute this every Saturday afternoon.

[Unit]
Description=Auto-update hosts file

[Service]
Type=oneshot
Environment=DISPLAY=:0
ExecStart=/usr/local/bin/hosts
StandardOutput=journal

[Install]
WantedBy=basic.target
[Unit]
Description=Auto Update Hosts File

[Timer]
OnCalendar=Sat 14:00:00
Persistent=true
Unit=hosts.service

[Install]
WantedBy=basic.target

And, so far, it all appears to be working very nicely indeed.

Flattr this!

Setting up a Multiplayer Voxelands Server on Debian

I mentioned an intention of setting up a Voxelands server a month ago so that Macsen and I could play in the same environment, and I have now finally gotten around to doing this. The server itself is running Debian 8 and the process turned out to be surprisingly painless.

I installed the Ubuntu deb from the Voxelands download page using gdebi, because I need my dependency resolution:

wget http://www.voxelands.com/downloads/voxelands-1602.00-ubuntu-x86_64.deb
gdebi voxelands-1602.00-ubuntu-x86_64.deb

And starting the server is a simple case of typing:

voxelands-server --port 30000

And, if I was going to run this only once, this would be enough. But as I want this to be available as and when required, it’s time for Systemd.

Handily, the Voxelands site provides a sample Systemd.service, so I copied and pasted it into /lib/systemd/system/voxelands.service with just one change:

ExecStart=/usr/local/bin/voxelands-server --port 30000

Then it’s just a case of enabling it:
systemctl enable voxelands

And starting it:
systemctl start voxelands

Now all I need to do is to upgrade the client versions so that they match the server.

Flattr this!

Voxels ate my weekend

Sunrise

Sunrise

Last week Macsen expressed an interest in Minecraft. He has access to an old laptop of mine, so I spent an evening upgrading it from OpenSuse to Antergos and installing Voxelands1 on it, along with a number of other games. I also installed Voxelands on my own laptop so that I could understand the interface well enough to answer any questions that might crop up.

I didn’t intend to start playing the damn game.

I did, however, spend a bit of time poking around the wiki so that, on Friday, I was able to show Macsen how to make a crafting guide and set him going. And he was off, digging, crafting and building. So much so that we had to crowbar him away from the laptop when it was time to eat2.

On Saturday Macsen asked me how my house was going. So I opened up my laptop and showed him what I’d built while tinkering around. Macsen showed me how to build a furnace and went away to copy my house design.

The rest of the weekend was a bit of a blur of YouTubery, sharing of ideas (something in which the twins were able to become involved), digging, crafting and building. And I have to say that there is something quite magical about an eight-year-old enthusiastically describing what he’s discovered and planning his next project.

At present we are both playing in single player mode. We have talked about shared worlds and I am thinking of setting up a small local3 server, but that is a task for another weekend.

I’m not normally much of a gamer but Voxelands has me hooked. It’s immersive, expansive, endlessly entertaining and frighteningly addictive. Darkrose and the rest of the Voxelands team have done a fantastic job so far. Long may they continue.

Footnotes

1 Voxelands is a fork of Minetest which is an Open Source implementation of Minecraft. From my limited reading, my understanding is that the Minetest developers have emphasised their modding engine at the expense of playability. Voxelands has dropped the modding engine and seeks, instead, to deliver a game that is complete, playable and fun. And playable is what I was looking for.
2 Figuratively speaking, of course. But now I’m wondering if it’s possible to craft a crowbar.
3 As in local to my home network and not connected to the interwebs.

Flattr this!

Mongo only pawn… in game of life*

About a week ago, Ben Everard on Linux Voice posted an introduction to MongoDB from issue 11 of the magazine. So I thought that now would be a good time to go and see what all the cool database kids are talking about`.

One thing that isn’t mentioned, and which came to bite me, is that Mongo needs to have 3GB available for its journal and other data. This all goes into /var/lib/mongodb and, in my case, this is in my already undersized root partition. Thank you, GParted for digging me out of that particular hole.

Installing MongoDB on my Antergos box is easy:

# pacman -S mongodb mongodb-tools

The mongodb-tools provides import, export and diagnostic capabilities and become useful later.

And then the thing that I always forget. Start the daemon:

$ systemctl start mongodb.service

After this, you can launch the MongDB shell with the mongo command, and you’re in.

Ben’s article is certainly an interesting introduction, but what I found more useful was this article: Getting Started with MongoDB (MongoDB Shell Edition). The guide provides installation instructions for various operating systems, which you can skip past by clicking here. This guide also provides a database that can be downloaded, imported and played around with.

It’s surprisingly easy to get a handle on the basics of MongoDB, and I can certainly see how the objects and methods approach to building and managing data provides a lot more flexibility than traditional relational databases. Now I just need to come up with a project to justify seeing just how much I can get out of this.

* Because whenever I see the name Mongo, I think of this guy.

Flattr this!