Varnish cache, munin-node and server-status

varnish-cacheOn my server running Ubuntu 12.04, I have Apache2 listening on port 8008 (20 virtual hosts) and Varnish on port 80. I use munin and monit to keep tabs on the various services running on the machine and they use the mod_status output to keep tabs on Apache2 processes. As mod_status is compiled into Apache2 by default and the module is enabled this means that the detailed information about your secure webserver is exposed for all the world to see. The mod_status configuation file allows you to lock access down to localhost access only which is nice.


However, Varnish connects to the backend Apache2 server as localhost and so exposes the server-status page to the wild wild web. With the Varnish VCL I was using my server-status page was cached for an hour so it was still available but only provided a static status report that changed when the cache refreshed. Implementing a solution from made the live server-status available through Varnish as it passed it to the backend. This did not help. To secure my server-status I had to block access to the server-status URL but still keep it open for munin-node. Continue reading Varnish cache, munin-node and server-status

Replacing a failing HDD in RAID1 in Ubuntu Server

I have a software RAID1 (mirrored) setup with four partitions on two 160GB SATA drives. Munin started emailing me reports that a drive was failing with bad sectors.

This is what I did to get the system up and running again.

From I completed the following steps first in the terminal:

To make Ubuntu Server automatically boot when one drive in a RAID array has failed do the following:

From a running server, do a package update to make sure you have the latest kernel and boot loader

sudo apt-get update && apt-get upgrade

Reboot the server to ensure any new kernel and bootloader packages are in place.
From the command line run

sudo grub-install /dev/md0

to ensure GRUB is installed on all members of the boot RAID device.

When asked “Should mdadm run monthly redundancy checks of the RAID arrays?”, select either Yes or No (read the warning about possible performance impact and decide. “Yes” is the safer choice)

From the command line run

sudo dpkg-reconfigure mdadm

When asked “Do you want to start the md monitoring daemon?” select Yes.

Enter a valid email address to send warning messages to.

When asked “Do you want to boot your system if your RAID becomes degraded?” select Yes. Continue reading Replacing a failing HDD in RAID1 in Ubuntu Server

Farewell Kubuntu Mint, Hello Fedora 16

Fedora Logo
Fedora logo

I have been running Linux Mint 10 for ages and have hacked and patched and updated it with various repositories to make sure it was reasonably up-to-date. The application I use most often on the desktop is DigiKam. The development of DigiKam has accelerated recently to the point of a new release almost monthly. The repositories are all trying to play catch-up. Some dedicated individuals are rolling their own .debs/.rpms for different flavours of linux. All you have to do is connect to their repository and install. But it is never that simple as the newer versions of DigiKam required newer versions of all the dependencies and a simple install ends up pulling in loads of different packages. In the end I gave up and stuck with version 1.9 as newer versions required an updated version of KDE and it was getting to be a hassle patching everything together. Continue reading Farewell Kubuntu Mint, Hello Fedora 16

New toys with buttons

DCP-195CAdding a Brother DCP-195C to LinuxMint 9 KDE

As you all know it was my birthday a couple of months ago and as a complete surprise Sarah had a Brother DCP-195C printer/scanner/copier couriered through to me.  Brother supply all the drivers for the printer and scanner for both Windows and Mac OSX and it’s a simple matter of plugging in the machine, loading the CD and installing the various packages to get it working.  On my Linux desktop (running Linux Mint 9 KDE 4.4.5 ) things are not so straight forward. Brother traditionally has supported Linux well and provide the required drivers and workarounds and tips on their website but the installation process required a bit of fiddling. Continue reading New toys with buttons

This is my desk

I get a feed from Lifehacker and noticed this post about users’ desktops and how they have been pimped and polished so they are just right.  Now that we have moved into a larger flat and have space to spare I have been able to set up my desk with all the bits and pieces that normally lived in a box in a cupboard.  They were pulled out and plugged in only when needed.  Here is a picture of my desk:

My desktop

IKEA trestle table missing the bolts to hold the trestles together.  On the left our Habitat CD rack holding extrat telephone and network cabling, spare headset, CD wallets with photo and music backups, odd tools and a roll of tape.  Pair of SATA Sonic speakers from the late 90s – great sound.  Lexmark Z615 printer that has only just started working with Ubuntu Jaunty but it’s out of ink at the moment and the spares are in on of the 20 boxes seen on the right of the photo.  Logitech wireless mouse and a logitech corded mouse.  BenQ 17″ monitor bought in 2005 and never had a problem.  250GB Lacie By Porsche USB harddrive currently backing up /home.  Agfa SnapScan e50 scanner (with slide and negative scanning adapter) from the late 90s.  The pile of paper is my current In Tray/Filing pile.

On the floor to the right is the server with keyboard unplugged.  This is a security feature.  Daniel has a penchant for entering random text strings while I am at work.  The collapsable carry cot is strategically placed, as is the chair, to stop him hitting the power button.  Under the desk there is a borrowed TV set top booster kit that doesn’t work and a surge protected multi-plug.  Everything plugs into the multiplug.  The shiny black box (Antec Solo case) is my desktop machine running Linux Mint 7 KDE.

Apart from the fact that the room has no heating (and it’s -2C outside) it’s nice to have a place where all the boxes, cables and stuff is out of the way.  I guess I could follow some of the tips on Lifehacker to clean everything up but hopefully we’ll be moving soon and then I can set it up a bit more permanently.

In a box on a box

vbox_logo2_gradientvbox_add_iso3I am running the non-free version of Virtualbox 3.0.12 on Linux Mint 7 KDE.  Normally Virtualbox works perfectly out of the box and is has worked perfectly when I was running Ubuntu 9.04.  Having changed OS recently to Mint I thought I would reinstall it to test future releases before taking the plunge and installing for real.

First up I installed the Virtualbox OSE from the Mint/Ubuntu repositories.  I created a new VM with a new virtual hard disc (8GB).  I downloaded the latest kubuntu desktop image to my downloads folder.  Then I configured the VM to read the ISO image as the start-up disc.  Or rather I tried to configure it.

On the VM settings tab I selected the CD/DVD-ROM drive, mounted the CD/DVD Drive and checked the radio button vbox_add_iso1for the ISO image file.  No media was selected so I clicked the browse button to open the choose file dialogue.  Navigating to the Downloads folder a blank screen is returned to me.


The file exists.  For some reason Virtualbox OSE under Mint 7 KDE can’t see the ISO files.  Take two.  Uninstall OSE and install the non-free version of Virtualbox – taking the latest version 3.1.0 from the website.  Same problem.  Uninstall 3.1.0 and reinstall 3.0.12 rebooting between installs.  No luck.  I have searched the forums for an answer without finding a solution.

vbox_add_iso2I have made sure I have been added to the vboxusers group.  Tried different ISO images including Mint 8, Dragonfly, FreeBSD.  The only thing that worked was booting from an Ubuntu 6.06 CD I had burnt three years ago.  The VM picked up the drive and popped up the gold Ubuntu menu.

Now it’s not the end of the world and there are probably better things I could be doing with my time but it is still annoying that something that worked under Ubuntu doesn’t work under Mint – an Ubuntu derivative.  If anything does turn up to solve the problem I’ll update the post with the solution.

Experimenting with Mint KDE

Mint 7 KDEI got tired of brown and orange ubuntu. And I really like amarok as a media player instead of ryhthmbox and I wanted to try digikam as photo manager instead of f-spot. I had heard good things about Linux Mint. Which is green and so makes a pleasant change.

So I backed up 250GB of photos, video, music and accumulated cruft and installed Linux Mint 7 “Gloria” KDE version.  It was not without hassles.digiKam The installer got confused as to which drive was which and, after a clean install reformatting everything to ext4, installed grub2 on the wrong disc.  Various boot parameters had to be edited until the Ubuntu 6.10 rescue CD sorted things out using the “rescue a broken system” menu.

DigiKam (0.10.0) works but I’d like to install version 1.0.0 and I need KDE 4.3.x for that.  It is a lot slower on my desktop than f-spot was under ubuntu (My desktop is Core 2 Duo e4300, 2GB DDR2 RAM, ASUS P5VDX2 mobo, 2 x 250GB WD and 1 x 500GB WD, nvidea 8600GT 512MB so it should be pretty snappy with all the fancy effects).

Amarok KWinAmarok has its pros and cons.  The default version on Mint 7 plays radio streams but doesn’t download any cover art for my albums.  Amarok NEON (bleeding edge) doesn’t play as it uses the new API requiring 3 euro a month but it does download most of my cover art.

Kdenlive is a non-linear video editor for KDE and seems to be pretty good.  Something along the lines of iMovie or Adobe Premiere Elements.  I have not used it with any serious intent yet but I do need to prepare a best man’s speech which I will have to deliver by video.  It might come in handy.

So what to do, what to do?

Wait for Mint 8 KDE or install Mint 8 Gnome?  32bit or 64bit?

Handy things to know

I have just upgraded to 8.04.3 – the third upgrade to the LTS release of Ubuntu.  What linux kernel version am I running the server on?

uname -r

What version of Ubuntu Linux am I running?

lsb-release -a


cat /etc/lsb-release

Improving the speed at which my websites load

I host a number of sites on my server that have anything from 10 to 1000 requests a day. some sites are image heavy – galleries – and others have a load of javascript plug-ins to make them look nice and do cool things. I have been trying to find different ways of improving the speed of the site as a number of users had complained about the glacial slowness of some of the components.

So, what did I do?

  • upped the installed memory from 512MB 533MHz to 2048 667Mhz – single biggest improvement!
  • repaired and optimised all MySQL database tables for each site
  • disabled all unnecessary wordpress plugins
  • enabled WP-Super-Cache, a cacheing plugin to improve performance of popular pages, on all WordPress sites.
  • resized and optimised for web all photos in the photo galleries
  • installed the firefox add-on, YSlow, to my browser and used that to identify slow parts of the site.
  • enabled the Apache2 module, mod_deflate, to compress elements of the page before serving them.
  • tweaked mod_deflate like this:

From this:

<ifmodule mod_deflate.c>
    # compress content with type html, text, and xml
    AddOutputFilterByType DEFLATE text/html text/plain text/xml

to this:

<ifmodule mod_deflate.c>
    # compress content with type html, text, xml, css, and javascript
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/x-javascript

Installing PHPSysInfo 3.0 RC8 on Ubuntu 8.04

I installed this the other day after running RC6 for a while and I wanted to see what improvements had been made. I used to run Nagios, Munin, Monit and AWstats on the server and they ground the machine to a halt.

  • rc6 picks up the server name and the internal IP address
  • rc8 picks up the apache virtual server name and the external IP address – changed with this line
    • define('PSI_USE_VHOST', true);
  • rc8 has an additional theme – cream – although I still prefer the
  • rc8 has memory usage section expanded by default
  • rc8 flickers when expanding the PCI Devices list. rc6 is smooth.

phpsysinfo 3.0 rc8The dynamic updating in rc8 seems to be faster / actually working. There also appears to be a lag in system uptime. The webmin front page and rc8 both match but rc6 is about 20 minutes behind.  I had to do a lot more tweaking of the config file in rc8 to get it to work than in rc6. As far as I can remember I just unpacked rc6 and pointed the browser at the appropriate URL.

These are the settings that I had to change in config.php rc8 as I kept getting XML errors about the PSI plugins and UPS settings:

define('PSI_PLUGINS', 'mdstatus,ps,psstatus,smart,quotas');
define('PSI_SENSOR_PROGRAM', 'LMSensors');
define('PSI_SENSOR_ACCESS', 'command');

If you want to download phpsysinfo 3.0 rc6 you can grab them here (rc6) phpSysInfo-3.0-RC6.tar and here (rc8) phpSysInfo-3.0-RC8.tar