MythBox: Connection to mythtv host failed

The system setup:
MythTV backend running on a separate machine (e.g.
XBMC MythBox plugin running on a separate computer (e.g.

This error occurs during MythBox setup, stating the following after MySQL credentials are entered: Connection to mythtv host failed: (10061..

This can be a plain MySQL error, but it can also be an error where the MySQL connection is successful but MythBox is referred back to when it tries to connect (by settings on the mythtv backend system).

– Ensure that the MySQL user can connect remotely. To test this from another computer:

$ mysql -h -u mythtv -p

If not working, check MySQL permissions for the mythtv user (make sure the host field for the user is ‘%’) and look at my.cnf (find the file with `locate my.cnf`).

From the mythtv backend:
$ mysql -u root -p
mysql> use mysql;
mysql> select * from user where user = 'mythtv';

* If MySQL is working, ensure that the MythTV backend is setup properly.

Run mythtv-setup
Go General -> IP Address
Set both IP addresses to the external IP of the machine you are connecting to from XBMC (setting only Local Backend to an external address did not work).


KDE 4: Turning off desktop switch via scroll wheel

There seems to be an kerfuffle with the layout of KDE settings. The option for this is not in the main ‘System Settings,’ but in another area entirely, named ‘Desktop Settings,’ which can be found by going to:

(From the desktop)

Right click -> Desktop Settings -> Mouse Actions

Click the minus sign by Middle-Scroll to delete it. Then click Apply.

Enabling webGL with Fedora 16

In Fedora 16, detection of WebGL fails for some reason (I haven’t looked into this too throughly).

What worked for me was to visit (in Google Chrome):


I then enabled “Override software rendering list” and clicked the restart button at the bottom left.

WebGL worked without a hitch (i’m using a Sapphire ATI 6850 graphics card if it matters).

Increasing the size of a LUKS cryptfs partition

Warning: This guide assumes that the partition you’re expanding into is adjacent to a pool of free space. Things get a bit trickier if that isn’t the case (re-arranging your partitions is probably necessary).

The system that I performed this on: Fedora 16 KDE install, on a 120GB SSD installation (migrated from an 80GB SSD using Acronis True Image). Fedora doesn’t set encryption up via LVM in the installer, seemingly opting for a plain vanilla container.

Step 0: Boot into a live CD environment. I used a Fedora 16 KDE respin CD which had all these tools. Open a console (in KDE this was `konsole`).

Step 1: Blow away the partition itself. You’ll need to do this with `fdisk`. Make a new partition, with the cluster of free space included. Select Linux for type when prompted (usually 82 OR 83). Write changes to disk.

Step 2: Open your crypted filesystem:

# Replace /dev/sda2 with your own filesystem

# cryptsetup luksOpen /dev/sda2 root 

Step 3: Expand the crypted FS

# cryptsetup resize root

# e2fsck -f /dev/mapper/root

# resize2fs -p /dev/mapper/root

Step 4: Safety hat

# cryptsetup luksClose root

# sync; sync; reboot

Including one package in a yum repository

Yum can be surprisingly simple and frustrating at once. To add only one package from a repository you can do the following.

In the yum configuration file for the repository (normally this is /etc/yum.repos.d/$repository.repo).


You can also glob to include all packages of that type, such as:


Save the file, and search/install new packages. Yum will only see packages of “vlc” and nothing else.

If you are looking to do the opposite, the keyword is `exclude`. To exclude all rpms from a repository for instance:


Don’t add both exclude and includepkgs together without careful consideration.

opsview and notifications

To send a notification to an external party in opsview (3.13.1) there are a few things to do:

1. Attach keywords in the host configuration to that particular host (unique no, spaces, special characters, underscores are okay).
2. Setup a new role (with the NOTIFYSOME permission, which is vaguely documented) + check off the ‘all’ box in the keywords permission section.
3. Add a contact with an e-mail address.
4. Add a notification profile attached to that e-mail address, with specific keywords to notify on checked off.
5. In the keywords section, click to flag all services with the specified keyword (otherwise no notifications will appear).

For the lazies (which means pretty much every systems administrator out there) there is, (thankfully) a *full* REST API with JSON built into opsview (unlike some of the other Nagios derivatives). More on that later hopefully.

Nagios + DNX

Are you getting messages that look like this in /var/log/messages?

nagios nagios: Error: Could not load module ‘/usr/lib/’ -> /var/nagios/spool/checkresults/nebmodyMUyCP: undefined symbol: service_result_buffer

Make sure that you have configured things properly if you’re using Nagios 3.x+:
./configure –with-nagios3x

Then run:
make install-server

And more importantly:
make install-cfg

Then edit your main nagios configuration to include the as an event broker, and turn on event brokering.

You should hopefully get:
nagios[5991]: Event broker module ‘/usr/lib/’ initialized successfully.

Converting GRUB entries (Linux)

GRUB device entries are interesting. They’re nothing like what’d you see in Linux or otherwise, and one could wonder what kind of voodoo goes on in the back-end to map GRUB entries to /dev/hda1..2..3.. and so forth.

When I started using GRUB, I used tab completion, and I was fortunately blessed by some sort of Linux/Unix voodoo that i’d usually get things right. Up until now, I used the guess what partition it is game for when things didn’t work out so well.

Thanks to a comment posted here, the naming scheme became more apparent. And so did a simple script I was able to hack up in less than 5 minutes time*. It is far from perfect (and i’m not a real expert in Ruby, i’m just a poser–honest), but here it is:

#!/usr/bin/ruby -w

class GrubConvert
	def initialize(basedir,device,subletter,number)
		@lookup = { 'a' => '0', 'b' => '1', 'c' => '2', 'd' => '3', 'e' => '4', 
'f' => '5', 'g' => '6', 'h' => '7', 'i' => '8', 'j' => '9', 'k' => '10', 'l' => '11', 
'm' => '12', 'n' => '13', 'o' => '14', 'p' => '15', 'q' => '16', 'r' => '17', 
's' => '18', 't' => '19', 'u' => '20', 'v' => '21', 'w' => '22', 'x' => '23', 
'y' => '24', 'z' => '25' }	
		@basedir = basedir
		@device = device
		@subletter = subletter
		@number = number

	def convert_to_grub
		first_g_number = @lookup[@subletter]	
		second_g_number = @number.to_i - 1
		puts "(#{@device}#{first_g_number},#{second_g_number})"

	def convert_to_drive
		sub_num_to_l = @lookup.index(@subletter)
		second_g_number = @number.to_i + 1
		puts "#{@basedir}#{@device}#{sub_num_to_l}#{second_g_number}"

if ARGV[0] =~ /(.*)\/(..)(.)(.*)/ 
	entry =$1,$2,$3,$4)
elsif ARGV[0] =~ /(..)(.),(.)/ # the cmd line arg may need to be quoted
	todrive ='/dev/',$1,$2,$3)
	puts "Is that really a disk drive? (couldn't find out if what you entered: 
#{ARGV[0]} matched a disk device)"

* This also means that it hasn’t been throughly checked and flogged of bugs and/or appearances.

Dual booting between Windows and Linux (on separate hard disks)

My personal desktop system is comprised of two separate operating systems. I dual boot between these.
Note, depending on how GRUB is configured on your system, your configuration file might be menu.lst, or grub.conf. These files are normally located in /boot, and are the ones that need to be edited for this guide.

2x 160 GB Seagate Barracuda Hard Disks in a software RAID-1 setup for Ubuntu Linux.
1x 80GB Western Digital Special Edition Hard Disk for Windows XP Media Center Edition.

Windows has its own bootloader called NTLDR that it uses.
Linux by today’s standards will use GRUB (instead of LILO).

There is no need to replace NTLDR at all. Some have even gotten NTLDR to boot Linux by copying off the first 512 bytes off of their Linux partition. There have also been some reports of problems with people who replace NTLDR and have complaining virus scanners. So its probably a good idea to leave it intact and alone.

We’ll cover GRUB here, since a lot of people like using it to boot.

Normally, dual booting is very simple if you have both Linux and Windows on the same disk (you simply specify the options in /boot/grub/menu.lst as such):

# The normal way to do it with Windows on the same disk
title Microsoft Windows XP
root (hd0,1)
chainloader +1

Where hd0 (/dev/sda) is the disk (you have to guess — more on that in a minute), and partition 2 (which is /dev/sda2 in `fdisk -l`).

It is a little different when you have Windows on a separate disk alltogether. My hard disks were setup as follows.

IDE Channel 0:
Seagate 160GB (Master)
Seagate 160GB (Slave)

IDE Channel 1:
CD/DVD Drive (Master)
Western Digital 80GB (Slave)

Now, GRUB numberings (hdX,X), are very different than what you will see in `fdisk -l`. I spent quite a bit of time wondering why (hd2,0) wouldn’t boot into Windows.

Update: Don’t want to go through the pain of partition hunt and peck? Try some of this Ruby code.

To figure out which one is your Windows partition, go through on the GRUB menu (by rebooting) and get a `c`ommand shell.
Try root(hd0,0) incrementing all the way up to 7 (hd0,1) (hd0,2) (hd0,3)..and see if you get something on the lines of “unknown, partition type 0x7.”

If you don’t, move on to the next disk until you get it, or an error message telling you that the disk doesn’t exist. (hd1,0) (hd1,1)..

When you get a partition type of 0x7, thats Windows NTFS.

The rest from here is simple. Windows will need be told that it is on the master hard disk, so that Windows will work properly (there are some reports of problems without this for some reason).

This is fairly easy in GRUB. Insert the following:

# For Windows thats on another disk
# (Replace ‘(hd1)’ with the drive that Windows is on for you)
# You may also want to put this at the bottom, since some automated grub editors will overwrite this entry when they’re used
title Windows XP
map (hd0) (hd1)
map (hd1) (hd0)
chainloader (hd1,0)+1

Save, and reboot.

Parts derived from and other sources.

How to fix FATAL ERROR: Bad primary partition 1: Partition ends in the final partial cylinder

This came up with the Lexar Jumpdrive that I was attempting to re-partition. According to sources round the net, the partition tables might have been overlapping.

Here is the error in its full context (if you didn’t catch the title):
FATAL ERROR: Bad primary partition 1: Partition ends in the final partial cylinder

The solution is to first blow away all the partitions, write, (reboot is advised if you’re asked to reboot to see changes to the table), then create your new partitions over it.

Update: Just to add some more detail to this process.. This was done entirely in Linux. Since cfdisk (curses fdisk program) bombs out without allowing you to edit your partitions, you’ll need to edit the usb drive’s partitions by using ol’ fdisk.

Its not that bad once you get used to it. Start it as you would with cfdisk (`fdisk /dev/usb_drive`), hit the help menu, get a printout of all the partitions, delete the partitions (using the help menu again), and then write the partition table to the usb drive.

Reboot if it asks. You should be able to re-partition normally after this.