How to change the time anacron runs.

Well this one took me a while to figure out, so I thought I'd blog about it in case I could save someone else some time. Anacron is installed on desktop / laptop orientated distributions as they're often switched off. It basically makes sure the daily, weekly and monthly cron jobs are run by checking … Read more

UFW and OpenVPN

I used the excellent script here to setup OpenVPN on a server I'm running recently. I've set it up a hundred times before manually, and frankly its a bit of a slog, so its nice to find a tool that can do it for you and cut out the drudgery. And it nearly did, except on this particular server it didn't work. Clients could connect, but couldn't use the internet through the VPN.

After scratching my head for a while, I narrowed it down to the IPv4 forwarding. The script puts this line into iptables
"iptables -t nat -A POSTROUTING -s 10.8.0.0/d" and adds it to /etc/rc.local
But it wasn't appearing in the rules. Turns out this was because it had ufw installed, which is a simplified firewall interface which sits on top of iptables. The newly added rules were just being overwritten by ufw.

Read more

Ubuntu / Mint gvfsd-metadata kill script.

I've always had trouble with gvfsd-metadata. Not that I know what it actually is, I just know that once or twice a day my computer will become unresponsive, and the culprit is this little program running around in the background, doing whatever it does, and pegging my CPU up to 100%. I've searched many forums. A lot of people are affected, but there doesn't really seem to be any solution, or any clear reasons why it happens.

So what I usually do is open up a Terminal, run top and see that gvfsd-metadata is at the top of the list redlining my CPU. From there, I press k to kill it (if its the topmost item, its PID will be automatically selected, otherwise enter the PID manually), and then retain the suggested kill signal value of 15. Not a terribly hard process, but as the CPU is maxed out, then opening a Terminal window and top can take a few minutes. Its that sluggish. So, like you do, I whipped up a quick script to handle this automatically, which I run every 5 minutes.

Read more

Notes on Encrypted /home directory, post install.

I decided to encrypt the /home directory on a notebook, post install, as I was going to take it out of the house. There's nothing too important on it, but I probably should look after my ssh keys at least! The laptop is a low end Dell, running Mint (based on Ubuntu). It has a slightly odd configuration in that I have the /home partition mounted separately.

OK, so the first thing I did was to copy the big files onto a separate, non-encrypted partition. I did this for two reasons. Firstly the encryption process creates a copy of your home directory which you can roll back to. This means in your /home partition you need enough room for two copies of your home dir. I didn't. Secondly, the encryption process obviously encrypts each file as it goes. I thought by moving out the large files (Music and Videos directories basically), that this would speed up the encryption process.

Read more

mysql not starting – errno: 24 – Too many open files

This was a really strange one and might be peculiar to debian servers. I was trying to change a couple of mysql default settings, so after editing the config file, I restarted mysql on a webserver and it didn't come back up again. There were a bunch of errors in the /var/log/mysql.log saying "errno: 24 – Too many open files". And in fact mysql was so busy pumping these errors out, that it didn't have time to do any databasing on the files it was able to open.

After a bit of experimentation (read 'panic'), I discovered that rebooting the server started mysql up fine, but doing a 'service mysql restart' produced the file errors, so I rebooted and left it running while I investigated.

Read more