How to create Postfix database files

Every time I come to recreate the Postfix database file when I edit the file /etc/postfix/virtual.cf I forget what command I need to recreate virtual.cf.db

Hopefully I’ll check my blog next time. The command is postmap. Hope this is useful for someone else too!

postmap /etc/postfix/virtual.cf
/etc/init.d/postfix restart

Reasons to upgrade your Ubuntu

ubuntu.com is down unfortunately. The release of Ubuntu 9.10, Karmic Koala the latest version of Ubuntu Linux, is obviously driving a heck of a lot of traffic to the site. (I wonder if they use the equivalent of wp-super-cache?)

Anyway, I’ll be upgrading tomorrow probably and once I do I’ll be checking out some of the applications mentioned on this page. Everything from an alternative media player, the (as yet unreleased) Gnome 3.0, audio/video editing, a photo manager to the pretty sweet Electric Sheep screensaver are listed here.

Many of the apps are available for Ubuntu 9.04 but others require building manually. I’ll be busy over the weekend 🙂

Here’s a few of the eye catching screenshots from that page, just to whet your appetite!

Ubuntu? Laptop? Intel Graphics? Speed Boost!

If you’re using the latest version of Ubuntu, Jaunty Jackalope, or version 9.04 and you use a laptop with an Intel graphics chip like I do in my Dell D630 you may have gotten used to to the God awful video performance since you upgraded from the previous release.

I had. I had forgotten that windows aren’t supposed to tear when you drag them, and that yes, the underpowered chipset in my laptop can sort of handle the special effects in Compiz. What changed? The new drivers in 9.04 did. Intel are apparently reshaping how their drivers work but while they do it performance has taken a back seat and is cheerfully swilling on beer while the computer does the heavy lifting up front. (errr)

Anyway, simple way to fix it? Revert to the driver in the previous version of Ubuntu! It’s horribly easy to do. Just follow this guide, update your apt sources, install the old driver and restart X. I did and now I have fancy windows bouncing here, there and everywhere! In fact, my wife used her online O2 account to send a few texts and the confirmation popup window hopped around the screen all on it’s own! Oh how we laughed!

Oh, and for anyone who uses a browser, there’s a really simple way to get a CPU upgrade for free. Download Chrome or Chromium (or for Ubuntu .debs) and give it a whirl. After using Firefox for many years it’s like a breath of fresh air, fast moving air that is as it zips along! OK, it’s not completely bug free. The latest builds have a problem with the “default browser” setting (grab a build from around Sep 4 but the fix will be available soon) but it’s the main browser on my Linux desktop and I love the thing!

Upgraded my Dell D630 to 4GB RAM

That was quick:

  • Order placed with Crucial yesterday afternoon around 1.30pm for 2 sticks of 2GB RAM.
  • UPS guy called this morning at 11.30am with RAM.
  • Dell D630 laptop upgraded to 4GB RAM with the help of this tutorial. Only took about 20 minutes, although unscrewing and removing the keyboard was a bit nerve wrecking.
  • Rebooted and found that Linux only found 3.5GB of the RAM but fixing that is simple:

    # apt-get install linux-headers-server linux-image-server linux-server

  • Reboot and I see 4GB RAM. Should make running Firefox and Bibble Pro 5 a lot less painful. Both memory hogs.

4GB of DDR2 RAM only cost me about 50 Euro. I’m sure I have a receipt for 8MB of SDRAM I bought years ago. Cost me 100 quid then. So, 4GB of RAM back then would have cost a small fortune.

laptopmemoryupgrade

2gbmemoryupgrade

Edit: the server kernel has terrible video performance (unsurprisingly), I’ve gone back to the desktop kernel and will recompile it when that 500MB of RAM becomes a real necessity (or I move to a 64 bit version of Ubuntu).

Run a program on one CPU core in Linux

Modern computers use CPUs with multiple cores for performance reasons. Software can take advantage of that and use both cores to run separate threads but sometimes it’s useful if you can force a process to use one core rather than both.

In Linux that’s easy to do. If you’re using Ubuntu or Debian grab the schedutils package:

sudo apititude install schedutils

That will install a program called “taskset” which is a tool to “retrieve or set a process’s CPU affinity”. It’s really easy to use too.

I wanted to force Bibblelabs on to one core while importing photos.

# ps auxw|grep bibble
donncha 19482 78.7 33.1 1090388 681220 ? RNl 09:56 77:28 ./bibblepro
# taskset -p 19482
pid 19482’s current affinity mask: 3
# taskset -p 01 19482
pid 19482’s current affinity mask: 3
pid 19482’s new affinity mask: 1

The app is still heavy on the system, and “System Monitor” doesn’t suddenly show 0% usage on one CPU because I’m also running Firefox, Xchat, X, Gnome Terminal but I’d almost swear the browser window refreshes faster.

PS. Thanks to whoever told me about this on Twitter a while back. It had slipped my mind and I had to search for it again. Blogging it to remember it!

Ubuntu Linux: Is your external usb drive slow?

I don’t know when this happened but my external USB drives were running really slow. Reading RAW images off them took ages, backups took forever, and moving files back and forth was plain slow.

I use two Seagate FreeAgent external drives. They’re both USB 2 devices so should sustain more than the maximum 1MB/s I was seeing. I decided to go looking. First stop was /var/log/syslog where I found the following:

usb 2-1.2.4.4: new full speed USB device using uhci_hcd and address 13
usb 2-1.2.4.4: not running at top speed; connect to a high speed hub

To cut a long story short, after a few searches I found bug 66115 where the same problem is described. Unfortunately the ticket has since been closed but the work around discovered by Jean Pierre Rupp works for me too. I haven’t modified any files in /etc/ but unloading ehci_hcd and uhci_hcd and reloading in the correct order worked for me:

rmmod ehci_hcd
rmmod uhci_hcd
modprobe ehci_hcd
modprobe uhci_hcd

Now I get a very respectable 15-20MB/s when using rsync to transfer files from my internal drive and reads are super fast:

hdparm -tT /dev/sdi1

/dev/sdi1:
Timing cached reads: 3964 MB in 2.00 seconds = 1985.16 MB/sec
Timing buffered disk reads: 82 MB in 3.03 seconds = 27.08 MB/sec

Next on the TODO list is making sure the modules are loaded in the correct order on reboot. Time to dive into /etc

Control Ubuntu and Mac OS X from one computer

I just installed Synergy on my Ubuntu and Mac OS X laptops and now I can control both from one keyboard and mouse. It works fairly well, although I do wonder:

  1. What are the special Mac keys mapped to on my beige PC keyboard?
  2. I’ll have to stretch if I move my Macbook away from my desk. (joking)

It’s easy enough to install, on Ubuntu the Linux version is already in the repositories, so the following will install a simple gui tool to configure and run a server.

aptitude install quicksynergy

That will install Synergy as well.
Run “quicksynergy” from a terminal, go to the “Use” tab and give it the IP address of your machine. Then enter the hostname of your second (or third or fourth..) computer in whichever direction you want. My Macbook is on the left.
screenshot-quicksynergy

Before clicking “Execute”, I downloaded the Mac OS X version of Synergy, untarred it and after reading the documentation, fired up the client with:

./synergyc -f 192.168.1.20

Moments later, the following message popped up on my Ubuntu terminal,

NOTE: CServer.cpp,278: client “donncha-o-caoimhs-macbook.local” has connected

Now I can move the mouse cursor off the left side of my Ubuntu screen and it starts moving on my Macbook!

I don’t think I’ll use it full time as I’d strain my back or neck typing on a keyboard in front of me and twisting my neck to see my Macbook but it’s a nice tool to have. Over WiFi moving the mouse cursor stuttered a small bit, so it’s unlikely you’ll want to do intricate pixel work with it.
I’ll have to try a day’s work with it to judge it properly.

Backups save the day

Marina City, Chicago A few weeks ago I blogged about my backup system. How I have two 1TB Iomega external drives and how one drive is a duplicate of everything on the other drive, and how I backup everything on my laptop and VPS accounts. It sometimes seem excessive but I’m paranoid.

This morning I’m very glad I went to such lengths. I wanted to copy some stuff onto my Macbook, and there’s nothing like the bandwidth available from a directly connected disk. I unmounted my drive, at least I tried. Something was keeping it mounted. Instead of following my own advice and checking what program was keeping the drive busy, I used “umount -l” instead. Turns out it was Rhythmbox, but I didn’t realise that until later.

Anyway, I disconnected the usb cable, plugged in the one connected to the Macbook (BTW – Ext2 for Mac OS X is useful for reading ext2/ext3 filesystems) and kaboom. The light on the external drive went out. Oh oh.

Long story short, the drive refused to mount again on the Linux box for several minutes. Eventually it did, but with errors. I’m running fsck.ext3 on it but it’s giving me tons of errors and won’t run automatically. I need to buy another drive this morning.

So what’s lost? My 8 years of photos? All the family videos shot over the last 2 years? My mp3 collection? Nope. They’re all backed up. Murphy’s Law states that if something can go wrong, it will. This was the worst time ever for a drive to fail as I had just reinstalled the operating system, and my backup system wasn’t running properly yet. Thankfully nothing irreplaceable was moved onto the broken drive in that narrow window of time when things weren’t being backed up.

I now want to get that new drive installed before the second goes belly up! Paranoid? You betcha!

How to fix ssh timeout problems

If you use ssh a lot, you may have noticed that your ssh session times out and you’re logged out every once in a while. Annoying isn’t it?

Read from remote host ocaoimh.ie: Connection reset by peer
Connection to ocaoimh.ie closed.

There’s a quick fix for that. Actually, there are 2 ways to fix it. You only need to do one of them so choose whichever one is easiest for you. You’ll need root access, so for most people it’s probably safer to do the client fix rather than the server fix.

  • On the server, login as root and edit /etc/ssh/sshd_config and add the line:

    ClientAliveInterval 60

    According to man sshd_config, this line,

    Sets a timeout interval in seconds after which if no data has been received from the client, sshd(8) will send a message through the encrypted channel to request a response from the client. The default is 0, indicating that these messages will not be sent to the client. This option applies to protocol version 2 only.

    Don’t forget to restart sshd on the server after you save the file.

  • The other way, and easier and safer way is for your desktop machine to send those keep alive messages. As root on your desktop (or client) machine, edit /etc/ssh/ssh_config and add the line:

    ServerAliveInterval 60

    That will send send a message to the server every 60 seconds, keeping the connection open. I prefer this way because I login to several machines every day, and I don’t have root access to all of them.

I knew I had blogged about ssh timeout problems before, but I hadn’t mentioned the client fix so it’s worth a revisit!

Fixing Ubuntu 8.10

I suppose you could say I’m a long time Debian/Ubuntu Linux user, but the recent upgrade to 8.10 completely messed up my desktop machine.

  • Sound was broken in Flash. That’s happened before and doing an aptitude install flashplugin-nonfree-extrasound fixed that, but from time to time sound would break and I’d have to killall -9 pulseaudio;pulseaudio -D to get it working again.
  • My shiny new Xbox360 controller refused to work correctly in Ubuntu 8.10. Despite assurances on various Ubuntu sites that a fully updated system should now work, it didn’t. Moving the analogue stick moved the mouse pointer.
  • Editing a spreadsheet in Open Office proved impossible as whatever key or action I last took would repeat if I used the cursor keys. Hit “a” and “a” would appear in every cell when the cursor was moved. I used the mouse and TAB a lot while working on my last VAT return.
  • I wrote a DVD+RW just fine on Monday, but 3 days later when I tried to erase it, Gnomebaker complained it didn’t have permission to access /dev/sr0 (I think). I tried to mount another CD and Ubuntu complained it couldn’t read ISO9660 CDs.

I tried recreating my user account in case that helped. It didn’t. The only way to fix my broken Ubuntu 8.10 was to reinstall from scratch. After backing everything up onto one of my external drives the install couldn’t have been easier.

So, now? Any problems? ‘Fraid so.

  • I had to install flashplugin-nonfree-extrasound to get sound working in Firefox and Flash. Yay, Youtube is sounding sweet again! No lockups yet.
  • My joypad still didn’t work, despite the fact I had upgraded everything. Thankfully this bug report came to the rescue. If your Xbox360 controller refuses to work in Ubuntu, try this:

    $ xinput list
    See which device number the Xbox controller has…
    $ xinput set-int-prop THATDEVICENUMBER ‘Device Enabled’ 32 0

    I’ll probably have to add that to the Gnome Session so it’s permanent.

  • OO.org works fine thankfully. That was a showstopper bug. I even considered using Mac OS X for a moment.

Backuppc is reinstalled and configured. It now has nice RRD graphs! I’m also blown away by the folder sharing in Nautilus. This might have been available in 8.04 but I never noticed. Sharing folders via SMB has never been so easy!

I haven’t reinstalled everything I need yet, but I’m happy that my desktop is working again.