Disks failing everywhere

Posted: 2013-01-15 20:49:36 by Alasdair Keyes

Direct Link | RSS feed


It must the the lovely "sunny" weather England is experiencing at the moment, I've had three hard disks fail on me today, one in my desktop and two in servers


If you found this useful, please feel free to donate via bitcoin to 1NT2ErDzLDBPB8CDLk6j1qUdT6FmxkMmNz

Slow DHCP and the lack of Portfast

Posted: 2013-01-14 14:05:50 by Alasdair Keyes

Direct Link | RSS feed


If you're using DHCP and it seems to be taking a long time to get an Address from your server, check that Portfast is enabled in your switch config.

The config setting will be specific to your brand of switch, but it enabled good fast PXE booting for me.


If you found this useful, please feel free to donate via bitcoin to 1NT2ErDzLDBPB8CDLk6j1qUdT6FmxkMmNz

Ave Maria

Posted: 2012-12-06 19:01:31 by Alasdair Keyes

Direct Link | RSS feed


What does your database choice say about you?

Well, I don't know if they actually do say anything, however I've been using MySQL for a long time. If I need a database for a project, either for work and personal I fall back to MySQL, it's like the comfy old pair of shoes that you always wear because you know where you are with them and it always feels comfortable.

I dabbled a bit with Oracle at uni and dipped my toe in the Postgres waters a couple of years ago to see what the fuss was about. Both seemed very functional, however my only reason not to switch was that I was comfortable with MySQL. As a developer I know the SQL syntax to do pretty much most things I'd want to do and as a Sys Admin, I know how to set it up in multiple configurations, upgrade it, manage it and debug issues. Beyond that I'd got a lot of projects currently running on it and no one needs the headache of changing a core part of a system such as the database, as the saying goes... "If it ain't broke..."

Those who follow such things will be aware that MySQL has had a somewhat rocky history over the past few years with, being bought in 2008 by Sun and then acquired by Oracle a couple of years later. This has worried a lot of people, after all what would Oracle want with a free Database solution that might take business away from their high-end, uber-expensive prized product?

I have to say, I'm also a little concerned so I've been following MariaDB with some interest recently. MariaDB is a drop-in replacement for MySQL forked from the MySQL community version. It also has a few extensions and little extras of it's own should you want to use them but still maintains the backwards compatibility with MySQL. They very nicely also provide repositories for some of the main Linux distributions CentOS, Debian, Fedora, Redhat and Ubuntu, so you can get the latest and greatest versions and bug fixes all at the cost of adding a repository into your package management system.

I'm not sure I want to migrate my work systems to it yet, however I think I'll be giving it a go for some of my new projects.


If you found this useful, please feel free to donate via bitcoin to 1NT2ErDzLDBPB8CDLk6j1qUdT6FmxkMmNz

Coding by famous Authors

Posted: 2012-08-24 15:24:49 by Alasdair Keyes

Direct Link | RSS feed


Here's a bit of light-hearted techy humour for those who like to code..

http://byfat.xxx/if-hemingway-wrote-javascript

I'm quite taken with the Shakespeare version.


If you found this useful, please feel free to donate via bitcoin to 1NT2ErDzLDBPB8CDLk6j1qUdT6FmxkMmNz

Sendmail takes a long time to start

Posted: 2012-07-26 13:39:39 by Alasdair Keyes

Direct Link | RSS feed


I had someone come to me today with a CentOS 5.x machine that was taking upwards of 10 minutes to get to the login prompt.

When I rebooted the box, It hung for a long time on Sendmail and the Sendmail sm-client services

Starting Sendmail:

Between the two of them they took over 8 minutes to start. Helpfully /var/log/messages and /var/log/maillog didn't have any entries about why it took so long. After a bit of poking it turns out that he had changed the hostname from kvmhost01.local to kvmhost01.testlocal but hadn't updated /etc/hosts so sendmail couldn't find the IP associated with the hostname.

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1       kvmhost01.testlocal localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6

It's only a small thing but obviously makes a big difference to Sendmail.


If you found this useful, please feel free to donate via bitcoin to 1NT2ErDzLDBPB8CDLk6j1qUdT6FmxkMmNz

Network Ranges By Country/Continent

Posted: 2012-04-05 12:46:45 by Alasdair Keyes

Direct Link | RSS feed


Whilst investigating the source of some network attacks this morning, I came across the following website

http://www.countryipblocks.net

It provides lists of Network blocks by Country/Continent, if you notice a large number of attacks from a specific geographical area, you can find other IP blocks from the same area to add firewall rules.

According to the website, the data may become a paid-for service soon, so you may want to get the information while it's free!


If you found this useful, please feel free to donate via bitcoin to 1NT2ErDzLDBPB8CDLk6j1qUdT6FmxkMmNz

KVM Console Not working

Posted: 2011-11-25 13:09:11 by Alasdair Keyes

Direct Link | RSS feed


I've noticed that with KVM virtual machines, the kvm console <domainid> doesn't appear to work, when running you get

# virsh console MyVM
Connected to domain MyVM
Escape character is ^]

Hitting enter gives you nothing It appears that this isn't bug with KVM, rather the Guest OS isn't aware that it should start up a ttyS for KVM to connect to. When starting the machine, enter into grub and add the following to the kernel options...

console=ttyS0,115200

Then when the virtual machine starts you can connect again using virsh and hit enter a couple of times

[root@inth1-vdc-lvh01 ~]# virsh console MyVM
Connected to domain MyVM
Escape character is ^]

CentOS Linux release 6.0 (Final)
Kernel 2.6.32-71.el6.x86_64 on an x86_64

centos-6-0 login:

Voila... Obviously this isn't going to work for Windows :)


If you found this useful, please feel free to donate via bitcoin to 1NT2ErDzLDBPB8CDLk6j1qUdT6FmxkMmNz

BASH v4 Regular Expressions

Posted: 2011-03-05 14:09:48 by Alasdair Keyes

Direct Link | RSS feed


I've recently built a new backup server using NILFS for it's handy snapshotting capability. I'll get onto that in another post, but because NILFS support was only added into the Linux 2.6.30 kernel, our current CentOS 5 build's don't have support for it as they only run 2.6.18.

To overcome this, I built the new box up with Ubuntu 10.10 Server. However, it appears that I'd never written any BASH scripts using regular expressions in Ubuntu. I copied my custom backup scripts from our old box to the new backup server and ran them and it errored on some path name checks I performed. Upon investigation it appears that BASH v4's regular expression handling isn't backwards compatible with version 3. Specifically the use of the $ character as the End of Line character

As a test...

#!/bin/bash
TESTDIR="/tmp/a/";

if [[ $TESTDIR =~ '/$' ]]; then
        echo "$TESTDIR has a trailing slash";
else
        echo "$TESTDIR has no trailing slash";
fi

The output is

/tmp/a/ has no trailing slash

Which doesn't seem too clever to me. After some looking through the bash documentation I found out about the 'shopt' builtin which allows you to change additional shell behavior.

Long story short, so I don't have to go round changing all the regex in my code, if I add something like this to the top of all my scripts, they can port between Bash v3 and v4 seamlessly...

#!/bin/bash

BASH_VER=`/bin/bash --version | grep 'version 4'`;
if [ -n "$BASH_VER" ]; then
        echo "Detected BASH v4 - Switching on Version 3 compatibility"
        shopt -s compat31
else
        echo "Not Detected BASH v4"
fi

TESTDIR="/tmp/a/";

if [[ $TESTDIR =~ '/$' ]]; then
        echo "$TESTDIR has a trailing slash";
else
        echo "$TESTDIR has no trailing slash";
fi

Produces more expected output

Detected BASH v4 - Switching on Version 3 compatibility
/tmp/a/ has a trailing slash

Or if you're not bothered about nice output, shorten the check to..

if [ -n "`/bin/bash --version | grep 'version 4'`" ]; then
        shopt -s compat31
fi


If you found this useful, please feel free to donate via bitcoin to 1NT2ErDzLDBPB8CDLk6j1qUdT6FmxkMmNz

FLOSS and CentOS

Posted: 2010-11-18 16:44:24 by Alasdair Keyes

Direct Link | RSS feed


Earlier today I watched this podcast from FLOSS (Free Libre Open Source Software) on the TWiT Network whose special guest was Karanbir Singh from the CentOS project. Karanbir talked about CentOS, it's start in life, it's relationship with the Redhat Enterprise Linux system and his experiences with the project which were very interesting to listen to.

Being a lead developer on CentOS, Karanbir commits most of the package updates for the CentOS 5 systems I use at both home and work and I get many emails from him via the CentOS Announce list advising of new package commits. In a strange way it was interesting to see the person who I've never met and probably never will but has huge influence over my work life.

If you're interested in hearing about Open Source projects or use CentOS on any machines, I'd highly recommend spending an hour and watching (or listening) to this.


If you found this useful, please feel free to donate via bitcoin to 1NT2ErDzLDBPB8CDLk6j1qUdT6FmxkMmNz

Centos/Redhat 6

Posted: 2010-11-11 13:00:01 by Alasdair Keyes

Direct Link | RSS feed


Redhat have just released their latest Enterprise Linux offering Redhat EL 6. According to the CentOS twitter feed http://twitter.com/centos it will be 4-6 weeks before CentOS 6 is built and released publicly.

The two biggest changes for me are that exim is now no longer in the Redhat Repository and Xen DomU supported kernels have been dropped in favour of KVM technology.

Exim is the only MTA I really want to use, so I won't be switching to Postfix or sendmail. Thankfully, rebuilding the Latest Exim Source RPM from Redhat 5 on Redhat 6 seems very easy, so it shouldn't cause too much of an issue that I can see. Once CentOS 6 is released, I'll post an article about getting Exim running on 6, so keep posted.

I'm very intrigued to use KVM, I've had very little experience of it, but I've used Xen a lot, building our entire Linux VPS platform around it. The "bonusses" of KVM are looking interesting, especially the memory overcommit facility that's available. If I can get some hardware to test with I'll look at the ease of building up a redundant KVM cluster.


If you found this useful, please feel free to donate via bitcoin to 1NT2ErDzLDBPB8CDLk6j1qUdT6FmxkMmNz

IT Consultancy Services

I'm now available for IT consultancy and software development services - Cloudee LTD.



Happy user of Digital Ocean (Affiliate link)


Version:master-862fb90399


Validate HTML 5