logo

ShrimpWorks

// why am I so n00b?

With all the talk of Unreal Tournament 4 possibly being cancelled one of these days, due to Epic’s runaway success with Fortnite, I’ve decided there’s really no reason to not be playing UT99.

Thus, we set about trying to run it on modern hardware, with a modern Linux installation.

As much as this is about setting things up on Linux, it’s also partially my own attempt at some knowledge preservation, as a lot of this stuff ends up being forgotten or lost over time (it’s been almost 20 years! a lot of the old sites and things you expect to find this info on simply do not exist anymore :()

This is part one of two, and will focus on installing and running the game using Wine.

arrow Continue Reading ...

I recently wanted to set up a couple of rough monitoring services to keep track of simple server status, load, disk etc. While there are options available like Munin which can do this by installing agents on the machines to be monitored, I wanted something a little simpler and more portable.

I’m quite fond of the StatsD + Graphite + Grafana stack, which is quite easy to run thanks to Kamon’s grafana_grafite Docker image, and I realised you can actually quite simply write counters, gauges and timers to StatsD using nothing but the standard Linux tools nc and cron.

For example, every minute on each server being monitored, a simple cron job is executed which uses nc to write a bunch of information to my StatsD service:

#!/bin/bash

HOST=$(hostname)

STAT_HOST="statsd-host"
STAT_PORT=8215

# load average
echo "load.$HOST.avg:`cat /proc/loadavg | cut -d ' ' -f 1 | awk '{print $1*100}'`|g" | nc -w 1 -u $STAT_HOST $STAT_PORT

# memory
echo "memory.$HOST.perc.free:`free | grep Mem | awk '{print $3/$2 * 100.0}'`|g" | nc -w 1 -u $STAT_HOST $STAT_PORT
echo "memory.$HOST.bytes.total:`free -b | grep Mem | awk '{print $2}'`|g" | nc -w 1 -u $STAT_HOST $STAT_PORT
echo "memory.$HOST.bytes.used:`free -b | grep Mem | awk '{print $3}'`|g" | nc -w 1 -u  $STAT_HOST $STAT_PORT

# disk
echo "disk.$HOST.kbytes.total:`df -k --output=size / | grep -v [a-z]`|g" | nc -w 1 -u $STAT_HOST $STAT_PORT
echo "disk.$HOST.kbytes.used:`df -k --output=used / | grep -v [a-z]`|g" | nc -w 1 -u $STAT_HOST $STAT_PORT
echo "disk.$HOST.kbytes.avail:`df -k --output=avail / | grep -v [a-z]`|g" | nc -w 1 -u $STAT_HOST $STAT_PORT

# mail queues
for i in maildrop hold incoming active deferred bounce; do echo "postfix.$HOST.queues.${i}:`find /var/spool/postfix/${i} -type f | wc -l`|c"; done | nc -w 1 -u $STAT_HOST $STAT_PORT

It’s perhaps a bit inefficient in places, but gets the job done fairly well. One minute resolution may be a bit rough, but it’s sufficient for most of these data points which don’t change too dramatically over time.

Some other more specific variations include HTTP accesses, ping times, etc. Pretty much any parameter you can parse down to a single number can be published as a counter, gauge or timer to StatsD, and then neatly graphed over time.

This is a small follow-on on from the Kodi on Debian Sid guide I did earlier this year to get lirc (IR remote support) working once more, following an upgrade to version 0.9.4, which changes how the lirc services and configuration work (shakes fist at systemd).

After upgrading and following all the instructions in /usr/share/doc/lirc/README.Debian.gz, I was left with the problem of Kodi not responding to any remote input at all.

Firstly, I had to re-source my remote’s configuration (mceusb) from the lirc git repository. Place the *.lircd.conf file from there into /etc/lirc/lircd.conf.d/ and remove/rename other .lircd.conf files already in that directory.

Now, running irw and pressing some buttons on your remote should show you the button pressed and the configuration used.

Next up, Kodi fails to connect to the IR device. There are two trivial but non-obvious solutions:

Firstly, without changing any of the default configuration generated by the migration process outlined in the lirc README file, simply change your Kodi starup command as follows:

$ kodi --lircdev /var/run/lirc/lircd

Alternatively, you may change the lirc configuration, to put the device file back where Kodi expects it:

# in /etc/lirc/lirc_options.conf:
output = /dev/lircd

Then end result should be you happily continuing with your life.

I recently went through the process of reinstalling the media PC connected to my TV, which I use to run Kodi for movies and TV, and Steam in Big Picture mode, which allows me to stream Windows-only games from my desktop to the couch.

I thought it would be useful to describe my setup and the process to achieve it, in case anyone else is interested in creating their own custom Kodi/Debian/Steam builds.

arrow Continue Reading ...

I’ve become fond of using nginx on my development machines, rather than a full Apache.

There are no explicit options built-in which allow something along the same lines as Apache’s userdir, however it’s easy enough to tweak the default configuration to support that behaviour without the need for external modules.

I also do some PHP dabbling from time to time, so need to enable that as well.

Install the required bits:

$ sudo aptitude install nginx php5-fpm

Configure nginx (the below is my customised and cleaned out server definition):

/etc/nginx/sites-available/default

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html;

    # Add index.php to the list if you are using PHP
    index index.html index.htm index.nginx-debian.html index.php;

    server_name _;

    # PHP support in user directories
    location ~ ^/~(.+?)(/.*\.php)$ {
        alias /home/$1/public_html;
        autoindex on;

        include snippets/fastcgi-php.conf;

        try_files $2 = 404;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
    }

    # PHP support in document root
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
    }

    # User directories in /home/user/public_html/
    # are accessed via http://host/~user/
    location ~ ^/~(.+?)(/.*)?$ {
        alias /home/$1/public_html$2;
        autoindex on;
    }
}

I also had to make a change to /etc/nginx/snippets/fastcgi-php.conf, to comment out the following line:

#try_files $fastcgi_script_name =404;

After restarting the nginx service (also make sure the php5-fpm service is running), you will be able to serve HTML and PHP files from your ~/public_html directory.

All of my Debian desktop installs running KDE received an update a month or two ago which rendered the “Apper” package management application broken, failing with the following error:

Unable to open database read-only: Database action 'prepare dependency insert 
statement' failed: table dependencies has no column named items_installed

The solution is to delete the Listaller cache DB:

rm -r /var/lib/listaller/db/

The cache will be recreated automatically with the expected structure on the next run of Apper (or other PackageKit type thing).

Yay, on Friday, I decided to take the plunge, and install Debian on my laptop. I’ve always wanted to try working in a Linux desktop environment, considering I do practically no Delphi development any more, everything’s either PHP or Python. Since Debian has plenty of support for both of these, it seemed quite ideal.

I’m not dumping the existing Windows install though, so I had to partition my drive. Now, partitioning drives is about the most nerve-racking thing I’ve ever done, no matter what software I’m using, no matter how little data I stand to lose, I’m always scared as hell something will go wrong. Doubly so on this laptop since I use it constantly for work, and it’s the default installation HP put on, which I’m not really eager to bugger up. Luckily, that all went smoothly though :D.

When it came to installing Debian though, I had a problem with the netinst installer I was using, in that a package or two would not install due to missing some authentication files or something. So, since that installer didn’t work, it was suggested that I try an older Sarge installer and upgrade to the Unstable branch from there.

As expected, that installation went without issue. Unfortunately I just had to try my best to keep the machine cool while waiting for the installation to complete and the ACPI applications to kick in so the fans would do their thing. Thanks Korpse for warning me about that in advance ;).

So anyway, after the base installation was done, it was trivial (as I have come to expect from Debian,) to get Gnome, X.org and GDM installed and running. Apache, PHP and the rest were even easier. I was very pleased to see that the Firebird SQL server (open source’d Interbase fork thingey) was available in Debian right away, so I plonked that in as well. All that was left was to install Subversion, and check out my work stuff. Once done, I was 100% ready for work :D.

There are a few things not working yet - I haven’t had much luck with the wireless LAN. Gnome’s wireless LAN configuration applet thing is missing WPA-PSK authentication options (which I’ve configured my wireless AP to use), it only supports WEP. I also can’t seem to get the WPA tools (wap_supplicant) to work correctly. Based on the output I’m getting though, it *looks* like it’s connecting to the access point - it manages to find the AP’s MAC address and everything just fine, and it reports the authentication was successful, but beyond that, I can’t actually ping anything, and all traffic still seems to be trying to go through eth0 (wired LAN) rather than eth1 (wireless). Guess I need to learn a bit more about Linux networking… heh.

Another thing that’s not quite working is Bluetooth. Again, it *seems* to be working, the hardware is detected, and is working fine. My phone can pair with the laptop fine, using the PIN I’ve defined, but I can’t seem to transfer files or anything in either direction. I’ll admit that I haven’t played with this much yet, but I’m not really sure where to go next. I haven’t even tried looking into infra-red yet :).

And yes, I do use all these things, that’s why I spent so much on this laptop :P.

I also haven’t installed the ATI drivers yet, it looks like it’s going to be a bit of a mission on it’s own though.

Along the way I’ve also discovered some interesting new applications I haven’t seen or heard of before. gDesklets seem like a nice way to waste some CPU time and memory if you like to keep your desktop busy. Beep Media Player seems like a very nice alternative to XMMS, seems a lot more stable, and the general feel integrates better with Gnome. RapidSVN looks like it’s trying to be a nice enough SVN front-end, however I find the good old command-line a lot more friendly and efficient (and it crashes less). Sylpheed is a rather nice little mail client, and works well as an alternative to Thunderbird - assuming you’re unhappy with Thunderbird though. ibWebAdmin is a neat web-based tool for managing your Interbase databases, not as feature-packed or good looking as phpMyAdmin, but it does what it needs to do pretty well.

All that’s left now is to give it a shot at work tomorrow, and see how it all goes :).