My ongoing experiences with Ubuntu, and later Mythbuntu, as a media center with MythTV. I'm also using the system for a virtual machine server, a mediawiki server and a general all around home infrastructure base.

Sunday, December 13, 2009

Upgrading laptop from 9.04 to 9.10

Upgraded my Ubuntu laptop from 9.04 to 9.10. No major issues.

As with 8.10 upgrade, my Firefox is all messed up. Google toolbar and all my other extension buttons are gone. To get them back I had to disable the "Ubuntu Firefox Modifications" and then I was able to restore everything.

Sunday, November 29, 2009

Virtualbox USB devices greyed out

Running WinXP inside of VirtualBox and wanting to re-program my Harmony Remote, but all the USB devices were grey out. I followed these directions to fix.

First I added myself to vboxusers group:
# grep vbox /etc/group
# usermod -G vboxusers -a von
In order to get this group change to take effect in my login session, I had to logout and back in again.

Then I edited /etc/fstab to add /proc/bus/usb. I had an old entry I had to comment out.
# vi /etc/fstab
# tail -2 /etc/fstab
#/dev/bus/usb /proc/bus/usb usbfs auto 0 0
none /proc/bus/usb usbfs devgid=128,devmod=644 0 0
I had to unmount the old /proc/bus/usb and then remount it:
# umount /proc/bus/usb
# mount -a
At this point I restarted VirtualBox and was able to mount USB devices.

Friday, August 14, 2009

apt-get failed to fetch errors...

I'm seeing the following errors running 'apt-get update'. Not sure why. /var/log/apt-cacher/error.log shows no errors.

% sudo apt-get update
Err jaunty/multiverse Translation-en_US
Error reading from server - read (104 Connection reset by peer)
Err jaunty-updates/universe Translation-en_US
Error reading from server - read (104 Connection reset by peer)
Hit jaunty-updates/multiverse Sources
W: Failed to fetch Error reading from server - read (104 Connection reset by peer)

W: Failed to fetch Error reading from server - read (104 Connection reset by peer)

E: Some index files failed to download, they have been ignored, or old ones used instead.

apt-get update missing GPG key

I was seeing the following error when running "Check" on the update-manager, or 'apt-get update':
GPG error: jaunty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 248DD1EEBC8EBFE8
Answer, kudos to Gentoo Blog:
% gpg --keyserver --recv 248DD1EEBC8EBFE8
gpg: requesting key BC8EBFE8 from hkp server
gpg: key BC8EBFE8: public key "Launchpad PPA for Network-manager" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
% gpg --export --armor 248DD1EEBC8EBFE8 | sudo apt-key add -

Thursday, July 30, 2009

Networking didn't work after kernel upgrade: br0?

I did an 'apt-get dist-upgrade' and there was a kernel upgrade, so I rebooted. When the system came back there was no functional networking. Everything looked fine, I couldn't reach anything besides loopback.

On a hunch, I commented out br0 interface from /etc/network/interfaces and bounced networking (/etc/init.d/network restart) and all OK.

Then for grins I added br0 interface back and bounced networking again and, huh, all now seemed OK.

So I tried rebooted and all was still OK.

Chalking it up to a mystery for now unless problem returns.

Saturday, July 25, 2009

Another dyndns false alarm - put weekly force into place

I got another ddclient false alarm, where my daily cron job seems to lag just a day behind dyndns sending me an email warning.

This time I decided to add a cron job that does a forced update once a week to get rid of this race condition. Start my copying over the daily cron job:

# cp /etc/cron.daily/ddclient /etc/cron.weekly/

And then editing it to include '-force':
# vi /etc/cron.weekly/ddclient

End result looks like this:
/usr/sbin/ddclient -syslog -force

Sunday, July 5, 2009

Upgraded to Virtualbox 3.0

I notiec that Virtualbox 3.0 was released, so I upgraded my previous install using the directions from This time I went the route of editing /etc/apt/sources.list by adding the following line:

deb jaunty non-free

Then adding the Sun VBox key:

wget -q -O- | sudo apt-key add -

Then did the install:

apt-get install virtualbox-3.0

Then I also downloaded and installed the new 3.0 version of the SDK from the Virtualbox download page (which seems to have been updated to work with Python 2.6 btw).

Monday, June 29, 2009

Getting Django running under Apache

I heard a number of good things about Django and wanted to give it a try. After following the tutorial and playing around with it, I found it really cool. BTW, there is also good documentation to be found at the Django Book site.

After playing a little, I decided I wanted to try deploying Django into my existing Apache instance. And well, I found the documentation for doing this somewhat lacking (even in the book). But I forged ahead and catched what it took here. Hopefully it will either be helpful or someone can come along and tell me I missed something.

First, I started by installing Django on my Ubuntu server. I already had Apache installed and working btw.
sudo apt-get install python-django

Reading through the Django document I decided to go the modwsgi route since that seem to be the recommended course. I followed the directions for installing modwsgi:
sudo apt-get install libapache2-mod-wsgi

Then I created a Django site to run my applications in. Pick the name of your site carefully - as far as I can tell, it will appear in all your URLs (maybe I'm wrong on this as I haven't experimented too much):
cd /usr/local
sudo django-admin startproject django_site

Now, you could just go ahead and make your site owned by the Apache user (www-data), but I decided to make it owned by me so that I could easily edit things:
sudo chown -R vwelch django_site
Now create /usr/local/django_site/django.wgsi that looks like the following:
import os
import sys

os.environ['DJANGO_SETTINGS_MODULE'] = 'django_site.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

Now go ahead and edit /usr/local/django_site/ and set up your database. I used SQLite3 since it was the simplest. You will need to put the database somewhere the Apache user (www-data) has write access. In my case I created a directory just for this purpose:
sudo mkdir /usr/local/django_db
sudo chown www-date /usr/local/django_db

So the relevant two lines of my file looked like:
DATABASE_NAME = '/usr/local/django_db/database.db'

Now go ahead and create the database - you must do this as the Apache user:
sudo -u www-data ./ syncdb

Time to proceed with Apache configuration. Create the file /etc/apache2/sites-available/django.conf (using 'sudo vi') so that it looks like the following. Note that I believe the first argument to WSGIScriptAlias "/django_site" must patch your site name. The second line lets the admin application find it's CSS (I haven't dealt with the case another application also wants CSS).
WSGIScriptAlias /django_site /usr/local/django_site/django.wsgi
Alias /media /var/lib/python-support/python2.6/django/contrib/admin/media

Now enable the site in Apache and restart it:
sudo a2ensite django.conf
sudo apache2ctl restart

Now visit you should be able to visit http://hostname/django_site and get a Django welcome page. If not, well, something is wrong :-/

At this point you can add applications under /usr/local/django_site as you normally would and have them appear at http://hostname/django_site/appname

Good luck. And as I mentioned I figured this out through mostly trial and error. If anyone can correct me or point me at better docs, I'd be grateful.

Sunday, June 14, 2009

Uninstalling VMWare 2.0.1, installing VMWare 1.0.9 on Ubuntu 9.0.4

I had previously installed VMWare 2.0.1 and I hate it. I'm probably going to move to VirtualBox, but I need VMWare for a while until I transition, so I decided to take another run at getting VMWare 1.0.9 to install.

First, to uninstall VMWare 2.0.1:
# /usr/bin/
Then I downloaded VMWare 1.0.9 from the VMWare website.

Previously I had run into this bug which caused the vmmon build to fail.

The trick to getting it to build is to use this patch following the directions from this tutorial, which worked for me despite it being for an older version.

USB thumb drive mounting writable only by root...

I had a thumb drive that was mounting on my Ubuntu laptop OK, but was writable only by root.

Long story short, I figured out it was something about the way it was formatted. When I tried to put the same thumb drive into my Mac, it wouldn't mount it and I had to reformat it. After that it mounted just fine on my Ubuntu laptop and was owned by when when I did so.

Not sure how I formatted it in the first place, but lesson learned is that certain formats mount OK but will not be user writable.

Monday, June 8, 2009

Installing Virtualbox and creating Ubuntu VMs on headless Ubuntu 9.04 server

Here's my situation: Ubuntu 9.04 server, headless and I want to install Virtualbox on it and get Ubuntu 8.04 LTS servers running as root.

Step 1: Install Virtualbox

Following the directions at the Virtualbox Linux download page I did the following:

1a) Edited /etc/apt/sources.list and add the virtual box repository:
deb jaunty non-free

1b) Add the virtualbox key to the apt keyring:
wget -q -O- | sudo apt-key add -

1c) And install:
apt-get install virtualbox-2.2

Step2: Configured bridged networking

I basically followed the directions on the wiki.:

2a) Install bridge-utils:

apt-get install bridge-utils

2b) Now edit /etc/network/interfaces and add the br0 interface with the same address as your primary interface (eth0 in my case). Note that these directions assume you are using a static IP, if not you are on your own. My /etc/network/interfaces now looks like this:

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static

# Configured per
# Address of br0 should be the same as eth0
auto br0
iface br0 inet static
bridge_ports eth0 vbox0 vbox1

2c) Now restart the networking:

/etc/init.d/networking restart

...wait a couple minutes for the network to come back - my SSH session survived the restart YMMV...

Now I have a br0 interface:

# ifconfig br0
br0 Link encap:Ethernet HWaddr 00:18:8b:76:32:11
inet addr: Bcast: Mask:
inet6 addr: fe80::218:8bff:fe76:3211/64 Scope:Link
RX packets:87 errors:0 dropped:0 overruns:0 frame:0
TX packets:74 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:6130 (6.1 KB) TX bytes:11447 (11.4 KB)

2d) Create /etc/vbox/interfaces:
vi /etc/vbox/interfaces

So that it looks like:
vbox root br0

2e) Restart virtualbox networking, but hmmm, I don't have /etc/init.d/vboxnet, but I do have /etc/init.d/vboxdrv so I restarted that instead:
/etc/init.d/vboxdrv restart

2f) I skipped setting permissions on /dev/net/tun since I'm running VMs as root.

Step 3: Create a VM

I basically followed these directions, updated as I went. Also kudos to Sasquatch for the nic1 and bridgeadapter1 options.

3a) Create the new VM. You should be able to set the memory as you see fit. Other options you probably don't want to mess with.

VBoxManage -q createvm -name Ubuntu-Server -register
VBoxManage -q modifyvm Ubuntu-Server -memory 384MB -acpi on -ostype ubuntu -pae on -nic1 bridged -bridgeadapter1 br0

Note that if you have other VMs using vrdp you probably want to add "-vrdpport #" to use an available port (default port is 3389).

3b) Create disk for the new VM and attach it. I created an 8GB disk based on my experiences trying to use smaller disks.
VBoxManage -q createhd -filename "Ubuntu-Server.dvi" -size 8192 -register
VBoxManage -q modifyvm Ubuntu-Server -hda Ubuntu-Server.dvi

3c) Download the iso for 8.04 server from Ubuntu. Note I use 8.04 since it has long-term support and hence I won't have to worry about upgraded the OS on the VM as often. Note that while the Ubuntu page tried to get me to use the 64 bit version, I found it did not work for me (I got the following error trying to boot with it: "This kernel requires an x86-64 CPU, but only detected an i686 CPU. Unable to boot - please use a kernel appropriate for your CPU.") so I used the 32 bit version instead. You should also choose a copy from a local mirror.


3d) Register the iso image and attach it to the VM:
VBoxManage -q registerimage dvd /path/to/ubuntu-8.04.2-server-i386.iso
VBoxManage -q modifyvm Ubuntu-Server -dvd /path/to/ubuntu-8.04.2-server-i386.iso

Ok, we now have a VM that's ready to boot and install Ubuntu...

Step 4: Start the VM and Connect to it via vrdp

4a) Start the VM in vrdp mode:
VBoxManage -q startvm Ubuntu-Server --type vrdp

4b) Connect using a remote desktop client. What I found worked for me from my Ubuntu 9.04 laptop was 'rdesktop' from the commandline:
rdesktop server-name

Or from my Mac, Remote Desktop Connection, though it does give a warning about "Remote Desktop Connection cannot verify the identity of the computer that you want to connect to."

Step 5: Do a standard Ubuntu Install
Ok, you should now be looking at the console on the VM which has booted from the CD. Go ahead and do your standard Ubuntu install.

When the install completed, I found the system automatically rebooted from the hard drive without me having to do anything to unmount iso image.

Step 6: Clean up

The only thing to do is detact the iso from the VM. After powering off the VM, do the following:
VBoxManage -q modifyvm Ubuntu-Server -dvd none

Saturday, June 6, 2009

sftp subsystem dying

I tried to open a nautilus bookmark of a sftp session to my server today and it closed immediate with a "Could not open location 'sftp://vwelch@host' ssh program unexpectedly exited' message.

Running a sshd in debug mode on the server and I saw the following:
subsystem request for sftp
debug1: subsystem: exec() /usr/lib/openssh/sftp-server
debug1: Received SIGCHLD.
So for some reason my sftp-server subsyst is immediately failing. No idea why. Will update here when I figure it out.

Making a SSH connection to a NAT'ed Virtualbox VM

I found myself wanting to SSH to a NAT'ed virtualbox VM. I discovered this post which nicely described how to use VBoxManage to accomplish this. The only change I had to make on my Ubuntu box was to use 'pcnet' instead of 'e1000'.

Thursday, May 28, 2009

Installing Virtual Box

I recently upgraded to VMServer 2.0.1 on my Ubuntu laptop and I'm very unhappy. The new console is very slow and it hangs often. I'm tried of watching "loading" message. Certainly my laptop is a little old (1.5GHz Celeron M processor) and maybe that is a contributor. On the other hand if you google the net, you'll find no shortage of other people with the same opinion.

I installed VirtualBox on my Mac laptop and found I really liked it. So I figured I'd give it a try on my Ubuntu laptop as well.

First you need to choose between the Open vs Closed Source editions. Despite being a fan of open source I went with the closed source, mainly because the Remote Display Protocol server sounded like useful functionality I might want.

Install was fairly straight forward, I went to the VirtualBox Linux Downloads page and clicked on the Ubuntu .deb link.

One annoyance is that it didn't install an entry in the Applications menu, so I had to start it from the command line:
% /usr/X11R6/bin/VirtualBox
I did add an icon on the panel using the following steps:
  1. Right Click on Application Panel
  2. Select "Add to Panel"
  3. Select "Custom Application Launcher" and "Add"
  4. Type is "Application"
  5. Name is "VirtualBox"
  6. Command is "/usr/X11R6/bin/VirtualBox"
  7. Click OK.
This will create an icon with the default "spring" image. If anyone knows where I can find a stash of images for applications, please let me know.

That's it. If I like it on my laptop, next step will be installing it on my server which will be more interesting since I'll want to have unattended, automatically starting VMs and I'll also want to re-use my existing VMWare images (the images on my laptop don't have enough state for me to worry about).

MythTV Volume too low

I noticed the volume on MythTV seemed rather low. Poking around the net I found this thread and followed the directions as follows:
% alsamixer
And set Master and PCM volume to 100% (Master was down at 70%). That fixed my problem.

Then as suggested later in the thread, I saved the results (has to be done as root):
% sudo alsactl store

Tuesday, May 26, 2009

DynDNS false alarm

I previously set up automatic updating of DynDNS. Today I got an email warning me "Your account vwelch at is due to expire in 5 days."

Hmmm, I'd seen this problem before. So I logged into my server, but no hung ddclient processes:

% ps auxwww | grep ddclient

Hmmm, poking around some more, looks like the problem maybe fixed itself?

%grep ddclient /var/log/daemon.log
May 25 08:21:48 casey ddclient[13892]: WARNING: forcing update of Home from to; 30 days since last update on Fri Apr 24 21:31:51 2009.
May 25 08:21:48 casey ddclient[13892]: WARNING: forcing update of from to; 30 days since last update on Fri Apr 24 21:31:51 2009.
May 25 08:21:50 casey ddclient[13892]: SUCCESS: updating Home: good: IP address set to
May 25 08:21:50 casey ddclient[13892]: SUCCESS: updating good: IP address set to

Sure enough, logging into DynDNS showed a last update time from this morning.

So apparently there is a race condition between the email warning and the ddclient forcing a refresh.

Saturday, May 9, 2009

dbus-daemon: Rejected send message

Since my Ubuntu laptop upgrade to 9.04 I'm seeing the following messages every 10 minutes in /var/log/auth.log and in my logwatch emails:
dbus-daemon: Rejected send message, 1 matched rules; type="method_call", sender=":1.36" (uid=1000 pid=3697 comm="/usr/lib/indicator-
applet/indicator-applet --oaf-a") interface="org.freedesktop.DBus.Properties" member="Get" error name="(unset)" requested_reply=0 destination=":1.1421" (uid=0 pid=22921 comm="/USR/SBIN/CRON ")): 1 Time(s)
dbus-daemon: Rejected send message, 1 matched rules; type="method_call", sender=":1.36" (uid=1000 pid=3697 comm="/usr/lib/indicator-applet/indicator-applet --oaf-a") interface="org.freedesktop.DBus.Properties" member="Get" error name="(unset)" requested_reply=0 destination=":1.1422" (uid=0 pid=22923 comm="/USR/SBIN/CRON ")): 1 Time(s)
dbus-daemon: Rejected send message, 1 matched rules; type="method_call", sender=":1.36" (uid=1000 pid=3697 comm="/usr/lib/indicator-applet/indicator-applet --oaf-a") interface="org.freedesktop.DBus.Properties" member="Get" error name="(unset)" requested_reply=0 destination=":1.1423" (uid=0 pid=22928 comm="/USR/SBIN/CRON ")): 1 Time(s)
Poking around the net I found this bug and in particular this comment. I applied the suggested fix:
# cd /etc/dbus-1
# cp system.conf system.conf.orig
# vi system.conf
# diff system.conf.orig system.conf
> > send_type="method_call"
> send_member="Get"/>
After that I tried restarting dbus ('/etc/init.d/dbus restart') but that resulted in logging me out, so I suggest just rebooting instead.

Sunday, May 3, 2009

Installing VMServer 2.0.1

Having just upgraded to 9.04, it seemed like a good time to catch up on my VMWare server upgrades, since I was still on 1.0.7, which is getting a little old.

I started by trying to upgrade to 1.0.9, but I could not get the vmmon module to build...

So, I shifted gears and tried installing 2.0.1 following the directions at VMWare Server 2.01 on Ubuntu 9.04.

I downloaded the 2.0.1 tarball and tried installing it following those directions.
$tar xvfz ~/Downloads/VMware-server-2.0.1-156745.i386.tar.gz
$cd vmware-server-distrib/
$patch ./bin/ ~/Downloads/
$sudo ./
I took the default answers except for the following:
Your computer has multiple ethernet network interfaces available: eth0, pan0,
wlan0. Which one do you want to bridge to vmnet0? [eth0] wlan0

The current administrative user for VMware Server is ''. Would you like to
specify a different administrator? [no] yes
Please specify the user whom you wish to be the VMware Server administrator
I actually goofed typing in my serial number, but looks like my existing VMServer 1.0 license worked.

apt-get nautilus-dropbox errors

Hmmm. After upgrading my laptop to 9.04, I'm seeing the following error:
# apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 77.5kB of archives.
After this operation, 0B of additional disk space will be used.
Do you want to continue [Y/n]?
WARNING: The following packages cannot be authenticated!
Install these packages without verification [y/N]? y
Get:1 jaunty/main nautilus-dropbox 0.6.1 [77.5kB]
Fetched 77.5kB in 0s (670kB/s)
Failed to fetch Size mismatch
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

So far I haven't figure out how to solve this. Will post an update here when I have.

Update 5/29/09: I fixed this by installing it manually as follows.

# wget
--2009-05-29 13:51:23--
Connecting to||:443... connected.
HTTP request sent, awaiting response... 302 FOUND
Location: [following]
--2009-05-29 13:51:24--
Connecting to||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 77528 (76K) [application/octet-stream]
Saving to: `nautilus-dropbox_0.6.1_i386_ubuntu_9.04.deb'

100%[======================================>] 77,528 316K/s in 0.2s

2009-05-29 13:51:25 (316 KB/s) - `nautilus-dropbox_0.6.1_i386_ubuntu_9.04.deb' saved [77528/77528]

# dpkg -i nautilus-dropbox_0.6.1_i386_ubuntu_9.04.deb
(Reading database ... 193825 files and directories currently installed.)
Preparing to replace nautilus-dropbox 0.6.1 (using nautilus-dropbox_0.6.1_i386_ubuntu_9.04.deb) ...
Unpacking replacement nautilus-dropbox ...
Setting up nautilus-dropbox (0.6.1) ...

Dropbox installation successfully completed! Please log out and log back in to complete the integration with your desktop. You can start Dropbox from your applications menu.

Processing triggers for man-db ...
Processing triggers for libc6 ...
ldconfig deferred processing now taking place

ttf-mscorefonts-installer, apt-cacher and .exe files

Since upgrading to 9.04 I was still having problems upgrading ttf-mscorefonts-installer. The 'apt-get dist-upgrade' would die with the following error:

--2009-05-03 12:00:35--
Resolving localhost...
Connecting to localhost||:3142... connected.
Proxy request sent, awaiting response... 403 Sorry, not allowed to fetch that type of file: andale32.exe
2009-05-03 12:00:36 ERROR 403: Sorry, not allowed to fetch that type of file: andale32.exe.
Poking around, I found this post which explained that apt-cacher had a list of allowed file types and '.exe' wasn't on it. Unforunately, the apt-cacher script had changed and the patch in the post wasn't relevant any more. Here is my fix:
#cd /usr/share/apt-cacher
# diff -c
*** 2009-05-03 12:06:48.000000000 -0500
--- 2009-05-03 12:07:15.000000000 -0500
*** 57,62 ****
--- 57,63 ----
package_files_regexp => '(?:' . join('|',
+ '\.exe',

The I restarted apt-cacher:
# /etc/init.d/apt-cacher restart
Then I reran 'apt-get dist-upgrade' and it installed fine.

Saturday, May 2, 2009

Upgrading Mythbuntu from 8.10 to 9.04

Time to upgrade my Mythbuntu box to 9.04 from 8.10. I followed the Network Upgrade directions.

Not unsurprisingly, update-manage-core was already installed, so on to the upgrade (only showing highlights):

# do-release-upgrade
8 packages are going to be removed. 82 new packages are going to be
installed. 731 packages are going to be upgraded.
What is the password for the MySQL administrator account 'root':
Hmmm. I just enter here, I got an error about a database connection being refused and the upgrade continued. AFAICT, it worked out OK.
Will you be using this webserver exclusively with mythweb? Yes

Configuration file `/etc/services'
==> Modified (by you or by a script) since installation.
Y or I : install the package maintainer's version

I got asked about apt-cacher.conf - I hit "D" to get diffs and I got an error and the install went on. Fortunately I got another chance at this later...

What would you like to do about smb.conf? I kept the local version currently installed
Configuration file `/etc/apt-cacher/apt-cacher.conf'
N or O : keep your currently-installed version
The ending of the upgrade did not look good:

--2009-05-02 10:23:29--
Resolving localhost...
Connecting to localhost||:3142... connected.
Proxy request sent, awaiting response... 403 Sorry, not allowed to fetch that type of file: andale32.exe
2009-05-02 10:23:29 ERROR 403: Sorry, not allowed to fetch that type of file: andale32.exe.

andale32.exe: No such file or directory

All done, errors in processing 1 file(s)
dpkg: error processing ttf-mscorefonts-installer (--configure):
subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
I'm not sure what ttf-mscorefonts is, but doesn't seem to have any major impact.

Upgrade complete.

The upgrade is completed but there were errors during the upgrade
Ok, not the best message at the end, but at leat things have finished.

First thing I noticed is I started getting emails from cron:
Subject: Cron [ -x /etc/init.d/mythtv-status ] && /etc/init.d/mythtv-status reload > /dev/null
Sorry, failed to fetch http://localhost:6544/xml.
Hmmm. Well, first things first, just on principle:
System comes up fine in MythTV. Everything seems to be working well.

Hmmm, another email from cron:

Subject: Cron [ -x /etc/init.d/mythtv-status ] && /etc/init.d/mythtv-status reload > /dev/null
mv: cannot stat `/var/run/': No such file or directory
Update: This problem was caused by two cron jobs both trying to modify /etc/motd at the same time (every 10 minutes)! The update-motd cron job moves /var/run/ out from underneath the mythtv-status job. You can see the two jobs in /etc/cron.d:
# grep 10 /etc/cron.d/mythtv-status /etc/cron.d/update-motd
/etc/cron.d/mythtv-status:*/10 * * * * root [ -x /etc/init.d/mythtv-status ] && /etc/init.d/mythtv-status reload > /dev/null
/etc/cron.d/update-motd:*/10 * * * * root [ -x /usr/sbin/update-motd ] && /usr/sbin/update-motd 2>/dev/null
I believe what should really be happening is myth-status should be run by update-motd every 10 minutes instead of independently. Here is what I did to make that happen:
# rm /etc/cron.d/mythtv-status
# cd /etc/update-motd.d/
# ln -s /usr/bin/mythtv-status 50-mythtv-status
Test it out...
# /usr/sbin/update-motd
# cat /etc/motd
Linux casey 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:57:59 UTC 2009 i686
...typical motd stuff...

MythTV status for localhost
...typical mythtv-status stuff...

0 packages can be updated.
0 updates are security updates.
End Update.

Checked on vmware and it wasn't running. Usual problem:
# /etc/init.d/vmware start
VMware Server is installed, but it has not been (correctly) configured
for the running kernel. To (re-)configure it, invoke the
following command: /usr/bin/
Usual fix:
# /usr/bin/
I took all the defaults. Afterwards, don't forget to fix /etc/vmware/config.

I then checked /usr/share/apt-cacher/ to see if I needed to patch it and it had been fixed in the distribution - yeah!

Well, I think that's it. Will update this post if I run into any more problems.

Update: This system also acts as my apt-cacher, and when I went to upgrade the next system I got "104 Connection reset by peer" errors. Turns out I had to use the new /etc/apt-cacher/apt-acher.conf file:
# cd /etc/apt-cacher
# mv apt-cacher.conf apt-cacher.conf.8.10
# cp apt-cacher.conf.dpkg-dist apt-cacher.conf
# /etc/init.d/apt-cacher restart
Restarting Apt-Cacher: apt-cacher.
For the record, here's the diff:

# diff apt-cacher.conf.8.10 apt-cacher.conf

< # optional setting, binds the listening daemon to one specified IP. Use IP --- > # optional setting, binds the listening daemon to specified IP(s). Use IP
< allowed_hosts=","> allowed_hosts=*
< # And similiarly for IPv6 with allowed_hosts_6 and denied_hosts_6. --- > # And similarly for IPv6 with allowed_hosts_6 and denied_hosts_6.
< # This thing can be done by Apache but is much simplier here - limit access to --- > # This thing can be done by Apache but is much simpler here - limit access to
> # This sets the interface to use for the upstream connection.
> # Specify an interface name, an IP address or a host name.
> # If unset, the default route is used.
> #interface=
< # To enable data checksumming, install libdbd-sqlite3-perl and set this option < # to 1. Then wait untill the Packages/Sources files have been refreshed once --- > # To enable data checksumming, install libberkeleydb-perl and set this option
> # to 1. Then wait until the Packages/Sources files have been refreshed once
< # apt-cacher server is beeing relocated (via apt-get's error messages while --- > # apt-cacher server is being relocated (via apt-get's error messages while
< # also the only method to use FTP access to the target hosts. The syntax is simple, the part of the beginning to replace, followed by a list of mirror urls, all space separated. Multiple profile are separated by semicolons < # path_map = debian ; ubuntu ; security < path_map =" debuntu"> # also the only method to use FTP access to the target hosts. The syntax is
> # simple, the part of the beginning to replace, followed by a list of mirror
> # urls, all space separated. Multiple profile are separated by semicolons
> # path_map = debian ; ubuntu ; security
> # Permitted package files - this is a perl regular expression which matches all
> # package-type files (files that are uniquely identified by their filename).
> # The default is:
> #package_files_regexp = (?:\.deb|\.rpm|\.dsc|\.tar\.gz|\.diff\.gz|\.udeb|index\.db-.+\.gz|\.jigdo|\.template)$
> # Permitted Index files - this is the perl regular expression which matches all
> # index-type files (files that are uniquely identified by their full path and
> # need to be checked for freshness).
> #The default is:
> #index_files_regexp = (?:Index|Packages\.gz|Packages\.bz2|Release|Release\.gpg|Sources\.gz|Sources\.bz2|Contents-.+\.gz|pkglist.*\.bz2|release|release\..*|srclist.*\.bz2|Translation-.+\.bz2)$

Sunday, April 26, 2009

Evernote under Ubuntu with wine

I've been using EverNote for a while. It's nice on my Mac with the native client, and I have been using it via the web interface from my Ubuntu laptop. Looks like others have had success running it under wine, so I thought I'd give it a try.

I started by downloading the windows binary from

Then I ran the installer under wine:
% cd ~/Downloads/
% wine Evernote_3.1.0.1139.exe
There was a lot of warnings printed to the shell, but the install worked (I chose the "Express" option BTW).

EverNote started up. The first thing it does is sync and the message telling you it's syncing is a small message in the lower right, which is easy to overlook it turn giving the false impression it's hung. But after a couple minute it finished and I saw all my notes.

I've played with it a little so far. The video is a little sluggish, but still more spry than the web interface, so I'm happy.

Installing TweetDeck on Ubuntu

I was interested in a Twitter client I could use cross-platform so I decided to try out TweetDeck. Here's my install process on Ubuntu.

I started by installing Adobe Air:
% wget
% chmod +x AdobeAIRInstaller.bin
% sudo ./AdobeAIRInstaller.bin
Then I went to install TweetDeck. I could not get it to work from the TweekDeck homepage (I would click on the download button but nothing would happen), but it did work for me through the Adobe site. The installer ran and it just worked.

It did mention it would install Adobe Air in the process, so it is possible I could have skipped the first part of this post.

Saturday, April 25, 2009

Had to re-patch

Looks like around April 15 a new version of apt-cacher got pushed out, which overwrote my previous fixes. The file didn't change though, so I just re-applied the same fixes and saved a copy of the patched script in case it happens again.

BTW, here are the latest numbers. apt-cacher has saved me 10GB in traffic over the past 6 months.

cache efficiency

Cache hitsCache missesTotal
Requests 31818 (65.15%)17015 (34.84%)48833
Transfers 10.641 GB (72.34%)4.068 GB (27.65%)14.71 GB

LifeHacker Top 10 Ubuntu Downloads

Nice list.

Upgrading Ubuntu 8.04 Desktop VM to 9.04

Short version: Don't try upgrading a 8.04 Ubuntu Desktop VM with only 4GB of disk to 8.10 - there isn't enough disk space.

I decided to start playing with Ubuntu 9.04 by upgrading a 8.04 Ubuntu Desktop VM I had. Since it was two version behind I followed the upgrade directions to bring it up to 8.10 first. A key bit in the directions is opening Software Sources and selecting "Normal releases" under the Updates tab, otherwise Update Manager won't show the update version.

I fired up the Update Manager, upgraded a number of packages, and then fired up the upgrade to 8.10. Unfortunately it died with the following message:
The upgrade aborts now. The upgrade needs a total of 649M free space on disk '/'. Please free at least an additional 243M of disk space on '/'. Empty your trash and remove temporary packages of former installations using 'sudo apt-get clean'.
So I did as it suggested and ran 'apt-get clean', which seemed to free up ~720MB of disk space:
# apt-get clean
# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 3920768 2993528 729644 81% /
Now I trued Update Manager again, but it failed again with a similar message:
The upgrade aborts now. The upgrade needs a total of 975M free space on disk '/'. Please free at least an additional 306M of disk space on '/'. Empty your trash and remove temporary packages of former installations using 'sudo apt-get clean'.
So now I need 975MB of space. I give up.

Lesson learned, give Ubuntu more than 4GB if you think you might want to upgrade it.

Friday, April 24, 2009

New VM checklist

Things to do in a new Ubuntu VM after I create it:
  1. Install a apt-cacher proxy. This involved editing /etc/hosts to add the caching host and then creating /etc/apt/apt.conf.d/90local-proxy with contents of: Acquire::http::Proxy "http://cache-host:3142";
  2. Install vmware-tools.
That's it for now.

Upgrading Ubuntu Desktop from 8.10 to 9.04 - wireless woes again.

Turning now to upgrading my Ubuntu laptop from 8.10 to 9.04 using the Network Upgrade method. I started by checking to make sure I'm up to date:
# apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Then I ran System/Administration/Update Manager, hit Upgrade and followed the directions.

The irst time through I saw the following, which turned out to be caused by a misconfigured apt-cacher on my apt-cacher system (which I had just upgraded):
Third party sources disabled

Some third party entries in your sources.list were disabled. You can re-enable them after the upgrade with the 'software-properties' tool or your package manager.
Followed by:

Error during update

A problem occurred during the update. This is usually some sort of network problem, please check your network connection and retry.

W:Failed to fetch Error reading from server - read (104 Connection reset by peer)
, W:Failed to fetch Error reading from server - read (104 Connection reset by peer)
, W:Failed to fetch Error reading from server - read (104 Connection reset by peer)
, W:Failed to fetch Error reading from server - read (104 Connection reset by peer)
, E:Some index files failed to download, they have been ignored, or old ones used instead.
After fixing apt-cacher, I ran System/Administration/Update Manager again and it went much more smoothly. Questions asked during the upgrade and my answers:

Replace /etc/services? Yes

Could not install 'b43-fwcutter'
subprocess post-installation script returned error exit status 1
This turned out to be the sources of wireless woes (more about that later).

Then a couple scary messages I think related to the b43-fwcutter failure.

Could not install the upgrades
The upgrade is now aborted. Your system could be in an unusable state. A recovery will run now (dpkg --configure -a).


Upgrade complete

The upgrade is completed but there were errors during the upgrade process.


Then I went ahead and did a...

Booting the system did a "Routine check of drives" took several minutes

And then when it came up, I had no wireless, like last time. I plugged into wired ethernet and that worked - so that's better than last time. First thing I tried was re-enabling third party sources and seeing if there was a new Network Manager. I edited /etc/apt/sources.list and uncommented the following lines:

# Latest version of Network Manager
deb jaunty main # disabled on upgrade to jaunty
deb-src jaunty main # disabled on upgrade to jaunty

# Dropbox
deb jaunty main # disabled on upgrade to jaunty
deb-src jaunty main # disabled on upgrade to jaunty

#WineHQ - Ubuntu 8.10 "Intrepid Ibex"
deb jaunty main # disabled on upgrade to jaunty

deb stable non-free # disabled on upgrade to jaunty

And then I ran:
# apt-get update
# apt-get upgrade
But the only packages that were upraded were nautilus-dropbox and wine. So no luck there.

Ok, going back to b43-fwcutter, I tried the following:
# /usr/share/b43-fwcutter/
# reboot
And that did the trick!

Now I just did the usual vmware re-configure:
# /usr/bin/
I accepted all the default. Afterwards, don't forget to fix /etc/vmware/config.

At this point everything seems good...

Upgrading Ubuntu server VMs from 8.10 to 9.04

After my first attempt to upgrade a Ubuntu VM desktop image didn't work work due to lack of disk space, I decided to try my Ubuntu server VMs, which I had previously upgraded to 8.10.

I started by backing up the virtual machines (basically shut them down and tar'ed them up). Then I followed the direction for doing a network upgrade for Ubuntu servers. BTW, this took a while, I should have done it inside a screen session.

# apt-get install update-manager-core
Reading package lists... Done
Building dependency tree
Reading state information... Done
update-manager-core is already the newest version.
Presumably I did that during the 8.10 upgrade, so on to step 2:
# do-release-upgrade
Checking for a new ubuntu release
Done Upgrade tool signature
Done Upgrade tool
Done downloading
extracting 'jaunty.tar.gz'
authenticate 'jaunty.tar.gz' against 'jaunty.tar.gz.gpg'

...a few minutes go by here...

1 package is going to be removed. 23 new packages are going to be
installed. 270 packages are going to be upgraded.

You have to download a total of 188M. This download will take about
15 minutes with your connection.

Fetching and installing the upgrade can take several hours. Once the
download has finished, the process cannot be cancelled.

Continue [yN] Details [d]y

...25 minutes of downloading go by here...
At this point installs started and I answered various questions. I won't mention all of them, just hit the highlights...

I kept my version of the following files:
  • /etc/apache2/ports.conf and /etc/apache2/sites-available/default
  • /etc/apt/apt.conf.d/50unattended-upgrades
  • smb.conf
I went ahead and said "yes" to "17 packages are going to be removed."

Then I went ahead and answered yes to reboot and when the VM came back up, all looked good.

$ cat /etc/lsb-release
VMWare tools were even running:

$ ps auxwww | grep vmware
root 2448 0.3 0.1 2204 660 ? Ss 22:21 0:02 /usr/sbin/vmware-guestd --background /var/run/
That's it.

Upgrading another VM, I saw the following message, which I thought was interesting. I went ahead and said "y":
Continue running under SSH?

This session appears to be running under ssh. It is not recommended
to perform a upgrade over ssh currently because in case of failure it
is harder to recover.

If you continue, a additional ssh daemon will be started at port
Do you want to continue?

whatismyip quit working for ddclient... change to

Suddenly ddclient started generating errors trying to determine my local IP address:
WARNING: cannot connect to socket: IO::Socket::INET: connect: Connection timed out
WARNING: unable to determine IP address
Pointing a browser at seemed to confirm the site is down - just kept getting connection refused.

Well, time to find an alternative for whatismyip. Poking around with google, I found this page which described using Following those directions I edited /etc/ddclient.conf and replaced the following line:

use=web,, web-skip='Current IP Address: '
And then ran ddclient again to check:
# /etc/cron.daily/ddclient
No output, all seems well....But no, it isn't. Visiting DynDNS indicates I still haven't updated my information recently. Remembering my previous experience with ddclient hanging, I checked for a hung process and sure enough, there was one:

# ps auxwww | grep ddcl
root 15725 0.0 0.0 7548 3032 ? S Mar29 0:00 ddclient - read from port 80
root 30771 0.0 0.0 3240 804 pts/2 S+ 21:26 0:00 grep ddcl
So I killed it:
# kill -9 15725
And reran ddclient (I found I hat to use the -force flag to get it to do anything):
# /usr/sbin/ddclient -force

And all was good.

Sunday, March 29, 2009

Trying out 'unattended upgrades' to replace cron-apt

A while back I posted about a problem I was having with my auto update process sometimes getting hung up reinstalling a kernel update over and over. A reader left a comment about not having a similar problem with the "unattended upgrades" paclage.

I poked around the net, but could not find a lot of information about this package. The best information I found was this blog post on, which was enough to go on.

At this point I've installed unattended upgrades on one of my virtual machines. I haven't noticed any difference so far, but I haven't had a kernel upgrade such as the one that caused my problems, so I'm in a waiting mode now.

Here is what I did to install unattended upgrades, based on the post.

First, install the package and got rid of cron-apt:
# apt-get install unattended-upgrades update-notifier-common
# apt-get remove cron-apt
Then I edited /etc/apt/apt.conf.d/50unattended-upgrades and uncommented the following line:
"Ubuntu intrepid-updates";
Then I edited /etc/apt/apt.conf.d/10periodic to look like:
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "1";
APT::Periodic::Unattended-Upgrade "1";
That's it. I'll post again when I come to some conclusion about unattended upgrades vs cron-apt.

Redoing auto-updates to reduce email

I've gotten a little tired about the amount of email I receive daily from my automatic daily package updates, particularly now that I've installed logwatch, which provides me with much of the same information.

I have two types of machines that I want to update:
  1. Virtual machines that I just want to auto update and I don't want to hear about it unless there is an error. Yes, I understand I risk configuration problems, but so far this hasn't been a problem so I'm happy living on the edge.

  2. My key server and my laptop. On these machines I do the conservative download the packages and once a week, on the weekend, I sit down and manually install them. (If some critical security update occurs, I assume I will hear about it via other channels and jump in manually).
On all systems: make cron-apt quiet
I started by editing cron-apt configuration on all my systems and configuring it so it only sends email on errors by changing the MAILON value to "error":
# vi /etc/cron-apt/config
# grep ^MAILON /etc/cron-apt/config
Key Server and Laptop
Then I turned to my server system and laptop. I want to run cron-apt daily and then once per week send me a reminder to update (assuming there is something to update, which generally there is). I could just run cron-apt weekly, but this way if there is a critical security update, it will already be downloaded and I just have to install it.

To run cron-apt dailly, I add it to /etc/cron.daily:
# ln -s /usr/sbin/cron-apt /etc/cron.daily/
Then I created the following script to send me a weekly reminder me to install the upgrades (based on the script from this page):
# vi /etc/cron.weekly/show-upgrades
# chmod +x show-upgrades
And here is the script:
apt-get --simulate dist-upgrade > $tmpFile 2>&1
if test $? -ne 0 ; then
echo "Error running apt-get --simulate dist-upgrade:"
cat $tmpFile
rm -f $tmpFile
exit 1
grep Inst $tmpFile > /dev/null
if test $? -eq 0; then
echo "Upgrades are pending. Run 'apt-get dist-upgrade' to install."
grep Inst $tmpFile
echo "Full output:"
cat $tmpFile
rm -f $tmpFile
exit 0
Virtual Machines
Now, turning to my virtual machines. What I wanted here was automatically daily upgrade of all new packages with no output unless there was an error. This involved editing to the auto-update script I had created previously:
# vi /etc/cron.daily/auto-update
Here is the script:
/usr/bin/apt-get -y dist-upgrade > $tmpFile 2>&1
if test $? -ne 0 ; then
echo "Error doing '/usr/bin/apt-get -y dist-upgrade':"
cat $tmpFile
rm -f $tmpFile

host clock rate changes again

Updated April 16, 2009: And the answer is running '', which I did recently after a kernel update, causes the 'host.useFastClock = FALSE' line to disappear from /etc/vmware/config.

Original post follows...

Argh, once again my syslog on my VMWare server was getting filled up with host clock rate change messages:
# tail /var/log/syslog
Mar 29 08:31:46 casey kernel: [1894820.064260] [925]: host clock rate change request 54 -> 58
Mar 29 08:31:57 casey kernel: [1894831.040153] [925]: host clock rate change request 58 -> 24
Mar 29 08:31:57 casey kernel: [1894831.040272] [925]: host clock rate change request 24 -> 54
Mar 29 08:31:59 casey kernel: [1894832.676158] [925]: host clock rate change request 54 -> 58
Once again "host.useFastClock = FALSE" was missing from /etc/vmware/config

Once again, I added it and restarted vmware (/etc/init.d/vmware restart).

Once again, this cleared up the problem.

I decided to add a daily check for this line to try and figure out why it disappears:
# vi check-vmware-config
# cat /etc/cron.daily/check-vmware-config
grep "useFastClock" /etc/vmware/config > /dev/null
if test $? -ne 0 ; then
echo "WARNING: useFastClock line not found in /etc/vmware/config"
# chmod +x /etc/cron.daily/check-vmware-config
Nothing to do now but sit back and wait....

ddclient woes

I previously setup automatic updates of my dyndns account. This had been working fine, until this morning when I got the following email from DynDNS:
Your account vwelch at is due to expire in 5 days. expires accounts that have no activity during a 30 day period.
So I logged into my server and checked to see what was going on. First thing I notices is I had a lot of ddclient processes running, hung reading from
# ps auxwww | grep ddclient | wc
23 386 2486
# ps auxwww | grep ddclient
root 22048 0.0 0.1 6196 4184 ? SN Mar10 0:00 ddclient - read from port 80
root 24041 0.0 0.1 6196 4224 ? SN Mar24 0:10 ddclient - read from port 80
root 24791 0.0 0.1 6196 4180 ? SN Mar17 0:00 ddclient - read from port 80
root 26332 0.0 0.1 6196 4224 ? SN Mar11 0:04 ddclient - reading from port 80
root 28622 0.0 0.1 6196 4224 ? SN Mar25 0:09 ddclient - read from port 80
My guess here is that at some point there was a network problem that gummed verything up. I started by killing off all of these hung processes:
# killall -9 ddclient
# ps auxwww | grep ddclient
root 15680 0.0 0.0 3236 796 pts/1 S+ 08:12 0:00 grep ddclient
Looking at the daily cron script I had previously written, use of the '-daemon' flag seems wrong since I'm running it regularly from cron. When the script runs, I want it to do its thing and exit. So I took the -daemon flag out, leaving /etc/cron.daily/ddclient looking as follows:
/usr/sbin/ddclient -syslog
After this, I ran the script and turned my browser to DynDNS and saw that my Last Updated field was current.

Wednesday, March 18, 2009

Using cronic to reduce "cram" (cron spam)

I'm working on reducing the about of email I'm getting from my cron jobs. One thing I stumbled across is cronic. I used it as following to quiet my cron jobs.

First, to install it:
# wget -O /usr/local/bin/cronic
# chmod 755 /usr/local/bin/cronic
Now to use it, edit your cron scripts to use cronic as a wrapper. Before:
# cat /etc/cron.daily/backup-web-server
/usr/local/bin/ /etc/backup-web-server.conf
And after:
# vi /etc/cron.daily/backup-webserver
# cat /etc/cron.daily/backup-web-server
/usr/local/bin/cronic /usr/local/bin/ /etc/backup-web-server.conf
That's it. Now unless your cron job either has output to stderr or returns non-zero, it will produce no output.

Friday, March 13, 2009


Update: Looks like this is fixed as of Ubuntu 9.04

I previously reported apt-cache-report was not working. In this post I will set about fixing it.

What I discoved is the apt-cacher log format has changed. Old log:
# gzip -dc /var/log/apt-cacher/access.log.6.gz | head -1
Thu Oct 30 22:01:39 2008||MISS|189|security.ubuntu.com_ubuntu_dists_hardy-security_Release.gpg
New log:
# head -1 /var/log/apt-cacher/access.log
Tue Mar 10 01:45:59 2009|19924||EXPIRED|189|archive.ubuntu.com_ubuntu_dists_intrepid-updates_Release.gpg
So the new format has an extra column (second column, I have no idea what it is) and rearranged a little. I started in changing /usr/share/apt-cacher/ to compensate for this. Not that it still needed to be able to parse the old logs, so some logic was involved to distinguish.

# cd /usr/share/apt-cacher/
# cp
# vi
# diff -c

*** 2009-03-13 15:35:14.000000000 -0500
--- 2009-03-13 17:04:45.000000000 -0500
*** 109,121 ****
#$logfile_line =~ s/ /\+/g;
@line = split /\|/, $logfile_line;
! $req_date = $line[0];
! # $req_ip = $line[1];
! $req_result = $line[2];
! $req_bytes = 0;
! $req_bytes = $line[3] if $line[3] =~ /^[0-9]+$/;
! # $req_object = $line[4];
$lastrecord = $req_date;
if(!$firstrecord) {
$firstrecord = $req_date;
--- 109,133 ----
#$logfile_line =~ s/ /\+/g;
@line = split /\|/, $logfile_line;
! if (scalar(@line) == 5)
! {
! # 5 columns == old format
! $req_date = $line[0];
! # $req_ip = $line[1];
! $req_result = $line[2];
! $req_bytes = 0;
! $req_bytes = $line[3] if $line[3] =~ /^[0-9]+$/;
! # $req_object = $line[4];
! } else {
! # Assume new 6 column format
! $req_date = $line[0];
! # I don't know what $line[1] is
! # $req_ip = $line[2];
! $req_result = $line[3];
! $req_bytes = 0;
! $req_bytes = $line[4] if $line[4] =~ /^[0-9]+$/;
! # $req_object = $line[5];
! }
$lastrecord = $req_date;
if(!$firstrecord) {
$firstrecord = $req_date;

Now to test things, by rerunning apt-cacher:

# /etc/cron.daily/apt-cacher
...this takes a while (~5 min)...

And then I browsed to http://localhost:3142/report/ and now I see an updated report:


Item Value
Report generated 2009-03-13 17:04:50
Administrator root@localhost
First request Thu Oct 30 22:01:39 2008
Last request Fri Mar 13 16:46:42 2009
Total requests 37119
Total traffic 11.487 GB

cache efficiency

Cache hitsCache missesTotal
Requests 24007 (64.67%)13112 (35.32%)37119
Transfers 8.018 GB (69.8%)3.468 GB (30.19%)11.487 GB

If anyone knows where I should submit this patch to, please drop me a comment.

Saturday, March 7, 2009

Fixing MythTV Database: Table './mythconverg/credits' is marked as crashed

My MythTV box became unresponsive earlier this week, prompting a power cycle. It seemed to come back up OK, except a cron job was spitting out the following email every 10 minutes:
DBD::mysql::st execute failed: Table './mythconverg/credits' is marked as crashed and last (automatic?) repair failed at /usr/share/perl5/MythTV/ line 195.
DBD::mysql::st fetchrow_array failed: fetch() without execute() at /usr/share/perl5/MythTV/ line 196.
I tried backing up the database manually and got a similar error:
warning : Table is marked as crashed and last repair failed
warning : 1 client is using or hasn't closed the table properly
error : Found 123809 keys of 124267
error : Corrupt
mysqldump: Got error: 144: Table './mythconverg/credits' is marked as crashed and last (automatic?) repair failed when using LOCK TABLES
Using google turned up the solution. But I didn't find the script where the poster indicated. I did find it elsewhere, copied it over and set permissions on it:
# mkdir /usr/share/mythtv/contrib
# cp /usr/share/doc/mythtv-backend/contrib/ /usr/share/mythtv/contrib
# chmod 755 /usr/share/mythtv/contrib/
At this point I was able to run the script as the poster indicated:
# /usr/share/mythtv/contrib/
Repaired/Optimized: `mythconverg`.`archiveitems`
Analyzed: `mythconverg`.`archiveitems`
Now the backup script ran cleanly:
# /etc/cron.weekly/mythtv-database
The last thing I did, as the comments in the script suggest, was add the script to the daily anacron list (update March 15, 2009: anacron apparently doesn't run scripts with a .pl suffix, so need to link this to a filename without the suffix):
# ln -s /usr/share/mythtv/contrib/ /etc/cron.daily/optimize_mythdb

Saturday, February 14, 2009

Multumedia volume keys not working...

Ever since I messed around with sound to get Skype and my USB headset working, my multimedia keys on the front of my laptop hadn't been working. The on-screen graphic would appear but nothing I did actually effected playback volume, basically exactly as this page described it:
If after assigning as described above, your VolumeUp/VolumeDown/Mute keys seem to work (i.e. you see a popup window with a slider in the middle of the screen that reacts on those key presses), but the playback volume actually remains unchanged, you may also have to setup what mixer tracks (channels) these keys should be bound to. Refer to this section below.
So, following the advice in the section referred to I opened System/Preferences/Sound and on the Device Tab I found the selectino for Default Mixer Tracks. It was set to "Logitech USB Headset (Alsa mixer)", I changed it to "Capture: ALSA PCM on front:0 (Intel ICH6) via DMA (PluseAudio Mix..." and now all works well.

Saturday, February 7, 2009

Installing Apache and PHP on my Ubuntu laptop and configuring a virtual host

I wanted to do some web development, so here's the process I used to install apache w/php and configure a virtual host on my Ubuntu laptop.

First, I followed these old directions as a starting point for installing Apache and php. But I found that the extra repositories were already added, Apache was already installed and after installing php5, libapach2-mod-php5 was already install, so all I really had to was:

# apt-get install php5
I test php functionality by creating a quick test file:
# vi /var/www/test.php
# cat /var/www/test.php
And pointing my browser at http://localhost/test.php and seeing "Hello World".

On thing I noticed is that I was getting the following error when restarting:
# apache2ctl restart
apache2: Could not reliably determine the server's fully qualified domain name, using for ServerName
I fixed this by adding a ServerName directive to the Apache configuration (I actually don't think it matters what name you give):
# vi /etc/apache2/apache2.conf
# grep ServerName /etc/apache2/apache2.conf
ServerName localhost
Now, to install the virtual host so that I can test using code in my home directory. There are a number of sites out there if you google "apache vhost" and I didn't find any particularly good, so here is what I did.

For the sake of these directions, I'm going to use the name and I'm going to put the name into /etc/hosts. This will allow me to see things exactly as they will appear on the live web site.

First I edit /etc/hosts and add an entry for the vhost:
# vi /etc/hosts
# tail -1 /etc/hosts
Now it's time to edit the apache configuration:

# vi /etc/apache2/sites-available/myvhost.conf
# cat /etc/apache2/sites-available/myvhost.conf

DocumentRoot "/path/to/vhost/directory"

<Directory /path/to/vhost/directory>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Depending on what you need to do, you may not need the block. I have some local php configuration, so I did.

Now enable the vhost:

# a2ensite myvhost.conf
Enabling site myvhost.conf.
Run '/etc/init.d/apache2 reload' to activate new configuration!# apache2ctl restart
One last snag, probably particular to how I handled my php, but I had the following .htaccess file in my vhost root:
AddHandler php-html .html
Action php-html /php/process.php
Which caused the following error whenever I tried to access the directory:
Invalid command 'Action', perhaps misspelled or defined by a module not included in the server configuration
To fix this, I enabled the actions module:
# a2enmod actions
Enabling module actions.
Run '/etc/init.d/apache2 restart' to activate new configuration!
Now, just restart Apache:
# apache2ctl restart
And point my browser at and everything worked.

Update 2/21/09: If you want to be able to run 'php' from the command-line, you should also install the php5-cli package (kudos):

# apt-get install php5-cli

Sunday, February 1, 2009

apt-cacher report not updating

Update Mar 13, 2009: I've now fixed

I noticed this morning the amounts of hits and data transferred in my apt-cacher report are not updating. See report below, the date has changed but the values in the 'cache efficiency' table have not since my original install. Something is broken some where, either I'm not using the cache or it's not reporting correctly.

Don't have time at this moment to investigate, but will update this post when I do...

Updated: I started by killing apt-cacher to verify the clients were using it...
# /etc/init.d/apt-cacher stop
Stopping Apt-Cacher: apt-cacher.
And, yes, this caused 'apt-get update' on my client to return all sorts of 'Count not connect...' errors, so I know my previous configuration was working:
# cat /etc/apt/apt.conf.d/90local-proxy
Acquire::http::Proxy "http://proxy-host:3142";

So I restarted apt-cacher ("/etc/init.d/apt-cacher start") and looked at the server side harder.

First, I checked to see if there was anything in the cache, and there was lots of stuff including new packages as of today, including wine, which is only on one of my clients and not the server, which would seem to indicate things are working as I should expect:
# grep cache_dir /etc/apt-cacher/apt-cacher.conf
# cache_dir is used to set the location of the local cache. This can

# du -s /var/cache/apt-cacher
1966256 /var/cache/apt-cacher
# ls -lt /var/cache/apt-cacher/packages | head -3
total 1947272
-rw-r--r-- 2 www-data www-data 0 2009-02-01 09:05 wine.budgetdedicated.com_apt_dists_intrepid_main_binary-i386_Packages.gz
-rw-r--r-- 2 www-data www-data 0 2009-02-01 09:03 wine.budgetdedicated.com_apt_dists_intrepid_Release

Ok, the issue would seem to be reporting. I checked relevant options in apt-cacher.conf and didn't see any issue.

# grep generate_reports /etc/apt-cacher/apt-cacher.conf
So I started looking a little harder at the apt-cacher logs and the /usr/share/apt-cacher/ script that generates the reports, and noticed a problem. Here's what a line in my logfile looks like:

# head -1 /var/log/apt-cacher/access.log
Sun Feb 1 08:22:01 2009|15927||MISS||ppa.launchpad.net_network-manager_ubuntu_dists_intrepid_Release.gpg

And here is the section of the apt-cacher/ script that parses it:

$req_date = $line[0];
# $req_ip = $line[1];
$req_result = $line[2];
$req_bytes = 0;
$req_bytes = $line[3] if $line[3] =~ /^[0-9]+$/;
# $req_object = $line[4];

If you don't understand PERl, basically there is a mismatch. The script is looking for the result (HIT or MISS) in the third column (column 2 starting from 0), but the IP address is there. It expects the number of bytes in column 4, but they are in column 2. So this would seem to be the problem, but why this discrepancy?

Update: See a later post for the fix.

Current apt-cacher report output (made narrow to fit into blow):


Item Value
Report generated 2009-02-01 09:02:18
Administrator root@localhost
First request Thu Oct 30 22:01:39 2008
Last request Sun Feb 1 08:22:05 2009
Total requests 27678
Total traffic 1980.17 MB

cache efficiency

Cache hitsCache missesTotal
Requests 2569 (9.28%)25109 (90.71%)27678
Transfers 955.718 MB (48.26%)1024.452 MB (51.73%)1980.17 MB

Saturday, January 31, 2009

Regenerating Apache SSL certificate for 10 years

I noticed the SSL certificate I had previously generated for Apache had expired, so I set about generating a new one. This time I wanted to generate a really long-lived (10 year) certificate so I didn't have to deal with this again in a year.

I started by cleaning out the old certificate (you'll get an error later if you don't do this):
# rm /etc/apache2/ssl/*
Now I edited the Openssl configuration file to bump the lifetime to 10 years (3650 days):

# cp /usr/share/ssl-cert/ssleay.cnf /usr/share/ssl-cert/ssleay.cnf.orig
# vi /usr/share/ssl-cert/ssleay.cnf
# diff -c /usr/share/ssl-cert/ssleay.cnf /usr/share/ssl-cert/ssleay.cnf.orig
*** /usr/share/ssl-cert/ssleay.cnf 2009-01-31 13:37:24.000000000 -0600
--- /usr/share/ssl-cert/ssleay.cnf.orig 2009-01-31 13:36:58.000000000 -0600
*** 7,13 ****
[ req ]
default_bits = 1024
default_keyfile = privkey.pem
- default_days = 3650
distinguished_name = req_distinguished_name
prompt = no
policy = policy_anything
--- 7,12 ----
Now I went ahead and generated the new certificate. The hostname was already filled in, so I just had to hit return at the only prompt.

# make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem
Finally I took a peak at the generated certificate to make sure it had the 10 year lifetime. Looking at the "Not Before" and "Not After" fields in the output below shows the lifetime.
# openssl x509 -noout -text -in /etc/apache2/ssl/apache.pem
Version: 1 (0x0)
Serial Number:
Signature Algorithm: sha1WithRSAEncryption
Not Before: Jan 31 19:37:42 2009 GMT
Not After : Jan 29 19:37:42 2019 GMT
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
RSA Public Key: (1024 bit)
Modulus (1024 bit):
Exponent: 65537 (0x10001)
Signature Algorithm: sha1WithRSAEncryption

Cron-apt and reboot needed...

I've noticed that when cron-apt upgrades the kernel and I don't get around to rebooting the system that day, it will keep "reinstalling" the new kernel each night it runs until I reboot the system.

Not sure what to do about this at the moment. Guess it doesn't really hurt anything. Since there doesn't seem to be any way of automatically detecting if a reboot is needed, the only option would seem to be always reboot nightly.

Going to think about this for a while. If anyone has any suggestions, please comment away.

Kernel updates and VMWare

I've noticed every time my kernel is updated, I have to rerun '/usr/bin/' before VMWare will start. So far I've always been able to just take the default options.

MythTV and disk management

Just a quick note that I've watched MythTV manage the disk space I've allocated it and it seems to do a good job without any help from me. Logwatch sends me a daily email with the disk allocation, so I watch how MythTV handles things. I have allocated two disks partitions to MythTV, and while they are constantly almost full (with logwatch giving me the warning you see below), MythTV deletes old stuff deletes old recordings before anything becomes a problem.

--------------------- Disk Space Begin ------------------------

Filesystem Size Used Avail Use% Mounted on
/dev/sda6 183G 170G 3.0G 99% /mnt/data
/dev/sdb3 220G 203G 6.6G 97% /mnt/data2

/dev/sda6 => 99% Used. Warning. Disk Filling up.
/dev/sdb3 => 97% Used. Warning. Disk Filling up.

---------------------- Disk Space End -------------------------

Monday, January 26, 2009

Ubuntu Pocket Guide Available as a Free Download

Via Lifehacker, the Ubuntu Pocket Guide and Reference is available for free as a PDF download (or you can buy it from Amazon for ~$10).

I've given it a quick scan and it looks like a great little reference guide.

Sunday, January 25, 2009

Cloning a Ubuntu VM

I haven't yet found a good set of directions on the net for cloning a Ubuntu VM. These directions are for cloning a 8.04 Ubuntu server VM (it happens to also be running in a Ubuntu server, but these should work for any linux server).

These directions assume your VMs use static IP addresses and you want to clone an existing VM called "myvm" to a new VM called "mynewvm" with its own IP address.

Make sure "myvm" has no snapshots, as this method won't work on a VM with snapshots (the disk rename step will fail).

Also make sure you close the original VM in VMWare-Server or you may get file-locking problems.

Ok, first change to the directory where the original VM is stored and copy the directory (this will take a few minutes):
cd /usr/lib/Virtual Machines
cp -ax myvm mynewvm

Now rename the disk:
cd mynewvm
/usr/bin/vmware-vdiskmanager -n myvm.vmdk mynewvm.vmdk

Now rename the configuration file and change the name of the VM in the file:
mv myvm.vmx mynewvm.vmx
sed -i "s/myvm/mynewvm/" mynewvm.vmx

Now in VM-Ware server, select "File" then "Open" and "Browse". Select the "mynewvm" directory and the "mynewvm.vmx" file in that directory. The new VM should appear in the Inventory list.

Select the new VM and boot it. At this point it won't appear on the network. You'll need to log into the console as root and do the following:

rm /etc/udev/rules.d/70-persistent-net.rules

At this point, you could reboot the VM and it will come back up with original IP and hostname, which will cause a conflict if the original VM is also on the network, so you might just want to go ahead and do the following while you're hear:

Change the hostname by editing /etc/hostname.

Then edit /etc/network/interfaces and change the 'address' line to reflect the new IP address you want the VM to have.

Finally, etc /etc/hosts, change the line for '' to reflect the new hostname and add (probably at the end of the file, but really where ever you want) a new line for the new hostname, e.g/:  mynewvm

That should do it. Now just reboot the VM and it should come back up with the new IP and hostname.

Monday, January 19, 2009

Installing Eclipse on 8.10 Desktop

Straight forward following these directions. I already had the OpenJDK Java Runtime installed. The Eclipse download took about 30 minutes.

Sunday, January 18, 2009

Installing Skype on 8.10 Desktop and getting it to work with Logitech Headset

Installing Skype on a Ubuntu 8.10 desktop turns out to be a piece of cake, getting it to work with my Logitech USB Headset was a little harder.

Installation of Skype was easy following these directions. First, I edited /etc/apt/sources.list to include the Skype repository:

# vi /etc/apt/sources.list
# tail -3 /etc/apt/sources.list
deb stable non-free

Then I did the repository install and installed skype:
# apt-get update
# apt-get install skype

At this point Skype was installed and appeared under Applications -> Internet -> Skype

But when I tried to make a call Skype reported "Problem with Audio Playback" and nothing worked.

Long story short, these directions finally worked for me, specifically, here are the devices I used:

Sound in: Logitech USB Headset (pluhw:Headset,0)
Sound out: Logitech USB Headset (hw:Headset,0)
Ringing: Logitech USB Headset (hw:Headset,0)

During the time I worked on this problem I restarted pulseaudio, I don't know if this helped or not, but I'll mention it just in case:
# killall pulseaudio
# /etc/init.d/pulseaudio start

Following is more details on things I saw and what didn't work.

If I run System -> Preferences -> Sound, I see both ALSA and OSS versions of the Headset, but only the OSS version works (the ALSO version returns the following error when I try to test it: "audiotestsrc wave=sine freq=512 ! audioconvert ! audioresample ! gconfaudiosink: Could not open audio device for playback.")

Trying to record with Applications -> Sound & Video -> Sound Recorder does not work.

"alsamixer -c 1" showed Logitech USB Headset, but I couldn't get anything further to work.

I tried these directions but I saw the same problem others did in that when I tried to remove pulseaudio, apt-get/aptitude wanted to remove ubuntu-desktop and I stopped there.

Here is the output from a couple commands:

# cat /proc/asound/cards 
 0 [ICH6           ]: ICH4 - Intel ICH6
                      Intel ICH6 with STAC9752,53 at irq 16
 1 [Headset        ]: USB-Audio - Logitech USB Headset
                      Logitech Logitech USB Headset at usb-0000:00:1d.3-2, full speed

# cat /proc/asound/devices
  2:        : timer
  3:        : sequencer
  4: [ 0- 4]: digital audio playback
  5: [ 0- 3]: digital audio capture
  6: [ 0- 2]: digital audio capture
  7: [ 0- 1]: digital audio capture
  8: [ 0- 0]: digital audio playback
  9: [ 0- 0]: digital audio capture
 10: [ 0]   : control
 11: [ 1- 0]: digital audio playback
 12: [ 1- 0]: digital audio capture
 13: [ 1]   : control