Enable caching in collectd!

23 February 2010

If you decide to run collectd on your system, don’t do what I did: I ran it for 8 months without caching enabled. Basically, that means that not only was collectd monitoring load, it was generating a huge amount of load itself — way more than anything else running on the system.

Case in point:

collectd load graph. "No caching" shows high iowait, while "CacheTimeout" and "CacheFlush" shows the CPU load more than halved.

The “no caching” bit is what it’s been running like for 8 months, using this config in /etc/collectd/collectd.conf:

<Plugin rrdtool>
        DataDir "/var/lib/collectd/rrd"
</Plugin>

To more than half my idle CPU usage, and get my load averages back down to near 0.00, all I had to do was add:

<Plugin rrdtool>
        DataDir "/var/lib/collectd/rrd"
       CacheTimeout 120
       CacheFlush 900
</Plugin>

I don’t get why they don’t ship it like that by default. Enable caching. Your server will thank you. Thanks to the folks on #slug who held my hand while fixing this. :)

How to get X.Org working on an Apple eMac (ATI Radeon 7500)

20 February 2009

About 8 or so months ago, I bought an Apple eMac, which came with a DVD drive, 1GHz PowerPC processor, 1GB of RAM, and an ATI Radeon 7500 video card.

One of the first things I did was attempt to install Linux on it. Ubuntu 8.04 was my first try, and I was annoyed to find that I couldn’t get a picture with Xorg on it — just a blank screen. I also tried Debian Etch, Debian Sid, and Fedora 8, which also had the exact same symptoms.

The only Linux distro that worked was openSUSE 11, but I couldn’t stand openSUSE because it was slow, YaST was painful to use, I hated RPM, and they customised GNOME way too much.

Initially, I thought it was a refresh rate problem. I have gathered that the optimum screen mode for the eMac is 1024×768 @ 89Hz. Because Ubuntu was trying to set the mode to 1280×800 @ 60Hz by default, I added a modeline for the proper mode. However, that didn’t fix my blank screen, and I almost gave up in despair.

I also ran xrandr under a tty, and it was interesting to see that it thought my Mac had DVI hardware — DVI-0 and DVI-1. The eMac most definitely does not support DVI, so this told me the issue was a little more advanced than refresh rates.

On Saturday, while talking to the friendly folks on #gentoo-powerpc, one of them pointed me to this page (Update: the link is an equivalent page, as the original link is now gone), which contained some ConnectorTable hacks. As it turned out, the hacks worked! Both internal and external VGA worked (internal VGA was called VGA-1, and external VGA was called VGA-0), which makes me really happy.

So, to get X.Org working on your eMac, make the following changes to xorg.conf.

First you need to define the Modeline for the video mode:

Section "Monitor"
  Identifier   "Configured Monitor"
  # 1024x768 @ 89.00 Hz (GTF) hsync: 72.00 kHz; pclk: 99.07 MHz
  Modeline "1024x768"  99.07  1024 1088 1200 1376  768 769 772 809  +HSync +Vsync
EndSection

Then, tell it to use the video mode:

Section "Screen"
  Monitor    "Configured Monitor"
  # Fill in self-explanatory data here.
  SubSection "Display"
     Viewport   0 0
     Depth     24
     Modes   "1024x768"
  EndSubSection
EndSection

Fix the broken ConnectorTable:

Section "Device"
  # Fill in device information here.
  Option      "ConnectorTable" "100,1,0,1,108,2,0,1"
EndSection

After you do that, you should have a working X display. If you still get a blank screen, switch to a tty, run export DISPLAY=:0, run xrandr, and check to see that the eMac is using the correct resolution. Make sure DVI is not mentioned.

The photo by Oswald using -HSync +Vsync depicts the eMac with the picture off-centre. This is because -HSync +Vsync (the default) is wrong! Use +HSync +Vsync, and your picture will be in the centre of the screen.

Instead of the ConnectorTable hack above, one user from the Ubuntu forums points out that it is possible to get a picture by adding the following code to the Device section:

Section "Device"
  # Device information goes here.
  Option "monitor-DVI-0" "iMac"
EndSection

This is not as good a solution as setting ConnectorTable, as the external VGA monitor does not work with this set.

If you used this information to try and fix X on your eMac, please let me know in the comments so I know whether it was helpful or not! Thanks!

VERR_SUPDRV_COMPONENT_NOT_FOUND on VirtualBox

6 January 2009

If anybody is getting the VERR_SUPDRV_COMPONENT_NOT_FOUND error when trying to start a VM in VirtualBox when trying to set up Host Interface networking, the error is occurring because VirtualBox can’t communicate with the vboxnetflt driver.

To fix this, simply load the vboxnetflt module:

# modprobe vboxnetflt

Then, try starting the VM again. If it works, you know that the problem is that the vboxnetflt module is not loading on startup.

If it didn’t work, make sure the module has been built. A little # /etc/init.d/vboxdrv setup ought to do the trick.

On most Linux systems, you can add an entry to /etc/modprobe.conf to make the module load on startup. (On OpenRC-based Gentoo systems, you can add an entry to /etc/conf.d/modules to do it the Gentoo Way™.)

Slipstreaming Windows XP with Service Pack 3 in Linux

12 July 2008

In between constructing table-based layouts in Dreamweaver (groan) in a web design class, I slipstreamed Service Pack 3 into Windows XP using only tools available in Linux. I didn’t boot into Windows once during the process (except for, obviously, booting the resulting ISO image in a VM to make sure it worked), but I did use Wine at one point.

This post isn’t going to be a how-to; rather, I will just give you a quick overview of how I did it, and let you readers fill in the gaps.

Here are the tools I used:

What I did:

  • Extracted the contents of a Windows XP ISO (in your case, it may be the CD) into a directory called “xp” on my Desktop. I initially loop-mounted the ISO and copied the files out of it that way, but I later had to re-extract them with file-roller instead. The reason? If you extract the contents of the ISO with lower-case names (the loop-mounted ISO lower-cased all the filenames), the CD will not boot. Make sure they are all in uppercase.
  • Extracted Service Pack 3: mkdir ~/Desktop/sp3 && cd ~/Desktop/sp3 && cabextract ../xpsp3.exe
  • Ran the slipstreamer for SP3 on the files: cd ~/sp3/update && wine update.exe /integrate:Z:\\home\\jeremy\\Desktop\\xp
  • Extracted the boot image from the existing Windows XP ISO. (To do this, you can either use the geteltorito command, run BBIE under Wine, or follow the directions under the “Finding the CD boot image” heading on this guide.)
  • Made the ISO image with genisoimage. You’ll at least need the -b (reference the boot image you extracted in the previous step), -no-emul-boot, -c, -max-iso9660-filenames, -relaxed-filenames options.

If you’re lucky, you now have a Windows XP SP3 ISO.

Get classic GNOME logout/shutdown menus in Ubuntu

12 July 2008

I don’t like Ubuntu’s default shutdown menu. (You know, the one that appears when you press System → Quit and pops up a dialog with buttons for each option.)

GNOME, by default, doesn’t actually have the “Quit” menu. Instead, it has “Log Out username” and “Shut Down”. Those menus bring up dialogs that have a timer, so if you don’t click Shut Down/Log Out or Cancel in the resulting dialog, it will go ahead and shut down anyway.

Handy for if you click System → Shut Down when you’re in a rush to get out of the house, and forget about the dialog that comes up, because you ran off before it came up.

It’s really easy to enable. Just type this in a terminal:

$ gconftool-2 --type bool --set /apps/panel/global/upstream_session true

Either type killall gnome-panel, or log out and log on to see the changes.