Answers 104

From LXF Wiki

Answers 104

<title>Server monitoring</title>

<question>I have three Ubuntu servers all running different services (Apache, MySQL, FTP, etc). These computers do not have very reliable hardware, so I was wondering if there is any open source software out there that can monitor multiple servers. I would prefer to get the output in a web page, so I could access it from my PDA via the internet. Will I need to hand-code it or is there anything out there ready-made? </question>

<answer>There are a number of programs that will do what you want, with varying degrees of sophistication. At the harder end of this range is Nagios ( but something a little less complicated should be more than adequate for your needs. Monit ( is mainly intended for monitoring programs on the machine running it, though it can watch remote servers too. It's generally a good idea to run it on a different machine to the one you're monitoring, otherwise a problem on the server could also bring down the monitor, leaving you with no warning that anything had happened. Monit can be told which services to test and what to do when they fail, so you don't have to rely on remembering to check a web page to see that something is wrong ­ Monit can send you an email. Even better, it can execute an external program or restart the service. The latter option is intended for local services, but you could make the restart command

ssh remote.server /etc/init.d/service restart

provided you've set up key-based SSH on the remote server so that this can run without pausing for a password. Other possible external actions would be to use the xsend script from xmpppy ( to send an instant message to your PDA, alerting you immediately, or send an email via an email-to-SMS gateway to alert you with a text message. It all depends on how urgently you need to know when a problem arises, and which way is most likely to reach you first. Here is an extract from a working config file

set mailserver
set alert
set httpd port 2812 and allow admin:monit
check host slartibartfast with address
  if failed icmp type echo count 3 with timeout 3
seconds then alert
  if failed port 3306 protocol mysql with timeout
15 seconds then alert
  if failed url then alert

The first part covers global settings, including where to send email alerts and enabling the web interface. This allows connections from anywhere, but controlled by a login, so you can use your PDA wherever you are. The second block performs three tests on a remote host, and sends an email alert if any of them fails. If you want to have Monit restart services, you will need a separate block for each service, like this

check host with address
  if failed port 3306 protocol mysql with timeout
15 seconds
    then exec "/usr/bin/ssh /
etc/init.d/mysql restart"

The exec command sends an alert too, so you'll know that the service has failed and has been restarted. Monit also has a web interface, so you can check and reassure yourself that all is well from time to time. Monit can do a lot more than watch servers: it can check CPU load and disk space or watch for changes to the contents or permissions of files or directories. The example configuration file covers most uses ­ simply uncomment it and edit the ones you want to use. </answer>

<title>Automounting with Udev</title>

<question>I have a car PC with a USB port on the front of it, and I've loaded a slimmed down version of PCLinuxOS on to it. What I would like to do is (at init level 3) have Udev automatically mount any USB mass storage device placed into the USB port to /media/removable. I've tried writing the following rule, but it doesn't work:

SUBSYSTEMS=="usb", ATTRS{product}=="Mass
Storage Device", SYMLINK:="removable",
RUN+="/bin/mount /dev/removable /media/

Can you see anything wrong with this? I've read through some Udev tutorials, which have lead me to the conclusion that this should work, but /dev/removable is never created. </question>

<answer>The first step is to try the rule without the RUN command, to test whether it is even matching. Only when /dev/removable is being created and you can run the mount command manually should you add it to the rule. Udev is smart enough to notice changes to the rule files without a restart, so it's easy enough to keep the file in your text editor and tweak the rule while unplugging and plugging the device. When writing Udev rules, bear in mind that the attributes you match on must come from the same block of output from udevinfo. If you want to match on any USB mass storage device (which may not all have the same product attribute), try

SUBSYSTEMS=="scsi", KERNEL=="sd[a-h]1",
SYMLINK:="removable", RUN+="/bin/mount /
dev/removable /media/removable"

This will mount the first partition of any USB storage device you connect. You don't need to create the /dev/removable symlink for a rule that mounts a device, though you may have other uses for this, so your rule could be simplified to

SUBSYSTEMS=="scsi", KERNEL=="sd[a-h]1",
RUN+="/bin/mount /dev/%k /media/removable"

because %k contains the kernel's name for this device, such as sda1. If your system uses the SCSI layer for hard disks, this will also match your hard disk when you boot. The solution is to explicitly exclude the hard disk from the rule. Run udevinfo to get the drive's model attribute, then add something like this to the rule:

ATTRS{model}!="superduper 500G"

Most USB mass storage devices, especially pen drives and memory cards, are set up with a single partition, so this will match on those. If you want to connect something like a USB hard drive with multiple partitions, you will need something a little cleverer, like

SUBSYSTEMS=="scsi", KERNEL=="sd[a-h][0-9]",
SYMLINK:="removable%n", RUN+="/usr/bin/
pmount /dev/removable%n"

This uses pmount instead of mount, which is more sophisticated and is used by most automounters. One of its advantages is that it only needs the device node as an argument, and creates the mount point in /media automatically. Its counterpart, pumount, removes the mount point when unmounting, keeping media clean. The %n in the above rule is replaced with the kernel number, so the third partition (sda3) would be mounted at /media/removable3. </answer>

<title>USB to serial</title>

<question>I would love to junk Windows and run a pure Linux system. I have found equivalent software for everything I do and I know from the Live DVDs that my system will work. However I am studying for a Cisco CCNA qualification and use a serial port replicator connected to a USB port on my system. The serial end then connects to the console port on the Cisco Router via a serial-to- RJ11 crossover cable. Do you know how to get a USB serial port replicator working under Linux, and can you recommend a replacement for the Hyper Terminal and SolarWinds TFTP Server apps? </question>

<answer>By port replicator, I take it you mean a converter. A port replicator usually connects a port to an output of the same kind, as used on laptop docking stations. There are a variety of USB-to-serial converters out there, most of which are supported by Linux. I have two myself, both bought from eBay and using different chipsets and drivers, but both working perfectly under Linux. The kernel has a number of modules to drive these devices, which should be automatically loaded when you connect them. Run this command as root, or prefix it with sudo if running Ubuntu, before connecting the device

tail -f /var/log/messages

When you connect the device, you should see something like this:

usbcore: registered new interface driver usbserial
drivers/usb/serial/usb-serial.c: USB Serial Driver
drivers/usb/serial/usb-serial.c: USB Serial support
registered for ark3116
ark3116 5-2:1.0: ark3116 converter detected
usb 5-2: ark3116 converter now attached to
usbcore: registered new interface driver ark3116

Here you can see that this device uses the ark3116 module and has created a serial device at /dev/ttyUSB0. You can see which USB serial drivers are available on your system with

ls -1 /lib/modules/$(uname -r)/kernel/drivers/usb/

If your device is not recognised, run the lsusb command to get its ID numbers and search for it at It may be that you have an unsupported device, (though that is unlikely), or that your kernel was not built with the appropriate modules, in which case you will have to recompile your kernel with the driver enabled. The standard serial terminal program for Linux is Minicom, which should be included with your distro. There are a number of TFTP servers available, including Atftp ( and NetKit TFTP ( although I prefer to use the TFTP server in dnsmasq ( </answer>

<title>Compilation queries</title>

<question>I'm new to Linux and appreciate `out of the box' solutions. For example, I use Slackware, and installed Filelight after reading the Install file and doing

./configure && make && su -c "make install"

because the Install file made sense. Now I have the January 2008 issue [LXF101] and in HotPicks is a program named NoteCase. The readme.txt file is confusing. It says, "Just unpack the archive contents and start the program. Windows users require GTK toolkit installation." Does "Just unpack the archive contents and start the program" refer to the Windows install or the Linux install? If it refers to the Linux install then there are no executables in the extracted archive named notecase-1.7.4_src.tar.gz to run. Then there is a compiling option for Ubuntu only. Since the program is for Ubuntu running Gnome, would you consider when you're writing HotPicks letting users know if it's an application for Gnome or KDE only? I tried running make and got this error message:

/notecase-1.7.4# make ===> Compiling src/main.cpp Package gnome-vfs-2.0 was not found in the pkg-config search path. Perhaps you should add the directory containing `gnome-vfs-2.0.pc' to the PKG_CONFIG_PATH environment variable </question>

<answer>The Readme file for this application is rather confusing. It would appear that the same Readme is used for the source and binary archives, and the one you tried to use is the source one. While the instructions for compilation are for Ubuntu, this is not an exclusively Ubuntu program. Nor does the mention of Ubuntu automatically make it a Gnome program, Ubuntu is quite capable of running KDE programs too, and KDE itself for that matter. In fact, this is a GTK application, although it does require gnome-vfs to be installed. There are two possible reasons for the error you mention: either you do not have gnome-vfs installed, or you do, but pkgconfig is not aware of it. In the latter case, setting PKG_CONFIG_PATH to include the correct directory before running make would fix the problem, like this:

locate gnome-vfs-2.0.pc
export PKG_CONFIG_PATH="directory from
above command"

Alternatively, there are binary packages available. The DVD contains RPM and Debian packages, and there is a plain binary tarball on the NoteCase website, which you could unpack to the root directory of your filesystem with

tar xf notecase-1.7.6.tar.gz -C /

An alternative to downloading the binary package, and one that is useful when a binary tarball is not available but an RPM is, is to use the rpm2targz command to convert an RPM to a tarball. Note that you will have to resolve any dependencies yourself when using this approach, so it is best reserved for those occasions when the source is not available. </answer>

<title>Swapping opinions</title>

<question>First I would like to say that I'm new to the Linux world. I purchased your Christmas issue [LXF100]. In reading through the magazine, on page 78 in the Essential Linux Info, it mentions that the swap file should be twice the size of the machine's RAM but no more than 512MB. But in the booting tutorial, in case study 2 the author mentions "... a 2GB partition hda2 for the swap partition" I'm confused. Am I reading this right? Second, on a single machine can you run a Linux image under a Linux image ? I know that there are other ways to do this, such as running VMware or VirtualBox, but I would like to know if you can do this. </question>

<answer>This is one of those questions that will get you a dozen different answers from ten different "experts" The traditional advice was that swap should be twice the machine's physical memory, but that comes from the days when most machines had only 64­128MB RAM. Some argue that with modern hardware having so much memory, swap is largely redundant. The opposite argument is that modern applications are capable of using that much memory, so swap is as relevant as ever. If you know you're going to be doing a lot of memory-intensive work, add plenty of swap. Losing a gigabyte or two of drive space is nothing compared with the inconvenience of your computer grinding to a halt because you have used up all the memory in a video editing session. Some systems use tmpfs for the /tmp directory, speeding up the system by keeping temporary files in memory. These are usually small, but some programs do put large files in /tmp, and having some disk space to handle an overflow is a good thing. It is also common practice to use the swap partition for suspend-to-disk storage, particularly on laptops. In this case, the swap partition has to be at least as large as your physical RAM. On balance, I would still use 1­2 times the physical RAM for swap space, especially as hard drive sizes have grown even more quickly than RAM capacity. While it is possible to run a Linux distro within a window on your existing distro ­ after all, this can be done in Windows ­ I know of no distros specifically aimed at this. This is probably because there are so many options for running virtual machines that can run any distro that creating a distro specifically for this task would be rather pointless (but if anyone knows of such a distro/app, please let us know). With a choice of VMware, VirtualBox, Qemu and Xen, you already have plenty of options for running Linux within Linux, and more securely because a virtual machine protects the host from the guest's processes. </answer>

<title>Missing Perl mod</title>

<question>I have tried to install Evince from LXFDVD99. After copying the application and compiling and installing the XML2 library I tried to configure Evince and got the following error message.

Checking for intltool >=
0.35.0....0.35.5 found
checking for perl ..../usr/local/bin/
checking for XML::Parser
configuration error XML:: Parser
perl module is required for intltool.

I then tried to load Perl from the DVD's Development section. Linux reported an I/O error and Windows reported CRC failure. Identical messages given when the DVD was inserted in another laptop. I tried downloading and installing the latest version of Perl but got the same error messages. Do you believe that it has any connection with the fact I have problems in reading the DVD? As other sections of the DVD are also unreadable, how do I get a replacement here in Australia? </question>

<answer>Your DVD has read errors, probably caused by damage in transit. Others in Australia have reported similar problems, and we are trying to resolve this. Meanwhile, we'll send you a replacement disc. The second problem is that you are missing the Perl module XML:: Parser. This is not part of the standard Perl package but an extra module, which is why reinstalling Perl didn't help. The first place to look for a Perl module, or anything else, is in your distro's software repositories. It is likely to be there, but if not you can install Perl modules from CPAN (The Comprehensive Perl Archive Network), which you can find at In most cases you can install directly from the command line without visiting the website. Providing you are connected to the internet, running this as root will install XML::Parser

perl -MCPAN -e `install XML:: Parser'

There are other ways of installing modules from CPAN ­ see the FAQ at for details. </answer>

<title>Ex-booting Xbuntu</title>

<question>I need to install Xubuntu from the LXF99 coverdisc on to a computer with no DVD drive. I have copied the file xubuntu-7.04-alternate-i386.iso to my home directory then burned it to a CD using Xfburn. The CD however will not boot on either of my older computers. They do boot from CDs, in fact the Dapper install CD boots and so does the CentOS install CD ­ but not the Xubuntu one I just burned. I checked the MD5sum on the burned image, and on the file I put into my home directory and they are the same. </question>

<answer>There are a number of possible causes for this. Going for the low-hanging fruit first it could be that you have written the ISO image to the disc as a file instead of as an image. When you look at the content of the CD, do you see several files and directories or just one big file? If it is one file, you have not written it as an image. With Xfburn, you should use the Burn CD Image button. Another possible culprit is the disc. Are you using CD-RW discs? If so, try a new one, or a CD-R. CD-RW discs have a lower reflectivity, which becomes even worse when they have become scratched with use. This can be compounded with older computers, where the drive lasers may be getting weaker and the lenses dirty. This may not be bad enough to stop your drive reading the disc, but it may slow down the process enough for the BIOS to decide there is no bootable CD in the drive and move on to the hard disk. One solution for discs that refuse to boot is to use Smart Boot Manager, which you will find in the Essentials directory of every LXFDVD. Write the file to a floppy disc, boot from that with the CD in the drive, then choose the CD from the Smart Boot Manager menu. </answer>

<title>Broadcom and SUSE</title>

<question>I run OpenSUSE 10.1 on a Dell M70 laptop, but have to use NdisWrapper to get my wireless to work. I have to use Modprobe to activate the wireless, which works a treat. I believe my Dell laptop uses the Broadcom wireless chipset. I would like to use OpenSUSE 10.3 but cannot get the wireless to work ­ the distro comes with the drivers built-in, but I don't know how to activate the wireless to get it working. </question>

<answer>The Linux kernel now includes native drivers for the Broadcom BCM43xx wireless chipset, but these are reverse-engineered and do not work well with all variants of these chips. I used it with a BCM4306 card and the drivers worked reasonably well, but some of the later chipsets don't work at all (yet). You can see an up to date list of currently supported devices at (run lspci in a root terminal to see which version of the hardware you are using). If you have a supported chipset, you should be able to configure it in Yast, though you may need to persuade SUSE to load the driver when you boot. If

lsmod | grep bcm

shows the module as being loaded, you should be OK. Otherwise, do

modprobe bcm43xx

to load it now, and edit /etc/sysconfig/kernel to add bcm43xx to the list of modules in the MODULES_LOADED_ON_BOOT line to have it load automatically at boot time. If you have one of the unsupported chipsets, you'll need to continue to use NdisWrapper, just as you do with SUSE 10.1. In this case, you may need to make sure that the native driver does not try to grab the device first by adding the line

blacklist bcm43xx

to /etc/modprobe.d/blacklist. Then set up NdisWrapper as you've done in SUSE 10.1. </answer>

<title>Fscked boot</title>

<question>I tried to boot into my Ubuntu Gutsy and it wouldn't go. I got Grub just fine, selected the OS, and it went to the boot splash screen and the loading bar. It got only a short way up this bar before the screen went black with a cursor in the top-left of the screen. There it stayed and wouldn't go anywhere else. I suspect that it's something to do with the regular fsck checks that it was perhaps trying to perform, but could not. If this is the case, what can I do? It seems that Ubuntu performs an fsck check every 27 times on booting. I fixed it by booting into recovery mode and letting fsck run, but it's going to happen again isn't it? How can I stop it happening every 27 boots? </question>

<answer>Boot splash screens are very pretty, but they also hide any error messages that the system wants to show you. Some distros let you remove the splash screen mid-boot by pressing a key, usually Esc or F2, but Ubuntu no longer does this. You can stop the splash screen in the first place by editing the boot options. When the "Press Esc to enter the menu" text appears, do so. Then press E, for edit, highlight the kernel line and press E again. Remove "quiet splash" from the end of the kernel line and press Enter followed by B to boot with the changed setting. You should now see all the boot text and be able to see exactly what is stopping the boot process. The change you made is temporary, but you can edit /boot/grub/menu.lst to make it permanent, or copy the current boot stanza and edit that, to give you options to boot with or without a splash screen. If a regular call to fsck is stopping the boot, it means that there's either a fault on the filesystem that fsck needs your input on before proceeding, or that fsck is taking a while and you haven't waited long enough. Booting without the splash screen will tell you which. Once fsck has completed successfully, you should not have this problem again, unless there is something wrong with your system that is causing filesystem corruption. One way to avoid the automated fsck is to regularly run it manually, so you should never go 27 mounts without a check. You can also use tune2fs to set the intervals between checks.

tune2fs -c 0 /dev/whatever
tune2fs -i 2w /dev/whatever

will tell it to ignore the mount count with the first command and to check every two weeks with the second. It is very unwise to disable both of these, otherwise filesystem corruption could build without you knowing until a serious failure occurs. If you want to get really clever, you could add something like this to a daily Cron script:

MOUNTS="$(tune2fs -l /dev/whatever | awk
`/^Mount count/ {print $3}')
if [[ $MOUNTS > 20 ]]
  echo "dev/whatever has been mounted
$MOUNTS times since the last check, run fsck
on it now."

This will email you when the mount count exceeds 20, giving you the chance to run it manually. The second line looks complicated, but it just runs tune2fs to list the filesystem information and extracts the mount count with awk. </answer>

<title>Canon can</title>

<question>I have a Canon professional scanner that will not work with Linux. If I installed Windows in a virtual machine so I can run Windows in Linux, would the scanner be able to run in the VM Windows or does USB control not work in that way? </question>

<answer>You don't say which virtual machine software you are using, but this is certainly possible in VMware Workstation and with VirtualBox, though the two apps use very different methods. In VMware Workstation, go to VM > Settings > Hardware > USB Controller and tick the box to `Automatically Connect USB Devices To This Virtual Machine When It Has Focus' If you then connect (or power up) the scanner while the Windows virtual machine is running and has focus, the scanner will be attached to the Windows guest OS instead of the Linux host. If you don't want to use this auto-connection, or if your scanner is connected and powered up before you boot the Windows virtual machine, you can manually connect it to the virtual machine at any time. Go to VM > Removable Devices > USB Devices, where you will see a list of attached devices ­ select your scanner. If you are using a version of VMware Workstation older than V6, you may need to disconnect the device from Linux first by unloading the module before it is available to VMware. The later versions are able to force the host OS to relinquish control of hotplugged devices. This was needed with mass storage devices, where you had to do

rmmod usb-storage

before the device could be seen by the guest OS. The procedure with VirtualBox is different: instead of giving it the power to take control of any newly connected USB device, you need to tell it about each device you want the virtual machine to see. Go into the USB section of the settings window for your VM and make sure that `Enable USB Controller' and `Enable USB EHCI USB 2.0). Then click on the Add button to the right of the USB Device Filters list and select your scanner from the list that pops up. Click on OK and start the virtual machine and it should detect your scanner. Instead of adding each device individually, you can leave some or all fields blank to match a range of devices. If you use Gentoo, you will need to install the virtualbox-bin package for USB support, as the app-emulation/virtualbox package ­ the one that installs from the Gentoo source code ­ doesn't handle USB on virtual machines. Once you've made the scanner available to your virtual machine, you will need to install drivers. Even if the device is supported in Linux, it now has a direct connection to the virtual machine, so the presence or otherwise of Linux drivers has no effect. The first time you connect the device, Windows should pop up the usual `found new hardware' message and take you through the driver installation process, so I hope you haven't lost the Windows driver disc that came with the device, as I usually do. </answer>