Tag Archives: Linux

Filesystem mounted as read-only during boot

Today I had a case where a server mounted the root filesystem as read-only during boot. To make a short story shorter, check /dev/null.

After doing some searching in the logs I found a few lines complaining about /dev/null also being read-only filesystem. So I checked the permission with ls -al /dev/null, and it turned out this had been changed into a regular file rather then the special file it’s supposed to be.

The fix is easy. Delete the file called /dev/null and re-create the special device with the command mknod -m 666 /dev/null c 1 3.

You can also read about how to create this special file by reading the man-pages. Command: man 4 null.

NimBUS and Regular Expressions

I recently had to configure NimBUS to send alarm upon detecting a specific log entry in /var/log/messages on a Linux system. Because this alarm was supposed to be sent by SMS , I didn’t want it to send more than one message. But since our log file has a timestamp, each entry were we found a match would be handled as a unique alarm, thus sending one message for each log entry where the mach was found.

If the string we were looking for first would appear, it would most likely show up somewhere between 5 to 50 times within an hour.It’s hard to guess, really. But we are looking for a problem that won’t solve itself, and the program checking for this problem will continue to write to the log file upon each encounter with the problem.

The way to solve this kind of problem, where we want to ignore the timestamp, is to understand how NimBUS handle incoming alarms. If it receives the same message two or more times, it would just upper the count, instead of creating a new entry in the alarm window.

Lets say our log file looks like this:

Mar 14 14:55:35 ErrorCheck: Oh noes, error detected in A51
Mar 14 14:57:32 ErrorCheck: Oh noes, error detected in A51

We only want to get one alarm, but with a count of two (actually one), not two alarms which is identical except for the timestamp. First, set up logmon to detect the correct line in the log file using regular expressions. The logmon probe supports both pattern recognition and regular expressions, so make sure to use the right one. Regex starts and end with a forward slash, otherwise it assumes pattern is used.

In this case we can use the following simple regex:

/.*ErrorCheck.*/

Of course my regex where more advanced since I had to detect other parameters as well, since the output of our program also had to be checked.

Now, with this regex in place, we are at the point where every entry will be treated uniquely. But logmon also give you the possibility to construct your own message, and to define variables. And that is what we have to do.

We can construct variables both by row or column number. Since this is a single line, we will use the column offset. So, let us create the variables:

prog = column number 4
error = column number 10

This is only a simplified view. The logmon probe has a user interface for this. Right click, add new variable (or something like that).

When this is done, add your own message text in the field saying so:

$prog: Error detected in $error

When this is set as the outbound message, NimBUS will count it instead of creating a new entry in the alarm view each time, since the message now is identical. If the error code changes, a new alarm will be sent.

Short version:

Create your own output message when using NimBUS logmon probe on a log file which has a timestamp.

(This short version was a lot better and could have saved me some time)

Threepwood Goes to VMware ESXi

My home server, Threepwood, named after the main character in the popular game series “Monkey Island”, has finally taken the step out of this world and into the virtual space.

For a few years it resided within a Compaq Proliant 400 with whooping 384MB of RAM and 450MHz CPU. Running Ubuntu Linux, this has actually been enough for most of the tasks. It has mainly been used to host a few blogs, my brother and mine, thus running Apache2, MySQL and PHP5.

Now that I’ve got VMware ESXi running, I decided it was time to move already. To move it I used VMware Converter, which can move physical machines into VMware ESX and ESXi while the source machine is online. To minimize data loss I stopped the Apache and MySQL services.

The conversion took about 1 hour, but then again I only had a 40GB hard drive, so times may vary depending on hard drive size and network capabilities.

After the conversion I took the time to upgrade the kernel and other packages. Until today my server had 294 days uptime, so one might say it was due for a new kernel. I also gave it some more memory to play with, 1596MB to be exact, and a 2.40GHz CPU.

Yeah, I know. I’m spoiling him.

Running Web Server as a Virtual Machine

For several months now I’ve been planning to virtualize my home server. That’s the server hosting this blog, among other things. For starters it would give me some more room to test different applications on separate operating system, but without the hassle of dealing with several physical computers.

One of my ideas is to test web application prior to deployment. This is kind of hard now that I only have one machine. It’s would be shameful if I accidently killed the web service because of a faulty configuration. Also I have a few projects which I want to separate from the machine visible on the internet.

VMware Server is a free product which can be installed on top of either Windows or Linux, so it’s not a bare-metal hypervisor. I recommend running it on top of Linux for minimal footprint, not to mention all the rebooting you have to do with Windows. A minimal Ubuntu server installation takes less than 1GB of disc space, and use next to nothing when it comes to terms of memory.

For the moment I’m doing some testing with one mySQL server, one Apache web server and one server running Varnish, which is a cache/proxy service. It’s not because I’m expecting high load in the near future, but it’s an interesting solution.

Anyway; the next few months I expect this blog to focus more on virtualization, but I can’t guarantee anything. I would be satisfied if I keep writing semi regular, no matter the topic.